From a97d8cf30042fe559d056cd3311d79fb2f121c0c Mon Sep 17 00:00:00 2001 From: lcc <1127794702@qq.com> Date: Thu, 8 Aug 2024 10:36:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=8A=B6=E6=80=81=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/controllers/wxapp/licheb/OpenApi.php | 47 ++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/api/controllers/wxapp/licheb/OpenApi.php b/api/controllers/wxapp/licheb/OpenApi.php index abe6ba69..cec4e766 100644 --- a/api/controllers/wxapp/licheb/OpenApi.php +++ b/api/controllers/wxapp/licheb/OpenApi.php @@ -17,6 +17,7 @@ class OpenApi extends Wxapp $this->load->model('receiver/receiver_clues_model', 'clues_model'); $this->load->model('receiver/receiver_customers_model', 'customers_model'); $this->load->model("biz/biz_model"); + $this->load->model('receiver/order/receiver_orders_model', 'orders_model'); $this->load->library('receiver/clues_entity'); $this->load->library('receiver/customers_entity'); } @@ -108,4 +109,50 @@ class OpenApi extends Wxapp return false; } } + + public function post_status() + { + $status_map = [ + 0 => ['title' => '待确认', 'list' => [0 => '清洗中', 1 => '已派发']], + 1 => ['title' => '已成交'], + 2 => ['title' => '无效'] + ]; + $out_ids = $this->input_param('out_ids'); + $cf_platform = $this->input_param('cf_platform'); + if (!$out_ids) { + throw new Exception('参数错误', API_CODE_FAIL); + } + $out_id_array = explode(',', $out_ids); + $lists = []; + if ($out_id_array) { + $ids = implode(',', $out_id_array); + $where = [ + "out_id in ({$ids})" => null, + 'cf_platform' => $cf_platform, + ]; + $rows = $this->clues_model->select($where, '', 1, 2000, 'id,out_id,name,status,status2'); + foreach ($rows as $item) { + $status2 = $status = 0; + $customersRow = $this->customers_model->get(['rid' => $item['id']]); + if ($customersRow) { + $status2 = 1; + } + if ($this->orders_model->get(['clue_id' => $item['id']])) { + $status = 1; + } + if ($item['status'] == 3) { + $status = 2; + } + $lists[$item['out_id']] = [ + 'id' => $item['id'], + 'out_id' => $item['out_id'], + 'status' => $status, + 'status2' => $status2, + 'status_cn' => $status_map[$status]['title'], + 'status2_cn' => $status_map[$status]['list'][$status2] ?: '' + ]; + } + } + return ['list' => $lists]; + } }