diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index 21a1bfc0..c6e7f3f0 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -1506,10 +1506,9 @@ class Customers extends Wxapp //客户线索 protected function put_unlock() { - $bizId = $this->get_biz_id(); $id = $this->input_param('id'); /** @var MyResponse $result */ - $result = $this->customers_model->unlock($id, $bizId); + $result = $this->customers_model->unlock($id, $this->biz_id); if (!$result->isSuccess()) { throw new Exception($result->getMessage(), API_CODE_FAIL); } diff --git a/api/controllers/wxapp/licheb/User.php b/api/controllers/wxapp/licheb/User.php index 029d4830..e76df149 100644 --- a/api/controllers/wxapp/licheb/User.php +++ b/api/controllers/wxapp/licheb/User.php @@ -148,7 +148,7 @@ class User extends Wxapp throw new Exception('门店不存在', API_CODE_FAIL); } - if(in_array($biz['type'],[1,2])){ + if (in_array($biz['type'], [1, 2])) { $this->add_user_score(); } @@ -333,7 +333,11 @@ class User extends Wxapp $defeat_count = $this->customers_model->count($where); $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) { + if ($biz['type'] == Biz_model::BIZ_TYPE_4s) { + $where = ['biz_id' => $biz_id, 'status' => 0, 'un_lock' => 0, 'rid>' => 0]; + $unlock_count = $this->customers_model->count($where); + $customer_op_list[] = ['title' => '待解锁客户(人)', 'icon' => 'icon-daifenpei', 'total' => $unlock_count, 'page' => '/pages/customer/index']; + } else { $customer_op_list[] = ['title' => '线索池(人)', 'icon' => 'icon-daifenpei', 'total' => $clues_count, 'page' => '/pages/clues/index']; } $customer_op_list[] = ['title' => '待分配客户(人)', 'icon' => 'icon-daifenpei', 'total' => $unuse_count, 'page' => '/pages/customer/allot/index']; diff --git a/common/models/agent/Auto_product_coupon_model.php b/common/models/agent/Auto_product_coupon_model.php index c1c574bf..e65fb76a 100644 --- a/common/models/agent/Auto_product_coupon_model.php +++ b/common/models/agent/Auto_product_coupon_model.php @@ -4,6 +4,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); class Auto_product_coupon_model extends HD_Model { private $table_name = 'lc_auto_product_coupon'; + const DEFAULT_CLUES_COMMISSION = 15; //默认线索佣金 public function __construct() { @@ -25,6 +26,7 @@ class Auto_product_coupon_model extends HD_Model $result = $this->update($addData, ['id' => $params['id']]); } else { $addData['product_id'] = $params['productId']; + $addData['cluesCommission'] = self::DEFAULT_CLUES_COMMISSION; $result = $this->add($addData); $params['id'] = $result; } diff --git a/common/models/receiver/Receiver_customers_model.php b/common/models/receiver/Receiver_customers_model.php index c4d2fbe2..1b689955 100644 --- a/common/models/receiver/Receiver_customers_model.php +++ b/common/models/receiver/Receiver_customers_model.php @@ -312,6 +312,7 @@ class Receiver_customers_model extends HD_Model */ public function unlock($id, $bizId) { + $log_path = "customer_unlock.log"; $this->load->model('receiver/receiver_clues_model'); $this->load->model('agent/auto_user_coupon_model'); $this->auto_user_coupon_model->set_db('agentdb'); @@ -319,6 +320,7 @@ class Receiver_customers_model extends HD_Model $this->auto_user_coupon_model->db->trans_begin(); try { $row = $this->get(['id' => $id, 'biz_id' => $bizId]); + debug_log("开始解锁客户id:{$id},biz_id:{$bizId}", $log_path); if (!$row) { throw new Exception('数据不存在'); } @@ -357,6 +359,7 @@ class Receiver_customers_model extends HD_Model } catch (Exception $e) { $this->db->trans_rollback(); // $this->auto_user_coupon_model->db->trans_rollback(); + debug_log("解锁失败:" . $e->getMessage(), $log_path); return new MyResponse(EXIT_ERROR, '解锁失败:' . $e->getMessage()); } }