修改小程序接口增加未解锁线索

This commit is contained in:
lcc
2025-07-30 14:59:36 +08:00
parent 0524ecaabb
commit c1e5f45c6e
4 changed files with 12 additions and 4 deletions
+1 -2
View File
@@ -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);
}
+6 -2
View File
@@ -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'];
@@ -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;
}
@@ -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());
}
}