增加状态查询接口
This commit is contained in:
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user