edit-api-licheb-edit-status

This commit is contained in:
lccsw
2021-09-01 10:36:23 +08:00
parent e5c01188fc
commit 82da6d5ecb
4 changed files with 29 additions and 8 deletions
+1
View File
@@ -39,6 +39,7 @@ class Order extends Wxapp{
];
if($type){
$where['status'] = $type;
$type == 1 && $where['status_detail'] = 11;
}
$fileds = 'id,sid,item_title,total_price,jsondata,status,status_detail,type';
$rows = $this->order_purchase_model->select($where,'id desc',$page,$size,$fileds);
+17 -3
View File
@@ -23,6 +23,8 @@ class Cusorder extends Wxapp{
$this->load->model('receiver/order/receiver_order_signs_model','order_signs_model');
$this->load->model('receiver/order/receiver_order_bills_model','order_bills_model');
$this->load->model('receiver/order/receiver_order_deliverys_model','order_deliverys_model');
$this->load->model('receiver/order/receiver_order_ckcars_model','order_ckcars_model');
$this->load->model('receiver/order/receiver_order_contracts_model','order_contracts_model');
$this->load->model('receiver/receiver_services_model','services_model');
$this->load->model('receiver/receiver_service_package_model','package_model');
@@ -30,6 +32,7 @@ class Cusorder extends Wxapp{
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_attr_model');
$this->load->model('apporder/order_purchase_model');
}
protected function get(){
@@ -151,10 +154,13 @@ class Cusorder extends Wxapp{
$up_data = [];
if(strlen($payway)|| $pack_id){
if($row['status']>0){
throw new Exception('修改失败,已签订合同', ERR_PARAMS_ERROR);
if(strlen($payway)){ //修改付款类型
$pay_order = $this->order_purchase_model->count(['app_id'=>1,'type in (5,6)'=>null,'status>'=>1,'item_id'=>$id]);
if($pay_order){
throw new Exception('修改失败,已付款', ERR_PARAMS_ERROR);
}
$up_data['payway'] = $payway;
}
strlen($payway) && $up_data['payway'] = $payway;
$pack_id && $up_data['pack_id'] = $pack_id;
}
if($up_data){
@@ -162,6 +168,14 @@ class Cusorder extends Wxapp{
}
if($result){
if(strlen($payway)){
//过期未支付订单
$res = $this->order_purchase_model->update(['status_detail'=>13],['app_id'=>1,'type in (5,6)'=>null,'status'=>1,'item_id'=>$id]);
$this->order_ckcars_model->update(['status'=>1],['o_id'=>$id]);
$this->orders_model->update(['status'=>0],['id'=>$id]);
$this->order_contracts_model->delete(['o_id'=>$id]);
$this->order_signs_model->update(['status'=>0],['o_id'=>$id]);
}
throw new Exception('修改成功', API_CODE_SUCCESS);
}else{
throw new Exception('修改失败', ERR_PARAMS_ERROR);
+10 -4
View File
@@ -62,7 +62,8 @@ class Orders_entity{
}
$customers = $this->ci->customers_model->get(['id'=>$row['rid']],'rid');
$ifpay = false;
if($customers['rid']){ //判断线索是否支付定金
$ifpay = $this->ci->order_purchase_model->count(['status>'=>1,'item_id'=>$oid,'app_id',$app_id,'app_uid'=>$userinfo['uid']]);
if($customers['rid'] && !$ifpay){ //判断线索是否支付定金
$ifpay = $this->ci->order_purchase_model->count(['type'=>3,'status'=>2,'cf_id'=>$customers['rid'],'app_id'=>$app_id,'app_uid'=>$userinfo['uid']]);
}
if($ifpay){
@@ -74,9 +75,14 @@ class Orders_entity{
$status = 1;
$this->ci->load->model('receiver/order/receiver_order_loans_model','next_model');
}
$res = $this->ci->orders_model->update(['status'=>$status],['id'=>$row['id']]);
if($res){
$this->ci->next_model->add(['o_id'=>$row['id'],'c_time'=>time()]);
//判断下一步是否存在
if(!$this->ci->next_model->get(['o_id'=>$row['id']])){
$res = $this->ci->orders_model->update(['status'=>$status],['id'=>$row['id']]);
if($res){
$this->ci->next_model->add(['o_id'=>$row['id'],'c_time'=>time()]);
}
}else{
$res = $this->ci->orders_model->update(['status'=>2],['id'=>$row['id']]);
}
}else{
$this->ci->signs_model->update(['status'=>1],['o_id'=>$row['id']]);
+1 -1
View File
@@ -100,7 +100,7 @@ class Payment_service extends HD_Service{
$pay_price && $upd['pay_price'] = $pay_price;
$res = $this->purchase_model->update($upd,array('id'=>$order['id']));
if($res){
$nopay = $this->purchase_model->count(['app_id'=>$this->app_id,'cf_id'=>$order['item_id'],'type in (5,6)'=>null,'status'=>1]); //未支付的尾款或者服务费
$nopay = $this->purchase_model->count(['app_id'=>$this->app_id,'cf_id'=>$order['item_id'],'type in (5,6)'=>null,'status'=>1,'status_detail'=>11]); //未支付的尾款或者服务费
if(!$nopay){
//更新订单状态
$row = $this->orders_model->get(['id'=>$order['item_id']]);