From 10e8e9218d33639acf5154ebb5a987dd636fb130 Mon Sep 17 00:00:00 2001 From: lccsw <805383944@qq.com> Date: Wed, 27 Apr 2022 17:30:11 +0800 Subject: [PATCH] edit-api-pay_up_customer --- admin/controllers/receiver/orderv2/Orders.php | 2 ++ api/controllers/wxapp/liche/Wxnotify_v3.php | 5 ++++- common/services/apporder/Payment_service.php | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/admin/controllers/receiver/orderv2/Orders.php b/admin/controllers/receiver/orderv2/Orders.php index 38e05189..b6428fb7 100644 --- a/admin/controllers/receiver/orderv2/Orders.php +++ b/admin/controllers/receiver/orderv2/Orders.php @@ -768,6 +768,8 @@ class Orders extends HD_Controller if($row['order_time'] == '0000-00-00 00:00:00'){ //更新下定时间 $this->receiver_orders_v2_model->update(['order_time' => date('Y-m-d H:i:s',strtotime($pay_time))], ['id' => $row['id']]); } + //更新客户为订单客户 + $this->customers_model->update(['status'=>2],['id'=>$row['customer_id']]); return $this->show_json(SYS_CODE_SUCCESS, '保存成功'); } diff --git a/api/controllers/wxapp/liche/Wxnotify_v3.php b/api/controllers/wxapp/liche/Wxnotify_v3.php index 01642cf6..3395af0c 100644 --- a/api/controllers/wxapp/liche/Wxnotify_v3.php +++ b/api/controllers/wxapp/liche/Wxnotify_v3.php @@ -21,6 +21,7 @@ class Wxnotify_v3 extends CI_Controller{ $this->load->model('app/liche/app_liche_orders_model'); $this->load->model('receiver/order/receiver_orders_model'); + $this->load->model('receiver/receiver_customers_model','customers_model'); $this->load->library('receiver/orders_v2_entity'); $this->load->library('qyrobot'); @@ -137,11 +138,11 @@ class Wxnotify_v3 extends CI_Controller{ }else{ $result = $this->payment_service->after_pay_liche($sid,$result['data']['amount']['payer_total']/100); if($result['code']){ + $receiver_order = $this->receiver_orders_model->get(['id'=>$order['o_id']]); $is_ts = false; if($order['type']==1){ //定金 $is_ts = true; }elseif($order['type']==4){ //意向金 - $receiver_order = $this->receiver_orders_model->get(['id'=>$order['o_id']]); if($receiver_order['deposit'] == $order['total_price']){ $is_ts = true; } @@ -150,6 +151,8 @@ class Wxnotify_v3 extends CI_Controller{ $robot_res = $this->qyrobot->deposit_notify($order['o_id']); debug_log("[info] ". __FUNCTION__ . ":推送企业微信群 ".json_encode($robot_res,JSON_UNESCAPED_UNICODE), $this->log_file,$this->log_dir); } + //更新客户为订单客户 + $this->customers_model->update(['status'=>2],['id'=>$receiver_order['rid']]); debug_log("[success] ". __FUNCTION__ . ":操作成功", $this->log_file,$this->log_dir); }else{ debug_log("[error] ". __FUNCTION__ . ":".$result['msg'], $this->log_file,$this->log_dir); diff --git a/common/services/apporder/Payment_service.php b/common/services/apporder/Payment_service.php index c24480bb..152a6937 100644 --- a/common/services/apporder/Payment_service.php +++ b/common/services/apporder/Payment_service.php @@ -301,6 +301,9 @@ class Payment_service extends HD_Service{ if($need_pay_money && $is_pay['total_price']>=$need_pay_money){ //完成支付 $this->orders_status_entity->set_status($order['o_id'],0,2); } + //更新客户为订单客户 + $order = $this->receiver_orders_v2_model->get(['id' => $order['o_id']],'customer_id'); + $this->customers_model->update(['status'=>2],['id'=>$order['customer_id']]); return array('code'=>1,'msg'=>'操作成功'); }else{ return array('code'=>0,'msg'=>'更新失败');