edit-api-add_order_limit2

This commit is contained in:
lccsw
2022-04-07 17:49:46 +08:00
parent d003edd18a
commit d0dc2e69ba
+17 -5
View File
@@ -103,7 +103,7 @@ class CusorderV2 extends Wxapp{
//同个品牌一个身份证只能下一单
$where = [
'brand_id' => $series_row['brand_id'],
"JSON_EXTRACT(info_json,'$.c_cardid')='{$cardid}'" => null,
"JSON_EXTRACT(info_json,'$.c_owner_cardid')='{$owner_cardid}'" => null,
'status>=' => 0
];
if($this->orders_model->count($where)){
@@ -247,9 +247,9 @@ class CusorderV2 extends Wxapp{
throw new Exception('请填写公司信息', ERR_PARAMS_ERROR);
}
}else{
if( !$cardid || !$owner_name || !$owner_mobile || !$owner_cardid){
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
if( !$cardid || !$owner_name || !$owner_mobile || !$owner_cardid){
throw new Exception('参数错误', ERR_PARAMS_ERROR);
}
}
$row = $this->customers_model->get(['id'=>$cus_id]);
if($inten_money > 2000){
@@ -345,6 +345,19 @@ class CusorderV2 extends Wxapp{
}
}
$info_json = json_decode($row['info_json'],true);
if(!$main_type){//个人
//同个品牌一个身份证只能下一单
$where = [
'brand_id' => $series_row['brand_id'],
"JSON_EXTRACT(info_json,'$.c_owner_cardid')='{$info_json['c_owner_cardid']}'" => null,
'status>=' => 0,
'id!=' => $id,
];
if($this->orders_model->count($where)){
throw new Exception('一个客户只能享受一次国补,请联系管理员', ERR_PARAMS_ERROR);
}
}
$data = [
'brand_id' => $series_row['brand_id'],
's_id' => $series_row['id'],
@@ -393,7 +406,6 @@ class CusorderV2 extends Wxapp{
}
}
$data['money_json'] = json_encode($money_json,JSON_UNESCAPED_UNICODE);
$info_json = json_decode($row['info_json'],true);
$info_json['business_id'] = $business_id;
$data['info_json'] = json_encode($info_json,JSON_UNESCAPED_UNICODE);
$result = $this->orders_model->update($data,['id'=>$row['id']]);