修改线索和客户解锁判断 && 增加导出接口

This commit is contained in:
lcc
2025-10-20 09:36:40 +08:00
parent 267ac52fb0
commit e739df6215
9 changed files with 129 additions and 77 deletions
+7 -1
View File
@@ -164,7 +164,7 @@ class Clues extends HD_Controller
$lists = [];
if ($count) {
$fileds = 'id,name,mobile,brand_id,series_id,cf_id,cf2_id,c_time,admin_id,status,status2,en_time,
province_id,city_id,county_id,biz_id,p_time,u_time,rec_time';
province_id,city_id,county_id,biz_id,p_time,u_time,rec_time,app_id';
$rows = $this->clues_model->select($where, 'en_time desc,id desc', $page, $size, $fileds);
$map_admin = $map_cf_pid = $cf_title_arr = [];
@@ -262,6 +262,12 @@ class Clues extends HD_Controller
$val['p_time'] = '';
}
$val['rec_time'] = $val['rec_time'] != '0000-00-00 00:00:00' ? $val['rec_time'] : '';
$is_unlock = '';
if ($val['app_id'] == Receiver_clues_model::APP_ID_ACTIVITY && $val['status'] > 0) {
$unlockCustomer = $this->customers_model->get(['rid' => $val['rid'], 'un_lock' => Receiver_customers_model::LOCK_STATUS]);
$is_unlock = $unlockCustomer ? '已解锁' : '未解锁';
}
$val['is_unlock'] = $is_unlock;
$lists[] = $val;
}
}
+7 -2
View File
@@ -56,7 +56,7 @@ class Customer extends HD_Controller
//$wxqyAry = $this->customers_model->wxqyAry();
$wxgrAry = $this->customers_model->wxgrAry();
if ($count) {
$fileds = 'id,cid,name,mobile,cf_title,p_time,cont_time,admin_id,status,biz_id,level,of_id,of2_id,wxgr,c_time,county_id,brand_id,series_id';
$fileds = 'id,rid,cid,name,mobile,cf_title,p_time,cont_time,admin_id,status,biz_id,level,of_id,of2_id,wxgr,c_time,county_id,brand_id,series_id,un_lock';
$rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds);
//获取车管家
$admin_id_arr = array_unique(array_column($rows, 'admin_id'));
@@ -107,7 +107,11 @@ class Customer extends HD_Controller
if ($brands[$val['brand_id']]) {
$brand_detail .= '-' . $series[$val['series_id']][0]['name'];
}
$clues = $this->clues_model->get(['id' => $val['rid']]);
$is_unlock = '';
if ($clues['app_id'] == Receiver_clues_model::APP_ID_ACTIVITY) {
$is_unlock = $val['un_lock'] ? '已解锁' : '未解锁';
}
$lists[] = array(
'id' => $val['id'],
'cid' => $val['cid'],
@@ -127,6 +131,7 @@ class Customer extends HD_Controller
'c_time' => $val['c_time'] != '0' ? date('Y-m-d H:i:s', $val['c_time']) : '',
'p_time' => $val['p_time'],
'cont_time' => $val['cont_time'] != '0000-00-00 00:00:00' ? $val['cont_time'] : '',
'is_unlock' => $is_unlock
);
}
}
+4 -1
View File
@@ -299,7 +299,10 @@
<td style="vertical-align: middle;"><?= $v['cf_title'] ?></td>
<td style="vertical-align: middle;"><?= $v['poi'] ?></td>
<td style="vertical-align: middle;"><?= $v['biz_poi'] ?><br><?= $v['biz_name'] ?></td>
<td style="vertical-align: middle;"><?= $v['status_name'] ?></td>
<td style="vertical-align: middle;">
<?= $v['status_name'] ?><br>
<?= $v['is_unlock']?>
</td>
<td style="text-align: left">
分配时间: <?= $v['p_time'] ?><br>
派单过期: <?= $v['rec_time'] ?><br>
+4 -1
View File
@@ -258,7 +258,10 @@
<td style="vertical-align: middle;">{{v.admin_name}}</td>
<td style="vertical-align: middle;">{{v.brand_detail}}</td>
<td style="vertical-align: middle;">{{v.wxgr_name}}</td>
<td style="vertical-align: middle;">{{v.status_name}}</td>
<td style="vertical-align: middle;">
{{v.status_name}}<br>
{{v.is_unlock}}
</td>
<td style="vertical-align: middle;">{{v.p_time}}</td>
<td style="vertical-align: middle;">{{v.cont_time}}</td>
</tr>
+1 -1
View File
@@ -24,7 +24,7 @@ class Data extends BaseController
$where['c_time>='] = strtotime(date('Y-m-d 00:00:00'));
$where['c_time<='] = time();
$today_clues = $this->clues_model->count($where);
$member = $this->pingan_users_model->count();
$member = $this->pingan_users_model->count(['status' => Pingan_users_model::STATUS_NORMAL]);
$app_id = self::APP_ID;
$where = [
"clue_id in (select id from lc_receiver_clues where app_id={$app_id})" => null
@@ -223,7 +223,7 @@ class Product extends BaseController
}
}
if ($limit >= 10000) {
$columns = ['品牌', '车型', '官方售价', '补贴详情', '推广周期', '线索佣金', '订单佣金', '城市', '适用门店'];
$columns = ['代理人姓名', '代理人工号', '团队主管姓名', '团队主管工号', '部经理姓名', '部经理工号', '区经理姓名', '区经理工号', '中心编号','归属城市','归属机构','代理人角色编号'];
}
$data = ['list' => $list, 'count' => $count, 'columns' => $columns];
return $data;
@@ -20,75 +20,8 @@ class User extends BaseController
public function page_get()
{
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$username = $this->input_param('username');
$mobile = $this->input_param('mobile');
$orgId = $this->input_param('orgId');
$teamId = $this->input_param('teamId');
$groupType = $this->input_param('groupType');
$centerNumber = $this->input_param('centerNumber');
$orgName = $this->input_param('orgName');
$citys = $this->input_param('citys');
$sort = $this->input_param('sort');
$order = $this->input_param('order');
$status = $this->input_param('status');
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'id desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$where = $list = [];
$where['status>='] = 0;
$username && $where["username like '%{$username}%'"] = null;
$mobile && $where["mobile like '%{$mobile}%'"] = null;
$orgId && $where['orgId'] = $orgId;
$teamId && $where['orgTeamId'] = $teamId;
$centerNumber && $where['centerNumber'] = $centerNumber;
strlen($groupType) && $where['groupType'] = $groupType;
$citys && $where['cityId'] = $citys[1];
$orgName && $where['orgName'] = $orgName;
strlen($status) && $where['status'] = intval($status);
$count = $this->pinganUsers->count($where);
if ($count) {
$res = $this->pinganUsers->select($where, $sort_order, $page, $limit);
$orgId = array_column($res, 'orgId');
$orgTeamId = array_column($res, 'orgTeamId');
$orgIdArray = array_merge($orgId, $orgTeamId);
$orgMap = $this->mdOrganization->get_map_by_ids($orgIdArray, '', 'id', 'title');
$areaIdArray = array_column($res, 'areaId');
$depIdArray = array_column($res, 'depId');
$teamIdArray = array_column($res, 'teamId');
$userIdArray = array_merge($areaIdArray, $depIdArray, $teamIdArray);
$userIds = implode(',', $userIdArray);
$mapUsers = [];
if ($userIds) {
$where = ["id in ({$userIds})" => null];
$mapUsers = $this->pinganUsers->map('id', '', $where, '', 0, 0, 'id,username,userCode');
}
foreach ($res as $v) {
$status = intval($v['status']);
// $orgName = $orgMap[$v['orgId']] ?: '';
$orgTeamName = $orgMap[$v['orgTeamId']] ?: '';
$city = $this->area_model->get(['city_id' => $v['cityId']]);
$areaUser = $mapUsers[$v['areaId']] ? $mapUsers[$v['areaId']][0] : [];
$depUser = $mapUsers[$v['depId']] ? $mapUsers[$v['depId']][0] : [];
$teamUser = $mapUsers[$v['teamId']] ? $mapUsers[$v['teamId']][0] : [];
$list[] = [
'id' => $v['id'], 'mobile' => $v['mobile'],
'username' => $v['username'], 'userCode' => $v['userCode'],
'status' => $status, 'updateTime' => $v['updateTime'],
'orgName' => $v['orgName'] ?: '', 'orgTeamName' => $orgTeamName,
'typeCn' => Pingan_users_model::TYPE_CN[$v['groupType']],
'groupType' => $v['groupType'], 'cityName' => $city['city_name'],
'centerNumber' => Pingan_users_model::TYPE_CENTER[$v['centerNumber']],
'areaUser' => $areaUser, 'depUser' => $depUser, 'teamUser' => $teamUser
];
}
}
$date = ['list' => $list, 'count' => $count];
$this->return_response_list($date);
$data = $this->userList($this->input_param());
$this->return_response_list($data);
}
public function groupType_get()
@@ -404,6 +337,101 @@ class User extends BaseController
} catch (Exception $e) {
$this->return_json($e->getMessage());
}
}
public function export_get()
{
$this->inputs['page'] = 1;
$this->inputs['limit'] = 20000;
$data = $this->userList($this->inputs);
$this->return_response_list($data);
}
private function userList($params)
{
$page = $params['page'];
$limit = $params['limit'];
$username = $params['username'];
$mobile = $params['mobile'];
$orgId = $params['orgId'];
$teamId = $params['teamId'];
$groupType = $params['groupType'];
$centerNumber = $params['centerNumber'];
$orgName = $params['orgName'];
$citys = $params['citys'];
$sort = $params['sort'];
$order = $params['order'];
$status = $params['status'];
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'id desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$where = $list = [];
$where['status>='] = 0;
$username && $where["username like '%{$username}%'"] = null;
$mobile && $where["mobile like '%{$mobile}%'"] = null;
$orgId && $where['orgId'] = $orgId;
$teamId && $where['orgTeamId'] = $teamId;
$centerNumber && $where['centerNumber'] = $centerNumber;
strlen($groupType) && $where['groupType'] = $groupType;
$citys && $where['cityId'] = $citys[1];
$orgName && $where['orgName'] = $orgName;
strlen($status) && $where['status'] = intval($status);
$count = $this->pinganUsers->count($where);
if ($count) {
$res = $this->pinganUsers->select($where, $sort_order, $page, $limit);
$orgId = array_column($res, 'orgId');
$orgTeamId = array_column($res, 'orgTeamId');
$orgIdArray = array_merge($orgId, $orgTeamId);
$orgMap = $this->mdOrganization->get_map_by_ids($orgIdArray, '', 'id', 'title');
$areaIdArray = array_column($res, 'areaId');
$depIdArray = array_column($res, 'depId');
$teamIdArray = array_column($res, 'teamId');
$userIdArray = array_merge($areaIdArray, $depIdArray, $teamIdArray);
$userIds = implode(',', $userIdArray);
$mapUsers = [];
if ($userIds) {
$where = ["id in ({$userIds})" => null];
$mapUsers = $this->pinganUsers->map('id', '', $where, '', 0, 0, 'id,username,userCode');
}
foreach ($res as $v) {
$orgTeamName = $orgMap[$v['orgTeamId']] ?: '';
$city = $this->area_model->get(['city_id' => $v['cityId']]);
$areaUser = $mapUsers[$v['areaId']] ? $mapUsers[$v['areaId']][0] : [];
$depUser = $mapUsers[$v['depId']] ? $mapUsers[$v['depId']][0] : [];
$teamUser = $mapUsers[$v['teamId']] ? $mapUsers[$v['teamId']][0] : [];
if ($limit >= 10000) { //导出
$list[] = [
'username' => $v['username'], 'userCode' => $v['userCode'],
'areaUser' => $areaUser['username'] ?: '', 'areaUserCode' => $areaUser['userCode'] ?: '',
'depUser' => $depUser['username'] ?: '', 'depUserCode' => $depUser['userCode'] ?: '',
'teamUser' => $teamUser['username'] ?: '', 'teamUserCode' => $teamUser['userCode'] ?: '',
'centerNumber' => Pingan_users_model::TYPE_CENTER[$v['centerNumber']], 'cityName' => $city['city_name'],
'orgName' => $v['orgName'] ?: '', 'groupType' => $v['groupType']
];
} else {
$status = intval($v['status']);
// $orgName = $orgMap[$v['orgId']] ?: '';
$list[] = [
'id' => $v['id'], 'mobile' => $v['mobile'],
'username' => $v['username'], 'userCode' => $v['userCode'],
'status' => $status, 'updateTime' => $v['updateTime'],
'orgName' => $v['orgName'] ?: '', 'orgTeamName' => $orgTeamName,
'typeCn' => Pingan_users_model::TYPE_CN[$v['groupType']],
'groupType' => $v['groupType'], 'cityName' => $city['city_name'],
'centerNumber' => Pingan_users_model::TYPE_CENTER[$v['centerNumber']],
'areaUser' => $areaUser, 'depUser' => $depUser, 'teamUser' => $teamUser
];
}
}
}
$columns = [];
if ($limit >= 10000) {
$columns = ['代理人姓名', '代理人工号', '团队主管姓名', '团队主管工号', '部经理姓名', '部经理工号', '区经理姓名', '区经理工号', '中心编号', '归属城市', '归属机构', '代理人角色编号'];
}
return ['list' => $list, 'count' => $count, 'columns' => $columns];
}
}
@@ -83,6 +83,7 @@ class Customer extends BaseController
if ($orderSubsidy) {
$checkStatus = Receiver_order_subsidy_model::IF_CHECK_STATUS[$orderSubsidy['ifcheck']] ?: '';
}
$isUnlock = $val['un_lock'] ? '已解锁' : '未解锁';
$temp = [
'cluesSid' => $cluesRow['sid'],
'cid' => $val['cid'],
@@ -95,7 +96,8 @@ class Customer extends BaseController
'brandDetail' => $brand_detail,
'belongUserName' => $pinganUsersRow ?: [],
'enTime' => date('Y-m-d H:i:s', $val['c_time']),
'checkStatus' => $checkStatus
'checkStatus' => $checkStatus,
'isUnlock' => $isUnlock
];
$list[] = $temp;
}
@@ -297,6 +299,7 @@ class Customer extends BaseController
$appId = self::APP_ID;
$where = [
'rid>' => 0,
'un_lock' => Receiver_customers_model::LOCK_STATUS
];
if ($_SESSION['groupType'] == Pingan_users_model::GROUP_TYPE_TEAM
|| $_SESSION['groupType'] == Pingan_users_model::GROUP_TYPE_TEAM_CONTACT) {
@@ -18,6 +18,10 @@ class Receiver_customers_model extends HD_Model
private $buy_time = [3 => '3天(H级)', 7 => '7天(A级)', 15 => '15天(B级)', 30 => '30天(C级)'];
private $follow_channel = ['见面', '电话', '微信'];
//解锁状态
const UNLOCK_STATUS = 0; //未解锁
const LOCK_STATUS = 1; //已解锁
public function __construct()
{
parent::__construct($this->table_name, 'default');