确认派单
diff --git a/agent/admin/controllers/pingan/receiver/Customer.php b/agent/admin/controllers/pingan/receiver/Customer.php
index 08424a1c..ca6daa95 100644
--- a/agent/admin/controllers/pingan/receiver/Customer.php
+++ b/agent/admin/controllers/pingan/receiver/Customer.php
@@ -83,7 +83,7 @@ class Customer extends BaseController
if ($orderSubsidy) {
$checkStatus = Receiver_order_subsidy_model::IF_CHECK_STATUS[$orderSubsidy['ifcheck']] ?: '';
}
- $isUnlock = $val['un_lock'] ? '已解锁' : '未解锁';
+ $isUnlock = Receiver_customers_model::LOCK_LIST[$val['un_lock']];
$temp = [
'cluesSid' => $cluesRow['sid'],
'cid' => $val['cid'],
diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php
index 9403dcba..24d5991e 100644
--- a/api/controllers/wxapp/licheb/Customers.php
+++ b/api/controllers/wxapp/licheb/Customers.php
@@ -33,6 +33,7 @@ class Customers extends Wxapp
$this->load->model('auto/auto_brand_model');
$this->load->model("biz/biz_model");
$this->load->library('receiver/customers_entity');
+ $this->load->library('receiver/clues_entity');
$this->load->model('app/paic/app_paic_users_model');
$this->biz_id = $this->get_biz_id();
}
@@ -851,7 +852,7 @@ class Customers extends Wxapp
if ($status == 1000) {
$where['rid>'] = 0;
$where['un_lock'] = 0;
- $where['rec_time>'] = date('Y-m-d H:i:s');
+// $where['rec_time>'] = date('Y-m-d H:i:s');
$status = 0;
$show_log = true;
} else {
@@ -1545,11 +1546,45 @@ class Customers extends Wxapp
protected function put_unlock()
{
$id = $this->input_param('id');
- /** @var MyResponse $result */
- $result = $this->customers_model->unlock($id, $this->biz_id);
- if (!$result->isSuccess()) {
- throw new Exception($result->getMessage(), API_CODE_FAIL);
+ $unlock = $this->input_param('unlock');
+ $reason = $this->input_param('reason');
+ if ($unlock) { //不解锁
+ if (!$reason) {
+ throw new Exception('请选择不解锁理由', ERR_PARAMS_ERROR);
+ }
+ $row = $this->customers_model->get(['id' => $id, 'biz_id' => $this->biz_id]);
+ if (!$row) {
+ throw new Exception('数据不存在');
+ }
+ $res = $this->customers_model->update(['un_lock' => Receiver_customers_model::LOCK_STATUS_2], ['id' => $id]);
+ if (!$res) {
+ throw new Exception('保存失败', ERR_PARAMS_ERROR);
+ }
+ //添加线索和和客户记录
+ $uname = $this->session['uname'];
+ $content = "不解锁,理由为【{$reason}】";
+ $this->customers_entity->add_log($id, $this->session['uid'], $uname, $content);
+ if ($row['rid']) {
+ $this->clues_entity->add_log($row['rid'], $this->session['uid'], $uname, $content);
+ }
+ throw new Exception('保存成功', API_CODE_SUCCESS);
+ } else {
+ /** @var MyResponse $result */
+ $result = $this->customers_model->unlock($id, $this->biz_id);
+ if (!$result->isSuccess()) {
+ throw new Exception($result->getMessage(), API_CODE_FAIL);
+ }
+ throw new Exception('解锁成功', API_CODE_SUCCESS);
}
- throw new Exception('解锁成功', API_CODE_SUCCESS);
+
+ }
+
+ /**
+ * 线索不解锁理由
+ * @return string[]
+ */
+ protected function get_lockReason()
+ {
+ return Receiver_customers_model::LOCK_REASON;
}
}
diff --git a/api/controllers/wxapp/licheb/User.php b/api/controllers/wxapp/licheb/User.php
index e00b55f7..5d21da79 100644
--- a/api/controllers/wxapp/licheb/User.php
+++ b/api/controllers/wxapp/licheb/User.php
@@ -334,7 +334,10 @@ class User extends Wxapp
$clues_count = $this->clues_model->count(['biz_id' => $biz_id, 'status' => 1, 'status2' => 1]);
$customer_op_list = [];
if ($biz['type'] == Biz_model::BIZ_TYPE_4s) {
- $where = ['biz_id' => $biz_id, 'status' => 0, 'un_lock' => 0, 'rid>' => 0, 'rec_time>' => date('Y-m-d H:i:s')];
+ $where = [
+ 'biz_id' => $biz_id, 'status' => 0, 'un_lock' => 0, 'rid>' => 0,
+// 'rec_time>' => date('Y-m-d H:i:s')
+ ];
$unlock_count = $this->customers_model->count($where);
$customer_op_list[] = ['title' => '待解锁客户(人)', 'icon' => 'icon-daifenpei', 'total' => $unlock_count, 'page' => '/pages/customer/index'];
} else {
diff --git a/common/models/receiver/Receiver_customers_model.php b/common/models/receiver/Receiver_customers_model.php
index 80699f3f..3aae6af7 100644
--- a/common/models/receiver/Receiver_customers_model.php
+++ b/common/models/receiver/Receiver_customers_model.php
@@ -21,6 +21,15 @@ class Receiver_customers_model extends HD_Model
//解锁状态
const UNLOCK_STATUS = 0; //未解锁
const LOCK_STATUS = 1; //已解锁
+ const LOCK_STATUS_2 = 2; //不解锁
+ const LOCK_LIST = [
+ self::UNLOCK_STATUS => '未解锁',
+ self::LOCK_STATUS => '已解锁',
+ self::LOCK_STATUS_2 => '不解锁'
+ ];
+ const LOCK_REASON = [
+ "线索重叠", "非精准线索"
+ ];
public function __construct()
{