Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b7efb88f7 | |||
| 93f7e38979 |
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
$config['url'] = "wss://sapi.liche.cn/wss";
|
||||
$config['url'] = "ws://api.ss.haodian.cn/wss";
|
||||
|
||||
$config['jwt_key_pingan'] = 'dvsr23423vsgAEDger'; //平安端生成用户秘钥
|
||||
$config['jwt_key_system'] = '2343ljfwefefew';//后端生成用户秘钥
|
||||
|
||||
@@ -1249,18 +1249,4 @@ class Common extends CI_Controller
|
||||
$this->data = $rows;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
public function set_notice()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$this->load->model('sys/sys_notice_model');
|
||||
if ($this->uid) {
|
||||
$where = ['uid' => $this->uid, 'platform' => Sys_notice_model::PLAT_FORM_ADMIN];
|
||||
if ($id) {
|
||||
$where['id'] = $id;
|
||||
}
|
||||
$this->sys_notice_model->update(['read' => Sys_notice_model::STATUS_READ], $where);
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ class Login extends CI_Controller
|
||||
|
||||
$this->input->set_cookie(LOGIN_CODE_COOKIE, $this->encryption->encrypt(json_encode($code)), 60 * 5, $domain);
|
||||
// send_sms($mobile, $code);
|
||||
$content = "【好店云(厦门)科技】" . "您的验证码为:{$code},请勿泄露于他人!";
|
||||
$content = "【好店云】" . "您的验证码为:{$code},请勿泄露于他人!";
|
||||
b2m_send_sms($mobile,$content);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ class Welcome extends CI_Controller
|
||||
$where = [
|
||||
'platform' => Sys_notice_model::PLAT_FORM_ADMIN,
|
||||
'uid' => $this->uid,
|
||||
'read' => Sys_notice_model::STATUS_UNREAD
|
||||
];
|
||||
$_noticeCount = $this->sys_notice_model->count($where);
|
||||
if ($_noticeCount) {
|
||||
|
||||
@@ -30,8 +30,6 @@ class Clues extends HD_Controller
|
||||
$this->load->model('receiver/receiver_enroll_model');
|
||||
|
||||
$this->load->model('biz/biz_car_brand_model');
|
||||
$this->load->model('sys/sys_notice_model');
|
||||
$this->load->model('sys/Sys_admin_model', 'sysAdmin');
|
||||
|
||||
$this->log_dir = 'receiver_clues';
|
||||
}
|
||||
@@ -550,7 +548,7 @@ class Clues extends HD_Controller
|
||||
if ($res_u) {
|
||||
foreach ($res_u as $v) {
|
||||
if ($info['biz_id'] != 1) {
|
||||
// b2m_send_sms($v['mobile'], '【好店云(厦门)科技】您好,门店新增了1个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
|
||||
// b2m_send_sms($v['mobile'], '【好店云】您好,门店新增了1个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
|
||||
ems_sms($v['mobile'], '您好,门店新增了1个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
|
||||
}
|
||||
}
|
||||
@@ -565,20 +563,6 @@ class Clues extends HD_Controller
|
||||
}
|
||||
return $this->show_json($code, $msg);
|
||||
}
|
||||
//推送消息给中台客服
|
||||
// $noticeAdmins = $this->sysAdmin->select(['role_id' => 2, 'status' => 1], '', 0, 0, 'id');
|
||||
// if ($noticeAdmins) {
|
||||
// foreach ($noticeAdmins as $noticeAdmin) {
|
||||
// $params = [
|
||||
// 'platform' => Sys_notice_model::PLAT_FORM_ADMIN,
|
||||
// 'uid' => $noticeAdmin['id'],
|
||||
// 'content' => "超级车补新增了一条线索,请及时处理.",
|
||||
// 'url' => '/receiver/clues/get?id=' . $ret,
|
||||
// ];
|
||||
// $endPlatform = Sys_notice_model::PLAT_FORM_SYS_ADMIN;
|
||||
// $this->sys_notice_model->addNotice($params, $endPlatform, $this->uid);
|
||||
// }
|
||||
// }
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '新增成功');
|
||||
} else {
|
||||
debug_log("[error]# add fail; " . $this->clues_model->db->last_query(), __FUNCTION__, $this->log_dir);
|
||||
@@ -614,24 +598,10 @@ class Clues extends HD_Controller
|
||||
'uname' => $this->username,
|
||||
'type' => intval($params['type']),
|
||||
'log' => $params['log'],
|
||||
'c_time' => time(),
|
||||
'cf_platform' => Receiver_clue_oplogs_model::CF_PLATFORM_ADMIN
|
||||
'c_time' => time()
|
||||
);
|
||||
$id = $this->mdOplogs->add($addData);
|
||||
if ($id) {
|
||||
if ($params['notice']) { //推送消息
|
||||
$clues = $this->clues_model->get(['id' => $params['id']]);
|
||||
if ($clues['pingan_user_id'] && $clues['app_id'] == Receiver_clues_model::APP_ID_ACTIVITY) {
|
||||
$params = [
|
||||
'platform' => Sys_notice_model::PLAT_FORM_PINGAN,
|
||||
'uid' => $clues['pingan_user_id'],
|
||||
'content' => $params['log'],
|
||||
'url' => '/receiver/clues/detail?id=' . $clues['id'],
|
||||
];
|
||||
$endPlatform = Sys_notice_model::PLAT_FORM_SYS_ADMIN;
|
||||
$this->sys_notice_model->addNotice($params, $endPlatform, $this->uid);
|
||||
}
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
|
||||
} else {
|
||||
return $this->show_json(SYS_CODE_FAIL, '添加失败');
|
||||
@@ -743,11 +713,8 @@ class Clues extends HD_Controller
|
||||
$up['city_id'] = $info['city_id'];
|
||||
$up['county_id'] = $info['county_id'];
|
||||
|
||||
// if ($info['province_id'] == '460000') {
|
||||
// $up['belong_id'] = 39;
|
||||
// }
|
||||
if(Receiver_clues_model::PROVINCE_BELONG[$info['province_id']]){
|
||||
$up['belong_id'] = Receiver_clues_model::PROVINCE_BELONG[$info['province_id']];
|
||||
if ($info['province_id'] == '460000') {
|
||||
$up['belong_id'] = 39;
|
||||
}
|
||||
}
|
||||
if ($info['cf_id'] != $re['cf_id'] || $info['cf2_id'] != $re['cf2_id']) {
|
||||
@@ -851,7 +818,7 @@ class Clues extends HD_Controller
|
||||
if ($res_u) {
|
||||
foreach ($res_u as $v) {
|
||||
if ($re['biz_id'] != 1) {
|
||||
// b2m_send_sms($v['mobile'], '【好店云(厦门)科技】您好,门店新增了1个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
|
||||
// b2m_send_sms($v['mobile'], '【好店云】您好,门店新增了1个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
|
||||
ems_sms($v['mobile'], '您好,门店新增了1个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
|
||||
}
|
||||
}
|
||||
@@ -885,8 +852,7 @@ class Clues extends HD_Controller
|
||||
'uname' => $this->username,
|
||||
'type' => intval($ary['type']),
|
||||
'log' => $ary['log'],
|
||||
'c_time' => time(),
|
||||
'cf_platform' => Receiver_clue_oplogs_model::CF_PLATFORM_ADMIN
|
||||
'c_time' => time()
|
||||
);
|
||||
$id = $this->mdOplogs->add($addData);
|
||||
}
|
||||
|
||||
@@ -561,9 +561,9 @@ class Customer extends HD_Controller
|
||||
$order_time[1] && $where["def_time <="] = $order_time[1] . ' 23:59:59';
|
||||
}
|
||||
if ($params['unlock_time']) {
|
||||
$p_time = explode(' ~ ', $params['unlock_time']);
|
||||
$p_time[0] && $where["unlock_time >="] = $p_time[0] . ' 00:00:00';
|
||||
$p_time[1] && $where["unlock_time <="] = $p_time[1] . ' 23:59:59';
|
||||
$p_time = explode(' ~ ', $params['lock_time']);
|
||||
$p_time[0] && $where["lock_time >="] = $p_time[0] . ' 00:00:00';
|
||||
$p_time[1] && $where["lock_time <="] = $p_time[1] . ' 23:59:59';
|
||||
}
|
||||
|
||||
if ($params['tags']) {
|
||||
@@ -961,7 +961,6 @@ class Customer extends HD_Controller
|
||||
'city_name' => '所在城市',
|
||||
'county_name' => '所在地区',
|
||||
'is_unlock' => '是否解锁',
|
||||
'unlock_time' => '解锁时间',
|
||||
// 'to_send' => '是否改派',
|
||||
'c_time' => '建档时间',
|
||||
"p_time" => "派单时间",
|
||||
@@ -984,7 +983,7 @@ class Customer extends HD_Controller
|
||||
$status_arr = $this->customers_model->get_status();
|
||||
unset($status_arr['-1']);
|
||||
if ($count) {
|
||||
$fileds = "id, name, mobile, level, status, cs_biz_id,brand_id,series_id, FROM_UNIXTIME(c_time) as c_time, if(dt_time>0, dt_time,'') as dt_time, p_time, sales_p_time, if(order_time>0, order_time,'') as order_time, u_time, c_brand, cf_id, of_id, of2_id, (SELECT biz_name FROM `lc_biz` where id = `lc_receiver_customers`.biz_id) as biz_name, (SELECT uname FROM `lc_app_licheb_users` where id = `lc_receiver_customers`.admin_id) as admin_name, biz_id, admin_id, wxqy, wxgr, (select city_name from lc_area where city_id = lc_receiver_customers.city_id limit 1) as city_name, (select county_name from lc_area where county_id = lc_receiver_customers.county_id limit 1) as county_name,un_lock,rid,unlock_time";
|
||||
$fileds = "id, name, mobile, level, status, cs_biz_id,brand_id,series_id, FROM_UNIXTIME(c_time) as c_time, if(dt_time>0, dt_time,'') as dt_time, p_time, sales_p_time, if(order_time>0, order_time,'') as order_time, u_time, c_brand, cf_id, of_id, of2_id, (SELECT biz_name FROM `lc_biz` where id = `lc_receiver_customers`.biz_id) as biz_name, (SELECT uname FROM `lc_app_licheb_users` where id = `lc_receiver_customers`.admin_id) as admin_name, biz_id, admin_id, wxqy, wxgr, (select city_name from lc_area where city_id = lc_receiver_customers.city_id limit 1) as city_name, (select county_name from lc_area where county_id = lc_receiver_customers.county_id limit 1) as county_name,un_lock,rid";
|
||||
$rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds);
|
||||
$brands = $this->auto_brand_model->get_map_by_ids(array_column($rows, 'brand_id'));
|
||||
$series = $this->auto_series_model->get_map_by_ids(array_column($rows, 'series_id'));
|
||||
@@ -1030,8 +1029,7 @@ class Customer extends HD_Controller
|
||||
'wxgr_name' => $this->customers_model->wxgrAry($val['wxgr']),
|
||||
'brand_detail' => $brand_detail,
|
||||
'series_detail' => $series_detail,
|
||||
'is_unlock' => $is_unlock,
|
||||
'unlock_time' => $val['unlock_time'] != '0000-00-00 00:00:00' ? $val['unlock_time'] : '',
|
||||
'is_unlock' => $is_unlock
|
||||
);
|
||||
|
||||
if ($params['export_tag']) {
|
||||
|
||||
@@ -42,20 +42,20 @@ class Orders extends HD_Controller
|
||||
$status_arr[] = array("id" => $key, "name" => $value, "cate" => [], "count" => $count);
|
||||
}
|
||||
$where = ['status>=' => 0];
|
||||
if ($this->admin_biz_str) {
|
||||
if($this->admin_biz_str){
|
||||
$where["biz_id in ($this->admin_biz_str)"] = null;
|
||||
}
|
||||
$params['count_all'] = $this->receiver_orders_model->count($where);//全部
|
||||
$params['list_type'] = 'all';
|
||||
if ($this->admin_biz_str) {
|
||||
if($this->admin_biz_str){
|
||||
$params['admin_biz_str'] = $this->admin_biz_str;
|
||||
}
|
||||
$result = $this->orderslist->lists($params['status_pid'], $params);
|
||||
$this->data = $result;
|
||||
//获取品牌
|
||||
$brand_rows = $this->auto_brand_model->select(['status>' => 0], 'initial asc', 0, 0, 'id,name');
|
||||
$brand_rows = $this->auto_brand_model->select(['status>'=>0], 'initial asc', 0, 0, 'id,name');
|
||||
$brands = [];
|
||||
if ($brand_rows) {
|
||||
if($brand_rows){
|
||||
foreach ($brand_rows as $v) {
|
||||
$brands[] = array(
|
||||
'id' => $v['id'],
|
||||
@@ -278,7 +278,7 @@ class Orders extends HD_Controller
|
||||
$row['of_title'] = $of_title;
|
||||
}
|
||||
$row['p_time'] = date('Y-m-d', strtotime($customers['p_time']));
|
||||
$row['money_json'] = $row['money_json'] ? json_decode($row['money_json'], true) : [];
|
||||
$row['money_json'] = json_decode($row['money_json'], true);
|
||||
$jsondata = $row['jsondata'] ? json_decode($row['jsondata'], true) : array();
|
||||
$row['status'] = intval($row['status']);
|
||||
$row['c_time'] = date('Y-m-d', $row['c_time']);
|
||||
@@ -321,14 +321,14 @@ class Orders extends HD_Controller
|
||||
$img_data['delivery_ck_img'] && $img_data['delivery_ck_img'] = build_qiniu_image_url($img_data['delivery_ck_img']);
|
||||
$img_data['bill_img'] && $img_data['bill_img'] = build_qiniu_image_url($img_data['bill_img']);
|
||||
|
||||
if ($img_data['insurance_img']) {
|
||||
if($img_data['insurance_img']){
|
||||
$img_data['insurance_img'] = build_qiniu_image_url($img_data['insurance_img']);
|
||||
strstr($img_data['insurance_img'], '.pdf') && $img_data['insurance_pdf'] = $img_data['insurance_img'];
|
||||
strstr($img_data['insurance_img'],'.pdf') && $img_data['insurance_pdf'] = $img_data['insurance_img'];
|
||||
}
|
||||
|
||||
if ($img_data['business_img']) {
|
||||
if($img_data['business_img']){
|
||||
$img_data['business_img'] = build_qiniu_image_url($img_data['business_img']);
|
||||
strstr($img_data['business_img'], '.pdf') && $img_data['business_pdf'] = $img_data['business_img'];
|
||||
strstr($img_data['business_img'],'.pdf') && $img_data['business_pdf'] = $img_data['business_img'];
|
||||
}
|
||||
|
||||
$row['img_data'] = $img_data;
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Notice extends HD_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('sys/sys_notice_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
|
||||
$page = $this->input->get('page') ?: 1;
|
||||
$pageSize = 20;
|
||||
$where = [
|
||||
'platform' => Sys_notice_model::PLAT_FORM_ADMIN,
|
||||
'uid' => $this->uid
|
||||
];
|
||||
strlen($params['read']) && $where['read'] = intval($params['read']);
|
||||
$count = $this->sys_notice_model->count($where);
|
||||
$list = [];
|
||||
if ($count) {
|
||||
$rows = $this->sys_notice_model->select($where, 'id desc', $page, $pageSize);
|
||||
foreach ($rows as $item) {
|
||||
$list[] = [
|
||||
'id' => $item['id'],
|
||||
'icon' => Sys_notice_model::ICON_TYPE[$item['icon']] ?: Sys_notice_model::ICON_DEFAULT,
|
||||
'content' => $item['content'],
|
||||
'url' => $item['url'],
|
||||
'read' => intval($item['read']),
|
||||
'readCn' => $item['read'] ? '已读' : '未读',
|
||||
'type' => $item['type'],
|
||||
'c_time' => date('Y-m-d H:i:s', $item['c_time'])
|
||||
];
|
||||
}
|
||||
}
|
||||
$this->data['params'] = $params;
|
||||
$this->data['readList'] = Sys_notice_model::READ_STATUS;
|
||||
$this->data['lists'] = $list;
|
||||
$this->data['_title'] = '系统消息';
|
||||
$this->data['pager'] = array('count' => ceil($count / $pageSize), 'curr' => $page, 'totle' => $count);
|
||||
$this->show_view('sys/notice/lists', true);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function edit_read()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$field = $this->input->post('field');
|
||||
$value = $this->input->post('value');
|
||||
$read = $this->input->post('read');
|
||||
|
||||
if ('read' == $field) {
|
||||
$read = $value;
|
||||
}
|
||||
|
||||
$upd = array('read' => $read);
|
||||
$where = ['uid' => $this->uid, 'platform' => Sys_notice_model::PLAT_FORM_ADMIN];
|
||||
if (is_numeric($id)) {
|
||||
$where['id'] = $id;
|
||||
} else {
|
||||
$where["id in ({$id})"] = null;
|
||||
}
|
||||
|
||||
$ret = $this->sys_notice_model->update($upd, $where);
|
||||
if (!$ret) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,6 @@ class Wss extends HD_Controller
|
||||
'uid' => $info['uid'],
|
||||
'content' => $info['content'],
|
||||
];
|
||||
$params['url'] = $info['url'] ?: '';
|
||||
$endPlatform = Ws_conn_model::PLAT_FORM_SYS_ADMIN;
|
||||
/** @var MyResponse $req */
|
||||
$req = $this->sys_notice_model->addNotice($params, $endPlatform, 8888888, true);
|
||||
|
||||
@@ -20,7 +20,6 @@ abstract class HD_Controller extends CI_Controller
|
||||
'430000' => ['id' => '430000', 'name' => '湖南省'],
|
||||
'520000' => ['id' => '520000', 'name' => '贵州省'],
|
||||
'460000' => ['id' => '460000', 'name' => '海南省'],
|
||||
'440000' => ['id' => '440000', 'name' => '广东省'],
|
||||
);
|
||||
|
||||
public function __construct()
|
||||
|
||||
+8
-85
@@ -75,8 +75,8 @@
|
||||
<a class="tit" href="javascript:;">通知<b><i>{{ countNotice }}</i></b></a>
|
||||
<ul class="dropdown-list" style="width: 180px">
|
||||
<template v-if="notice.length > 0">
|
||||
<li v-for="(item,index) in notice">
|
||||
<a @click="setRead(item,index)" href="#"
|
||||
<li v-for="item in notice">
|
||||
<a href="#"
|
||||
style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
|
||||
{{ item.content}}
|
||||
</a>
|
||||
@@ -84,11 +84,10 @@
|
||||
<!-- 按钮容器:使用Flex实现左右分栏 -->
|
||||
<li style="display: flex; border-top: 1px solid #eee; margin-top: 4px;">
|
||||
<a href="javascript:void(0);"
|
||||
style="color: #ff4d4f; flex: 1; text-align: center; padding: 4px 0; text-decoration: none;"
|
||||
@click="clearNotice">
|
||||
style="color: #ff4d4f; flex: 1; text-align: center; padding: 4px 0; text-decoration: none;">
|
||||
<i class="fa"></i> 清除所有
|
||||
</a>
|
||||
<a data-open="/sys/notice" href="javascript:void(0);"
|
||||
<a href="javascript:void(0);"
|
||||
style="flex: 1; text-align: center; padding: 4px 0; text-decoration: none; color: inherit;">
|
||||
<i class="fa"></i> 查看更多
|
||||
</a>
|
||||
@@ -192,9 +191,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<audio id="notification-sound" hidden>
|
||||
<source src="/static/audio/message-ding.mp3" type="audio/mpeg">
|
||||
</audio>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -211,8 +207,6 @@
|
||||
var log_data = {};
|
||||
var heartbeatInterval = null;
|
||||
var pongTimeout = null;
|
||||
const $audio = $('#notification-sound');
|
||||
let isAudioLoaded = false; // 标记音频是否预加载完成
|
||||
(function ($) {
|
||||
_index_vue_obj = new Vue({
|
||||
el: '#index-vue-app',
|
||||
@@ -222,52 +216,11 @@
|
||||
},
|
||||
mounted: function () {
|
||||
},
|
||||
methods: {
|
||||
clearNotice() {
|
||||
let that = this;
|
||||
$.post('/common/set_notice', {}, function (data) {
|
||||
if (data.code) {
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
that.countNotice = 0;
|
||||
that.notice = [];
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
})
|
||||
},
|
||||
setRead(item, index) {
|
||||
let that = this;
|
||||
$.post('/common/set_notice', {id: item.id}, function (data) {
|
||||
if (data.code) {
|
||||
that.notice.splice(index, 1);
|
||||
that.countNotice--;
|
||||
let btn = ['关闭'];
|
||||
if (item.url) {
|
||||
btn = ['查看详情', '关闭'];
|
||||
}
|
||||
layer.confirm(item.content, {
|
||||
btn: btn,
|
||||
title: '通知详情'
|
||||
}, function (index) {
|
||||
// 点击查看详情
|
||||
if (item.url) {
|
||||
$.form.href(item.url);
|
||||
}
|
||||
layer.close(index);
|
||||
}, function (index) {
|
||||
// 点击关闭
|
||||
layer.close(index);
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
methods: {}
|
||||
});
|
||||
// 初始化 WebSocket 连接
|
||||
initWebSocket();
|
||||
|
||||
$(".coms-layout-header .bars-nav").on("click", function (event) {
|
||||
event.stopPropagation()
|
||||
var $headNav = $(".header-nav");
|
||||
@@ -313,14 +266,7 @@
|
||||
color: '#000',
|
||||
alpha: 0.03,
|
||||
});
|
||||
|
||||
// 1. 监听音频预加载完成事件
|
||||
$audio.on('canplaythrough', function () {
|
||||
isAudioLoaded = true;
|
||||
console.log('音频预加载完成,等待通知触发播放');
|
||||
});
|
||||
})
|
||||
|
||||
})(jQuery)
|
||||
|
||||
function initWebSocket() {
|
||||
@@ -365,7 +311,7 @@
|
||||
|
||||
// 连接关闭事件
|
||||
websocket.onclose = function (event) {
|
||||
console.log('websocket 关闭连接', event);
|
||||
console.log('websocket 关闭连接');
|
||||
if (heartbeatInterval) {
|
||||
clearInterval(heartbeatInterval);
|
||||
heartbeatInterval = null;
|
||||
@@ -394,12 +340,9 @@
|
||||
switch (data.type) {
|
||||
case 'notice':
|
||||
// 显示通知消息
|
||||
let message = data.data.content ? data.data.content : "您收到一条新的系统通知,请及时查看";
|
||||
showNotification(message);
|
||||
showNotification("您收到一条新的系统通知,请及时查看");
|
||||
_index_vue_obj.countNotice++;
|
||||
_index_vue_obj.notice = [data.data].concat(_index_vue_obj.notice);
|
||||
// 播放提示音
|
||||
playNotificationSound();
|
||||
break;
|
||||
case 'heartbeat':
|
||||
// 收到pong响应时清除超时定时器
|
||||
@@ -424,26 +367,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 新增播放提示音函数
|
||||
function playNotificationSound() {
|
||||
// 先判断音频是否加载完成 + 浏览器是否允许播放(需用户曾交互过页面)
|
||||
if (!isAudioLoaded) {
|
||||
console.log('音频未加载完成,无法播放');
|
||||
return;
|
||||
}
|
||||
// 尝试播放,处理浏览器限制(如未交互导致的失败)
|
||||
$audio[0].currentTime = 0; // 重置播放位置(避免重复通知时只播后半段)
|
||||
$audio[0].play()
|
||||
.then(() => {
|
||||
console.log('通知音频播放成功');
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('播放失败(可能需用户先点击页面):', err.message);
|
||||
// 可选:提示用户点击页面激活音频
|
||||
alert('请先点击页面任意位置,启用通知音效');
|
||||
});
|
||||
}
|
||||
|
||||
// 提供全局发送消息的方法
|
||||
window.sendWebSocketMessage = function (message) {
|
||||
if (window.adminWebsocket &&
|
||||
|
||||
@@ -415,12 +415,6 @@
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="am-form-group" v-if="info.app_id==1 && info.pingan_user_id>0">
|
||||
<label class="am-para-label label-width w150">通知平安坐席:</label>
|
||||
<div class="am-para-input wp80" style="margin-left: 150px;line-height: 40px">
|
||||
<input type="checkbox" v-model="goods.notice">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label label-width w150">内容:</label>
|
||||
<div class="am-para-input wp80" style="margin-left: 150px">
|
||||
@@ -545,7 +539,7 @@
|
||||
data: {
|
||||
info: {},
|
||||
infoShow: {},
|
||||
goods: {log: '', id: <?=$info['id']?>, type: 0, buy_time: '', notice: false},
|
||||
goods: {log: '', id: <?=$info['id']?>, type: 0, buy_time: ''},
|
||||
provinceAry: [],
|
||||
cityAry: [],
|
||||
countyAry: [],
|
||||
@@ -779,7 +773,7 @@
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
type: [1, 5],
|
||||
type: [1,5],
|
||||
page: that.brandsThPage,
|
||||
province_id: that.info.province_id_admin,
|
||||
city_id: that.info.city_id_admin,
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
province_id: <?=$params['province_id'] ? $params['province_id'] : 0?>,
|
||||
city_id: <?=$params['city_id'] ? $params['city_id'] : 0?>,
|
||||
county_id: <?=$params['county_id'] ? $params['county_id'] : 0?>,
|
||||
provinceAry: [{"id": "350000", "name": "福建省"}, {"id": "430000", "name": "湖南省"},{"id": "520000", "name": "贵州省"},{"id": "460000", "name": "海南省"},{"id": "440000", "name": "广东省"}],
|
||||
provinceAry: [{"id": "350000", "name": "福建省"}, {"id": "430000", "name": "湖南省"},{"id": "520000", "name": "贵州省"},{"id": "460000", "name": "海南省"}],
|
||||
cityAry: [],
|
||||
countyAry: [],
|
||||
bizList: [],
|
||||
|
||||
@@ -86,7 +86,6 @@
|
||||
<option value=10>厦门</option>
|
||||
<option value=38>贵阳</option>
|
||||
<option value=39>海口</option>
|
||||
<option value=99>佛山</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">定金金额:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con" v-if="info.money_json">{{info.money_json.confirm_amount}}</label>
|
||||
<label class="am-para-label-con">{{info.money_json.confirm_amount}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
@@ -37,7 +37,7 @@
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">车身优惠价:</span></label>
|
||||
<div class="am-para-input">
|
||||
<label class="am-para-label-con" v-if="info.money_json">{{info.money_json.discount_amount}}</label>
|
||||
<label class="am-para-label-con">{{info.money_json.discount_amount}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
@@ -51,7 +51,7 @@
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
<label class="am-para-label label-width"><span class="span-bold">上牌费:</span></label>
|
||||
<div class="am-para-input" style="margin-left:120px">
|
||||
<label class="am-para-label-con" v-if="info.money_json">{{info.money_json.register_amount}}</label>
|
||||
<label class="am-para-label-con">{{info.money_json.register_amount}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group am-u-lg-6">
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
<div class="coms-table-wrap">
|
||||
<div class="coms-table-hd clearfix no-border">
|
||||
<form action="/sys/notice" class="form-search" onsubmit="return false">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">状态:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="read" v-model="params.read">
|
||||
<option value="">全部</option>
|
||||
<option :value="i" v-for="(v,i) in readList">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<button type="submit" class="am-btn am-btn-sm am-btn-success w100">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">
|
||||
<label><input type="checkbox" data-check-target=".ids"></label>
|
||||
<span>ID</span>
|
||||
</th>
|
||||
<th width="20%"><span>通知内容</span></th>
|
||||
<th width="10%"><span>通知时间</span></th>
|
||||
<th width="8%"><span>状态</span></th>
|
||||
<th width="8%"><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(v,i) in lists">
|
||||
<tr>
|
||||
<td>
|
||||
<label><input type="checkbox" name="ids[]" class="ids" :value="v.id"/></label>
|
||||
</td>
|
||||
<td>
|
||||
<a v-if="v.url" :data-open="v.url" href="javascript:void(0);">
|
||||
{{v.content}}
|
||||
</a>
|
||||
<span v-else>{{ v.content }}</span>
|
||||
</td>
|
||||
<td>{{v.c_time}}</td>
|
||||
<td>
|
||||
<span v-if="v.read">{{v.readCn}}</span>
|
||||
<span v-else style="color:red">{{v.readCn}}</span>
|
||||
</td>
|
||||
<td>
|
||||
<a v-if="v.url" :data-open="v.url" href="javascript:void(0);">查看</a>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
<label class="fl mr5"><input type="checkbox" data-check-target=".ids">全选</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select data-update-group="" data-list-target=".ids" data-action="/sys/notice/edit_read"
|
||||
data-field="read">
|
||||
<option value="">批量操作</option>
|
||||
<option value="1">标记已读</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var vue_obj;
|
||||
var loading = 0;
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params: <?=json_encode($params)?>,
|
||||
lists: <?=json_encode($lists)?>,
|
||||
readList: <?=json_encode($readList)?>
|
||||
},
|
||||
mounted: function () {
|
||||
},
|
||||
methods: {},
|
||||
watch: {}
|
||||
});
|
||||
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
@@ -23,30 +23,11 @@
|
||||
<input type="text" placeholder="输入推送内容" name="content" v-model="info.content"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">
|
||||
<span class="com-must-star"></span>跳转地址:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="输入跳转地址" name="url" v-model="info.url"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-secondary" type="button" @click="saveEdit">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-modal am-modal-confirm" id="my-confirm">
|
||||
<div class="am-modal-dialog">
|
||||
<div class="am-modal-hd">Amaze UI</div>
|
||||
<div class="am-modal-bd">
|
||||
你,确定要删除这条记录吗?
|
||||
</div>
|
||||
<div class="am-modal-footer">
|
||||
<span class="am-modal-btn" data-am-modal-cancel>取消</span>
|
||||
<span class="am-modal-btn" data-am-modal-confirm>确定</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
var loading = 0;
|
||||
@@ -59,7 +40,6 @@
|
||||
platform: 1,
|
||||
uid: '',
|
||||
content: '',
|
||||
url: ''
|
||||
},
|
||||
platformList: <?=json_encode($platformList, JSON_UNESCAPED_UNICODE)?>,
|
||||
},
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* websocket配置文件
|
||||
*/
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
$config['url'] = "wss://sapi.liche.cn/wss";
|
||||
|
||||
$config['jwt_key_pingan'] = 'dvsr23423vsgAEDger'; //平安端生成用户秘钥
|
||||
$config['jwt_key_system'] = '2343ljfwefefew';//后端生成用户秘钥
|
||||
|
||||
$config['jwt_algorithm'] = 'HS256';
|
||||
@@ -1,203 +0,0 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class BaseCommon extends CI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
|
||||
header("Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With");
|
||||
$this->load->model('area_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* 省市区数据
|
||||
* @return void
|
||||
*/
|
||||
public function regionsData()
|
||||
{
|
||||
$req = $this->area_model->getDataByTree();
|
||||
echo json_encode($req, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取品牌
|
||||
* @return void
|
||||
*/
|
||||
public function autoBrand()
|
||||
{
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->mdAutoBrand->set_db('ssdb');
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
];
|
||||
$lists = $this->mdAutoBrand->select($where, 'initial asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车系
|
||||
* @return void
|
||||
*/
|
||||
public function autoSeries()
|
||||
{
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$this->mdAutoSeries->set_db('ssdb');
|
||||
$brandId = intval($this->input->get('brandId'));
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
'brand_id' => $brandId
|
||||
];
|
||||
$lists = $this->mdAutoSeries->select($where, 'id asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车型
|
||||
* @return void
|
||||
*/
|
||||
public function autoCar()
|
||||
{
|
||||
$this->load->model('auto/auto_cars_model', 'mdAutoCar');
|
||||
$this->mdAutoCar->set_db('ssdb');
|
||||
$seriesId = intval($this->input->get('seriesId'));
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
'series_id' => $seriesId
|
||||
];
|
||||
$lists = $this->mdAutoCar->select($where, 'id asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有门店
|
||||
* @return void
|
||||
*/
|
||||
public function allBiz()
|
||||
{
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('biz/biz_car_brand_model');
|
||||
$this->load->model('agent/auto_product_model');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$this->biz_car_brand_model->set_db('ssdb');
|
||||
$productId = intval($this->input->get('productId'));
|
||||
$types = Biz_model::BIZ_TYPE_4s . ',' . Biz_model::BIZ_TYPE_SPACE;
|
||||
$where = [
|
||||
'status' => 1,
|
||||
];
|
||||
if ($productId) {
|
||||
$product = $this->auto_product_model->get(['id' => $productId]);
|
||||
$brandId = $product['brandId'] ?: 0;
|
||||
$brandBizList = $this->biz_car_brand_model->select(['brand_id' => $brandId], '', '', '', 'biz_id');
|
||||
$bizIdArray = array_column($brandBizList, 'biz_id');
|
||||
$bizIdString = $bizIdArray ? implode(',', $bizIdArray) : 0;
|
||||
$where["(id in ({$bizIdString}) and type=" . Biz_model::BIZ_TYPE_4s . " or type=" . Biz_model::BIZ_TYPE_SPACE . ")"] = null;
|
||||
} else {
|
||||
$where["type in ({$types})"] = null;
|
||||
}
|
||||
$lists = $this->biz_model->select($where, 'id desc', 0, 0, 'id,biz_name as name,city_id');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
public function autoBrands()
|
||||
{
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$this->load->model('auto/auto_cars_model', 'mdAutoCar');
|
||||
$this->mdAutoBrand->set_db('ssdb');
|
||||
$this->mdAutoSeries->set_db('ssdb');
|
||||
$this->mdAutoCar->set_db('ssdb');
|
||||
$redis = load_cache("redis");
|
||||
$cKey = 'SYS_BRAND_TREE_DATA';
|
||||
$cacheList = $redis->get($cKey);
|
||||
if ($cacheList) {
|
||||
die(json_encode($cacheList, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
$where = ['status' => 1];
|
||||
$brandRows = $this->mdAutoBrand->select($where, 'initial asc', 0, 0);
|
||||
$seriesRows = $this->mdAutoSeries->map('brand_id', '', $where, 'id desc', 0, 0);
|
||||
$carRows = $this->mdAutoCar->map('series_id', '', $where, 'id desc', 0, 0, 'id as value,name as label,series_id');
|
||||
$lists = [];
|
||||
foreach ($brandRows as $brandRow) {
|
||||
$children = [];
|
||||
$brand = [
|
||||
'value' => $brandRow['id'],
|
||||
'label' => $brandRow['name'],
|
||||
];
|
||||
if ($seriesRows[$brandRow['id']]) {
|
||||
foreach ($seriesRows[$brandRow['id']] as $seriesRow) {
|
||||
$seriesChildren = $carRows[$seriesRow['id']] ?: [];
|
||||
$children[] = [
|
||||
'value' => $seriesRow['id'],
|
||||
'label' => $seriesRow['name'],
|
||||
'children' => $seriesChildren
|
||||
];
|
||||
}
|
||||
}
|
||||
$brand['children'] = $children;
|
||||
$lists[] = $brand;
|
||||
}
|
||||
$redis->save($cKey, $lists, 24 * 60 * 60);
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有门店
|
||||
* @return void
|
||||
*/
|
||||
public function allProvinceBiz()
|
||||
{
|
||||
$this->load->model('area_model');
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('agent/auto_product_model');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$this->area_model->set_db('ssdb');
|
||||
$type = Biz_model::BIZ_TYPE_4s;
|
||||
$where = [
|
||||
'status' => 1,
|
||||
'type' => $type
|
||||
];
|
||||
$lists = $this->biz_model->map('city_id', '', $where, 'id desc', 0, 0, 'id as value,biz_name as label,city_id');
|
||||
$provinceTree = $this->area_model->getDataByTree();
|
||||
$resList = [];
|
||||
foreach ($provinceTree as $item) {
|
||||
$children = $item['children'];
|
||||
$newChildren = [];
|
||||
foreach ($children as $key => $item2) {
|
||||
if ($lists[$item2['value']]) {
|
||||
$item2['children'] = $lists[$item2['value']];
|
||||
$newChildren[] = $item2;
|
||||
} else {
|
||||
$children[$key]['children'] = [];
|
||||
}
|
||||
}
|
||||
if ($newChildren) {
|
||||
$resList[] = [
|
||||
'value' => $item['value'],
|
||||
'label' => $item['label'],
|
||||
'children' => $newChildren
|
||||
];
|
||||
}
|
||||
}
|
||||
echo json_encode($resList, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户归属中心
|
||||
* @return void
|
||||
*/
|
||||
public function centerList()
|
||||
{
|
||||
$this->load->model('agent/pingan/pingan_users_model');
|
||||
$res = Pingan_users_model::TYPE_CENTER;
|
||||
echo json_encode($res, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
public function orgNameList()
|
||||
{
|
||||
$this->load->model('agent/pingan/pingan_users_model');
|
||||
echo json_encode(Pingan_users_model::orgNameList, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,200 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/BaseCommon.php';
|
||||
|
||||
class Common extends BaseCommon
|
||||
class Common extends CI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('area_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* 省市区数据
|
||||
* @return void
|
||||
*/
|
||||
public function regionsData()
|
||||
{
|
||||
$req = $this->area_model->getDataByTree();
|
||||
echo json_encode($req, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取品牌
|
||||
* @return void
|
||||
*/
|
||||
public function autoBrand()
|
||||
{
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->mdAutoBrand->set_db('ssdb');
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
];
|
||||
$lists = $this->mdAutoBrand->select($where, 'initial asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车系
|
||||
* @return void
|
||||
*/
|
||||
public function autoSeries()
|
||||
{
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$this->mdAutoSeries->set_db('ssdb');
|
||||
$brandId = intval($this->input->get('brandId'));
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
'brand_id' => $brandId
|
||||
];
|
||||
$lists = $this->mdAutoSeries->select($where, 'id asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车型
|
||||
* @return void
|
||||
*/
|
||||
public function autoCar()
|
||||
{
|
||||
$this->load->model('auto/auto_cars_model', 'mdAutoCar');
|
||||
$this->mdAutoCar->set_db('ssdb');
|
||||
$seriesId = intval($this->input->get('seriesId'));
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
'series_id' => $seriesId
|
||||
];
|
||||
$lists = $this->mdAutoCar->select($where, 'id asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有门店
|
||||
* @return void
|
||||
*/
|
||||
public function allBiz()
|
||||
{
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('biz/biz_car_brand_model');
|
||||
$this->load->model('agent/auto_product_model');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$this->biz_car_brand_model->set_db('ssdb');
|
||||
$productId = intval($this->input->get('productId'));
|
||||
$types = Biz_model::BIZ_TYPE_4s . ',' . Biz_model::BIZ_TYPE_SPACE;
|
||||
$where = [
|
||||
'status' => 1,
|
||||
];
|
||||
if ($productId) {
|
||||
$product = $this->auto_product_model->get(['id' => $productId]);
|
||||
$brandId = $product['brandId'] ?: 0;
|
||||
$brandBizList = $this->biz_car_brand_model->select(['brand_id' => $brandId], '', '', '', 'biz_id');
|
||||
$bizIdArray = array_column($brandBizList, 'biz_id');
|
||||
$bizIdString = $bizIdArray ? implode(',', $bizIdArray) : 0;
|
||||
$where["(id in ({$bizIdString}) and type=" . Biz_model::BIZ_TYPE_4s . " or type=" . Biz_model::BIZ_TYPE_SPACE . ")"] = null;
|
||||
} else {
|
||||
$where["type in ({$types})"] = null;
|
||||
}
|
||||
$lists = $this->biz_model->select($where, 'id desc', 0, 0, 'id,biz_name as name,city_id');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
public function autoBrands()
|
||||
{
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$this->load->model('auto/auto_cars_model', 'mdAutoCar');
|
||||
$this->mdAutoBrand->set_db('ssdb');
|
||||
$this->mdAutoSeries->set_db('ssdb');
|
||||
$this->mdAutoCar->set_db('ssdb');
|
||||
$redis = load_cache("redis");
|
||||
$cKey = 'SYS_BRAND_TREE_DATA';
|
||||
$cacheList = $redis->get($cKey);
|
||||
if ($cacheList) {
|
||||
die(json_encode($cacheList, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
$where = ['status' => 1];
|
||||
$brandRows = $this->mdAutoBrand->select($where, 'initial asc', 0, 0);
|
||||
$seriesRows = $this->mdAutoSeries->map('brand_id', '', $where, 'id desc', 0, 0);
|
||||
$carRows = $this->mdAutoCar->map('series_id', '', $where, 'id desc', 0, 0, 'id as value,name as label,series_id');
|
||||
$lists = [];
|
||||
foreach ($brandRows as $brandRow) {
|
||||
$children = [];
|
||||
$brand = [
|
||||
'value' => $brandRow['id'],
|
||||
'label' => $brandRow['name'],
|
||||
];
|
||||
if ($seriesRows[$brandRow['id']]) {
|
||||
foreach ($seriesRows[$brandRow['id']] as $seriesRow) {
|
||||
$seriesChildren = $carRows[$seriesRow['id']] ?: [];
|
||||
$children[] = [
|
||||
'value' => $seriesRow['id'],
|
||||
'label' => $seriesRow['name'],
|
||||
'children' => $seriesChildren
|
||||
];
|
||||
}
|
||||
}
|
||||
$brand['children'] = $children;
|
||||
$lists[] = $brand;
|
||||
}
|
||||
$redis->save($cKey, $lists, 24 * 60 * 60);
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有门店
|
||||
* @return void
|
||||
*/
|
||||
public function allProvinceBiz()
|
||||
{
|
||||
$this->load->model('area_model');
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('agent/auto_product_model');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$this->area_model->set_db('ssdb');
|
||||
$type = Biz_model::BIZ_TYPE_4s;
|
||||
$where = [
|
||||
'status' => 1,
|
||||
'type' => $type
|
||||
];
|
||||
$lists = $this->biz_model->map('city_id', '', $where, 'id desc', 0, 0, 'id as value,biz_name as label,city_id');
|
||||
$provinceTree = $this->area_model->getDataByTree();
|
||||
$resList = [];
|
||||
foreach ($provinceTree as $item) {
|
||||
$children = $item['children'];
|
||||
$newChildren = [];
|
||||
foreach ($children as $key => $item2) {
|
||||
if ($lists[$item2['value']]) {
|
||||
$item2['children'] = $lists[$item2['value']];
|
||||
$newChildren[] = $item2;
|
||||
} else {
|
||||
$children[$key]['children'] = [];
|
||||
}
|
||||
}
|
||||
if ($newChildren) {
|
||||
$resList[] = [
|
||||
'value' => $item['value'],
|
||||
'label' => $item['label'],
|
||||
'children' => $newChildren
|
||||
];
|
||||
}
|
||||
}
|
||||
echo json_encode($resList, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户归属中心
|
||||
* @return void
|
||||
*/
|
||||
public function centerList()
|
||||
{
|
||||
$this->load->model('agent/pingan/pingan_users_model');
|
||||
$res = Pingan_users_model::TYPE_CENTER;
|
||||
echo json_encode($res, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
public function orgNameList()
|
||||
{
|
||||
$this->load->model('agent/pingan/pingan_users_model');
|
||||
echo json_encode(Pingan_users_model::orgNameList, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,203 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/BaseCommon.php';
|
||||
|
||||
class Common extends BaseCommon
|
||||
class Common extends CI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
|
||||
header("Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With");
|
||||
$this->load->model('area_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* 省市区数据
|
||||
* @return void
|
||||
*/
|
||||
public function regionsData()
|
||||
{
|
||||
$req = $this->area_model->getDataByTree();
|
||||
echo json_encode($req, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取品牌
|
||||
* @return void
|
||||
*/
|
||||
public function autoBrand()
|
||||
{
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->mdAutoBrand->set_db('ssdb');
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
];
|
||||
$lists = $this->mdAutoBrand->select($where, 'initial asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车系
|
||||
* @return void
|
||||
*/
|
||||
public function autoSeries()
|
||||
{
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$this->mdAutoSeries->set_db('ssdb');
|
||||
$brandId = intval($this->input->get('brandId'));
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
'brand_id' => $brandId
|
||||
];
|
||||
$lists = $this->mdAutoSeries->select($where, 'id asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车型
|
||||
* @return void
|
||||
*/
|
||||
public function autoCar()
|
||||
{
|
||||
$this->load->model('auto/auto_cars_model', 'mdAutoCar');
|
||||
$this->mdAutoCar->set_db('ssdb');
|
||||
$seriesId = intval($this->input->get('seriesId'));
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
'series_id' => $seriesId
|
||||
];
|
||||
$lists = $this->mdAutoCar->select($where, 'id asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有门店
|
||||
* @return void
|
||||
*/
|
||||
public function allBiz()
|
||||
{
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('biz/biz_car_brand_model');
|
||||
$this->load->model('agent/auto_product_model');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$this->biz_car_brand_model->set_db('ssdb');
|
||||
$productId = intval($this->input->get('productId'));
|
||||
$types = Biz_model::BIZ_TYPE_4s . ',' . Biz_model::BIZ_TYPE_SPACE;
|
||||
$where = [
|
||||
'status' => 1,
|
||||
];
|
||||
if ($productId) {
|
||||
$product = $this->auto_product_model->get(['id' => $productId]);
|
||||
$brandId = $product['brandId'] ?: 0;
|
||||
$brandBizList = $this->biz_car_brand_model->select(['brand_id' => $brandId], '', '', '', 'biz_id');
|
||||
$bizIdArray = array_column($brandBizList, 'biz_id');
|
||||
$bizIdString = $bizIdArray ? implode(',', $bizIdArray) : 0;
|
||||
$where["(id in ({$bizIdString}) and type=" . Biz_model::BIZ_TYPE_4s . " or type=" . Biz_model::BIZ_TYPE_SPACE . ")"] = null;
|
||||
} else {
|
||||
$where["type in ({$types})"] = null;
|
||||
}
|
||||
$lists = $this->biz_model->select($where, 'id desc', 0, 0, 'id,biz_name as name,city_id');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
public function autoBrands()
|
||||
{
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$this->load->model('auto/auto_cars_model', 'mdAutoCar');
|
||||
$this->mdAutoBrand->set_db('ssdb');
|
||||
$this->mdAutoSeries->set_db('ssdb');
|
||||
$this->mdAutoCar->set_db('ssdb');
|
||||
$redis = load_cache("redis");
|
||||
$cKey = 'SYS_BRAND_TREE_DATA';
|
||||
$cacheList = $redis->get($cKey);
|
||||
if ($cacheList) {
|
||||
die(json_encode($cacheList, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
$where = ['status' => 1];
|
||||
$brandRows = $this->mdAutoBrand->select($where, 'initial asc', 0, 0);
|
||||
$seriesRows = $this->mdAutoSeries->map('brand_id', '', $where, 'id desc', 0, 0);
|
||||
$carRows = $this->mdAutoCar->map('series_id', '', $where, 'id desc', 0, 0, 'id as value,name as label,series_id');
|
||||
$lists = [];
|
||||
foreach ($brandRows as $brandRow) {
|
||||
$children = [];
|
||||
$brand = [
|
||||
'value' => $brandRow['id'],
|
||||
'label' => $brandRow['name'],
|
||||
];
|
||||
if ($seriesRows[$brandRow['id']]) {
|
||||
foreach ($seriesRows[$brandRow['id']] as $seriesRow) {
|
||||
$seriesChildren = $carRows[$seriesRow['id']] ?: [];
|
||||
$children[] = [
|
||||
'value' => $seriesRow['id'],
|
||||
'label' => $seriesRow['name'],
|
||||
'children' => $seriesChildren
|
||||
];
|
||||
}
|
||||
}
|
||||
$brand['children'] = $children;
|
||||
$lists[] = $brand;
|
||||
}
|
||||
$redis->save($cKey, $lists, 24 * 60 * 60);
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有门店
|
||||
* @return void
|
||||
*/
|
||||
public function allProvinceBiz()
|
||||
{
|
||||
$this->load->model('area_model');
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('agent/auto_product_model');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$this->area_model->set_db('ssdb');
|
||||
$type = Biz_model::BIZ_TYPE_4s;
|
||||
$where = [
|
||||
'status' => 1,
|
||||
'type' => $type
|
||||
];
|
||||
$lists = $this->biz_model->map('city_id', '', $where, 'id desc', 0, 0, 'id as value,biz_name as label,city_id');
|
||||
$provinceTree = $this->area_model->getDataByTree();
|
||||
$resList = [];
|
||||
foreach ($provinceTree as $item) {
|
||||
$children = $item['children'];
|
||||
$newChildren = [];
|
||||
foreach ($children as $key => $item2) {
|
||||
if ($lists[$item2['value']]) {
|
||||
$item2['children'] = $lists[$item2['value']];
|
||||
$newChildren[] = $item2;
|
||||
} else {
|
||||
$children[$key]['children'] = [];
|
||||
}
|
||||
}
|
||||
if ($newChildren) {
|
||||
$resList[] = [
|
||||
'value' => $item['value'],
|
||||
'label' => $item['label'],
|
||||
'children' => $newChildren
|
||||
];
|
||||
}
|
||||
}
|
||||
echo json_encode($resList, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户归属中心
|
||||
* @return void
|
||||
*/
|
||||
public function centerList()
|
||||
{
|
||||
$this->load->model('agent/pingan/pingan_users_model');
|
||||
$res = Pingan_users_model::TYPE_CENTER;
|
||||
echo json_encode($res, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
public function orgNameList()
|
||||
{
|
||||
$this->load->model('agent/pingan/pingan_users_model');
|
||||
echo json_encode(Pingan_users_model::orgNameList, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ class Subsidy extends BaseController
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/auto_product_model');
|
||||
$this->load->model('agent/auto_product_coupon_model');
|
||||
$this->load->model('agent/auto_user_coupon_model');
|
||||
$this->load->model('agent/auto_user_data_model');
|
||||
$this->load->model('area_model');
|
||||
@@ -61,8 +59,6 @@ class Subsidy extends BaseController
|
||||
if ($orderData['cardidb']) {
|
||||
$idCardImg[] = ['title' => '身份证反面', 'img' => build_qiniu_image_url($orderData['cardidb'])];
|
||||
}
|
||||
$productCoupon = $this->auto_product_coupon_model->get(['id' => $row['couponId']]);
|
||||
$money = $productCoupon['price'] ?: 0;
|
||||
$list[] = [
|
||||
'id' => $row['id'],
|
||||
'sid' => $order['sid'],
|
||||
@@ -82,8 +78,7 @@ class Subsidy extends BaseController
|
||||
'idCardImg' => $idCardImg,
|
||||
'pTime' => $clues['p_time'] != '0000-00-00 00:00:00' ? $clues['p_time'] : '',
|
||||
'billTime' => $order['bill_time'] != '0000-00-00 00:00:00' ? $order['bill_time'] : '',
|
||||
'cluesCtime' => $order['c_time'] ? date('Y-m-d H:i:s', $order['c_time']) : '',
|
||||
'money' => $money
|
||||
'cluesCtime' => $order['c_time'] ? date('Y-m-d H:i:s', $order['c_time']) : ''
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,12 +44,7 @@ class Area extends BaseController
|
||||
*/
|
||||
public function city_get()
|
||||
{
|
||||
$provinceIds = implode(',', self::PROVINCE_LIST);
|
||||
$where = [];
|
||||
if ($provinceIds) {
|
||||
$where["province_id in ({$provinceIds})"] = null;
|
||||
}
|
||||
$city_rows = $this->area_model->select_groupby('city_id', $where, 'firstchar asc', '', '', 'firstchar,province_name,city_id,city_name');
|
||||
$city_rows = $this->area_model->select_groupby('city_id', [], 'firstchar asc', '', '', 'firstchar,province_name,city_id,city_name');
|
||||
$data = [];
|
||||
foreach ($city_rows as $item) {
|
||||
$data[$item['firstchar']][] = [
|
||||
@@ -57,11 +52,11 @@ class Area extends BaseController
|
||||
'city_name' => $item['city_name'] != '市辖区' ? $item['city_name'] : $item['province_name']
|
||||
];
|
||||
}
|
||||
// foreach (range('A', 'Z') as $letter) {
|
||||
// if (!isset($data[$letter])) {
|
||||
// $data[$letter] = [];
|
||||
// }
|
||||
// }
|
||||
foreach (range('A', 'Z') as $letter) {
|
||||
if (!isset($data[$letter])) {
|
||||
$data[$letter] = [];
|
||||
}
|
||||
}
|
||||
ksort($data);
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
@@ -19,21 +19,14 @@ abstract class BaseController extends REST_Controller
|
||||
|
||||
const CODE_BM = 'bm'; //报名
|
||||
const CODE_BANK = 'bank'; //绑定银行卡
|
||||
const CODE_LOGIN = 'login'; //登录验证码
|
||||
|
||||
//短信验证码类型
|
||||
protected $codeCachePre = [
|
||||
self::CODE_BM => 'AUTO_BM_%s',
|
||||
self::CODE_BANK => 'AUTO_BANK_%s',
|
||||
self::CODE_LOGIN => 'AUTO_LOGIN_%s'
|
||||
self::CODE_BANK => 'AUTO_BANK_%s'
|
||||
];
|
||||
const SERVICE_PHONE = '13388887777';
|
||||
const APP_ID = 1; //应用id
|
||||
const DEFAULT_AVATAR = 'https://img.liche.cn/liche/2025/11/77c2d0795e49dd06/e5a81f095b32724b.jpg?imageView2/2/w/200/h/200/interlace/1';
|
||||
//显示对应省份
|
||||
const PROVINCE_LIST = [
|
||||
350000, 440000, 460000
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -82,38 +82,24 @@ class Config extends BaseController
|
||||
];
|
||||
$latitude = $this->input_param('latitude');
|
||||
$longitude = $this->input_param('longitude');
|
||||
$cityId = $this->input_param('cityId');
|
||||
if ($cityId) {
|
||||
$row = $this->area_model->get(['city_id' => $cityId]);
|
||||
if ($row) {
|
||||
$data = [
|
||||
'provinceId' => $row['province_id'],
|
||||
'provinceName' => $row['province_name'],
|
||||
'cityId' => $row['city_id'],
|
||||
'cityName' => $row['city_name'],
|
||||
];
|
||||
}
|
||||
} else {
|
||||
if (!$latitude || !$longitude) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$tcGeocoder = new TcGeocoder();
|
||||
$result = $tcGeocoder->reverseGeocode($latitude, $longitude);
|
||||
debug_log("解析结果:" . json_encode($result), 'local.log');
|
||||
if (!$result) {
|
||||
$this->return_response($data);
|
||||
// $this->return_json('地址解析失败');
|
||||
}
|
||||
$adcode = $result['ad_info']['adcode'];
|
||||
$row = $this->area_model->get(['county_id' => $adcode]);
|
||||
if ($row && in_array($row['province_id'], self::PROVINCE_LIST)) {
|
||||
$data = [
|
||||
'provinceId' => $row['province_id'],
|
||||
'provinceName' => $row['province_name'],
|
||||
'cityId' => $row['city_id'],
|
||||
'cityName' => $row['city_name'],
|
||||
];
|
||||
}
|
||||
if (!$latitude || !$longitude) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$tcGeocoder = new TcGeocoder();
|
||||
$result = $tcGeocoder->reverseGeocode($latitude, $longitude);
|
||||
debug_log("解析结果:".json_encode($result),'local.log');
|
||||
if (!$result) {
|
||||
$this->return_json('地址解析失败');
|
||||
}
|
||||
$adcode = $result['ad_info']['adcode'];
|
||||
$row = $this->area_model->get(['county_id' => $adcode]);
|
||||
if ($row) {
|
||||
$data = [
|
||||
'provinceId' => $row['province_id'],
|
||||
'provinceName' => $row['province_name'],
|
||||
'cityId' => $row['city_id'],
|
||||
'cityName' => $row['city_name'],
|
||||
];
|
||||
}
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
@@ -48,43 +48,7 @@ class Login extends BaseController
|
||||
}
|
||||
|
||||
/** @var MyResponse $response */
|
||||
$response = $this->autoUserModel->initUser('', $ret['openid'], $accountId, $from, $otherInfo);
|
||||
if (!$response->isSuccess()) {
|
||||
$this->return_json($response->getMessage());
|
||||
}
|
||||
$responseData = $response->getData();
|
||||
$data = [
|
||||
'Authorization' => generateToken([$responseData['id'], $responseData['orgId'] ?: 0], 'jwt_key_auto'),
|
||||
];
|
||||
$this->return_response($data, API_CODE_SUCCESS);
|
||||
} catch (Exception $e) {
|
||||
$this->return_json($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function mobile_post()
|
||||
{
|
||||
try {
|
||||
$accountId = $this->input_param('accountId');
|
||||
$cfrom = $this->input_param('cfrom');
|
||||
$mobile = $this->input_param('mobile');
|
||||
$code = $this->input_param('code');
|
||||
if (!mobile_valid($mobile)) {
|
||||
throw new Exception('请输入正确手机号');
|
||||
}
|
||||
//校验验证码
|
||||
$redis = &load_cache();
|
||||
$key = $this->getCodeCacheKey(self::CODE_LOGIN, $mobile);
|
||||
$cacheCode = $redis->get($key);
|
||||
if (!$cacheCode || $cacheCode != $code) {
|
||||
throw new Exception("验证码错误");
|
||||
}
|
||||
$otherInfo['cfrom'] = $cfrom;
|
||||
/** @var MyResponse $response */
|
||||
$response = $this->autoUserModel->initUser($mobile, '', $accountId, '', $otherInfo);
|
||||
$response = $this->autoUserModel->initUser($ret['openid'], $accountId, $from, $otherInfo);
|
||||
if (!$response->isSuccess()) {
|
||||
$this->return_json($response->getMessage());
|
||||
}
|
||||
|
||||
@@ -31,14 +31,11 @@ class Sms extends BaseController
|
||||
case self::CODE_BANK:
|
||||
$cacheKey = $this->getCodeCacheKey(self::CODE_BANK, $mobile);
|
||||
break;
|
||||
case self::CODE_LOGIN:
|
||||
$cacheKey = $this->getCodeCacheKey(self::CODE_LOGIN, $mobile);
|
||||
break;
|
||||
default:
|
||||
$this->return_json('验证码类型错误');
|
||||
}
|
||||
$redis = &load_cache();
|
||||
$code = $this->get($cacheKey);
|
||||
// $key = $this->getCodeCacheKey(self::CODE_BM, $mobile);
|
||||
if (!$redis->get($cacheKey)) {
|
||||
$this->load->helper('string');
|
||||
$code = random_string('numeric', 4);
|
||||
@@ -49,16 +46,6 @@ class Sms extends BaseController
|
||||
ems_sms($mobile, $content);
|
||||
$redis->save($cacheKey, $code, 600);
|
||||
}
|
||||
$this->return_response([], '发送成功' . $code);
|
||||
$this->return_response([], '发送成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function login_post()
|
||||
{
|
||||
$this->index_post();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,7 +19,6 @@ class Subsidy extends BaseController
|
||||
$this->auto_series_model->set_db('ssdb');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$this->receiver_orders_model->set_db('ssdb');
|
||||
$this->load->library('TcOrc');
|
||||
}
|
||||
|
||||
public function index_post()
|
||||
@@ -36,26 +35,6 @@ class Subsidy extends BaseController
|
||||
if (!$result->isSuccess()) {
|
||||
throw new Exception($result->getMessage());
|
||||
}
|
||||
$reqData = $result->getData();
|
||||
//识别发票
|
||||
if ($params['businessImg'] && $reqData['orderId']) {
|
||||
$url = build_qiniu_image_url($params['businessImg']);
|
||||
$billTime = "";
|
||||
$ocrResult = $this->tcorc->CarInvoiceInfos($url);
|
||||
if ($ocrResult['code'] && $ocrResult['data']['CarInvoiceInfos']) {
|
||||
$carInvoiceInfos = $ocrResult['data']['CarInvoiceInfos'];
|
||||
foreach ($carInvoiceInfos as $item) {
|
||||
if ($item['Name'] == '开票日期') {
|
||||
$billTime = str_replace(['年', '月', '日'], ['-', '-', ''], $item['Value']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$billTime = date('Y-m-d', strtotime($billTime));
|
||||
}
|
||||
if ($billTime) {
|
||||
$this->receiver_orders_model->update(['bill_time' => $billTime], ['id' => $reqData['orderId']]);
|
||||
}
|
||||
}
|
||||
$this->return_response();
|
||||
} catch (Exception $e) {
|
||||
$this->return_json($e->getMessage());
|
||||
@@ -107,7 +86,7 @@ class Subsidy extends BaseController
|
||||
if ($row['businessImg']) {
|
||||
$insuranceFile[] = ['url' => $row['businessImg'] ? build_qiniu_image_url($row['businessImg']) : ''];
|
||||
}
|
||||
if ($row['contractImg']) {
|
||||
if($row['contractImg']){
|
||||
$contractFile[] = ['url' => $row['contractImg'] ? build_qiniu_image_url($row['contractImg']) : ''];
|
||||
}
|
||||
$data = [
|
||||
|
||||
@@ -36,7 +36,7 @@ class Ucenter extends BaseController
|
||||
{
|
||||
$user = $this->autoUserModel->get(['id' => $this->userId]);
|
||||
$data = [
|
||||
'user_info' => ['username' => $user['nickname'], 'avatar' => $user['headimg'] ?: self::DEFAULT_AVATAR],
|
||||
'user_info' => ['username' => $user['nickname'], 'avatar' => $user['headimg']],
|
||||
'menu_list' => [
|
||||
['title' => '我的券', 'type' => 1, 'url' => '/my/coupon'],
|
||||
// ['title' => '我的订单', 'type' => 1, 'url' => '/my/order'],
|
||||
@@ -201,18 +201,17 @@ class Ucenter extends BaseController
|
||||
{
|
||||
$id = $this->get('id');
|
||||
$userCoupon = $this->auto_user_coupon_model->get(['id' => $id, 'userId' => $this->userId]);
|
||||
$product = $this->auto_product_model->get(['id' => $userCoupon['productId']]);
|
||||
$where = ['cf_uid' => $this->userId, 'app_id' => Receiver_clues_model::APP_ID_ACTIVITY];
|
||||
$where = ['cf_uid' => $this->userId, 'app_id' => Receiver_clues_model::APP_ID_ACTIVITY, 'out_id' => $userCoupon['productId']];
|
||||
$cluesRow = $this->clues_model->get($where);
|
||||
$cityRow = $this->area_model->get(['city_id' => $cluesRow['city_id']]);
|
||||
$brand = $this->auto_brand_model->get(['id' => $product['brand_id']], 'name');
|
||||
$series = $this->auto_series_model->get(['id' => $product['series_id']], 'name');
|
||||
$brand = $this->auto_brand_model->get(['id' => $cluesRow['brand_id']], 'name');
|
||||
$series = $this->auto_series_model->get(['id' => $cluesRow['series_id']], 'name');
|
||||
$data = [
|
||||
'mobile' => mobile_asterisk($userCoupon['mobile']),
|
||||
'city' => $cityRow['province_name'] . '/' . $cityRow['city_name'],
|
||||
'cityId' => $cluesRow['city_id'] ?: '',
|
||||
'brandId' => $product['brandId'] ?: '',
|
||||
'seriesId' => $product['seriesId'] ?: '',
|
||||
'brandId' => $cluesRow['brand_id'] ?: '',
|
||||
'seriesId' => $cluesRow['series_id'] ?: '',
|
||||
'model' => "{$brand['name']} {$series['name']}"
|
||||
];
|
||||
$this->return_response($data);
|
||||
|
||||
@@ -19,64 +19,29 @@ class Coupon extends BaseController
|
||||
public function index_post()
|
||||
{
|
||||
try {
|
||||
$user = $this->autoUserModel->get(['id' => $this->userId]); //当前用户信息
|
||||
if (!$this->userId) {
|
||||
throw new Exception("请先登录");
|
||||
}
|
||||
$couponId = $this->post('couponId');
|
||||
$mobile = $this->post('mobile');
|
||||
$code = $this->post('code');
|
||||
$cityId = $this->post('cityId');
|
||||
if (!$couponId) {
|
||||
if (!$couponId || !$mobile || !$code) {
|
||||
throw new Exception("参数错误");
|
||||
}
|
||||
$mobile = $user['mobile'];
|
||||
$userId = $user['id'];
|
||||
$resData = [];
|
||||
$bindUser = '';
|
||||
if (checkua() == 'wx' && !$mobile) { //微信且未绑定手机号
|
||||
$mobile = $this->post('mobile');
|
||||
$code = $this->post('code');
|
||||
if (!$mobile) {
|
||||
throw new Exception("请填写手机号");
|
||||
}
|
||||
//校验验证码
|
||||
$redis = &load_cache();
|
||||
$key = $this->getCodeCacheKey(self::CODE_BM, $mobile);
|
||||
$cacheCode = $redis->get($key);
|
||||
if (!$cacheCode || $cacheCode != $code) {
|
||||
throw new Exception("验证码错误");
|
||||
}
|
||||
$redis->delete($key);
|
||||
//查找是否存在相同未绑定微信手机号
|
||||
$bindUser = $this->autoUserModel->get(['mobile' => $mobile, 'openid' => '', 'status>' => Auto_user_model::STATUS_DELETE]);
|
||||
if ($bindUser) {
|
||||
$userId = $bindUser['id'];
|
||||
}
|
||||
} else {
|
||||
if (!$mobile) {
|
||||
throw new Exception("请先绑定手机号");
|
||||
}
|
||||
//校验验证码
|
||||
$redis = &load_cache();
|
||||
$key = $this->getCodeCacheKey(self::CODE_BM, $mobile);
|
||||
$cacheCode = $redis->get($key);
|
||||
if (!$cacheCode || $cacheCode != $code) {
|
||||
throw new Exception("验证码错误");
|
||||
}
|
||||
$result = $this->auto_user_coupon_model->getCoupon(self::APP_ID, $userId, $couponId, $mobile, $cityId);
|
||||
$result = $this->auto_user_coupon_model->getCoupon(self::APP_ID, $this->userId, $couponId, $mobile, $cityId);
|
||||
if (!$result->isSuccess()) {
|
||||
throw new Exception($result->getMessage());
|
||||
}
|
||||
// 绑定手机号
|
||||
if ($bindUser) {
|
||||
$updateUser = [
|
||||
'openid' => $user['openid'], 'nickname' => $user['nickname'],
|
||||
'headimg' => $user['headimg']
|
||||
];
|
||||
$this->autoUserModel->update($updateUser, ['id' => $bindUser['id']]);
|
||||
//作废当前用户并返回新token
|
||||
$this->autoUserModel->update(['status' => Auto_user_model::STATUS_DELETE], ['id' => $this->userId]);
|
||||
$resData = [
|
||||
'Authorization' => generateToken([$bindUser['id'], $bindUser['orgId'] ?: 0], 'jwt_key_auto'),
|
||||
];
|
||||
} else {
|
||||
//绑定手机号
|
||||
$this->autoUserModel->update(['mobile' => $mobile], ['id' => $this->userId, 'mobile' => '']);
|
||||
}
|
||||
$this->return_response($resData, '领取成功');
|
||||
$redis->delete($key);
|
||||
$this->return_response([], '领取成功');
|
||||
} catch (Exception $e) {
|
||||
$this->return_json($e->getMessage());
|
||||
}
|
||||
|
||||
@@ -87,7 +87,6 @@ class Product extends BaseController
|
||||
if (!$result) {
|
||||
$this->return_json('数据不存在');
|
||||
}
|
||||
$user = $this->autoUserModel->get(['id' => $this->userId]); //当前用户信息
|
||||
$coupon = $result->getOneCoupons($this->userId);
|
||||
$data = [
|
||||
'id' => $result->id,
|
||||
@@ -103,8 +102,7 @@ class Product extends BaseController
|
||||
'brandId' => $result->brandId,
|
||||
'seriesId' => $result->seriesId,
|
||||
'brandName' => $result->getBrandName(),
|
||||
'seriesName' => $result->getSeriesName(),
|
||||
'bindMobile' => $user['mobile'] ? 1 : 0
|
||||
'seriesName' => $result->getSeriesName()
|
||||
];
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ abstract class BaseController extends REST_Controller
|
||||
self::CODE_LOGIN => 'PINGAN_LOGIN_%s',
|
||||
self::CODE_REGISTER => 'PINGAN_REGISTER_%s'
|
||||
];
|
||||
const DEFAULT_AVATAR = 'https://img.liche.cn/liche/2025/11/77c2d0795e49dd06/e5a81f095b32724b.jpg?imageView2/2/w/200/h/200/interlace/1';
|
||||
const DEFAULT_AVATAR = 'https://img.liche.cn/space/agentadmin/202507/p_8087d3cfe434bb7a76eb4a7a802b6195.jpg?imageView2/2/w/200/h/200/interlace/1';
|
||||
protected $groupType;
|
||||
|
||||
public function __construct()
|
||||
|
||||
@@ -1,62 +1,203 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/BaseCommon.php';
|
||||
|
||||
class Common extends BaseCommon
|
||||
class Common extends CI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/pingan/pingan_users_model');
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
|
||||
header("Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With");
|
||||
$this->load->model('area_model');
|
||||
}
|
||||
|
||||
public function teamList()
|
||||
/**
|
||||
* 省市区数据
|
||||
* @return void
|
||||
*/
|
||||
public function regionsData()
|
||||
{
|
||||
$groupType = $_SESSION['groupType'];
|
||||
if ($groupType == Pingan_users_model::GROUP_TYPE_DEP) { //部经理
|
||||
$where = [
|
||||
'groupType' => Pingan_users_model::GROUP_TYPE_TEAM,
|
||||
'depId' => $_SESSION['id']
|
||||
];
|
||||
$result = $this->pingan_users_model->select($where, 'id asc', '', '', 'id as value,username as label');
|
||||
} elseif ($groupType > Pingan_users_model::GROUP_TYPE_DEP || $_SESSION['id'] == 1) { //部经理以上
|
||||
$groupList = Pingan_users_model::GROUP_TYPE_TEAM . ',' . Pingan_users_model::GROUP_TYPE_DEP;
|
||||
$where = ["groupType in ($groupList)" => null];
|
||||
if ($groupType == Pingan_users_model::GROUP_TYPE_AREA) { //区域
|
||||
$where['areaId'] = $_SESSION['id'];
|
||||
}
|
||||
$rows = $this->pingan_users_model->select($where, 'id asc', '', '', 'id,username,groupType,teamId,depId');
|
||||
$result = $this->toTree($rows);
|
||||
$req = $this->area_model->getDataByTree();
|
||||
echo json_encode($req, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取品牌
|
||||
* @return void
|
||||
*/
|
||||
public function autoBrand()
|
||||
{
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->mdAutoBrand->set_db('ssdb');
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
];
|
||||
$lists = $this->mdAutoBrand->select($where, 'initial asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车系
|
||||
* @return void
|
||||
*/
|
||||
public function autoSeries()
|
||||
{
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$this->mdAutoSeries->set_db('ssdb');
|
||||
$brandId = intval($this->input->get('brandId'));
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
'brand_id' => $brandId
|
||||
];
|
||||
$lists = $this->mdAutoSeries->select($where, 'id asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车型
|
||||
* @return void
|
||||
*/
|
||||
public function autoCar()
|
||||
{
|
||||
$this->load->model('auto/auto_cars_model', 'mdAutoCar');
|
||||
$this->mdAutoCar->set_db('ssdb');
|
||||
$seriesId = intval($this->input->get('seriesId'));
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
'series_id' => $seriesId
|
||||
];
|
||||
$lists = $this->mdAutoCar->select($where, 'id asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有门店
|
||||
* @return void
|
||||
*/
|
||||
public function allBiz()
|
||||
{
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('biz/biz_car_brand_model');
|
||||
$this->load->model('agent/auto_product_model');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$this->biz_car_brand_model->set_db('ssdb');
|
||||
$productId = intval($this->input->get('productId'));
|
||||
$types = Biz_model::BIZ_TYPE_4s . ',' . Biz_model::BIZ_TYPE_SPACE;
|
||||
$where = [
|
||||
'status' => 1,
|
||||
];
|
||||
if ($productId) {
|
||||
$product = $this->auto_product_model->get(['id' => $productId]);
|
||||
$brandId = $product['brandId'] ?: 0;
|
||||
$brandBizList = $this->biz_car_brand_model->select(['brand_id' => $brandId], '', '', '', 'biz_id');
|
||||
$bizIdArray = array_column($brandBizList, 'biz_id');
|
||||
$bizIdString = $bizIdArray ? implode(',', $bizIdArray) : 0;
|
||||
$where["(id in ({$bizIdString}) and type=" . Biz_model::BIZ_TYPE_4s . " or type=" . Biz_model::BIZ_TYPE_SPACE . ")"] = null;
|
||||
} else {
|
||||
$result = [];
|
||||
$where["type in ({$types})"] = null;
|
||||
}
|
||||
echo json_encode($result, JSON_UNESCAPED_UNICODE);
|
||||
$lists = $this->biz_model->select($where, 'id desc', 0, 0, 'id,biz_name as name,city_id');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
private function toTree($rows)
|
||||
public function autoBrands()
|
||||
{
|
||||
$result = [];
|
||||
$tempList = $rows;
|
||||
foreach ($rows as $item) {
|
||||
if ($item['groupType'] == Pingan_users_model::GROUP_TYPE_DEP) {
|
||||
$children = [];
|
||||
foreach ($tempList as $key1 => $item2) {
|
||||
if ($item2['depId'] == $item['id'] && $item2['groupType'] == Pingan_users_model::GROUP_TYPE_TEAM) {
|
||||
$children[] = [
|
||||
'value' => $item2['id'],
|
||||
'label' => $item2['username']
|
||||
];
|
||||
//删除已添加的
|
||||
unset($tempList[$key1]);
|
||||
}
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$this->load->model('auto/auto_cars_model', 'mdAutoCar');
|
||||
$this->mdAutoBrand->set_db('ssdb');
|
||||
$this->mdAutoSeries->set_db('ssdb');
|
||||
$this->mdAutoCar->set_db('ssdb');
|
||||
$redis = load_cache("redis");
|
||||
$cKey = 'SYS_BRAND_TREE_DATA';
|
||||
$cacheList = $redis->get($cKey);
|
||||
if ($cacheList) {
|
||||
die(json_encode($cacheList, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
$where = ['status' => 1];
|
||||
$brandRows = $this->mdAutoBrand->select($where, 'initial asc', 0, 0);
|
||||
$seriesRows = $this->mdAutoSeries->map('brand_id', '', $where, 'id desc', 0, 0);
|
||||
$carRows = $this->mdAutoCar->map('series_id', '', $where, 'id desc', 0, 0, 'id as value,name as label,series_id');
|
||||
$lists = [];
|
||||
foreach ($brandRows as $brandRow) {
|
||||
$children = [];
|
||||
$brand = [
|
||||
'value' => $brandRow['id'],
|
||||
'label' => $brandRow['name'],
|
||||
];
|
||||
if ($seriesRows[$brandRow['id']]) {
|
||||
foreach ($seriesRows[$brandRow['id']] as $seriesRow) {
|
||||
$seriesChildren = $carRows[$seriesRow['id']] ?: [];
|
||||
$children[] = [
|
||||
'value' => $seriesRow['id'],
|
||||
'label' => $seriesRow['name'],
|
||||
'children' => $seriesChildren
|
||||
];
|
||||
}
|
||||
$result[] = [
|
||||
'value' => $item['id'],
|
||||
'label' => $item['username'],
|
||||
'children' => $children
|
||||
}
|
||||
$brand['children'] = $children;
|
||||
$lists[] = $brand;
|
||||
}
|
||||
$redis->save($cKey, $lists, 24 * 60 * 60);
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有门店
|
||||
* @return void
|
||||
*/
|
||||
public function allProvinceBiz()
|
||||
{
|
||||
$this->load->model('area_model');
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('agent/auto_product_model');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$this->area_model->set_db('ssdb');
|
||||
$type = Biz_model::BIZ_TYPE_4s;
|
||||
$where = [
|
||||
'status' => 1,
|
||||
'type' => $type
|
||||
];
|
||||
$lists = $this->biz_model->map('city_id', '', $where, 'id desc', 0, 0, 'id as value,biz_name as label,city_id');
|
||||
$provinceTree = $this->area_model->getDataByTree();
|
||||
$resList = [];
|
||||
foreach ($provinceTree as $item) {
|
||||
$children = $item['children'];
|
||||
$newChildren = [];
|
||||
foreach ($children as $key => $item2) {
|
||||
if ($lists[$item2['value']]) {
|
||||
$item2['children'] = $lists[$item2['value']];
|
||||
$newChildren[] = $item2;
|
||||
} else {
|
||||
$children[$key]['children'] = [];
|
||||
}
|
||||
}
|
||||
if ($newChildren) {
|
||||
$resList[] = [
|
||||
'value' => $item['value'],
|
||||
'label' => $item['label'],
|
||||
'children' => $newChildren
|
||||
];
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
echo json_encode($resList, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户归属中心
|
||||
* @return void
|
||||
*/
|
||||
public function centerList()
|
||||
{
|
||||
$this->load->model('agent/pingan/pingan_users_model');
|
||||
$res = Pingan_users_model::TYPE_CENTER;
|
||||
echo json_encode($res, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
public function orgNameList()
|
||||
{
|
||||
$this->load->model('agent/pingan/pingan_users_model');
|
||||
echo json_encode(Pingan_users_model::orgNameList, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,39 +120,6 @@ class Product extends BaseController
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
//优惠券列表
|
||||
public function couponList_get()
|
||||
{
|
||||
$brands = $this->input_param('brands');
|
||||
$cityId = $this->input_param('cityId');
|
||||
$brandId = $brands[0];
|
||||
$seriesId = $brands[1];
|
||||
$page = 1;
|
||||
$limit = 200;
|
||||
if (!$seriesId || !$cityId) {
|
||||
$this->return_response();
|
||||
}
|
||||
$lists = [];
|
||||
$where = [
|
||||
"(provinceId is null or cityId={$cityId})" => null,
|
||||
"seriesId" => $seriesId,
|
||||
"status" => Auto_product_model::STATUS_NORMAL,
|
||||
];
|
||||
$productList = $this->autoProduct->selectProduct($where, "", $page, $limit);
|
||||
$productIds = $productList ? implode(',', array_column($productList, 'id')) : 0;
|
||||
$where = [
|
||||
"product_id in ({$productIds})" => null,
|
||||
];
|
||||
$coupons = $this->auto_product_coupon_model->select($where, 'id desc', $page, $limit);
|
||||
foreach ($coupons as $item) {
|
||||
$lists[] = [
|
||||
'id' => $item['id'],
|
||||
'title' => $item['title'],
|
||||
];
|
||||
}
|
||||
$this->return_response_list($lists);
|
||||
}
|
||||
|
||||
private function productList($params)
|
||||
{
|
||||
$uid = intval($_SESSION['id']);
|
||||
@@ -264,5 +231,4 @@ class Product extends BaseController
|
||||
$data = ['list' => $list, 'count' => $count, 'columns' => $columns];
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,170 +0,0 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/api/BaseController.php';
|
||||
|
||||
class Cmmssn extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/pingan/pingan_users_model', 'pinganUsers');
|
||||
|
||||
$this->load->model('agent/pingan/pingan_users_cmmssn_model', 'cmmssn_model');
|
||||
$this->load->model('receiver/receiver_clues_model');
|
||||
$this->load->model('receiver/receiver_customers_model');
|
||||
$this->load->model('receiver/order/receiver_orders_model');
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->receiver_clues_model->set_db('ssdb');
|
||||
$this->receiver_customers_model->set_db('ssdb');
|
||||
$this->receiver_orders_model->set_db('ssdb');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
}
|
||||
|
||||
public function index_get()
|
||||
{
|
||||
$params = $this->input_param();
|
||||
$data = $this->cmmssnList($params);
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
public function export_get()
|
||||
{
|
||||
$this->inputs['page'] = 1;
|
||||
$this->inputs['limit'] = 20000;
|
||||
$data = $this->cmmssnList($this->inputs);
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
public function index_put()
|
||||
{
|
||||
$ids = $this->input_param('ids');
|
||||
if (!$ids) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$ids = implode(',', $ids);
|
||||
// $row = $this->cmmssn_model->get(['id' => $params['id']]);
|
||||
// if (!$row) {
|
||||
// $this->return_json('参数错误');
|
||||
// }
|
||||
// if ($row['ifSend']) {
|
||||
// $this->return_json('已设置发放');
|
||||
// }
|
||||
$updateData = [
|
||||
'ifSend' => Pingan_users_cmmssn_model::IF_SEND_YES,
|
||||
'sendTime' => date('Y-m-d H:i:s')
|
||||
];
|
||||
$where = [
|
||||
"id in ({$ids})" => null,
|
||||
"ifSend" => Pingan_users_cmmssn_model::IF_SEND_NO
|
||||
];
|
||||
$res = $this->cmmssn_model->update($updateData, $where);
|
||||
if (!$res) {
|
||||
$this->return_json('保存失败');
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
private function cmmssnList($params)
|
||||
{
|
||||
$list = [];
|
||||
$page = $params['page'] ?: 1;
|
||||
$limit = $params['limit'] ?: 10;
|
||||
$where = [];
|
||||
if ($params['type']) {
|
||||
if ($params['type'] == 1) { //线索
|
||||
$cfType = Pingan_users_cmmssn_model::CF_TYPE_CLUES_OWN . ',' . Pingan_users_cmmssn_model::CF_TYPE_CLUES_TEAM;
|
||||
} else { //订单
|
||||
$cfType = Pingan_users_cmmssn_model::CF_TYPE_ORDER_OWN . ',' . Pingan_users_cmmssn_model::CF_TYPE_ORDER_TEAM;
|
||||
}
|
||||
$where["cfType in ({$cfType})"] = null;
|
||||
}
|
||||
if ($params['username']) {
|
||||
$where["pinganUserId in (select id from lc_pingan_users where username like '%{$params['username']}%')"] = null;
|
||||
}
|
||||
if (strlen($params['ifSend'])) {
|
||||
$where["ifSend"] = intval($params['ifSend']);
|
||||
}
|
||||
if ($params['dateRange']) {
|
||||
$where["createTime>="] = date('Y-m-d 00:00:00', strtotime($params['dateRange'][0]));
|
||||
$where["createTime<="] = date('Y-m-d 23:59:59', strtotime($params['dateRange'][1]));
|
||||
}
|
||||
if ($params['lg_money']) {
|
||||
$where["pinganUserId in (select pinganUserId from lc_pingan_users_cmmssn where ifSend=0 GROUP BY pinganUserId HAVING SUM(money) > {$params['lg_money']})"] = null;
|
||||
}
|
||||
$count = $this->cmmssn_model->count($where);
|
||||
if ($count) {
|
||||
$rows = $this->cmmssn_model->select($where, 'id desc', $page, $limit);
|
||||
$bizIdArray = array_unique(array_column($rows, 'bizId'));
|
||||
$bizIdIds = $bizIdArray ? implode(',', $bizIdArray) : 0;
|
||||
$where = ["id in ({$bizIdIds})" => null];
|
||||
$bizMap = $this->biz_model->map('id', 'biz_name', $where, '', '', '', 'id,biz_name');
|
||||
//获取坐席
|
||||
$userIdArray = array_unique(array_column($rows, 'pinganUserId'));
|
||||
$userIds = $userIdArray ? implode(',', $userIdArray) : 0;
|
||||
$where = ["id in ({$userIds})" => null];
|
||||
$userMap = $this->pinganUsers->map('id', '', $where, '', '', 'id,centerNumber,username,userCode,orgName');
|
||||
foreach ($rows as $item) {
|
||||
$customer = [];
|
||||
$order = [];
|
||||
$user = $userMap[$item['pinganUserId']] ? $userMap[$item['pinganUserId']][0] : [];
|
||||
if (in_array($item['cfType'], [Pingan_users_cmmssn_model::CF_TYPE_CLUES_OWN, Pingan_users_cmmssn_model::CF_TYPE_CLUES_TEAM])) { //线索
|
||||
$customer = $this->receiver_customers_model->get(['rid' => $item['cfId'], 'un_lock' => Receiver_customers_model::LOCK_STATUS]);
|
||||
$order = $this->receiver_orders_model->get(['clue_id' => $item['cfId']]);
|
||||
}
|
||||
if (in_array($item['cfType'], [Pingan_users_cmmssn_model::CF_TYPE_ORDER_OWN, Pingan_users_cmmssn_model::CF_TYPE_ORDER_TEAM])) { //订单
|
||||
$order = $this->receiver_orders_model->get(['id' => $item['cfId']]);
|
||||
$order['customer_id'] && $customer = $this->receiver_customers_model->get(['id' => $order['customer_id']]);
|
||||
}
|
||||
if ($limit >= 10000) {
|
||||
$list[] = [
|
||||
'mobile' => $customer['mobile'] ?: '',
|
||||
'bizName' => $bizMap[$item['bizId']] ?: '',
|
||||
'centerName' => Pingan_users_model::TYPE_CENTER[$user['centerNumber']] ?: '',
|
||||
'orgName' => $user['orgName'] ?: '',
|
||||
'userName' => $user['username'] ?: '',
|
||||
'userCode' => $user['userCode'] ?: '',
|
||||
'unlockTime' => $item['createTime'],
|
||||
'orderTime' => $order['order_time'] ?: '',
|
||||
'money' => $item['money']
|
||||
];
|
||||
} else {
|
||||
$list[] = [
|
||||
'id' => $item['id'],
|
||||
'mobile' => $customer['mobile'] ?: '',
|
||||
'bizName' => $bizMap[$item['bizId']] ?: '',
|
||||
'centerName' => Pingan_users_model::TYPE_CENTER[$user['centerNumber']] ?: '',
|
||||
'userName' => $user['username'] ?: '',
|
||||
'userCode' => $user['userCode'] ?: '',
|
||||
'orgName' => $user['orgName'] ?: '',
|
||||
'unlockTime' => $item['createTime'],
|
||||
'orderTime' => $order['order_time'] ?: '',
|
||||
'typeCn' => Pingan_users_cmmssn_model::CF_TYPE_CN[$item['cfType']] ?: '',
|
||||
'money' => $item['money'],
|
||||
'sendCn' => Pingan_users_cmmssn_model::IF_SEND_CN[$item['ifSend']] ?: '',
|
||||
'ifSend' => $item['ifSend'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
$columns = [];
|
||||
if ($limit >= 10000) {
|
||||
$columns = ['线索', '解锁门店', '中心', '机构', '坐席', '坐席工号', '解锁时间', '订单时间', '佣金'];
|
||||
}
|
||||
return ['list' => $list, 'count' => $count, 'columns' => $columns];
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出佣金未发放大于100的用户数据
|
||||
* @return void
|
||||
*/
|
||||
public function exportLgMoney_get()
|
||||
{
|
||||
$this->inputs['page'] = 1;
|
||||
$this->inputs['limit'] = 20000;
|
||||
$this->inputs['lg_money'] = 100;
|
||||
$data = $this->cmmssnList($this->inputs);
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,6 @@ class Clues extends BaseController
|
||||
$this->load->model('receiver/receiver_call_wechat_model');
|
||||
$this->load->model('receiver/receiver_enroll_model');
|
||||
$this->load->model('receiver/receiver_customers_model', 'customers_model');
|
||||
$this->load->model('sys/sys_notice_model');
|
||||
$this->clues_model->set_db('ssdb');
|
||||
$this->clues_cfrom_model->set_db('ssdb');
|
||||
$this->auto_brand_model->set_db('ssdb');
|
||||
@@ -32,7 +31,6 @@ class Clues extends BaseController
|
||||
$this->receiver_call_wechat_model->set_db('ssdb');
|
||||
$this->receiver_enroll_model->set_db('ssdb');
|
||||
$this->customers_model->set_db('ssdb');
|
||||
$this->sys_notice_model->set_db('ssdb');
|
||||
$this->load->library('api/callPhone');
|
||||
}
|
||||
|
||||
@@ -118,8 +116,7 @@ class Clues extends BaseController
|
||||
public function addLog_post()
|
||||
{
|
||||
$params = $this->input_param();
|
||||
$clues = $this->clues_model->get(['id' => $params['id']]);
|
||||
if (!$clues) {
|
||||
if (!$params['id']) {
|
||||
$this->return_json('参数错误!');
|
||||
}
|
||||
if (!$params['content']) {
|
||||
@@ -133,8 +130,7 @@ class Clues extends BaseController
|
||||
'uname' => $_SESSION['username'],
|
||||
'type' => intval($params['type']),
|
||||
'log' => '修改意向购车周期为:' . $buy_time_cn,
|
||||
'c_time' => time(),
|
||||
'cf_platform' => Receiver_clue_oplogs_model::CF_PLATFORM_PINGAN_ADMIN
|
||||
'c_time' => time()
|
||||
);
|
||||
$this->mdOplogs->add($addData);
|
||||
$this->clues_model->update(['buy_time' => $params['buy_time']], ['id' => $params['id']]);
|
||||
@@ -144,32 +140,10 @@ class Clues extends BaseController
|
||||
'pingan_user_id' => $_SESSION['id'],
|
||||
'uname' => $_SESSION['username'],
|
||||
'log' => $params['content'],
|
||||
'c_time' => time(),
|
||||
'cf_platform' => Receiver_clue_oplogs_model::CF_PLATFORM_PINGAN_ADMIN
|
||||
'c_time' => time()
|
||||
);
|
||||
$id = $this->mdOplogs->add($addData);
|
||||
if ($id) {
|
||||
//消息推送给管理后台
|
||||
$admin_id = $clues['admin_id'];
|
||||
if (!$admin_id) {
|
||||
$where = [
|
||||
'clue_id' => $clues['id'],
|
||||
'uid>' => 0,
|
||||
'cf_platform' => Receiver_clue_oplogs_model::CF_PLATFORM_ADMIN
|
||||
];
|
||||
$firstRow = $this->mdOplogs->select($where, 'id asc', 1, 1);
|
||||
$admin_id = $firstRow ? $firstRow[0]['uid'] : 0;
|
||||
}
|
||||
if ($admin_id) {
|
||||
$params = [
|
||||
'platform' => Sys_notice_model::PLAT_FORM_ADMIN,
|
||||
'uid' => $admin_id,
|
||||
'content' => $addData['log'],
|
||||
'url' => '/receiver/clues/get?id=' . $clues['id'],
|
||||
];
|
||||
$sendPlatform = Sys_notice_model::PLAT_FORM_SYS_PINGAN;
|
||||
$this->sys_notice_model->addNotice($params, $sendPlatform, $_SESSION['id'], true);
|
||||
}
|
||||
$this->return_response();
|
||||
} else {
|
||||
$this->return_json('添加失败!');
|
||||
@@ -189,8 +163,7 @@ class Clues extends BaseController
|
||||
}
|
||||
$belongList = $this->pingan_users_model->levelListTree($_SESSION['id'], $_SESSION['groupType']);
|
||||
$levelList = Receiver_clues_model::LEVEL_LIST;
|
||||
$isShowTeamSearch = $_SESSION['groupType'] == Pingan_users_model::GROUP_TYPE_ATTEND ? 0 : 1;
|
||||
$data = ['statusList' => $statusList, 'belongList' => $belongList, 'levelList' => $levelList, 'isShowTeamSearch' => $isShowTeamSearch];
|
||||
$data = ['statusList' => $statusList, 'belongList' => $belongList, 'levelList' => $levelList];
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
@@ -202,7 +175,6 @@ class Clues extends BaseController
|
||||
$brands = $this->input_param('brands');
|
||||
$status = $this->input_param('status');
|
||||
$citys = $this->input_param('citys');
|
||||
$teamIds = $this->input_param('teamIds');
|
||||
// $belong = $this->input_param('belong');
|
||||
$where = [
|
||||
'app_id' => self::APP_ID,
|
||||
@@ -244,16 +216,6 @@ class Clues extends BaseController
|
||||
$seriesIdString = implode(',', $seriesIdArr);
|
||||
$seriesIdString && $where["series_id in ($seriesIdString)"] = null;
|
||||
}
|
||||
if ($teamIds) {
|
||||
$teamIdArr = [];
|
||||
foreach ($teamIds as $item) {
|
||||
$itemArray = json_decode($item, true);
|
||||
$teamIdArr[] = count($itemArray) == 1 ? $itemArray[0] : $itemArray[1];
|
||||
}
|
||||
$teamIdString = implode(',', $teamIdArr);
|
||||
!$teamIdString && $teamIdString = 0;
|
||||
$where["team_id in ($teamIdString)"] = null;
|
||||
}
|
||||
strlen($status) && $where['status'] = intval($status);
|
||||
$citys && $where['city_id'] = $citys[1];
|
||||
if ($params['dateRange'][0] && $params['dateRange'][1]) {
|
||||
@@ -361,8 +323,7 @@ class Clues extends BaseController
|
||||
'uname' => $_SESSION['username'],
|
||||
'type' => 0,
|
||||
'log' => $log,
|
||||
'c_time' => time(),
|
||||
'cf_platform' => Receiver_clue_oplogs_model::CF_PLATFORM_PINGAN_ADMIN
|
||||
'c_time' => time()
|
||||
);
|
||||
$this->mdOplogs->add($addData);
|
||||
}
|
||||
@@ -409,10 +370,7 @@ class Clues extends BaseController
|
||||
$count = $this->clues_model->count($where);
|
||||
if ($count) {
|
||||
$rows = $this->clues_model->select($where, $sort_order, $page, $limit);
|
||||
$uIdArray = array_column($rows, 'pingan_user_id');
|
||||
$teamIdArray = array_column($rows, 'team_id');
|
||||
$userIdArray = array_merge($uIdArray, $teamIdArray);
|
||||
$users = $this->pingan_users_model->get_map_by_ids($userIdArray, 'id,userCode,username,centerNumber,orgName');
|
||||
$users = $this->pingan_users_model->get_map_by_ids(array_column($rows, 'pingan_user_id'), 'id,userCode,username,centerNumber,orgName');
|
||||
//所在地区
|
||||
$county_id_arr = array_filter(array_unique(array_column($rows, 'county_id')));
|
||||
if ($county_id_arr) {
|
||||
@@ -433,7 +391,6 @@ class Clues extends BaseController
|
||||
}
|
||||
foreach ($rows as $v) {
|
||||
$belongUserName = $users[$v['pingan_user_id']] ? $users[$v['pingan_user_id']][0] : '';
|
||||
$teamUser = $users[$v['team_id']] ? $users[$v['team_id']][0] : [];
|
||||
$brandList = $this->receiver_enroll_model->getBrandsByMobile($v['mobile']);
|
||||
$poi = '';
|
||||
$area = '';
|
||||
@@ -452,15 +409,7 @@ class Clues extends BaseController
|
||||
$unlockCustomer = $unLockReason = $is_unlock = '';
|
||||
if ($v['status'] == 1) {
|
||||
$unlockCustomer = $this->customers_model->get(['rid' => $v['id'], 'un_lock' => Receiver_customers_model::LOCK_STATUS]);
|
||||
if (!$unlockCustomer) {
|
||||
if ($this->customers_model->get(['rid' => $v['id'], 'un_lock' => Receiver_customers_model::LOCK_STATUS_2])) {
|
||||
$is_unlock = '不解锁';
|
||||
} else {
|
||||
$is_unlock = '未解锁';
|
||||
}
|
||||
} else {
|
||||
$is_unlock = '已解锁';
|
||||
}
|
||||
$is_unlock = $unlockCustomer ? '已解锁' : '未解锁';
|
||||
}
|
||||
if ($limit >= 10000) {
|
||||
if ($v['status'] == 1 && !$unlockCustomer) {
|
||||
@@ -474,7 +423,6 @@ class Clues extends BaseController
|
||||
$temp = [
|
||||
'name' => $v['name'], 'mobile' => mobile_asterisk($v['mobile']), 'sid' => $v['sid'],
|
||||
'belongUserName' => $belongUserName ? $belongUserName['username'] . '(' . $belongUserName['userCode'] . ')' : '',
|
||||
'teamUser' => $teamUser['username'] ?: '',
|
||||
'centerNumber' => $belongUserName['centerNumber'] ? Pingan_users_model::TYPE_CENTER[$belongUserName['centerNumber']] : '',
|
||||
'orgName' => $belongUserName['orgName'] ?: '',
|
||||
'brandList' => implode(',', $brandList),
|
||||
@@ -498,9 +446,7 @@ class Clues extends BaseController
|
||||
'belongUserName' => $belongUserName,
|
||||
'brandList' => $brandList,
|
||||
'poi' => $poi,
|
||||
'isUnlock' => $is_unlock,
|
||||
'level' => $v['level'],
|
||||
'cityId' => $v['city_id']
|
||||
'isUnlock' => $is_unlock
|
||||
];
|
||||
}
|
||||
|
||||
@@ -509,44 +455,9 @@ class Clues extends BaseController
|
||||
}
|
||||
$columns = [];
|
||||
if ($limit >= 10000) {
|
||||
$columns = ['姓名', '手机号', '订单编号', '归属', '团队长', '中心', '机构', '关注车型', '所属省', '所属市', '主状态', '子状态', '是否解锁', '未解锁原因', '客户等级', '入池时间'];
|
||||
$columns = ['姓名', '手机号', '订单编号', '归属', '中心', '机构', '关注车型', '所属省', '所属市', '主状态', '子状态', '是否解锁', '未解锁原因', '客户等级', '入池时间'];
|
||||
}
|
||||
return ['list' => $list, 'count' => $count, 'statusList' => $statusList, 'columns' => $columns];
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新等级
|
||||
* @return void
|
||||
*/
|
||||
public function level_post()
|
||||
{
|
||||
$params = $this->input_param();
|
||||
if (!$params['id']) {
|
||||
$this->return_json('参数错误!');
|
||||
}
|
||||
$res = $this->clues_model->update(['level' => $params['level']], ['id' => $params['id']]);
|
||||
if (!$res) {
|
||||
$this->return_json('更新失败!');
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
// 发放优惠券
|
||||
public function sendCoupon_post()
|
||||
{
|
||||
$this->load->model('agent/auto_user_coupon_model');
|
||||
$params = $this->input_param();
|
||||
try {
|
||||
/** @var MyResponse $resutl */
|
||||
$resutl = $this->auto_user_coupon_model->sendCoupon($params['id'], $params['couponId']);
|
||||
if (!$resutl->isSuccess()) {
|
||||
throw new Exception($resutl->getMessage());
|
||||
}
|
||||
$this->return_response();
|
||||
} catch (Exception $e) {
|
||||
$this->return_json($e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,8 +119,7 @@ class Cmmssn extends BaseController
|
||||
'belongUserName' => $item->getBelongUser(),
|
||||
'cluesCid' => $cluesRow['sid'],
|
||||
'cluesTime' => $cluesRow ? date('Y-m-d H:i:s', $cluesRow['c_time']) : '',
|
||||
'brandSeries' => $brandSeries,
|
||||
'ifSendCn' => Pingan_users_cmmssn_model::IF_SEND_CN[$item->ifSend],
|
||||
'brandSeries' => $brandSeries
|
||||
];
|
||||
$list[] = $temp;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class Notice extends BaseController
|
||||
'read' => $item['read'],
|
||||
'readCn' => $item['read'] ? '已读' : '未读',
|
||||
'type' => $item['type'],
|
||||
'c_time' => date('Y-m-d H:i:s', $item['c_time'])
|
||||
'c_time' => date('Y-m-d H:i:s')
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -73,12 +73,11 @@ class Notice extends BaseController
|
||||
{
|
||||
$ids = $this->input_param('ids');
|
||||
$type = $this->input_param('type');
|
||||
$isRead = $this->input_param('isRead');
|
||||
$isRead = $isRead ? Sys_notice_model::STATUS_READ : Sys_notice_model::STATUS_UNREAD;
|
||||
|
||||
$where = [
|
||||
'platform' => Sys_notice_model::PLAT_FORM_PINGAN,
|
||||
'uid' => $_SESSION['id'],
|
||||
'read' => Sys_notice_model::STATUS_UNREAD
|
||||
];
|
||||
if ($type != 'all') {
|
||||
if (!$ids) {
|
||||
@@ -90,7 +89,7 @@ class Notice extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
$this->sys_notice_model->update(['read' => $isRead], $where);
|
||||
$this->sys_notice_model->update(['read' => Sys_notice_model::STATUS_READ], $where);
|
||||
$this->return_response();
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,9 @@ class UserInfo extends BaseController
|
||||
//查询实名认证
|
||||
$daiFu = new DaiFu();
|
||||
$requestId = create_order_no(350200, 'pingan');
|
||||
$params['cardId'] = 350802199111298215;
|
||||
$username = '林聪聪';
|
||||
$mobile = '18350451617';
|
||||
$req = $daiFu->querySignUp($requestId, $params['cardId'], $username, $mobile);
|
||||
if (!$req->isSuccess()) {
|
||||
$this->return_json($req->getMessage());
|
||||
|
||||
@@ -26,8 +26,9 @@ class ApiAuthHook
|
||||
];
|
||||
//h5白名单
|
||||
$this->route_un_auto = [
|
||||
'auto/config/*', 'auto/login/*', 'auto/area/*', 'auto/car/brand', 'auto/car/product/list',
|
||||
'auto/car/coupon/bizs', 'auto/visit', 'auto/brand/*', 'auto/car/product/detail', 'auto/sms/login'
|
||||
'auto/config/*', 'auto/login/*', 'auto/area/*',
|
||||
'auto/car/brand', 'auto/car/product/list',
|
||||
'auto/car/coupon/bizs',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -40,10 +41,10 @@ class ApiAuthHook
|
||||
$uri_string = uri_string();
|
||||
$urlArray = explode("/", $uri_string);
|
||||
if ($urlArray[0] == 'auto') { //h5
|
||||
$headers = $this->CI->input->request_headers();
|
||||
if ($headers['Authorization'] || (!in_array($uri_string, $this->route_un_auto) &&
|
||||
!in_array($urlArray[0] . '/' . $urlArray[1] . '/*', $this->route_un_auto) &&
|
||||
!in_array($urlArray[0] . '/' . $urlArray[1] . '/' . $urlArray[2] . '/*', $this->route_un_auto))) {
|
||||
if (!in_array($uri_string, $this->route_un_auto) &&
|
||||
!in_array($urlArray[0] . '/' . $urlArray[1] . '/*', $this->route_un_auto) &&
|
||||
!in_array($urlArray[0] . '/' . $urlArray[1] . '/' . $urlArray[2] . '/*', $this->route_un_auto)) {
|
||||
$headers = $this->CI->input->request_headers();
|
||||
if ($this->tokenIsExist($headers)) {
|
||||
$req = $this->validateToken($headers['Authorization'], 'jwt_key_auto');
|
||||
$this->CI->userId = $req[0];
|
||||
@@ -62,9 +63,9 @@ class ApiAuthHook
|
||||
}
|
||||
} else { //后台
|
||||
if (preg_match($this->route, $uri_string) || preg_match($this->pingan_route, $uri_string)) {
|
||||
$headers = $this->CI->input->request_headers();
|
||||
if ((!in_array($uri_string, $this->route_un) && !in_array($urlArray[0] . '/' . $urlArray[1] . '/*', $this->route_un))
|
||||
|| $this->tokenIsExist($headers)) {
|
||||
if (!in_array($uri_string, $this->route_un) &&
|
||||
!in_array($urlArray[0] . '/' . $urlArray[1] . '/*', $this->route_un)) {
|
||||
$headers = $this->CI->input->request_headers();
|
||||
if ($this->tokenIsExist($headers)) {
|
||||
if ($urlArray[0] == 'pingan') {
|
||||
$userId = $this->validateToken($headers['Authorization'], 'jwt_key_pingan');
|
||||
@@ -85,7 +86,6 @@ class ApiAuthHook
|
||||
|
||||
private function set_session($userId)
|
||||
{
|
||||
$uri_string = uri_string();
|
||||
$_SESSION['userId'] = intval($userId);
|
||||
$this->CI->load->model('agent/admin/Market_sys_admin_model');
|
||||
$re_admin = $this->CI->Market_sys_admin_model->get(['userId' => $userId, 'status' => 0]);
|
||||
@@ -120,7 +120,7 @@ class ApiAuthHook
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($authority_set && !in_array($uri_string, $this->route_un)) {
|
||||
if ($authority_set) {
|
||||
$show = true;
|
||||
$authority = $authorityAry[1] . ':' . $authorityAry[2] . ':' . $authority_set;//system:user:save
|
||||
if ($menuIds) {
|
||||
@@ -154,7 +154,6 @@ class ApiAuthHook
|
||||
|
||||
private function set_session_pingan($userId)
|
||||
{
|
||||
$uri_string = uri_string();
|
||||
$_SESSION['userId'] = intval($userId);
|
||||
$this->CI->load->model('agent/pingan/Pingan_users_model');
|
||||
$re_admin = $this->CI->Pingan_users_model->get(['id' => $userId, 'status' => 1]);
|
||||
@@ -189,7 +188,7 @@ class ApiAuthHook
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($authority_set && !in_array($uri_string, $this->route_un)) {
|
||||
if ($authority_set) {
|
||||
$show = true;
|
||||
$authority = $authorityAry[1] . ':' . $authorityAry[2] . ':' . $authority_set;//system:user:save
|
||||
if ($menuIds) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
@@ -89,7 +89,7 @@ $autoload['drivers'] = array();
|
||||
|
|
||||
| $autoload['helper'] = array('url', 'file');
|
||||
*/
|
||||
$autoload['helper'] = array('comm', 'url', 'array', 'order', 'authorization');
|
||||
$autoload['helper'] = array('comm', 'url', 'array','order');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
$config['url'] = "wss://sapi.liche.cn/wss";
|
||||
$config['url'] = "ws://api.ss.haodian.cn/wss";
|
||||
|
||||
$config['jwt_key_pingan'] = 'dvsr23423vsgAEDger'; //平安端生成用户秘钥
|
||||
$config['jwt_key_system'] = '2343ljfwefefew';//后端生成用户秘钥
|
||||
|
||||
@@ -13,28 +13,6 @@ class Welcome extends CI_Controller
|
||||
|
||||
public function test()
|
||||
{
|
||||
$open_key = 'CdJiji028';
|
||||
$secret_key = 'MjkJiji';
|
||||
|
||||
// 获取当前时间戳(秒)和微秒数
|
||||
$microtime = microtime(true); // 返回一个浮点数,单位为秒
|
||||
// 将其转换为毫秒时间戳(整数)
|
||||
$t = (int)($microtime * 1000);
|
||||
$t = time();
|
||||
$token = $this->encode($secret_key.$t, $open_key);
|
||||
|
||||
$data = file_get_contents("https://xmmjk.dongzhumeijia.com/api/api/goodlist/token/{$token}/times/{$t}/start/0/number/50");
|
||||
|
||||
$str = trim($data, '\"');
|
||||
|
||||
// 解码Unicode转义字符
|
||||
$str = json_decode('"' . $str . '"');
|
||||
|
||||
// 现在$str是有效的JSON字符串,可以解析为数组
|
||||
$array = json_decode($str, true);
|
||||
|
||||
print_r($array);
|
||||
|
||||
// $this->load->library('carHome/daiFu');
|
||||
// $daiFu = new DaiFu();
|
||||
// $daiFu->uploadIdCardImage();
|
||||
@@ -70,34 +48,4 @@ class Welcome extends CI_Controller
|
||||
// $res = $this->customers_model->Commissions($rid, $bizId);
|
||||
// var_dump($res);
|
||||
}
|
||||
|
||||
function encode($string, $key)
|
||||
{
|
||||
$key = md5($key);
|
||||
$key_length = strlen($key);
|
||||
$string = substr(md5($string . $key), 0, 8) . $string;
|
||||
$string_length = strlen($string);
|
||||
$rndkey = $box = array();
|
||||
$result = '';
|
||||
for ($i = 0; $i <= 255; $i++) {
|
||||
$rndkey[$i] = ord($key[$i % $key_length]);
|
||||
$box[$i] = $i;
|
||||
}
|
||||
for ($j = $i = 0; $i < 256; $i++) {
|
||||
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
|
||||
$tmp = $box[$i];
|
||||
$box[$i] = $box[$j];
|
||||
$box[$j] = $tmp;
|
||||
}
|
||||
for ($a = $j = $i = 0; $i < $string_length; $i++) {
|
||||
$a = ($a + 1) % 256;
|
||||
$j = ($j + $box[$a]) % 256;
|
||||
$tmp = $box[$a];
|
||||
$box[$a] = $box[$j];
|
||||
$box[$j] = $tmp;
|
||||
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) %
|
||||
256]));
|
||||
}
|
||||
return str_replace('=', '', base64_encode($result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,10 +117,11 @@ class CallBack extends CI_Controller
|
||||
$callData['userRingTime'] && $upData['userRingTime'] = $callData['userRingTime'];
|
||||
$callData['userAnswerTime'] && $upData['userAnswerTime'] = $callData['userAnswerTime'];
|
||||
$callData['endTime'] && $upData['endTime'] = $callData['endTime'];
|
||||
if ($callData['finishType'] == Receiver_call_wechat_model::FINISH_STATUS_FINISH) {
|
||||
if ($callData['endTime'] && $callData['userAnswerTime']) {
|
||||
$upData['telDuration'] = strtotime($callData['endTime']) - strtotime($callData['userAnswerTime']);
|
||||
}
|
||||
if ($callData['endTime'] && $callData['agentAnswerTime']) {
|
||||
$upData['telDuration'] = strtotime($callData['endTime']) - strtotime($callData['agentAnswerTime']);
|
||||
}
|
||||
if ($callData['endTime'] && $callData['userAnswerTime']) {
|
||||
$upData['telDuration'] = strtotime($callData['endTime']) - strtotime($callData['userAnswerTime']);
|
||||
}
|
||||
$this->callWechat->update($upData, ['id' => $row['id']]);
|
||||
if ($row['cfId'] && $row['cfPlatform'] == Receiver_call_wechat_model::CF_PLATFORM_WX_APP) { //理车宝
|
||||
@@ -143,7 +144,6 @@ class CallBack extends CI_Controller
|
||||
if ($row['cfType'] == Receiver_call_wechat_model::CF_TYPE_CLUE) {//线索拨打电话回调
|
||||
$this->load->model('receiver/receiver_clue_oplogs_model', 'mdOplogs');
|
||||
$addData['clue_id'] = $row['cfId'];
|
||||
$addData['cf_platform'] = Receiver_call_wechat_model::CF_PLATFORM_ADMIN;
|
||||
} else if ($row['cfType'] == Receiver_call_wechat_model::CF_TYPE_CUSTOMERS) {//客户拨打电话回调
|
||||
$this->load->model('receiver/receiver_customer_oplogs_model', 'mdOplogs');
|
||||
$addData['customer_id'] = $row['cfId'];
|
||||
|
||||
@@ -232,8 +232,8 @@ class Licheb extends HD_Controller
|
||||
$visit_count = $this->mdCustomerVisitData->count_visit($where_v);
|
||||
|
||||
if ($visit_count) {//发送短信
|
||||
b2m_send_sms($value['mobile'], '【好店云(厦门)科技】您好,今天共有 '.$visit_count.' 个客户需要回访,客户线索来之不易,请及时跟进~');
|
||||
//ems_sms($value['mobile'], '您好,今天共有 ' . $visit_count . ' 个客户需要回访,客户线索来之不易,请及时跟进~ ');
|
||||
// b2m_send_sms($value['mobile'], '【好店云】您好,今天共有 '.$visit_count.' 个客户需要回访,客户线索来之不易,请及时跟进~');
|
||||
ems_sms($value['mobile'], '您好,今天共有 ' . $visit_count . ' 个客户需要回访,客户线索来之不易,请及时跟进~ ');
|
||||
$log[] = array('id' => $id, 'mobile' => $value['mobile'], 'count' => $visit_count);
|
||||
}
|
||||
}
|
||||
@@ -304,8 +304,8 @@ class Licheb extends HD_Controller
|
||||
$Customers_count = $this->mdCustomers->count($where_c);
|
||||
if ($Customers_count) {
|
||||
//发送短信
|
||||
b2m_send_sms($value['mobile'], '【好店云(厦门)科技】您好,门店有 '.$Customers_count.' 个客户线索尚未分配。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
|
||||
// ems_sms($value['mobile'], '您好,门店有 ' . $Customers_count . ' 个客户线索尚未分配。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
|
||||
// b2m_send_sms($value['mobile'], '【好店云】您好,门店有 '.$Customers_count.' 个客户线索尚未分配。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
|
||||
ems_sms($value['mobile'], '您好,门店有 ' . $Customers_count . ' 个客户线索尚未分配。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
|
||||
$log[] = array('id' => $id, 'mobile' => $value['mobile'], 'count' => $Customers_count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Notice extends CI_Controller
|
||||
{
|
||||
private $log_dir = 'plan_notice';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/receiver_clues_model', 'clues_model');
|
||||
$this->load->model('receiver/receiver_clues_notice_model', 'clues_notice_model');
|
||||
$this->load->model('sys/sys_notice_model');
|
||||
$this->load->model('sys/Sys_admin_model', 'sysAdmin');
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索通知
|
||||
* @return void
|
||||
*/
|
||||
public function clues()
|
||||
{
|
||||
$logPath = "clues.txt";
|
||||
$cluseNoticeRow = $this->clues_notice_model->select([], 'clue_id desc', 1, 1);
|
||||
$where = [
|
||||
'app_id' => Receiver_clues_model::APP_ID_ACTIVITY
|
||||
];
|
||||
if ($cluseNoticeRow[0]) {
|
||||
$where['id>'] = $cluseNoticeRow[0]['clue_id'];
|
||||
}
|
||||
$cluesRow = $this->clues_model->select($where, 'id asc', 1, 20);
|
||||
if ($cluesRow) {
|
||||
$noticeAdmins = $this->sysAdmin->select(['role_id' => 2, 'status' => 1], '', 0, 0, 'id,other_json');
|
||||
foreach ($cluesRow as $item) {
|
||||
debug_log("开始处理线: {$item['id']}", $logPath);
|
||||
$mobile = substr($item['mobile'], -4);
|
||||
$content = "超级车补新增了一条线索,尾号{$mobile},请及时查看处理。";
|
||||
//推送消息给中台客服
|
||||
if ($noticeAdmins) {
|
||||
foreach ($noticeAdmins as $noticeAdmin) {
|
||||
$otherJson = json_decode($noticeAdmin['other_json'], true);
|
||||
if ($item['belong_id'] && $item['belong_id'] != $otherJson['belong_id']) {
|
||||
continue;
|
||||
}
|
||||
$params = [
|
||||
'platform' => Sys_notice_model::PLAT_FORM_ADMIN,
|
||||
'uid' => $noticeAdmin['id'],
|
||||
'content' => $content,
|
||||
'url' => '/receiver/clues/get?id=' . $item['id'],
|
||||
];
|
||||
$sendPlatform = Sys_notice_model::PLAT_FORM_SYS_H5;
|
||||
$this->sys_notice_model->addNotice($params, $sendPlatform);
|
||||
}
|
||||
}
|
||||
if ($item['pingan_user_id']) {
|
||||
$params = [
|
||||
'platform' => Sys_notice_model::PLAT_FORM_PINGAN,
|
||||
'uid' => $item['pingan_user_id'],
|
||||
'content' => $content,
|
||||
'url' => '/receiver/clues/detail?id=' . $item['id'],
|
||||
];
|
||||
$sendPlatform = Sys_notice_model::PLAT_FORM_SYS_H5;
|
||||
$this->sys_notice_model->addNotice($params, $sendPlatform);
|
||||
}
|
||||
$this->clues_notice_model->add([
|
||||
'clue_id' => $item['id'],
|
||||
'c_time' => time(),
|
||||
]);
|
||||
debug_log("处理完成线: {$item['id']}", $logPath);
|
||||
}
|
||||
} else {
|
||||
echo '没有新线索';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,6 @@ class Plan extends CI_Controller
|
||||
$plan[] = array('url' => base_url(array('plan', 'report', 'index')), 'interval' => 20); //门店日报
|
||||
|
||||
$plan[] = array('url' => base_url(array('plan', 'callBack', 'downVideo')), 'interval' => 1); //外呼下载录音文件
|
||||
$plan[] = array('url' => base_url(array('plan', 'notice', 'clues')), 'interval' => 1); //消息推送
|
||||
|
||||
$this->plan = $plan;
|
||||
}
|
||||
|
||||
@@ -76,10 +76,7 @@ class Commission extends HD_Controller
|
||||
try {
|
||||
$page = 1;
|
||||
$size = 20;
|
||||
$where = [
|
||||
'ifcheck' => Receiver_order_subsidy_model::IF_CHECK_YES,
|
||||
'commStatus' => Receiver_order_subsidy_model::COMM_STATUS_WAIT
|
||||
];
|
||||
$where = ['commStatus' => Receiver_order_subsidy_model::COMM_STATUS_WAIT];
|
||||
/** @var ReceiverOrderSubsidyEntity[] $rows */
|
||||
$rows = $this->receiver_order_subsidy_model->select($where, 'id asc', $page, $size, '', 'ReceiverOrderSubsidyEntity');
|
||||
if (!$rows) {
|
||||
|
||||
@@ -11,7 +11,7 @@ require_once APPPATH . 'controllers/wxapp/Wxapp.php';
|
||||
|
||||
class City extends Wxapp
|
||||
{
|
||||
private $province_lists = [350000, 430000, 520000, 460000, 440000]; //开放省份
|
||||
private $province_lists = [350000, 430000, 520000, 460000]; //开放省份
|
||||
|
||||
function __construct($inputs, $app_key)
|
||||
{
|
||||
|
||||
@@ -127,9 +127,9 @@ class Cusorder extends Wxapp
|
||||
$users = $this->app_user_model->select(array('status' => 1, 'group_id' => 4, 'biz_id like "%,' . $this->biz_id . ',%"' => null));
|
||||
if ($users) {
|
||||
foreach ($users as $v) {
|
||||
$content = "【好店云(厦门)科技】亲爱的客户成功经理,您管理的" . $biz['biz_name'] . '新增了一个订单。';
|
||||
b2m_send_sms($v['mobile'], $content);
|
||||
// ems_sms($v['mobile'], "亲爱的客户成功经理,您管理的" . $biz['biz_name'] . '新增了一个订单。');
|
||||
// $content = "【好店云】亲爱的客户成功经理,您管理的" . $biz['biz_name'] . '新增了一个订单。';
|
||||
// b2m_send_sms($v['mobile'], $content);
|
||||
ems_sms($v['mobile'], "亲爱的客户成功经理,您管理的" . $biz['biz_name'] . '新增了一个订单。');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ class Cusorderdata extends Wxapp
|
||||
if (!$row) {
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$clues = $this->clues_model->get(['id' => $row['clue_id']]);
|
||||
$clues = $this->clues_model->get(['id' => $row['clues_id']]);
|
||||
$biz = $this->get_biz_info();
|
||||
$data_row = $this->receiver_order_datas_model->get(['o_id' => $id]);
|
||||
$jsondata = json_decode($data_row['jsondata'], true);
|
||||
|
||||
@@ -38,7 +38,6 @@ class Customers extends Wxapp
|
||||
$this->load->library('receiver/clues_entity');
|
||||
$this->load->model('app/paic/app_paic_users_model');
|
||||
$this->load->model('biz/biz_visit_log_model');
|
||||
$this->load->model('sys/sys_notice_model');
|
||||
$this->biz_id = $this->get_biz_id();
|
||||
}
|
||||
|
||||
@@ -1189,8 +1188,8 @@ class Customers extends Wxapp
|
||||
}
|
||||
//发送短信
|
||||
$num = $re['mobile'] ? substr($re['mobile'], -4) : 0;
|
||||
b2m_send_sms($admin['mobile'], '【好店云(厦门)科技】您有一个新的客户需要跟进,手机尾号为' . $num . '。请及时到小程序“理车宝-客户”进行操作,祝您成单!');
|
||||
// ems_sms($admin['mobile'], '您有一个新的客户需要跟进。请及时到小程序“理车宝-客户”查看,祝您成单!');
|
||||
// b2m_send_sms($admin['mobile'], '【好店云】您有一个新的客户需要跟进,手机尾号为' . $num . '。请及时到小程序“理车宝-客户”进行操作,祝您成单!');
|
||||
ems_sms($admin['mobile'], '您有一个新的客户需要跟进。请及时到小程序“理车宝-客户”查看,祝您成单!');
|
||||
}
|
||||
}
|
||||
throw new Exception('分配成功', API_CODE_SUCCESS);
|
||||
@@ -1246,7 +1245,7 @@ class Customers extends Wxapp
|
||||
if ($visit == 1) {//客户回访记录
|
||||
$status = intval($params['status']);
|
||||
$t_day = date('Y-m-d');
|
||||
$where = array('a.biz_id' => $this->biz_id, 'a.status in(0,1)' => null);
|
||||
$where = array('a.biz_id' => $this->biz_id, 'a.cs_biz_id<>' => -1, 'a.status in(0,1)' => null, 'b.t_day' => $t_day);
|
||||
$params['level'] && $where['a.level'] = $params['level'];//等级
|
||||
$params['admin_id'] && $where['a.admin_id'] = $params['admin_id'];//等级
|
||||
if ($status == 2) {//已跟进
|
||||
@@ -1254,7 +1253,6 @@ class Customers extends Wxapp
|
||||
} else {
|
||||
if ($tab_id) {
|
||||
$where['b.status'] = $tab_id;
|
||||
$tab_id == 1 && $where['b.t_day'] = $t_day;
|
||||
} else {
|
||||
$where['b.status<>'] = 2;
|
||||
}
|
||||
@@ -1566,19 +1564,15 @@ class Customers extends Wxapp
|
||||
$id = $this->input_param('id');
|
||||
$unlock = $this->input_param('unlock');
|
||||
$reason = $this->input_param('reason');
|
||||
$row = $this->customers_model->get(['id' => $id, 'biz_id' => $this->biz_id]);
|
||||
if (!$row) {
|
||||
throw new Exception('数据不存在');
|
||||
}
|
||||
if ($unlock) { //不解锁
|
||||
if (!$reason) {
|
||||
throw new Exception('请选择不解锁理由', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$updateData = [
|
||||
'un_lock' => Receiver_customers_model::LOCK_STATUS_2,
|
||||
'unlock_time' => date('Y-m-d H:i:s')
|
||||
];
|
||||
$res = $this->customers_model->update($updateData, ['id' => $id]);
|
||||
$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);
|
||||
}
|
||||
@@ -1587,36 +1581,17 @@ class Customers extends Wxapp
|
||||
$content = "不解锁,理由为【{$reason}】";
|
||||
$this->customers_entity->add_log($id, $this->session['uid'], $uname, $content, Receiver_customer_oplogs_model::TYPE_UNLOCK);
|
||||
if ($row['rid']) {
|
||||
$this->clues_entity->add_log($row['rid'], $this->session['uid'], $uname, $content, Receiver_clue_oplogs_model::TYPE_UNLOCK, Receiver_clue_oplogs_model::CF_PLATFORM_WXAPP);
|
||||
$this->clues_entity->add_log($row['rid'], $this->session['uid'], $uname, $content, Receiver_clue_oplogs_model::TYPE_UNLOCK);
|
||||
}
|
||||
$msg = "保存成功";
|
||||
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);
|
||||
}
|
||||
$msg = "解锁成功";
|
||||
throw new Exception('解锁成功', API_CODE_SUCCESS);
|
||||
}
|
||||
//推送消息
|
||||
$clues = $this->clues_model->get(['id' => $row['rid']]);
|
||||
if ($clues['pingan_user_id']) {
|
||||
$biz = $this->get_biz_info();
|
||||
if ($unlock) {
|
||||
$content = "您编号{$clues['sid']}的线索{$biz['biz_name']}门店不解锁(点击可跳转到对应【客户】详情)。";
|
||||
} else {
|
||||
$content = "您编号{$clues['sid']}的线索已被{$biz['biz_name']}门店解锁(点击可跳转到对应【客户】详情)。";
|
||||
}
|
||||
$params = [
|
||||
'platform' => Sys_notice_model::PLAT_FORM_PINGAN,
|
||||
'uid' => $clues['pingan_user_id'],
|
||||
'content' => $content,
|
||||
'url' => '/receiver/clues/detail?id=' . $clues['id'],
|
||||
];
|
||||
$endPlatform = Sys_notice_model::PLAT_FORM_SYS_WXAPP;
|
||||
$this->sys_notice_model->addNotice($params, $endPlatform, $this->session['uid']);
|
||||
}
|
||||
throw new Exception($msg, API_CODE_SUCCESS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ require_once APPPATH . 'controllers/wxapp/Wxapp.php';
|
||||
class Sms extends Wxapp
|
||||
{
|
||||
//private $smsSign = '理车宝';
|
||||
private $smsSign = '好店云(厦门)科技';
|
||||
private $smsSign = '好店云';
|
||||
|
||||
function __construct($inputs, $app_key)
|
||||
{
|
||||
@@ -45,9 +45,9 @@ class Sms extends Wxapp
|
||||
$code = random_string('numeric', 6);
|
||||
$mc->save($key, $code, 600);
|
||||
}
|
||||
$content = "【{$this->smsSign}】" . "您的验证码为:{$code},请勿泄露于他人!";
|
||||
b2m_send_sms($mobile, $content);
|
||||
//ems_sms($mobile, "您的验证码为:{$code},请勿泄露于他人!");
|
||||
// $content = "【{$this->smsSign}】" . "您的验证码为:{$code},请勿泄露于他人!";
|
||||
// b2m_send_sms($mobile, $content);
|
||||
ems_sms($mobile, "您的验证码为:{$code},请勿泄露于他人!");
|
||||
|
||||
$msg = '发送成功';
|
||||
throw new Exception($msg, API_CODE_SUCCESS);
|
||||
@@ -70,9 +70,9 @@ class Sms extends Wxapp
|
||||
throw new Exception('该客户不可操作', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$mobile = $row['mobile'];
|
||||
$content = "【{$this->smsSign}】" . $content;
|
||||
b2m_send_sms($mobile, $content);
|
||||
//ems_sms($mobile, $content);
|
||||
// $content = "【{$this->smsSign}】" . $content;
|
||||
// b2m_send_sms($mobile, $content);
|
||||
ems_sms($mobile, $content);
|
||||
$this->load->library('receiver/customers_entity');
|
||||
$this->customers_entity->add_log_visit($id, $uid, $this->session['uname'], $content, 1, 1);
|
||||
throw new Exception('短信发送成功', API_CODE_SUCCESS);
|
||||
@@ -94,9 +94,9 @@ class Sms extends Wxapp
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$mobile = $row['mobile'];
|
||||
$content = "【{$this->smsSign}】" . $content;
|
||||
b2m_send_sms($mobile, $content);
|
||||
//ems_sms($mobile, $content);
|
||||
// $content = "【{$this->smsSign}】" . $content;
|
||||
// b2m_send_sms($mobile, $content);
|
||||
ems_sms($mobile, $content);
|
||||
$this->load->library('receiver/customers_entity');
|
||||
$this->customers_entity->add_log($row['id'], $uid, $this->session['uname'], $content, 1);
|
||||
throw new Exception('短信发送成功', API_CODE_SUCCESS);
|
||||
|
||||
@@ -330,7 +330,7 @@ class User extends Wxapp
|
||||
$where['un_lock'] = 1;
|
||||
}
|
||||
$unuse_count = $this->customers_model->count($where);
|
||||
$where = ['biz_id' => $biz_id, 'if_defeat' => 1, 'status>' => -1];
|
||||
$where = ['biz_id' => $biz_id, 'cs_biz_id<>' => -1, 'if_defeat' => 1, 'status>' => -1];
|
||||
$biz_type == Biz_model::BIZ_TYPE_4s && $where['un_lock'] = 1;
|
||||
$defeat_count = $this->customers_model->count($where);
|
||||
$clues_count = $this->clues_model->count(['biz_id' => $biz_id, 'status' => 1, 'status2' => 1]);
|
||||
@@ -368,8 +368,8 @@ class User extends Wxapp
|
||||
['title' => '发票开具', 'icon' => 'icon-kaipiao1', 'total' => $kp_total, 'page' => '/pages/order/filterList/index2?type=1&title=发票开具'],
|
||||
['title' => '车辆交付', 'icon' => 'icon-jiaofu', 'total' => $ck_total, 'page' => '/pages/order/filterList/index2?type=2&title=车辆交付'],
|
||||
];
|
||||
$where_v = ['a.biz_id' => $biz_id, 'a.status in(0,1)' => null, 'b.t_day' => date('Y-m-d')];
|
||||
$where_c = ['biz_id' => $biz_id, 'status in(0,1)' => null];
|
||||
$where_v = ['a.biz_id' => $biz_id, 'a.cs_biz_id<>' => -1, 'a.status in(0,1)' => null, 'b.t_day' => date('Y-m-d')];
|
||||
$where_c = ['biz_id' => $biz_id, 'cs_biz_id<>' => -1, 'status in(0,1)' => null];
|
||||
$group_id == 4 && $where_c['brand_id!='] = 3;
|
||||
$biz_type == Biz_model::BIZ_TYPE_4s && $where_c['un_lock'] = 1;
|
||||
if ($group_id == 1) {
|
||||
@@ -403,8 +403,6 @@ class User extends Wxapp
|
||||
, ['title' => '今日已跟进 >', 'num' => $c_num_2, 'url' => '/pages/customer/filterList/index?level=C&status=2&visit=1&title=C级今日已跟进']]],
|
||||
];
|
||||
$wl_num = $this->mdCustomerVisitData->count_visit(array_merge($where_v, ['b.status<>' => 2]));
|
||||
unset($where_v['b.t_day']);
|
||||
$yl_num = $this->mdCustomerVisitData->count_visit(array_merge($where_v, ['b.status' => 3]));
|
||||
//数据统计
|
||||
$str_uids = $str_userids = '';
|
||||
if ($group_id == 1) {
|
||||
@@ -474,8 +472,7 @@ class User extends Wxapp
|
||||
];
|
||||
$data = [
|
||||
'wl_count' => ['title' => '待跟进客户(人)', 'num' => $wl_num, 'url' => '/pages/customer/filterList/index?status=1&visit=1&title=待跟进客户'],
|
||||
//'gz_count' => ['title' => '特别关注客户(人)', 'num' => $gz_count, 'url' => '/pages/customer/filterList/index?istop=1&title=特别关注客户'],
|
||||
'gz_count' => ['title' => '逾期跟进客户(人)', 'num' => $yl_num, 'url' => '/pages/customer/filterList/index?status=1&visit=1&visit_tab_id=3&title=逾期跟进客户'],
|
||||
'gz_count' => ['title' => '特别关注客户(人)', 'num' => $gz_count, 'url' => '/pages/customer/filterList/index?istop=1&title=特别关注客户'],
|
||||
'sign_count' => $sign_count,
|
||||
'loan_count' => $loan_count,
|
||||
'deallist' => $deallist,
|
||||
|
||||
@@ -90,7 +90,7 @@ class AutoUserCouponEntity
|
||||
$where = [
|
||||
'app_id' => Receiver_clues_model::APP_ID_ACTIVITY,
|
||||
'cf_uid' => $this->userId,
|
||||
// 'out_id' => $this->productId
|
||||
'out_id' => $this->productId
|
||||
];
|
||||
$clueRow = $this->ci->receiver_clues_model->get($where);
|
||||
$where = [
|
||||
@@ -170,7 +170,7 @@ class AutoUserCouponEntity
|
||||
$this->ci->load->model('app/licheb/app_licheb_users_model');
|
||||
$this->ci->app_licheb_users_model->set_db('ssdb');
|
||||
$this->ci->app_licheb_users_model->sendSmsToManager($bizId, "门店新增了一个订单,请及时到小程序“理车宝-订单”进行处理。");
|
||||
return new MyRESPONSE(EXIT_SUCCESS, '核销成功', ['orderId' => $orderId]);
|
||||
return new MyRESPONSE(EXIT_SUCCESS, '核销成功');
|
||||
} catch (Exception $e) {
|
||||
$this->ci->db->trans_rollback();
|
||||
return new MyResponse(EXIT_ERROR, $e->getMessage());
|
||||
|
||||
@@ -14,8 +14,6 @@ class PinganUsersCmmssnEntity
|
||||
public $createTime;
|
||||
public $sourceId;
|
||||
|
||||
public $ifSend;
|
||||
|
||||
protected $ci;
|
||||
|
||||
public function __construct()
|
||||
|
||||
@@ -164,8 +164,7 @@ class ReceiverOrderSubsidyEntity
|
||||
throw new Exception("产品不存在");
|
||||
}
|
||||
$money = $product['orderCommission'];
|
||||
$cluesCommission = $product['cluesCommission'];
|
||||
debug_log("订单分总佣金额:" . $money . ",线索总佣金:" . $cluesCommission, $log_path, $log_dir);
|
||||
debug_log("订单分佣金额:" . $money, $log_path, $log_dir);
|
||||
if ($money <= 0) { //不需要分佣
|
||||
$ci->receiver_order_subsidy_model->update(['commStatus' => Receiver_order_subsidy_model::COMM_STATUS_NOT], ['id' => $this->id]);
|
||||
return new MyResponse(EXIT_SUCCESS, "不需要分佣,分佣金额为:{$money}");
|
||||
@@ -193,18 +192,10 @@ class ReceiverOrderSubsidyEntity
|
||||
}
|
||||
//团队设置分佣等级
|
||||
$level = $ci->organization_model->getTeamLevel($pinanUser['orgTeamId']);
|
||||
$brokerage1 = $money * ($cmmssn['orderLevel1'] / 100) ?: 0;
|
||||
$brokerage2 = $money * ($cmmssn['orderLevel2'] / 100) ?: 0;
|
||||
$brokerage3 = $money * ($cmmssn['orderLevel3'] / 100) ?: 0;
|
||||
$brokerage4 = $money * ($cmmssn['orderLevel4'] / 100) ?: 0;
|
||||
$cluesBrokerage1 = $cluesCommission * ($cmmssn['cluesLevel1'] / 100) ?: 0;
|
||||
$cluesBrokerage2 = $cluesCommission * ($cmmssn['cluesLevel2'] / 100) ?: 0;
|
||||
$cluesBrokerage3 = $cluesCommission * ($cmmssn['cluesLevel3'] / 100) ?: 0;
|
||||
$cluesBrokerage4 = $cluesCommission * ($cmmssn['cluesLevel4'] / 100) ?: 0;
|
||||
$brokerage1 = max(0, $brokerage1 - $cluesBrokerage1);
|
||||
$brokerage2 = max(0, $brokerage2 - $cluesBrokerage2);
|
||||
$brokerage3 = max(0, $brokerage3 - $cluesBrokerage3);
|
||||
$brokerage4 = max(0, $brokerage4 - $cluesBrokerage4);
|
||||
$brokerage1 = $money * ($cmmssn['cluesLevel1'] / 100) ?: 0;
|
||||
$brokerage2 = $money * ($cmmssn['cluesLevel2'] / 100) ?: 0;
|
||||
$brokerage3 = $money * ($cmmssn['cluesLevel3'] / 100) ?: 0;
|
||||
$brokerage4 = $money * ($cmmssn['cluesLevel4'] / 100) ?: 0;
|
||||
debug_log('分佣金额:' . json_encode([$brokerage1, $brokerage2, $brokerage3, $brokerage4]), $log_path, $log_dir);
|
||||
$add_data = [];
|
||||
if ($brokerage1 && $clues['area_id']) { //一级佣金
|
||||
|
||||
@@ -14,7 +14,7 @@ class Clues_entity
|
||||
}
|
||||
|
||||
//添加日志
|
||||
public function add_log($clue_id, $uid, $uname, $log, $type = '', $cf_platform = 'admin')
|
||||
public function add_log($clue_id, $uid, $uname, $log, $type = '')
|
||||
{
|
||||
$this->ci->load->model('receiver/receiver_clue_oplogs_model', 'oplogs_model');
|
||||
$data = [
|
||||
@@ -25,7 +25,6 @@ class Clues_entity
|
||||
'c_time' => time()
|
||||
];
|
||||
$type && $data['type'] = $type;
|
||||
$cf_platform && $data['cf_platform'] = $cf_platform;
|
||||
$r_id = $this->ci->oplogs_model->add($data);
|
||||
return $r_id;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ class ValidToken
|
||||
case Ws_conn_model::PLAT_FORM_SYS_ADMIN:
|
||||
case Ws_conn_model::PLAT_FORM_SYS_PINGAN:
|
||||
case Ws_conn_model::PLAT_FORM_SYS_WXAPP:
|
||||
case Ws_conn_model::PLAT_FORM_SYS_H5:
|
||||
$uid = JWT::decode($token, $this->jwt_key_system, array($this->jwt_algorithm));
|
||||
if (!$uid) {
|
||||
throw new Exception('授权失败', WsResponse::CODE_UNAUTHORIZED);
|
||||
|
||||
@@ -22,7 +22,7 @@ class Area_model extends HD_Model
|
||||
$result = array();
|
||||
$where = [];
|
||||
if($show_limit){
|
||||
$where["province_id in (350000,430000,520000,460000,440000)"] = null;
|
||||
$where["province_id in (350000,430000,520000,460000)"] = null;
|
||||
}
|
||||
$list = $this->select($where, null, null, null, 'distinct(province_id), province_name');
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@ defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Auto_product_setting_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_auto_product_setting';
|
||||
private $cacheKey = 'PRODUCTS_SETTING_%d_%s';
|
||||
private $cacheKey = 'PRODUCT_SETTING_%d_%s';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
public function setValue($productId, $key,g $value)
|
||||
public function setValue($productId, $key, $value)
|
||||
{
|
||||
$cache = load_cache();
|
||||
$data = [
|
||||
|
||||
@@ -79,18 +79,12 @@ class Auto_user_coupon_model extends HD_Model
|
||||
if (!$res) {
|
||||
throw new Exception('领取失败');
|
||||
}
|
||||
$cf_id = $teamCf['cfId'] ?: 0;
|
||||
$cf2_id = $teamCf['cf2Id'] ?: 0;
|
||||
if ($user['cfrom'] == Auto_user_model::C_FROM_APP) { //来源app
|
||||
$cf_id = 38;
|
||||
$cf2_id = 43;
|
||||
}
|
||||
//增加留资记录
|
||||
$enrollData = [
|
||||
'sid' => $sid,
|
||||
'mobile' => $mobile,
|
||||
'cf_id' => $cf_id,
|
||||
'cf2_id' => $cf2_id,
|
||||
'cf_id' => $teamCf['cfId'] ?: 0,
|
||||
'cf2_id' => $teamCf['cf2Id'] ?: 0,
|
||||
'out_id' => $product['id'],
|
||||
'c_time' => time()
|
||||
];
|
||||
@@ -107,8 +101,8 @@ class Auto_user_coupon_model extends HD_Model
|
||||
'out_id' => $product['id'],
|
||||
'app_id' => $appId,
|
||||
'cf_uid' => $userId,
|
||||
'cf_id' => $cf_id,
|
||||
'cf2_id' => $cf2_id,
|
||||
'cf_id' => $teamCf['cfId'] ?: 0,
|
||||
'cf2_id' => $teamCf['cf2Id'] ?: 0,
|
||||
'c_time' => time(),
|
||||
];
|
||||
$data['brand_id'] = $product['brandId'] ?: 0;
|
||||
@@ -121,13 +115,10 @@ class Auto_user_coupon_model extends HD_Model
|
||||
$data['province_id'] = $areaRow['province_id'] ?: 0;
|
||||
$data['city_id'] = $areaRow['city_id'] ?: 0;
|
||||
$data['county_id'] = $areaRow['county_id'] ?: 0;
|
||||
// if ($data['province_id'] == 460000) { //海南省
|
||||
// $data['belong_id'] = 39;
|
||||
// } else if ($data['province_id'] == 350000) { //福建
|
||||
// $data['belong_id'] = 10;
|
||||
// }
|
||||
if(Receiver_clues_model::PROVINCE_BELONG[$data['province_id']]){
|
||||
$data['belong_id'] = Receiver_clues_model::PROVINCE_BELONG[$data['province_id']];
|
||||
if ($data['province_id'] == 460000) { //海南省
|
||||
$data['belong_id'] = 39;
|
||||
} else if ($data['province_id'] == 350000) { //福建
|
||||
$data['belong_id'] = 10;
|
||||
}
|
||||
$this->receiver_clues_model->add($data);
|
||||
} else {
|
||||
@@ -139,67 +130,4 @@ class Auto_user_coupon_model extends HD_Model
|
||||
return new MyResponse(EXIT_ERROR, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 给指定线索发送优惠券
|
||||
* @param $cluesId
|
||||
* @param $couponId
|
||||
* @return MyResponse
|
||||
*/
|
||||
public function sendCoupon($cluesId, $couponId)
|
||||
{
|
||||
$this->load->model('agent/auto_product_model');
|
||||
$this->load->model('agent/auto_product_coupon_model');
|
||||
$this->load->model('receiver/receiver_enroll_model');
|
||||
$this->load->model('receiver/receiver_clues_model');
|
||||
$this->receiver_clues_model->set_db('ssdb');
|
||||
$this->receiver_enroll_model->set_db('ssdb');
|
||||
try {
|
||||
$cluesRow = $this->receiver_clues_model->get(['id' => $cluesId]);
|
||||
if (!$cluesRow) {
|
||||
throw new Exception('线索不存在');
|
||||
}
|
||||
$coupon = $this->auto_product_coupon_model->get(['id' => $couponId]);
|
||||
if (!$coupon) {
|
||||
throw new Exception('优惠券不存在');
|
||||
}
|
||||
$where = ['userId' => $cluesRow['cf_uid'], 'couponId' => $couponId];
|
||||
$row = $this->get($where);
|
||||
if ($row) {
|
||||
throw new Exception('优惠券已领取');
|
||||
}
|
||||
$sid = create_order_no($cluesRow['city_id'], 'pingan');
|
||||
$data = [
|
||||
'sid' => $sid,
|
||||
'userId' => $cluesRow['cf_uid'],
|
||||
'productId' => $coupon['product_id'],
|
||||
'couponId' => $couponId,
|
||||
'mobile' => $cluesRow['mobile'],
|
||||
'title' => $coupon['title'],
|
||||
'price' => $coupon['price'],
|
||||
'timeStart' => $coupon['timeStart'],
|
||||
'timeEnd' => $coupon['timeEnd'],
|
||||
];
|
||||
$res = $this->add($data);
|
||||
if (!$res) {
|
||||
throw new Exception('发送失败');
|
||||
}
|
||||
$product = $this->auto_product_model->get(['id' => $coupon['product_id']]);
|
||||
//增加留资记录
|
||||
$enrollData = [
|
||||
'sid' => $sid,
|
||||
'mobile' => $cluesRow['mobile'],
|
||||
'cf_id' => $cluesRow['cf_id'],
|
||||
'cf2_id' => $cluesRow['cf2_id'],
|
||||
'out_id' => $coupon['product_id'],
|
||||
'c_time' => time()
|
||||
];
|
||||
$enrollData['brand_id'] = $product['brandId'] ?: 0;
|
||||
$enrollData['series_id'] = $product['seriesId'] ?: 0;
|
||||
$this->receiver_enroll_model->add($enrollData);
|
||||
return new MyResponse(EXIT_SUCCESS, '操作成功');
|
||||
} catch (Exception $e) {
|
||||
return new MyResponse(EXIT_ERROR, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,8 @@ defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Auto_user_model extends HD_Model
|
||||
{
|
||||
const STATUS_DELETE = -1; //删除
|
||||
const STATUS_DISABLE = 0; //禁用
|
||||
const STATUS_NORMAL = 1; //正常
|
||||
|
||||
const C_FROM_APP = 'app';//来源app
|
||||
private $table_name = 'lc_auto_user';
|
||||
const MAP_USER_MODEL = [
|
||||
'ain' => 'ain_users_model',
|
||||
@@ -24,13 +21,12 @@ class Auto_user_model extends HD_Model
|
||||
|
||||
/**
|
||||
* @param $openid
|
||||
* @param string $mobile
|
||||
* @param string $accountId 平安用户编码
|
||||
* @param string $from ain fish
|
||||
* @param array $otherInfo
|
||||
* @return MyResponse
|
||||
*/
|
||||
public function initUser($mobile, $openid, $accountId, $from = '', $otherInfo = [])
|
||||
public function initUser($openid, $accountId, $from = '', $otherInfo = [])
|
||||
{
|
||||
try {
|
||||
$userModel = self::MAP_USER_MODEL[$from];
|
||||
@@ -39,15 +35,9 @@ class Auto_user_model extends HD_Model
|
||||
} else {
|
||||
$this->load->model('agent/pingan/pingan_users_model', 'pingAnUsers');
|
||||
}
|
||||
if ($mobile) {
|
||||
$user = $this->get(['mobile' => $mobile, 'status>=' => self::STATUS_NORMAL]);
|
||||
} else {
|
||||
$user = $this->get(['openid' => $openid, 'status>=' => self::STATUS_DISABLE]);
|
||||
}
|
||||
|
||||
$user = $this->get(['openid' => $openid]);
|
||||
if (!$user) {
|
||||
$user = [
|
||||
'mobile' => $mobile,
|
||||
'openid' => $openid,
|
||||
'createTime' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
@@ -70,7 +60,6 @@ class Auto_user_model extends HD_Model
|
||||
$otherInfo['nickname'] && $user['nickname'] = $otherInfo['nickname'];
|
||||
$otherInfo['headimg'] && $user['headimg'] = $otherInfo['headimg'];
|
||||
$otherInfo['unionid'] && $user['unionid'] = $otherInfo['unionid'];
|
||||
$otherInfo['cfrom'] && $user['cfrom'] = $otherInfo['cfrom'];
|
||||
$userId = $this->add($user);
|
||||
if (!$userId) {
|
||||
throw new Exception('添加用户失败');
|
||||
|
||||
@@ -16,13 +16,6 @@ class Pingan_users_cmmssn_model extends HD_Model
|
||||
self::CF_TYPE_CLUES_OWN => '线索', //自有线索
|
||||
self::CF_TYPE_CLUES_TEAM => '线索' //团队线索
|
||||
];
|
||||
//是否发放
|
||||
const IF_SEND_NO = 0; //否
|
||||
const IF_SEND_YES = 1; //是
|
||||
const IF_SEND_CN = [
|
||||
self::IF_SEND_NO => '否',
|
||||
self::IF_SEND_YES => '是'
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -16,10 +16,6 @@ class Receiver_call_wechat_model extends HD_Model
|
||||
//状态 0 未拨打 1 已拨打
|
||||
const STATUS_WAIT = 0;
|
||||
const STATUS_FINISH = 1;
|
||||
// 通话完成状态 0:通话未完成 1:通话完成 2:通话失败
|
||||
const FINISH_STATUS_WAIT = 0;
|
||||
const FINISH_STATUS_FINISH = 1;
|
||||
const FINISH_STATUS_FAIL = 2;
|
||||
|
||||
|
||||
public function __construct()
|
||||
|
||||
@@ -18,11 +18,6 @@ class Receiver_clue_oplogs_model extends HD_Model
|
||||
//type状态值11不解锁
|
||||
const TYPE_UNLOCK = 11;
|
||||
|
||||
//消息来源
|
||||
const CF_PLATFORM_ADMIN = 'admin';
|
||||
const CF_PLATFORM_WXAPP = 'wxapp';
|
||||
const CF_PLATFORM_PINGAN_ADMIN = 'pingan_admin';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
|
||||
@@ -20,12 +20,6 @@ class Receiver_clues_model extends HD_Model
|
||||
const LEVEL_DEFAULT = 'H';//默认等级
|
||||
//分佣机构id
|
||||
const COMM_ORG_IDS = [1];
|
||||
//省份对应归属id
|
||||
const PROVINCE_BELONG = [
|
||||
'460000' => 39, //海南省
|
||||
'350000' => 10, //福建
|
||||
'440000' => 99, //广东省
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -207,8 +201,6 @@ class Receiver_clues_model extends HD_Model
|
||||
$this->load->model('agent/organization/organization_cmmssn_model', 'mdOrganizationCmmssn');
|
||||
$this->load->model('agent/organization/organization_model');
|
||||
$this->load->model('agent/pingan/pingan_users_cmmssn_model');
|
||||
$this->load->model('agent/auto_product_model');
|
||||
$this->auto_product_model->set_db('agentdb');
|
||||
$this->pingan_users_model->set_db('agentdb');
|
||||
$this->mdOrganizationCmmssn->set_db('agentdb');
|
||||
$this->organization_model->set_db('agentdb');
|
||||
@@ -233,9 +225,6 @@ class Receiver_clues_model extends HD_Model
|
||||
if (!$pinanUser['id']) {
|
||||
throw new Exception("线索不存在绑定用户关系");
|
||||
}
|
||||
//修改获取分佣金额
|
||||
$product = $this->auto_product_model->get(['id' => $clues['out_id']]);
|
||||
$money = $product['cluesCommission'] ?: $money; //商家扣除金额
|
||||
//获取分佣配置
|
||||
$cmmssn = $this->mdOrganizationCmmssn->get(['teamId' => $pinanUser['orgTeamId'], 'status' => 0]);
|
||||
if (!$cmmssn) {
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Receiver_clues_notice_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_receiver_clues_notice';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -331,7 +331,6 @@ class Receiver_customers_model extends HD_Model
|
||||
$log_path = "customer_unlock.log";
|
||||
$this->load->model('receiver/receiver_clues_model');
|
||||
$this->load->model('agent/auto_user_coupon_model');
|
||||
$this->load->model('biz/biz_car_brand_model');
|
||||
$this->auto_user_coupon_model->set_db('agentdb');
|
||||
$this->db->trans_begin();
|
||||
$this->auto_user_coupon_model->db->trans_begin();
|
||||
@@ -357,34 +356,11 @@ class Receiver_customers_model extends HD_Model
|
||||
throw new Exception('您已解锁该线索');
|
||||
}
|
||||
$unLockBizIds[] = $row['biz_id'];
|
||||
//获取门店的品牌
|
||||
$bizBrands = $this->biz_car_brand_model->select(['biz_id' => $row['biz_id']], '', '', '', 'brand_id');
|
||||
$bizBrandIds = $bizBrands ? array_column($bizBrands, 'brand_id') : [];
|
||||
$bizBrandIdString = $bizBrandIds ? implode(',', $bizBrandIds) : '';
|
||||
|
||||
if ($bizBrandIdString) {
|
||||
//按门店品牌发券
|
||||
$updateCoupon = [
|
||||
"unLockBizIds = IF(
|
||||
unLockBizIds IS NOT NULL AND unLockBizIds != '',
|
||||
CONCAT_WS(',',unLockBizIds, '{$row['biz_id']}'),
|
||||
'{$row['biz_id']}'
|
||||
)" => null,
|
||||
'status' => Auto_user_coupon_model::STATUS_NOT_USED
|
||||
];
|
||||
$where = [
|
||||
"productId in (select id from lc_auto_product where brandId in ({$bizBrandIdString}) and status =1)" => null,
|
||||
"status" => Auto_user_coupon_model::STATUS_AUDITING,
|
||||
'userId' => $coupon['userId']
|
||||
];
|
||||
$res = $this->auto_user_coupon_model->update($updateCoupon, $where);
|
||||
} else {
|
||||
$updateCoupon = [
|
||||
'unLockBizIds' => implode(',', $unLockBizIds),
|
||||
'status' => Auto_user_coupon_model::STATUS_NOT_USED
|
||||
];
|
||||
$res = $this->auto_user_coupon_model->update($updateCoupon, ['id' => $coupon['id']]);
|
||||
}
|
||||
$updateCoupon = [
|
||||
'unLockBizIds' => implode(',', $unLockBizIds),
|
||||
'status' => Auto_user_coupon_model::STATUS_NOT_USED
|
||||
];
|
||||
$res = $this->auto_user_coupon_model->update($updateCoupon, ['id' => $coupon['id']]);
|
||||
if (!is_numeric($res)) {
|
||||
throw new Exception('更新优惠券状态失败');
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class Receiver_orders_model extends HD_Model
|
||||
public function downpayment_type($type = 0)
|
||||
{
|
||||
$array = [1 => '现金', 2 => '0首付', 3 => '按揭'];
|
||||
if (isset($type)) {
|
||||
if ($type) {
|
||||
return $array[$type] ? $array[$type] : '';
|
||||
} else {
|
||||
return $array;
|
||||
|
||||
@@ -4,14 +4,9 @@ defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Sys_notice_model extends HD_Model
|
||||
{
|
||||
private $table_name = 'lc_sys_notice';
|
||||
const PLAT_FORM_ADMIN = 1; //接收平台-管理后台
|
||||
const PLAT_FORM_PINGAN = 2; //接收平台-平安
|
||||
const PLAT_FORM_WXAPP = 3; //接收平台-微信小程序
|
||||
|
||||
const PLAT_FORM_SYS_ADMIN = 4;//推送平台-管理后台
|
||||
const PLAT_FORM_SYS_PINGAN = 5;//推送平台-平安
|
||||
const PLAT_FORM_SYS_WXAPP = 6;//推送平台-微信小程序
|
||||
const PLAT_FORM_SYS_H5 = 7;//推送平台-h5报名
|
||||
const PLAT_FORM_ADMIN = 1; //前端-管理后台
|
||||
const PLAT_FORM_PINGAN = 2; //前端-平安
|
||||
const PLAT_FORM_WXAPP = 3; //前端-微信小程序
|
||||
|
||||
const TYPE_SYS = 0; //系统通知
|
||||
const ICON_DEFAULT = 'el-icon-s-comment';//默认图标
|
||||
@@ -20,17 +15,11 @@ class Sys_notice_model extends HD_Model
|
||||
];
|
||||
const STATUS_UNREAD = 0; //未读
|
||||
const STATUS_READ = 1; //已读
|
||||
const READ_STATUS = [
|
||||
self::STATUS_UNREAD => '未读',
|
||||
self::STATUS_READ => '已读',
|
||||
];
|
||||
const PLATFORM_LIST = [
|
||||
self::PLAT_FORM_ADMIN => '管理后台',
|
||||
self::PLAT_FORM_PINGAN => '平安',
|
||||
self::PLAT_FORM_WXAPP => '微信小程序',
|
||||
];
|
||||
// 系统账号
|
||||
const SEND_UID_SYS = 8888888;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -39,13 +28,12 @@ class Sys_notice_model extends HD_Model
|
||||
|
||||
/**
|
||||
* 添加系统通知
|
||||
* @param Array $params platform,uid,content,type,url
|
||||
* @param $sendPlatform
|
||||
* @param $sendUid
|
||||
* @param $showWssErr
|
||||
* @param $sendUid 推送消息账号
|
||||
* @param $sendPlatform 发消息平台
|
||||
* @param $params 其它参数
|
||||
* @return MyResponse
|
||||
*/
|
||||
public function addNotice($params, $sendPlatform, $sendUid = self::SEND_UID_SYS, $showWssErr = false)
|
||||
public function addNotice($params, $sendPlatform, $sendUid = 8888888, $showWssErr = false)
|
||||
{
|
||||
$logPath = 'websocket';
|
||||
$logFile = 'sendError.txt';
|
||||
@@ -59,9 +47,7 @@ class Sys_notice_model extends HD_Model
|
||||
'content' => $params['content'],
|
||||
'type' => $params['type'] ?: 0,
|
||||
'url' => $params['url'] ?: '',
|
||||
'c_time' => time(),
|
||||
'send_platform' => $sendPlatform,
|
||||
'send_uid' => $sendUid
|
||||
'c_time' => time()
|
||||
];
|
||||
$addData['icon'] = self::ICON_TYPE[$params['type']] ?: self::ICON_DEFAULT;
|
||||
$req = $this->add($addData);
|
||||
|
||||
@@ -6,14 +6,13 @@ class Ws_conn_model extends HD_Model
|
||||
private $table_name = 'lc_ws_conn';
|
||||
|
||||
//平台类型
|
||||
const PLAT_FORM_ADMIN = 1; //接收平台-管理后台
|
||||
const PLAT_FORM_PINGAN = 2; //接收平台-平安
|
||||
const PLAT_FORM_WXAPP = 3; //接收平台-微信小程序
|
||||
const PLAT_FORM_ADMIN = 1; //前端-管理后台
|
||||
const PLAT_FORM_PINGAN = 2; //前端-平安
|
||||
const PLAT_FORM_WXAPP = 3; //前端-微信小程序
|
||||
|
||||
const PLAT_FORM_SYS_ADMIN = 4;//推送平台-管理后台
|
||||
const PLAT_FORM_SYS_PINGAN = 5;//推送平台-平安
|
||||
const PLAT_FORM_SYS_WXAPP = 6;//推送平台-微信小程序
|
||||
const PLAT_FORM_SYS_H5 = 7;//推送平台-微信小程序
|
||||
const PLAT_FORM_SYS_ADMIN = 4;//后端-管理后台
|
||||
const PLAT_FORM_SYS_PINGAN = 5;//后端-平安
|
||||
const PLAT_FORM_SYS_WXAPP = 6;//后端-微信小程序
|
||||
//接收消息平台
|
||||
const REC_PLAT_FORM = [
|
||||
self::PLAT_FORM_WXAPP => '小程序',
|
||||
|
||||
Vendored
+1
-1
@@ -169,7 +169,7 @@ function getMillisecond()
|
||||
|
||||
function SendSMS($mobile, $content,
|
||||
$timerTime = "", $customSmsId = "",
|
||||
$extendedCode = "2",
|
||||
$extendedCode = "",
|
||||
$validPeriodtime = 120)
|
||||
{
|
||||
|
||||
|
||||
-191
@@ -1,191 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# WebSocket 服务管理脚本
|
||||
# 路径配置
|
||||
SCRIPT_PATH="/home/wwwroot/spacestation/www/api/websocket.php"
|
||||
PID_FILE="/var/run/websocket.pid"
|
||||
LOG_FILE="/tmp/websocket.log"
|
||||
|
||||
# 颜色定义
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# 检查PHP和Swoole扩展
|
||||
check_environment() {
|
||||
if ! command -v php &> /dev/null; then
|
||||
echo -e "${RED}错误: 未找到PHP${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! php -m | grep -q "swoole"; then
|
||||
echo -e "${RED}错误: PHP未安装Swoole扩展${NC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 获取进程ID
|
||||
get_pid() {
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
cat "$PID_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
# 检查服务是否运行
|
||||
is_running() {
|
||||
local pid=$(get_pid)
|
||||
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 启动服务
|
||||
start() {
|
||||
check_environment
|
||||
|
||||
if is_running; then
|
||||
echo -e "${YELLOW}警告: WebSocket服务已在运行 (PID: $(get_pid))${NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -n "正在启动WebSocket服务... "
|
||||
|
||||
# 后台启动服务
|
||||
nohup php "$SCRIPT_PATH" > "$LOG_FILE" 2>&1 &
|
||||
local pid=$!
|
||||
|
||||
# 等待服务启动
|
||||
sleep 2
|
||||
|
||||
if kill -0 $pid 2>/dev/null; then
|
||||
echo "$pid" > "$PID_FILE"
|
||||
echo -e "${GREEN}成功${NC} (PID: $pid)"
|
||||
else
|
||||
echo -e "${RED}失败${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 停止服务
|
||||
stop() {
|
||||
if ! is_running; then
|
||||
echo -e "${YELLOW}WebSocket服务未运行${NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local pid=$(get_pid)
|
||||
echo -n "正在停止WebSocket服务 (PID: $pid)... "
|
||||
|
||||
# 优雅地停止服务
|
||||
if kill -TERM "$pid" 2>/dev/null; then
|
||||
# 等待进程结束
|
||||
local count=0
|
||||
while kill -0 "$pid" 2>/dev/null && [ $count -lt 10 ]; do
|
||||
sleep 1
|
||||
((count++))
|
||||
done
|
||||
|
||||
# 如果进程仍未结束,则强制杀死
|
||||
if kill -0 "$pid" 2>/dev/null; then
|
||||
kill -KILL "$pid"
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
rm -f "$PID_FILE"
|
||||
echo -e "${GREEN}成功${NC}"
|
||||
else
|
||||
echo -e "${RED}失败${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 重启服务
|
||||
restart() {
|
||||
stop
|
||||
sleep 2
|
||||
start
|
||||
}
|
||||
|
||||
# 查看服务状态
|
||||
status() {
|
||||
if is_running; then
|
||||
local pid=$(get_pid)
|
||||
echo -e "${GREEN}WebSocket服务正在运行 (PID: $pid)${NC}"
|
||||
|
||||
# 显示更多详细信息
|
||||
ps -p "$pid" -o pid,ppid,cmd,etime --no-headers 2>/dev/null
|
||||
else
|
||||
echo -e "${YELLOW}WebSocket服务未运行${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 查看日志
|
||||
logs() {
|
||||
if [ -f "$LOG_FILE" ]; then
|
||||
tail -f "$LOG_FILE"
|
||||
else
|
||||
echo -e "${YELLOW}日志文件不存在: $LOG_FILE${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 查看最后的日志
|
||||
tail_logs() {
|
||||
local lines=${1:-20}
|
||||
if [ -f "$LOG_FILE" ]; then
|
||||
tail -n "$lines" "$LOG_FILE"
|
||||
else
|
||||
echo -e "${YELLOW}日志文件不存在: $LOG_FILE${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 显示帮助信息
|
||||
show_help() {
|
||||
echo "用法: $0 {start|stop|restart|status|logs|tail|help}"
|
||||
echo ""
|
||||
echo "命令说明:"
|
||||
echo " start 启动WebSocket服务"
|
||||
echo " stop 停止WebSocket服务"
|
||||
echo " restart 重启WebSocket服务"
|
||||
echo " status 查看服务状态"
|
||||
echo " logs 实时查看日志"
|
||||
echo " tail [n] 查看最后n行日志 (默认20行)"
|
||||
echo " help 显示此帮助信息"
|
||||
}
|
||||
|
||||
# 主逻辑
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
logs)
|
||||
logs
|
||||
;;
|
||||
tail)
|
||||
tail_logs "$2"
|
||||
;;
|
||||
help|--help|-h)
|
||||
show_help
|
||||
;;
|
||||
*)
|
||||
echo -e "${RED}无效参数: $1${NC}"
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $?
|
||||
Binary file not shown.
Reference in New Issue
Block a user