String[] price = getParaValues("price");
//用于判断规格是否有重复值的标记
boolean flag=false;
for (int i = 0; i < spec_name.length; i++) {
String temp=spec_name[i];
int count=0;
for (int j = 0; j < spec_name.length; j++) {
String temp2=spec_name[j];
//有重复值就count+1
if(temp.equals(temp2)){
count++;
}
}
//由于中间又一次会跟自己本身比较所以这里要判断count>=2
if(count>=2){
flag=true;
}
}
if(flag){
renderFail("规格不可以重复");
}else{
service.update(commodity, spec_name, price);
this.renderJson(200, " 修改成功!");
}
}