|
@@ -63,14 +63,15 @@ class Order extends Base
|
|
return error_show(1004,"参数num 不能为空或0");
|
|
return error_show(1004,"参数num 不能为空或0");
|
|
}
|
|
}
|
|
$id = isset($this->post['unit_id'])&&$this->post['unit_id']!=""? intval($this->post['unit_id']): "";
|
|
$id = isset($this->post['unit_id'])&&$this->post['unit_id']!=""? intval($this->post['unit_id']): "";
|
|
- if($id){
|
|
|
|
|
|
+ if($id==""){
|
|
return error_show(1004,"unit_id不能为空");
|
|
return error_show(1004,"unit_id不能为空");
|
|
}
|
|
}
|
|
|
|
+
|
|
$kg= Db::name('unit')->where(["is_del" => 0,"id"=>$id,"status"=>1])->field("id,name,weight")->find();
|
|
$kg= Db::name('unit')->where(["is_del" => 0,"id"=>$id,"status"=>1])->field("id,name,weight")->find();
|
|
|
|
+ // var_dump(Db::name('unit')->where(["is_del" => 0,"id"=>$id,"status"=>1])->getLastSql());
|
|
if(empty($kg)){
|
|
if(empty($kg)){
|
|
return error_show(1004,"单位不能为空");
|
|
return error_show(1004,"单位不能为空");
|
|
}
|
|
}
|
|
-
|
|
|
|
$count=$num*$kg['weight'];
|
|
$count=$num*$kg['weight'];
|
|
if($count==""){
|
|
if($count==""){
|
|
return error_show(1004,"购买数量不能为空");
|
|
return error_show(1004,"购买数量不能为空");
|
|
@@ -95,6 +96,8 @@ class Order extends Base
|
|
"order_sn"=>$ordersn,
|
|
"order_sn"=>$ordersn,
|
|
"accountid"=>$this->userinfo['id'],
|
|
"accountid"=>$this->userinfo['id'],
|
|
"order_num"=>$num,
|
|
"order_num"=>$num,
|
|
|
|
+ "unit"=>$kg['name'],
|
|
|
|
+ "unit_weight"=>$kg['weight'],
|
|
"is_del"=>0,
|
|
"is_del"=>0,
|
|
"status"=>1,
|
|
"status"=>1,
|
|
"addtime"=>date("Y-m-d H:i:s"),
|
|
"addtime"=>date("Y-m-d H:i:s"),
|