更新联营sku库存

parent 2dcb3ba5
...@@ -931,7 +931,7 @@ function checkFloat($str){ ...@@ -931,7 +931,7 @@ function checkFloat($str){
/* /*
* 判断大于0 多少位小数 * 判断大于0 多少位小数
*/ */
function checkFloatInt($number,$w = 2,$type = 1){ function checkFloatInt($number,$w = 2){
if (preg_match('/^[0-9]+(.[0-9]{1,'.$w.'})?$/', $number)) { if (preg_match('/^[0-9]+(.[0-9]{1,'.$w.'})?$/', $number)) {
return true; return true;
}else{ }else{
......
...@@ -97,6 +97,7 @@ class ServerFoostoneModel ...@@ -97,6 +97,7 @@ class ServerFoostoneModel
] ]
*/ */
public function comSkuEdit($data,$type =1){ public function comSkuEdit($data,$type =1){
if (empty(@$data['goods_id'])) return [1001,'商品id必填']; if (empty(@$data['goods_id'])) return [1001,'商品id必填'];
$tdata['goods_id'] = $data['goods_id']; $tdata['goods_id'] = $data['goods_id'];
$stock = @$data['stock']; $stock = @$data['stock'];
...@@ -127,17 +128,19 @@ class ServerFoostoneModel ...@@ -127,17 +128,19 @@ class ServerFoostoneModel
]); ]);
} }
foreach ($price_cn as $a=>$b){ foreach ($price_cn as $a=>$b){
if (empty($b)) continue; if ($b == '0') return [1007,"国内含税价填写不对:".$b];
if (!checkFloatInt($b,5,2)) return [1007,"国内含税价填写不对:".$b]; if ($b === "") continue;
if (!checkFloatInt($b,5)) return [1007,"国内含税价填写不对:".$b];
} }
foreach ($purchases as $c=>$d){ foreach ($price_us as $c=>$d){
if (empty($d)) continue; if ($d == '0') return [1008,"香港含税价填写不对:".$d];
if (!checkFloatInt($d,5,2)) return [1007,"国内含税价填写不对:".$d]; if ($d === "") continue;
if (!checkFloatInt($d,5)) return [1008,"香港含税价填写不对:".$d];
} }
$tdata['ladder_price'] = $ladder_price; $tdata['ladder_price'] = $ladder_price;
} }
$res = $this->push('/yunxin/api/pool/sku/edit',$tdata,$type); $res = $this->push('/yunxin/api/pool/sku/edit',$tdata,$type);
return [$res['code'],$res['errmsg']]; return [$res['code'],$res['errmsg']];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment