1 Commits

Author SHA1 Message Date
lcc 9bcf645b43 平安用户端 2025-03-12 10:34:24 +08:00
36926 changed files with 2232 additions and 3812163 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
@@ -58,7 +58,7 @@ $autoload['packages'] = array();
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('database', 'myResponse');
$autoload['libraries'] = array('database');
/*
| -------------------------------------------------------------------
@@ -89,7 +89,7 @@ $autoload['drivers'] = array();
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('comm', 'sys', 'url', 'image', 'authorization');
$autoload['helper'] = array('comm', 'sys', 'url','image');
/*
| -------------------------------------------------------------------
-22
View File
@@ -94,25 +94,3 @@ $db['default'] = array(
'failover' => array(),
'save_queries' => TRUE
);
$db['agentdb'] = array(
'dsn' => '',
'hostname' => 'mysql:host=127.0.0.1;port=3306;dbname=agentdb',
'username' => 'devuser',
'password' => 'DEV@hdy123456',
'database' => 'agentdb',
'dbdriver' => 'pdo',
'dbprefix' => 'lc_',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8mb4',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
-12
View File
@@ -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';
+38 -106
View File
@@ -415,12 +415,9 @@ class Common extends CI_Controller
$page = $this->input->post('page') ? intval($this->input->post('page')) : 1;
$size = $this->input->post('size') ? intval($this->input->post('size')) : 10;
$brand_id = intval($this->input->post('brand_id'));
$car_brand_id = intval($this->input->post('car_brand_id'));
$province_id = intval($this->input->post('province_id'));
$city_id = intval($this->input->post('city_id'));
$county_id = intval($this->input->post('county_id'));
$type = $this->input->post('type');
$unset_city_limit = intval($this->input->post('unset_city_limit'));
$use_shop_list = $this->input->post('use_shop_list');
$sys_cate_id = intval($this->input->post('sys_cate_id'));
@@ -433,7 +430,6 @@ class Common extends CI_Controller
}
}
$where['status'] = 1;
// $car_brand_id && $where['car_brand_id'] = $car_brand_id;
$sys_cate_id && $where['cate_id'] = $sys_cate_id;
$biz_name && $where['biz_name like "%' . $biz_name . '%"'] = null;
$brand_id && $where['brand_id'] = $brand_id;
@@ -441,16 +437,8 @@ class Common extends CI_Controller
$city_id && $where['city_id'] = $city_id;
$county_id && $where['county_id'] = $county_id;;
$ids && $where['id not in (' . $ids . ')'] = null;
if (is_array($type)) {
$type && $where['type in (' . implode(',', $type) . ')'] = null;
} else {
$type == 1 && $where['type'] = 1;
}
if ($car_brand_id) {
$where["id in (select biz_id from lc_biz_car_brand where brand_id={$car_brand_id})"] = null;
}
if (($province_id && $city_id) || $unset_city_limit) {
if ($province_id && $city_id) {
$count = $this->mdBiz->count($where);
if ($count) {
$resBiz = $this->mdBiz->select($where, 'id desc', $page, $size);
@@ -459,10 +447,6 @@ class Common extends CI_Controller
$setValue = array();
$setValue['id'] = $value['id'];
$setValue['name'] = $value['biz_name'];
if (is_array($type)) {
$bizType = $this->mdBiz->type_ary($value['type']);
$setValue['name'] .= '(' . $bizType . ')';
}
$img = $value['headimg'] ? $value['headimg'] : $value['cover'];
$setValue['img'] = $img ? build_qiniu_image_url($img) : '';
$setValue['sort'] = $key;
@@ -850,9 +834,6 @@ class Common extends CI_Controller
*/
public function bind_mobile()
{
$this->load->helper('order');
$this->load->model('receiver/receiver_call_wechat_model', 'callWechat');
$this->load->library('carHome/callOutWechat');
$this->load->model('sys/sys_admin_model');
$this->load->model('sys/sys_yx_mobiles_model');
$params = $this->input->get();
@@ -865,89 +846,57 @@ class Common extends CI_Controller
if ($type == 'clues') {
$this->load->model('receiver/receiver_clues_model', 'mdClues');
$re = $this->mdClues->get(array('id' => $id));
$orderId = $re['sid'];
$cfId = $re['id'];
$cfType = Receiver_call_wechat_model::CF_TYPE_CLUE;
} else if ($type == 'customer') {
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
$re = $this->mdCustomers->get(array('id' => $id));
$orderId = $re['cid'];
$cfId = $re['id'];
$cfType = Receiver_call_wechat_model::CF_TYPE_CUSTOMERS;
} else {
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
}
if (!$re['mobile']) {
return $this->show_json(SYS_CODE_FAIL, '手机不存在!');
}
$user = $this->sys_admin_model->get(['id' => $this->uid]);
$user_mobile = $user['kf_mobile'] ?: $user['mobile'];
if (!$user_mobile) {
return $this->show_json(SYS_CODE_FAIL, '管理员未设置手机号');
}
$mobile = $re['mobile'];
$callOutWechat = new CallOutWechat();
$cityId = $re['city_id'] ?: 350200;
$requestId = create_order_no($cityId, 'licheb');
$req = $callOutWechat->outBind($requestId, $orderId, $user_mobile, $mobile);
if (!$req->isSuccess()) {
return $this->show_json(SYS_CODE_FAIL, $req->getMessage());
}
//添加记录
$add_data = [
'reqId' => $requestId,
'cfId' => $cfId,
'cfUid' => $this->uid,
'cfType' => $cfType,
'cfPlatform' => Receiver_call_wechat_model::CF_PLATFORM_ADMIN,
'createTime' => time()
];
$req = $this->callWechat->add($add_data);
if (!is_numeric($req)) {
return $this->show_json(SYS_CODE_FAIL, $req->getMessage());
}
//绑定手机号
return $this->show_json(SYS_CODE_SUCCESS, '提交成功,请耐心等待');
// $cache = &load_cache('redis');
// $xz_admin_phone = $cache->get('xz_admin_phone');
// $middleNumber = '';
// if ($xz_admin_phone) {
// $middleNumber = $xz_admin_phone['admins'][$this->uid];
// }
// 平安双呼
// $yxMobiles = $this->sys_yx_mobiles_model->get(['admin_id' => $this->uid, 'status' => 1]);
// $middleNumber = $yxMobiles['mobile'] ?: '';
// if (!$middleNumber) {
// return $this->show_json(SYS_CODE_FAIL, '还未分配号码不可使用');
// }
// require_once COMMPATH . 'third_party/Ycall/Ycall.php';
// $seq_id = create_order_no();
// $ycall = new Ycall();
// $maxBindingTime = 30;//绑定时间
// $result = $ycall->AXbind($middleNumber, $mobile, '', $maxBindingTime, '');
$yxMobiles = $this->sys_yx_mobiles_model->get(['admin_id' => $this->uid, 'status' => 1]);
$middleNumber = $yxMobiles['mobile'] ?: '';
if (!$middleNumber) {
return $this->show_json(SYS_CODE_FAIL, '还未分配号码不可使用');
}
$this->load->helper('order');
require_once COMMPATH . 'third_party/Ycall/Ycall.php';
$seq_id = create_order_no();
$ycall = new Ycall();
$maxBindingTime = 30;//绑定时间
$result = $ycall->AXbind($middleNumber, $mobile, '', $maxBindingTime, '');
//改AXB模式 开始
// $this->load->model('sys/sys_admin_model');
// $user = $this->sys_admin_model->get(['id'=>$this->uid]);
// $user_mobile = $user['mobile'];
// if(!$user_mobile) return $this->show_json(SYS_CODE_FAIL, '管理员未设置手机号');
// $result = $ycall->ABXbind($user_mobile, $mobile, $seq_id, $maxBindingTime);
//改AXB模式 结束
// if ($result['result'] != '000000') { //绑定失败
// debug_log("xz_result:" . json_encode($result, JSON_UNESCAPED_UNICODE));
// return $this->show_json(SYS_CODE_FAIL, $result['message']);
// }
// $this->data['middlenumber'] = $result['middleNumber'];
// $add_data = [
// 'call_id' => $seq_id,
// 'bind_id' => $result['bindId'],
// 'display_number' => $result['middleNumber'],
// 'cf_id' => $id,
// 'cf_uid' => $this->uid,
// 'cf_title' => $type,
// 'cf_platform' => 'admin',
// 'c_time' => time()
// ];
// $this->mdReceiverYx->add($add_data);
// $this->data['mobile_sub'] = mobile_asterisk($mobile);
// $this->data['id'] = $id;
// $this->show_view('common/bind_mobile');
if ($result['result'] != '000000') { //绑定失败
debug_log("xz_result:" . json_encode($result, JSON_UNESCAPED_UNICODE));
return $this->show_json(SYS_CODE_FAIL, $result['message']);
}
$this->data['middlenumber'] = $result['middleNumber'];
$add_data = [
'call_id' => $seq_id,
'bind_id' => $result['bindId'],
'display_number' => $result['middleNumber'],
'cf_id' => $id,
'cf_uid' => $this->uid,
'cf_title' => $type,
'cf_platform' => 'admin',
'c_time' => time()
];
$this->mdReceiverYx->add($add_data);
$this->data['mobile_sub'] = mobile_asterisk($mobile);
$this->data['id'] = $id;
$this->show_view('common/bind_mobile');
}
/**
@@ -1154,7 +1103,7 @@ class Common extends CI_Controller
$lists = $this->auto_brand_model->select($where, 'initial asc', $page, $size);
foreach ($lists as $key => $val) {
$itemsList[] = [
'id' => intval($val['id']),
'id' => $val['id'],
'name' => $val['name'],
'is_checked' => $itemsChecked[$val['id']] ? 1 : 0
];
@@ -1205,7 +1154,7 @@ class Common extends CI_Controller
$tp == 0 && $lists[] = array('id' => 0, 'name' => $name ? $name : '选择车型');
$res = $this->mdAutoCar->select(array_merge($where, ['series_id' => $pid]), 'id asc', 0, 0, 'id,name');
}
foreach ($res as $value) {
foreach ($res as $key => $value) {
$lists[] = array('id' => $value['id'], 'name' => $value['name']);
}
$this->data = $lists;
@@ -1242,25 +1191,8 @@ class Common extends CI_Controller
$where = [
'status' => App_paic_users_model::STATUS_NORMAL
];
$rows = $this->app_paic_users_model->select($where, 'id desc', 0, 0, 'id,name,mobile');
foreach ($rows as $k => $v) {
$rows[$k]['name'] = $v['name'] . " (" . substr($v['mobile'], -4) . ")";
}
$rows = $this->app_paic_users_model->select($where, 'id desc', 0, 0, 'id,name');
$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, '操作成功');
}
}
+1 -1
View File
@@ -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);
}
}
+20 -38
View File
@@ -1,72 +1,54 @@
<?php
//enter
defined('BASEPATH') or exit('No direct script access allowed');
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller
{
class Welcome extends CI_Controller {
public function index()
{
$this->load->model('sys/sys_notice_model');
public function index()
{
$this->load->model('sys/sys_menu_model');
$list = $this->sys_menu_model->select(array('status' => 1), 'sort desc', 0, 0);
$this->load->model('sys/sys_role_model');
$role = $this->sys_role_model->get(array('id' => $this->role));
$menu_ids = explode(',', $role['menu_ids']);
foreach ($list as $item) {
if ($this->role != SUPER_ADMIN && !in_array($item['id'], $menu_ids)) {
foreach ($list as $item)
{
if($this->role != SUPER_ADMIN && !in_array($item['id'], $menu_ids))
{
continue;
}
$map[$item['id']] = $item;
}
foreach ($list as $item) {
if ($this->role != SUPER_ADMIN && !in_array($item['id'], $menu_ids)) {
foreach ($list as $item)
{
if($this->role != SUPER_ADMIN && !in_array($item['id'], $menu_ids))
{
continue;
}
if (isset($item['pid']) && isset($map[$item['pid']])) {
if (isset($item['pid']) && isset($map[$item['pid']]))
{
$map[$item['pid']]['sub'][] = &$map[$item['id']];
} else {
}
else
{
$this->data['menus'][] = &$map[$item['id']];
}
}
unset($map);
$_notice = [];
$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) {
$rows = $this->sys_notice_model->select($where, 'id desc', 1, 10);
foreach ($rows as $item) {
$_notice[] = [
'id' => $item['id'],
'icon' => Sys_notice_model::ICON_TYPE[$item['icon']] ?: Sys_notice_model::ICON_DEFAULT,
'content' => $item['content'],
'url' => $item['url'],
'read' => $item['read'],
'readCn' => $item['read'] ? '已读' : '未读',
'type' => $item['type'],
'c_time' => date('Y-m-d H:i:s')
];
}
}
$this->data['_username'] = $this->username;
$this->data['_role'] = $role['name'];
$this->data['_notice'] = $_notice;
$this->data['_noticeCount'] = $_noticeCount;
$this->load->view('index', $this->data);
return true;
}
}
public function nopage()
public function nopage()
{
$this->load->view('nopage');
+1 -2
View File
@@ -5,7 +5,7 @@ defined('BASEPATH') or exit('No direct script access allowed');
class Member extends HD_Controller
{
private $groups;
private $groups = [1 => '车管家', 2 => '店长', 3 => '投资人', 4 => '客户成功经理'];
public function __construct()
{
@@ -13,7 +13,6 @@ class Member extends HD_Controller
$this->load->model('app/licheb/App_licheb_users_model', 'userM');
$this->load->model('app/licheb/App_licheb_channel_biz_model', 'mdChannelBiz');
$this->load->model("biz/biz_model");
$this->groups = $this->userM->get_group();
}
//首页信息
+14 -100
View File
@@ -16,18 +16,18 @@ class Customer extends HD_Controller
private $keyExt5 = '10477';
private $channel = array(
'10477' => '宝马3',
'10489' => '腾势',
'10490' => '奇瑞',
'10491' => '方程豹',
'10492' => '五菱',
'10493' => '五菱2',
'10477' => '初始渠道',
'10489' => '厦门-郑子华',
'10490' => '厦门-魏思雨',
'10491' => '厦门-蔡文彬',
'10492' => '厦门-李怀松',
'10493' => '厦门-哪吒',
'10494' => '厦门-古惟天',
'10495' => '福州仓山',
'10496' => 'BMW',
'10497' => '宝马2',
'10498' => '梅赛德斯',
'10499' => '北京越野',
'10495' => '厦门-7',
'10496' => '厦门-8',
'10497' => '厦门-9',
'10498' => '厦门-10',
'10499' => '长沙-1',
'10500' => '长沙-2',
'10501' => '长沙-3',
'10502' => '长沙-4',
@@ -142,7 +142,7 @@ class Customer extends HD_Controller
$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'));
$map_biz = $this->biz_model->map('id', 'biz_name', ['status' => 1, 'province_id' => 350000], '', 0, 0, 'id,biz_name');
$map_biz = $this->biz_model->map('biz_name', 'id', ['status' => 1, 'province_id' => 350000], '', 0, 0, 'id,biz_name');
foreach ($rows as $val){
$area = $map_area_city[$val['city_id']][0];
@@ -387,97 +387,13 @@ class Customer extends HD_Controller
public function export()
{
$params = $this->input->get();
if ($params['c_time']) {
$c_time = explode(' ~ ', $params['c_time']);
if ($c_time[0]) {
$where["c_time >="] = $c_time[0] . ' 00:00:00';
}
if ($c_time[1]) {
$where["c_time <="] = $c_time[1] . ' 23:59:59';
}
}
//上传时间
if ($params['p_time']) {
$p_time = explode(' ~ ', $params['p_time']);
if ($p_time[0]) {
$where["p_time >="] = $p_time[0] . ' 00:00:00';
}
if ($p_time[1]) {
$where["p_time <="] = $p_time[1] . ' 23:59:59';
}
}
$province_id = intval($params['province_id']);
$city_id = intval($params['city_id']);
$province_id && $where['province_id'] = $province_id;
$city_id && $where['city_id'] = $city_id;
$params['channel'] && $where['channel'] = $params['channel'];
$params['cfrom_id'] && $where['cfrom'] = $params['cfrom_id'];
$params['cfrom_id2'] && $where['cfrom2'] = $params['cfrom_id2'];
$params['brand_id'] && $where['brand_id'] = $params['brand_id'];
$params['series_id'] && $where['series_id'] = $params['series_id'];
$page = 1;
$size = 10000;
$indexs = [
'mobile' => '手机',
'cfrom' => '来源一',
'cfrom2' => '来源二',
'channel' => '渠道',
'province' => '省份',
'city' => '城市',
'brand' => '品牌',
'series' => '车型',
"p_time" => "上传时间",
];
$count = $this->autohome_customer_model->count($where);
$data = [];
if ($count) {
$rows = $this->autohome_customer_model->select($where, 'id desc', $page, $size);
$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'));
$map_biz = $this->biz_model->map('id', 'biz_name', ['status' => 1, 'province_id' => 350000], '', 0, 0, 'id,biz_name');
$city_id_arr = array_filter(array_unique(array_column($rows, 'city_id')));
if ($city_id_arr) {
$str_ids = implode(',', $city_id_arr);
$map_area_city = $this->area_model->map('city_id', '', ["city_id in ({$str_ids})" => null], '', 0, $size, 'city_id,province_name,city_name');
}
foreach ($rows as $val){
$val['brand'] = $brands[$val['brand_id']][0]['name'];
$val['series'] = $series[$val['series_id']][0]['name'];
$area = $map_area_city[$val['city_id']][0];
$val['province'] = $area['province_name'];
$val['city'] = $area['city_name'];
if($val['cfrom'] == 1){
$cf2 = $this->cfrom2[$val['cfrom2']];
}else{
$cf2 = $map_biz[$val['cfrom2']];
}
$val['cfrom'] = $this->cfrom[$val['cfrom']];
$val['cfrom2'] = $cf2;
$val['channel'] = $this->channel[$val['channel']];
$data[] = $val;
}
}
$fileName = '客户列表';
array_unshift($data, $indexs);
$this->load->library('excel');
$this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
}
function json_map_cfrom()
{
$pid = $this->input->post('pid');
$map_biz = $this->biz_model->map('biz_name', 'id', ['status' => 1, 'province_id' => 350000, 'type' => 2], '', 0, 0, 'id,biz_name');
$map_biz = $this->biz_model->map('biz_name', 'id', ['status' => 1, 'province_id' => 350000, 'type' => 0], '', 0, 0, 'id,biz_name');
if($pid == 1){
$this->data = $this->cfrom2;
@@ -528,9 +444,7 @@ class Customer extends HD_Controller
'keyCarAudiId' => $v['series_id'] ? $v['series_id'] : null,
'keyCarTypeId' => null,
'keyCardCityId' => $v['city_id'] ? $v['city_id'] : '110100',
'keyNewCarRentSupplierId' => 1,
'keyExt1' => 376,
'keyReleaseId' => 376,
'keyNewCarRentSupplierId' => 10
);
$res = $this->mycurl->httpPost($url, $push_data, 'is_json');
+10 -104
View File
@@ -19,10 +19,6 @@ class Store extends HD_Controller
$this->load->helper('image_helper');
$this->load->model("biz/biz_model");
$this->load->model('area_model');
$this->load->library('bizAccount');
$this->load->helper('db');
$this->load->model('auto/auto_brand_model');
$this->load->model('biz/biz_car_brand_model');
}
public function index()
@@ -69,42 +65,15 @@ class Store extends HD_Controller
$c_time[1] && $where["c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
$params['type'] && $where['type'] = $params['type'];
if ($params['brand_id']) {
$brand_biz_list = $this->biz_car_brand_model->select(['brand_id' => intval($params['brand_id'])], '', 0, 0, 'biz_id');
$bizIds = array_column($brand_biz_list, 'biz_id');
$bizIdString = $bizIds ? implode(',', $bizIds) : 0;
$where["id in ({$bizIdString})"] = null;
}
$typeAry = $this->biz_model->type_ary();
$biz_lists = $this->biz_model->select($where, 'id desc', $page, $pagesize);
$count = $this->biz_model->count($where);
$bizlists = [];
$account = new BizAccount();
$brandAry = $this->auto_brand_model->select(['status>' => 0], 'initial asc', 0, 0, 'id,name');
if ($biz_lists) {
$map = [];
foreach ($brandAry as $item) {
$map[$item['id']] = null !== $item['name'] ? $item['name'] : '';
}
foreach ($biz_lists as $v) {
$bizAccount = $account->getAccountBizId($v['id']);
$v['money_left'] = $bizAccount ? $bizAccount['money_left'] : 0;
$v['c_time'] = date('Y-m-d H:i:s', $v['c_time']);
$v['biz_type'] = $typeAry[$v['type']];
// $v['brand_name'] = $map[$v['car_brand_id']];
$brand_name_list = [];
//获取门店品牌
$bizBrand = $this->biz_car_brand_model->map('brand_id', '', ['biz_id' => $v['id']], '', '', '', 'brand_id,biz_id');
if ($bizBrand) {
foreach ($bizBrand as $k1 => $v1) {
$brand_name_list[] = $map[$k1];
}
}
$v['brand_name'] = $brand_name_list ? implode(',', $brand_name_list) : '';
$bizlists[] = $v;
}
foreach ($biz_lists as $v) {
$v['c_time'] = date('Y-m-d H:i:s', $v['c_time']);
$v['biz_type'] = $typeAry[$v['type']];
$bizlists[] = $v;
}
$this->data['brandAry'] = $brandAry;
$this->data['params'] = $params;
$this->data['lists'] = $bizlists;
$this->data['typeAry'] = $typeAry;
@@ -132,16 +101,7 @@ class Store extends HD_Controller
$biz['county_id'] && $areas = $this->sys_area_model->select(array('county_id' => $biz['county_id']));
$this->data['areas'] = $areas;
$biz['avatar'] = build_qiniu_image_url($biz['headimg'], 200, 200);
$biz['car_brand_id'] = $biz['car_brand_id'] ? intval($biz['car_brand_id']) : '';
$carBrands = $this->biz_car_brand_model->select(['biz_id' => $id], '', '', 'brand_id');
$carBrandsIds = [];
if ($carBrands) {
foreach ($carBrands as $item) {
$carBrandsIds[] = intval($item['brand_id']);
}
}
$biz['car_brand_ids'] = $carBrandsIds;
$this->data['biz'] = $biz;
} else {
$map_city = $this->city_ary();
@@ -158,7 +118,7 @@ class Store extends HD_Controller
'type' => 0,
'company_id' => 0,
'auto_brands' => array(),
'car_brand_id' => ''
'car_brand_id' => 0
);//默认福建城市
$this->data['biz'] = $biz;
}
@@ -169,7 +129,7 @@ class Store extends HD_Controller
public function add()
{
$car_brand_ids = $this->input->post('car_brand_ids');
$biz['status'] = 1;
$biz['biz_name'] = $this->input->post('biz_name', true);
if (!$biz['biz_name']) {
@@ -190,7 +150,6 @@ class Store extends HD_Controller
$biz['lat'] = $this->input->post('lat', true);
$biz['lng'] = $this->input->post('lng', true);
$biz['type'] = intval($this->input->post('type', true));
$biz['car_brand_id'] = intval($this->input->post('car_brand_id', true)) ?: '';
//上传头像
$biz['headimg'] = $this->input->post('headimg');
@@ -200,17 +159,7 @@ class Store extends HD_Controller
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '添加失败');
}
if (is_array($car_brand_ids)) {
$carBrandData = [];
foreach ($car_brand_ids as $item) {
$carBrandData[] = [
'biz_id' => $id,
'brand_id' => $item,
'c_time' => time()
];
}
$carBrandData && $this->biz_car_brand_model->replace_batch($carBrandData);
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
@@ -222,7 +171,7 @@ class Store extends HD_Controller
$id = intval($this->input->post('id'));
$company_id = intval($this->input->post('company_id', true));
$srv_company_id = intval($this->input->post('srv_company_id', true));
$car_brand_ids = $this->input->post('car_brand_ids');
$biz['biz_name'] = $this->input->post('biz_name', true);
if (!$biz['biz_name']) {
return $this->show_json(SYS_CODE_FAIL, '门店不能为空');
@@ -242,28 +191,13 @@ class Store extends HD_Controller
$biz['lat'] = $this->input->post('lat', true);
$biz['lng'] = $this->input->post('lng', true);
$biz['type'] = intval($this->input->post('type', true));
$biz['car_brand_id'] = intval($this->input->post('car_brand_id', true)) ?: '';
//上传头像
$biz['headimg'] = $this->input->post('headimg');
$res = $this->biz_model->update($biz, array('id' => $id));
if (!$res) {
return $this->show_json(SYS_CODE_FAIL, '添加失败');
}
if (is_array($car_brand_ids)) {
$brandIds = implode(',', $car_brand_ids);
$brandIds && $this->biz_car_brand_model->delete(['biz_id' => $id, 'brand_id NOT IN(' . $brandIds . ')' => null]);
$carBrandData = [];
foreach ($car_brand_ids as $item) {
$carBrandData[] = [
'biz_id' => $id,
'brand_id' => $item,
'c_time' => time()
];
}
$carBrandData && $this->biz_car_brand_model->replace_batch($carBrandData);
} else {
$this->biz_car_brand_model->delete(['biz_id' => $id]);
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
@@ -335,10 +269,7 @@ class Store extends HD_Controller
$city_id && $where['city_id'] = $city_id;
$county_id && $where['county_id'] = $county_id;
$title && $where["biz_name like '%{$title}%'"] = null;
if ($province_id || $city_id || $county_id || $title) {
$total = $this->biz_model->count($where);
}
$total = $this->biz_model->count($where);
$lists = array();
if ($total) {
@@ -357,29 +288,4 @@ class Store extends HD_Controller
$this->data = array('total' => $total, 'list' => $lists);
return $this->show_json(SYS_CODE_SUCCESS);
}
public function add_money()
{
$id = intval($this->input->get_post('id'));
$biz = $this->biz_model->get(array('id' => $id, 'status>-1' => null));
if (!$biz) {
return $this->show_json(0, '门店不存在');
}
if ($this->input->method() == 'post') {
$money = $this->input->post('money');
if (!$money) {
return $this->show_json(SYS_CODE_FAIL, '请输入金额');
}
$bizAccount = new BizAccount();
$account = $bizAccount->getAccountBizId($id, true);
$sqlArr = $bizAccount->charge($account['id'], $money, '充值');
$result = trans_sql($sqlArr);
if (!$result) {
return $this->show_json(SYS_CODE_FAIL, '充值失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '充值成功');
}
$this->data['biz'] = $biz;
$this->show_view('biz/store/add_money');
}
}
+22 -253
View File
@@ -17,7 +17,7 @@ class Clues extends HD_Controller
$this->load->model('receiver/receiver_clues_cfrom_model', 'clues_cfrom_model');
$this->load->model('receiver/receiver_customers_model', 'customers_model');
$this->load->model('receiver/receiver_clue_oplogs_model', 'mdOplogs');
// $this->load->model('receiver/receiver_yx_model', 'mdReceiverXz');
$this->load->model('receiver/receiver_yx_model', 'mdReceiverXz');
// $this->load->model('app/licheb/app_licheb_users_model');
$this->load->model("biz/biz_model");
// $this->load->model('auto/auto_brand_model', 'mdAutoBrand');
@@ -27,11 +27,6 @@ class Clues extends HD_Controller
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_series_model');
$this->load->model('app/paic/app_paic_users_model');
$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';
}
@@ -48,9 +43,7 @@ class Clues extends HD_Controller
$cate = array();
$where = array("status" => $key);
if ($this->admin_biz_str) {
$where["belong_id in ($this->admin_biz_str)"] = null;
} else {
$this->belong && $where["belong_id"] = $this->belong;
$where["biz_id in ($this->admin_biz_str)"] = null;
}
$count1 = $this->clues_model->count($where);
if ($value['list']) {
@@ -77,8 +70,6 @@ class Clues extends HD_Controller
$this->data['statusList'] = $statusList;
$this->data['maintainAry'] = $this->maintainAry;
$this->data['export_button'] = $export_button;
$this->data['role'] = $this->role;
$this->data['levelList'] = Receiver_clues_model::LEVEL_LIST;
$this->data['_title'] = '线索池列表';
return $this->show_view('receiver/clues/lists', true);
}
@@ -101,9 +92,7 @@ class Clues extends HD_Controller
$where["{$params['search_tp']} like '%{$params['title']}%'"] = null;
}
if ($this->admin_biz_str) {
$where["belong_id in ($this->admin_biz_str)"] = null;
} else {
$params['belong_id'] && $where["belong_id"] = $params['belong_id'];
$where["biz_id in ($this->admin_biz_str)"] = null;
}
//创建时间
if ($params['c_time']) {
@@ -145,7 +134,6 @@ class Clues extends HD_Controller
$params['brand_id'] && $where['brand_id'] = $params['brand_id'];
$params['series_id'] && $where['series_id'] = $params['series_id'];
strlen($params['admin_id']) && $where['admin_id'] = $params['admin_id'];
$params['level'] && $where['level'] = $params['level'];
//门店筛选
if ($params['biz_id_admin']) {
@@ -165,13 +153,11 @@ class Clues extends HD_Controller
!$params['brand_id'] && $params['brand_id'] = 0;
!$params['series_id'] && $params['series_id'] = 0;
!strlen($params['admin_id']) && $params['admin_id'] = '';
$params['level'] && $params['level'] = '';
$count = $this->clues_model->count($where);
$lists = [];
if ($count) {
$fileds = 'id,name,mobile,brand_id,series_id,cf_id,cf2_id,c_time,admin_id,status,status2,en_time,
province_id,city_id,county_id,biz_id,p_time,u_time,rec_time,app_id';
$fileds = 'id,name,mobile,brand_id,series_id,cf_id,cf2_id,c_time,admin_id,status,status2,en_time,province_id,city_id,county_id,biz_id,p_time,u_time';
$rows = $this->clues_model->select($where, 'en_time desc,id desc', $page, $size, $fileds);
$map_admin = $map_cf_pid = $cf_title_arr = [];
@@ -268,13 +254,6 @@ class Clues extends HD_Controller
if ($val['p_time'] == '0000-00-00 00:00:00') {
$val['p_time'] = '';
}
$val['rec_time'] = $val['rec_time'] != '0000-00-00 00:00:00' ? $val['rec_time'] : '';
$is_unlock = '';
if ($val['app_id'] == Receiver_clues_model::APP_ID_ACTIVITY && $val['status'] == 1) {
$unlockCustomer = $this->customers_model->get(['rid' => $val['id'], 'un_lock' => Receiver_customers_model::LOCK_STATUS]);
$is_unlock = $unlockCustomer ? '已解锁' : '未解锁';
}
$val['is_unlock'] = $is_unlock;
$lists[] = $val;
}
}
@@ -282,6 +261,7 @@ class Clues extends HD_Controller
$adminLists = $this->sys_admin_model->select($where, 'id desc', 0, 0, 'id,username');
$this->data['adminLists'] = $adminLists;
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
return [$lists, $count];
}
@@ -313,7 +293,6 @@ class Clues extends HD_Controller
$info_show['c_time'] = date('Y-m-d H:i', $re['c_time']);
$info_show['en_time'] = $re['en_time'];
$info_show['mobile_sub'] = $re['mobile'];
$info_show['buy_time_cn'] = $re['buy_time'] ? Receiver_clues_model::BUY_TIME_LIST[$re['buy_time']] : '';
$resLogs = $this->mdOplogs->select(array('clue_id' => $id), 'c_time desc', 0, 0);
foreach ($resLogs as $key => $value) {
@@ -322,22 +301,21 @@ class Clues extends HD_Controller
$setValue['log'] = $value['log'];
$setValue['type_name'] = $this->mdOplogs->typeAry()[$value['type']];
$setValue['c_time'] = date('Y-m-d H:i', $value['c_time']);
list($rec_url, $rec_text) = $this->mdOplogs->getRecordUrl($value['id']);
// if ($value['type'] == 2) {//拨打电话
// $rec_text = '未接通';
// $row = $this->mdReceiverXz->get(array('id' => $value['log']));
// if ($row['duration']) {
// $rec_url = $row['rec_url'] ? build_qiniu_image_url($row['rec_url'], 0, 0, 'video') : '';
// $rec_text = '录音文件未生成';
// }
// }
$rec_url = $rec_text = '';
if ($value['type'] == 2) {//拨打电话
$rec_text = '未接通';
$row = $this->mdReceiverXz->get(array('id' => $value['log']));
if ($row['duration']) {
$rec_url = $row['rec_url'] ? build_qiniu_image_url($row['rec_url'], 0, 0, 'video') : '';
$rec_text = '录音文件未生成';
}
}
$setValue['rec_url'] = $rec_url;
$setValue['rec_text'] = $rec_text;
$logsList[] = $setValue;
}
$info_show['logsList'] = $logsList;
$dataInfo['rec_time'] = $dataInfo['rec_time'] == '0000-00-00 00:00:00' ? '' : $dataInfo['rec_time'];
//获取所在地区
$dataInfo['province_id'] = $re['province_id'];
$dataInfo['city_id'] = $re['city_id'];
@@ -350,25 +328,15 @@ class Clues extends HD_Controller
$dataInfo['county_id_admin'] = $biz ? $biz['county_id'] : 0;
$customer = $this->customers_model->get(array('rid' => $re['id'], 'biz_id' => $re['biz_id'], 'status >' => -1));
$dataInfo['customer_id'] = $customer['id'];
$dataInfo['cf_pid'] = $dataInfo['cf_pid'] ?: '';
$dataInfo['brand_id'] = $dataInfo['brand_id'] ?: '';
$map_cfrom = $this->clues_cfrom_model->map('id', 'title', array('status' => 1, 'pid' => 0, 'type' => 0), '', 0, 0, 'id, title');
$map_cfrom2 = $this->clues_cfrom_model->map('id', 'title', array('status' => 1, 'pid' => $params['cfrom_id']), '', 0, 0, 'id, title');
//已分配门店
$selectedBrands1 = [];
if ($dataInfo['app_id'] == Receiver_clues_model::APP_ID_ACTIVITY) {
$customerRows = $this->customers_model->select(['rid' => $re['id'], 'status >' => -1], '', '', '', 'biz_id');
$ids = implode(',', array_column($customerRows, 'biz_id'));
$ids && $selectedBrands1 = $this->biz_model->select(["id in ($ids)" => null, 'status' => 1], '', 0, 0, 'id as biz_id,biz_name as name');
}
$this->data['cfromAry'] = $map_cfrom;
$this->data['cfromAry2'] = $map_cfrom2;
$this->data['provinces'] = $this->province_ary();
$this->data['info'] = $dataInfo;
$this->data['info_show'] = $info_show;
$this->data['selectedBrands1'] = $selectedBrands1;
$this->data['buyTimeList'] = Receiver_clues_model::BUY_TIME_LIST;
$this->data['_title'] = '线索详情';
return $this->show_view('receiver/clues/edit', true);
}
@@ -427,7 +395,7 @@ class Clues extends HD_Controller
'mobile' => '',
'cf_id' => '',
'cf2_id' => '',
'province_id' => $this->limit_province_id,
'province_id' => 350000,
'city_id' => 0,
'county_id' => 0,
'biz_id' => 0,
@@ -445,10 +413,9 @@ class Clues extends HD_Controller
$this->data['info'] = $info;
$this->data['cfromAry'] = $map_cfrom;
$this->data['action'] = $action;
$this->data['limit_province_id'] = $this->limit_province_id;
$this->data['_title'] = $title;
return $this->show_view('receiver/clues/get', true);
return $this->show_view('receiver/clues/get',true);
}
//添加单条数据
@@ -482,7 +449,6 @@ class Clues extends HD_Controller
'brand_id' => $info['brand_id'],
'series_id' => $info['series_id'],
'admin_id' => $this->uid,
'belong_id' => $this->belong,
'c_time' => time(),
'en_time' => date('Y-m-d H:i:s'),
);
@@ -550,8 +516,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个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
ems_sms($v['mobile'], '您好,门店新增了1个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
b2m_send_sms($v['mobile'], '【理车宝】您好,门店新增了1个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
}
}
}
@@ -565,20 +530,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);
@@ -595,43 +546,16 @@ class Clues extends HD_Controller
if (!$params['log']) {
return $this->show_json(SYS_CODE_FAIL, '请输入内容!');
}
// if (strlen($params['buy_time'])) {
// $buy_time_cn = Receiver_clues_model::BUY_TIME_LIST[$params['buy_time']];
// $addData = array(
// 'clue_id' => $params['id'],
// 'uid' => $this->uid,
// 'uname' => $this->username,
// 'type' => intval($params['type']),
// 'log' => '修改意向购车周期为:' . $buy_time_cn,
// 'c_time' => time()
// );
// $this->mdOplogs->add($addData);
// $this->clues_model->update(['buy_time' => $params['buy_time']], ['id' => $params['id']]);
// }
$addData = array(
'clue_id' => $params['id'],
'uid' => $this->uid,
'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, '添加失败');
@@ -742,13 +666,6 @@ class Clues extends HD_Controller
$up['province_id'] = $info['province_id'];
$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['cf_id'] != $re['cf_id'] || $info['cf2_id'] != $re['cf2_id']) {
$log .= '更新客户来源 ';
@@ -764,11 +681,6 @@ class Clues extends HD_Controller
if ($info['cf_pid'] != $re['cf_pid']) {
$up['cf_pid'] = $info['cf_pid'];
}
if ($info['buy_time'] != $re['buy_time']) {
$log .= '修改意向购车周期为: ' . Receiver_clues_model::BUY_TIME_LIST[$info['buy_time']];
$up['buy_time'] = $info['buy_time'];
$up['level'] = Receiver_clues_model::LEVEL_LIST[$info['buy_time']] ?: Receiver_clues_model::LEVEL_DEFAULT;
}
$ret = $this->clues_model->update($up, array('id' => $info['id']));
if (!$ret) {
@@ -795,7 +707,7 @@ class Clues extends HD_Controller
'status2' => 1,
'p_time' => date('Y-m-d H:i:s'),
];
$info['rec_time'] && $up_data['rec_time'] = $info['rec_time'];
$ret = $this->clues_model->update($up_data, array('id' => $info['id']));
if (!$ret) {
$code = SYS_CODE_FAIL;
@@ -851,8 +763,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个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
ems_sms($v['mobile'], '您好,门店新增了1个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
b2m_send_sms($v['mobile'], '【理车宝】您好,门店新增了1个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
}
}
}
@@ -885,8 +796,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);
}
@@ -1248,7 +1158,6 @@ class Clues extends HD_Controller
'city_id' => $map_city[$v['city_name']] ? $map_city[$v['city_name']] : 0,
'county_id' => $map_county[$v['county_name']] ? $map_county[$v['county_name']] : 0,
'biz_id' => $map_biz[$v['biz_name']] ? $map_biz[$v['biz_name']] : 0,
'belong_id' => $this->belong,
'p_time' => $map_biz[$v['biz_name']] ? date('Y-m-d H:i:s') : 0,
);
$adds[] = $temp;
@@ -1314,144 +1223,4 @@ class Clues extends HD_Controller
return $this->show_view('receiver/clues/get_admin');
}
//派单到客户池
public function add_customer()
{
$this->load->helper("order");
$info = $this->input->post('info');
$bizList = $this->input->post('bizList');
if (!count($bizList)) {
return $this->show_json(SYS_CODE_FAIL, '请选择门店');
}
// if (!$info['rec_time']) {
// return $this->show_json(SYS_CODE_FAIL, '请选择回收时间');
// }
$re = $this->clues_model->get(array('id' => $info['id']));
if (!$re || empty($re)) {
return $this->show_json(SYS_CODE_FAIL, '线索不存在!');
}
foreach ($bizList as $item) {
$customers = $this->customers_model->get(array('rid' => $re['id'], 'status >' => -1, 'biz_id' => $item['biz_id']));
if ($customers) {
continue;
}
$biz = $this->biz_model->get(array('id' => $item['biz_id']));
//获取一条门店品牌
$bizBrand = $this->biz_car_brand_model->get(['biz_id' => $biz['id']]);
$add = array(
'rid' => $re['id'],
'cid' => create_customer_no($biz['county_id']),
'name' => $re['name'],
'province_id' => $biz['province_id'],
'city_id' => $biz['city_id'],
'county_id' => $biz['county_id'],
'mobile' => $re['mobile'],
'biz_id' => $item['biz_id'],
'level' => $re['level'],
'cf_title' => '数字营销中台',
'of_id' => $re['cf_id'],
'of2_id' => $re['cf2_id'],
'brand_id' => $re['brand_id'],
'series_id' => $re['series_id'],
'p_time' => date('Y-m-d H:i:s'),
'cont_time' => $re['cont_time'],
'cf_pid' => $re['cf_pid'],
'c_time' => $re['c_time'],
'rec_time' => $info['rec_time'] ?: date('Y-m-d H:i:s')
);
if ($re['app_id'] == Receiver_clues_model::APP_ID_ACTIVITY) {
$add['un_lock'] = Receiver_customers_model::UNLOCK_STATUS;
}
//获取用户留资记录与门店品牌对应数据
if ($bizBrand) {
$where = ['mobile' => $re['mobile'], 'brand_id' => $bizBrand['brand_id']];
$enrollRows = $this->receiver_enroll_model->select($where, 'id desc', 1, 1);
if ($enrollRows) {
$add['brand_id'] = $enrollRows[0]['brand_id'];
$add['series_id'] = $enrollRows[0]['series_id'];
}
}
$customers_id = $this->customers_model->add($add);
if (!$customers_id) {
continue;
}
// if ($biz['type'] == Biz_model::BIZ_TYPE_SPACE) {
// //解锁
// /** @var MyResponse $result */
// $result = $this->customers_model->unlock($customers_id, $biz['id'], false);
// }
//同步线索日志到客户日志
$this->load->library('receiver/customers_entity');
$this->customers_entity->syn_clues($customers_id, $re['id']);
//短信通知店长
$this->load->model('app/licheb/app_licheb_users_model');
$where = array('biz_id' => $biz['id'], 'status' => 1, 'group_id' => 2);
$res_u = $this->app_licheb_users_model->select($where);
if ($res_u) {
foreach ($res_u as $v) {
if ($re['biz_id'] != 1) {
// b2m_send_sms($v['mobile'], '【理车宝】您好,门店新增了1个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
ems_sms($v['mobile'], '您好,门店新增了1个客户线索,请及时到微信小程序"理车宝”进行查看。');
debug_log("[info]:发短信到{$v['mobile']},线索派单", 'send_sms.txt', $this->log_dir);
}
}
}
}
$this->clues_model->update(['rec_time' => $info['rec_time'], 'p_time' => date('Y-m-d H:i:s')], ['id' => $re['id']]);
return $this->show_json(SYS_CODE_SUCCESS, '修改成功');
}
/**
* 删除客户派单
* @return bool
*/
public function edit_customer()
{
$info = $this->input->post('info');
$bizId = $this->input->post('bizId');
if (!$bizId) {
return $this->show_json(SYS_CODE_FAIL, '请选择门店');
}
$re = $this->clues_model->get(array('id' => $info['id']));
if (!$re || empty($re)) {
return $this->show_json(SYS_CODE_FAIL, '线索不存在!');
}
$this->customers_model->update(array('status' => -1), ['rid' => $re['id'], 'biz_id' => $bizId]);
return $this->show_json(SYS_CODE_SUCCESS, '修改成功');
}
public function lists_enroll()
{
$params = $this->input->get();
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
$list = [];
$id = intval($params['id']);
$clues = $this->clues_model->get(['id' => $id]);
if (!$clues) {
return $this->show_json(SYS_CODE_FAIL, '线索不存在!');
}
$where = ['mobile' => $clues['mobile']];
$count = $this->receiver_enroll_model->count($where);
if ($count) {
$rows = $this->receiver_enroll_model->select($where, 'id desc', $page, $size);
$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'));
foreach ($rows as $key => $value) {
$setValue = $value;
$setValue['mobile'] = $value['mobile'];
$setValue['c_time'] = date('Y-m-d H:i:s');
$brandName = $brands[$value['brand_id']] ? $brands[$value['brand_id']][0]['name'] : '';
$seriesName = $series[$value['series_id']] ? $series[$value['series_id']][0]['name'] : '';
$cfRow = $this->clues_cfrom_model->get(['id' => $value['cf2_id']]);
$cfrom2 = $cfRow['title'] ?: '';
$setValue['brandName'] = "{$brandName} {$seriesName}";
$setValue['cfrom2'] = $cfrom2;
$list[] = $setValue;
}
}
$this->data['list'] = $list;
$this->data['count'] = $count;
return $this->show_json(SYS_CODE_SUCCESS);
}
}
+27 -33
View File
@@ -10,7 +10,7 @@ defined('BASEPATH') or exit('No direct script access allowed');
class Customer extends HD_Controller
{
private $searchTpAry = array('mobile' => '客户手机号', 'cid' => '客户编号');
private $searchTimeAry = array('unlock_time' => '解锁时间', 'p_time' => '派单/建档时间', 'cont_time' => '最后联系时间', 'dt_time' => '首次到店时间', 'order_time' => '下定时间', 'def_time' => '战败时间', 'c_time' => '创建时间');
private $searchTimeAry = array('p_time' => '派单/建档时间', 'cont_time' => '最后联系时间', 'dt_time' => '首次到店时间', 'order_time' => '下定时间', 'def_time' => '战败时间', 'c_time' => '创建时间',);
protected $log_dir;
@@ -56,7 +56,7 @@ class Customer extends HD_Controller
//$wxqyAry = $this->customers_model->wxqyAry();
$wxgrAry = $this->customers_model->wxgrAry();
if ($count) {
$fileds = 'id,rid,cid,name,mobile,cf_title,p_time,cont_time,admin_id,status,biz_id,level,of_id,of2_id,wxgr,c_time,county_id,brand_id,series_id,un_lock';
$fileds = 'id,cid,name,mobile,cf_title,p_time,cont_time,admin_id,status,biz_id,level,of_id,of2_id,wxgr,c_time,county_id,brand_id,series_id';
$rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds);
//获取车管家
$admin_id_arr = array_unique(array_column($rows, 'admin_id'));
@@ -107,11 +107,7 @@ class Customer extends HD_Controller
if ($brands[$val['brand_id']]) {
$brand_detail .= '-' . $series[$val['series_id']][0]['name'];
}
$clues = $this->clues_model->get(['id' => $val['rid']]);
$is_unlock = '';
if ($clues['app_id'] == Receiver_clues_model::APP_ID_ACTIVITY) {
$is_unlock = Receiver_customers_model::LOCK_LIST[$val['un_lock']];
}
$lists[] = array(
'id' => $val['id'],
'cid' => $val['cid'],
@@ -131,7 +127,6 @@ class Customer extends HD_Controller
'c_time' => $val['c_time'] != '0' ? date('Y-m-d H:i:s', $val['c_time']) : '',
'p_time' => $val['p_time'],
'cont_time' => $val['cont_time'] != '0000-00-00 00:00:00' ? $val['cont_time'] : '',
'is_unlock' => $is_unlock
);
}
}
@@ -464,7 +459,7 @@ class Customer extends HD_Controller
$where["biz_id in(select id from lc_biz where type={$params['biz_type']})"] = null;
}
if ($params['cid']) {
$where["{$params['search_tp']} like '%{$params['cid']}%'"] = null;
$where["{$params['search_tp']} like '{$params['cid']}'"] = null;
}
if ($params['level']) {
$where['level'] = $params['level'];
@@ -560,11 +555,6 @@ class Customer extends HD_Controller
$order_time[0] && $where["def_time >="] = $order_time[0] . ' 00:00:00';
$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';
}
if ($params['tags']) {
$where = $this->tagWhere($where, $params['tags']);
@@ -582,8 +572,6 @@ class Customer extends HD_Controller
}
if ($this->admin_biz_str) {
$where["biz_id in ($this->admin_biz_str)"] = null;
} else {
$this->belong && $where["biz_id in(select id from lc_biz where province_id=" . $this->limit_province_id . ")"] = null;
}
return $where;
}
@@ -686,7 +674,23 @@ class Customer extends HD_Controller
//操作日志
$logs = array();
foreach ($rows_log as $key => $value) {
list($rec_url, $rec_text) = $this->customer_oplogs_model->getRecordUrl($value['id']);
$rec_text = $rec_url = '';
if ($value['type'] == 2) {
$record = '';
if ($value['sub_type'] == Receiver_customer_oplogs_model::SUB_TYPE_XZ) {
$rec_row = $this->receiver_xz_model->get(['id' => $value['log']], 'rec_url,duration');
$rec_row['rec_url'] && $record = $rec_row['rec_url'];
} else {
$rec_row = $this->receiver_yx_model->get(['id' => $value['log']], 'rec_url,duration');
$rec_row['rec_url'] && $record = get_yx_video($rec_row['rec_url']);
}
if ($rec_row['duration']) {
$record && $rec_url = $record;
!$rec_row['rec_url'] && $rec_text = '录音暂未生成';
} else {
$rec_text = '未接通';
}
}
$imgs = [];
if ($value['imgs']) {
$json_imgs = json_decode($value['imgs'], true);
@@ -960,15 +964,12 @@ class Customer extends HD_Controller
'status_name' => '客户状态',
'city_name' => '所在城市',
'county_name' => '所在地区',
'is_unlock' => '是否解锁',
'unlock_time' => '解锁时间',
// 'to_send' => '是否改派',
'to_send' => '是否改派',
'c_time' => '建档时间',
"p_time" => "派单时间",
"sales_p_time" => "分配时间",
"dt_time" => "到店时间",
"order_time" => "下单时间",
"u_time" => "最后操作时间",
"cont_time" => "最后联系时间",
"of_title_1" => "来源1",
"of_title_2" => "来源2",
"biz_name" => "归属门店",
@@ -984,7 +985,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, if(order_time>0, order_time,'') as order_time, if(cont_time>0, cont_time,'') as cont_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";
$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'));
@@ -1002,11 +1003,7 @@ class Customer extends HD_Controller
$brand_detail = $brands[$val['brand_id']][0]['name'];
$series_detail = $series[$val['series_id']][0]['name'];
}
$clues = $this->clues_model->get(['id' => $val['rid']]);
$is_unlock = '';
if ($clues['app_id'] == Receiver_clues_model::APP_ID_ACTIVITY) {
$is_unlock = Receiver_customers_model::LOCK_LIST[$val['un_lock']];
}
$id = $val['id'];
$row = array(
'id' => $id,
@@ -1019,10 +1016,9 @@ class Customer extends HD_Controller
'to_send' => $this->customers_model->csbizidAry($val['cs_biz_id'] ? $val['cs_biz_id'] : 0),
'c_time' => $val['c_time'],
'dt_time' => $val['dt_time'],
'sales_p_time' => $val['sales_p_time'],
'p_time' => $val['p_time'],
'order_time' => $val['order_time'],
'u_time' => $val['u_time'],
'cont_time' => $val['cont_time'],
'of_title_1' => $of_title_1,
'of_title_2' => $of_title_2,
'biz_name' => $val['biz_name'],
@@ -1030,8 +1026,6 @@ 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'] : '',
);
if ($params['export_tag']) {
@@ -1253,7 +1247,7 @@ class Customer extends HD_Controller
$mobile = $params['mobile'];
if (!$mobile) {
return '';
} elseif (in_array($params['of_id'], [1, 2]) && $this->role != 1) {
} elseif (in_array($params['of_id'], [1, 2]) && $this->role == 8) {
return mobile_asterisk($mobile);
} else {
return $mobile;
+9 -9
View File
@@ -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;
-107
View File
@@ -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, '保存成功');
}
}
-107
View File
@@ -1,107 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Vlog extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('biz/biz_visit_log_model');
$this->load->model('biz/biz_model');
$this->load->model("sys/sys_admin_model");
$this->load->model('app/licheb/app_licheb_users_model', 'app_user_model');
}
public function index()
{
$typeAry = $this->biz_model->type_ary();
$this->data['typeAry'] = $typeAry;
return $this->lists();
}
public function lists()
{
$params = $this->input->get();
$page = $this->input->get('page');
!$page && $page = 1;
$pageSize = 20;
$where = [];
if ($params['user_name']) {
$uids = 0;
$userList = $this->app_user_model->select(["uname like '%{$params['user_name']}%'" => null], '', '', '', 'id,uname');
if ($userList) {
$uids = implode(',', array_column($userList, 'id'));
}
$where["uid in ($uids)"] = null;
}
if ($params['biz_name']) {
$bizs = 0;
$bizList = $this->biz_model->select(["biz_name like '%{$params['biz_name']}%'" => null], '', '', '', 'id,biz_name');
if ($bizList) {
$bizs = implode(',', array_column($bizList, 'id'));
}
$where["biz_id in ($bizs)"] = null;
}
if ($params['type']) {
$type = intval($params['type']);
$where["biz_id in (select id from lc_biz where type={$type})"] = null;
}
if ($params['c_time']) {
$c_time = explode(' ~ ', $params['c_time']);
$c_time[0] && $where["createTime >="] = $c_time[0] . ' 00:00:00';
$c_time[1] && $where["createTime <="] = $c_time[1] . ' 23:59:59';
}
$rows = $this->biz_visit_log_model->select($where, 'id desc', $page, $pageSize);
$count = $this->biz_visit_log_model->count($where);
$list = [];
if ($rows) {
$bizIds = implode(',', array_unique(array_column($rows, 'biz_id')));
!$bizIds && $bizIds = 0;
$bizs = $this->biz_model->map('id', 'biz_name', ["id in ({$bizIds})" => null]);
$userIds = implode(',', array_unique(array_column($rows, 'uid')));
!$userIds && $userIds = 0;
$users = $this->app_user_model->map('id', 'uname', ["id in ({$userIds})" => null]);
foreach ($rows as $v) {
$v['url'] = explode('?', $v['url'])[0];
$v['biz_name'] = $bizs[$v['biz_id']] ?: '';
$v['username'] = $users[$v['uid']] ?: '';
$list[] = $v;
}
}
$this->data['params'] = $params;
$this->data['lists'] = $list;
$this->data['_title'] = '小程序访问日志';
$this->data['pager'] = array('count' => ceil($count / $pageSize), 'curr' => $page, 'totle' => $count);
$this->show_view('sys/vlog/lists', true);
}
public function add()
{
}
public function get()
{
}
public function edit()
{
}
public function batch()
{
}
public function export()
{
}
public function del()
{
}
}
+2 -15
View File
@@ -3,7 +3,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class Admin extends HD_Controller {
public function __construct()
public function __construct()
{
parent::__construct();
$this->load->model('sys/Sys_admin_model','sysAdmin');
@@ -24,7 +24,6 @@ class Admin extends HD_Controller {
$mobile = $this->input->get('mobile');
$status = $this->input->get('status');
$role_id = $this->input->get('role_id');
$belong_id = $this->input->get('belong_id');
$page = $this->input->get('page') ? $this->input->get('page') : 1;
$status = $status === null ? 1 : $status;
if(!empty($username)) $where["username like '%$username%'"] = null;
@@ -38,9 +37,7 @@ class Admin extends HD_Controller {
foreach ($data as $key => $value) {
$data[$key]['role'] = $role[$value['role_id']]['name'];
}
$this->data['role'] = $role;
$this->data['belong_id'] = $belong_id;
$this->data['role_id'] = $role_id;
$this->data['pager'] = ['count' => ceil($count/$size),'curr' => $page,'totle' => $count];
$this->data['lists'] = $data;
@@ -89,16 +86,14 @@ class Admin extends HD_Controller {
//获取已选门店
if($json['biz_id']){
$ids = implode(',',$json['biz_id']);
$where = [
$where = [
"id in ($ids)" => null
];
$this->data['selectBiz'] = $this->biz_model->select($where,'','','','id,biz_name as title');
}
$this->data['username'] = $data['username'];
$this->data['role_id'] = $data['role_id'];
$this->data['belong_id'] = $json['belong_id'];
$this->data['mobile'] = $data['mobile'];
$this->data['kf_mobile'] = $data['kf_mobile'];
$this->data['id'] = $id;
$this->load->vars('url','edit');
$this->show_view('/sys/admin/edit');
@@ -142,7 +137,6 @@ class Admin extends HD_Controller {
$input = $this->_get_input();
$other_json = [];
$input['biz_id'] && $other_json['biz_id'] = $input['biz_id'];
$input['belong_id'] && $other_json['belong_id'] = $input['belong_id'];
$insert = [
'username' => $input['username'],
'mobile' => $input['mobile'],
@@ -150,7 +144,6 @@ class Admin extends HD_Controller {
'other_json' => json_encode($other_json,JSON_UNESCAPED_UNICODE),
'password' => password_hash($input['password1'],PASSWORD_BCRYPT),
'c_time' => time(),
'kf_mobile' => $input['kf_mobile'],
];
$this->sysAdmin->add($insert);
return $this->show_json(SYS_CODE_SUCCESS,'新增成功!');
@@ -167,13 +160,11 @@ class Admin extends HD_Controller {
$input = $this->_get_input();
$other_json = [];
$input['biz_id'] && $other_json['biz_id'] = $input['biz_id'];
$input['belong_id'] && $other_json['belong_id'] = $input['belong_id'];
$upd = [
'username' => $input['username'],
'mobile' => $input['mobile'],
'role_id' => $input['role'],
'other_json' => json_encode($other_json,JSON_UNESCAPED_UNICODE),
'kf_mobile' => $input['kf_mobile'],
];
if($this->sysAdmin->update($upd,['id' => $input['id']])) {
return $this->show_json(SYS_CODE_SUCCESS,'修改成功!');
@@ -205,8 +196,6 @@ class Admin extends HD_Controller {
private function _get_info()
{
$data['role'] = $this->sysRole->select(['status' => '1'],'','','','id,name');
$data['belong'] = $this->biz_model->select(['status' => 1, 'type' => 1],'','','','id,biz_name');
return $data;
}
@@ -261,10 +250,8 @@ class Admin extends HD_Controller {
'id' => $this->input->post('id'),
'username' => trim($this->input->post('username')),
'mobile' => trim($this->input->post('mobile')),
'kf_mobile' => trim($this->input->post('kf_mobile')),
'status' => $this->input->post('status'),
'role' => $this->input->post('role'),
'belong_id' => $this->input->post('belong_id'),
'password1' => trim($this->input->post('password1')),
'password2' => trim($this->input->post('password2')),
'biz_id' => $this->input->post('biz_id'),
-90
View File
@@ -1,90 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Callconfig extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('sys/sys_config_model', 'confModel');
}
public function index()
{
return $this->get();
}
public function lists()
{
}
public function get()
{
$row = $this->confModel->get(array('k' => Sys_config_model::CALL_CONFIG_KEY));
if (!$row) {
$addData = array(
'k' => Sys_config_model::CALL_CONFIG_KEY,
'v' => json_encode([], JSON_UNESCAPED_UNICODE),
'c_time' => time(),
);
$id = $this->confModel->add($addData);
if (!is_numeric($id)) {
$this->show_json(SYS_CODE_FAIL, '添加失败');
}
$row = $addData;
$row['id'] = $id;
}
$this->data['id'] = $row['id'];
$this->data['row'] = json_decode($row['v'], true);
$this->data['_title'] = '外呼配置';
$this->show_view('sys/site/callConfig/edit', true);
}
public function add()
{
}
public function edit()
{
$input = $this->input->post();
$row = $this->confModel->get(array('id' => $input['id']));
if (!$row) {
return $this->show_json(SYS_CODE_FAIL, '提交错误');
}
$callTime = intval($input['callTime']);
$callbackTime = intval($input['callbackTime']);
if (!$callTime || $callbackTime <= 0) {
return $this->show_json(SYS_CODE_FAIL, '请输入正确的外呼绑定时长');
}
if (!$callbackTime || $callbackTime <= 0) {
return $this->show_json(SYS_CODE_FAIL, '请输入正确的回拨绑定时长');
}
$jsonData = json_decode($row['v'], true);
$jsonData['callBackPhoneNo'] = $input['callBackPhoneNo'] ?: '';
$jsonData['callTime'] = $callTime;
$jsonData['callbackTime'] = $callbackTime;
$re = $this->confModel->update(array('v' => json_encode($jsonData, JSON_UNESCAPED_UNICODE)), array('id' => $input['id']));
if ($re) {
return $this->show_json(SYS_CODE_SUCCESS, '编辑成功');
} else {
return $this->show_json(SYS_CODE_FAIL, '编辑失败');
}
}
public function del()
{
}
public function batch()
{
}
public function export()
{
}
}
-68
View File
@@ -1,68 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Wss extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('ws/ws_conn_model');
$this->load->model('sys/sys_notice_model');
}
public function index()
{
$this->data['platformList'] = Sys_notice_model::PLATFORM_LIST;
$this->data['_title'] = '消息推送工具';
$this->show_view('sys/utils/wss/index', true);
}
public function lists()
{
}
public function add()
{
$info = $this->input->post();
if (!$info['uid'] || !$info['content'] || !$info['platform']) {
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
$params = [
'platform' => $info['platform'],
'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);
if (!$req->isSuccess()) {
return $this->show_json(SYS_CODE_FAIL, $req->getMessage());
}
return $this->show_json(SYS_CODE_SUCCESS, '发送成功');
}
public function get()
{
}
public function edit()
{
}
public function batch()
{
}
public function export()
{
}
public function del()
{
}
}
+3 -9
View File
@@ -10,17 +10,14 @@ defined('BASEPATH') or exit('No direct script access allowed');
abstract class HD_Controller extends CI_Controller
{
public $uid, $user_name, $role, $admin_biz, $admin_biz_str, $limit_province_id;
public $uid, $user_name, $role, $admin_biz, $admin_biz_str;
public $data = array(), $if_ajax = false;
//开发城省份 湖南 福建
public $city_lists = array(
'350000' => ['id' => '350000', 'name' => '福建省'],
'430000' => ['id' => '430000', 'name' => '湖南省'],
'520000' => ['id' => '520000', 'name' => '贵州省'],
'460000' => ['id' => '460000', 'name' => '海南省'],
'440000' => ['id' => '440000', 'name' => '广东省'],
'350000' => ['id' => '350000', 'name' => '福建省'],
);
public function __construct()
@@ -138,15 +135,12 @@ abstract class HD_Controller extends CI_Controller
*/
protected function province_ary()
{
$this->load->model("sys/area_model", 'area_model');
$area_where = [];
$citys = array_column($this->city_lists, 'id');
if ($citys) {
$this->load->model("sys/area_model", 'area_model');
$area_where["province_id in (" . implode(",", $citys) . ")"] = null;
}
if($this->limit_province_id){
$area_where["province_id"] = $this->limit_province_id;
}
return $this->area_model->select($area_where, '', 0, 0, 'distinct(province_id), province_name');
}
}
-14
View File
@@ -35,9 +35,6 @@ class Auth
$CI->load->model('sys/sys_role_model');
$CI->load->model('sys/sys_city_model');
$CI->load->model('Area_model');
$CI->load->model("biz/biz_model");
$CI->load->model('ws/ws_conn_model');
$CI->load->config('wss');
if ($user_info = json_decode($user_info, true)) {
//登录ip判断
@@ -237,18 +234,7 @@ class Auth
$CI->role = $admin_user ? $admin_user['role_id'] : 0;
$other_json = $admin_user['other_json'] ? json_decode($admin_user['other_json'], true) : [];
$CI->admin_biz = $other_json['biz_id'] ? $other_json['biz_id'] : [];
$CI->belong = $other_json['belong_id'] ? $other_json['belong_id'] : 0;
$CI->admin_biz_str = $CI->admin_biz ? implode(',', $CI->admin_biz) : '';
$CI->limit_province_id = 0;
if ($CI->belong) {
$biz = $CI->biz_model->get(['id' => $other_json['belong_id']], 'province_id');
$CI->limit_province_id = $biz['province_id'];
}
$wss_url = $CI->config->item('url');
$wss_token = generateToken($CI->uid, 'jwt_key_system');
$wss_platform = Ws_conn_model::PLAT_FORM_ADMIN;
$CI->data['wss_url'] = "{$wss_url}?token={$wss_token}&platform={$wss_platform}";
} elseif ($ctrl != 'login') {
header('location:/login');
}
+18 -6
View File
@@ -25,6 +25,17 @@
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w80">分发状态:</label>
<div class="am-para-inline w100">
<select name="dis_status">
<option value=''>请选择</option>
<option value='0' <?php if($params['dis_status'] == '0'){?> selected="selected" <?php }?> >未分发</option>
<option value='1' <?php if($params['dis_status'] == '1'){?> selected="selected" <?php }?> >分发成功</option>
<option value='2' <?php if($params['dis_status'] == '2'){?> selected="selected" <?php }?> >分发失败</option>
</select>
</div>
</div>
<div class="fl" style="width:1920px">
<label class="am-para-label w100">线索来源:</label>
<div class="am-form-group am-para-inline w150">
@@ -111,7 +122,7 @@
</div>
</div>
</div>
<div class="am-form-group fl" style="margin-bottom: 0px;">
<div-- class="am-form-group fl" style="margin-bottom: 0px;">
<div class="am-form-group fl ml30">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
@@ -121,11 +132,11 @@
<div class="am-form-group fl ml10">
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="reset">重置</button>
</div>
<div class="am-form-group fl ml10">
<!--div class="am-form-group fl ml10">
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="export_out"
title="最多500条" v-if="export_button">导出
</button>
</div>
</div-->
<div class="am-form-group fl ml10">
<button type="button" class="am-btn am-btn-success am-btn-sm w150" @click="push_search">按搜索结果上传</button>
</div>
@@ -144,6 +155,7 @@
<th width="15%"><span>线索来源</span></th>
<th width="15%"><span>线索渠道</span></th>
<th width="10%"><span>上传状态</span></th>
<th width="10%"><span>分发状态</span></th>
<th width="15%"><span>上传时间</span></th>
</tr>
</thead>
@@ -159,6 +171,7 @@
<td style="vertical-align: middle;"><?= $v['cf_title'] ?></td>
<td style="vertical-align: middle;"><?= $v['channel'] ?></td>
<td style="vertical-align: middle;"><?= $v['push_status'] ?></td>
<td style="vertical-align: middle;"><?= $v['dis_status'] ?></td>
<td style="vertical-align: middle;"><?=$v['c_time']?></td>
</tr>
<? }
@@ -255,7 +268,7 @@
},
init_cfrom2: function () {
var vm = this;
$.post('autohome/customer/json_map_cfrom', {pid: vm.cfrom_id}, function (response) {
$.get('autohome/customer/json_map_cfrom', {pid: vm.cfrom_id}, function (response) {
if (response.code == 1) {
vm.cfromAry2 = response.data;
}
@@ -287,7 +300,7 @@
return false;
}
let href = $.menu.parseUri(window.location.href);
href = href.replace("customer?", "customer/export?");
href = href.replace("clues?", "clues/export?");
window.location.href = href;
},
push_search: function (){
@@ -302,7 +315,6 @@
$.get('autohome/customer/push_search', paramsObj, function (response) {
if (response.code == 1) {
layer.msg('上传成功:'+ response.data.succ+' '+'上传失败:' + response.data.fail+' '+'未处理:' + response.data.undo);
window.location.reload();
}
});
}
-18
View File
@@ -1,18 +0,0 @@
<form class="am-form am-form-horizontal" action="/biz/store/store/add_money" data-auto="true" method="post" style="width: 90%;padding:25px 30px 20px 0;margin: 0 auto">
<div class="am-form-group">
<label class="am-para-label"><span class="com-must-star">*</span>门店:</label>
<div class="am-para-input">
<span style="line-height: 37px"><?=$biz['biz_name'];?></span>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">充值金额:</label>
<div class="am-para-input">
<input type="number" placeholder="请输入金额" name="money" value=""/>
</div>
</div>
<input type="hidden" name="id" value="<?=$biz['id']?>">
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input"><button class="am-btn am-btn-secondary" type="submit">提交</button></div>
</div>
</form>
+10 -78
View File
@@ -135,15 +135,14 @@
<div class="am-form-group">
<label class="am-para-label">门店:</label>
<div class="am-para-input"><input type="text" placeholder="(最多 30 个字符)" name="biz_name"
v-model="info.biz_name"/></div>
value="<?= $biz['biz_name'] ?>"/></div>
</div>
<div class="am-form-group">
<label class="am-para-label">门店地址:</label>
<div class="am-para-input">
<div class="am-form-inline">
<div class="am-form-group">
<select name="province_id" v-model="info.province_id" style="width: 200px;"
data-toggle="next-select"
<select name="province_id" style="width: 200px;" data-toggle="next-select"
data-refurl="/common/area?key=city&id={value}&url=edit" data-next="#bd-hd-city">
<option value="0">省份</option>
<?php if ($provinces) {
@@ -155,8 +154,7 @@
</select>
</div>
<div class="am-form-group">
<select id="bd-hd-city" name="city_id" v-model="info.city_id" style="width: 200px;"
data-toggle="next-select"
<select id="bd-hd-city" name="city_id" style="width: 200px;" data-toggle="next-select"
data-refurl="/common/area?key=county&id={value}" data-next="#bd-hd-county">
<option value="0">城市</option>
<?php if ($citys) {
@@ -170,7 +168,7 @@
<div class="am-form-group">
<!--<select id="bd-hd-county" name="county_id" style="width: 200px;" data-toggle="next-select"-->
<!-- data-refurl="/common/area?key=street&id={value}" data-next="#bd-hd-street">-->
<select id="bd-hd-county" name="county_id" v-model="info.county_id" style="width: 200px;">
<select id="bd-hd-county" name="county_id" style="width: 200px;">
<option value="0">行政区</option>
<?php if ($countys) {
foreach ($countys as $value) { ?>
@@ -181,7 +179,7 @@
</select>
</div>
<div class="am-form-group" style="display: none">
<select id="bd-hd-street" name="street_id" v-model="info.street_id" style="width: 200px;">
<select id="bd-hd-street" name="street_id" style="width: 200px;">
<option value="0">街道/乡镇</option>
<?php if ($street) {
foreach ($street as $value) { ?>
@@ -192,7 +190,7 @@
</select>
</div>
<div class="am-form-group" style="display: none">
<select name="area_id" style="width: 200px;" v-model="info.area_id" id="bd-hd-area">
<select name="area_id" style="width: 200px;" id="bd-hd-area">
<option value="0">商圈</option>
<?php if ($areas) {
foreach ($areas as $value) { ?>
@@ -209,7 +207,7 @@
<div class="am-para-input">
<div class="am-input-group am-input-group-primary">
<input type="text" placeholder="详细地址" id="address" name="address"
v-model="info.address"/>
value="<?= $biz['address'] ?>"/>
<span class="am-input-group-btn">
<button id="addr-btn" class="am-btn am-btn-primary" type="button"><span
class="am-icon-search"></span></button>
@@ -253,7 +251,7 @@
<input type="hidden" name="headimg"
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
value="<?= $biz['headimg'] ?>" class="layui-input" id="biz_headimg">
value="<?= $biz['headimg'] ?>" class="layui-input">
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
src="<?= $biz['avatar'] ?>"/>
</div>
@@ -268,32 +266,9 @@
</select>
</div>
</div>
<template v-if="info.type==5">
<div class="am-form-group">
<label class="am-para-label">车型品牌:</label>
<div class="am-para-input wp40">
<el-select name="car_brand_ids" style="width: 100%" v-model="info.car_brand_ids"
placeholder="请选择" filterable clearable multiple sear>
<el-option
v-for="(v,i) in auto_brands"
:key="v.id"
:label="v.name"
:value="v.id">
</el-option>
</el-select>
<!--
<select name="car_brand_id" v-model="info.car_brand_id">
<option v-for="(v,i) in auto_brands" :value="v.id">
{{v.name}}
</option>
</select>
-->
</div>
</div>
</template>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<button class="am-btn am-btn-success" type="button" @click="submit">提交</button>
<button class="am-btn am-btn-success" type="submit">提交</button>
</div>
</div>
</form>
@@ -391,53 +366,10 @@
cate_id: <?=$biz['cate_id'] ? $biz['cate_id'] : "''"?>,
info: <?=json_encode($biz)?>,
typeAry: <?=json_encode($typeAry)?>,
auto_brands: []
},
mounted: function () {
this.init_auto_brands();
},
methods: {
init_auto_brands: function () {
var vm = this;
$.ajax({
url: '/common/brands',
type: 'post',
dataType: 'json',
data: {status: 1, size: 1000},
beforeSend: function () {
},
success: function (data) {
if (1 == data.code) {
vm.auto_brands = data.data.itemsList;
}
},
complete: function () {
loading = 0;
layer.closeAll('loading');
}
});
},
submit() {
let vm = this;
let url = '/biz/store/store/edit';
if (!this.info.id) {
url = '/biz/store/store/add'
}
vm.info.headimg = $('#biz_headimg').val();
vm.info.lng = $("#biz-edit-lng").val();
vm.info.lat = $("#biz-edit-lat").val();
console.log(vm.info)
$.post(url, vm.info, function (result) {
if (result.code) {
layer.msg(result.msg, {time: 2000, icon: 1}, function () {
$.form.reload();
});
} else {
layer.msg(result.msg, {icon: 2});
}
}, 'json')
}
},
methods: {},
created: function () {
},
watch: {}
+31 -57
View File
@@ -48,18 +48,6 @@
</select>
</div>
</div>
<div class="am-form-group fl" :style="'visibility: '+ [type==5? '' : 'hidden']">
<label class="am-para-label w100">品牌:</label>
<div class="am-form-group am-para-inline w150">
<select class="selectpicker" name="brand_id" v-model="brand_id" data-live-search="true">
<option value="0">所有品牌</option>
<? foreach ($brandAry as $v) { ?>
<option value="<?= $v['id'] ?>"><?= $v['name'] ?></option>
<? } ?>
</select>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">创建时间:</label>
@@ -76,20 +64,14 @@
</div>
</div>
</div>
<div class="am-form-group">
<div class="am-form-group fl ml20">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
<button type="button" data-open="/biz/store/store/get" class="am-btn am-btn-success am-btn-sm w100">
新增
</button>
</div>
<!--
<div class="am-form-group fl ml20">
<button type="button" data-open="/biz/store/store/get" class="am-btn am-btn-success am-btn-sm w100">
新增
</button>
</div>
-->
</div>
</form>
<div class="coms-table-bd">
@@ -100,8 +82,6 @@
<th width="50"></th>
<th width="5%"><span>ID</span></th>
<th><span>门店</span></th>
<th width="10%"><span>品牌</span></th>
<td width="10%">余额</td>
<th width="10%"><span>门店类型</span></th>
<th width="15%"><span>创建时间</span></th>
<th width="20%"><span>操作</span></th>
@@ -115,13 +95,9 @@
</td>
<td><?= $v['id'] ?></td>
<td><?= $v['biz_name'] ?></td>
<td><?= $v['brand_name'] ?></td>
<td><?= $v['money_left'] ?></td>
<td><?= $v['biz_type'] ?></td>
<td><?= $v['c_time'] ?></td>
<td>
<a data-modal="/biz/store/store/add_money?id=<?= $v['id'] ?>"
class="am-btn am-btn-primary am-btn-xs">充值</a>
<a data-open="/biz/store/store/get?id=<?= $v['id'] ?>" class="am-btn am-btn-primary am-btn-xs">修改</a>
<input type="hidden" class="biz-id-<?= $v['id'] ?>" name="id" value="<?= $v['id'] ?>" checked>
<select data-update-group="" data-list-target=".biz-id-<?= $v['id'] ?>"
@@ -211,41 +187,9 @@
</div>
</div>
<script>
require(['laydate', 'autocomplete', 'bootstrap-select'], function (laydate) {
laydate.render({
elem: '#id-create-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', nowDate = new Date();
var beginDate = '', endDate = '';
switch (type) {
case 'today':
beginDate = endDate = nowDate.Format('yyyy-MM-dd');
break;
case 'yesterday':
beginDate = endDate = (new Date(nowDate.getTime() - 86400000)).Format('yyyy-MM-dd');
break;
case 'weeks':
nowDate.setDate(nowDate.getDate() - nowDate.getDay() + 1);
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
nowDate.setDate(nowDate.getDate() + 6);
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
break;
case 'month':
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-01";
var day = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, 0);
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + day.getDate();
break;
}
date = beginDate + ' ~ ' + endDate;
$('#id-create-time').val(date);
});
$('.selectpicker').selectpicker();
});
var vm = new Vue({
el: '#vue-app',
data: {
brand_id: <?=$params['brand_id'] ? $params['brand_id'] : 0?>,
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?>,
@@ -428,6 +372,36 @@
}
}
});
require(['laydate', 'autocomplete'], function (laydate) {
laydate.render({
elem: '#id-create-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', nowDate = new Date();
var beginDate = '', endDate = '';
switch (type) {
case 'today':
beginDate = endDate = nowDate.Format('yyyy-MM-dd');
break;
case 'yesterday':
beginDate = endDate = (new Date(nowDate.getTime() - 86400000)).Format('yyyy-MM-dd');
break;
case 'weeks':
nowDate.setDate(nowDate.getDate() - nowDate.getDay() + 1);
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
nowDate.setDate(nowDate.getDate() + 6);
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
break;
case 'month':
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-01";
var day = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, 0);
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + day.getDate();
break;
}
date = beginDate + ' ~ ' + endDate;
$('#id-create-time').val(date);
});
});
$(function () {
<?php page_script($pager) ?>
});
+88 -327
View File
@@ -25,7 +25,7 @@
<script type="text/javascript" src="/static/js/plugin/bootstrap-select/popper.min.js"></script>
<script type="text/javascript" src="/static/js/common/jquery-3.0.0.js"></script>
<script type="text/javascript" src="/static/js/common/vue.min.js"></script>
<script type="text/javascript" src="/AmazeUI/assets/js/amazeui.js"></script>
<script type="text/javascript" src="/AmazeUI/assets/js/amazeui.js"></script>
<script type="text/javascript" src="/static/js/plugin/layer/layer.js"></script>
<script type="text/javascript" src="/static/js/common/admin.js?t=20210208"></script>
<script type="text/javascript" src="/static/js/plugin/layerpage/laypage.js"></script>
@@ -37,13 +37,12 @@
<script type="text/javascript" src="/static/js/common/vuedraggable.umd.min.js?t=2020221"></script>
<script type="text/javascript" src="/static/js/common/jquery.form.js?t=2020410"></script>
<script type="text/javascript" src="/static/js/plugin/viewer/viewer.js?t=4"></script>
<link rel="stylesheet" href="/static/js/plugin/element-ui/index.css">
<script src="/static/js/plugin/element-ui/index.js"></script>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>window.ROOT_URL = '';</script>
</head>
<body>
<div class="coms-layout-container theme-default" id="index-vue-app">
<div class="coms-layout-container theme-default">
<div class="coms-layout-header">
<div class="bars-nav"><i class="am-icon-bars"></i>导航</div>
<a href="" class="logo" style="">
@@ -53,111 +52,77 @@
<ul class="header-nav">
<? foreach ($menus as $v) { ?>
<?php if (!$v['sub']) { ?>
<li data-menu-node='m-<?= $v['id'] ?>' data-open="<?= $v['url'] ?>"><a
href="javascript:void (0);"><?= $v['name'] ?></a></li>
<li data-menu-node='m-<?=$v['id']?>' data-open="<?=$v['url']?>"><a href="javascript:void (0);"><?=$v['name']?></a></li>
<?php } else { ?>
<li data-menu-node='m-<?= $v['id'] ?>'><a href="javascript:void (0);"><?= $v['name'] ?></a>
<li data-menu-node='m-<?=$v['id']?>'><a href="javascript:void (0);"><?=$v['name']?></a>
</li>
<?php } ?>
<?php } ?>
</ul>
<?php } ?>
<div class="header-userinfo">
<a class="info-name" href="javascript:;"><?= $_username ?><span class="arrow"></span></a>
<a class="info-name" href="javascript:;"><?=$_username?><span class="arrow"></span></a>
<ul class="dropdown-list">
<li><a href="javascript:void (0);" data-open="/expfile" data-title="导出文件">导出文件</a></li>
<li><a href="javascript:void (0);" data-modal="/login/reset_pwd" data-title="修改秘密">修改密码</a></li>
<li><a href="javascript:void (0);" data-load="/login/logout" data-confirm="确定要退出登录吗?">退出</a>
</li>
<li><a href="javascript:void (0);" data-load="/login/logout" data-confirm="确定要退出登录吗?">退出</a></li>
</ul>
</div>
<div class="header-notice">
<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="#"
style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
{{ item.content}}
</a>
</li>
<!-- 按钮容器:使用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">
<i class="fa"></i> 清除所有
</a>
<a data-open="/sys/notice" href="javascript:void(0);"
style="flex: 1; text-align: center; padding: 4px 0; text-decoration: none; color: inherit;">
<i class="fa"></i> 查看更多
</a>
</li>
<!--
<a href="javascript:void(0);" style="color: #ff4d4f; border-top: 1px solid #eee;">
<i class="fa"></i> 清除所有
</a>
<a href="javascript:void(0);">
<i class="fa"></i> 查看更多
</a>
-->
</template>
<li v-if="notice.length === 0">
<a href="javascript:void(0);" style="color: #999; cursor: default;">暂无通知</a>
</li>
<!--div class="header-notice">
<a class="tit" href="javascript:;">通知<b><i>0</i></b></a>
<ul class="dropdown-list">
<li><a href="#">新的订单</a></li>
</ul>
</div>
</div-->
</div>
<div class="coms-layout-aside fold" id="J_coms-layout-aside" style="display: none">
<div class="aside-menu-scroll">
<?php if ($menus) { ?>
<div class="aside-unfold"><i class="iconfont f18">&#xe6d4;</i></div>
<?php foreach ($menus as $pmenu) { ?>
<?php if ($pmenu['sub']) { ?>
<ul class="aside-menu" data-menu-box="m-<?= $pmenu['id'] ?>">
<?php foreach ($pmenu['sub'] as $menu) { ?>
<?php if (!$menu['sub']) { ?>
<li class="treeview" data-menu-node='m-<?= $pmenu['id'] ?>-<?= $menu['id'] ?>'
data-open="<?= $menu['url'] ?>">
<a style="text-align: center" href="javascript:void(0)"><i class="iconfont f14">&#xe65d;</i><span
class="txt"><?= $menu['name'] ?></span></a>
</li>
<?php } else { ?>
<li class="treeview">
<a href="javascript:void(0)" style="text-align: center">
<?php if($menus){ ?>
<div class="aside-unfold"><i class="iconfont f18">&#xe6d4;</i></div>
<?php foreach ($menus as $pmenu) { ?>
<?php if ($pmenu['sub']) { ?>
<ul class="aside-menu" data-menu-box="m-<?=$pmenu['id']?>">
<?php foreach ($pmenu['sub'] as $menu) { ?>
<?php if (!$menu['sub']) { ?>
<li class="treeview" data-menu-node='m-<?=$pmenu['id']?>-<?=$menu['id']?>' data-open="<?=$menu['url']?>">
<a style="text-align: center" href="javascript:void(0)"><i class="iconfont f14">&#xe65d;</i><span class="txt"><?=$menu['name']?></span></a>
</li>
<?php } else { ?>
<li class="treeview">
<a href="javascript:void(0)" style="text-align: center">
<?php if ($menu['icon']) { ?>
<i class="<?= $menu['icon'] ?> "></i>
<?php } else { ?>
<i class="iconfont f14">&#xe65d;</i>
<?php } ?>
<span class="txt"><?= $menu['name'] ?></span>
</a>
<ul class="list" style="display: none"
data-menu-box='m-<?= $pmenu['id'] ?>-<?= $menu['id'] ?>'>
<?php foreach ($menu['sub'] as $submenu) {
$url = $submenu['url'];
$node = "{$pmenu['id']}-{$menu['id']}-{$submenu['id']}";
if ((!$url || $url == '#') && $submenu['sub']) {
$url = $submenu['sub'][0]['url'];
$node .= "-{$submenu['sub'][0]['id']}";
}
?>
<li data-menu-node='m-<?= $node ?>' data-open="<?= $url ?>">
<a href="javascript:void (0);"><?= $submenu['name'] ?></a>
</li>
<?php } ?>
</ul>
</li>
<?php } ?>
<?php if($menu['icon']){?>
<i class="<?=$menu['icon']?> "></i>
<?php }else{ ?>
<i class="iconfont f14">&#xe65d;</i>
<?php } ?>
<span class="txt"><?=$menu['name']?></span>
</a>
<ul class="list" style="display: none" data-menu-box='m-<?=$pmenu['id']?>-<?=$menu['id']?>'>
<?php foreach ($menu['sub'] as $submenu) {
$url = $submenu['url'];
$node = "{$pmenu['id']}-{$menu['id']}-{$submenu['id']}";
if((!$url || $url == '#') && $submenu['sub']) {
$url = $submenu['sub'][0]['url'];
$node .= "-{$submenu['sub'][0]['id']}";
}
?>
<li data-menu-node='m-<?=$node?>' data-open="<?=$url?>">
<a href="javascript:void (0);"><?=$submenu['name']?></a>
</li>
<?php } ?>
</ul>
</li>
<?php } ?>
</ul>
<?php } ?>
<?php } ?>
</ul>
<?php } ?>
<div class="aside-menu-sub">
</div>
<?php } ?>
<div class="aside-menu-sub">
</div>
<?php }?>
</div>
</div>
@@ -165,36 +130,31 @@
<div class="coms-layout-body-inner">
<article class="am-article" style="display: none">
<div class="am-article-hd">
<h1 class="am-article-title">欢迎 [<?= $_role ?>] <?= $_username ?></h1>
<h1 class="am-article-title">欢迎 [<?=$_role?>] <?=$_username?></h1>
<p class="am-article-meta">
<?php
$no = date("H", time());
$week = array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日");
if ($no > 0 && $no <= 6) {
echo "凌晨好!";
} elseif ($no > 6 && $no < 12) {
echo "上午好!";
} elseif ($no >= 12 && $no <= 18) {
echo "下午好!";
} else {
echo "晚上好!";
}
?>
<?php
$no = date("H", time());
$week = array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日");
if ($no > 0 && $no <= 6){
echo "凌晨好!";
}elseif ($no > 6 && $no < 12){
echo "上午好!";
}elseif ($no >= 12 && $no <= 18){
echo "下午好!";
}else{
echo "晚上好!";
}
?>
</p>
</div>
<div class="am-article-bd">
<p class="am-article-lead">
现在时间是:<?= date('Y年m月d日') ?> <?= $week[date('w')] ?> <?= date('H:i:s') ?>
当前IP<?= get_client_ip() ?></p>
<p class="am-article-lead">现在时间是:<?=date('Y年m月d日')?> <?=$week[date('w')]?> <?=date('H:i:s')?> 当前IP<?=get_client_ip()?></p>
</div>
</article>
</div>
</div>
<audio id="notification-sound" hidden>
<source src="/static/audio/message-ding.mp3" type="audio/mpeg">
</audio>
</div>
</body>
@@ -202,104 +162,43 @@
<script type="text/javascript" src="/static/js/common/app.js?v=1"></script>
<script type="text/javascript">
//查看图片控件
function showViewer(obj) {
function showViewer(obj){
new Viewer(document.getElementById(obj));
}
var _index_vue_obj;
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',
data: {
countNotice: <?=$_noticeCount?>,
notice: <?=json_encode($_notice)?>
},
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});
}
})
}
}
});
// 初始化 WebSocket 连接
initWebSocket();
$(".coms-layout-header .bars-nav").on("click", function (event) {
$(".coms-layout-header .bars-nav").on("click",function(event){
event.stopPropagation()
var $headNav = $(".header-nav");
if ($headNav.hasClass("active")) {
var $headNav=$(".header-nav");
if($headNav.hasClass("active")){
$headNav.removeClass("active")
} else {
}else{
$headNav.addClass("active")
}
});
$("body").on("touchstart", function (event) {
if ($(event.target).closest(".header-nav").length) {
$("body").on("touchstart",function(event){
if($(event.target).closest(".header-nav").length){
return;
} else {
}else{
$(".header-nav").removeClass("active");
}
})
$(function () {
var $aside = $("#J_coms-layout-aside"),
$fold = $aside.find(".aside-unfold"),
$mainBody = $("#J_coms-layout-body");
$fold.on("click", function () {
$(function(){
var $aside=$("#J_coms-layout-aside"),
$fold=$aside.find(".aside-unfold"),
$mainBody=$("#J_coms-layout-body");
$fold.on("click",function(){
if ($aside.hasClass('fold')) {
if($aside.hasClass('fold')){
$aside.removeClass('fold');
$mainBody.removeClass('unfold');
$('.coms-layout-body').css('left', 220);
$(".coms-body-main-nav").css("left", 220)
} else {
$('.coms-layout-body').css('left',220);
$(".coms-body-main-nav").css("left",220)
}else{
$aside.addClass('fold');
$mainBody.addClass('unfold');
$('.coms-layout-body').css('left', 65);
$(".coms-body-main-nav").css("left", 65);
$('.coms-layout-body').css('left',65);
$(".coms-body-main-nav").css("left",65);
}
});
@@ -313,146 +212,8 @@
color: '#000',
alpha: 0.03,
});
// 1. 监听音频预加载完成事件
$audio.on('canplaythrough', function () {
isAudioLoaded = true;
console.log('音频预加载完成,等待通知触发播放');
});
})
})(jQuery)
function initWebSocket() {
// 构建 WebSocket 连接 URL
var wsUrl = "<?=$wss_url?>";
try {
// 创建 WebSocket 实例
var websocket = new WebSocket(wsUrl);
// 连接打开事件
websocket.onopen = function (event) {
console.log('websocket 连接成功');
// 在websocket.onopen回调中添加:
heartbeatInterval = setInterval(function () {
if (window.adminWebsocket && window.adminWebsocket.readyState === WebSocket.OPEN) {
window.adminWebsocket.send(JSON.stringify({type: 'heartbeat', content: 'ping'}));
// 设置等待pong响应的超时
pongTimeout = setTimeout(function () {
console.warn('Heartbeat timeout - closing connection');
window.adminWebsocket.close();
}, 5000); // 5秒内等待pong响应
}
}, 30000); // 每30秒发送一次ping
};
// 接收消息事件
websocket.onmessage = function (event) {
try {
console.log('websocket 接收到消息:', event.data);
var data = JSON.parse(event.data);
handleWebSocketMessage(data);
} catch (e) {
console.error('websocket 解析消息错误:', e);
}
};
// 错误处理事件
websocket.onerror = function (error) {
console.error('websocket 错误信息:', error);
};
// 连接关闭事件
websocket.onclose = function (event) {
console.log('websocket 关闭连接', event);
if (heartbeatInterval) {
clearInterval(heartbeatInterval);
heartbeatInterval = null;
}
if (pongTimeout) {
clearTimeout(pongTimeout);
pongTimeout = null;
}
// 5秒后尝试重连
setTimeout(initWebSocket, 5000);
};
// 保存 WebSocket 实例供全局使用
window.adminWebsocket = websocket;
} catch (e) {
console.error('初始化 websocket 失败:', e);
}
}
/**
* 消息处理
* @param data
*/
function handleWebSocketMessage(data) {
// 处理不同类型的消息
switch (data.type) {
case 'notice':
// 显示通知消息
let message = data.data.content ? data.data.content : "您收到一条新的系统通知,请及时查看";
showNotification(message);
_index_vue_obj.countNotice++;
_index_vue_obj.notice = [data.data].concat(_index_vue_obj.notice);
// 播放提示音
playNotificationSound();
break;
case 'heartbeat':
// 收到pong响应时清除超时定时器
if (pongTimeout) {
clearTimeout(pongTimeout);
pongTimeout = null;
}
console.log('websocket 心跳检测正常');
break;
default:
console.log('Received message:', data);
}
}
function showNotification(message) {
layer.msg(message, {
time: 5000,
icon: 1,
offset: 't', // t表示顶部显示
anim: 0, // 使用淡入淡出动画
isOutAnim: false // 关闭移出动画
});
}
// 新增播放提示音函数
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 &&
window.adminWebsocket.readyState === WebSocket.OPEN) {
window.adminWebsocket.send(JSON.stringify(message));
} else {
console.warn('websocket 未连接');
}
};
</script>
</html>
+53 -483
View File
@@ -1,18 +1,15 @@
<style>
.el-input__inner {
background-color: white !important;
background-color: white!important;
}
.el-input__inner {
height: 36.8px;
/* 设置输入框高度 */
height: 36.8px; /* 设置输入框高度 */
</style>
</style>
<div class="am-form am-form-horizontal" style="width: 98%;padding-top: 10px">
<div id="vue-edit">
<div class="am-g">
<div class="col-sm-12 mb25">
<div class="col-sm-12 mb25" >
<div class="col-sm-2" style="padding-left: 0px;">
<div class="my-panel">
<div class="text-center">
@@ -72,15 +69,13 @@
<td class="table-td">
<div class="input-group">
<div class="input-group-addon">客户姓名:</div>
<input style="width: 100px;" type="text" v-model="info.name"
placeholder="请输入客户姓名">
<input style="width: 100px;" type="text" v-model="info.name" placeholder="请输入客户姓名">
</div>
</td>
<td class="table-td">
<div class="input-group">
<div class="input-group-addon">手机号码:</div>
<input style="width: 150px;" type="text" v-model="info.mobile"
placeholder="请输入手机号">
<input style="width: 150px;" type="text" v-model="info.mobile" placeholder="请输入手机号">
<!--a data-modal="/common/show_sms?id=<?= $info['id'] ?>&type=clues" data-title="发送短信" class="am-btn am-btn-sm am-btn-success ml10">短信</a-->
</div>
</td>
@@ -174,19 +169,6 @@
</tr>
<tr>
<td class="table-td">
<div class="input-group">
<div class="input-group-addon">意向购车周期:</div>
<el-select clearable v-model="info.buy_time">
<el-option label="请选择" value="0"></el-option>
<el-option
v-for="(item,index) in buyTimeList"
:key="index"
:label="item"
:value="index">
</el-option>
</el-select>
</div>
<!--
<div class="input-group">
<div class="input-group-addon">平安推荐:</div>
<el-select v-model="info.cf_pid" filterable placeholder="请选择" clearable>
@@ -198,27 +180,17 @@
</el-option>
</el-select>
</div>
-->
</td>
<td class="table-td">
<div class="input-group">
</div>
</td>
</tr>
<tr>
<td class="table-td">
<div class="input-group" style="margin-left: 30px;">
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success"
@click="saveEdit(2)">保存</a>
<!--
<a href="javascript:void(0);"
data-modal="/common/bind_mobile?id=<?= $info['id'] ?>&type=clues"
class="am-btn am-btn-sm am-btn-danger ml20" data-title="获取手机号">拨打</a>
-->
<a data-ajax="get" data-action="/common/bind_mobile"
data-params-id="<?= $info['id'] ?>" data-params-type="clues"
class="am-btn am-btn-sm am-btn-danger ml20">
拨打
</a>
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success" @click="saveEdit(2)" >保存</a>
<a href="javascript:void(0);" data-modal="/common/bind_mobile?id=<?= $info['id'] ?>&type=clues" class="am-btn am-btn-sm am-btn-danger ml20" data-title="获取手机号">拨打</a>
</div>
</td>
</tr>
@@ -226,39 +198,6 @@
</div>
</div>
</div>
<div class="am-u-lg-12">
<div class="am-panel am-panel-default">
<div class="am-panel-hd">
<span href="javascript:void(0)" style="font-size: 20px">
留资记录
</span>
</div>
<div class="am-panel-bd">
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="sid" label="编号">
</el-table-column>
<el-table-column prop="mobile" label="手机号">
</el-table-column>
<el-table-column prop="brandName" label="关注品牌车型">
</el-table-column>
<el-table-column prop="cfrom2" label="留资渠道">
</el-table-column>
<el-table-column prop="c_time" label="时间">
</el-table-column>
</el-table>
<el-pagination
class="mt10 text-center"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 50]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next"
:total="total">
</el-pagination>
</div>
</div>
</div>
<div class="am-u-lg-12">
<div class="am-panel am-panel-default">
<div class="am-panel-hd">
@@ -271,81 +210,44 @@
<tr>
<td class="table-td">
<div class="am-para-inline ml30">派单门店:</div>
<template v-if="info.app_id==1">
<div>
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-default"
@click="brandModal1">+选择门店</a>
<el-tag v-for="item in selectedBrands1" class="ml5" closable
@close="delCustomer(item)">{{item.name}}
</el-tag>
</div>
</template>
<template v-else>
<div class="am-para-inline w100" style="margin: 0">
<select name="info.province_id_admin" v-model="info.province_id_admin">
<option value="0">省份</option>
<option :value="v.province_id" v-for="(v,i) in admins.provinceAry">
{{v.province_name}}
</option>
</select>
</div>
<div class="am-para-inline w100">
<select name="info.city_id_admin" v-model="info.city_id_admin">
<option value="0">城市</option>
<option :value="v.id" v-for="(v,i) in admins.cityAry">{{v.name}}</option>
</select>
</div>
<div class="am-para-inline w180">
<select name="info.county_id_admin" v-model="info.county_id_admin" class="w180">
<option value="0">行政区</option>
<option :value="v.id" v-for="(v,i) in admins.countyAry">{{v.name}}</option>
</select>
</div>
<div class="am-para-inline w180">
<select name="info.biz_id" v-model="info.biz_id">
<option value="0">门店</option>
<option :value="v.id" v-for="(v,i) in admins.bizAry">{{v.title}}</option>
</select>
</div>
<div class="am-para-inline" style="margin-left: 30px;">
<?php if ($info['biz_id']) { ?>
<?php if (!$info['customer_id']) { ?>
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-danger"
@click="saveEdit(4)">转交门店跟踪</a>
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success"
@click="saveEdit(5)">改派门店</a>
<?php } else { ?>
<a href="javascript:void(0)"
data-open="/receiver/customer/get?id=<?= $info['customer_id'] ?>"
class="am-btn am-btn-sm am-btn-default">门店跟进中</a>
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success"
@click="saveEdit(5)">另派门店</a>
<?php }
} else { ?>
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success"
@click="saveEdit(3)">确认派单</a>
<?php } ?>
</div>
</template>
<div class="am-para-inline w100" style="margin: 0">
<select name="info.province_id_admin" v-model="info.province_id_admin">
<option value="0">省份</option>
<option :value="v.province_id" v-for="(v,i) in admins.provinceAry">{{v.province_name}}</option>
</select>
</div>
<div class="am-para-inline w100">
<select name="info.city_id_admin" v-model="info.city_id_admin">
<option value="0">城市</option>
<option :value="v.id" v-for="(v,i) in admins.cityAry">{{v.name}}</option>
</select>
</div>
<div class="am-para-inline w180">
<select name="info.county_id_admin" v-model="info.county_id_admin" class="w180">
<option value="0">行政区</option>
<option :value="v.id" v-for="(v,i) in admins.countyAry">{{v.name}}</option>
</select>
</div>
<div class="am-para-inline w180">
<select name="info.biz_id" v-model="info.biz_id">
<option value="0">门店</option>
<option :value="v.id" v-for="(v,i) in admins.bizAry">{{v.title}}</option>
</select>
</div>
<div class="am-para-inline" style="margin-left: 30px;">
<?php if($info['biz_id']){ ?>
<?php if(!$info['customer_id']){ ?>
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-danger" @click="saveEdit(4)">转交门店跟踪</a>
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success" @click="saveEdit(5)">改派门店</a>
<?php }else{ ?>
<a href="javascript:void(0)" data-open="/receiver/customer/get?id=<?=$info['customer_id']?>" class="am-btn am-btn-sm am-btn-default">门店跟进中</a>
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success" @click="saveEdit(5)">另派门店</a>
<?php }} else{ ?>
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success" @click="saveEdit(3)">确认派单</a>
<?php }?>
</div>
</td>
</tr>
<tr>
<template v-if="info.app_id==1">
<td class="table-td">
<!--
<div class="am-para-inline ml30">回收时间:</div>
<div class="am-para-inline w200">
<input type="text" autocomplete="off" id="id-create-time"
v-model="info.rec_time">
</div>
-->
<div class="am-para-inline ml30">
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success"
@click="saveCustomer()">确认派单</a>
</div>
</td>
</template>
</tr>
</table>
</div>
</div>
@@ -400,144 +302,18 @@
</div>
<div id="log-modal" style="display: none;">
<div style="padding-top: 20px;">
<!--
<div class="am-form-group">
<label class="am-para-label label-width w150">意向购车周期</label>
<div class="am-para-input">
<el-select clearable v-model="goods.buy_time">
<el-option
v-for="(item,index) in buyTimeList"
:key="index"
:label="item"
:value="index">
</el-option>
</el-select>
</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">
<label class="am-para-label label-width">内容</label>
<div class="am-para-input" style="width: 80%">
<textarea name="log" rows="5" placeholder="请输入内容" v-model="goods.log"></textarea>
</div>
</div>
</div>
</div>
<div id="brand-modal1" style="display:none">
<div class="modal-body">
<div class="header">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<div class="am-form-group am-para-inline w150">
<el-select v-model="search_info.brand_id" filterable placeholder="品牌" clearable>
<el-option
v-for="item in brandAry"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="am-form-group am-para-inline w150">
<select title="城市" v-model="info.province_id_admin">
<option value="0">省份</option>
<template v-for="(v,i) in admins.provinceAry">
<option :value="v.province_id">{{v.province_name}}</option>
</template>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select title="城市" v-model="info.city_id_admin">
<option value="0">城市</option>
<template v-for="(v,i) in admins.cityAry">
<option :value="v.id">{{v.name}}</option>
</template>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select title="行政区" v-model="info.county_id_admin">
<option value="0">行政区</option>
<template v-for="(v,i) in admins.countyAry">
<option :value="v.id">{{v.name}}</option>
</template>
</select>
</div>
<div class="am-form-group fl ml10">
<a class="am-btn am-btn-success am-btn-sm w100" @click="search1()">搜索</a>
</div>
</div>
</div>
<div style="padding-top: 10px;">
<div class="vuetable-body-wrapper">
<table class="vuetable table table-middle table-hover fixed">
<colgroup>
<col class="vuetable-col-title" style="width: 50%;">
<col class="vuetable-col-actions text-right" style="width: 10%;">
</colgroup>
<thead>
<tr>
<th class="vuetable-th-slot-title">门店</th>
<th class="vuetable-th-slot-actions text-right">操作</th>
</tr>
</thead>
<tfoot></tfoot>
<tbody class="vuetable-body">
<tr v-for="(v,i) in brandsList1">
<td class="vuetable-slot">
{{v.name}}
</td>
<td class="vuetable-slot text-right">
<button type='button' v-if="v.is_checked==0 || !v.is_checked"
class="btn btn-sm btn-success"
@click="addItem1(i)">添加
</button>
<button type='button' v-if="v.is_checked==1" class="btn btn-sm btn-danger"
@click="removeItem1(v)">删除
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="clearfix">
<span class="pull-left text-muted">第{{brandsPage.page}}页(每页{{brandsPage.pageLimit}}条,共{{brandsPage.pageCount}}条)</span>
<nav class="pull-right" aria-label="Page navigation">
<ul class="pagination pagination-sm">
<li>
<a href="javascript:void(0);" @click="beforeShopPage1();" aria-label="上一页">
<span class="glyphicon glyphicon-menu-left"></span>
</a>
</li>
<li v-if="brandsPage.hasNext">
<a href="javascript:void(0);" @click="afterShopPage1();" aria-label="下一页">
<span class="glyphicon glyphicon-menu-right"></span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
require(['laydate'], function (laydate) {
laydate.render({
elem: '#id-create-time',
type: 'datetime'
});
});
var vue_obj;
$(document).ready(function () {
vue_obj = new Vue({
@@ -545,7 +321,7 @@
data: {
info: {},
infoShow: {},
goods: {log: '', id: <?=$info['id']?>, type: 0, buy_time: '', notice: false},
goods: {"imgs_url": [], "imgs": [], "log": ''},
provinceAry: [],
cityAry: [],
countyAry: [],
@@ -553,24 +329,8 @@
cfroms2: [],
brandAry: [],
seryAry: [],
admins: {
provinceAry: <?=json_encode($provinces, JSON_UNESCAPED_UNICODE)?>,
cityAry: [],
countyAry: [],
bizAry: []
},
admins: {provinceAry: <?=json_encode($provinces, JSON_UNESCAPED_UNICODE)?>, cityAry: [], countyAry: [], bizAry: []},
paicUser: [],
search_info: {province_id: 0, city_id: 0, county_id: 0, brand_id: ''},
brandsPage: [],
bizIds: [],
brandsList1: [],
brandsThPage: 0,
selectedBrands1: [],
tableData: [],
currentPage: 1,
total: 0,
pageSize: 10,
buyTimeList: []
},
mounted: function () {
var that = this;
@@ -578,8 +338,6 @@
that.infoShow = <?=json_encode($info_show)?>;
that.cfroms = <?=json_encode($cfromAry, JSON_UNESCAPED_UNICODE)?>;
that.cfroms2 = <?=json_encode($cfromAry2, JSON_UNESCAPED_UNICODE)?>;
that.selectedBrands1 = <?=json_encode($selectedBrands1, JSON_UNESCAPED_UNICODE)?>;
that.buyTimeList = <?=json_encode($buyTimeList, JSON_UNESCAPED_UNICODE)?>;
that.init_provinces();
that.init_brands();
that.get_series();
@@ -587,7 +345,6 @@
},
computed: {},
created: function () {
this.loadModelList();
},
updated: function () {
},
@@ -694,7 +451,9 @@
url: '/receiver/clues/add_log',
type: 'post',
dataType: 'json',
data: vm.goods,
data: {
act_type: 1, id: <?= $info['id'] ?>, type: 0, log: vm.goods.log, imgs: vm.goods.imgs
},
beforeSend: function () {
layer.load(1, {
shade: [0.1, '#fff'] //0.1透明度的白色背景
@@ -721,10 +480,9 @@
},
saveEdit: function (editType) {
var vm = this;
if (editType != '') {
if(editType != ''){
vm.info.editType = editType;
}
vm.info.rec_time = $("#id-create-time").val();
$.ajax({
url: '/receiver/clues/edit',
type: 'post',
@@ -760,194 +518,6 @@
var classArr = ['default', 'primary', 'success', 'info', 'warning', 'danger'];
var rand = Math.floor(Math.random() * classArr.length);
return classArr[rand]
},
brandModal1: function () {
var that = this;
layer.open({
type: 1,
area: ['60%', '80%'], //宽高
content: $('#brand-modal1'),
title: '选择门店',
shade: false,
btn: ['选好了'],
yes: function (index) {
layer.close(index);
}
});
$.ajax({
url: '/common/shop_app',
type: 'post',
dataType: 'json',
data: {
type: [1, 5],
page: that.brandsThPage,
province_id: that.info.province_id_admin,
city_id: that.info.city_id_admin,
county_id: that.info.county_id_admin,
unset_city_limit: 1,
car_brand_id: that.search_info.brand_id,
},
success: function (json) {
var brandsList1 = json.data.shopList;
that.brandsPage = json.data.shopPage;
brandsList1.map(function (_item, _index) {
for (var index in that.selectedBrands1) {
var item = that.selectedBrands1[index];
var id = that.sys_type_id == 1 ? item.brand_id : item.biz_id;
if (id == _item.id) {
brandsList1[_index].is_checked = 1;
break;
} else {
brandsList1[_index].is_checked = 0;
}
}
})
that.brandsList1 = brandsList1;
}
});
},
//group_id1
search1: function () {
this.changePage1(1);
},
changePage1: function (page) {
var that = this;
that.brandsThPage = page;
return this.brandModal1();
},
beforeShopPage1: function () {
var vm = this;
if (vm.brandsThPage == 1) {
alert('已经是第一页了');
return;
}
vm.brandsThPage--;
return this.brandModal1();
},
afterShopPage1: function () {
var vm = this;
vm.brandsThPage++;
return this.brandModal1();
},
addItem1: function (index) {
var vm = this;
var brand_id;
var biz_id;
biz_id = vm.brandsList1[index]['id'];
var _shop = {
biz_id: biz_id,
name: vm.brandsList1[index]['name'],
};
vm.selectedBrands1.push(_shop);
vm.brandsList1[index]['is_checked'] = 1;
},
removeItem1: function (item) {
var vm = this;
this.selectedBrands1 = this.selectedBrands1.filter(function (_item) {
var id = _item.biz_id > 0 ? _item.biz_id : _item.brand_id;
return id != item.id;
})
this.brandsList1.map(function (_item, _index) {
if (item.id == _item.id) {
vm.brandsList1[_index].is_checked = 0;
}
})
},
//派单到客户池
saveCustomer: function () {
var vm = this;
vm.info.rec_time = $("#id-create-time").val();
$.ajax({
url: '/receiver/clues/add_customer',
type: 'post',
dataType: 'json',
data: {
bizList: vm.selectedBrands1,
info: vm.info
},
beforeSend: function () {
layer.load(1, {
shade: [0.1, '#fff'] //0.1透明度的白色背景
});
},
success: function (data) {
loading = false;
if (data['code']) {
layer.msg(data.msg, {
icon: 1,
time: 2000
}, function () {
$.form.reload();
});
} else {
layer.msg(data.msg, {icon: 2});
}
},
complete: function () {
loading = false;
layer.closeAll('loading');
},
});
},
delCustomer(item) {
var vm = this;
layer.confirm('您确定要删除?', {icon: 3, title: '提示'}, function (index) {
layer.close(index);
$.ajax({
url: '/receiver/clues/edit_customer',
type: 'post',
dataType: 'json',
data: {
bizId: item.biz_id,
info: vm.info
},
beforeSend: function () {
layer.load(1, {
shade: [0.1, '#fff'] //0.1透明度的白色背景
});
},
success: function (data) {
if (data['code']) {
layer.msg(data.msg, {
icon: 1,
time: 2000
}, function () {
$.form.reload();
});
} else {
layer.msg(data.msg, {icon: 2});
}
},
complete: function () {
layer.closeAll('loading');
},
});
});
},
handleSizeChange(size) {
this.pageSize = size;
this.currentPage = 1;
this.loadModelList();
},
handleCurrentChange(obj) {
console.log(obj);
this.loadModelList();
},
loadModelList() {
let that = this;
$.get('receiver/clues/lists_enroll', {
id: <?=$info['id']?>,
page: that.currentPage,
size: that.pageSize
}, function (response) {
if (response.code) {
that.tableData = response.data.list;
that.total = response.data.count;
} else {
layer.msg(response.msg, {icon: 2});
}
})
}
},
watch: {
+3 -4
View File
@@ -28,7 +28,6 @@
<label class="am-para-label w110">派单门店:</label>
<div class="am-para-inline w100">
<select title="省份" name="province_id_admin" v-model="province_id_admin">
<option value="0">省份</option>
<option :value="v.province_id" v-for="(v,i) in admins.provinceAry">{{v.province_name}}</option>
</select>
</div>
@@ -146,10 +145,10 @@
el: '#edit-form',
data: {
info: {},
province_id: <?=$limit_province_id?>,
province_id: 350000,
city_id: 0,
county_id: 0,
province_id_admin: <?=$limit_province_id?>,
province_id_admin: 350000,
city_id_admin: 0,
county_id_admin: 0,
biz_id_admin: 0,
@@ -242,7 +241,7 @@
vm.cityAry = response.data;
}
});
$.get('common/area', {id: <?=$limit_province_id?>, key: 'city', type: 1}, function (response) {
$.get('common/area', {id: 350000, key: 'city', type: 1}, function (response) {
if (response.code == 1) {
vm.admins.cityAry = response.data;
}
+1 -1
View File
@@ -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": "湖南省"}],
cityAry: [],
countyAry: [],
bizList: [],
+7 -39
View File
@@ -76,32 +76,6 @@
<input id="title" name="title" type="text" value="<?= $params['title'] ?>"/>
</div>
</div>
<?php if ($role == 1) { ?>
<div class="am-form-group fl">
<label class="am-para-label w100">客户归属:</label>
<div class="am-para-inline w100">
<select name="belong_id">
<option value=0>请选择</option>
<option value=10>厦门</option>
<option value=38>贵阳</option>
<option value=39>海口</option>
<option value=99>佛山</option>
</select>
</div>
</div>
<?php } else { ?>
<input name="belong_id" value="<?= $params['belong_id'] ?>" type="hidden">
<?php } ?>
<div class="am-form-group fl">
<label class="am-para-label w100">客户等级:</label>
<div class="am-para-inline w100">
<select name="level" v-model="level">
<option value="">请选择</option>
<option :value="item" v-for="item in levelList">{{item}}</option>
</select>
</div>
</div>
<div class="fl" style="width:1920px">
<label class="am-para-label w100">线索来源:</label>
<div class="am-form-group am-para-inline w150">
@@ -293,7 +267,9 @@
<th width="12%"><span>所在地区</span></th>
<th width="12%"><span>所派门店</span></th>
<th width="8%"><span>状态</span></th>
<th width="15%"><span>时间</span></th>
<th width="12%"><span>分配时间</span></th>
<th width="12%"><span>创建时间</span></th>
<th width="12%"><span>更新时间</span></th>
<th width="10%"><span>跟进人员</span></th>
</tr>
</thead>
@@ -309,16 +285,10 @@
<td style="vertical-align: middle;"><?= $v['cf_title'] ?></td>
<td style="vertical-align: middle;"><?= $v['poi'] ?></td>
<td style="vertical-align: middle;"><?= $v['biz_poi'] ?><br><?= $v['biz_name'] ?></td>
<td style="vertical-align: middle;">
<?= $v['status_name'] ?><br>
<?= $v['is_unlock'] ?>
</td>
<td style="text-align: left">
分配时间: <?= $v['p_time'] ?><br>
派单过期: <?= $v['rec_time'] ?><br>
创建时间: <?= date('Y-m-d H:i:s', $v['c_time']) ?><br>
更新时间: <?= $v['u_time'] ?><br>
</td>
<td style="vertical-align: middle;"><?= $v['status_name'] ?></td>
<td style="vertical-align: middle;"><?= $v['p_time'] ?></td>
<td style="vertical-align: middle;"><?= date('Y-m-d H:i:s', $v['c_time']) ?></td>
<td style="vertical-align: middle;"><?= $v['u_time'] ?></td>
<td style="vertical-align: middle;"><?= $v['admin_name'] ?></td>
</tr>
<? }
@@ -385,8 +355,6 @@
export_button: <?=$export_button?>,
admin_id: <?=strlen($params['admin_id']) ? $params['admin_id'] : '""'?>,
adminAry: <?=$adminLists ? json_encode($adminLists) : '[]'?>,
levelList: <?=$levelList ? json_encode($levelList) : '[]'?>,
level: "<?=$params['level'] ? $params['level'] : ''?>",
},
mounted: function () {
this.init_provinces();
-7
View File
@@ -44,19 +44,12 @@
<tr>
<td class="table-td"><span class="mr5">客户姓名:</span>{{info.name}}</td>
<td class="table-td"><span class="mr5">客户电话:</span>{{info.mobile}}
<a data-ajax="get" data-action="/common/bind_mobile"
data-params-id="<?= $info['id'] ?>" data-params-type="customer"
class="am-btn am-btn-sm am-btn-success ml5" v-if="info.role!=8">
拨打
</a>
<!--
<a href="javascript:void(0);"
data-modal="/common/bind_mobile?id=<?= $info['id'] ?>&type=customer"
class="am-btn am-btn-sm am-btn-success ml5" data-title="获取手机号"
v-if="info.role!=8">
拨打
</a>
-->
</td>
<td class="table-td"><span class="mr5">归属门店:</span>{{info.biz}}</td>
+1 -4
View File
@@ -258,10 +258,7 @@
<td style="vertical-align: middle;">{{v.admin_name}}</td>
<td style="vertical-align: middle;">{{v.brand_detail}}</td>
<td style="vertical-align: middle;">{{v.wxgr_name}}</td>
<td style="vertical-align: middle;">
{{v.status_name}}<br>
{{v.is_unlock}}
</td>
<td style="vertical-align: middle;">{{v.status_name}}</td>
<td style="vertical-align: middle;">{{v.p_time}}</td>
<td style="vertical-align: middle;">{{v.cont_time}}</td>
</tr>
+3 -3
View File
@@ -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">
-21
View File
@@ -17,12 +17,6 @@
<input type="text" placeholder="输入手机号" value="<?=$this->data['mobile']?$this->data['mobile']:''?>" name="mobile"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">客服号:</label>
<div class="am-para-input">
<input type="text" placeholder="输入客服号" value="<?=$this->data['kf_mobile']?$this->data['kf_mobile']:''?>" name="kf_mobile"/>
</div>
</div>
<!-- <div class="am-form-group">
<label class="am-para-label">状态:</label>
<div class="am-para-inline w150">
@@ -45,18 +39,6 @@
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">归属:</label>
<div class="am-para-inline w150">
<select v-model="belong_id" name="belong_id">
<option value="">请选择</option>
<template v-for="value in belong">
<option v-if="value.id == '<?=isset($this->data['belong_id'])?$this->data['belong_id']:''?>'" selected :value="value.id">{{value.biz_name}}</option>
<option v-else :value="value.id">{{value.biz_name}}</option>
</template>
</select>
</div>
</div>
<?php if($url == 'add') { ?>
<div class="am-form-group">
<label class="am-para-label">密码:</label>
@@ -110,9 +92,7 @@
var vm = new Vue({
el: '#vue-edit',
data: {
belong_id: '',
role_id: '',
belong: <?=json_encode($this->data['belong'])?>,
role: <?=json_encode($this->data['role'])?>,
province_id: '<?=$province_id?>',
city_id:'<?=$city_id?>',
@@ -126,7 +106,6 @@
created: function(index) {
if('edit' == '<?=$url?>') {
this.role_id = '<?=$this->data['role_id']?>';
this.belong_id = '<?=$this->data['belong_id']?>';
}
},
mounted: function () {
-95
View File
@@ -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>
-44
View File
@@ -1,44 +0,0 @@
<div class="coms-table-wrap">
<div class="coms-table-hd clearfix no-border">
<form id="vue-edit" class="am-form am-form-horizontal" action="/sys/site/callconfig/edit" data-auto="true"
method="post" style="width: 90%;padding-top: 10px" onsubmit="return false">
<input type="hidden" value="<?= $id ?>" name="id"/>
<div class="am-form-group">
<label class="am-para-label">回呼号码:</label>
<div class="am-para-input w300">
<input type="text" placeholder="输入回呼号码" value="<?= $row['callBackPhoneNo'] ?>"
name="callBackPhoneNo"/>
</div>
<span class="f12 fl clr999 lh-default ml5" style="line-height: 30px;">
客户回拨到号码,为空则回到坐席号码
</span>
</div>
<div class="am-form-group">
<label class="am-para-label label-width">外呼绑定时长:</label>
<div class="col-sm-6" style="padding-left:5px;">
<div class="am-input-group w300">
<input type="number" class="am-form-field" value="<?= $row['callTime'] ?>" placeholder=""
name="callTime">
<a href="javascript:void(0);" class="am-input-group-label">分钟</a>
</div>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label label-width">回拨绑定时长:</label>
<div class="col-sm-6" style="padding-left:5px;">
<div class="am-input-group w300">
<input type="number" class="am-form-field" value="<?= $row['callbackTime'] ?>" placeholder=""
name="callbackTime">
<a href="javascript:void(0);" class="am-input-group-label">分钟</a>
</div>
</div>
</div>
<div class="am-form-group">
<button class="am-btn ml20 am-btn-sm am-btn-success w100" style="margin-left: 3.5rem" type="submit">
保存
</button>
</div>
</form>
</div>
</div>
-86
View File
@@ -1,86 +0,0 @@
<form id="vue-edit" class="am-form am-form-horizontal" action="/sys/city/city/add" data-auto="true" method="post"
style="width: 90%;padding:25px 30px 20px 0;margin: 0 auto">
<div class="am-form-group">
<label class="am-para-label"><span class="com-must-star">*</span>推送平台:</label>
<div class="am-para-input">
<select name="platform" v-model="info.platform">
<option value="">选择推送平台</option>
<option v-for="(v,i) in platformList" :value="i">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">
<span class="com-must-star">*</span>推送用户id</label>
<div class="am-para-input">
<input type="text" placeholder="输入用户id" name="uid" v-model="info.uid"/>
</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="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;
var vue_obj;
$(function () {
vue_obj = new Vue({
el: '#vue-edit',
data: {
info: {
platform: 1,
uid: '',
content: '',
url: ''
},
platformList: <?=json_encode($platformList, JSON_UNESCAPED_UNICODE)?>,
},
mounted: function () {
},
methods: {
saveEdit() {
if (!this.info.uid || !this.info.content) {
layer.msg("参数错误", {icon: 2});
return false
}
$.post('sys/utils/wss/add', this.info, function (response) {
if (response.code == 1) {
layer.msg(response.msg, {'icon': 1})
} else {
layer.msg(response.msg, {'icon': 2});
}
})
}
},
watch: {}
});
});
</script>
-149
View File
@@ -1,149 +0,0 @@
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
<div class="coms-table-wrap mt10" id="vue-app">
<form class="form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/sys/vlog/index" id="search_form">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">用户:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input name="user_name" type="text" value="<?= $params['user_name'] ?>"
placeholder="用户" autocomplete="off"/>
</div>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">门店类型:</label>
<div class="am-form-group am-para-inline w150">
<select name="type" v-model="type">
<option value="0">所有</option>
<option :value="i" v-for="(v,i) in typeAry">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label w100">门店:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input name="biz_name" type="text" value="<?= $params['biz_name'] ?>"
placeholder="门店" autocomplete="off"/>
</div>
</div>
</div>
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<label class="am-para-label w100">访问时间:</label>
<div class="am-form-group fl">
<div class="am-para-inline w300">
<input id="id-create-time" name="c_time" type="text" value="<?= $params['c_time'] ?>"
placeholder="访问时间" autocomplete="off"/>
</div>
<div class="am-para-inline" style="padding-top: 5px;">
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="weeks">本周</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="month">本月</a>
</div>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;">
<div class="am-form-group fl ml30">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
</div>
</div>
</form>
<div class="coms-table-bd">
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
<table class="am-table am-table-bordered table-hover fixed">
<thead>
<tr>
<th width="15%"><span>门店</span></th>
<th width="10%"><span>用户</span></th>
<th width="12%"><span>访问接口</span></th>
<!--
<th width=""><span>访问接口</span></th>
-->
<th width="15%"><span>访问时间</span></th>
</tr>
</thead>
<tbody>
<template v-for="(item, index) in lists" :key="item.id">
<tr>
<td style="vertical-align: middle;">{{ item.biz_name }}</td>
<td style="vertical-align: middle;">{{ item.username }}</td>
<td style="vertical-align: middle;">{{ item.title }}</td>
<!--
<td style="vertical-align: middle;overflow: hidden;text-overflow: ellipsis;">{{ item.url }}
</td>
-->
<td style="vertical-align: middle;">{{ item.createTime}}</td>
</tr>
</template>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="hander am-form">
</div>
<div class="coms-pagination fr mr20">
<? page_view($pager) ?>
</div>
</div>
</div>
<script>
$(function () {
vue_obj = new Vue({
el: '#vue-app',
data: {
lists: [],
type: <?=$params['type'] ? $params['type'] : 0?>,
typeAry: <?=$typeAry ? json_encode($typeAry) : '[]'?>,
},
mounted: function () {
this.lists = <?= json_encode($lists, JSON_UNESCAPED_UNICODE) ?>;
},
methods: {
// reset() {
//
// }
},
watch: {}
});
<?php page_script($pager) ?>
});
require(['laydate', 'autocomplete'], function (laydate) {
laydate.render({
elem: '#id-create-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', nowDate = new Date();
var beginDate = '', endDate = '';
switch (type) {
case 'today':
beginDate = endDate = nowDate.Format('yyyy-MM-dd');
break;
case 'yesterday':
beginDate = endDate = (new Date(nowDate.getTime() - 86400000)).Format('yyyy-MM-dd');
break;
case 'weeks':
nowDate.setDate(nowDate.getDate() - nowDate.getDay() + 1);
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
nowDate.setDate(nowDate.getDate() + 6);
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
break;
case 'month':
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-01";
var day = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, 0);
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + day.getDate();
break;
}
date = beginDate + ' ~ ' + endDate;
$('#id-create-time').val(date);
});
});
</script>
-6
View File
@@ -1,6 +0,0 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
-11
View File
@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
-5
View File
@@ -1,5 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$config = array();
-135
View File
@@ -1,135 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it. This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Drivers
| 4. Helper files
| 5. Custom config files
| 6. Language files
| 7. Models
|
*/
/*
| -------------------------------------------------------------------
| Auto-load Packages
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in system/libraries/ or your
| application/libraries/ directory, with the addition of the
| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('database','myResponse');
/*
| -------------------------------------------------------------------
| Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in system/libraries/ or in your
| application/libraries/ directory, but are also placed inside their
| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
| $autoload['drivers'] = array('cache');
|
| You can also supply an alternative property name to be assigned in
| the controller:
|
| $autoload['drivers'] = array('cache' => 'cch');
|
*/
$autoload['drivers'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('comm', 'url', 'array','order','authorization');
/*
| -------------------------------------------------------------------
| Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files. Otherwise, leave it blank.
|
*/
$autoload['config'] = array('jwt');
/*
| -------------------------------------------------------------------
| Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
$autoload['language'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['model'] = array('first_model', 'second_model');
|
| You can also supply an alternative model name to be assigned
| in the controller:
|
| $autoload['model'] = array('first_model' => 'first');
*/
$autoload['model'] = array();
-523
View File
@@ -1,523 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = 'http://market.dev.liche.cn/';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = TRUE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/core_classes.html
| https://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'HD_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = COMMPATH.'/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Allow $_GET array
|--------------------------------------------------------------------------
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['allow_get_array'] = TRUE;
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
| array(2) = Debug Messages, without Error Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 1;
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ directory. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
/*
|--------------------------------------------------------------------------
| Log File Extension
|--------------------------------------------------------------------------
|
| The default filename extension for log files. The default 'php' allows for
| protecting the log files via basic scripting, when they are to be stored
| under a publicly accessible directory.
|
| Note: Leaving it blank will default to 'php'.
|
*/
$config['log_file_extension'] = '';
/*
|--------------------------------------------------------------------------
| Log File Permissions
|--------------------------------------------------------------------------
|
| The file system permissions to be applied on newly created log files.
|
| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
| integer notation (i.e. 0700, 0644, etc.)
*/
$config['log_file_permissions'] = 0644;
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
/*
|--------------------------------------------------------------------------
| Error Views Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/views/errors/ directory. Use a full server path with trailing slash.
|
*/
$config['error_views_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/cache/ directory. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Include Query String
|--------------------------------------------------------------------------
|
| Whether to take the URL query string into consideration when generating
| output cache files. Valid options are:
|
| FALSE = Disabled
| TRUE = Enabled, take all query parameters into account.
| Please be aware that this may result in numerous cache
| files generated for the same page over and over again.
| array('q') = Enabled, but only take into account the specified list
| of query parameters.
|
*/
$config['cache_query_string'] = FALSE;
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class, you must set an encryption key.
| See the user guide for more info.
|
| https://codeigniter.com/user_guide/libraries/encryption.html
|
*/
$config['encryption_key'] = 'market.ai';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_driver'
|
| The storage driver to use: files, database, redis, memcached
|
| 'sess_cookie_name'
|
| The session cookie name, must contain only [0-9a-z_-] characters
|
| 'sess_expiration'
|
| The number of SECONDS you want the session to last.
| Setting to 0 (zero) means expire when the browser is closed.
|
| 'sess_save_path'
|
| The location to save sessions to, driver dependent.
|
| For the 'files' driver, it's a path to a writable directory.
| WARNING: Only absolute paths are supported!
|
| For the 'database' driver, it's a table name.
| Please read up the manual for the format with other session drivers.
|
| IMPORTANT: You are REQUIRED to set a valid save path!
|
| 'sess_match_ip'
|
| Whether to match the user's IP address when reading the session data.
|
| WARNING: If you're using the database driver, don't forget to update
| your session table's PRIMARY KEY when changing this setting.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_regenerate_destroy'
|
| Whether to destroy session data associated with the old session ID
| when auto-regenerating the session ID. When set to FALSE, the data
| will be later deleted by the garbage collector.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
| Note: These settings (with the exception of 'cookie_prefix' and
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
/*
|--------------------------------------------------------------------------
| Standardize newlines
|--------------------------------------------------------------------------
|
| Determines whether to standardize newline characters in input data,
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['standardize_newlines'] = FALSE;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['global_xss_filtering'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
| 'csrf_regenerate' = Regenerate token on every submission
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads. When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| Only used if zlib.output_compression is turned off in your php.ini.
| Please do not use it together with httpd-level output compression.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or any PHP supported timezone. This preference tells
| the system whether to use your server's local time as the master 'now'
| reference, or convert it to the configured one timezone. See the 'date
| helper' page of the user guide for information regarding date handling.
|
*/
$config['time_reference'] = 'local';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
| Note: You need to have eval() enabled for this to work.
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy
| IP addresses from which CodeIgniter should trust headers such as
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
| the visitor's IP address.
|
| You can use both an array or a comma-separated list of proxy addresses,
| as well as specifying whole subnets. Here are a few examples:
|
| Comma-separated: '10.0.1.200,192.168.5.0/24'
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';
-112
View File
@@ -1,112 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Display Debug backtrace
|--------------------------------------------------------------------------
|
| If set to TRUE, a backtrace will be displayed along with php errors. If
| error_reporting is disabled, the backtrace will not display, regardless
| of this setting
|
*/
defined('SHOW_DEBUG_BACKTRACE') or define('SHOW_DEBUG_BACKTRACE', TRUE);
/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system. The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
*/
defined('FILE_READ_MODE') or define('FILE_READ_MODE', 0644);
defined('FILE_WRITE_MODE') or define('FILE_WRITE_MODE', 0666);
defined('DIR_READ_MODE') or define('DIR_READ_MODE', 0755);
defined('DIR_WRITE_MODE') or define('DIR_WRITE_MODE', 0755);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
defined('FOPEN_READ') or define('FOPEN_READ', 'rb');
defined('FOPEN_READ_WRITE') or define('FOPEN_READ_WRITE', 'r+b');
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') or define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') or define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
defined('FOPEN_WRITE_CREATE') or define('FOPEN_WRITE_CREATE', 'ab');
defined('FOPEN_READ_WRITE_CREATE') or define('FOPEN_READ_WRITE_CREATE', 'a+b');
defined('FOPEN_WRITE_CREATE_STRICT') or define('FOPEN_WRITE_CREATE_STRICT', 'xb');
defined('FOPEN_READ_WRITE_CREATE_STRICT') or define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/*
|--------------------------------------------------------------------------
| Exit Status Codes
|--------------------------------------------------------------------------
|
| Used to indicate the conditions under which the script is exit()ing.
| While there is no universal standard for error codes, there are some
| broad conventions. Three such conventions are mentioned below, for
| those who wish to make use of them. The CodeIgniter defaults were
| chosen for the least overlap with these conventions, while still
| leaving room for others to be defined in future versions and user
| applications.
|
| The three main conventions used for determining exit status codes
| are as follows:
|
| Standard C/C++ Library (stdlibc):
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
| (This link also contains other GNU-specific conventions)
| BSD sysexits.h:
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
| Bash scripting:
| http://tldp.org/LDP/abs/html/exitcodes.html
|
*/
defined('EXIT_SUCCESS') or define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') or define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') or define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') or define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') or define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') or define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') or define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') or define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') or define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') or define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
define('ERR_SYS_SUCCESS', 0);
define('ERR_SYS_FAIL', 9999);
define('ERR_SYS_INVAL_PARAM', 9998);
define('ERR_USER_NOT_LOGIN', 1001);
/*edit by xuxianbin 这边应该是多写了一个*/
//define('ERR_USER_NOT_LOGIN', 1001);
/*edit end*/
define('ERR_USER_LOGIN_FAIL', 1002);
define('ERR_ACCOUNT_NOT_EXISTS', 1021);
define('ERR_PARAMS_ERROR', 1017);
define('TEMP_PATH', APPPATH . '../www/market/api/');
define('AGENT_H5_URL', 'http://www.auto.haodian.cn/'); //h5域名
//新的api接口code规定
defined('API_CODE_SUCCESS') or define('API_CODE_SUCCESS', 200);//成功
defined('API_CODE_FAIL') or define('API_CODE_FAIL', 400);//请求失败
defined('API_CODE_NONE') or define('API_CODE_FORB', 403);//禁止访问
defined('API_CODE_NONE') or define('API_CODE_NONE', 404);//页面不存在
defined('API_CODE_LOGOUT') or define('API_CODE_LOGOUT', 408);//未登录
defined('API_CODE_INVILD_PARAM') or define('API_CODE_INVILD_PARAM', 401);//非法参数
defined('API_CODE_USER_FULL') or define('API_CODE_USER_FULL', 417);//完善用户资料
defined('API_CODE_ORC_FAIL') or define('API_CODE_ORC_FAIL', 418);//图片识别失败
define('HDY_SMS_SIGN', '好店云'); // 短信签名
-117
View File
@@ -1,117 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['dsn'] The full DSN string describe a connection to the database.
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database driver. e.g.: mysqli.
| Currently supported:
| cubrid, ibase, mssql, mysql, mysqli, oci8,
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Query Builder class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['encrypt'] Whether or not to use an encrypted connection.
|
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
| 'ssl_key' - Path to the private key file
| 'ssl_cert' - Path to the public key certificate file
| 'ssl_ca' - Path to the certificate authority file
| 'ssl_capath' - Path to a directory containing trusted CA certificates in PEM format
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not ('mysqli' only)
|
| ['compress'] Whether or not to use client compression (MySQL only)
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
| NOTE: Disabling this will also effectively disable both
| $this->db->last_query() and profiling of DB queries.
| When you run a query, with this setting set to TRUE (default),
| CodeIgniter will store the SQL statement for debugging purposes.
| However, this may cause high memory usage, especially if you run
| a lot of SQL queries ... disable this to avoid that problem.
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $query_builder variables lets you determine whether or not to load
| the query builder class.
*/
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'mysql:host=127.0.0.1;port=3306;dbname=agentdb',
'username' => 'devuser',
'password' => 'DEV@hdy123456',
'database' => 'agentdb',
'dbdriver' => 'pdo',
'dbprefix' => 'lc_',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8mb4',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
$db['ssdb'] = array(
'dsn' => '',
'hostname' => 'mysql:host=127.0.0.1;port=3306;dbname=ssdb',
'username' => 'devuser',
'password' => 'DEV@hdy123456',
'database' => 'ssdb',
'dbdriver' => 'pdo',
'dbprefix' => 'lc_',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8mb4',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
-24
View File
@@ -1,24 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$_doctypes = array(
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">'
);
-103
View File
@@ -1,103 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| Foreign Characters
| -------------------------------------------------------------------
| This file contains an array of foreign characters for transliteration
| conversion used by the Text helper
|
*/
$foreign_characters = array(
'/ä|æ|ǽ/' => 'ae',
'/ö|œ/' => 'oe',
'/ü/' => 'ue',
'/Ä/' => 'Ae',
'/Ü/' => 'Ue',
'/Ö/' => 'Oe',
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A',
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a',
'/Б/' => 'B',
'/б/' => 'b',
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
'/ç|ć|ĉ|ċ|č/' => 'c',
'/Д/' => 'D',
'/д/' => 'd',
'/Ð|Ď|Đ|Δ/' => 'Dj',
'/ð|ď|đ|δ/' => 'dj',
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E',
'/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e',
'/Ф/' => 'F',
'/ф/' => 'f',
'/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G',
'/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g',
'/Ĥ|Ħ/' => 'H',
'/ĥ|ħ/' => 'h',
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I',
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i',
'/Ĵ/' => 'J',
'/ĵ/' => 'j',
'/Ķ|Κ|К/' => 'K',
'/ķ|κ|к/' => 'k',
'/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L',
'/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l',
'/М/' => 'M',
'/м/' => 'm',
'/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N',
'/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n',
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O',
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o',
'/П/' => 'P',
'/п/' => 'p',
'/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R',
'/ŕ|ŗ|ř|ρ|р/' => 'r',
'/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S',
'/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
'/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T',
'/ț|ţ|ť|ŧ|т/' => 't',
'/Þ|þ/' => 'th',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
'/Ƴ|Ɏ|Ỵ|Ẏ|Ӳ|Ӯ|Ў|Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y',
'/ẙ|ʏ|ƴ|ɏ|ỵ|ẏ|ӳ|ӯ|ў|ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y',
'/В/' => 'V',
'/в/' => 'v',
'/Ŵ/' => 'W',
'/ŵ/' => 'w',
'/Ź|Ż|Ž|Ζ|З/' => 'Z',
'/ź|ż|ž|ζ|з/' => 'z',
'/Æ|Ǽ/' => 'AE',
'/ß/' => 'ss',
'/IJ/' => 'IJ',
'/ij/' => 'ij',
'/Œ/' => 'OE',
'/ƒ/' => 'f',
'/ξ/' => 'ks',
'/π/' => 'p',
'/β/' => 'v',
'/μ/' => 'm',
'/ψ/' => 'ps',
'/Ё/' => 'Yo',
'/ё/' => 'yo',
'/Є/' => 'Ye',
'/є/' => 'ye',
'/Ї/' => 'Yi',
'/Ж/' => 'Zh',
'/ж/' => 'zh',
'/Х/' => 'Kh',
'/х/' => 'kh',
'/Ц/' => 'Ts',
'/ц/' => 'ts',
'/Ч/' => 'Ch',
'/ч/' => 'ch',
'/Ш/' => 'Sh',
'/ш/' => 'sh',
'/Щ/' => 'Shch',
'/щ/' => 'shch',
'/Ъ|ъ|Ь|ь/' => '',
'/Ю/' => 'Yu',
'/ю/' => 'yu',
'/Я/' => 'Ya',
'/я/' => 'ya'
);
-20
View File
@@ -1,20 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
| https://codeigniter.com/user_guide/general/hooks.html
|
*/
$hook['post_controller_constructor'] = array(
'class' => 'ApiAuthHook',
'function' => 'index',
'filename' => 'ApiAuthHook.php',
'filepath' => 'hooks',
'params' => []
);
-11
View File
@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
-9
View File
@@ -1,9 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
$config['jwt_key'] = 'yourjwtkey4CITutorial';
$config['jwt_key_pingan'] = 'dvsr23423vsgAEDger';
$config['jwt_key_auto'] = 'zlkEFxfoi7232nAfe';
$config['jwt_algorithm'] = 'HS256';
-19
View File
@@ -1,19 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Memcached settings
| -------------------------------------------------------------------------
| Your Memcached servers can be specified below.
|
| See: https://codeigniter.com/user_guide/libraries/caching.html#memcached
|
*/
$config = array(
'default' => array(
'hostname' => '192.168.0.16',
'port' => '12001',
'weight' => '1',
),
);
-84
View File
@@ -1,84 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Enable/Disable Migrations
|--------------------------------------------------------------------------
|
| Migrations are disabled by default for security reasons.
| You should enable migrations whenever you intend to do a schema migration
| and disable it back when you're done.
|
*/
$config['migration_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migration Type
|--------------------------------------------------------------------------
|
| Migration file names may be based on a sequential identifier or on
| a timestamp. Options are:
|
| 'sequential' = Sequential migration naming (001_add_blog.php)
| 'timestamp' = Timestamp migration naming (20121031104401_add_blog.php)
| Use timestamp format YYYYMMDDHHIISS.
|
| Note: If this configuration value is missing the Migration library
| defaults to 'sequential' for backward compatibility with CI2.
|
*/
$config['migration_type'] = 'timestamp';
/*
|--------------------------------------------------------------------------
| Migrations table
|--------------------------------------------------------------------------
|
| This is the name of the table that will store the current migrations state.
| When migrations runs it will store in a database table which migration
| level the system is at. It then compares the migration level in this
| table to the $config['migration_version'] if they are not the same it
| will migrate up. This must be set.
|
*/
$config['migration_table'] = 'migrations';
/*
|--------------------------------------------------------------------------
| Auto Migrate To Latest
|--------------------------------------------------------------------------
|
| If this is set to TRUE when you load the migrations class and have
| $config['migration_enabled'] set to TRUE the system will auto migrate
| to your latest migration (whatever $config['migration_version'] is
| set to). This way you do not have to call migrations anywhere else
| in your code to have the latest migration.
|
*/
$config['migration_auto_latest'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migrations version
|--------------------------------------------------------------------------
|
| This is used to set migration version that the file system should be on.
| If you run $this->migration->current() this is the version that schema will
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 0;
/*
|--------------------------------------------------------------------------
| Migrations Path
|--------------------------------------------------------------------------
|
| Path to your migrations folder.
| Typically, it will be within your application path.
| Also, writing permission is required within the migrations path.
|
*/
$config['migration_path'] = APPPATH.'migrations/';
-184
View File
@@ -1,184 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
return array(
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
'cpt' => 'application/mac-compactpro',
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => array('application/octet-stream', 'application/x-msdownload'),
'class' => 'application/octet-stream',
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
'ai' => array('application/pdf', 'application/postscript'),
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'gzip' => 'application/x-gzip',
'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => array('application/x-javascript', 'text/plain'),
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => array('audio/x-aiff', 'audio/aiff'),
'aiff' => array('audio/x-aiff', 'audio/aiff'),
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'),
'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'css' => array('text/css', 'text/plain'),
'html' => array('text/html', 'text/plain'),
'htm' => array('text/html', 'text/plain'),
'shtml' => array('text/html', 'text/plain'),
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => array('application/xml', 'text/xml', 'text/plain'),
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
'movie' => 'video/x-sgi-movie',
'doc' => array('application/msword', 'application/vnd.ms-office'),
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
'dot' => array('application/msword', 'application/vnd.ms-office'),
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => array('application/json', 'text/json'),
'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
'p10' => array('application/x-pkcs10', 'application/pkcs10'),
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
'der' => 'application/x-x509-ca-cert',
'kdb' => 'application/octet-stream',
'pgp' => 'application/pgp',
'gpg' => 'application/gpg-keys',
'sst' => 'application/octet-stream',
'csr' => 'application/octet-stream',
'rsa' => 'application/x-pkcs7',
'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
'3g2' => 'video/3gpp2',
'3gp' => array('video/3gp', 'video/3gpp'),
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => array('video/mp4', 'video/x-f4v'),
'flv' => 'video/x-flv',
'webm' => 'video/webm',
'aac' => 'audio/x-acc',
'm4u' => 'application/vnd.mpegurl',
'm3u' => 'text/plain',
'xspf' => 'application/xspf+xml',
'vlc' => 'application/videolan',
'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'),
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
'7zip' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
'vcf' => 'text/x-vcard',
'srt' => array('text/srt', 'text/plain'),
'vtt' => array('text/vtt', 'text/plain'),
'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
'odc' => 'application/vnd.oasis.opendocument.chart',
'otc' => 'application/vnd.oasis.opendocument.chart-template',
'odf' => 'application/vnd.oasis.opendocument.formula',
'otf' => 'application/vnd.oasis.opendocument.formula-template',
'odg' => 'application/vnd.oasis.opendocument.graphics',
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
'odi' => 'application/vnd.oasis.opendocument.image',
'oti' => 'application/vnd.oasis.opendocument.image-template',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
'odt' => 'application/vnd.oasis.opendocument.text',
'odm' => 'application/vnd.oasis.opendocument.text-master',
'ott' => 'application/vnd.oasis.opendocument.text-template',
'oth' => 'application/vnd.oasis.opendocument.text-web'
);
-11
View File
@@ -1,11 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/2
* Time: 14:38
*/
defined('BASEPATH') OR exit('No direct script access allowed');
$config['host'] = '192.168.0.16';
$config['port'] = 27017;
-14
View File
@@ -1,14 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Profiler Sections
| -------------------------------------------------------------------------
| This file lets you determine whether or not various sections of Profiler
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
| https://codeigniter.com/user_guide/general/profiling.html
|
*/
-26
View File
@@ -1,26 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$config['access_key'] = 'Pn60lJXcaOGKvMjn5qv-OMr7wR1lp1p8QG7Ul6NK';
$config['secret_key'] = '83YE_xcHLuejVvbnCiMrMr-CYR7QshBfGgmPSknP';
$config['bucket'] = 'img-liche';
$config['region'] = '华南';
$config['is_https'] = 'https';
$config['domain'] = 'img.liche.cn';
$config['attch'] = 'space/agent';
$config['img']['access_key'] = 'Pn60lJXcaOGKvMjn5qv-OMr7wR1lp1p8QG7Ul6NK';
$config['img']['secret_key'] = '83YE_xcHLuejVvbnCiMrMr-CYR7QshBfGgmPSknP';
$config['img']['bucket'] = 'img-liche';
$config['img']['region'] = '华南';
$config['img']['is_https'] = 'https';
$config['img']['domain'] = 'img.liche.cn';
$config['img']['attch'] = 'space/agent';
$config['video']['access_key'] = 'Pn60lJXcaOGKvMjn5qv-OMr7wR1lp1p8QG7Ul6NK';
$config['video']['secret_key'] = '83YE_xcHLuejVvbnCiMrMr-CYR7QshBfGgmPSknP';
$config['video']['bucket'] = 'media-liche';
$config['video']['region'] = '华南';
$config['video']['is_https'] = 'https';
$config['video']['domain'] = 'media.liche.cn';
$config['video']['attch'] = 'space/agent';
-11
View File
@@ -1,11 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: linfan
* Date: 2018/11/2
* Time: 14:38
*/
defined('BASEPATH') OR exit('No direct script access allowed');
$config['host'] = '127.0.0.1';
$config['port'] = 6679;
-605
View File
@@ -1,605 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| HTTP protocol
|--------------------------------------------------------------------------
|
| Set to force the use of HTTPS for REST API calls
|
*/
$config['force_https'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST Output Format
|--------------------------------------------------------------------------
|
| The default format of the response
|
| 'array': Array data structure
| 'csv': Comma separated file
| 'json': Uses json_encode(). Note: If a GET query string
| called 'callback' is passed, then jsonp will be returned
| 'html' HTML using the table library in CodeIgniter
| 'php': Uses var_export()
| 'serialized': Uses serialize()
| 'xml': Uses simplexml_load_string()
|
*/
$config['rest_default_format'] = 'json';
/*
|--------------------------------------------------------------------------
| REST Supported Output Formats
|--------------------------------------------------------------------------
|
| The following setting contains a list of the supported/allowed formats.
| You may remove those formats that you don't want to use.
| If the default format $config['rest_default_format'] is missing within
| $config['rest_supported_formats'], it will be added silently during
| REST_Controller initialization.
|
*/
$config['rest_supported_formats'] = [
'json',
'array',
'csv',
'html',
'jsonp',
'php',
'serialized',
'xml',
];
/*
|--------------------------------------------------------------------------
| REST Status Field Name
|--------------------------------------------------------------------------
|
| The field name for the status inside the response
|
*/
$config['rest_status_field_name'] = 'status';
/*
|--------------------------------------------------------------------------
| REST Message Field Name
|--------------------------------------------------------------------------
|
| The field name for the message inside the response
|
*/
$config['rest_message_field_name'] = 'error';
/*
|--------------------------------------------------------------------------
| Enable Emulate Request
|--------------------------------------------------------------------------
|
| Should we enable emulation of the request (e.g. used in Mootools request)
|
*/
$config['enable_emulate_request'] = TRUE;
/*
|--------------------------------------------------------------------------
| REST Realm
|--------------------------------------------------------------------------
|
| Name of the password protected REST API displayed on login dialogs
|
| e.g: My Secret REST API
|
*/
$config['rest_realm'] = 'REST API';
/*
|--------------------------------------------------------------------------
| REST Login
|--------------------------------------------------------------------------
|
| Set to specify the REST API requires to be logged in
|
| FALSE No login required
| 'basic' Unsecured login
| 'digest' More secured login
| 'session' Check for a PHP session variable. See 'auth_source' to set the
| authorization key
|
*/
$config['rest_auth'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST Login Source
|--------------------------------------------------------------------------
|
| Is login required and if so, the user store to use
|
| '' Use config based users or wildcard testing
| 'ldap' Use LDAP authentication
| 'library' Use a authentication library
|
| Note: If 'rest_auth' is set to 'session' then change 'auth_source' to the name of the session variable
|
*/
$config['auth_source'] = 'ldap';
/*
|--------------------------------------------------------------------------
| Allow Authentication and API Keys
|--------------------------------------------------------------------------
|
| Where you wish to have Basic, Digest or Session login, but also want to use API Keys (for limiting
| requests etc), set to TRUE;
|
*/
$config['allow_auth_and_keys'] = TRUE;
/*
|--------------------------------------------------------------------------
| REST Login Class and Function
|--------------------------------------------------------------------------
|
| If library authentication is used define the class and function name
|
| The function should accept two parameters: class->function($username, $password)
| In other cases override the function _perform_library_auth in your controller
|
| For digest authentication the library function should return already a stored
| md5(username:restrealm:password) for that username
|
| e.g: md5('admin:REST API:1234') = '1e957ebc35631ab22d5bd6526bd14ea2'
|
*/
$config['auth_library_class'] = '';
$config['auth_library_function'] = '';
/*
|--------------------------------------------------------------------------
| Override auth types for specific class/method
|--------------------------------------------------------------------------
|
| Set specific authentication types for methods within a class (controller)
|
| Set as many config entries as needed. Any methods not set will use the default 'rest_auth' config value.
|
| e.g:
|
| $config['auth_override_class_method']['deals']['view'] = 'none';
| $config['auth_override_class_method']['deals']['insert'] = 'digest';
| $config['auth_override_class_method']['accounts']['user'] = 'basic';
| $config['auth_override_class_method']['dashboard']['*'] = 'none|digest|basic';
|
| Here 'deals', 'accounts' and 'dashboard' are controller names, 'view', 'insert' and 'user' are methods within. An asterisk may also be used to specify an authentication method for an entire classes methods. Ex: $config['auth_override_class_method']['dashboard']['*'] = 'basic'; (NOTE: leave off the '_get' or '_post' from the end of the method name)
| Acceptable values are; 'none', 'digest' and 'basic'.
|
*/
// $config['auth_override_class_method']['deals']['view'] = 'none';
// $config['auth_override_class_method']['deals']['insert'] = 'digest';
// $config['auth_override_class_method']['accounts']['user'] = 'basic';
// $config['auth_override_class_method']['dashboard']['*'] = 'basic';
// ---Uncomment list line for the wildard unit test
// $config['auth_override_class_method']['wildcard_test_cases']['*'] = 'basic';
/*
|--------------------------------------------------------------------------
| Override auth types for specific 'class/method/HTTP method'
|--------------------------------------------------------------------------
|
| example:
|
| $config['auth_override_class_method_http']['deals']['view']['get'] = 'none';
| $config['auth_override_class_method_http']['deals']['insert']['post'] = 'none';
| $config['auth_override_class_method_http']['deals']['*']['options'] = 'none';
*/
// ---Uncomment list line for the wildard unit test
// $config['auth_override_class_method_http']['wildcard_test_cases']['*']['options'] = 'basic';
/*
|--------------------------------------------------------------------------
| REST Login Usernames
|--------------------------------------------------------------------------
|
| Array of usernames and passwords for login, if ldap is configured this is ignored
|
*/
$config['rest_valid_logins'] = ['admin' => '1234'];
/*
|--------------------------------------------------------------------------
| Global IP White-listing
|--------------------------------------------------------------------------
|
| Limit connections to your REST server to White-listed IP addresses
|
| Usage:
| 1. Set to TRUE and select an auth option for extreme security (client's IP
| address must be in white-list and they must also log in)
| 2. Set to TRUE with auth set to FALSE to allow White-listed IPs access with no login
| 3. Set to FALSE but set 'auth_override_class_method' to 'white-list' to
| restrict certain methods to IPs in your white-list
|
*/
$config['rest_ip_whitelist_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST Handle Exceptions
|--------------------------------------------------------------------------
|
| Handle exceptions caused by the controller
|
*/
$config['rest_handle_exceptions'] = TRUE;
/*
|--------------------------------------------------------------------------
| REST IP White-list
|--------------------------------------------------------------------------
|
| Limit connections to your REST server with a comma separated
| list of IP addresses
|
| e.g: '123.456.789.0, 987.654.32.1'
|
| 127.0.0.1 and 0.0.0.0 are allowed by default
|
*/
$config['rest_ip_whitelist'] = '';
/*
|--------------------------------------------------------------------------
| Global IP Blacklisting
|--------------------------------------------------------------------------
|
| Prevent connections to the REST server from blacklisted IP addresses
|
| Usage:
| 1. Set to TRUE and add any IP address to 'rest_ip_blacklist'
|
*/
$config['rest_ip_blacklist_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST IP Blacklist
|--------------------------------------------------------------------------
|
| Prevent connections from the following IP addresses
|
| e.g: '123.456.789.0, 987.654.32.1'
|
*/
$config['rest_ip_blacklist'] = '';
/*
|--------------------------------------------------------------------------
| REST Database Group
|--------------------------------------------------------------------------
|
| Connect to a database group for keys, logging, etc. It will only connect
| if you have any of these features enabled
|
*/
$config['rest_database_group'] = 'default';
/*
|--------------------------------------------------------------------------
| REST API Keys Table Name
|--------------------------------------------------------------------------
|
| The table name in your database that stores API keys
|
*/
$config['rest_keys_table'] = 'keys';
/*
|--------------------------------------------------------------------------
| REST Enable Keys
|--------------------------------------------------------------------------
|
| When set to TRUE, the REST API will look for a column name called 'key'.
| If no key is provided, the request will result in an error. To override the
| column name see 'rest_key_column'
|
| Default table schema:
| CREATE TABLE `keys` (
| `id` INT(11) NOT NULL AUTO_INCREMENT,
| `user_id` INT(11) NOT NULL,
| `key` VARCHAR(40) NOT NULL,
| `level` INT(2) NOT NULL,
| `ignore_limits` TINYINT(1) NOT NULL DEFAULT '0',
| `is_private_key` TINYINT(1) NOT NULL DEFAULT '0',
| `ip_addresses` TEXT NULL DEFAULT NULL,
| `date_created` INT(11) NOT NULL,
| PRIMARY KEY (`id`)
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
*/
$config['rest_enable_keys'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST Table Key Column Name
|--------------------------------------------------------------------------
|
| If not using the default table schema in 'rest_enable_keys', specify the
| column name to match e.g. my_key
|
*/
$config['rest_key_column'] = 'key';
/*
|--------------------------------------------------------------------------
| REST API Limits method
|--------------------------------------------------------------------------
|
| Specify the method used to limit the API calls
|
| Available methods are :
| $config['rest_limits_method'] = 'IP_ADDRESS'; // Put a limit per ip address
| $config['rest_limits_method'] = 'API_KEY'; // Put a limit per api key
| $config['rest_limits_method'] = 'METHOD_NAME'; // Put a limit on method calls
| $config['rest_limits_method'] = 'ROUTED_URL'; // Put a limit on the routed URL
|
*/
$config['rest_limits_method'] = 'ROUTED_URL';
/*
|--------------------------------------------------------------------------
| REST Key Length
|--------------------------------------------------------------------------
|
| Length of the created keys. Check your default database schema on the
| maximum length allowed
|
| Note: The maximum length is 40
|
*/
$config['rest_key_length'] = 40;
/*
|--------------------------------------------------------------------------
| REST API Key Variable
|--------------------------------------------------------------------------
|
| Custom header to specify the API key
| Note: Custom headers with the X- prefix are deprecated as of
| 2012/06/12. See RFC 6648 specification for more details
|
*/
$config['rest_key_name'] = 'X-API-KEY';
/*
|--------------------------------------------------------------------------
| REST Enable Logging
|--------------------------------------------------------------------------
|
| When set to TRUE, the REST API will log actions based on the column names 'key', 'date',
| 'time' and 'ip_address'. This is a general rule that can be overridden in the
| $this->method array for each controller
|
| Default table schema:
| CREATE TABLE `logs` (
| `id` INT(11) NOT NULL AUTO_INCREMENT,
| `uri` VARCHAR(255) NOT NULL,
| `method` VARCHAR(6) NOT NULL,
| `params` TEXT DEFAULT NULL,
| `api_key` VARCHAR(40) NOT NULL,
| `ip_address` VARCHAR(45) NOT NULL,
| `time` INT(11) NOT NULL,
| `rtime` FLOAT DEFAULT NULL,
| `authorized` VARCHAR(1) NOT NULL,
| `response_code` smallint(3) DEFAULT '0',
| PRIMARY KEY (`id`)
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
*/
$config['rest_enable_logging'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST API Logs Table Name
|--------------------------------------------------------------------------
|
| If not using the default table schema in 'rest_enable_logging', specify the
| table name to match e.g. my_logs
|
*/
$config['rest_logs_table'] = 'logs';
/*
|--------------------------------------------------------------------------
| REST Method Access Control
|--------------------------------------------------------------------------
| When set to TRUE, the REST API will check the access table to see if
| the API key can access that controller. 'rest_enable_keys' must be enabled
| to use this
|
| Default table schema:
| CREATE TABLE `access` (
| `id` INT(11) unsigned NOT NULL AUTO_INCREMENT,
| `key` VARCHAR(40) NOT NULL DEFAULT '',
| `all_access` TINYINT(1) NOT NULL DEFAULT '0',
| `controller` VARCHAR(50) NOT NULL DEFAULT '',
| `date_created` DATETIME DEFAULT NULL,
| `date_modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
| PRIMARY KEY (`id`)
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
*/
$config['rest_enable_access'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST API Access Table Name
|--------------------------------------------------------------------------
|
| If not using the default table schema in 'rest_enable_access', specify the
| table name to match e.g. my_access
|
*/
$config['rest_access_table'] = 'access';
/*
|--------------------------------------------------------------------------
| REST API Param Log Format
|--------------------------------------------------------------------------
|
| When set to TRUE, the REST API log parameters will be stored in the database as JSON
| Set to FALSE to log as serialized PHP
|
*/
$config['rest_logs_json_params'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST Enable Limits
|--------------------------------------------------------------------------
|
| When set to TRUE, the REST API will count the number of uses of each method
| by an API key each hour. This is a general rule that can be overridden in the
| $this->method array in each controller
|
| Default table schema:
| CREATE TABLE `limits` (
| `id` INT(11) NOT NULL AUTO_INCREMENT,
| `uri` VARCHAR(255) NOT NULL,
| `count` INT(10) NOT NULL,
| `hour_started` INT(11) NOT NULL,
| `api_key` VARCHAR(40) NOT NULL,
| PRIMARY KEY (`id`)
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| To specify the limits within the controller's __construct() method, add per-method
| limits with:
|
| $this->method['METHOD_NAME']['limit'] = [NUM_REQUESTS_PER_HOUR];
|
| See application/controllers/api/example.php for examples
*/
$config['rest_enable_limits'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST API Limits Table Name
|--------------------------------------------------------------------------
|
| If not using the default table schema in 'rest_enable_limits', specify the
| table name to match e.g. my_limits
|
*/
$config['rest_limits_table'] = 'limits';
/*
|--------------------------------------------------------------------------
| REST Ignore HTTP Accept
|--------------------------------------------------------------------------
|
| Set to TRUE to ignore the HTTP Accept and speed up each request a little.
| Only do this if you are using the $this->rest_format or /format/xml in URLs
|
*/
$config['rest_ignore_http_accept'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST AJAX Only
|--------------------------------------------------------------------------
|
| Set to TRUE to allow AJAX requests only. Set to FALSE to accept HTTP requests
|
| Note: If set to TRUE and the request is not AJAX, a 505 response with the
| error message 'Only AJAX requests are accepted.' will be returned.
|
| Hint: This is good for production environments
|
*/
$config['rest_ajax_only'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST Language File
|--------------------------------------------------------------------------
|
| Language file to load from the language directory
|
*/
$config['rest_language'] = 'zh';
/*
|--------------------------------------------------------------------------
| CORS Check
|--------------------------------------------------------------------------
|
| Set to TRUE to enable Cross-Origin Resource Sharing (CORS). Useful if you
| are hosting your API on a different domain from the application that
| will access it through a browser
|
*/
$config['check_cors'] = TRUE;
/*
|--------------------------------------------------------------------------
| CORS Allowable Headers
|--------------------------------------------------------------------------
|
| If using CORS checks, set the allowable headers here
|
*/
$config['allowed_cors_headers'] = [
'Origin',
'X-Requested-With',
'Content-Type',
'Accept',
'Access-Control-Request-Method'
];
/*
|--------------------------------------------------------------------------
| CORS Allowable Methods
|--------------------------------------------------------------------------
|
| If using CORS checks, you can set the methods you want to be allowed
|
*/
$config['allowed_cors_methods'] = [
'GET',
'POST',
'OPTIONS',
'PUT',
'PATCH',
'DELETE'
];
/*
|--------------------------------------------------------------------------
| CORS Allow Any Domain
|--------------------------------------------------------------------------
|
| Set to TRUE to enable Cross-Origin Resource Sharing (CORS) from any
| source domain
|
*/
$config['allow_any_cors_domain'] = TRUE;
/*
|--------------------------------------------------------------------------
| CORS Allowable Domains
|--------------------------------------------------------------------------
|
| Used if $config['check_cors'] is set to TRUE and $config['allow_any_cors_domain']
| is set to FALSE. Set all the allowable domains within the array
|
| e.g. $config['allowed_origins'] = ['http://www.example.com', 'https://spa.example.com']
|
*/
$config['allowed_cors_origins'] = [];
-54
View File
@@ -1,54 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| https://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There are three reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
| $route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
-64
View File
@@ -1,64 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| SMILEYS
| -------------------------------------------------------------------
| This file contains an array of smileys for use with the emoticon helper.
| Individual images can be used to replace multiple smileys. For example:
| :-) and :) use the same image replacement.
|
| Please see user guide for more info:
| https://codeigniter.com/user_guide/helpers/smiley_helper.html
|
*/
$smileys = array(
// smiley image name width height alt
':-)' => array('grin.gif', '19', '19', 'grin'),
':lol:' => array('lol.gif', '19', '19', 'LOL'),
':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
':)' => array('smile.gif', '19', '19', 'smile'),
';-)' => array('wink.gif', '19', '19', 'wink'),
';)' => array('wink.gif', '19', '19', 'wink'),
':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
':-S' => array('confused.gif', '19', '19', 'confused'),
':wow:' => array('surprise.gif', '19', '19', 'surprised'),
':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
'%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
':P' => array('raspberry.gif', '19', '19', 'raspberry'),
':blank:' => array('blank.gif', '19', '19', 'blank stare'),
':long:' => array('longface.gif', '19', '19', 'long face'),
':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
'8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
':down:' => array('downer.gif', '19', '19', 'downer'),
':red:' => array('embarrassed.gif', '19', '19', 'red face'),
':sick:' => array('sick.gif', '19', '19', 'sick'),
':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
':-/' => array('hmm.gif', '19', '19', 'hmmm'),
'>:(' => array('mad.gif', '19', '19', 'mad'),
':mad:' => array('mad.gif', '19', '19', 'mad'),
'>:-(' => array('angry.gif', '19', '19', 'angry'),
':angry:' => array('angry.gif', '19', '19', 'angry'),
':zip:' => array('zip.gif', '19', '19', 'zipper'),
':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
':ahhh:' => array('shock.gif', '19', '19', 'shock'),
':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
':snake:' => array('snake.gif', '19', '19', 'snake'),
':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'),
':question:' => array('question.gif', '19', '19', 'question')
);
-6
View File
@@ -1,6 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$config['host'] = '192.168.0.16';
$config['port'] = 9512;
$config['SPHINX_MAX_MATCHES'] = '2000';
-214
View File
@@ -1,214 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| USER AGENT TYPES
| -------------------------------------------------------------------
| This file contains four arrays of user agent data. It is used by the
| User Agent Class to help identify browser, platform, robot, and
| mobile device data. The array keys are used to identify the device
| and the array values are used to set the actual name of the item.
*/
$platforms = array(
'windows nt 10.0' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1',
'windows nt 6.2' => 'Windows 8',
'windows nt 6.1' => 'Windows 7',
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.1' => 'Windows XP',
'windows nt 5.0' => 'Windows 2000',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows phone' => 'Windows Phone',
'windows' => 'Unknown Windows OS',
'android' => 'Android',
'blackberry' => 'BlackBerry',
'iphone' => 'iOS',
'ipad' => 'iOS',
'ipod' => 'iOS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS',
'symbian' => 'Symbian OS'
);
// The order of this array should NOT be changed. Many browsers return
// multiple browser types so we want to identify the sub-type first.
$browsers = array(
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Edge',
'Chrome' => 'Chrome',
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
'Opera.*?Version' => 'Opera',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Trident.* rv' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Safari' => 'Safari',
'Mozilla' => 'Mozilla',
'Konqueror' => 'Konqueror',
'icab' => 'iCab',
'Lynx' => 'Lynx',
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse',
'Maxthon' => 'Maxthon',
'Ubuntu' => 'Ubuntu Web Browser'
);
$mobiles = array(
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
// Phones and Manufacturers
'motorola' => 'Motorola',
'nokia' => 'Nokia',
'palm' => 'Palm',
'iphone' => 'Apple iPhone',
'ipad' => 'iPad',
'ipod' => 'Apple iPod Touch',
'sony' => 'Sony Ericsson',
'ericsson' => 'Sony Ericsson',
'blackberry' => 'BlackBerry',
'cocoon' => 'O2 Cocoon',
'blazer' => 'Treo',
'lg' => 'LG',
'amoi' => 'Amoi',
'xda' => 'XDA',
'mda' => 'MDA',
'vario' => 'Vario',
'htc' => 'HTC',
'samsung' => 'Samsung',
'sharp' => 'Sharp',
'sie-' => 'Siemens',
'alcatel' => 'Alcatel',
'benq' => 'BenQ',
'ipaq' => 'HP iPaq',
'mot-' => 'Motorola',
'playstation portable' => 'PlayStation Portable',
'playstation 3' => 'PlayStation 3',
'playstation vita' => 'PlayStation Vita',
'hiptop' => 'Danger Hiptop',
'nec-' => 'NEC',
'panasonic' => 'Panasonic',
'philips' => 'Philips',
'sagem' => 'Sagem',
'sanyo' => 'Sanyo',
'spv' => 'SPV',
'zte' => 'ZTE',
'sendo' => 'Sendo',
'nintendo dsi' => 'Nintendo DSi',
'nintendo ds' => 'Nintendo DS',
'nintendo 3ds' => 'Nintendo 3DS',
'wii' => 'Nintendo Wii',
'open web' => 'Open Web',
'openweb' => 'OpenWeb',
// Operating Systems
'android' => 'Android',
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => 'Palm',
'series60' => 'Symbian S60',
'windows ce' => 'Windows CE',
// Browsers
'obigo' => 'Obigo',
'netfront' => 'Netfront Browser',
'openwave' => 'Openwave Browser',
'mobilexplorer' => 'Mobile Explorer',
'operamini' => 'Opera Mini',
'opera mini' => 'Opera Mini',
'opera mobi' => 'Opera Mobile',
'fennec' => 'Firefox Mobile',
// Other
'digital paths' => 'Digital Paths',
'avantgo' => 'AvantGo',
'xiino' => 'Xiino',
'novarra' => 'Novarra Transcoder',
'vodafone' => 'Vodafone',
'docomo' => 'NTT DoCoMo',
'o2' => 'O2',
// Fallback
'mobile' => 'Generic Mobile',
'wireless' => 'Generic Mobile',
'j2me' => 'Generic Mobile',
'midp' => 'Generic Mobile',
'cldc' => 'Generic Mobile',
'up.link' => 'Generic Mobile',
'up.browser' => 'Generic Mobile',
'smartphone' => 'Generic Mobile',
'cellphone' => 'Generic Mobile'
);
// There are hundreds of bots but these are the most common.
$robots = array(
'googlebot' => 'Googlebot',
'msnbot' => 'MSNBot',
'baiduspider' => 'Baiduspider',
'bingbot' => 'Bing',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'ask jeeves' => 'Ask Jeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos',
'yandex' => 'YandexBot',
'mediapartners-google' => 'MediaPartners Google',
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
'adsbot-google' => 'AdsBot Google',
'feedfetcher-google' => 'Feedfetcher Google',
'curious george' => 'Curious George',
'ia_archiver' => 'Alexa Crawler',
'MJ12bot' => 'Majestic-12',
'Uptimebot' => 'Uptimebot'
);
-9
View File
@@ -1,9 +0,0 @@
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
//服务号-车卖场
$config['default']['appid'] = 'wx42cfb5a705233394';
$config['default']['appSecret'] = 'a34f842ce9ad0f3ec732590e36e15c10';
//测试号
//$config['default']['appid'] = 'wx10561f0e5ea2951f';
//$config['default']['appSecret'] = '25874b9592b5b89f6ca4c3f508aec214';
-12
View File
@@ -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';
-203
View File
@@ -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);
}
}
-12
View File
@@ -1,12 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/BaseCommon.php';
class Common extends BaseCommon
{
public function __construct()
{
parent::__construct();
}
}
-16
View File
@@ -1,16 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
echo "<h1>agent_admin</h1>";exit;
$this->load->view('welcome_message');
}
public function test()
{
echo '333';
}
}
@@ -1,110 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'libraries/REST_Controller.php';
use Restserver\Libraries\REST_Controller;
/**
* Notes:基本控制器
* Created on: 2022/9/2 16:57
* Created by: dengbw
*/
abstract class BaseController extends REST_Controller
{
protected $inputs;
protected $start_time;
const CF2_PRODUCT = 39; //二级来源车型
const CF2_ACTIVITY = 40; //二级来源活动
const APP_ID = 1; //应用id
public function __construct()
{
parent::__construct();
$this->input_param();
$this->start_time = microtime(true);
}
/**
* Notes:获取参数
* Created on: 2022/9/2 16:57
* Created by: dengbw
* @param string $key
* @return mixed
*/
function input_param($key = '')
{
if ($key) {
return $this->inputs[$key];
}
$request = $this->input->method();
switch ($request) {
case 'post':
case 'put':
case 'delete':
$input = json_decode(file_get_contents('php://input'), true);
break;
default:
$input = $this->input->get();
}
$this->inputs = $input;
return $this->inputs;
}
/**
* Notes:返回json
* Created on: 2022/9/8 15:35
* Created by: dengbw
* @param string $message
* @param int $code
*/
public function return_json($message = '', $code = 1)
{
header('Content-Type:application/json; charset=utf-8');
echo json_encode(['code' => $code, 'message' => $message], JSON_UNESCAPED_UNICODE);
exit();
}
/**
* Notes:返回response
* Created on: 2022/9/9 15:39
* Created by: dengbw
* @param array $data
*/
public function return_response_list($data = [])
{
$this->return_response($data, '操作成功', 0, 1);
}
/**
* Notes:返回response
* Created on: 2022/9/8 15:21
* Created by: dengbw
* @param array $data
* @param string $message
* @param int $code
* @param int $if_list
* @param int $http_code
*/
public function return_response($data = [], $message = '操作成功', $code = 0, $if_list = 0, $http_code = REST_Controller::HTTP_OK)
{
$set_data = ['code' => $code, 'message' => $message];
if ($if_list) {//列表显示空数据
$set_data['data'] = $data;
} else {
$data && $set_data['data'] = $data;
}
if ($_SESSION['operation_description']) {//添加操作日志
$this->load->library('api/record');
$method = lcfirst(get_class($this));
$end_time = microtime(true);
$spendTime = ($end_time - $this->start_time) * 1000; //计算差值 毫秒
$this->record->operationRecord(['userId' => $_SESSION['userId'], 'username' => $_SESSION['username']
, 'nickname' => $_SESSION['nickname'], 'method' => $method, 'spendTime' => $spendTime
, 'module' => $_SESSION['operation_module'], 'description' => $_SESSION['operation_description']
, 'params' => json_encode($this->inputs, JSON_UNESCAPED_UNICODE)
, 'result' => json_encode($set_data, JSON_UNESCAPED_UNICODE)]);
}
$this->response($set_data, $http_code, TRUE);
}
}
-43
View File
@@ -1,43 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:生成验证码
* Created on: 2022/8/29 17:15
* Created by: dengbw
*/
class Captcha extends BaseController
{
private $redis;
public function __construct()
{
parent::__construct();
$this->redis = &load_cache('redis');
}
public function index_get()
{
$this->load->library('MyCaptcha');
$myCaptcha = new MyCaptcha();
$re = $myCaptcha->create(5, ['width' => 16, 'height' => 20, 'pnum' => 50, 'base64' => 1]);
$code_key = $this->generateSign();
$this->redis->save($code_key, $re['text'], 5 * 60);
$data = ['base64' => $re['base64'], 'code_key' => $code_key];
$this->return_response($data);
}
function generateSign()
{
$sign = md5(mt_rand() . 'mycaptchamarket');
// 拼接上签名作为 Redis 的 key
$key = 'code_' . $sign;
if ($this->redis->exists($key)) {
// 如果生成的 Sign 已存在,就进行递归,直到生成出一个不存在的。
return $this->generateSign();
}
return $key;
}
}
-12
View File
@@ -1,12 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/BaseCommon.php';
class Common extends BaseCommon
{
public function __construct()
{
parent::__construct();
}
}
-185
View File
@@ -1,185 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:登录操作
* Created on: 2022/8/29 17:15
* Created by: dengbw
*/
class Login extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sys_admin_model', 'mdSysAdmin');
$this->load->model('agent/admin/Market_sys_role_model', 'mdSysRole');
$this->load->model('agent/admin/Market_sys_menu_model', 'mdSysMenu');
$this->load->model('agent/admin/Market_sys_login_record_model', 'mdSysLoginRecord');
}
public function index_get()
{
}
/**
* Notes:用户登录
* Created on: 2022/9/8 14:49
* Created by: dengbw
*/
public function index_post()
{
$username = $this->input_param('username');
$password = $this->input_param('password');
$code = $this->input_param('code');
$code_key = $this->input_param('code_key');
if (!$username) {
$this->return_json('请输入登录账号');
}
if (!$password) {
$this->return_json('请输入登录密码');
}
if (!$code) {
$this->return_json('请输入验证码');
}
$redis = &load_cache('redis');
if (!$redis->get($code_key)) {
$this->return_json('验证码已过期');
}
if ($redis->get($code_key) != $code) {
$this->return_json('验证码错误');
}
$re = $this->mdSysAdmin->get(["username like '{$username}'" => null, 'status' => 0]);
if (!$re) {
$this->return_json('账号不存在');
return;
}
$this->load->library('api/record');
if (!password_verify($password, $re['password'])) {
$message = '密码错误';
$this->record->loginRecord(['userId' => $re['userId'], 'username' => $re['username'], 'nickname' => $re['nickname']
, 'loginType' => 1, 'comments' => $message]);
$this->return_json($message);
}
$user = ['userId' => $re['userId'], 'username' => $re['username'], 'nickname' => $re['nickname']
, 'avatar' => "https://qs.liche.cn/web/images/project/H5-ShiYu/default-avatar.jpg?v=1"
, 'sex' => $re['sex'], 'phone' => $re['phone'], 'introduction' => $re['introduction'], 'email' => $re['email']
, 'enabled' => true, 'accountNonLocked' => true, 'credentialsNonExpired' => true, 'accountNonExpired' => true];
$roles = $authorities = [];
if ($re['roleId']) {
$re_ro = $this->mdSysRole->get(['roleId' => $re['roleId'], 'status' => 0]);
if ($re_ro) {
$re_ro['userId'] = $re['userId'];
$roles[] = $re_ro;
if ($re_ro['menuIds']) {
$authorities = $this->mdSysMenu->select(["menuId in({$re_ro['menuIds']})" => null, 'status' => 0]
, 'sortNumber asc,menuId desc');
foreach ($authorities as $k => $v) {
$authorities[$k]['menuId'] = intval($v['menuId']);
$authorities[$k]['parentId'] = intval($v['parentId']);
$authorities[$k]['menuType'] = intval($v['menuType']);
$authorities[$k]['openType'] = intval($v['openType']);
$authorities[$k]['sortNumber'] = intval($v['sortNumber']);
$authorities[$k]['hide'] = intval($v['hide']);
$authorities[$k]['meta'] = json_decode($v['meta'], true);
}
}
}
}
$user['roles'] = $roles;
$user['authorities'] = $authorities;
$data['access_token'] = generateToken($re['userId']);
$data['user'] = $user;
$this->record->loginRecord(['userId' => $re['userId'], 'username' => $re['username'], 'nickname' => $re['nickname']]);
$redis->delete($code_key);//删除验证码
$this->return_response($data, '登录成功');
}
/**
* Notes:获取手机验证码
* Created on: 2022/10/13 16:54
* Created by: dengbw
*/
public function code_get()
{
$phone = $this->input_param('phone');
if (!$phone) {
$this->return_json('请输入绑定手机号');
}
$re = $this->mdSysAdmin->get(["phone" => $phone, 'status' => 0]);
if (!$re) {
$this->return_json('绑定手机号不存在');
return;
}
$code = rand(100000, 999999);
$redis = &load_cache('redis');
$redis->save($phone, $code, 10 * 60);
//send_sms($phone, $code);
$this->return_response(['code'=>$code], '短信验证码发送成功, 请注意查收!');
}
/**
* Notes:忘记密码
* Created on: 2022/10/13 15:34
* Created by: dengbw
*/
public function forget_post()
{
$phone = $this->input_param('phone');
$password = $this->input_param('password');
$password2 = $this->input_param('password2');
$code = $this->input_param('code');
if (!$phone) {
$this->return_json('请输入绑定手机号');
}
if (!$password) {
$this->return_json('请输入新的登录密码');
}
if (!$password2) {
$this->return_json('请再次输入登录密码');
}
if (mb_strlen($password) < 4) {
$this->return_json('请输入至少4个字符的新密码');
}
if ($password != $password2) {
$this->return_json('两次输入密码不一致');
}
if (!$code) {
$this->return_json('请输入验证码');
}
$redis = &load_cache('redis');
if (!$redis->get($phone)) {
$this->return_json('验证码已过期');
}
if ($redis->get($phone) != $code) {
$this->return_json('验证码错误');
}
$upDate['password'] = password_hash($password, PASSWORD_BCRYPT);
$this->mdSysAdmin->update($upDate, ['phone' => $phone, 'status' => 0]);
$redis->delete($phone);//删除验证码
$this->return_response([], '密码修改成功');
}
/**
* Notes:
* Created on: 2022/8/29 17:06
* Created by: dengbw
* http://market.dev.liche.cn/api/login/test
* http://market.liche.cn/api/login/test
*/
public function test()
{
//echo config('ele_admin.API_KEY');
$mobile = '13860164563';
$signer = new Lcobucci\JWT\Signer\Hmac\Sha256();//加密算法
$time = time();
$key = new Lcobucci\JWT\Signer\Key('market');
$token = (new Lcobucci\JWT\Builder())->issuedBy('http://market.dev.liche.cn')
->identifiedBy('4f1g23a12aa', true)//身份验证
->issuedAt($time)//签发时间
->expiresAt($time + 60)//多长时间以后才能用token,60秒以后才能用
->withClaim('mobile', $mobile)
->getToken($signer, $key);//配置项
echo 'token=' . $token;
}
}
-85
View File
@@ -1,85 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:上传图片
* Created on: 2022/9/21 17:15
* Created by: dengbw
*/
class Upload extends BaseController
{
public function __construct()
{
parent::__construct();
}
public function index_post()
{
$file = $_FILES['file'];
if (!$file) {
$this->return_json('请选择图片');
}
if (!$file['tmp_name']) {//太大的图片上传,这个参数会变成空的
$this->return_json('参数错误');
}
if (!file_exists(TEMP_PATH)) {
$oldumask = umask(0);
mkdir(TEMP_PATH, 0777, true);
umask($oldumask);
}
$tmp = TEMP_PATH . md5($file['name'] . uniqid()) . substr($file['name'], strpos($file['name'], '.', strlen($file['name']) - 1));
move_uploaded_file($file['tmp_name'], $tmp);
if (!filesize($tmp)) {
$this->return_json('图片有点问题,换个小的试试');
}
//上传图片到FTP
$res = $this->upload_img_qiniu($tmp, "admin/");
if (!$res) {
$this->return_json('上传失败');
}
$data['full_url'] = build_qiniu_image_url($res['photo']);
$data['url'] = $res['photo'];
$this->return_response($data);
}
/**
* @param string $file 上传的文件
* @param string $path 要保存的目录
* @param string $filename 原始文件名称
* @return array
* @throws Exception
*/
private function upload_img_qiniu($file, $path = '', $filename = '')
{
$phoId = md5(uniqid() . mt_rand(0, 10000) . time());
$filename = $filename ? $filename : $file;
$ext_arr = explode(".", $filename);
$ext = count($ext_arr) > 1 ? $ext_arr[count($ext_arr) - 1] : 'jpg';
if (is_uploaded_file($file)) {
//上传图片
$oriPath = TEMP_PATH . '/p_' . $phoId . '_ori.' . $ext;
move_uploaded_file($file, $oriPath);
} else {
$oriPath = $file;
}
$oriKey = 'p_' . $phoId . '.' . $ext;
// 上传到七牛后保存的文件名
$photo = $path . date('Ym') . "/" . $oriKey;
//上传图片到FTP
$this->load->library('qiniu');
$res = $this->qiniu->save($photo, file_get_contents($oriPath));
$img_size = getimagesize($oriPath);
$file_size = filesize($oriPath);
$size = "{$img_size[0]},{$img_size[1]},{$file_size}";
unlink($oriPath);
if ($res) {
$size = getimagesize($res['url']);
return array('photo' => $res['file'], 'size' => $size);
} else {
return array();
}
}
}
@@ -1,52 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:修改密码
* Created on: 2022/9/05 17:15
* Created by: dengbw
*/
class Password extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sys_admin_model', 'mdSysAdmin');
}
/**
* Notes:修改密码
* Created on: 2022/9/16 11:11
* Created by: dengbw
*/
public function index_put()
{
$oldPassword = $this->input_param('oldPassword');
$password = $this->input_param('password');
$password2 = $this->input_param('password2');
if (!$oldPassword) {
$this->return_json('请输入旧密码');
}
if (!$password) {
$this->return_json('请输入新密码');
}
if (!$password2) {
$this->return_json('请再次输入新密码');
}
if (mb_strlen($password) < 4) {
$this->return_json('请输入至少4个字符的新密码');
}
if ($password != $password2) {
$this->return_json('两次输入密码不一致');
}
if (!password_verify($oldPassword, $_SESSION['password'])) {
$this->return_json('旧密码错误');
}
$upDate['password'] = password_hash($password, PASSWORD_BCRYPT);
$this->mdSysAdmin->update($upDate, ['userId' => $_SESSION['userId']]);
$this->return_response();
}
}
-53
View File
@@ -1,53 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:获取用户信息
* Created on: 2022/9/05 17:15
* Created by: dengbw
*/
class User extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sys_role_model', 'mdSysRole');
$this->load->model('agent/admin/Market_sys_menu_model', 'mdSysMenu');
}
public function index_get()
{
$re = $_SESSION;
$user = ['userId' => $re['userId'], 'username' => $re['username'], 'nickname' => $re['nickname']
, 'avatar' => "https://qs.liche.cn/web/images/project/H5-ShiYu/default-avatar.jpg?v=1"
, 'sex' => $re['sex'], 'phone' => $re['phone'], 'introduction' => $re['introduction'], 'email' => $re['email']
, 'enabled' => true, 'accountNonLocked' => true, 'credentialsNonExpired' => true, 'accountNonExpired' => true];
$roles = $authorities = [];
if ($re['roleId']) {
$re_ro = $this->mdSysRole->get(['roleId' => $re['roleId'], 'status' => 0]);
if ($re_ro) {
$re_ro['userId'] = $re['userId'];
$roles[] = $re_ro;
if ($re_ro['menuIds']) {
$authorities = $this->mdSysMenu->select(["menuId in({$re_ro['menuIds']})" => null, 'status' => 0]
, 'sortNumber asc,menuId desc');
foreach ($authorities as $k => $v) {
$authorities[$k]['menuId'] = intval($v['menuId']);
$authorities[$k]['parentId'] = intval($v['parentId']);
$authorities[$k]['menuType'] = intval($v['menuType']);
$authorities[$k]['openType'] = intval($v['openType']);
$authorities[$k]['sortNumber'] = intval($v['sortNumber']);
$authorities[$k]['hide'] = intval($v['hide']);
$authorities[$k]['meta'] = json_decode($v['meta'], true);
}
}
}
}
$user['roles'] = $roles;
$user['authorities'] = $authorities;
$this->return_response($user);
}
}
-212
View File
@@ -1,212 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
class Product extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/auto_product_model', 'autoProduct');
$this->load->helper('image');
$this->load->model('area_model');
}
public function page_get()
{
$params = $this->input_param();
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$title = $this->input_param('title');
$sort = $this->input_param('sort');
$order = $this->input_param('order');
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'id desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$list = [];
$where = ['status>=' => 0];
$selectedCar = json_decode($params['selectedCar'], true) ?: [];
$title && $where['title LIKE "%' . trim($title) . '%"'] = null;
$selectedCar['brandId'] && $where['brandId'] = $selectedCar['brandId'];
$selectedCar['seriesId'] && $where['seriesId'] = $selectedCar['seriesId'];
if (strlen($params['status'])) {
$where['status'] = intval($params['status']);
}
if ($params['dateRange'][0] && $params['dateRange'][1]) {
$where['timeLaunch>='] = $params['dateRange'][0] . ' 00:00:00';
$where['timeLaunch<='] = $params['dateRange'][1] . ' 23:59:59';
}
$labelIdArray = [];
$params['priceRange'] && $labelIdArray = array_merge($labelIdArray, $params['priceRange']);
$params['carProductLabel'] && $labelIdArray = array_merge($labelIdArray, $params['carProductLabel']);
$params['productLevel'] && $labelIdArray = array_merge($labelIdArray, $params['productLevel']);
if ($labelIdArray) {
$countLabelIds = count($labelIdArray);
$labelIdString = implode(',', $labelIdArray);
$where["lc_auto_product.id in (SELECT product_id
FROM lc_auto_product_label
WHERE label_id IN ($labelIdString)
GROUP BY product_id
HAVING COUNT(DISTINCT label_id) = $countLabelIds)"] = null;
}
if ($params['citys']) {
$cityArray = [];
foreach ($params['citys'] as $item) {
$temp = json_decode($item, true);
$temp && $cityArray[] = $temp[1];
}
$cityIds = implode(',', $cityArray);
$cityIds && $where["cityId in ($cityIds)"] = null;
}
$count = $this->autoProduct->selectProductCount($where);
if ($count) {
$res = $this->autoProduct->selectProduct($where, $sort_order, $page, $limit, '', 'AutoProductEntity');
/** @var AutoProductEntity[] $res */
foreach ($res as $v) {
$temp = (array)$v;
$getProvinceCity = $v->getProvinceCity();
$temp['banner'] = $v->banner ? changeImg(explode(',', $v->banner)) : [];
$temp['posterBg'] = $v->posterBg ? changeImg(explode(',', $v->posterBg)) : [];
$temp['timeLaunch'] = $v->timeLaunch != '0000-00-00 00:00:00' ? $v->timeLaunch : "";
$temp['imgs'] = $v->imgs ? changeImg(explode(',', $v->imgs)) : [];
$temp['dateRange'] = [$v->timeStart, $v->timeEnd];
$temp['provinceCity'] = $getProvinceCity['provinceCityIds'] ?: [];
$temp['cityName'] = $getProvinceCity['cityNames'] ?: ['全国'];
$temp['status'] = intval($v->status);
$temp['crowdProfiling'] = json_decode($v->crowdProfiling) ? json_decode($v->crowdProfiling) : [];
$temp['selectedCar'] = [
'brandId' => $v->brandId ?: '',
'seriesId' => $v->seriesId ?: '',
'modelId' => ''
];
$temp['promotion_text'] = json_decode($v->promotion_text, true) ?: [];
$temp['carProductLabel'] = $v->getLabel();
$temp['labels'] = $v->getLabel();
$list[] = $temp;
}
}
$data = ['list' => $list, 'count' => $count];
$this->return_response_list($data);
}
public function index_post()
{
$params = $this->input_param();
$res = $this->autoProduct->saveOrUpdate($params);
if (!$res) {
$this->return_json('添加失败');
}
$this->return_response();
}
public function index_put()
{
$params = $this->input_param();
if (!$this->autoProduct->get(['id' => $params['id']])) {
$this->return_json('数据不存在');
}
$res = $this->autoProduct->saveOrUpdate($params);
if (!$res) {
$this->return_json('更新失败');
}
$this->return_response();
}
/**
* 修改状态
*/
public function status_put()
{
$id = $this->input_param('id');
$status = $this->input_param('status');
/** @var AutoProductEntity $row */
$row = $this->autoProduct->get(['id' => $id], '', 'AutoProductEntity');
if (!$row) {
$this->return_json('参数错误');
}
if (!$row->banner) {
$this->return_json('产品缩略图未上传');
}
if (!$row->imgs) {
$this->return_json('产品轮播图未上传');
}
$update = [
'status' => $status,
];
if ($update['status']) {
$update['timeLaunch'] = date('Y-m-d H:i:s');
}
$this->autoProduct->update($update, ['id' => $id]);
$this->return_response();
}
/**
* 删除
*/
public function index_delete()
{
$ids = $this->input_param('ids');
if (!$ids) {
$this->return_json('参数错误');
}
$str_ids = is_array($ids) ? implode(',', $ids) : $ids;
if ($str_ids) {
$this->autoProduct->update(['status' => -1], ["id in($str_ids)" => null]);
}
$this->return_response();
}
/**
* 修改佣金
*/
public function brokerage_put()
{
$params = $this->input_param();
if (!$this->autoProduct->get(['id' => $params['id']])) {
$this->return_json('参数错误');
}
$update = [
'cluesCommission' => $params['cluesCommission'] ?: 0,
'orderCommission' => $params['orderCommission'] ?: 0,
];
$this->autoProduct->update($update, ['id' => $params['id']]);
$this->return_response();
}
/**
* 修改CPS金额
*/
public function cps_put()
{
$params = $this->input_param();
if (!$this->autoProduct->get(['id' => $params['id']])) {
$this->return_json('参数错误');
}
$update = [
'cpsMoney' => $params['cpsMoney'] ?: 0,
];
$this->autoProduct->update($update, ['id' => $params['id']]);
$this->return_response();
}
/**
* 修改状态
*/
public function sort_put()
{
$id = $this->input_param('id');
$sort = $this->input_param('sort');
if (!$this->autoProduct->get(['id' => $id])) {
$this->return_json('参数错误');
}
$update = [
'sort' => intval($sort),
];
$this->autoProduct->update($update, ['id' => $id]);
$this->return_response([], '保存成功');
}
}
@@ -1,105 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
class ProductCoupon extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/auto_product_coupon_model', 'autoProductCoupon');
$this->load->helper('image');
$this->load->model('area_model');
}
public function page_get()
{
$params = $this->input_param();
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$title = $this->input_param('title');
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'id desc';
$list = [];
$where = ['status>=' => 0, 'product_id' => $params['productId']];
$title && $where['title LIKE "%' . trim($title) . '%"'] = null;
$count = $this->autoProductCoupon->count($where);
if ($count) {
$res = $this->autoProductCoupon->select($where, $sort_order, $page, $limit, '', 'AutoProductCouponEntity');
/** @var AutoProductCouponEntity[] $res */
foreach ($res as $v) {
$temp = (array)$v;
$temp['status'] = intval($v->status);
$temp['dateRange'] = [$v->timeStart, $v->timeEnd];
$temp['userType'] = intval($v->userType) ?: 0;
$temp['bizs'] = $v->getBizs();
$temp['selectBiz'] = $v->getShowBiz($temp['bizs']);
$temp['typeCn'] = $v->getTypeCn();
$list[] = $temp;
}
}
$data = ['list' => $list, 'count' => $count];
$this->return_response_list($data);
}
public function index_post()
{
$params = $this->input_param();
if (!$params['productId']) {
$this->return_json('参数错误');
}
$res = $this->autoProductCoupon->saveOrUpdate($params);
if (!$res) {
$this->return_json('添加失败');
}
$this->return_response();
}
public function index_put()
{
$params = $this->input_param();
if (!$this->autoProductCoupon->get(['id' => $params['id']])) {
$this->return_json('数据不存在');
}
$res = $this->autoProductCoupon->saveOrUpdate($params);
if (!$res) {
$this->return_json('更新失败');
}
$this->return_response();
}
/**
* 修改状态
*/
public function status_put()
{
$id = $this->input_param('id');
$status = $this->input_param('status');
if (!$this->autoProductCoupon->get(['id' => $id])) {
$this->return_json('参数错误');
}
$update = [
'status' => $status,
];
$this->autoProductCoupon->update($update, ['id' => $id]);
$this->return_response();
}
/**
* 删除
*/
public function index_delete()
{
$ids = $this->input_param('ids');
if (!$ids) {
$this->return_json('参数错误');
}
$str_ids = is_array($ids) ? implode(',', $ids) : $ids;
if ($str_ids) {
$this->autoProductCoupon->update(['status' => -1], ["id in($str_ids)" => null]);
}
$this->return_response();
}
}
-41
View File
@@ -1,41 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
class Data extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('receiver/receiver_clues_model', 'clues_model');
$this->clues_model->set_db('ssdb');
$this->load->model('agent/pingan/pingan_users_model');
$this->load->model('receiver/order/receiver_orders_model');
$this->receiver_orders_model->set_db('ssdb');
}
public function index_get()
{
$where = [
'app_id' => self::APP_ID
];
$total_clues = $this->clues_model->count($where);
$where['c_time>='] = strtotime(date('Y-m-d 00:00:00'));
$where['c_time<='] = time();
$today_clues = $this->clues_model->count($where);
$member = $this->pingan_users_model->count(['status' => Pingan_users_model::STATUS_NORMAL]);
$app_id = self::APP_ID;
$where = [
"clue_id in (select id from lc_receiver_clues where app_id={$app_id})" => null
];
$orders = $this->receiver_orders_model->count($where);
$data = [
'total_clues' => $total_clues,
'today_clues' => $today_clues,
'member' => $member,
'orders' => $orders
];
$this->return_response($data);
}
}
@@ -1,255 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_机构管理
* Created on: 2022/9/16 17:15
* Created by: dengbw
*/
class Organization extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_organization_model', 'mdSyliveOrganization');
}
/**
* Notes:获取机构
* Created on: 2022/9/16 11:11
* Created by: dengbw
*/
public function index_get()
{
$unOrganizationType = intval($this->input_param('unOrganizationType'));
$activityId = intval($this->input_param('activityId'));
$where['status>='] = 0;
$unOrganizationType && $where['organizationType<>'] = $unOrganizationType;
$sort_order = 'sortNumber asc,organizationId desc';
if ($_SESSION['brandName'] || $activityId) {//只找该品牌机构
if ($activityId) {
$this->load->model('agent/admin/Market_sylive_activity_model', 'mdSyliveActivity');
$re_act = $this->mdSyliveActivity->get(['activityId' => $activityId]);
$re_org['organizationId'] = intval($re_act['organizationId']);
} else {
$re_org = $this->mdSyliveOrganization->get(['organizationName' => $_SESSION['brandName'], 'parentId' => 0, 'status' => 0]);
}
if ($re_org['organizationId']) {
$organizationIds[] = $re_org['organizationId'];
$res_all = $this->mdSyliveOrganization->select($where, 'organizationType asc,parentId asc', 0, 0, 'organizationId,parentId');
foreach ($res_all as $k => $v) {
if (in_array($v['parentId'], $organizationIds)) {
$organizationIds[] = $v['organizationId'];
}
}
$str_organizationIds = implode(',', array_unique($organizationIds));
$where["organizationId in({$str_organizationIds})"] = null;
} else {
$where['organizationId'] = -1;
}
}
$res = $this->mdSyliveOrganization->select($where, $sort_order);
foreach ($res as $k => $v) {
$res[$k]['organizationId'] = intval($v['organizationId']);
$res[$k]['parentId'] = intval($v['parentId']);
$res[$k]['sortNumber'] = intval($v['sortNumber']);
$city = $logo = [];
if ($v['countyId']) {
$city[] = $v['provinceId'];
$city[] = $v['cityId'];
$city[] = $v['countyId'];
}
$res[$k]['city'] = $city;
if ($v['logo']) {
$logo[] = ['uid' => 1, 'fileUrl' => $v['logo'], 'url' => build_qiniu_image_url($v['logo']), 'status' => 'done'];
}
$res[$k]['logo'] = $logo;
}
$this->return_response_list($res);
}
/**
* Notes:查找上级机构
* Created on: 2022/10/24 15:24
* Created by: dengbw
*/
public function parent_get()
{
$list = [];
if ($_SESSION['brandName']) {//只找该品牌机构
$re_org = $this->mdSyliveOrganization->get(['organizationName' => $_SESSION['brandName'], 'parentId' => 0, 'status>=' => 0]);
if ($re_org['organizationId']) {
$list[] = ['organizationId' => intval($re_org['organizationId']), 'organizationName' => $re_org['organizationName']];
}
} else {
$parentId = intval($this->input_param('parentId'));
$sort_order = 'sortNumber asc,organizationId desc';
$where['status>='] = 0;
$where['parentId'] = $parentId;
$res = $this->mdSyliveOrganization->select($where, $sort_order, 0, 0, 'organizationId,organizationName');
foreach ($res as $k => $v) {
$list[] = ['organizationId' => intval($v['organizationId']), 'organizationName' => $v['organizationName']];
}
}
$this->return_response_list($list);
}
/**
* Notes:添加机构
* Created on: 2022/9/19 16:43
* Created by: dengbw
*/
public function index_post()
{
$parentId = intval($this->input_param('parentId'));
$organizationName = $this->input_param('organizationName');
$organizationFullName = $this->input_param('organizationFullName');
$organizationType = $this->input_param('organizationType');
$sortNumber = intval($this->input_param('sortNumber'));
$comments = $this->input_param('comments');
$city = $this->input_param('city');
$logo = $this->input_param('logo');
$enrollDeal = $this->input_param('organization');
if ($_SESSION['brandName'] && !$parentId) {//品牌机构必顺选择上级机构
$this->return_json('请选择上级机构');
}
if (!$organizationName) {
$this->return_json('请输入机构名称');
}
if (!$organizationType) {
$this->return_json('请选择机构类型');
}
if ($parentId) {//判断上级机构是不是员工类型
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $parentId]);
if ($re_org['organizationType'] == 4) {
$this->return_json('选择的上级机构不能保存,请重新选择');
}
}
!$comments && $comments = '';
$logo = $logo[0]['fileUrl'] ? $logo[0]['fileUrl'] : '';
$addDate = ['parentId' => $parentId, 'organizationName' => $organizationName, 'organizationFullName' => $organizationFullName
, 'organizationType' => $organizationType, 'sortNumber' => $sortNumber, 'comments' => $comments, 'logo' => $logo
, 'createTime' => date('Y-m-d H:i:s')];
if ($city) {
$addDate['provinceId'] = intval($city[0]);
$addDate['cityId'] = intval($city[1]);
$addDate['countyId'] = intval($city[2]);
}
if($enrollDeal){
$addDate['enrollDeal'] = $enrollDeal;
}
$id = $this->mdSyliveOrganization->add($addDate);
if (!$id) {
$this->return_json('添加机构失败');
}
$this->return_response();
}
/**
* Notes:修改机构
* Created on: 2022/9/19 17:29
* Created by: dengbw
*/
public function index_put()
{
$organizationId = intval($this->input_param('organizationId'));
$parentId = intval($this->input_param('parentId'));
$organizationName = $this->input_param('organizationName');
$organizationFullName = $this->input_param('organizationFullName');
$organizationType = $this->input_param('organizationType');
$sortNumber = intval($this->input_param('sortNumber'));
$comments = $this->input_param('comments');
$city = $this->input_param('city');
$logo = $this->input_param('logo');
$enrollDeal = $this->input_param('enrollDeal');
if ($_SESSION['brandName']) {//品牌机构
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $organizationId]);
if ($re_org && $re_org['parentId'] == 0) {//一级品牌不可修改字段
$parentId = 0;
$organizationType = 1;
$organizationName = $re_org['organizationName'];
}
}
if (!$organizationId) {
$this->return_json('参数错误');
}
if (!$organizationName) {
$this->return_json('请输入机构名称');
}
if (!$organizationType) {
$this->return_json('请选择机构类型');
}
if ($parentId) {//判断上级机构是不是员工类型
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $parentId]);
if ($re_org['organizationType'] == 4) {
$this->return_json('选择的上级机构不能保存,请重新选择');
}
}
!$comments && $comments = '';
$logo = $logo ? $logo[0]['fileUrl'] : '';
$upDate = ['parentId' => $parentId, 'organizationName' => $organizationName, 'organizationFullName' => $organizationFullName
, 'organizationType' => $organizationType, 'sortNumber' => $sortNumber, 'comments' => $comments, 'logo' => $logo];
if ($city) {
$upDate['provinceId'] = intval($city[0]);
$upDate['cityId'] = intval($city[1]);
$upDate['countyId'] = intval($city[2]);
}
if($enrollDeal){
$upDate['enrollDeal'] = $enrollDeal;
}
$this->mdSyliveOrganization->update($upDate, ['organizationId' => $organizationId]);
$this->return_response();
}
/**
* Notes:删除机构
* Created on: 2022/9/19 11:08
* Created by: dengbw
* @param null $organizationId
*/
public function index_delete($organizationId = null)
{
$organizationId = intval($organizationId);
if (!$organizationId) {
$this->return_json('参数错误');
}
$this->mdSyliveOrganization->update(['status' => -1], ['organizationId' => $organizationId]);
$this->return_response();
}
/**
* Notes:批量删除机构
* Created on: 2022/9/8 17:11
* Created by: dengbw
*/
public function batch_delete()
{
$ids = $this->input_param('ids');
if (!$ids) {
$this->return_json('参数错误');
}
$str_ids = implode(',', $ids);
if ($str_ids) {
$this->mdSyliveOrganization->update(['status' => -1], ["organizationId in($str_ids)" => null]);
}
$this->return_response();
}
/**
* Notes:机构详情
* Created on: 2022/12/09 10:37
* Created by: dengbw
*/
public function info_get()
{
$organizationId = intval($this->input_param('organizationId'));
if (!$organizationId) {
$this->return_json('参数错误');
}
$re = $this->mdSyliveOrganization->get(['organizationId' => $organizationId]);
$this->return_response($re);
}
}
@@ -1,325 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_机构用户管理
* Created on: 2022/9/19 17:15
* Created by: dengbw
*/
class OrganizationUser extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_user_model', 'mdSyliveUser');
$this->load->model('agent/admin/Market_sylive_organization_model', 'mdSyliveOrganization');
}
/**
* Notes:用户管理列表
* Created on: 2022/9/20 14:48
* Created by: dengbw
*/
public function page_get()
{
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$uname = $this->input_param('uname');
$nickname = $this->input_param('nickname');
$sort = $this->input_param('sort');
$order = $this->input_param('order');
$organizationId = intval($this->input_param('organizationId'));
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'userId desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$list = [];
$where['status>='] = 0;
$organizationId && $where['organizationId'] = $organizationId;
$uname && $where['uname'] = $uname;
$nickname && $where['nickname'] = $nickname;
$this->load->model('agent/admin/Market_sylive_organization_model', 'mdSyliveOrganization');
$organizationType = 0;
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $organizationId]);
$re_org && $organizationType = $re_org['organizationType'];
$roleName = $this->mdSyliveUser->roleAry($organizationType);
$count = $this->mdSyliveUser->count($where);
if ($count) {
$res = $this->mdSyliveUser->select($where, $sort_order, $page, $limit);
foreach ($res as $v) {
$status = intval($v['status']);
$createTime = $v['createTime'] != '0000-00-00 00:00:00' ? $v['createTime'] : '';
$list[] = [
'userId' => $v['userId'], 'uname' => $v['uname'], 'nickname' => $v['nickname'], 'mobile' => $v['mobile']
, 'roleName' => $roleName, 'organizationId' => $organizationId, 'status' => $status, 'createTime' => $createTime];
}
}
$date = ['list' => $list, 'count' => $count];
$this->return_response_list($date);
}
/**
* Notes:获取机构用户
* Created on: 2022/11/29 11:08
* Created by: dengbw
*/
public function list_post()
{
$this->load->model('agent/admin/Market_sylive_groups_user_model', 'mdSyliveGroupsUser');
$this->load->model('agent/admin/Market_sylive_groups_model', 'mdSyliveGroups');
$activityId = intval($this->input_param('activityId'));
$organizationIds = $this->input_param('organizationIds');
$keyword = trim($this->input_param('keyword'));
$where = ['status>=' => 0, 'organizationId>' => 0];
if ($keyword) {
$this->load->model('agent/admin/Market_sylive_activity_model', 'mdSyliveActivity');
$where["(uname LIKE '%{$keyword}%' OR mobile LIKE '%{$keyword}%')"] = null;
$re = $this->mdSyliveActivity->get(['activityId' => $activityId]);
if ($re['organizationId']) {//找当前顶级机构用户
$where["topOrgId"] = $re['organizationId'];
}
} else if ($organizationIds) {
$organizationIds = implode(',', $organizationIds);
$where["organizationId in({$organizationIds}) or bizId in({$organizationIds})"] = null;
}
$res = $this->mdSyliveUser->select($where, 'userId desc', 0, 0, 'userId,uname,mobile,organizationId,bizId');
if ($keyword && $res) {
$organizationIds = [];
foreach ($res as $v) {
$v['bizId'] && $organizationIds[] = $v['bizId'];
$v['organizationId'] && $organizationIds[] = $v['organizationId'];
}
$organizationIds && $organizationIds = implode(',', $organizationIds);
}
$map_organization = [];
if ($organizationIds) {
$map_organization = $this->mdSyliveOrganization->map('organizationId', 'organizationName,organizationType'
, ["organizationId in({$organizationIds})" => null]);
}
$list = [];
foreach ($res as $v) {
$uname = $v['uname'] ? $v['uname'] : '-';
$organization = $map_organization[$v['bizId']];
if (!$organization) {
$organization = $map_organization[$v['organizationId']];
}
$organizationName = $organization['organizationName'] ? $organization['organizationName'] : '-';
$type = 2;
if ($v['bizId']) {
$type = $v['bizId'] == $v['organizationId'] ? 1 : 0;
}
$groups = 0;
$re_gro_use = $this->mdSyliveGroupsUser->get(['activityId' => $activityId, 'userId' => $v['userId']
, 'status>=' => 0], 'groupsId,bizId');
if ($re_gro_use) {
$groups = 1;
$groupsId = $re_gro_use['bizId'] ? $re_gro_use['bizId'] : $re_gro_use['groupsId'];
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'groupsId' => $groupsId
, 'status>=' => 0], 'groupsName');
$re_gro['groupsName'] && $organizationName .= "(分组-{$re_gro['groupsName']})";
}
$list[] = ['userId' => $v['userId'], 'uname' => $uname, 'mobile' => $v['mobile'], 'type' => $type
, 'groups' => $groups, 'organizationName' => $organizationName];
}
$this->return_response_list($list);
}
/**
* Notes:添加用户
* Created on: 2022/9/21 16:46
* Created by: dengbw
*/
public function index_post()
{
$mobile = $this->input_param('mobile');
$organizationId = intval($this->input_param('organizationId'));
$uname = $this->input_param('uname');
if (!$mobile) {
$this->return_json('请输入手机号');
}
if (!$organizationId) {
$this->return_json('请选择所属机构');
}
if (!$uname) {
$this->return_json('请输入姓名');
}
$topOrgId = $this->getTopOrgId($organizationId);
$re = $this->mdSyliveUser->get(['mobile' => $mobile, 'topOrgId' => $topOrgId]);
if ($re && $re['status'] != -1) {
if ($re['teamId'] || $re['organizationId']) {
$this->return_json('手机号已存在当前机构');
}
}
$bizId = 0;
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $organizationId]);
if ($re_org) {
if ($re_org['organizationType'] == 4 && $re_org['parentId']) {
$bizId = $re_org['parentId'];
} else if ($re_org['organizationType'] == 3) {
$bizId = $re_org['organizationId'];
}
}
$addDate = ['topOrgId' => $topOrgId, 'organizationId' => $organizationId, 'uname' => $uname,
'bizId' => $bizId, 'status' => 0, 'teamId' => 0];
if ($re && $re['status'] != -1) {
$this->mdSyliveUser->update($addDate, ['userId' => $re['userId']]);
$this->return_response([], '绑定用户成功');
} else {
$addDate['mobile'] = $mobile;
$addDate['createTime'] = date('Y-m-d H:i:s');
$id = $this->mdSyliveUser->add($addDate);
if (!$id) {
$this->return_json('添加用户失败');
}
$this->return_response();
}
}
/**
* Notes:修改用户
* Created on: 2022/9/21 14:48
* Created by: dengbw
*/
public function index_put()
{
$userId = intval($this->input_param('userId'));
$organizationId = intval($this->input_param('organizationId'));
$uname = $this->input_param('uname');
if (!$userId) {
$this->return_json('参数错误');
}
if (!$organizationId) {
$this->return_json('请选择所属机构');
}
if (!$uname) {
$this->return_json('请输入姓名');
}
$re = $this->mdSyliveUser->get(['userId' => $userId]);
if (!$re) {
$this->return_json('无此用户');
}
$topOrgId = $re['topOrgId'];
if ($re['organizationId'] != $organizationId) {
$topOrgId = $this->getTopOrgId($organizationId);
if ($re['topOrgId'] && $re['topOrgId'] != $topOrgId) {
$this->return_json('不可修改顶级机构');
}
}
$bizId = 0;
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $organizationId]);
if ($re_org) {
if ($re_org['organizationType'] == 4 && $re_org['parentId']) {
$bizId = $re_org['parentId'];
} else if ($re_org['organizationType'] == 3) {
$bizId = $re_org['organizationId'];
}
}
$upDate = ['topOrgId' => $topOrgId, 'organizationId' => $organizationId, 'bizId' => $bizId, 'teamId' => 0, 'uname' => $uname];
$this->mdSyliveUser->update($upDate, ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:修改状态
* Created on: 2022/9/21 16:10
* Created by: dengbw
*/
public function status_put()
{
$userId = $this->input_param('userId');
$status = $this->input_param('status');
if (!$userId) {
$this->return_json('参数错误');
}
$this->mdSyliveUser->update(['status' => $status], ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:删除用户
* Created on: 2022/9/21 16:10
* Created by: dengbw
* @param null $userId
*/
public function index_delete($userId = null)
{
if (!$userId) {
$this->return_json('参数错误');
}
$this->mdSyliveUser->update(['status' => -1], ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:批量删除用户
* Created on: 2022/9/8 17:11
* Created by: dengbw
*/
public function batch_delete()
{
$ids = $this->input_param('ids');
if (!$ids) {
$this->return_json('参数错误');
}
$str_ids = implode(',', $ids);
if ($str_ids) {
$this->mdSyliveUser->update(['status' => -1], ["userId in($str_ids)" => null]);
}
$this->return_response();
}
/**
* Notes:栓验字段
* Created on: 2022/9/21 15:52
* Created by: dengbw
*/
public function existence_get()
{
$field = $this->input_param('field');
$value = $this->input_param('value');
$organizationId = intval($this->input_param('organizationId'));
if ($organizationId) {
$topOrgId = $this->getTopOrgId($organizationId);
$where = [$field => $value, 'topOrgId' => $topOrgId, 'status>=' => 0];
$re = $this->mdSyliveUser->get($where);
if ($re) {
if ($field == 'mobile') {
if ($re['teamId'] || $re['organizationId']) {
$this->return_json('已存在', 0);
}
} else {
$this->return_json('已存在', 0);
}
}
}
$this->return_json('不存在', 1);
}
/**
* Notes:获取顶级机构id
* Created on: 2022/12/8 14:39
* Created by: dengbw
* @param $organizationId
* @param $topOrgId
* @return mixed
*/
private function getTopOrgId($organizationId, $topOrgId = 0)
{
$re = $this->mdSyliveOrganization->get(['organizationId' => $organizationId], 'organizationId,parentId');
if (!$re) {
return $topOrgId;
} else {
$topOrgId = $re['organizationId'];
if ($re['parentId']) {
return $this->getTopOrgId($re['parentId'], $topOrgId);
} else {
return $topOrgId;
}
}
}
}
@@ -1,164 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_团队管理
* Created on: 2022/9/16 17:15
* Created by: dengbw
*/
class Team extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_team_model', 'mdSyliveTeam');
}
/**
* Notes:获取团队
* Created on: 2022/9/16 11:11
* Created by: dengbw
*/
public function index_get()
{
$unTeamType = $this->input_param('unTeamType');
$where['status>='] = 0;
$unTeamType && $where['teamType<>'] = $unTeamType;
$sort_order = 'sortNumber asc,teamId desc';
if ($_SESSION['brandName']) {//只找该品牌机构
$this->load->model('agent/admin/Market_sylive_organization_model', 'mdSyliveOrganization');
$re_org = $this->mdSyliveOrganization->get(['organizationName' => $_SESSION['brandName'], 'parentId' => 0, 'status' => 0]);
if ($re_org['organizationId']) {
$res_team = $this->mdSyliveTeam->select(['status>=' => 0, 'organizationId' => $re_org['organizationId']], 'parentId asc,sortNumber asc', 0, 0, 'teamId');
if ($res_team) {
$teamIds = [];
foreach ($res_team as $k => $v) {
$teamIds[] = $v['teamId'];
}
$res_all = $this->mdSyliveTeam->select($where, 'parentId asc,sortNumber asc', 0, 0, 'teamId,parentId');
foreach ($res_all as $k => $v) {
if (in_array($v['parentId'], $teamIds)) {
$teamIds[] = $v['teamId'];
}
}
$str_teamIds = implode(',', array_unique($teamIds));
$where["teamId in({$str_teamIds})"] = null;
} else {
$where['teamId'] = -1;
}
} else {
$where['teamId'] = -1;
}
}
$res = $this->mdSyliveTeam->select($where, $sort_order);
foreach ($res as $k => $v) {
$res[$k]['teamId'] = intval($v['teamId']);
$res[$k]['parentId'] = $v['parentId'] ? intval($v['parentId']) : '';
$res[$k]['sortNumber'] = intval($v['sortNumber']);
$res[$k]['organizationId'] = $v['organizationId'] ? intval($v['organizationId']) : '';
$city = $logo = [];
if ($v['cityId']) {
$city[] = $v['provinceId'];
$city[] = $v['cityId'];
}
$res[$k]['city'] = $city;
if ($v['logo']) {
$logo[] = ['uid' => 1, 'fileUrl' => $v['logo'], 'url' => build_qiniu_image_url($v['logo']), 'status' => 'done'];
}
$res[$k]['logo'] = $logo;
}
$this->return_response_list($res);
}
/**
* Notes:添加团队
* Created on: 2022/9/19 16:43
* Created by: dengbw
*/
public function index_post()
{
$parentId = intval($this->input_param('parentId'));
$teamName = $this->input_param('teamName');
$sortNumber = intval($this->input_param('sortNumber'));
$comments = $this->input_param('comments');
$city = $this->input_param('city');
$teamType = $this->input_param('teamType');
$organizationId = intval($this->input_param('organizationId'));
$logo = $this->input_param('logo');
if (!$teamName) {
$this->return_json('请输入团队名称');
}
if (!$parentId && !$organizationId) {
$this->return_json('请选择所属团队');
}
!$comments && $comments = '';
$logo = $logo ? $logo[0]['fileUrl'] : '';
$addDate = ['parentId' => $parentId, 'teamName' => $teamName, 'sortNumber' => $sortNumber, 'comments' => $comments
, 'teamType' => $teamType, 'organizationId' => $organizationId, 'logo' => $logo, 'createTime' => date('Y-m-d H:i:s')];
if ($city) {
$addDate['provinceId'] = intval($city[0]);
$addDate['cityId'] = intval($city[1]);
}
$id = $this->mdSyliveTeam->add($addDate);
if (!$id) {
$this->return_json('添加团队失败');
}
$this->return_response();
}
/**
* Notes:修改团队
* Created on: 2022/9/19 17:29
* Created by: dengbw
*/
public function index_put()
{
$teamId = intval($this->input_param('teamId'));
$parentId = intval($this->input_param('parentId'));
$teamName = $this->input_param('teamName');
$sortNumber = intval($this->input_param('sortNumber'));
$comments = $this->input_param('comments');
$city = $this->input_param('city');
$teamType = $this->input_param('teamType');
$organizationId = intval($this->input_param('organizationId'));
$logo = $this->input_param('logo');
if (!$teamId) {
$this->return_json('参数错误');
}
if (!$teamName) {
$this->return_json('请输入团队名称');
}
if (!$parentId && !$organizationId) {
$this->return_json('请选择所属团队');
}
!$comments && $comments = '';
$logo = $logo ? $logo[0]['fileUrl'] : '';
$upDate = ['parentId' => $parentId, 'teamName' => $teamName, 'sortNumber' => $sortNumber, 'comments' => $comments
, 'teamType' => $teamType, 'organizationId' => $organizationId, 'logo' => $logo];
if ($city) {
$upDate['provinceId'] = intval($city[0]);
$upDate['cityId'] = intval($city[1]);
}
$this->mdSyliveTeam->update($upDate, ['teamId' => $teamId]);
$this->return_response();
}
/**
* Notes:删除团队
* Created on: 2022/9/19 11:08
* Created by: dengbw
* @param null $teamId
*/
public function index_delete($teamId = null)
{
$teamId = intval($teamId);
if (!$teamId) {
$this->return_json('参数错误');
}
$this->mdSyliveTeam->update(['status' => -1], ['teamId' => $teamId]);
$this->return_response();
}
}
@@ -1,244 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_团队用户管理
* Created on: 2022/10/24 17:15
* Created by: dengbw
*/
class TeamUser extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_user_model', 'mdSyliveUser');
$this->load->model('agent/admin/Market_sylive_team_model', 'mdSyliveTeam');
}
/**
* Notes:用户管理列表
* Created on: 2022/9/20 14:48
* Created by: dengbw
*/
public function page_get()
{
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$uname = $this->input_param('uname');
$nickname = $this->input_param('nickname');
$sort = $this->input_param('sort');
$order = $this->input_param('order');
$teamId = intval($this->input_param('teamId'));
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'userId desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$list = [];
$where['status>='] = 0;
$teamId && $where['teamId'] = $teamId;
$uname && $where['uname'] = $uname;
$nickname && $where['nickname'] = $nickname;
$count = $this->mdSyliveUser->count($where);
if ($count) {
$res = $this->mdSyliveUser->select($where, $sort_order, $page, $limit);
foreach ($res as $v) {
$status = intval($v['status']);
$createTime = $v['createTime'] != '0000-00-00 00:00:00' ? $v['createTime'] : '';
$list[] = [
'userId' => $v['userId'], 'uname' => $v['uname'], 'nickname' => $v['nickname'], 'mobile' => $v['mobile']
, 'teamId' => $teamId, 'status' => $status, 'createTime' => $createTime];
}
}
$date = ['list' => $list, 'count' => $count];
$this->return_response_list($date);
}
/**
* Notes:获取团队用户
* Created on: 2022/11/30 15:37
* Created by: dengbw
*/
public function list_post()
{
$this->load->model('agent/admin/Market_sylive_groups_user_model', 'mdSyliveGroupsUser');
$this->load->model('agent/admin/Market_sylive_groups_model', 'mdSyliveGroups');
$activityId = intval($this->input_param('activityId'));
$teamIds = $this->input_param('teamIds');
$keyword = trim($this->input_param('keyword'));
$where = ['status>=' => 0, 'teamId>' => 0];
if ($keyword) {
$where["(uname LIKE '%{$keyword}%' OR mobile LIKE '%{$keyword}%')"] = null;
} else if ($teamIds) {
$teamIds_str = implode(',', $teamIds);
$res_tea = $this->mdSyliveTeam->select(["parentId in({$teamIds_str})" => null], 'teamId desc', 0, 0, 'teamId');
foreach ($res_tea as $v) {
$teamIds[] = $v['teamId'];
}
$teamIds = implode(',', $teamIds);
$where["teamId in({$teamIds})"] = null;
}
$res = $this->mdSyliveUser->select($where, 'userId desc', 0, 0, 'userId,uname,mobile,teamId');
if ($keyword && $res) {
$teamIds = [];
foreach ($res as $v) {
$v['teamId'] && $teamIds[] = $v['teamId'];
}
$teamIds && $teamIds = implode(',', $teamIds);
}
$map_team = $map_team2 = [];
if ($teamIds) {
$map_team = $this->mdSyliveTeam->map('teamId', 'teamName,teamType', ["teamId in({$teamIds})" => null]);
}
$list = [];
foreach ($res as $v) {
$uname = $v['uname'] ? $v['uname'] : '-';
$team = $map_team[$v['teamId']];
$teamName = $team['teamName'] ? $team['teamName'] : '-';
$type = 2;
if ($team['teamType'] == 2) {
$type = 1;
} else if ($team['teamType'] == 3) {
$type = 0;
}
$groups = 0;
$re_gro_use = $this->mdSyliveGroupsUser->get(['activityId' => $activityId, 'userId' => $v['userId']
, 'status>=' => 0], 'groupsId,bizId');
if ($re_gro_use) {
$groups = 1;
$groupsId = $re_gro_use['bizId'] ? $re_gro_use['bizId'] : $re_gro_use['groupsId'];
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'groupsId' => $groupsId
, 'status>=' => 0], 'groupsName');
$re_gro['groupsName'] && $teamName .= "(分组-{$re_gro['groupsName']})";
}
$list[] = ['userId' => $v['userId'], 'uname' => $uname, 'mobile' => $v['mobile'], 'type' => $type
, 'groups' => $groups, 'teamName' => $teamName];
}
$this->return_response_list($list);
}
/**
* Notes:添加用户
* Created on: 2022/9/21 16:46
* Created by: dengbw
*/
public function index_post()
{
$mobile = $this->input_param('mobile');
$teamId = intval($this->input_param('teamId'));
$uname = $this->input_param('uname');
if (!$mobile) {
$this->return_json('请输入手机号');
}
if (!$teamId) {
$this->return_json('请选择所属团队');
}
if (!$uname) {
$this->return_json('请输入姓名');
}
$re = $this->mdSyliveUser->get(['mobile' => $mobile]);
if ($re && $re['status'] != -1) {
if ($re['teamId'] || $re['organizationId']) {
$this->return_json('手机号已存在');
}
}
$addDate = ['teamId' => $teamId, 'uname' => $uname, 'status' => 0, 'organizationId' => 0];
if ($re['userId']) {
$this->mdSyliveUser->update($addDate, ['userId' => $re['userId']]);
$this->return_response([], '绑定用户成功');
} else {
$addDate['mobile'] = $mobile;
$addDate['createTime'] = date('Y-m-d H:i:s');
$id = $this->mdSyliveUser->add($addDate);
if (!$id) {
$this->return_json('添加用户失败');
}
$this->return_response();
}
}
/**
* Notes:修改用户
* Created on: 2022/9/21 14:48
* Created by: dengbw
*/
public function index_put()
{
$userId = intval($this->input_param('userId'));
$teamId = intval($this->input_param('teamId'));
$uname = $this->input_param('uname');
if (!$userId) {
$this->return_json('参数错误');
}
if (!$teamId) {
$this->return_json('请选择所属团队');
}
if (!$uname) {
$this->return_json('请输入姓名');
}
$upDate = ['teamId' => $teamId, 'uname' => $uname];
$this->mdSyliveUser->update($upDate, ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:修改状态
* Created on: 2022/9/21 16:10
* Created by: dengbw
*/
public function status_put()
{
$userId = $this->input_param('userId');
$status = $this->input_param('status');
if (!$userId) {
$this->return_json('参数错误');
}
$this->mdSyliveUser->update(['status' => $status], ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:删除用户
* Created on: 2022/9/21 16:10
* Created by: dengbw
* @param null $userId
*/
public function index_delete($userId = null)
{
if (!$userId) {
$this->return_json('参数错误');
}
$this->mdSyliveUser->update(['status' => -1], ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:栓验字段
* Created on: 2022/9/21 15:52
* Created by: dengbw
*/
public function existence_get()
{
$field = $this->input_param('field');
$value = $this->input_param('value');
$id = $this->input_param('id');
if (!$id) {
$where = [$field => $value, 'status<>' => -1];
$re = $this->mdSyliveUser->get($where);
if ($re) {
if ($field == 'mobile') {
if ($re['teamId'] || $re['organizationId']) {
$this->return_json('已存在', 0);
}
} else {
$this->return_json('已存在', 0);
}
}
}
$this->return_json('不存在', 1);
}
}
@@ -1,95 +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/organization/Organization_model', 'mdOrganization');
$this->load->model('agent/organization/Organization_cmmssn_model', 'mdOrganizationCmmssn');
}
public function index_get()
{
$teamId = $this->input_param('teamId');
$where = [
'teamId' => $teamId
];
$res = $this->mdOrganizationCmmssn->get($where);
$teamLevel = $this->mdOrganization->getTeamLevel($teamId);
if (!$res) {
$res['teamId'] = $teamId;
}
$res['showLevel'] = $teamLevel;
$this->return_response($res);
}
public function index_put()
{
$params = $this->input_param();
$upData = [
'cluesLevel1' => $params['cluesLevel1'] ?: 0,
'cluesLevel2' => $params['cluesLevel2'] ?: 0,
'cluesLevel3' => $params['cluesLevel3'] ?: 0,
'cluesLevel4' => $params['cluesLevel4'] ?: 0,
'orderLevel1' => $params['orderLevel1'] ?: 0,
'orderLevel2' => $params['orderLevel2'] ?: 0,
'orderLevel3' => $params['orderLevel3'] ?: 0,
'orderLevel4' => $params['orderLevel4'] ?: 0,
];
if ($params['id']) {
$upData['createTime'] = date('Y-m-d H:i:s');
$this->mdOrganizationCmmssn->update($upData, ['id' => $params['id']]);
} else {
$upData['teamId'] = $params['teamId'];
$this->mdOrganizationCmmssn->add($upData);
}
$this->return_response();
}
public function index_post()
{
$parentId = intval($this->input_param('parentId'));
$title = $this->input_param('title');
if (!$title) {
$this->return_json('请输入名称');
}
$remark = $this->input_param('remark');
$imgs = getImageFromArray($this->input_param('logo'));
$level = 0;
if ($parentId) {
$level = $this->mdOrganization->getLevel($parentId);
$level += 1;
}
if ($level > 5) {
$this->return_json('最多只能添加4级');
}
if ($level > 1) {
if ($this->mdOrganization->get(['parentId' => $parentId, 'status' => 0])) {
$this->return_json('该节点下已有子节点');
}
}
$addData = ['parentId' => $parentId, 'title' => $title, 'level' => $level, 'createTime' => date('Y-m-d H:i:s')];
$remark && $addData['remark'] = $remark;
$imgs && $addData['logo'] = $imgs[0];
$id = $this->mdOrganization->add($addData);
if (!$id) {
$this->return_json('添加失败');
}
$this->return_response();
}
public function index_delete()
{
$id = intval($this->input_param('id'));
if (!$id) {
$this->return_json('参数错误');
}
$this->mdOrganization->update(['status' => -1], ['id' => $id]);
$this->return_response();
}
}
@@ -1,124 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
class Manage extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/organization/Organization_model', 'mdOrganization');
$this->load->model('agent/organization/Organization_cmmssn_model', 'mdOrganizationCmmssn');
$this->load->helper('image');
}
public function index_get()
{
$title = $this->input_param('title');
$pid = $this->input_param('pid');
$where['status'] = 0;
$sort_order = 'id desc';
$title && $where['title'] = $title;
strlen($pid) && $where['parentId'] = $pid;
$res = $this->mdOrganization->select($where, $sort_order);
if ($res) {
foreach ($res as $k => $v) {
$res[$k]['id'] = intval($v['id']);
$res[$k]['parentId'] = intval($v['parentId']);
$res[$k]['cfId'] = intval($v['cfId']);
$res[$k]['logo'] = $v['logo'] ? changeImg(explode(',', $v['logo'])) : [];
$res[$k]['level'] = intval($v['level']);
$res[$k]['roleId'] = $v['roleId'] ? intval($v['roleId']) : '';
}
}
$this->return_response_list($res);
}
public function index_put()
{
$id = $this->input_param('id');
$parentId = intval($this->input_param('parentId'));
$cfId = intval($this->input_param('cfId'));
$roleId = intval($this->input_param('roleId'));
$row = $this->mdOrganization->get(['id' => $id]);
$title = $this->input_param('title');
if (!$row) {
$this->return_json('参数错误');
}
if (!$title) {
$this->return_json('请输入菜单名称');
}
$remark = $this->input_param('remark');
$imgs = getImageFromArray($this->input_param('logo'));
$upData = ['parentId' => $parentId, 'title' => $title];
$remark && $upData['remark'] = $remark;
if ($row['parentId'] != $parentId) {
$level = 0;
if ($parentId) {
$level = $this->mdOrganization->getLevel($parentId);
$level += 1;
}
$upData['level'] = $level;
if ($level > 5) {
$this->return_json('最多只能添加4级');
}
}
if ($level > 1) {
if ($this->mdOrganization->get(['parentId' => $parentId, 'status' => 0, "id != " => $id])) {
$this->return_json('该节点下已有子节点');
}
}
$imgs && $upData['logo'] = $imgs[0];
$cfId && $upData['cfId'] = $cfId;
$roleId && $upData['roleId'] = $roleId;
$this->mdOrganization->update($upData, ['id' => $id]);
$this->return_response();
}
public function index_post()
{
$parentId = intval($this->input_param('parentId'));
$cfId = intval($this->input_param('cfId'));
$roleId = intval($this->input_param('roleId'));
$title = $this->input_param('title');
if (!$title) {
$this->return_json('请输入名称');
}
$remark = $this->input_param('remark');
$imgs = getImageFromArray($this->input_param('logo'));
$level = 0;
if ($parentId) {
$level = $this->mdOrganization->getLevel($parentId);
$level += 1;
}
if ($level > 5) {
$this->return_json('最多只能添加4级');
}
if ($level > 1) {
if ($this->mdOrganization->get(['parentId' => $parentId, 'status' => 0])) {
$this->return_json('该节点下已有子节点');
}
}
$addData = ['parentId' => $parentId, 'title' => $title, 'level' => $level, 'createTime' => date('Y-m-d H:i:s')];
$remark && $addData['remark'] = $remark;
$imgs && $addData['logo'] = $imgs[0];
$cfId && $addData['cfId'] = $cfId;
$roleId && $addData['roleId'] = $roleId;
$id = $this->mdOrganization->add($addData);
if (!$id) {
$this->return_json('添加失败');
}
$this->return_response();
}
public function index_delete()
{
$id = intval($this->input_param('id'));
if (!$id) {
$this->return_json('参数错误');
}
$this->mdOrganization->update(['status' => -1], ['id' => $id]);
$this->return_response();
}
}
@@ -1,386 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
class User extends BaseController
{
const DEFAULT_ORG_TEAM_ID = 3; //默认机构团队id
public function __construct()
{
parent::__construct();
$this->load->model('agent/pingan/pingan_users_model');
$this->load->model('agent/organization/Organization_model', 'mdOrganization');
$this->load->model('area_model');
$this->load->model('agent/pingan/Pingan_sys_role_model', 'mdSysRole');
$this->orgId = $this->input_param("orgId");
if (!$this->orgId) {
$rows = $this->mdOrganization->select(['status' => 0, 'parentId' => 0], 'id desc', 1, 1, 'id,userTableModel');
$mdOrganization = $rows[0];
} else {
$mdOrganization = $this->mdOrganization->get(['id' => $this->orgId]);
}
$userTableModel = $mdOrganization['userTableModel'];
$this->load->model('agent/pingan/' . $userTableModel, 'pinganUsers');
}
public function page_get()
{
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$username = $this->input_param('username');
$mobile = $this->input_param('mobile');
$orgId = $this->input_param('orgId');
$teamId = $this->input_param('teamId');
$groupType = $this->input_param('groupType');
$centerNumber = $this->input_param('centerNumber');
$orgName = $this->input_param('orgName');
$citys = $this->input_param('citys');
$sort = $this->input_param('sort');
$order = $this->input_param('order');
$status = $this->input_param('status');
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'id desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$where = $list = [];
$where['status>='] = 0;
$username && $where["username like '%{$username}%'"] = null;
$mobile && $where["mobile like '%{$mobile}%'"] = null;
$orgId && $where['orgId'] = $orgId;
$teamId && $where['orgTeamId'] = $teamId;
$centerNumber && $where['centerNumber'] = $centerNumber;
strlen($groupType) && $where['groupType'] = $groupType;
$citys && $where['cityId'] = $citys[1];
$orgName && $where['orgName'] = $orgName;
strlen($status) && $where['status'] = intval($status);
$count = $this->pinganUsers->count($where);
if ($count) {
$res = $this->pinganUsers->select($where, $sort_order, $page, $limit);
$orgId = array_column($res, 'orgId');
$orgTeamId = array_column($res, 'orgTeamId');
$orgIdArray = array_merge($orgId, $orgTeamId);
$orgMap = $this->mdOrganization->get_map_by_ids($orgIdArray, '', 'id', 'title');
$areaIdArray = array_column($res, 'areaId');
$depIdArray = array_column($res, 'depId');
$teamIdArray = array_column($res, 'teamId');
$userIdArray = array_merge($areaIdArray, $depIdArray, $teamIdArray);
$userIds = implode(',', $userIdArray);
$mapUsers = [];
if ($userIds) {
$where = ["id in ({$userIds})" => null];
$mapUsers = $this->pinganUsers->map('id', '', $where, '', 0, 0, 'id,username,userCode');
}
foreach ($res as $v) {
$status = intval($v['status']);
// $orgName = $orgMap[$v['orgId']] ?: '';
$orgTeamName = $orgMap[$v['orgTeamId']] ?: '';
$city = $this->area_model->get(['city_id' => $v['cityId']]);
$areaUser = $mapUsers[$v['areaId']] ? $mapUsers[$v['areaId']][0] : [];
$depUser = $mapUsers[$v['depId']] ? $mapUsers[$v['depId']][0] : [];
$teamUser = $mapUsers[$v['teamId']] ? $mapUsers[$v['teamId']][0] : [];
$list[] = [
'id' => $v['id'], 'mobile' => $v['mobile'],
'username' => $v['username'], 'userCode' => $v['userCode'],
'status' => $status, 'updateTime' => $v['updateTime'],
'orgName' => $v['orgName'] ?: '', 'orgTeamName' => $orgTeamName,
'typeCn' => Pingan_users_model::TYPE_CN[$v['groupType']],
'groupType' => $v['groupType'], 'cityName' => $city['city_name'],
'centerNumber' => Pingan_users_model::TYPE_CENTER[$v['centerNumber']],
'areaUser' => $areaUser, 'depUser' => $depUser, 'teamUser' => $teamUser,
'orgId' => intval($v['orgId']), 'citys' => [$v['provinceId'], $v['cityId']],
'remark' => $v['remark']
];
}
}
$date = ['list' => $list, 'count' => $count];
$this->return_response_list($date);
}
public function groupType_get()
{
$res = Pingan_users_model::TYPE_CN;
$this->return_response($res);
}
public function center_get()
{
$res = Pingan_users_model::TYPE_CENTER;
$this->return_response($res);
}
public function orgNameList_get()
{
$this->return_response(Pingan_users_model::orgNameList);
}
public function index_put()
{
$id = $this->input_param('id');
$params = $this->input_param();
if (!$params['username']) {
$this->return_json('请输入用户账号');
}
if (!$params['userCode']) {
$this->return_json('请输入工号');
}
$row = $this->pinganUsers->get(['id' => $id]);
if (!$row) {
$this->return_json('参数错误');
}
if ($params['userCode'] != $row['userCode']) {
$mobileRow = $this->pinganUsers->get(['userCode' => $params['userCode'], 'status>=' => 0]);
if ($mobileRow) {
$this->return_json('帐号已存在');
}
}
$citys = $this->input_param('citys');
$upDate = [
'username' => $params['username'], 'mobile' => $params['mobile'], 'userCode' => $params['userCode'],
'remark' => $params['remark'], 'provinceId' => $citys[0] ?: 0, 'cityId' => $citys[1] ?: 0
];
$this->pinganUsers->update($upDate, ['id' => $id]);
$this->return_response();
}
public function index_post()
{
$params = $this->input_param();
if (!$params['username']) {
$this->return_json('请输入用户账号');
}
if (!$params['userCode']) {
$this->return_json('请输入工号');
}
$re = $this->pinganUsers->get(['userCode' => $params['userCode'], 'status>=' => 0]);
if ($re) {
$this->return_json('帐号已存在');
}
$citys = $this->input_param('citys');
$addDate = [
'username' => $params['username'], 'mobile' => $params['mobile'], 'userCode' => $params['userCode'],
'remark' => $params['remark'], 'createTime' => date('Y-m-d H:i:s'),
'orgId' => intval($params['orgId'])
];
$citys[0] && $addDate['provinceId'] = $citys[0];
$citys[1] && $addDate['cityId'] = $citys[1];
$id = $this->pinganUsers->add($addDate);
if (!$id) {
$this->return_json('添加用户失败');
}
$this->return_response();
}
public function status_put()
{
$id = $this->input_param('id');
$status = $this->input_param('status');
if (!$id) {
$this->return_json('参数错误');
}
$this->pinganUsers->update(['status' => $status], ['id' => $id]);
$this->return_response();
}
public function index_delete($id = null)
{
if (!$id) {
$this->return_json('参数错误');
}
$this->pinganUsers->update(['status' => -1], ['id' => $id]);
$this->return_response();
}
public function batch_delete()
{
$ids = $this->input_param('ids');
if (!$ids) {
$this->return_json('参数错误');
}
$str_ids = implode(',', $ids);
if ($str_ids) {
$this->pinganUsers->update(['status' => -1], ["id in($str_ids)" => null]);
}
$this->return_response();
}
public function import_post()
{
$log_file = 'import_user.log';
try {
$allowedExtensions = ['xlsx', 'xls'];
$file = $_FILES['file'];
if (!$file) {
throw new Exception('请选择文件');
}
if (!$file['tmp_name']) {//太大的图片上传,这个参数会变成空的
throw new Exception('参数错误');
}
$fileExtension = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
if (!in_array($fileExtension, $allowedExtensions)) {
throw new Exception('无效的文件类型!请上传.xlsx或.xls格式的Excel文件');
}
$uploadDir = FCPATH . 'temp' . DIRECTORY_SEPARATOR . date('Ymd');
if (!file_exists($uploadDir)) {
mkdir($uploadDir, 0777, true);
}
$filePath = $uploadDir . DIRECTORY_SEPARATOR . uniqid() . '_' . $file['name'];
if (!move_uploaded_file($file['tmp_name'], $filePath)) {
throw new Exception('保存上传文件失败');
}
// 根据文件扩展名选择合适的读取器
if ($fileExtension === 'xlsx') {
$reader = new PHPExcel_Reader_Excel2007();
} else {
$reader = new PHPExcel_Reader_Excel5();
}
if (!file_exists($filePath)) {
throw new Exception('文件不存在');
}
$PHPExcel = $reader->load($filePath); // 文档名称
$objWorksheet = $PHPExcel->getActiveSheet();
$rowCnt = $objWorksheet->getHighestRow(); //获取总行数
$col_max = $objWorksheet->getHighestColumn();//最大列
$data = [];
$successNum = 0; //新增用户数量
$updateNum = 0; //更新用户数量
$orgTeamId = $_SESSION['orgTeamId'] ?: self::DEFAULT_ORG_TEAM_ID;
$org = $this->mdOrganization->get(['id' => $orgTeamId]);
for ($i = 2; $i <= $rowCnt; $i++) { //读取内容
$name = $objWorksheet->getCell('A' . $i)->getValue();
$userCode = $objWorksheet->getCell('B' . $i)->getValue();
$teamName = $objWorksheet->getCell('C' . $i)->getValue();
$teamCode = $objWorksheet->getCell('D' . $i)->getValue();
$depName = $objWorksheet->getCell('E' . $i)->getValue();
$depCode = $objWorksheet->getCell('F' . $i)->getValue();
$areaName = $objWorksheet->getCell('G' . $i)->getValue();
$areaCode = $objWorksheet->getCell('H' . $i)->getValue();
$number = $objWorksheet->getCell('I' . $i)->getValue();
$cityId = $objWorksheet->getCell('J' . $i)->getValue();
$cityName = $objWorksheet->getCell('K' . $i)->getValue();
$groupType = $objWorksheet->getCell('L' . $i)->getValue();
if (!$userCode) {
continue;
}
$importData = [
$name, $userCode, $teamName, $teamCode, $depName, $depCode,
$areaName, $areaCode, $number, $cityId, $cityName, $groupType
];
debug_log("导入数据:" . json_encode($importData, JSON_UNESCAPED_UNICODE), $log_file);
$centerNumber = Pingan_users_model::TYPE_CENTER_CODE[$number] ?: '';
$cityRow = $this->area_model->get(["city_name like '%{$cityId}%'" => null]);
$teamUserId = $depUserId = $areaUserId = '';
$role = $this->mdSysRole->map('roleCode', 'roleId', ['status' => 0], '', '', '', 'roleId,roleCode');
if ($areaCode) { //获取区域用户id
$areaRow = $this->pinganUsers->get(['userCode' => $areaCode]);
if ($areaRow) {
$areaUserId = $areaRow['id'];
} else {
$areaAddData = [
'username' => $areaName,
'userCode' => $areaCode,
'groupType' => Pingan_users_model::GROUP_TYPE_AREA,
'orgTeamId' => $orgTeamId,
'centerNumber' => $centerNumber,
'orgName' => $cityName
];
$org && $areaAddData['orgId'] = $org['parentId'];
$cityRow && $areaAddData['cityId'] = $cityRow['city_id'];
$cityRow && $areaAddData['provinceId'] = $cityRow['province_id'];
$roleCode = "role-{$areaAddData['groupType']}";
$role[$roleCode] && $areaAddData['roleId'] = $role[$roleCode];
$areaUserId = $this->pinganUsers->add($areaAddData);
}
}
if ($depCode) { //获取部门用户uid
$depRow = $this->pinganUsers->get(['userCode' => $depCode]);
if ($depRow) {
$depUserId = $depRow['id'];
} else {
$depAddData = [
'username' => $depName,
'userCode' => $depCode,
'groupType' => Pingan_users_model::GROUP_TYPE_DEP,
'orgTeamId' => $orgTeamId,
'centerNumber' => $centerNumber,
'orgName' => $cityName
];
$org && $depAddData['orgId'] = $org['parentId'];
$cityRow && $depAddData['cityId'] = $cityRow['city_id'];
$cityRow && $depAddData['provinceId'] = $cityRow['province_id'];
$areaUserId && $depAddData['areaId'] = $areaUserId;
$roleCode = "role-{$depAddData['groupType']}";
$role[$roleCode] && $depAddData['roleId'] = $role[$roleCode];
$depUserId = $this->pinganUsers->add($depAddData);
}
}
if ($teamCode) { //获取团队用户id
$teamRow = $this->pinganUsers->get(['userCode' => $teamCode]);
if ($teamRow) {
$teamUserId = $teamRow['id'];
} else {
$teamAddData = [
'username' => $teamName,
'userCode' => $teamCode,
'groupType' => Pingan_users_model::GROUP_TYPE_TEAM,
'orgTeamId' => $orgTeamId,
'centerNumber' => $centerNumber,
'orgName' => $cityName
];
$org && $teamAddData['orgId'] = $org['parentId'];
$cityRow && $teamAddData['cityId'] = $cityRow['city_id'];
$cityRow && $teamAddData['provinceId'] = $cityRow['province_id'];
$areaUserId && $teamAddData['areaId'] = $areaUserId;
$depUserId && $teamAddData['depId'] = $depUserId;
$roleCode = "role-{$teamAddData['groupType']}";
$role[$roleCode] && $teamAddData['roleId'] = $role[$roleCode];
$teamUserId = $this->pinganUsers->add($teamAddData);
}
}
$userData = [
'username' => $name,
'userCode' => $userCode,
'groupType' => $groupType,
'orgTeamId' => $orgTeamId,
'centerNumber' => $centerNumber,
'orgName' => $cityName
];
$org && $userData['orgId'] = $org['parentId'];
$cityRow && $userData['cityId'] = $cityRow['city_id'];
$cityRow && $userData['provinceId'] = $cityRow['province_id'];
$areaUserId && $userData['areaId'] = $areaUserId;
$depUserId && $userData['depId'] = $depUserId;
$teamUserId && $userData['teamId'] = $teamUserId;
$roleCode = "role-{$userData['groupType']}";
$role[$roleCode] && $userData['roleId'] = $role[$roleCode];
$user = $this->pinganUsers->get(['userCode' => $userCode]);
if ($user) {
debug_log("更新数据:" . json_encode($userData, JSON_UNESCAPED_UNICODE), $log_file);
$result = $this->pinganUsers->update($userData, ['id' => $user['id']]);
debug_log("更新结果:" . $result, $log_file);
if (is_numeric($result) && $result) {
$updateNum += 1;
}
} else {
debug_log("新增数据:" . json_encode($userData, JSON_UNESCAPED_UNICODE), $log_file);
$result = $this->pinganUsers->add($userData);
if ($result) {
$successNum += 1;
}
}
}
$message = "新增{$successNum}条数据,更新{$updateNum}";
$this->return_response([], $message);
} catch (Exception $e) {
$this->return_json($e->getMessage());
}
}
}
-175
View File
@@ -1,175 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
class User extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/pingan/pingan_users_model', 'pinganUsers');
}
public function page_get()
{
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$username = $this->input_param('username');
$mobile = $this->input_param('mobile');
$sort = $this->input_param('sort');
$order = $this->input_param('order');
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'id desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$where = $list = [];
$where['status>='] = 0;
$username && $where["username like '%{$username}%'"] = null;
$mobile && $where["mobile like '%{$mobile}%'"] = null;
$count = $this->pinganUsers->count($where);
if ($count) {
$res = $this->pinganUsers->select($where, $sort_order, $page, $limit);
foreach ($res as $v) {
$status = intval($v['status']);
$list[] = [
'id' => $v['id'], 'mobile' => $v['mobile'],
'username' => $v['username'], 'userCode' => $v['userCode'],
'status' => $status, 'createTime' => $v['createTime'],
'typeCn' => Pingan_users_model::TYPE_CN[$v['groupType']],
];
}
}
$date = ['list' => $list, 'count' => $count];
$this->return_response_list($date);
}
public function index_get($userId = null)
{
if (!$userId) {
$this->return_json('参数错误');
}
$re = $this->mdSysAdmin->get(['userId' => $userId]);
if (!$re) {
$this->return_json('用户不存在');
}
$re['sexName'] = $re['sex'] == 2 ? '女' : '男';
$re['status'] = intval($re['status']);
$roles = [];
if ($re['roleId']) {
$re_ro = $this->mdSysRole->get(['roleId' => $re['roleId']]);
$re_ro && $roles[] = $re_ro;
}
$re['roles'] = $roles;
$this->return_response($re);
}
public function index_put()
{
$userId = $this->input_param('userId');
$nickname = $this->input_param('nickname');
$phone = $this->input_param('phone');
$sex = $this->input_param('sex');
$birthday = $this->input_param('birthday');
$introduction = $this->input_param('introduction');
$email = $this->input_param('email');
$roleIds = $this->input_param('roleIds');
if (!$userId) {
$this->return_json('参数错误');
}
if (!$nickname) {
$this->return_json('请输入用户名');
}
if (!$sex) {
$this->return_json('请选择性别');
}
if (!$roleIds) {
$this->return_json('请选择角色');
}
$roleId = intval($roleIds[0]);
$upDate = ['nickname' => $nickname, 'phone' => $phone, 'sex' => $sex, 'birthday' => $birthday,
'introduction' => $introduction, 'email' => $email, 'roleId' => $roleId];
$this->mdSysAdmin->update($upDate, ['userId' => $userId]);
$this->return_response();
}
public function index_post()
{
$username = $this->input_param('username');
$nickname = $this->input_param('nickname');
$phone = $this->input_param('phone');
$sex = $this->input_param('sex');
$birthday = $this->input_param('birthday');
$introduction = $this->input_param('introduction');
$email = $this->input_param('email');
$roleIds = $this->input_param('roleIds');
$password = $this->input_param('password');
if (!$username) {
$this->return_json('请输入用户帐户');
}
if (!$nickname) {
$this->return_json('请输入用户名');
}
if (!$sex) {
$this->return_json('请选择性别');
}
if (!$password) {
$this->return_json('请输入登录密码');
}
if (!$roleIds) {
$this->return_json('请选择角色');
}
$re = $this->mdSysAdmin->get(['username' => $username]);
if ($re) {
$this->return_json('用户帐号已存在');
}
$roleId = intval($roleIds[0]);
$password = password_hash($password, PASSWORD_BCRYPT);
$addDate = ['username' => $username, 'nickname' => $nickname, 'phone' => $phone, 'sex' => $sex, 'birthday' => $birthday
, 'password' => $password, 'introduction' => $introduction, 'email' => $email, 'roleId' => $roleId, 'createTime' => date('Y-m-d H:i:s')];
$id = $this->mdSysAdmin->add($addDate);
if (!$id) {
$this->return_json('添加用户失败');
}
$this->return_response();
}
public function status_put()
{
$id = $this->input_param('id');
$status = $this->input_param('status');
if (!$id) {
$this->return_json('参数错误');
}
$this->pinganUsers->update(['status' => $status], ['id' => $id]);
$this->return_response();
}
public function index_delete($id = null)
{
if (!$id) {
$this->return_json('参数错误');
}
$this->pinganUsers->update(['status' => -1], ['id' => $id]);
$this->return_response();
}
public function batch_delete()
{
$ids = $this->input_param('ids');
if (!$ids) {
$this->return_json('参数错误');
}
$str_ids = implode(',', $ids);
if ($str_ids) {
$this->pinganUsers->update(['status' => -1], ["id in($str_ids)" => null]);
}
$this->return_response();
}
}
@@ -1,140 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
class Clues extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/auto_product_model', 'autoProduct');
$this->load->model('receiver/receiver_clues_model', 'clues_model');
$this->load->model('receiver/receiver_clues_cfrom_model', 'clues_cfrom_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_series_model');
$this->load->model('receiver/receiver_clue_oplogs_model', 'mdOplogs');
$this->load->model('receiver/receiver_yx_model');
$this->load->model('receiver/receiver_xz_model');
$this->load->model('receiver/receiver_call_wechat_model');
$this->clues_model->set_db('ssdb');
$this->clues_cfrom_model->set_db('ssdb');
$this->auto_brand_model->set_db('ssdb');
$this->auto_series_model->set_db('ssdb');
$this->mdOplogs->set_db('ssdb');
$this->receiver_yx_model->set_db('ssdb');
$this->receiver_xz_model->set_db('ssdb');
$this->receiver_call_wechat_model->set_db('ssdb');
}
public function page_get()
{
$params = $this->input_param();
$page = $params['page'] ?: 1;
$limit = $params['limit'] ?: 10;
$title = $this->input_param('title');
$sort_order = 'id desc';
$statusList = $list = [];
$where = [
'app_id' => self::APP_ID
];
if ($title) {
$where['mobile LIKE "%' . trim($title) . '%"'] = null;
}
if ($params['dateRange'][0] && $params['dateRange'][1]) {
$where['en_time >='] = $params['dateRange'][0] . ' 00:00:00';
$where['en_time <='] = $params['dateRange'][1] . ' 23:59:59';
}
foreach ($this->clues_model->statusAry() as $key => $value) {
$statusList[$key] = $value['name'];
}
$count = $this->clues_model->count($where);
if ($count) {
$rows = $this->clues_model->select($where, $sort_order, $page, $limit);
$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'));
foreach ($rows as $v) {
$cfRow = $this->clues_cfrom_model->get(['id' => $v['cf2_id']]);
$brandName = $brands[$v['brand_id']] ? $brands[$v['brand_id']][0]['name'] : '';
$seriesName = $series[$v['series_id']] ? $series[$v['series_id']][0]['name'] : '';
$cfrom2 = $cfRow['title'] ?: '';
if ($v['cf2_id'] == self::CF2_PRODUCT) {
$product = $this->autoProduct->get(['id' => $v['out_id']]);
if ($product) {
$cfrom2 .= '-' . $product['title'];
}
}
$temp = [
'id' => $v['id'],
'mobile' => mobile_asterisk($v['mobile']),
'statusCn' => $statusList[$v['status']],
'cfrom' => $cfrom2,
'brandSeries' => "$brandName-$seriesName",
'enTime' => $v['en_time']
];
$list[] = $temp;
}
}
$data = ['list' => $list, 'count' => $count, 'statusList' => $statusList];
$this->return_response_list($data);
}
/**
* 详情
* @return void
*/
public function index_get()
{
$params = $this->input_param();
$id = intval($params['id']);
if (!$id) {
$this->return_json('非法参数!');
}
$re = $this->clues_model->get(array('id' => $id));
if (!$re || empty($re)) {
$this->return_json('线索不存在!');
}
$dataInfo = $re;
$dataInfo['mobile'] = mobile_asterisk($dataInfo['mobile']);
$dataInfo['c_time'] = date('Y-m-d H:i', $re['c_time']);
$selectedCar = ['brandId' => $re['brand_id'], 'seriesId' => $re['series_id'], 'modelId' => ''];
$dataInfo['selectedCar'] = $selectedCar;
$dataInfo['provinceCity'] = [substr($re['province_id'], 0, 3), $re['city_id'], $re['county_id']];
$this->return_response($dataInfo);
}
/**
* 操作日志
* @return void
*/
public function opt_get()
{
$params = $this->input_param();
$page = $params['page'] ?: 1;
$limit = $params['limit'] ?: 10;
$list = [];
$params = $this->input_param();
$id = intval($params['id']);
if (!$id) {
$this->return_json('非法参数!');
}
$where = ['clue_id' => $id];
$count = $this->mdOplogs->count($where);
if ($count) {
$resLogs = $this->mdOplogs->select($where, 'c_time desc', $page, $limit);
foreach ($resLogs as $key => $value) {
$setValue = array();
$setValue['uname'] = $value['uname'];
$setValue['log'] = $value['log'];
$setValue['type_name'] = $this->mdOplogs->typeAry()[$value['type']];
$setValue['c_time'] = date('Y-m-d H:i', $value['c_time']);
list($rec_url, $rec_text) = $this->mdOplogs->getRecordUrl($value['id']);
$setValue['rec_url'] = $rec_url;
$setValue['rec_text'] = $rec_text;
$list[] = $setValue;
}
}
$data = ['list' => $list, 'count' => $count];
$this->return_response_list($data);
}
}
@@ -1,209 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
class Customer extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('receiver/receiver_customers_model', 'customers_model');
$this->load->model('receiver/receiver_customer_oplogs_model', 'customer_oplogs_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_series_model');
$this->load->model("biz/biz_model");
$this->load->model('area_model');
$this->load->model('receiver/receiver_yx_model');
$this->load->model('receiver/receiver_xz_model');
$this->load->model('receiver/receiver_call_wechat_model');
$this->load->model('receiver/receiver_clues_cfrom_model', 'clues_cfrom_model');
$this->customers_model->set_db('ssdb');
$this->customer_oplogs_model->set_db('ssdb');
$this->auto_brand_model->set_db('ssdb');
$this->auto_series_model->set_db('ssdb');
$this->biz_model->set_db('ssdb');
$this->area_model->set_db('ssdb');
$this->receiver_yx_model->set_db('ssdb');
$this->receiver_xz_model->set_db('ssdb');
$this->receiver_call_wechat_model->set_db('ssdb');
$this->clues_cfrom_model->set_db('ssdb');
}
public function page_get()
{
$status_arr = $this->customers_model->get_status();
unset($status_arr['-1']);
$params = $this->input_param();
$page = $params['page'] ?: 1;
$limit = $params['limit'] ?: 10;
$sort_order = 'id desc';
$list = [];
$where = $this->buildWhere($params);
$count = $this->customers_model->count($where);
if ($count) {
$rows = $this->customers_model->select($where, $sort_order, $page, $limit);
//车型
$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'));
//获取门店
$biz_id_arr = array_unique(array_column($rows, 'biz_id'));
$biz_id_arr && $biz_rows = $this->biz_model->get_map_by_ids($biz_id_arr, 'id,biz_name,county_id');
foreach ($biz_rows as $v) {
$county_id_arr[] = $v[0]['county_id'];
}
if ($county_id_arr) {
$str_ids = implode(',', $county_id_arr);
$map_area = $this->area_model->map('county_id', '', ["county_id in ({$str_ids})" => null], '', 0, 0, 'county_id,province_name,city_name,county_name');
}
foreach ($rows as $val) {
$area = $map_area[$biz_rows[$val['biz_id']][0]['county_id']][0];
$brand_detail = '';
if ($brands[$val['brand_id']]) {
$brand_detail = $brands[$val['brand_id']][0]['name'];
}
if ($brands[$val['brand_id']]) {
$brand_detail .= '-' . $series[$val['series_id']][0]['name'];
}
$temp = [
'id' => $val['id'],
'mobile' => mobile_asterisk($val['mobile']),
'status_name' => $status_arr[$val['status']],
'biz_poi' => $area ? "{$area['province_name']}-{$area['city_name']}-{$area['county_name']}" : '',
'biz_name' => isset($biz_rows[$val['biz_id']]) ? $biz_rows[$val['biz_id']][0]['biz_name'] : '',
'brand_detail' => $brand_detail,
];
$list[] = $temp;
}
}
$data = ['list' => $list, 'count' => $count];
$this->return_response_list($data);
}
/**
* 详情
* @return void
*/
public function index_get()
{
$id = $this->input->get('id');
$this->load->model('auto/auto_series_model');
$select = '*, (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';
$row = $this->customers_model->get(array('id' => $id), $select);
if (!$row) {
$this->return_json('客户不存在!');
}
$row_biz = $this->biz_model->get(array('id' => $row['biz_id']));
//用户信息
$mobile_sub = mobile_asterisk($row['mobile']);
if ($row['county_id']) {
$area = $this->area_model->get(array('county_id' => $row['county_id']));
$poi = "{$area['province_name']}-{$area['city_name']}-{$area['county_name']}";
} elseif ($row['city_id']) {
$area = $this->area_model->get(array('city_id' => $row['city_id']));
$poi = "{$area['province_name']}-{$area['city_name']}";
} elseif ($row['province_id']) {
$area = $this->area_model->get(array('province_id' => $row['province_id']));
$poi = "{$area['province_name']}";
}
$brand_detail = '';
if ($row['brand_id']) {
$brand = $this->auto_brand_model->get(['id' => $row['brand_id']]);
$brand && $brand_detail = $brand['name'];
}
if ($row['series_id']) {
$series = $this->auto_series_model->get(['id' => $row['series_id']]);
$series && $brand_detail .= '-' . $series['name'];
}
$of_title = '';
if ($row['of_id']) {
$of = $this->clues_cfrom_model->get(array('id' => $row['of_id']));
$of_title = $of['title'];
if ($row['of2_id']) {
$of = $this->clues_cfrom_model->get(array('id' => $row['of2_id']));
$of_title .= '-' . $of['title'];
}
}
$data = array(
'id' => $row['id'],
'name' => $row['name'],
'level' => $row['level'],
'mobile' => $mobile_sub,
'wx_name' => $this->customers_model->wxgrAry($row['wxgr']),
'c_time' => date('Y-m-d H:i:s', $row['c_time']),
'p_time' => $row['p_time'],
'status' => $row['status'],
'poi' => $poi,
'biz' => $row_biz['biz_name'],
'brand_detail' => $brand_detail,
'of_title' => $of_title,
);
$selectedCar = ['brandId' => $row['brand_id'] ?: '', 'seriesId' => $row['series_id'] ?: '', 'modelId' => ''];
$data['selectedCar'] = $selectedCar;
$statusAry = $this->customers_model->get_status();
unset($statusAry['-1']);
$this->return_response($data);
}
/**
* 操作日志
* @return void
*/
public function opt_get()
{
$params = $this->input_param();
$page = $params['page'] ?: 1;
$limit = $params['limit'] ?: 10;
$params = $this->input_param();
$id = intval($params['id']);
if (!$id) {
$this->return_json('非法参数!');
}
$where = array('customer_id' => $id);
$count = $this->customer_oplogs_model->count($where);
$list = [];
$rows_log = $this->customer_oplogs_model->select($where, 'id desc', $page, $limit);
foreach ($rows_log as $key => $value) {
list($rec_url, $rec_text) = $this->customer_oplogs_model->getRecordUrl($value['id']);
$imgs = [];
if ($value['imgs']) {
$json_imgs = json_decode($value['imgs'], true);
foreach ($json_imgs as $key1 => $value1) {
$imgs[] = build_qiniu_image_url($value1);
}
}
$list[] = array(
'uname' => $value['uname'],
'log' => $value['log'],
'imgs' => $imgs,
'rec_url' => $rec_url,
'rec_text' => $rec_text,
'type_name' => $this->customer_oplogs_model->typeAry()[$value['type']],
'c_time' => date('Y-m-d H:i', $value['c_time'])
);
}
$data = ['list' => $list, 'count' => $count];
$this->return_response_list($data);
}
private function buildWhere($params)
{
$uid = $_SESSION['id'];
$app_id = self::APP_ID;
$where = [
'un_lock' => Receiver_customers_model::LOCK_STATUS
];
$where["rid in (select id from lc_receiver_clues where app_id={$app_id})"] = null;
if ($params['title']) {
$where['mobile LIKE "%' . trim($params['title']) . '%"'] = null;
}
if ($params['dateRange'][0] && $params['dateRange'][1]) {
$where['c_time >='] = strtotime($params['dateRange'][0] . ' 00:00:00');
$where['c_time <='] = strtotime($params['dateRange'][1] . ' 23:59:59');
}
return $where;
}
}
@@ -1,261 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
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');
$this->load->model('agent/receiver_order_subsidy_model');
$this->load->model('receiver/receiver_clues_model');
$this->load->model('receiver/order/receiver_orders_model');
$this->load->model('receiver/order/receiver_order_datas_model');
$this->load->model('biz/biz_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_series_model');
$this->receiver_clues_model->set_db('ssdb');
$this->receiver_orders_model->set_db('ssdb');
$this->biz_model->set_db('ssdb');
$this->auto_brand_model->set_db('ssdb');
$this->auto_series_model->set_db('ssdb');
$this->receiver_order_datas_model->set_db('ssdb');
}
public function page_get()
{
$params = $this->input_param();
$page = $params['page'] ?: 1;
$limit = $params['limit'] ?: 10;
$list = [];
$where = [];
$count = $this->receiver_order_subsidy_model->count($where);
if ($count) {
$rows = $this->receiver_order_subsidy_model->select($where, 'id desc', $page, $limit);
//车型
$brands = $this->auto_brand_model->get_map_by_ids(array_column($rows, 'brandId'));
$series = $this->auto_series_model->get_map_by_ids(array_column($rows, 'seriesId'));
foreach ($rows as $row) {
$order = $this->receiver_orders_model->get(['id' => $row['orderId']]);
$orderData = $this->receiver_order_datas_model->get(['o_id' => $order['id']]);
$clues = $this->receiver_clues_model->get(['id' => $order['clue_id']]);
$area = $this->area_model->get(['city_id' => $row['cityId']]);
$biz = $this->biz_model->get(['id' => $row['bizId']]);
$brand_detail = '';
if ($brands[$row['brandId']]) {
$brand_detail = $brands[$row['brandId']][0]['name'];
}
if ($series[$row['seriesId']]) {
$brand_detail .= '-' . $series[$row['seriesId']][0]['name'];
}
$idCardImg = [];
if ($orderData['cardida']) {
$idCardImg[] = ['title' => '身份证正面', 'img' => build_qiniu_image_url($orderData['cardida'])];
}
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'],
'name' => $order['name'],
'mobile' => $order['mobile'],
'cSid' => $clues['sid'],
'cityName' => $area['city_name'],
'bizName' => $biz['biz_name'],
'brandName' => $brand_detail,
'statusCn' => Receiver_order_subsidy_model::IF_CHECK_STATUS[$row['ifcheck']],
'contractImg' => $row['contractImg'] ? build_qiniu_image_url($row['contractImg']) : '',
'billImg' => $row['billImg'] ? build_qiniu_image_url($row['billImg']) : '',
'businessImg' => $row['businessImg'] ? build_qiniu_image_url($row['businessImg']) : '',
'cTime' => $row['createTime'],
'ifcheck' => intval($row['ifcheck']),
'reason' => $row['reason'],
'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
];
}
}
$data = ['list' => $list, 'count' => $count];
$this->return_response_list($data);
}
/**
* 详情
* @return void
*/
public function index_get()
{
$id = $this->input->get('id');
$this->load->model('auto/auto_series_model');
$select = '*, (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';
$row = $this->customers_model->get(array('id' => $id), $select);
if (!$row) {
$this->return_json('客户不存在!');
}
$row_biz = $this->biz_model->get(array('id' => $row['biz_id']));
//用户信息
$mobile_sub = $row['mobile'];
if ($row['county_id']) {
$area = $this->area_model->get(array('county_id' => $row['county_id']));
$poi = "{$area['province_name']}-{$area['city_name']}-{$area['county_name']}";
} elseif ($row['city_id']) {
$area = $this->area_model->get(array('city_id' => $row['city_id']));
$poi = "{$area['province_name']}-{$area['city_name']}";
} elseif ($row['province_id']) {
$area = $this->area_model->get(array('province_id' => $row['province_id']));
$poi = "{$area['province_name']}";
}
$brand_detail = '';
if ($row['brand_id']) {
$brand = $this->auto_brand_model->get(['id' => $row['brand_id']]);
$brand && $brand_detail = $brand['name'];
}
if ($row['series_id']) {
$series = $this->auto_series_model->get(['id' => $row['series_id']]);
$series && $brand_detail .= '-' . $series['name'];
}
$of_title = '';
if ($row['of_id']) {
$of = $this->clues_cfrom_model->get(array('id' => $row['of_id']));
$of_title = $of['title'];
if ($row['of2_id']) {
$of = $this->clues_cfrom_model->get(array('id' => $row['of2_id']));
$of_title .= '-' . $of['title'];
}
}
$data = array(
'id' => $row['id'],
'name' => $row['name'],
'level' => $row['level'],
'mobile' => $mobile_sub,
'wx_name' => $this->customers_model->wxgrAry($row['wxgr']),
'c_time' => $row['createTime'],
'p_time' => $row['p_time'],
'status' => $row['status'],
'poi' => $poi,
'biz' => $row_biz['biz_name'],
'brand_detail' => $brand_detail,
'of_title' => $of_title,
);
$selectedCar = ['brandId' => $row['brand_id'] ?: '', 'seriesId' => $row['series_id'] ?: '', 'modelId' => ''];
$data['selectedCar'] = $selectedCar;
$statusAry = $this->customers_model->get_status();
unset($statusAry['-1']);
$this->return_response($data);
}
/**
* 审核
* @return void
*/
public function check_post()
{
$id = $this->post('id');
$status = $this->post('status');
$reason = $this->post('reason');
/** @var ReceiverOrderSubsidyEntity $row */
$row = $this->receiver_order_subsidy_model->get(['id' => $id], '', 'ReceiverOrderSubsidyEntity');
if (!$row) {
$this->return_json('数据不存在!');
}
if ($row->ifcheck != Receiver_order_subsidy_model::IF_CHECK_NO) {
$this->return_json('当前数据不是待审核状态!');
}
$result = $row->ifCheckSubsidy($status, $reason);
if (!$result->isSuccess()) {
$this->return_json($result->getMessage());
}
$this->return_response();
}
public function sendLog_get()
{
$params = $this->input_param();
$page = $params['page'] ?: 1;
$limit = $params['limit'] ?: 10;
$list = [];
$where = [
'ifcheck' => Receiver_order_subsidy_model::IF_CHECK_YES
];
$params['status'] && $where['status'] = $params['status'];
if ($params['dateRange']) {
$where['checkTime>='] = $params['dateRange'][0] . ' 00:00:00';
$where['checkTime<='] = $params['dateRange'][0] . ' 23:59:59';
}
if ($params['name'] || $params['mobile']) {
if ($params['name'] && $params['mobile']) {
$oWhere['name'] = $params['name'];
$oWhere['mobile'] = $params['mobile'];
} else {
$oWhere["name='{$params['name']}' or mobile='{$params['mobile']}'"] = null;
}
$orderList = $this->receiver_orders_model->select($oWhere, '', 0, 0, 'id');
$orderIdsArray = array_column($orderList, 'id');
$orderIds = implode(',', $orderIdsArray);
!$orderIds && $orderIds = '0';
$where["orderId in ($orderIds)"] = null;
}
$count = $this->receiver_order_subsidy_model->count($where);
if ($count) {
$rows = $this->receiver_order_subsidy_model->select($where, 'id desc', $page, $limit);
//车型
foreach ($rows as $row) {
$order = $this->receiver_orders_model->get(['id' => $row['orderId']]);
$orderData = $this->receiver_order_datas_model->get(['o_id' => $order['id']]);
$userData = $this->auto_user_data_model->get(['userId' => $row['userId']]);
$userCoupon = $this->auto_user_coupon_model->get([
'couponId' => $row['couponId'], 'userId' => $row['userId'], 'status' => Auto_user_coupon_model::STATUS_USED
]);
$list[] = [
'id' => $row['id'],
'name' => $order['name'],
'mobile' => $order['mobile'],
'bankCardNum' => $userData['bankCardNum'] ?: '',
'bankName' => $userData['bankName'] ?: '',
'bankImg' => $userData['bankImg'] ? build_qiniu_image_url($userData['bankImg']) : '',
'statusCn' => Receiver_order_subsidy_model::STATUS_STATUS[$row['status']],
'checkTime' => $row['checkTime'],
'price' => intval($userCoupon['price']),
'cardId' => $order['card_id'] ?: '',
'cardida' => $orderData['cardida'] ? build_qiniu_image_url($orderData['cardida']) : '',
'cardidb' => $orderData['cardidb'] ? build_qiniu_image_url($orderData['cardidb']) : '',
'status' => $row['status'],
];
}
}
$data = ['list' => $list, 'count' => $count];
$this->return_response_list($data);
}
//修改状态
public function status_post()
{
$id = $this->input_param('id');
$status = $this->input_param('status');
if (!$id) {
$this->return_json('参数错误');
}
$this->receiver_order_subsidy_model->update(['status' => $status], ['id' => $id]);
$this->return_response();
}
public function statusList_get()
{
$this->return_response(Receiver_order_subsidy_model::STATUS_STATUS);
}
}
@@ -1,825 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_活动管理
* Created on: 2022/9/19 17:15
* Created by: dengbw
*/
class Activity extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_activity_model', 'mdSyliveActivity');
$this->load->model('agent/admin/Market_sylive_activity_biz_model', 'mdSyliveActivityBiz');
$this->load->model('agent/admin/Market_sylive_activity_draw_model', 'mdSyliveActivityDraw');
$this->load->model('agent/admin/Market_sylive_organization_model', 'mdSyliveOrganization');
$this->load->model('market/Market_sylive_team_model', 'mdSyliveTeam');
$this->load->model('market/Market_sylive_activity_team_model', 'mdSyliveActivityTeam');
$this->load->model('market/Market_sylive_groups_model', 'mdSyliveGroups');
$this->load->model('market/Market_sylive_groups_user_model', 'mdSyliveGroupsUser');
$this->load->model('market/Market_sylive_customer_model', 'mdSyliveCustomer');
}
/**
* Notes:活动管理列表
* Created on: 2022/9/20 14:48
* Created by: dengbw
*/
public function page_get()
{
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$title = $this->input_param('title');
$sort = $this->input_param('sort');
$order = $this->input_param('order');
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'activityId desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$list = [];
$where['status>='] = 0;
$title && $where['title LIKE "%' . trim($title) . '%"'] = null;
if ($_SESSION['brandName']) {//品牌机构
$re_org = $this->mdSyliveOrganization->get(['organizationName' => $_SESSION['brandName'], 'parentId' => 0, 'status' => 0]);
if ($re_org['organizationId']) {
$where['organizationId'] = $re_org['organizationId'];
} else {
$where['organizationId'] = -1;
}
}
$count = $this->mdSyliveActivity->count($where);
if ($count) {
$this->load->library('MyEncryption');
$res = $this->mdSyliveActivity->select($where, $sort_order, $page, $limit);
foreach ($res as $v) {
$dateRange = $v['timeStart'] != '0000-00-00 00:00:00' ? [$v['timeStart'], $v['timeEnd']] : '';
$status = intval($v['status']);
$activityId = intval($v['activityId']);
$bgImg = $channelImg = $banner = $sharePhoto = $shareImg = $shareTitle = $pay = $bottoms = [];
$item = ['itemImg' => [], 'title' => '', 'introduction' => '', 'price' => '', 'stock' => '', 'dateRange' => ''];
$coupon = ['img' => [], 'title' => '', 'rules' => '', 'price' => '', 'dateRange' => ''];
$draw = ['bgImg' => [], 'sms' => '', 'screenDisplay' => 1, 'winNum' => [], 'winType' => []];
$pay = ['way' => 1, 'price' => '', 'img' => []];
$signBespeak = ['status' => 0, 'title' => '', 'content' => '', 'itemId' => '', 'payItemId' => ''];
$barrage = ['color' => 0, 'title' => ''];
$button = ['title' => ''];
$v['shareTitle'] && $shareTitle = json_decode($v['shareTitle'], true);
$jsondata = $v['jsondata'] ? json_decode($v['jsondata'], true) : [];
if ($jsondata['item']) {
$getItem = $jsondata['item'];
$item['stock'] = $v['stock'];
$item['title'] = $getItem['title'];
$item['introduction'] = $getItem['introduction'];
$item['price'] = $getItem['price'];
$item['dateRange'] = $getItem['timeStart'] ? [$getItem['timeStart'], $getItem['timeEnd']] : [];
$item['dateUseRange'] = $getItem['useTimeStart'] ? [$getItem['useTimeStart'], $getItem['useTimeEnd']] : [];
if ($getItem['itemImg']) {
$itemImg = [];
foreach ($getItem['itemImg'] as $k2 => $v2) {
$itemImg[] = ['uid' => $k2, 'fileUrl' => $v2, 'url' => build_qiniu_image_url($v2), 'status' => 'done'];
}
$item['itemImg'] = $itemImg;
}
}
if ($jsondata['coupon']) {
$getCoupon = $jsondata['coupon'];
$coupon['title'] = $getCoupon['title'];
$coupon['rules'] = $getCoupon['rules'];
$coupon['price'] = $getCoupon['price'];
$coupon['dateUseRange'] = $getCoupon['useTimeStart'] ? [$getCoupon['useTimeStart'], $getCoupon['useTimeEnd']] : [];
if ($getCoupon['img']) {
$itemImg = [];
foreach ($getCoupon['img'] as $k2 => $v2) {
$itemImg[] = ['uid' => $k2, 'fileUrl' => $v2, 'url' => build_qiniu_image_url($v2), 'status' => 'done'];
}
$coupon['img'] = $itemImg;
}
}
if (intval($jsondata['pay']['way']) > 1) {
$pay = $jsondata['pay'];
if ($pay['img']) {
$img[] = ['uid' => 1, 'fileUrl' => $pay['img'], 'url' => build_qiniu_image_url($pay['img']), 'status' => 'done'];
$pay['img'] = $img;
} else {
$pay['img'] = [];
}
}
if ($jsondata['banner']) {
$banner = [['uid' => 1, 'fileUrl' => $jsondata['banner'], 'url' => build_qiniu_image_url($jsondata['banner']), 'status' => 'done']];
}
if ($v['bgImg']) {
$bgImg = [['uid' => 1, 'fileUrl' => $v['bgImg'], 'url' => build_qiniu_image_url($v['bgImg']), 'status' => 'done']];
}
if ($v['channelImg']) {
$channelImg = [['uid' => 1, 'fileUrl' => $v['channelImg'], 'url' => build_qiniu_image_url($v['channelImg']), 'status' => 'done']];
}
if ($v['sharePhoto']) {
$sharePhoto = [['uid' => 1, 'fileUrl' => $v['sharePhoto'], 'url' => build_qiniu_image_url($v['sharePhoto']), 'status' => 'done']];
}
if ($v['shareImg']) {
$getShareImg = json_decode($v['shareImg'], true);
foreach ($getShareImg as $k2 => $v2) {
$shareImg[] = ['uid' => $k2, 'fileUrl' => $v2, 'url' => build_qiniu_image_url($v2), 'status' => 'done'];
}
}
if ($jsondata['bottoms']) {
foreach ($jsondata['bottoms'] as $k2 => $v2) {
$icon = [];
if ($v2['icon']) {
$icon[] = ['uid' => $k2, 'fileUrl' => $v2['icon'], 'url' => build_qiniu_image_url($v2['icon']), 'status' => 'done'];
}
$v2['icon'] = $icon;
$bottoms[] = $v2;
}
}
$skey = $this->myencryption->base64url_encode("a_id=" . $activityId);
if ($activityId >= 6) {
$url = http_host_com('home') . "/h5/market/sylive2?skey=" . $skey;//活动连接
} else {
$url = http_host_com('home') . "/h5/market/sylive?skey=" . $skey;//活动连接
}
$serviceLink = $jsondata['serviceLink'] ? $jsondata['serviceLink'] : '';
$activityStart = $v['activityStart'] != '0000-00-00 00:00:00' ? $v['activityStart'] : '';
$organizationId = $v['organizationId'] ? intval($v['organizationId']) : '';
$groups = 0;
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'parentId' => 0, 'status>=' => 0]);
$re_gro && $groups = 1;
$blacklist = intval($jsondata['blacklist']);
$jsondata['signBespeak'] && $signBespeak = $jsondata['signBespeak'];
$jsondata['barrage'] && $barrage = $jsondata['barrage'];
$jsondata['button'] && $button = $jsondata['button'];
//抽奖配置
$re_draw = $this->mdSyliveActivityDraw->get(['activityId' => $activityId]);
if ($re_draw) {
$draw['screenDisplay'] = intval($re_draw['screenDisplay']);
if ($re_draw['bgImg']) {
$draw['bgImg'] = [['uid' => 1, 'fileUrl' => $re_draw['bgImg'], 'url' => build_qiniu_image_url($re_draw['bgImg']), 'status' => 'done']];
}
$re_draw['sms'] && $draw['sms'] = $re_draw['sms'];
$re_draw['winNum'] && $draw['winNum'] = json_decode($re_draw['winNum'], true);
if ($re_draw['winType']) {
$winType = [];
$json_winType = json_decode($re_draw['winType'], true);
foreach ($json_winType as $v2) {
$v2['img'] = $v2['img'] ?
[['uid' => 1, 'fileUrl' => $v2['img'], 'url' => build_qiniu_image_url($v2['img']), 'status' => 'done']] : [];
$winType[] = $v2;
}
$draw['winType'] = $winType;
}
}
//访问标签
$visitTag = [];
$visitTagAry = $this->mdSyliveCustomer->visitTagAry();
foreach ($visitTagAry as $k2 => $v2) {
$tag = $jsondata['visitTag'][$k2] ? $jsondata['visitTag'][$k2] : '';
$visitTag[] = ['id' => $k2, 'title' => $v2, 'tag' => $tag];
}
$list[] = [
'activityId' => $activityId, 'title' => $v['title'], 'channelId' => $v['channelId'], 'pay' => $pay, 'organizationId' => $organizationId,
'activityStart' => $activityStart, 'shareTitle' => $shareTitle, 'dateRange' => $dateRange, 'coupon' => $coupon, 'drawCode' => $v['drawCode'],
'bgImg' => $bgImg, 'channelImg' => $channelImg, 'banner' => $banner, 'sharePhoto' => $sharePhoto, 'shareImg' => $shareImg, 'item' => $item, 'url' => $url,
'mchId' => $v['mchId'], 'protocolTitle' => $v['protocolTitle'], 'protocol' => $v['protocol'], 'serviceLink' => $serviceLink,
'bottoms' => $bottoms, 'draw' => $draw, 'visitTag' => $visitTag, 'blacklist' => $blacklist,
'signBespeak' => $signBespeak, 'barrage' => $barrage, 'button' => $button, 'orderType' => intval($v['orderType']),
's_time' => $v['timeStart'], 'e_time' => $v['timeEnd'], 'status' => $status, 'groups' => $groups, 'createTime' => $v['createTime']];
}
}
$date = ['list' => $list, 'count' => $count];
$this->return_response_list($date);
}
/**
* Notes:添加活动
* Created on: 2022/9/21 16:46
* Created by: dengbw
*/
public function index_post()
{
$title = $this->input_param('title');
$channelId = $this->input_param('channelId');
$dateRange = $this->input_param('dateRange');
$shareTitle = $this->input_param('shareTitle');
$shareImg = $this->input_param('shareImg');
$bgImg = $this->input_param('bgImg');
$channelImg = $this->input_param('channelImg');
$sharePhoto = $this->input_param('sharePhoto');
$organizationId = intval($this->input_param('organizationId'));
$pay = $this->input_param('pay');
$drawCode = $this->input_param('drawCode');
$banner = $this->input_param('banner');
$mchId = $this->input_param('mchId');
$protocolTitle = $this->input_param('protocolTitle');
$protocol = $this->input_param('protocol');
$serviceLink = $this->input_param('serviceLink');
$activityStart = $this->input_param('activityStart');
$bottoms = $this->input_param('bottoms');
$signBespeak = $this->input_param('signBespeak');
$orderType = $this->input_param('orderType') ?: 0;
if (!$title) {
$this->return_json('请输入活动标题');
}
if (!$bgImg[0]['fileUrl']) {
$this->return_json('请选择背景图');
}
if (!$channelId) {
$this->return_json('请输入直播频道');
}
if (!$dateRange) {
$this->return_json('请选择直播时间');
}
if ($drawCode) {
$re = $this->mdSyliveActivity->get(['drawCode' => $drawCode, 'status' => 0], 'drawCode');
if ($re['drawCode']) {
$this->return_json('抽奖码已存在');
}
}
$bgImg = $bgImg[0]['fileUrl'];
$sharePhoto = $sharePhoto ? $sharePhoto[0]['fileUrl'] : '';
$channelImg = $channelImg ? $channelImg[0]['fileUrl'] : '';
$banner = $banner ? $banner[0]['fileUrl'] : '';
$shareTitle = $shareTitle ? json_encode($shareTitle, JSON_UNESCAPED_UNICODE) : '';
$setShareImg = '';
if ($shareImg) {
foreach ($shareImg as $v) {
$setShareImg[] = $v['fileUrl'];
}
$setShareImg = json_encode($setShareImg, JSON_UNESCAPED_UNICODE);
}
if ($pay['way'] > 1) {
$pay['img'] = $pay['img'][0]['fileUrl'] ? $pay['img'][0]['fileUrl'] : '';
} else {
$pay = ['way' => 1, 'price' => '', 'img' => []];
}
$jsondata['pay'] = $pay;
$jsondata['banner'] = $banner;
$jsondata['serviceLink'] = $serviceLink;
$setBottoms = [];
foreach ($bottoms as $v) {
if ($v['urlType'] == 'link') {
$v['miniProgramId'] = '';
}
$v['icon'] = $v['icon'][0]['fileUrl'] ? $v['icon'][0]['fileUrl'] : '';
$setBottoms[] = $v;
}
$jsondata['bottoms'] = $setBottoms;
$jsondata['blacklist'] = intval($this->input_param('blacklist'));
$jsondata['signBespeak'] = $signBespeak;
$jsondata['barrage'] = $this->input_param('barrage');
$jsondata['button'] = $this->input_param('button');
$jsondata = json_encode($jsondata, JSON_UNESCAPED_UNICODE);
$createTime = date('Y-m-d H:i:s');
$addData = ['title' => $title, 'bgImg' => $bgImg, 'channelImg' => $channelImg, 'channelId' => $channelId, 'jsondata' => $jsondata
, 'shareTitle' => $shareTitle, 'sharePhoto' => $sharePhoto, 'shareImg' => $setShareImg, 'organizationId' => $organizationId
, 'drawCode' => $drawCode, 'mchId' => $mchId, 'protocolTitle' => $protocolTitle, 'protocol' => $protocol, 'activityStart' => $activityStart
, 'timeStart' => $dateRange[0], 'timeEnd' => $dateRange[1], 'status' => 1, 'createTime' => $createTime, 'orderType' => $orderType];
$activityId = $this->mdSyliveActivity->add($addData);
if (!$activityId) {
$this->return_json('添加活动失败');
}
if ($organizationId) {
$re = $this->mdSyliveOrganization->get(['organizationId' => $organizationId, 'status' => 0]);
if ($re['organizationName']) {//加顶级分组
$this->mdSyliveGroups->add(['groupsName' => $re['organizationName'], 'activityId' => $activityId,
'statisticsType' => 4, 'createTime' => $createTime]);
}
}
$this->return_response();
}
/**
* Notes:修改活动
* Created on: 2022/9/21 14:48
* Created by: dengbw
*/
public function index_put()
{
$activityId = intval($this->input_param('activityId'));
$title = $this->input_param('title');
$channelId = $this->input_param('channelId');
$dateRange = $this->input_param('dateRange');
$shareTitle = $this->input_param('shareTitle');
$shareImg = $this->input_param('shareImg');
$bgImg = $this->input_param('bgImg');
$channelImg = $this->input_param('channelImg');
$sharePhoto = $this->input_param('sharePhoto');
$pay = $this->input_param('pay');
$drawCode = $this->input_param('drawCode');
$banner = $this->input_param('banner');
$mchId = $this->input_param('mchId');
$protocolTitle = $this->input_param('protocolTitle');
$protocol = $this->input_param('protocol');
$serviceLink = $this->input_param('serviceLink');
$organizationId = intval($this->input_param('organizationId'));
$activityStart = $this->input_param('activityStart');
$bottoms = $this->input_param('bottoms');
$signBespeak = $this->input_param('signBespeak');
$orderType = $this->input_param('orderType') ?: 0;
if (!$activityId) {
$this->return_json('参数错误');
}
if (!$title) {
$this->return_json('请输入活动标题');
}
if (!$bgImg[0]['fileUrl']) {
$this->return_json('请选择背景图');
}
if (!$channelId) {
$this->return_json('请输入直播频道');
}
if (!$dateRange) {
$this->return_json('请选择直播时间');
}
$re = $this->mdSyliveActivity->get(['activityId' => $activityId]);
if (!$re) {
$this->return_json('活动不存在');
}
if ($drawCode) {
if ($drawCode != $re['drawCode']) {
$re = $this->mdSyliveActivity->get(['drawCode' => $drawCode, 'status' => 0], 'drawCode');
if ($re['drawCode']) {
$this->return_json('抽奖码已存在');
}
}
}
$bgImg = $bgImg[0]['fileUrl'];
$sharePhoto = $sharePhoto ? $sharePhoto[0]['fileUrl'] : '';
$channelImg = $channelImg ? $channelImg[0]['fileUrl'] : '';
$banner = $banner ? $banner[0]['fileUrl'] : '';
$shareTitle = $shareTitle ? json_encode($shareTitle, JSON_UNESCAPED_UNICODE) : '';
$setShareImg = '';
if ($shareImg) {
foreach ($shareImg as $v) {
$setShareImg[] = $v['fileUrl'];
}
$setShareImg = json_encode($setShareImg, JSON_UNESCAPED_UNICODE);
}
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : [];
if ($pay['way'] > 1) {
$pay['img'] = $pay['img'][0]['fileUrl'] ? $pay['img'][0]['fileUrl'] : '';
} else {
$pay = ['way' => 1, 'price' => '', 'img' => []];
}
$jsondata['pay'] = $pay;
$jsondata['banner'] = $banner;
$jsondata['serviceLink'] = $serviceLink;
$jsondata['blacklist'] = intval($this->input_param('blacklist'));
$jsondata['signBespeak'] = $signBespeak;
$jsondata['barrage'] = $this->input_param('barrage');
$jsondata['button'] = $this->input_param('button');
$setBottoms = [];
foreach ($bottoms as $v) {
if ($v['urlType'] == 'link') {
$v['miniProgramId'] = '';
}
$v['icon'] = $v['icon'][0]['fileUrl'] ? $v['icon'][0]['fileUrl'] : '';
$setBottoms[] = $v;
}
$jsondata['bottoms'] = $setBottoms;
$jsondata = json_encode($jsondata, JSON_UNESCAPED_UNICODE);
$upData = ['title' => $title, 'bgImg' => $bgImg, 'channelImg' => $channelImg, 'channelId' => $channelId, 'activityStart' => $activityStart,
'shareTitle' => $shareTitle, 'sharePhoto' => $sharePhoto, 'shareImg' => $setShareImg, 'jsondata' => $jsondata,
'drawCode' => $drawCode, 'mchId' => $mchId, 'protocolTitle' => $protocolTitle, 'protocol' => $protocol,
'timeStart' => $dateRange[0], 'timeEnd' => $dateRange[1], 'organizationId' => $organizationId, 'orderType' => $orderType];
$this->mdSyliveActivity->update($upData, ['activityId' => $activityId]);
$this->return_response();
}
/**
* Notes:复制活动
* Created on: 2022/12/8 10:08
* Created by: dengbw
* @param null $activityId
*/
public function copy_get($activityId = null)
{
$activityIdOld = intval($activityId);
if (!$activityIdOld) {
$this->return_json('参数错误');
}
$re = $this->mdSyliveActivity->get(['activityId' => $activityIdOld]);
if (!$re) {
$this->return_json('活动不存在');
}
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : [];
$jsondata['banner'] = '';
$createTime = date('Y-m-d H:i:s');
$addData = ['title' => '【复制】' . $re['title'], 'organizationId' => $re['organizationId'], 'mchId' => $re['mchId']
, 'protocolTitle' => $re['protocolTitle'], 'protocol' => $re['protocol']
, 'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE), 'status' => 1, 'createTime' => $createTime];
$activityId = $this->mdSyliveActivity->add($addData);
if (!$activityId) {
$this->return_json('复制活动失败');
}
$groupsIds = [];
if ($re['organizationId']) {//分组所属机构
//分级分组
$groupsLevel = [['groupsLevel' => 0, 'parentId' => 'parentId=0', 'title' => '顶级']
, ['groupsLevel' => 1, 'parentId' => 'parentId>0', 'title' => '1级']
, ['groupsLevel' => 2, 'parentId' => 'parentId>0', 'title' => '2级']
, ['groupsLevel' => 3, 'parentId' => 'parentId>0', 'title' => '3级']
, ['groupsLevel' => 0, 'parentId' => 'parentId>0', 'title' => '门店']];
$fileds = 'groupsId,parentId,groupsLevel,sortNumber,userFrom,groupsName,ifBiz,statisticsType,originalBizId';
foreach ($groupsLevel as $v1) {
$res = $this->mdSyliveGroups->select(['groupsLevel' => $v1['groupsLevel'], $v1['parentId'] => null
, 'status>=' => 0, 'activityId' => $activityIdOld], 'groupsId asc', 0, 0, $fileds);
foreach ($res as $v2) {
$parentId = intval($groupsIds[$v2['parentId']]);
$groupsData = ['activityId' => $activityId, 'parentId' => $parentId, 'originalBizId' => $v2['originalBizId']
, 'groupsName' => $v2['groupsName'], 'groupsLevel' => $v2['groupsLevel'], 'statisticsType' => $v2['statisticsType']
, 'userFrom' => $v2['userFrom'], 'ifBiz' => $v2['ifBiz'], 'sortNumber' => $v2['sortNumber'], 'createTime' => $createTime];
$groupsId = $this->mdSyliveGroups->add($groupsData);
$groupsId && $groupsIds[$v2['groupsId']] = $groupsId;
}
}
//分组用户
$fileds = 'userId,groupsId,bizId,levelId1,levelId2,levelId3,type,userFrom,status';
$res = $this->mdSyliveGroupsUser->select(['status>=' => 0, 'activityId' => $activityIdOld], 'groupsUserId asc', 0, 0, $fileds);
$userData = [];
foreach ($res as $v) {
$groupsId = intval($groupsIds[$v['groupsId']]);
$bizId = intval($groupsIds[$v['bizId']]);
$levelId1 = intval($groupsIds[$v['levelId1']]);
$levelId2 = intval($groupsIds[$v['levelId2']]);
$levelId3 = intval($groupsIds[$v['levelId3']]);
$userData[] = [
'activityId' => $activityId, 'userId' => $v['userId'], 'groupsId' => $groupsId, 'bizId' => $bizId, 'levelId1' => $levelId1,
'levelId1' => $levelId1, 'levelId2' => $levelId2, 'levelId3' => $levelId3,
'type' => $v['type'], 'userFrom' => $v['userFrom'], 'status' => $v['status'], 'createTime' => $createTime];
}
$userData && $this->mdSyliveGroupsUser->add_batch($userData);
}
$this->return_response($groupsIds);
}
/**
* Notes:活动信息
* Created on: 2023/3/02 10:37
* Created by: dengbw
*/
public function info_get()
{
$activityId = $this->input_param('activityId');
$type = $this->input_param('type');
if (!$activityId) {
$this->return_json('参数错误');
}
$select = 'activityId,title,channelId';
if ($type == 'customer') {
$select = 'title,jsondata';
}
$re = $this->mdSyliveActivity->get(['activityId' => $activityId], $select);
if (!$re) {
$this->return_json('活动不存在');
}
$info = [];
if ($type == 'customer') {
$info['title'] = $re['title'];
$statusAry = $visitTagAry = [];
$getStatusAry = $this->mdSyliveCustomer->statusAry();
foreach ($getStatusAry as $k => $v) {
$statusAry[] = ['value' => $k, 'label' => $v];
}
$jsonData = $re['jsondata'] ? json_decode($re['jsondata'], true) : [];
$getVisitTagAry = $this->mdSyliveCustomer->visitTagAry();
foreach ($getVisitTagAry as $k => $v) {
$label = $v;
if ($jsonData['visitTag'][$k]) {
$label = $label . '(' . $jsonData['visitTag'][$k] . ')';
}
$visitTagAry[] = ['value' => $k, 'label' => $label];
}
$info['statusAry'] = $statusAry;
$info['visitTagAry'] = $visitTagAry;
} else {
$info = $re;
}
$this->return_response($info);
}
/**
* Notes:活动详情
* Created on: 2022/9/29 10:37
* Created by: dengbw
* @param null $activityId
*/
public function index_get($activityId = null)
{
if (!$activityId) {
$this->return_json('参数错误');
}
$re = $this->mdSyliveActivity->get(['activityId' => $activityId], 'activityId,title,channelId');
if (!$re) {
$this->return_json('活动不存在');
}
$this->return_response($re);
}
/**
* Notes:删除活动
* Created on: 2022/9/21 16:10
* Created by: dengbw
* @param null $activityId
*/
public function index_delete($activityId = null)
{
if (!$activityId) {
$this->return_json('参数错误');
}
$this->mdSyliveActivity->update(['status' => -1], ['activityId' => $activityId]);
$this->return_response();
}
/**
* Notes:批量删除用户
* Created on: 2022/9/8 17:11
* Created by: dengbw
*/
public function batch_delete()
{
$ids = $this->input_param('ids');
if (!$ids) {
$this->return_json('参数错误');
}
$str_ids = implode(',', $ids);
if ($str_ids) {
$this->mdSyliveActivity->update(['status' => -1], ["activityId in($str_ids)" => null]);
}
$this->return_response();
}
/**
* Notes:修改状态
* Created on: 2022/9/8 16:10
* Created by: dengbw
*/
public function status_put()
{
$activityId = $this->input_param('activityId');
$status = $this->input_param('status');
if (!$activityId) {
$this->return_json('参数错误');
}
$this->mdSyliveActivity->update(['status' => $status], ['activityId' => $activityId]);
$this->return_response();
}
/**
* Notes:修改商品
* Created on: 2022/9/28 15:09
* Created by: dengbw
*/
public function item_put()
{
$activityId = intval($this->input_param('activityId'));
$title = $this->input_param('title');
$price = $this->input_param('price');
$stock = intval($this->input_param('stock'));
$itemImg = $this->input_param('itemImg');
$dateRange = $this->input_param('dateRange');
$dateUseRange = $this->input_param('dateUseRange');
$introduction = $this->input_param('introduction');
if (!$activityId) {
$this->return_json('参数错误');
}
$re = $this->mdSyliveActivity->get(['activityId' => $activityId]);
if (!$re) {
$this->return_json('活动不存在');
}
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : [];
$timeStart = $dateRange[0] ? $dateRange[0] : '';
$timeEnd = $dateRange[1] ? $dateRange[1] : '';
$useTimeStart = $dateUseRange[0] ? $dateUseRange[0] : '';
$useTimeEnd = $dateUseRange[1] ? $dateUseRange[1] : '';
$item = ['title' => $title, 'price' => $price, 'timeStart' => $timeStart, 'timeEnd' => $timeEnd
, 'useTimeStart' => $useTimeStart, 'useTimeEnd' => $useTimeEnd, 'introduction' => $introduction];
if ($itemImg) {
$setItemImg = [];
foreach ($itemImg as $v) {
$setItemImg[] = $v['fileUrl'];
}
$item['itemImg'] = $setItemImg;
}
$jsondata['item'] = $item;
$upDate = ['stock' => $stock, 'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE)];
$this->mdSyliveActivity->update($upDate, ['activityId' => $activityId]);
$this->return_response();
}
/**
* Notes:修改券
* Created on: 2022/10/21 15:09
* Created by: dengbw
*/
public function coupon_put()
{
$activityId = intval($this->input_param('activityId'));
$title = $this->input_param('title');
$price = $this->input_param('price');
$img = $this->input_param('img');
$dateUseRange = $this->input_param('dateUseRange');
$rules = $this->input_param('rules');
if (!$activityId) {
$this->return_json('参数错误');
}
$re = $this->mdSyliveActivity->get(['activityId' => $activityId]);
if (!$re) {
$this->return_json('活动不存在');
}
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : [];
$useTimeStart = $dateUseRange[0] ? $dateUseRange[0] : '';
$useTimeEnd = $dateUseRange[1] ? $dateUseRange[1] : '';
$coupon = ['title' => $title, 'price' => $price, 'rules' => $rules,
'useTimeStart' => $useTimeStart, 'useTimeEnd' => $useTimeEnd];
if ($img) {
$setImg = [];
foreach ($img as $v) {
$setImg[] = $v['fileUrl'];
}
$coupon['img'] = $setImg;
}
$jsondata['coupon'] = $coupon;
$upDate = ['jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE)];
$this->mdSyliveActivity->update($upDate, ['activityId' => $activityId]);
$this->return_response();
}
/**
* Notes:修改回访标签
* Created on: 2023/2/27 10:08
* Created by: dengbw
*/
public function visit_tag_put()
{
$activityId = intval($this->input_param('activityId'));
if (!$activityId) {
$this->return_json('参数错误');
}
$visitTag = $this->input_param('visitTag');
$re = $this->mdSyliveActivity->get(['activityId' => $activityId], 'jsondata');
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : [];
$setVisitTag = [];
if ($visitTag) {
foreach ($visitTag as $v) {
$v['tag'] && $setVisitTag[$v['id']] = $v['tag'];
}
}
$jsondata['visitTag'] = $setVisitTag ? $setVisitTag : [];
$upDate['jsondata'] = json_encode($jsondata, JSON_UNESCAPED_UNICODE);
$ret = $this->mdSyliveActivity->update($upDate, ['activityId' => $activityId]);
if (!$ret) {
$this->return_json('修改回访标签失败');
}
$this->return_response();
}
/**
* Notes:修改抽奖配置
* Created on: 2023/1/30 10:08
* Created by: dengbw
*/
public function draw_put()
{
$activityId = intval($this->input_param('activityId'));
if (!$activityId) {
$this->return_json('参数错误');
}
$bgImg = $this->input_param('bgImg');
$sms = $this->input_param('sms');
$screenDisplay = $this->input_param('screenDisplay');
$winNum = $this->input_param('winNum');
$winType = $this->input_param('winType');
$re = $this->mdSyliveActivityDraw->get(['activityId' => $activityId]);
$upDate['bgImg'] = $bgImg ? $bgImg[0]['fileUrl'] : '';
$upDate['sms'] = $sms;
$upDate['screenDisplay'] = $screenDisplay;
$setWinNum = $setWinType = [];
if ($winNum) {
foreach ($winNum as $v) {
$setWinNum[] = ['title' => $v['value'] . '人', 'value' => $v['value']];
}
}
if ($winType) {
foreach ($winType as $v) {
$v['img'] = $v['img'] ? $v['img'][0]['fileUrl'] : '';
$setWinType[] = $v;
}
}
$upDate['winNum'] = $setWinNum ? json_encode($setWinNum, JSON_UNESCAPED_UNICODE) : null;
$upDate['winType'] = $setWinType ? json_encode($setWinType, JSON_UNESCAPED_UNICODE) : null;
if (!$re) {
$upDate['activityId'] = $activityId;
$upDate['createTime'] = date('Y-m-d H:i:s');
$ret = $this->mdSyliveActivityDraw->add($upDate);
} else {
$ret = $this->mdSyliveActivityDraw->update($upDate, ['activityId' => $activityId]);
}
if (!$ret) {
$this->return_json('抽奖配置失败');
}
$this->return_response();
}
/**
* Notes:修改黑名单
* Created on: 2023/3/03 10:08
* Created by: dengbw
*/
public function blacklist_put()
{
$activityId = intval($this->input_param('activityId'));
if (!$activityId) {
$this->return_json('参数错误');
}
$blacklist = $this->input_param('blacklist');
$addDate = [];
$delId = '';
foreach ($blacklist as $v) {
if ($v['type'] == 'add' && $v['mobile']) {
$re = $this->mdSyliveBlacklist->get(['activityId' => $activityId, 'mobile' => $v['mobile']]);
if (!$re) {
$addDate[] = ['mobile' => $v['mobile'], 'activityId' => $activityId, 'createTime' => date('Y-m-d H:i:s')];
}
} else if ($v['type'] == 'del' && $v['id']) {
$delId = $delId ? $delId . ',' . $v['id'] : $v['id'];
}
}
if (count($addDate)) {
$this->mdSyliveBlacklist->add_batch($addDate);
}
if ($delId) {
$this->mdSyliveBlacklist->delete(["blacklistId in({$delId})" => null]);
}
$this->return_response();
}
/**
* Notes:导入黑名单
* Created on: 2023/3/06 17:24
* Created by: dengbw
* @throws PHPExcel_Exception
* @throws PHPExcel_Reader_Exception
*/
public function blacklist_import_post()
{
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
$res = $this->upload();
if (!$res['code']) {
return $this->return_json($res['message']);
}
$file = $res['path'];
if ($res['file_ext'] == '.xls') {
$reader = \PHPExcel_IOFactory::createReader('Excel5'); // 读取 excel 文档
} elseif ($res['file_ext'] == '.xlsx') {
$reader = \PHPExcel_IOFactory::createReader('Excel2007'); // 读取 excel 文档
} else {
return $this->return_json('文件无法识别');
}
$PHPExcel = $reader->load($file); // 文档名称
$objWorksheet = $PHPExcel->getActiveSheet();
$rowCnt = $objWorksheet->getHighestRow(); //获取总行数
if ($rowCnt > 800) {
@unlink($file);
$this->return_json('数据大于800请拆分多个表格导入');
}
$activityId = $_POST['activityId'];
$addDate = [];
for ($_row = 2; $_row <= $rowCnt; $_row++) { //读取内容
$mobile = $objWorksheet->getCell('A' . $_row)->getValue();
if ($mobile) {
$re = $this->mdSyliveBlacklist->get(['activityId' => $activityId, 'mobile' => $mobile]);
if (!$re) {
$addDate[] = ['mobile' => $mobile, 'activityId' => $activityId, 'createTime' => date('Y-m-d H:i:s')];
}
}
}
$count = count($addDate);
if ($count) {
$this->mdSyliveBlacklist->add_batch($addDate);
}
@unlink($file);
$this->return_response('', "成功新增{$count}个黑名单");
}
private function upload()
{
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/';
$config['allowed_types'] = '*';
$config['max_size'] = 5120;
$config['file_name'] = 'blacklist_' . time() . rand(1, 99999);
$this->load->library('upload', $config);
if (!$this->upload->do_upload('file')) {
return ['code' => SYS_CODE_FAIL, 'message' => $this->upload->display_errors('', '')];
} else {
$data = $this->upload->data();
return ['code' => SYS_CODE_SUCCESS, 'path' => $data['full_path'], 'file_ext' => $data['file_ext']];
}
}
}
@@ -1,182 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_黑名单管理
* Created on: 2022/10/21 17:15
* Created by: dengbw
*/
class Blacklist extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_blacklist_model', 'mdSyliveBlacklist');
}
/**
* Notes:黑名单管理列表
* Created on: 2022/9/20 14:48
* Created by: dengbw
*/
public function page_get()
{
$activityId = intval($this->input_param('activityId'));
$mobile = $this->input_param('mobile');
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$sort = $this->input_param('sort');
$order = $this->input_param('order');
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'blacklistId desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$where['blacklistId>'] = 0;
$mobile && $where['mobile LIKE "%' . trim($mobile) . '%"'] = null;
$activityId && $where['activityId'] = $activityId;
$count = $this->mdSyliveBlacklist->count($where);
$list = [];
if ($count) {
$res = $this->mdSyliveBlacklist->select($where, $sort_order, $page, $limit);
foreach ($res as $v) {
$list[] = ['blacklistId' => $v['blacklistId'], 'activityId' => $v['activityId'],
'mobile' => $v['mobile'], 'createTime' => $v['createTime']];
}
}
$date = ['list' => $list, 'count' => $count];
$this->return_response_list($date);
}
/**
* Notes:添加黑名单
* Created on: 2022/10/21 16:46
* Created by: dengbw
*/
public function index_post()
{
$activityId = intval($this->input_param('activityId'));
$mobile = $this->input_param('mobile');
if (!$activityId) {
$this->return_json('参数错误');
}
if (!$mobile) {
$this->return_json('请输入手机号');
}
$re = $this->mdSyliveBlacklist->get(['activityId' => $activityId,'mobile' => $mobile]);
if ($re) {
$this->return_json('手机号已在黑名单中');
}
$addDate = ['activityId' => $activityId, 'mobile' => $mobile, 'createTime' => date('Y-m-d H:i:s')];
$id = $this->mdSyliveBlacklist->add($addDate);
if (!$id) {
$this->return_json('添加黑名单失败');
}
$this->return_response();
}
/**
* Notes:修改黑名单
* Created on: 2022/10/21 14:48
* Created by: dengbw
*/
public function index_put()
{
$blacklistId = intval($this->input_param('blacklistId'));
$mobile = $this->input_param('mobile');
if (!$blacklistId) {
$this->return_json('参数错误');
}
if (!$mobile) {
$this->return_json('请输入黑名单标题');
}
$upDate = ['mobile' => $mobile];
$this->mdSyliveBlacklist->update($upDate, ['blacklistId' => $blacklistId]);
$this->return_response();
}
/**
* Notes:批量删除黑名单
* Created on: 2022/10/21 17:11
* Created by: dengbw
*/
public function batch_delete()
{
$ids = $this->input_param('ids');
if (!$ids) {
$this->return_json('参数错误');
}
$str_ids = implode(',', $ids);
if ($str_ids) {
$this->mdSyliveBlacklist->delete(["blacklistId in($str_ids)" => null]);
}
$this->return_response();
}
/**
* Notes:导入黑名单
* Created on: 2023/3/06 17:24
* Created by: dengbw
* @throws PHPExcel_Exception
* @throws PHPExcel_Reader_Exception
*/
public function import_post()
{
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
$res = $this->upload();
if (!$res['code']) {
return $this->return_json($res['message']);
}
$file = $res['path'];
if ($res['file_ext'] == '.xls') {
$reader = \PHPExcel_IOFactory::createReader('Excel5'); // 读取 excel 文档
} elseif ($res['file_ext'] == '.xlsx') {
$reader = \PHPExcel_IOFactory::createReader('Excel2007'); // 读取 excel 文档
} else {
return $this->return_json('文件无法识别');
}
$PHPExcel = $reader->load($file); // 文档名称
$objWorksheet = $PHPExcel->getActiveSheet();
$rowCnt = $objWorksheet->getHighestRow(); //获取总行数
if ($rowCnt > 800) {
@unlink($file);
$this->return_json('数据大于800请拆分多个表格导入');
}
$activityId = $_POST['activityId'];
$addDate = [];
for ($_row = 2; $_row <= $rowCnt; $_row++) { //读取内容
$mobile = $objWorksheet->getCell('A' . $_row)->getValue();
if ($mobile) {
$re = $this->mdSyliveBlacklist->get(['activityId' => $activityId, 'mobile' => $mobile]);
if (!$re) {
$addDate[] = ['mobile' => $mobile, 'activityId' => $activityId, 'createTime' => date('Y-m-d H:i:s')];
}
}
}
$count = count($addDate);
if ($count) {
$this->mdSyliveBlacklist->add_batch($addDate);
}
@unlink($file);
$this->return_response('', "成功新增{$count}个黑名单");
}
private function upload()
{
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/';
$config['allowed_types'] = '*';
$config['max_size'] = 5120;
$config['file_name'] = 'blacklist_' . time() . rand(1, 99999);
$this->load->library('upload', $config);
if (!$this->upload->do_upload('file')) {
return ['code' => SYS_CODE_FAIL, 'message' => $this->upload->display_errors('', '')];
} else {
$data = $this->upload->data();
return ['code' => SYS_CODE_SUCCESS, 'path' => $data['full_path'], 'file_ext' => $data['file_ext']];
}
}
}
@@ -1,252 +0,0 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_商品管理
* Created on: 2022/10/21 17:15
* Created by: dengbw
*/
class Goods extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_items_model', 'mdSyliveItems');
}
/**
* Notes:商品管理列表
* Created on: 2022/9/20 14:48
* Created by: dengbw
*/
public function page_get()
{
$activityId = intval($this->input_param('activityId'));
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$title = $this->input_param('title');
$sort = $this->input_param('sort');
$order = $this->input_param('order');
$type = $this->input_param('type');
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'sort asc,itemId desc';
if ($sort && $order) {
if ($sort == 'typeName') {
$sort_order = 'type ' . $order;
} else {
$sort_order = $sort . ' ' . $order;
}
}
$where['status>='] = 0;
$title && $where['title LIKE "%' . trim($title) . '%"'] = null;
$activityId && $where['activityId'] = $activityId;
strlen($type) && $where['type'] = $type;
$count = $this->mdSyliveItems->count($where);
$list = [];
if ($count) {
$this->load->library('MyEncryption');
$res = $this->mdSyliveItems->select($where, $sort_order, $page, $limit);
foreach ($res as $v) {
$skey = $this->myencryption->base64url_encode("a_id={$activityId}&itemId={$v['itemId']}");
$banner = [];
$dateRange = $useRange = '';
$imgs = $v['imgs'] ? json_decode($v['imgs'], true) : [];
if ($imgs['banner']) {
foreach ($imgs['banner'] as $k2 => $v2) {
$banner[] = ['uid' => $k2 + 1, 'fileUrl' => $v2, 'url' => build_qiniu_image_url($v2), 'status' => 'done'];
}
}
$timeStart = $v['timeStart'] != '0000-00-00 00:00:00' ? $v['timeStart'] : '';
$v['timeStart'] != '0000-00-00 00:00:00' && $dateRange[] = $v['timeStart'];
$v['timeEnd'] != '0000-00-00 00:00:00' && $dateRange[] = $v['timeEnd'];
$v['useStart'] != '0000-00-00 00:00:00' && $useRange[] = $v['useStart'];
$v['useEnd'] != '0000-00-00 00:00:00' && $useRange[] = $v['useEnd'];
if ($activityId >= 6) {
$url = http_host_com('home') . "/h5/agent/admin/sylive2/item/detail?skey={$skey}";//活动连接
} else {
$url = http_host_com('home') . "/h5/agent/admin/sylive/item/detail?skey={$skey}";//活动连接
}
$list[] = ['itemId' => $v['itemId'], 'activityId' => $v['activityId'], 'title' => $v['title'], 'banner' => $banner
, 'dateRange' => $dateRange, 'useRange' => $useRange, 'descrip' => $v['descrip'], 'price' => $v['price'], 'stock' => $v['stock']
, 'timeStart' => $timeStart, 'sort' => $v['sort'], 'status' => intval($v['status']), 'createTime' => $v['createTime']
, 'ifAddress' => intval($v['ifAddress']), 'ifCode' => intval($v['ifCode']), 'type' => intval($v['type']),
'typeName' => $this->mdSyliveItems->typeAry($v['type']), 'url' => $url];
}
}
$date = ['list' => $list, 'count' => $count];
$this->return_response_list($date);
}
/**
* Notes:获取商品
* Created on: 2022/11/11 13:51
* Created by: dengbw
*/
public function items_get()
{
$activityId = intval($this->input_param('activityId'));
$type = $this->input_param('type');
$price = $this->input_param('price');
$price_type = $this->input_param('price_type');
$where['status>='] = 0;
$where['activityId'] = $activityId;
strlen($type) && $where['type'] = $type;
if ($price_type) {
switch ($price_type) {
case 'gt':
$where['price>'] = $price;
}
} else {
strlen($price) && $where['price'] = $price;
}
$list = $this->mdSyliveItems->select($where, 'sort asc,itemId desc', 0, 0, 'itemId,title');
$this->return_response_list($list);
}
/**
* Notes:添加商品
* Created on: 2022/10/21 16:46
* Created by: dengbw
*/
public function index_post()
{
$activityId = intval($this->input_param('activityId'));
$title = $this->input_param('title');
$banner = $this->input_param('banner');
$descrip = $this->input_param('descrip');
$price = $this->input_param('price');
$stock = $this->input_param('stock');
$sort = $this->input_param('sort');
$ifAddress = intval($this->input_param('ifAddress'));
$ifCode = intval($this->input_param('ifCode'));
$dateRange = $this->input_param('dateRange');
$useRange = $this->input_param('useRange');
$type = intval($this->input_param('type'));
if (!$activityId) {
$this->return_json('参数错误');
}
if (!$title) {
$this->return_json('请输入商品标题');
}
$addDate = ['activityId' => $activityId, 'title' => $title, 'price' => $price, 'stock' => $stock, 'sort' => $sort
, 'ifAddress' => $ifAddress, 'ifCode' => $ifCode, 'descrip' => $descrip, 'type' => $type, 'createTime' => date('Y-m-d H:i:s')];
$addDate['timeStart'] = $dateRange[0] ? $dateRange[0] : '0000-00-00 00:00:00';
$addDate['timeEnd'] = $dateRange[1] ? $dateRange[1] : '0000-00-00 00:00:00';
$addDate['useStart'] = $useRange[0] ? $useRange[0] : '0000-00-00 00:00:00';
$addDate['useEnd'] = $useRange[1] ? $useRange[1] : '0000-00-00 00:00:00';
$imgs_banner = [];
if ($banner) {
foreach ($banner as $v) {
$imgs_banner[] = $v['fileUrl'];
}
}
$imgs['banner'] = $imgs_banner ? $imgs_banner : '';
$addDate['imgs'] = json_encode($imgs, JSON_UNESCAPED_UNICODE);
$id = $this->mdSyliveItems->add($addDate);
if (!$id) {
$this->return_json('添加商品失败');
}
$this->return_response();
}
/**
* Notes:修改商品
* Created on: 2022/10/21 14:48
* Created by: dengbw
*/
public function index_put()
{
$itemId = intval($this->input_param('itemId'));
$title = $this->input_param('title');
$banner = $this->input_param('banner');
$descrip = $this->input_param('descrip');
$price = $this->input_param('price');
$stock = $this->input_param('stock');
$sort = intval($this->input_param('sort'));
$ifAddress = intval($this->input_param('ifAddress'));
$ifCode = intval($this->input_param('ifCode'));
$dateRange = $this->input_param('dateRange');
$useRange = $this->input_param('useRange');
$type = intval($this->input_param('type'));
if (!$itemId) {
$this->return_json('参数错误');
}
if (!$title) {
$this->return_json('请输入商品标题');
}
$re = $this->mdSyliveItems->get(['itemId' => $itemId]);
if (!$re) {
$this->return_json('商品不存在');
}
$upDate = ['title' => $title, 'price' => $price, 'stock' => $stock, 'sort' => $sort
, 'ifAddress' => $ifAddress, 'ifCode' => $ifCode, 'descrip' => $descrip, 'type' => $type];
$upDate['timeStart'] = $dateRange[0] ? $dateRange[0] : '0000-00-00 00:00:00';
$upDate['timeEnd'] = $dateRange[1] ? $dateRange[1] : '0000-00-00 00:00:00';
$upDate['useStart'] = $useRange[0] ? $useRange[0] : '0000-00-00 00:00:00';
$upDate['useEnd'] = $useRange[1] ? $useRange[1] : '0000-00-00 00:00:00';
$imgs = $re['imgs'] ? json_decode($re['imgs'], true) : [];
$imgs_banner = [];
if ($banner) {
foreach ($banner as $v) {
$imgs_banner[] = $v['fileUrl'];
}
}
$imgs['banner'] = $imgs_banner ? $imgs_banner : '';
$imgs && $upDate['imgs'] = json_encode($imgs, JSON_UNESCAPED_UNICODE);
$this->mdSyliveItems->update($upDate, ['itemId' => $itemId]);
$this->return_response();
}
/**
* Notes:删除商品
* Created on: 2022/10/21 16:10
* Created by: dengbw
* @param null $id
*/
public function index_delete($id = null)
{
if (!$id) {
$this->return_json('参数错误');
}
$this->mdSyliveItems->update(['status' => -1], ['itemId' => $id]);
$this->return_response();
}
/**
* Notes:批量删除商品
* Created on: 2022/10/21 17:11
* Created by: dengbw
*/
public function batch_delete()
{
$ids = $this->input_param('ids');
if (!$ids) {
$this->return_json('参数错误');
}
$str_ids = implode(',', $ids);
if ($str_ids) {
$this->mdSyliveItems->update(['status' => -1], ["itemId in($str_ids)" => null]);
}
$this->return_response();
}
/**
* Notes:修改状态
* Created on: 2022/9/8 16:10
* Created by: dengbw
*/
public function status_put()
{
$itemId = intval($this->input_param('itemId'));
$status = $this->input_param('status');
if (!$itemId) {
$this->return_json('参数错误');
}
$this->mdSyliveItems->update(['status' => $status], ['itemId' => $itemId]);
$this->return_response();
}
}
@@ -1,332 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_分组管理
* Created on: 2022/11/24 17:15
* Created by: dengbw
*/
class Groups extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_groups_model', 'mdSyliveGroups');
$this->load->model('agent/admin/Market_sylive_groups_user_model', 'mdSyliveGroupsUser');
$this->load->model('agent/admin/Market_sylive_user_model', 'mdSyliveUser');
}
/**
* Notes:获取分组
* Created on: 2022/9/16 11:11
* Created by: dengbw
*/
public function index_get()
{
$activityId = intval($this->input_param('activityId'));
$unGroupsType = $this->input_param('unGroupsType');
$where['status>='] = 0;
$activityId && $where['activityId'] = $activityId;
$unGroupsType && $where['groupsLevel<>'] = $unGroupsType;
$sort_order = 'sortNumber asc,groupsId desc';
$fileds = 'activityId,groupsId,parentId,sortNumber,userFrom,groupsName,ifBiz,statisticsType,originalBizId';
$res = $this->mdSyliveGroups->select($where, $sort_order, 0, 0, $fileds);
foreach ($res as $k => $v) {
$res[$k]['activityId'] = intval($v['activityId']);
$res[$k]['groupsId'] = intval($v['groupsId']);
$res[$k]['userFrom'] = intval($v['userFrom']);
$res[$k]['parentId'] = intval($v['parentId']);
$res[$k]['sortNumber'] = intval($v['sortNumber']);
$res[$k]['ifBiz'] = intval($v['ifBiz']);
$res[$k]['statisticsType'] = $v['statisticsType'] ? intval($v['statisticsType']) : '';
$res[$k]['originalBizId'] = $v['originalBizId'] ? intval($v['originalBizId']) : '';
}
$this->return_response_list($res);
}
/**
* Notes:查找上级分组
* Created on: 2022/10/24 15:24
* Created by: dengbw
*/
public function parent_get()
{
$parentId = intval($this->input_param('parentId'));
$sort_order = 'sortNumber asc,groupsId desc';
$where['status>='] = 0;
$where['parentId'] = $parentId;
$res = $this->mdSyliveGroups->select($where, $sort_order, 0, 0, 'groupsId,groupsName');
$this->return_response_list($res);
}
/**
* Notes:添加分组
* Created on: 2022/9/19 16:43
* Created by: dengbw
*/
public function index_post()
{
$activityId = intval($this->input_param('activityId'));
$parentId = intval($this->input_param('parentId'));
$groupsName = $this->input_param('groupsName');
$userFrom = intval($this->input_param('userFrom'));
$sortNumber = intval($this->input_param('sortNumber'));
$ifBiz = intval($this->input_param('ifBiz'));
$statisticsType = intval($this->input_param('statisticsType'));
$originalBizId = intval($this->input_param('originalBizId'));
if (!$groupsName) {
$this->return_json('请输入分组名称');
}
$groupsLevel = 0;
if ($parentId) {//判断上级分组
$re_org = $this->mdSyliveGroups->get(['groupsId' => $parentId]);
if ($re_org['ifBiz']) {
$userFrom = $re_org['userFrom'] == 0 ? '门店' : '团队';
$this->return_json("选择的上级分组{$userFrom}不能保存,请重新选择");
}
$re_org['groupsLevel'] == 3 && $ifBiz = 1;//如果上级等级3级,当前分组设为门店
!$ifBiz && $groupsLevel = $re_org['groupsLevel'] + 1;
} else {
$re_org = $this->mdSyliveGroups->get(['parentId' => $parentId]);
if ($re_org) {
$this->return_json('请选择上级分组');
}
}
$originalBizId = $ifBiz ? $originalBizId : 0;
$addDate = ['activityId' => $activityId, 'parentId' => $parentId, 'originalBizId' => $originalBizId, 'groupsName' => $groupsName
, 'groupsLevel' => $groupsLevel, 'statisticsType' => $statisticsType, 'userFrom' => $userFrom, 'ifBiz' => $ifBiz
, 'sortNumber' => $sortNumber, 'createTime' => date('Y-m-d H:i:s')];
$groupsId = $this->mdSyliveGroups->add($addDate);
if (!$groupsId) {
$this->return_json('添加分组失败');
}
if ($originalBizId) {
$levelAry = $this->getLevelAry($groupsId);
$res = $this->mdSyliveUser->select(['bizId' => $originalBizId, 'status>=' => 0], 'userId asc', 0, 0
, 'userId,organizationId,bizId');
$addUser = [];
foreach ($res as $v) {
$re_user = $this->mdSyliveGroupsUser->get(['activityId' => $activityId, 'userId' => $v['userId'], 'status>=' => 0]);
if (!$re_user) {
$type = $v['bizId'] == $v['organizationId'] ? 1 : 0;
$value = ['userId' => $v['userId'], 'type' => $type, 'activityId' => $activityId
, 'groupsId' => $groupsId, 'userFrom' => $userFrom, 'createTime' => date('Y-m-d H:i:s')];
$data = array_merge($value, $levelAry);
$addUser[] = $data;
}
}
$addUser && $this->mdSyliveGroupsUser->add_batch($addUser);
}
$this->return_response();
}
/**
* Notes:修改分组
* Created on: 2022/9/19 17:29
* Created by: dengbw
*/
public function index_put()
{
$groupsId = intval($this->input_param('groupsId'));
$parentId = intval($this->input_param('parentId'));
$groupsName = $this->input_param('groupsName');
$userFrom = intval($this->input_param('userFrom'));
$sortNumber = intval($this->input_param('sortNumber'));
$ifBiz = intval($this->input_param('ifBiz'));
$statisticsType = intval($this->input_param('statisticsType'));
$originalBizId = intval($this->input_param('originalBizId'));
if (!$groupsId) {
$this->return_json('参数错误');
}
if (!$groupsName) {
$this->return_json('请输入分组名称');
}
$re_gro = $this->mdSyliveGroups->get(['groupsId' => $groupsId]);
$activityId = intval($re_gro['activityId']);
if ($re_gro && $re_gro['parentId'] != $parentId) {
$re_user = $this->mdSyliveGroupsUser->get(['groupsId' => $groupsId, 'status>=' => 0, 'activityId' => $activityId]);
if ($re_user) {
$this->return_json('此分组已有用户,不能修改上级分组');
}
}
$groupsLevel = 0;
if ($parentId) {//判断上级分组
$re_org = $this->mdSyliveGroups->get(['groupsId' => $parentId]);
if ($re_org['ifBiz']) {
$userFrom = $re_org['userFrom'] == 0 ? '门店' : '团队';
$this->return_json("选择的上级分组{$userFrom}不能保存,请重新选择");
}
$re_org['groupsLevel'] == 3 && $ifBiz = 1;//如果上级等级3级,当前分组设为门店
!$ifBiz && $groupsLevel = $re_org['groupsLevel'] + 1;
} else {
$re_org = $this->mdSyliveGroups->get(['parentId' => $parentId, 'activityId' => $activityId]);
if ($re_org && $groupsId != $re_org['groupsId']) {
$this->return_json('请选择上级分组');
}
}
$originalBizId = $ifBiz ? $originalBizId : 0;
$upDate = ['parentId' => $parentId, 'originalBizId' => $originalBizId, 'groupsName' => $groupsName, 'groupsLevel' => $groupsLevel,
'statisticsType' => $statisticsType, 'userFrom' => $userFrom, 'ifBiz' => $ifBiz, 'sortNumber' => $sortNumber];
$this->mdSyliveGroups->update($upDate, ['groupsId' => $groupsId]);
if (!$re_gro['originalBizId'] && $originalBizId) {//首次绑定同步用户
$levelAry = $this->getLevelAry($groupsId);
$res = $this->mdSyliveUser->select(['bizId' => $originalBizId, 'status>=' => 0], 'userId asc', 0, 0
, 'userId,organizationId,bizId');
$addUser = [];
foreach ($res as $v) {
$re_user = $this->mdSyliveGroupsUser->get(['activityId' => $activityId, 'userId' => $v['userId'], 'status>=' => 0]);
if (!$re_user) {
$type = $v['bizId'] == $v['organizationId'] ? 1 : 0;
$value = ['userId' => $v['userId'], 'type' => $type, 'activityId' => $activityId
, 'groupsId' => $groupsId, 'userFrom' => $userFrom, 'createTime' => date('Y-m-d H:i:s')];
$data = array_merge($value, $levelAry);
$addUser[] = $data;
}
}
$addUser && $this->mdSyliveGroupsUser->add_batch($addUser);
}
$this->return_response();
}
/**
* Notes:删除分组
* Created on: 2022/9/19 11:08
* Created by: dengbw
*/
public function index_delete()
{
$groupsId = intval($this->input_param('id'));
if (!$groupsId) {
$this->return_json('参数错误');
}
$ret = $this->mdSyliveGroups->update(['status' => -1], ['groupsId' => $groupsId]);
if ($ret) {//删除分组用户
$this->mdSyliveGroupsUser->update(['status' => -1], ['groupsId' => $groupsId]);
}
$this->return_response();
}
/**
* Notes:导出分组所有顾问
* Created on: 2023/5/6 14:56
* Created by: dengbw
*/
public function consultant_export_get()
{
$activityId = $this->inputs['activityId'];
if (!$activityId) {
$this->return_json('参数错误');
}
$where = ["activityId" => $activityId, "status" => 0];
$count = $this->mdSyliveGroupsUser->count($where);
if ($count > 10000) {
$this->return_json('导出失败,每次导出不能超出10000条数据');
}
if ($count == 0) {
$this->return_json('导出失败,无数据');
}
$levels = [];
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'parentId' => 0, 'status>=' => 0]);
if ($re_gro['statisticsType']) {
$this->load->model('agent/admin/Market_sys_dictionary_data_model', 'mdSysDictionaryData');
$res_dit = $this->mdSysDictionaryData->select(['status>=' => 0, 'dictId' => $re_gro['statisticsType']], 'sortNumber asc,dictDataId desc'
, 0, 0, 'dictDataCode,dictDataName');
foreach ($res_dit as $k => $v) {
$groupsLevel = intval($v['dictDataCode']);
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'groupsLevel' => $groupsLevel, 'status>=' => 0]);
if ($re_gro) {
$levels[] = ['label' => $v['dictDataName'], 'prop' => "levelId{$groupsLevel}"];
}
}
}
$res = $this->mdSyliveGroupsUser->select($where, "levelId1 asc,bizId asc,groupsUserId asc", 0, 0
, 'userId,type,userFrom,levelId1,levelId2,levelId3,bizId');
$list = $userIds = $groupsIds = [];
foreach ($res as $v) {
if ($v['levelId1'] && !in_array($v['levelId1'], $groupsIds)) {
$groupsIds[] = $v['levelId1'];
}
if ($v['levelId2'] && !in_array($v['levelId2'], $groupsIds)) {
$groupsIds[] = $v['levelId2'];
}
if ($v['levelId3'] && !in_array($v['levelId3'], $groupsIds)) {
$groupsIds[] = $v['levelId3'];
}
if ($v['bizId'] && !in_array($v['bizId'], $groupsIds)) {
$groupsIds[] = $v['bizId'];
}
if ($v['userId'] && !in_array($v['userId'], $userIds)) {
$userIds[] = $v['userId'];
}
}
$userIds = $userIds ? implode(",", $userIds) : -1;
$map_user = $this->mdSyliveUser->map('userId', 'uname,nickname,mobile', ["userId in({$userIds})" => null]);
$groupsIds = $groupsIds ? implode(',', $groupsIds) : -1;
$map_groups = $this->mdSyliveGroups->map('groupsId', 'groupsName', ["groupsId in({$groupsIds})" => null, 'activityId' => $activityId]);
foreach ($res as $v) {
$uname = $nickname = $mobile = '';
$user = $map_user[$v['userId']];
if ($user) {
$uname = $user['uname'];
$nickname = $user['nickname'];
$mobile = $user['mobile'];
}
if ($v['type'] == 0) {
$roleName = '销售';
} else if ($v['type'] == 1) {
$roleName = $v['userFrom'] == 0 ? '店长' : '团长';
} else {
$roleName = '管理员';
}
$list1 = ['uname' => $uname, 'nickname' => $nickname, 'mobile' => $mobile, 'roleName' => $roleName];
$list2 = [];
foreach ($levels as $k2 => $v2) {
$levelId = $v[$v2['prop']];
$list2[$v2['prop']] = $map_groups[$levelId] ? $map_groups[$levelId] : '';
}
$item = count($list2) ? array_merge($list1, $list2) : $list1;
$item['stores'] = $map_groups[$v['bizId']] ? $map_groups[$v['bizId']] : '';
$list[] = $item;
}
$columns1 = ['姓名', '微信昵称', '手机号', '角色'];
$columns2 = [];
foreach ($levels as $k => $v) {
$columns2[] = $v['label'];
}
$columns3 = count($columns2) ? array_merge($columns1, $columns2) : $columns1;
$columns = array_merge($columns3, ['门店']);
$this->return_response_list(['list' => $list, 'columns' => $columns]);
}
/**
* Notes:获取分组等级ID
* Created on: 2022/11/30 14:30
* Created by: dengbw
* @param $groupsId
* @param array $data
* @return array
*/
private function getLevelAry($groupsId, $data = [])
{
$re = $this->mdSyliveGroups->get(['groupsId' => $groupsId], 'groupsId,parentId,groupsLevel,ifBiz');
if (!$re) {
return $data;
} else {
if ($re['groupsLevel']) {//分类id
$levelId = "levelId" . $re['groupsLevel'];
$data[$levelId] = $re['groupsId'];
}
if ($re['ifBiz']) {//门店id
$data['bizId'] = $re['groupsId'];
}
if ($re['parentId']) {
return $this->getLevelAry($re['parentId'], $data);
} else {
return $data;
}
}
}
}
@@ -1,337 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_客户列表
* Created on: 2023/2/27 17:15
* Created by: dengbw
*/
class groupsCustomer extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_customer_model', 'mdSyliveCustomer');
$this->load->model('agent/admin/Market_sylive_groups_model', 'mdSyliveGroups');
$this->load->model('agent/admin/Market_sylive_groups_user_model', 'mdSyliveGroupsUser');
$this->load->model('agent/admin/Market_sylive_user_model', 'mdSyliveUser');
$this->load->model('agent/admin/Market_sylive_activity_model', 'mdSyliveActivity');
}
/**
* Notes:订单管理列表
* Created on: 2022/12/08 14:48
* Created by: dengbw
*/
public function index_get()
{
$date = $this->dataSelect($this->inputs);
$this->return_response_list($date);
}
/**
* Notes:导出订单数据
* Created on: 2022/12/08 15:26
* Created by: dengbw
*/
public function export_get()
{
$this->inputs['page'] = 1;
$this->inputs['limit'] = 20000;
$date = $this->dataSelect($this->inputs);
$this->return_response_list($date);
}
/**
* Notes:导入审核数据
* Created on: 2023/2/22 17:24
* Created by: dengbw
* @throws PHPExcel_Exception
* @throws PHPExcel_Reader_Exception
*/
public function import_post()
{
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
$res = $this->upload();
if (!$res['code']) {
return $this->return_json($res['message']);
}
$file = $res['path'];
if ($res['file_ext'] == '.xls') {
$reader = \PHPExcel_IOFactory::createReader('Excel5'); // 读取 excel 文档
} elseif ($res['file_ext'] == '.xlsx') {
$reader = \PHPExcel_IOFactory::createReader('Excel2007'); // 读取 excel 文档
} else {
return $this->return_json('文件无法识别');
}
$PHPExcel = $reader->load($file); // 文档名称
$objWorksheet = $PHPExcel->getActiveSheet();
$rowCnt = $objWorksheet->getHighestRow(); //获取总行数
if ($rowCnt > 800) {
@unlink($file);
$this->return_json('数据大于800请拆分多个表格导入');
}
$activityId = $_POST['activityId'];
$done = 0;
for ($_row = 2; $_row <= $rowCnt; $_row++) { //读取内容
$name = $objWorksheet->getCell('A' . $_row)->getValue();
$mobile = $objWorksheet->getCell('B' . $_row)->getValue();
$bizName = $objWorksheet->getCell('C' . $_row)->getValue();
//$cfName = $objWorksheet->getCell('D' . $_row)->getValue();
$cfMobile = $objWorksheet->getCell('E' . $_row)->getValue();
$level = $objWorksheet->getCell('F' . $_row)->getValue();
if ($mobile) {
$re = $this->mdSyliveCustomer->get(['activityId' => $activityId, 'mobile' => $mobile, 'status<>' => -1]);
if (!$re) {
!$name && $name = '';
!$level && $level = '';
$addData = ['activityId' => $activityId, 'name' => $name, 'mobile' => $mobile, 'level' => $level
, 'createTime' => date('Y-m-d H:i:s')];
if ($cfMobile) {
$re_user = $this->mdSyliveUser->get(['mobile' => $cfMobile, 'organizationId>' => 0, 'status<>' => -1]);
if ($re_user['userId']) {
$addData['cfUserId'] = $re_user['userId'];
$re_groUser = $this->mdSyliveGroupsUser->get(['activityId' => $activityId, 'userId' => $re_user['userId'], 'status<>' => -1]);
if ($re_groUser['bizId']) {
$addData['status'] = 1;
$addData['bizId'] = $re_groUser['bizId'];
$addData['levelId1'] = $re_groUser['levelId1'];
$addData['levelId2'] = $re_groUser['levelId2'];
$addData['levelId3'] = $re_groUser['levelId3'];
}
}
}
if (!$addData['bizId'] && $bizName) {
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'groupsName' => $bizName, 'ifBiz' => 1, 'status<>' => -1]);
if ($re_gro['groupsId']) {
$addData['bizId'] = $re_gro['groupsId'];
$levelAry = $this->getLevelAry($re_gro['parentId']);
$levelAry['levelId1'] && $addData['levelId1'] = $levelAry['levelId1'];
$levelAry['levelId2'] && $addData['levelId2'] = $levelAry['levelId2'];
$levelAry['levelId3'] && $addData['levelId3'] = $levelAry['levelId3'];
}
}
$re_user = $this->mdSyliveUser->get(['mobile' => $mobile, 'status<>' => -1]);
if ($re_user['userId']) {
$addData['userId'] = $re_user['userId'];
}
$customerId = $this->mdSyliveCustomer->add($addData);
$customerId && $done++;
}
}
}
@unlink($file);
$this->return_response('', "成功新增{$done}个客户");
}
/**
* Notes:获取分组等级ID
* Created on: 2023/3/01 14:30
* Created by: dengbw
* @param $groupsId
* @param array $data
* @return array
*/
private function getLevelAry($groupsId, $data = [])
{
$re = $this->mdSyliveGroups->get(['groupsId' => $groupsId], 'groupsId,parentId,groupsLevel');
if (!$re) {
return $data;
} else {
if ($re['groupsLevel']) {//分类id
$levelId = "levelId" . $re['groupsLevel'];
$data[$levelId] = $re['groupsId'];
}
if ($re['parentId']) {
return $this->getLevelAry($re['parentId'], $data);
} else {
return $data;
}
}
}
private function dataSelect($params)
{
$activityId = intval($params['activityId']);
$page = $params['page'];
$limit = $params['limit'];
$name = $params['name'];
$mobile = $params['mobile'];
$bizId = $params['bizId'];
$status = $params['status'];
$visitTagId = $params['visitTagId'];
$sort = $params['sort'];
$order = $params['order'];
$createTimeStart = $this->input_param('createTimeStart');
$createTimeEnd = $this->input_param('createTimeEnd');
!$page && $page = 1;
!$limit && $limit = 10;
$levels = [];
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'parentId' => 0, 'status>=' => 0]);
if ($re_gro['statisticsType']) {
$this->load->model('agent/admin/Market_sys_dictionary_data_model', 'mdSysDictionaryData');
$res_dit = $this->mdSysDictionaryData->select(['status>=' => 0, 'dictId' => $re_gro['statisticsType']], 'sortNumber asc,dictDataId desc'
, 0, 0, 'dictDataCode,dictDataName');
foreach ($res_dit as $k => $v) {
$groupsLevel = intval($v['dictDataCode']);
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'groupsLevel' => $groupsLevel, 'status>=' => 0]);
if ($re_gro) {
$levels[] = ['label' => $v['dictDataName'], 'prop' => "levelName{$groupsLevel}"];
}
}
}
$sort_order = 'customerId desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$list = [];
if (strlen($status)) {
$where["status"] = $status;
} else {
$where["status>=0"] = null;
}
$activityId && $where['activityId'] = $activityId;
$name && $where['name LIKE "%' . trim($name) . '%"'] = null;
$mobile && $where['mobile LIKE "%' . trim($mobile) . '%"'] = null;
$visitTagId && $where['visitTagId'] = $visitTagId;
$createTimeStart && $where['createTime>='] = $createTimeStart;
$createTimeEnd && $where['createTime<='] = $createTimeEnd;
if ($bizId) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $bizId]);
if ($res_org) {
if ($res_org['groupsLevel']) {
$levelId = 'levelId' . $res_org['groupsLevel'];
$where[$levelId] = $bizId;
} else if ($res_org['parentId']) {//门店
$where['bizId'] = $bizId;
}
}
}
$count = $this->mdSyliveCustomer->count($where);
if ($limit >= 10000 && $count > 10000) {
$this->return_json('导出失败,每次导出不能超出10000条数据');
}
if ($count) {
$re = $this->mdSyliveActivity->get(['activityId' => $activityId], 'jsondata');
$jsonData = $re['jsondata'] ? json_decode($re['jsondata'], true) : [];
$visitTagAry = $this->mdSyliveCustomer->visitTagAry();
$statusAry = $this->mdSyliveCustomer->statusAry();
$res = $this->mdSyliveCustomer->select($where, $sort_order, $page, $limit);
foreach ($res as $v) {
$consultant = $this->consultantGet(['activityId' => $v['activityId']
, 'levelId1' => $v['levelId1'], 'levelId2' => $v['levelId2'], 'levelId3' => $v['levelId3']
, 'bizId' => $v['bizId'], 'cfUserId' => $v['cfUserId']]);
$status = intval($v['status']);
$statusName = $statusAry[$status];
$visitTagName = '';
$visitTagId = $v['visitTagId'];
if ($visitTagId) {
$visitTagName = $visitTagAry[$visitTagId];
if ($jsonData['visitTag'][$visitTagId]) {
$visitTagName = $visitTagName . '(' . $jsonData['visitTag'][$visitTagId] . ')';
}
}
$list1 = [
'customerId' => $v['customerId'], 'name' => $v['name'], 'mobile' => $v['mobile']
, 'statusName' => $statusName, 'visitTagName' => $visitTagName, 'consultant' => $consultant['consultant']
];
if ($limit >= 10000) {
unset($list1['customerId']);
}
$list2 = [];
foreach ($levels as $k2 => $v2) {
$list2[$v2['prop']] = $consultant[$v2['prop']] ? $consultant[$v2['prop']] : '';
}
$item = count($list2) ? array_merge($list1, $list2) : $list1;
$item['stores'] = $consultant['stores'];
$list[] = $item;
}
}
if ($limit >= 10000) {
$columns1 = ['姓名', '手机号', '状态', '回访标签', '顾问'];
$columns2 = [];
foreach ($levels as $k => $v) {
$columns2[] = $v['label'];
}
$columns3 = count($columns2) ? array_merge($columns1, $columns2) : $columns1;
$columns = array_merge($columns3, ['门店']);
return ['list' => $list, 'columns' => $columns];
} else {
$columns = '';
if ($page == 1) {
$columns1 = [
['prop' => 'customerId', 'label' => 'ID', 'align' => 'center', 'showOverflowTooltip' => true, 'minWidth' => 45, 'fixed' => 'left'],
['prop' => 'name', 'label' => '姓名', 'showOverflowTooltip' => true, 'minWidth' => 60],
['prop' => 'mobile', 'label' => '手机号', 'showOverflowTooltip' => true, 'minWidth' => 60],
['prop' => 'statusName', 'label' => '状态', 'showOverflowTooltip' => true, 'minWidth' => 60, 'align' => 'center'],
['prop' => 'visitTagName', 'label' => '回访标签', 'showOverflowTooltip' => true, 'minWidth' => 100, 'align' => 'center'],
['prop' => 'consultant', 'label' => '顾问', 'showOverflowTooltip' => true, 'minWidth' => 60]
];
$columns2 = [];
foreach ($levels as $k => $v) {
$columns2[] = ['prop' => $v['prop'], 'label' => $v['label'], 'showOverflowTooltip' => true, 'minWidth' => 80];
}
$columns = count($columns2) ? array_merge($columns1, $columns2) : $columns1;
$columns[] = ['prop' => 'stores', 'label' => '门店', 'showOverflowTooltip' => true, 'minWidth' => 80];
}
return ['list' => $list, 'count' => $count, 'columns' => $columns];
}
}
/**
* Notes:获取顾问信息
* Created on: 2022/12/08 11:29
* Created by: dengbw
* @param $params
* @return string
*/
private function consultantGet($params)
{
$stores = $consultant = $levelName1 = $levelName2 = $levelName3 = '';
$levelId1 = intval($params['levelId1']);
$levelId2 = intval($params['levelId2']);
$levelId3 = intval($params['levelId3']);
$bizId = intval($params['bizId']);
$cfUserId = intval($params['cfUserId']);
if ($bizId) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $bizId]);
$res_org['groupsName'] && $stores = $res_org['groupsName'];
}
if ($levelId1) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId1]);
$res_org['groupsName'] && $levelName1 = $res_org['groupsName'];
}
if ($levelId2) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId2]);
$res_org['groupsName'] && $levelName2 = $res_org['groupsName'];
}
if ($levelId3) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId3]);
$res_org['groupsName'] && $levelName3 = $res_org['groupsName'];
}
if($cfUserId){
$re_user = $this->mdSyliveUser->get(['userId' => $cfUserId]);
$re_user['uname'] && $consultant = $re_user['uname'];
}
return ['stores' => $stores, 'consultant' => $consultant, 'levelName1' => $levelName1,
'levelName2' => $levelName2, 'levelName3' => $levelName3];
}
private function upload()
{
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/';
$config['allowed_types'] = '*';
$config['max_size'] = 5120;
$config['file_name'] = 'customer_' . time() . rand(1, 99999);
$this->load->library('upload', $config);
if (!$this->upload->do_upload('file')) {
return ['code' => SYS_CODE_FAIL, 'message' => $this->upload->display_errors('', '')];
} else {
$data = $this->upload->data();
return ['code' => SYS_CODE_SUCCESS, 'path' => $data['full_path'], 'file_ext' => $data['file_ext']];
}
}
}
@@ -1,451 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_核销记录管理
* Created on: 2023/2/15 17:15
* Created by: dengbw
*/
class groupsExchange extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_order_model', 'mdSyliveOrder');
$this->load->model('agent/admin/Market_sylive_checkdata_model', 'mdSyliveCheckdata');
$this->load->model('agent/admin/Market_sylive_user_model', 'mdSyliveUser');
$this->load->model('agent/admin/Market_sys_admin_model', 'mdSysAdmin');
$this->load->model('agent/admin/Market_sylive_groups_model', 'mdSyliveGroups');
$this->load->model('agent/admin/Market_sylive_activity_kpidata_model', 'mdSyliveActivityKpidata');
$this->load->model('agent/admin/Market_sylive_items_model', 'mdSyliveItems');
}
/**
* Notes:订单管理列表
* Created on: 2022/12/08 14:48
* Created by: dengbw
*/
public function index_get()
{
$date = $this->orderList($this->inputs);
$this->return_response_list($date);
}
/**
* Notes:导出订单数据
* Created on: 2022/12/08 15:26
* Created by: dengbw
*/
public function export_get()
{
$this->inputs['page'] = 1;
$this->inputs['limit'] = 20000;
$date = $this->orderList($this->inputs);
$this->return_response_list($date);
}
/**
* Notes:操作详情
* Created on: 2023/2/21 9:45
* Created by: dengbw
*/
public function detail_get()
{
$cfId = intval($this->input_param('cfId'));
$type = intval($this->input_param('type'));
$ifCheckAry = [0 => '未审核', 1 => '通过', -1 => '驳回'];
$date = [];
$where = ['cfId' => $cfId, 'type' => $type];
$res = $this->mdSyliveCheckdata->select($where, 'id DESC', 0, 0);
if ($res) {
$address = '';
$re = $this->mdSyliveOrder->get(['id' => $cfId]);
if ($re['jsondata']) {
$jsondata = json_decode($re['jsondata'], true);
if ($jsondata['address']) {
$address = $jsondata['address']['region'] . $jsondata['address']['detail'];
}
}
$this->load->library('AliWuliu');
$cfUids = implode(',', array_column($res, 'cfUid'));
$map_users = $cfUids ? $this->mdSyliveUser->map('userId', 'uname,nickname', ["userId in({$cfUids})" => null]) : [];
$adminUids = implode(',', array_column($res, 'adminUid'));
$map_admins = $adminUids ? $this->mdSysAdmin->map('userId', 'username,nickname', ["userId in({$adminUids})" => null]) : [];
foreach ($res as $v) {
$cfName = $adminName = $adminTime = '';
$mapUser = $map_users[$v['cfUid']];
if ($mapUser) {
$cfName = $mapUser['uname'] ? $mapUser['uname'] : $mapUser['nickname'];
}
$mapAdmin = $map_admins[$v['adminUid']];
if ($mapAdmin) {
$adminName = $mapAdmin['nickname'] ? $mapAdmin['nickname'] : $mapAdmin['username'];
}
$jsondata = $v['jsondata'] ? json_decode($v['jsondata'], true) : [];
$logistics = [];
if ($jsondata) {
$jsondata['adminTime'] && $adminTime = $jsondata['adminTime'];
$courierNo = $jsondata['courierNo'];
if ($courierNo) {
if (strstr($courierNo, 'SF') || strstr($courierNo, 'FW')) {
$re_order = $this->mdSyliveOrder->get(['id' => $v['cfId']]);
if ($re_order['mobile']) {
$courierNo = $courierNo . ':' . substr($re_order['mobile'], -4);
}
}
$re_wl = $this->aliwuliu->kdi($courierNo, '', $debug = false);
if ($re_wl['code'] == 1 && $re_wl['result']) {
$result = $re_wl['result'];
$expName = $result['expName'] ? $result['expName'] : '物流单号';
$logistics[] = ['time' => $expName, 'status' => $jsondata['courierNo']];
foreach ($result['list'] as $v2) {
$logistics[] = $v2;
}
} else {
$logistics[] = ['time' => '物流单号', 'status' => $jsondata['courierNo']];
}
}
}
$cfTime = date('Y-m-d H:i:s', $v['createTime']);
$address = count($logistics) ? $address : '';
$date[] = ['adminName' => $adminName, 'adminTime' => $adminTime, 'cfName' => $cfName, 'cfTime' => $cfTime
, 'logistics' => $logistics, 'descrip' => $v['descrip'], 'address' => $address
, 'ifCheckName' => $ifCheckAry[$v['ifCheck']]];
}
}
$this->return_response_list($date);
}
/**
* Notes:审核数据
* Created on: 2023/2/21 14:43
* Created by: dengbw
*/
public function status_put()
{
$cfId = intval($this->input_param('cfId'));
$type = intval($this->input_param('type'));
$useStatus = $this->input_param('useStatus');
$descrip = $this->input_param('descrip');
if (!$cfId) {
$this->return_json('参数错误');
}
$ret = $this->updateCheck(['cfId' => $cfId, 'type' => $type, 'useStatus' => $useStatus, 'descrip' => $descrip]);
if (!$ret) {
$this->return_json('审核失败');
}
$this->return_response();
}
/**
* Notes:导入审核数据
* Created on: 2023/2/22 17:24
* Created by: dengbw
* @throws PHPExcel_Exception
* @throws PHPExcel_Reader_Exception
*/
public function import_post()
{
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
$res = $this->upload();
if (!$res['code']) {
return $this->return_json($res['message']);
}
$file = $res['path'];
if ($res['file_ext'] == '.xls') {
$reader = \PHPExcel_IOFactory::createReader('Excel5'); // 读取 excel 文档
} elseif ($res['file_ext'] == '.xlsx') {
$reader = \PHPExcel_IOFactory::createReader('Excel2007'); // 读取 excel 文档
} else {
return $this->return_json('文件无法识别');
}
$PHPExcel = $reader->load($file); // 文档名称
$objWorksheet = $PHPExcel->getActiveSheet();
$rowCnt = $objWorksheet->getHighestRow(); //获取总行数
if ($rowCnt > 800) {
@unlink($file);
$this->return_json('数据大于800请拆分多个表格导入');
}
$done = 0;
for ($_row = 2; $_row <= $rowCnt; $_row++) { //读取内容
$sid = $objWorksheet->getCell('A' . $_row)->getValue();
if ($sid) {
$re_order = $this->mdSyliveOrder->get(['sid' => $sid]);
$cfId = $re_order['id'];
if ($cfId) {
$useStatus = $objWorksheet->getCell('B' . $_row)->getValue();
$descrip = '';
if ($useStatus == '通过') {
$useStatus = 2;
$courierNo = $objWorksheet->getCell('C' . $_row)->getValue();
$courierNo && $descrip = $courierNo;
} else {
$useStatus = 3;
$getDescrip = $objWorksheet->getCell('D' . $_row)->getValue();
$getDescrip && $descrip = $getDescrip;
}
$getType = $objWorksheet->getCell('E' . $_row)->getValue();
$type = $getType == '抽奖' ? 1 : 0;
$ret = $this->updateCheck(['cfId' => $cfId, 'type' => $type, 'useStatus' => $useStatus, 'descrip' => $descrip]);
if ($ret) {
$done++;
}
}
}
}
@unlink($file);
$this->return_response('', "成功审核{$done}");
}
private function updateCheck($params = [])
{
$cfId = $params['cfId'];
$type = $params['type'];
$useStatus = $params['useStatus'];
$descrip = $params['descrip'];
$ifCheck = 0;
$jsonData['adminTime'] = date('Y-m-d H:i:s');
if ($useStatus == 2) {
$ifCheck = 1;
$upDate['ifCheck'] = $ifCheck;
$jsonData['courierNo'] = $descrip;
} else if ($useStatus == 3) {
$ifCheck = -1;
$upDate['descrip'] = $descrip;
}
$upDate['ifCheck'] = $ifCheck;
$upDate['jsondata'] = json_encode($jsonData, JSON_UNESCAPED_UNICODE);
$re = $this->mdSyliveCheckdata->max('id', ['cfId' => $cfId, 'type' => $type]);
if ($re['id']) {
$this->mdSyliveCheckdata->update($upDate, ['id' => $re['id']]);
}
$upDate = [];
if ($type == 1) {
$upDate['winUseStatus'] = $useStatus;
} else {
$upDate['useStatus'] = $useStatus;
}
$ret = $this->mdSyliveOrder->update($upDate, ['id' => $cfId]);
return $ret;
}
private function orderList($params)
{
$activityId = intval($params['activityId']);
$page = $params['page'];
$limit = $params['limit'];
$uname = $params['uname'];
$mobile = $params['mobile'];
$sort = $params['sort'];
$order = $params['order'];
$bizId = $params['bizId'];
$itemId = $params['itemId'];
!$page && $page = 1;
!$limit && $limit = 10;
$levels = [];
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'parentId' => 0, 'status>=' => 0]);
if ($re_gro['statisticsType']) {
$this->load->model('agent/admin/Market_sys_dictionary_data_model', 'mdSysDictionaryData');
$res_dit = $this->mdSysDictionaryData->select(['status>=' => 0, 'dictId' => $re_gro['statisticsType']], 'sortNumber asc,dictDataId desc'
, 0, 0, 'dictDataCode,dictDataName');
foreach ($res_dit as $k => $v) {
$groupsLevel = intval($v['dictDataCode']);
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'groupsLevel' => $groupsLevel, 'status>=' => 0]);
if ($re_gro) {
$levels[] = ['label' => $v['dictDataName'], 'prop' => "levelName{$groupsLevel}"];
}
}
}
$sort_order = 'id desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$list = [];
$useType = intval($params['useType']);
$useStatus = intval($params['useStatus']);
if ($useType == 1) {
$exchangeName = '抽奖';
if ($useStatus) {
$where['winUseStatus'] = $useStatus;
} else {
$where['winUseStatus>'] = 0;
}
} else {
$exchangeName = '订单';
if ($useStatus) {
$where['useStatus'] = $useStatus;
} else {
$where['useStatus>'] = 0;
}
}
$activityId && $where['activityId'] = $activityId;
$itemId && $where['itemId'] = $itemId;
$uname && $where['uname LIKE "%' . trim($uname) . '%"'] = null;
$mobile && $where['mobile LIKE "%' . trim($mobile) . '%"'] = null;
if ($bizId) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $bizId]);
if ($res_org) {
if ($res_org['groupsLevel']) {
$levelId = 'levelId' . $res_org['groupsLevel'];
$where[$levelId] = $bizId;
} else if ($res_org['parentId']) {//门店
$where['bizId'] = $bizId;
}
}
}
$count = $this->mdSyliveOrder->count($where);
if ($limit >= 10000 && $count > 10000) {
$this->return_json('导出失败,每次导出不能超出10000条数据');
}
if ($count) {
$res = $this->mdSyliveOrder->select($where, $sort_order, $page, $limit);
$itemIds = implode(',', array_column($res, 'itemId'));
$map_items = $this->mdSyliveItems->map('itemId', 'ifAddress', ["itemId in({$itemIds})" => null]);
foreach ($res as $v) {
$consultant = $this->consultantGet(['activityId' => $v['activityId'], 'userId' => $v['userId']
, 'levelId1' => $v['levelId1'], 'levelId2' => $v['levelId2'], 'levelId3' => $v['levelId3']
, 'bizId' => $v['bizId'], 'cfUserId' => $v['cfUserId']]);
$useStatus = $useType == 1 ? $v['winUseStatus'] : $v['useStatus'];
$useStatusName = '未审核';
if ($useStatus == 2) {
$useStatusName = '通过';
} else if ($useStatus == 3) {
$useStatusName = '驳回';
}
$ifAddress = intval($map_items[$v['itemId']]);
$list1 = [
'id' => $v['id'], 'sid' => $v['sid'], 'uname' => $v['uname'], 'mobile' => $v['mobile'], 'itemTitle' => $v['itemTitle']
, 'totalPrice' => $v['totalPrice'], 'exchangeName' => $exchangeName
, 'useStatusName' => $useStatusName, 'consultant' => $consultant['consultant']
, 'ifAddress' => $ifAddress, 'useStatus' => intval($useStatus)
];
if ($limit >= 10000) {
unset($list1['id']);
unset($list1['ifAddress']);
unset($list1['useStatus']);
} else {
unset($list1['sid']);
}
$list2 = [];
foreach ($levels as $k2 => $v2) {
$list2[$v2['prop']] = $consultant[$v2['prop']] ? $consultant[$v2['prop']] : '';
}
$item = count($list2) ? array_merge($list1, $list2) : $list1;
$item['stores'] = $consultant['stores'];
if ($limit >= 10000) {
$address = $biz = '';
$jsondata = $v['jsondata'] ? json_decode($v['jsondata'], true) : [];
if ($jsondata['address']) {
$address = $jsondata['address']['region'] . $jsondata['address']['detail'];
}
if ($jsondata['biz']) {
$biz = $jsondata['biz'];
}
$item['biz'] = $biz;
$item['address'] = $address;
}
$list[] = $item;
}
}
if ($limit >= 10000) {
$columns1 = ['订单号', '姓名', '手机号', '商品标题', '订单价格', '核销类型', '状态', '顾问'];
$columns2 = [];
foreach ($levels as $k => $v) {
$columns2[] = $v['label'];
}
$columns3 = count($columns2) ? array_merge($columns1, $columns2) : $columns1;
$columns = array_merge($columns3, ['门店', '所选经销商', '地址']);
return ['list' => $list, 'columns' => $columns];
} else {
$columns = '';
if ($page == 1) {
$columns1 = [
['prop' => 'id', 'label' => 'ID', 'align' => 'center', 'showOverflowTooltip' => true, 'minWidth' => 45, 'fixed' => 'left'],
['prop' => 'uname', 'label' => '姓名', 'showOverflowTooltip' => true, 'minWidth' => 60],
['prop' => 'mobile', 'label' => '手机号', 'showOverflowTooltip' => true, 'minWidth' => 80],
['prop' => 'itemTitle', 'label' => '商品标题', 'showOverflowTooltip' => true, 'minWidth' => 130],
['prop' => 'totalPrice', 'label' => '订单价格', 'showOverflowTooltip' => true, 'minWidth' => 60],
['prop' => 'exchangeName', 'label' => '核销类型', 'showOverflowTooltip' => true, 'minWidth' => 60, 'align' => 'center'],
['prop' => 'useStatus', 'label' => '状态', 'showOverflowTooltip' => true, 'minWidth' => 60, 'align' => 'center', 'slot' => 'useStatus'],
['prop' => 'consultant', 'label' => '顾问', 'showOverflowTooltip' => true, 'minWidth' => 60]
];
$columns2 = [];
foreach ($levels as $k => $v) {
$columns2[] = ['prop' => $v['prop'], 'label' => $v['label'], 'showOverflowTooltip' => true, 'minWidth' => 80];
}
$columns = count($columns2) ? array_merge($columns1, $columns2) : $columns1;
$columns[] = ['prop' => 'stores', 'label' => '门店', 'showOverflowTooltip' => true, 'minWidth' => 80];
$columns[] = ['columnKey' => 'action', 'label' => '操作', 'showOverflowTooltip' => true, 'width' => 150, 'align' => 'center'
, 'resizable' => false, 'slot' => 'action'];
}
return ['list' => $list, 'count' => $count, 'columns' => $columns];
}
}
/**
* Notes:获取顾问信息
* Created on: 2022/12/08 11:29
* Created by: dengbw
* @param $params
* @return string
*/
private function consultantGet($params)
{
$stores = $consultant = $levelName1 = $levelName2 = $levelName3 = '';
$levelId1 = intval($params['levelId1']);
$levelId2 = intval($params['levelId2']);
$levelId3 = intval($params['levelId3']);
$bizId = intval($params['bizId']);
$cfUserId = intval($params['cfUserId']);
if (!$bizId && $params['userId']) {
$re = $this->mdSyliveActivityKpidata->get(['activityId' => $params['activityId'], 'userId' => $params['userId'], 'kpi' => 'order']);
if ($re) {
$levelId1 = $re['levelId1'];
$levelId2 = $re['levelId2'];
$levelId3 = $re['levelId3'];
$bizId = $re['bizId'];
$cfUserId = $re['cfUserId'];
}
}
if ($bizId) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $bizId]);
$res_org['groupsName'] && $stores = $res_org['groupsName'];
}
if ($levelId1) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId1]);
$res_org['groupsName'] && $levelName1 = $res_org['groupsName'];
}
if ($levelId2) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId2]);
$res_org['groupsName'] && $levelName2 = $res_org['groupsName'];
}
if ($levelId3) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId3]);
$res_org['groupsName'] && $levelName3 = $res_org['groupsName'];
}
if ($cfUserId) {
$re_user = $this->mdSyliveUser->get(['userId' => $cfUserId]);
$re_user['uname'] && $consultant = $re_user['uname'];
}
return ['stores' => $stores, 'consultant' => $consultant, 'levelName1' => $levelName1,
'levelName2' => $levelName2, 'levelName3' => $levelName3];
}
private function upload()
{
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/';
$config['allowed_types'] = '*';
$config['max_size'] = 5120;
$config['file_name'] = 'exchange_' . time() . rand(1, 99999);
$this->load->library('upload', $config);
if (!$this->upload->do_upload('file')) {
return ['code' => SYS_CODE_FAIL, 'message' => $this->upload->display_errors('', '')];
} else {
$data = $this->upload->data();
return ['code' => SYS_CODE_SUCCESS, 'path' => $data['full_path'], 'file_ext' => $data['file_ext']];
}
}
}
@@ -1,431 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_分组订单管理
* Created on: 2022/12/08 17:15
* Created by: dengbw
*/
class groupsOrder extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_order_model', 'mdSyliveOrder');
$this->load->model('agent/admin/Market_sylive_user_model', 'mdSyliveUser');
$this->load->model('agent/admin/Market_sylive_activity_kpidata_model', 'mdSyliveActivityKpidata');
$this->load->model('agent/admin/Market_sylive_groups_model', 'mdSyliveGroups');
$this->load->model('agent/admin/Market_sylive_user_model', 'mdSyliveUser');
}
/**
* Notes:订单管理列表
* Created on: 2022/12/08 14:48
* Created by: dengbw
*/
public function index_get()
{
$date = $this->orderList($this->inputs);
$this->return_response_list($date);
}
/**
* Notes:导出订单数据
* Created on: 2022/12/08 15:26
* Created by: dengbw
*/
public function export_get()
{
$this->inputs['page'] = 1;
$this->inputs['limit'] = 20000;
$date = $this->orderList($this->inputs);
$this->return_response_list($date);
}
private function orderList($params)
{
$activityId = intval($params['activityId']);
$page = $params['page'];
$limit = $params['limit'];
$uname = $params['uname'];
$mobile = $params['mobile'];
$status = $params['status'];
$type = $params['type'];
$sort = $params['sort'];
$order = $params['order'];
$bizId = $params['bizId'];
$itemId = $params['itemId'];
$insiders = intval($params['insiders']);//内部人员
$createTimeStart = $this->input_param('createTimeStart');
$createTimeEnd = $this->input_param('createTimeEnd');
!$page && $page = 1;
!$limit && $limit = 10;
$levels = [];
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'parentId' => 0, 'status>=' => 0]);
if ($re_gro['statisticsType']) {
$this->load->model('agent/admin/Market_sys_dictionary_data_model', 'mdSysDictionaryData');
$res_dit = $this->mdSysDictionaryData->select(['status>=' => 0, 'dictId' => $re_gro['statisticsType']], 'sortNumber asc,dictDataId desc'
, 0, 0, 'dictDataCode,dictDataName');
foreach ($res_dit as $k => $v) {
$groupsLevel = intval($v['dictDataCode']);
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'groupsLevel' => $groupsLevel, 'status>=' => 0]);
if ($re_gro) {
$levels[] = ['label' => $v['dictDataName'], 'prop' => "levelName{$groupsLevel}"];
}
}
}
$sort_order = 'id desc';
if ($sort && $order) {
if ($sort == 'statusName') {
$sort_order = 'status ' . $order;
} else if ($sort == 'typeName') {
$sort_order = 'type ' . $order;
} else if ($sort == 'cfromName') {
$sort_order = 'cfrom ' . $order;
} else {
$sort_order = $sort . ' ' . $order;
}
}
$list = [];
if (!strlen($status)) {
$status = 1;
}
$where['status'] = $status;
$activityId && $where['activityId'] = $activityId;
$itemId && $where['itemId'] = $itemId;
$uname && $where['uname LIKE "%' . trim($uname) . '%"'] = null;
$mobile && $where['mobile LIKE "%' . trim($mobile) . '%"'] = null;
strlen($type) && $where['type'] = $type;
$createTimeStart && $where['createTime>='] = $createTimeStart;
$createTimeEnd && $where['createTime<='] = $createTimeEnd;
if ($insiders == 1) {
$where["userId in(select userId from lc_market_sylive_user where organizationId>0)"] = null;
} else if ($insiders == 2) {
$where["userId not in(select userId from lc_market_sylive_user where organizationId>0)"] = null;
}
if ($bizId) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $bizId]);
if ($res_org) {
if ($res_org['groupsLevel']) {
$levelId = 'levelId' . $res_org['groupsLevel'];
$where[$levelId] = $bizId;
} else if ($res_org['parentId']) {//门店
$where['bizId'] = $bizId;
}
}
}
$count = $this->mdSyliveOrder->count($where);
if ($limit >= 10000 && $count > 10000) {
$this->return_json('导出失败,每次导出不能超出10000条数据');
}
if ($count) {
$res = $this->mdSyliveOrder->select($where, $sort_order, $page, $limit);
$userIds = implode(',', array_column($res, 'userId'));
$map_user = $this->mdSyliveUser->map('userId', 'organizationId', ["userId in({$userIds})" => null]);
foreach ($res as $v) {
$consultant = $this->consultantGet(['activityId' => $v['activityId'], 'userId' => $v['userId']
, 'levelId1' => $v['levelId1'], 'levelId2' => $v['levelId2'], 'levelId3' => $v['levelId3']
, 'bizId' => $v['bizId'], 'cfUserId' => $v['cfUserId'], 'itemId' => $v['itemId']]);
$insiders = $map_user[$v['userId']] ? '是' : '否';//内部人员
$list1 = [
'id' => $v['id'], 'sid' => $v['sid'], 'uname' => $v['uname'], 'mobile' => $v['mobile'], 'itemTitle' => $v['itemTitle']
, 'totalPrice' => $v['totalPrice'], 'payTime' => $v['payTime'] != '0000-00-00 00:00:00' ? $v['payTime'] : ''
, 'createTime' => $v['createTime'], 'typeName' => $this->mdSyliveOrder->typeAry($v['type'])
, 'statusName' => $this->mdSyliveOrder->statusAry($v['status']), 'insiders' => $insiders, 'consultant' => $consultant['consultant']
];
if ($limit >= 10000) {
unset($list1['id']);
$list1['consultantMobile'] = $consultant['consultantMobile'];
} else {
unset($list1['sid']);
}
$list2 = [];
foreach ($levels as $k2 => $v2) {
$list2[$v2['prop']] = $consultant[$v2['prop']] ? $consultant[$v2['prop']] : '';
}
$item = count($list2) ? array_merge($list1, $list2) : $list1;
$item['stores'] = $consultant['stores'];
if ($limit >= 10000) {
$address = $biz = '';
$jsondata = $v['jsondata'] ? json_decode($v['jsondata'], true) : [];
if ($jsondata['address']) {
$address = $jsondata['address']['region'] . $jsondata['address']['detail'];
}
if ($jsondata['biz']) {
$biz = $jsondata['biz'];
}
$item['biz'] = $biz;
$item['address'] = $address;
}
$list[] = $item;
}
}
if ($limit >= 10000) {
$columns1 = ['订单号', '姓名', '手机号', '商品标题', '订单价格', '付款时间', '创建时间', '订单类型', '状态', '内部人员'
, '顾问', '顾问手机号'];
$columns2 = [];
foreach ($levels as $k => $v) {
$columns2[] = $v['label'];
}
$columns3 = count($columns2) ? array_merge($columns1, $columns2) : $columns1;
$columns = array_merge($columns3, ['门店', '所选经销商', '地址']);
return ['list' => $list, 'columns' => $columns];
} else {
$columns = '';
if ($page == 1) {
$columns1 = [
['prop' => 'id', 'label' => 'ID', 'align' => 'center', 'showOverflowTooltip' => true, 'minWidth' => 45, 'fixed' => 'left'],
['prop' => 'uname', 'label' => '姓名', 'showOverflowTooltip' => true, 'minWidth' => 60],
['prop' => 'mobile', 'label' => '手机号', 'showOverflowTooltip' => true, 'minWidth' => 80],
['prop' => 'itemTitle', 'label' => '商品标题', 'showOverflowTooltip' => true, 'minWidth' => 130],
['prop' => 'totalPrice', 'label' => '订单价格', 'showOverflowTooltip' => true, 'minWidth' => 70, 'sortable' => 'custom'],
['prop' => 'payTime', 'label' => '付款时间', 'showOverflowTooltip' => true, 'minWidth' => 100, 'sortable' => 'custom'],
['prop' => 'createTime', 'label' => '创建时间', 'showOverflowTooltip' => true, 'minWidth' => 100, 'sortable' => 'custom'],
['prop' => 'typeName', 'label' => '订单类型', 'showOverflowTooltip' => true, 'minWidth' => 60],
['prop' => 'statusName', 'label' => '状态', 'showOverflowTooltip' => true, 'minWidth' => 60],
['prop' => 'insiders', 'label' => '内部人员', 'showOverflowTooltip' => true, 'minWidth' => 60],
['prop' => 'consultant', 'label' => '顾问', 'showOverflowTooltip' => true, 'minWidth' => 55]
];
$columns2 = [];
foreach ($levels as $k => $v) {
$columns2[] = ['prop' => $v['prop'], 'label' => $v['label'], 'showOverflowTooltip' => true, 'minWidth' => 80];
}
$columns = count($columns2) ? array_merge($columns1, $columns2) : $columns1;
$columns[] = ['prop' => 'stores', 'label' => '门店', 'showOverflowTooltip' => true, 'minWidth' => 80];
}
return ['list' => $list, 'count' => $count, 'columns' => $columns];
}
}
/**
* Notes:获取顾问信息
* Created on: 2022/12/08 11:29
* Created by: dengbw
* @param $params
* @return string
*/
private function consultantGet($params)
{
$stores = $consultant = $consultantMobile = $levelName1 = $levelName2 = $levelName3 = '';
$levelId1 = intval($params['levelId1']);
$levelId2 = intval($params['levelId2']);
$levelId3 = intval($params['levelId3']);
$bizId = intval($params['bizId']);
$cfUserId = intval($params['cfUserId']);
$itemId = intval($params['itemId']);
if (!$bizId && $params['userId']) {
$re = $this->mdSyliveActivityKpidata->get(['activityId' => $params['activityId'], 'userId' => $params['userId'], 'itemId' => $itemId]);
if ($re) {
$levelId1 = $re['levelId1'];
$levelId2 = $re['levelId2'];
$levelId3 = $re['levelId3'];
$bizId = $re['bizId'];
$cfUserId = $re['cfUserId'];
}
}
if ($bizId) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $bizId]);
$res_org['groupsName'] && $stores = $res_org['groupsName'];
}
if ($levelId1) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId1]);
$res_org['groupsName'] && $levelName1 = $res_org['groupsName'];
}
if ($levelId2) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId2]);
$res_org['groupsName'] && $levelName2 = $res_org['groupsName'];
}
if ($levelId3) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId3]);
$res_org['groupsName'] && $levelName3 = $res_org['groupsName'];
}
if ($cfUserId) {
$re_user = $this->mdSyliveUser->get(['userId' => $cfUserId]);
if ($re_user['uname']) {
$consultant = $re_user['uname'];
$consultantMobile = $re_user['mobile'];
}
}
return ['stores' => $stores, 'consultant' => $consultant, 'consultantMobile' => $consultantMobile, 'levelName1' => $levelName1,
'levelName2' => $levelName2, 'levelName3' => $levelName3];
}
/**
* Notes:导入订单
* Created on: 2023/4/26 17:24
* Created by: dengbw
* @throws PHPExcel_Exception
* @throws PHPExcel_Reader_Exception
*/
public function import_post()
{
$activityId = intval($_POST['activityId']);
if (!$activityId) {
$this->return_json('参数错误');
}
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
$res = $this->upload();
if (!$res['code']) {
return $this->return_json($res['message']);
}
$file = $res['path'];
if ($res['file_ext'] == '.xls') {
$reader = \PHPExcel_IOFactory::createReader('Excel5'); // 读取 excel 文档
} elseif ($res['file_ext'] == '.xlsx') {
$reader = \PHPExcel_IOFactory::createReader('Excel2007'); // 读取 excel 文档
} else {
return $this->return_json('文件无法识别');
}
$PHPExcel = $reader->load($file); // 文档名称
$objWorksheet = $PHPExcel->getActiveSheet();
$rowCnt = $objWorksheet->getHighestRow(); //获取总行数
if ($rowCnt > 800) {
@unlink($file);
$this->return_json('数据大于800请拆分多个表格导入');
}
$this->load->model('agent/admin/Market_sylive_items_model', 'mdSyliveItems');
$this->load->model('agent/admin/Market_sylive_groups_user_model', 'mdSyliveGroupsUser');
$this->load->library('agent/admin/sylive2_entity');
$done = 0;
for ($_row = 2; $_row <= $rowCnt; $_row++) { //读取内容
$itemId = $itemPrice = $totalPrice = $cfUserId = $bizId = $levelId1 = $levelId2 = $levelId3 = $userId = $cfUserId = 0;
$sid = $objWorksheet->getCell('A' . $_row)->getValue();
$mobile = $objWorksheet->getCell('C' . $_row)->getValue();
$itemTitle = $objWorksheet->getCell('D' . $_row)->getValue();
if ($mobile) {
$where = ['mobile' => $mobile, "activityId" => $activityId];
if ($itemTitle) {
$re_order = $this->mdSyliveItems->get(['title' => $itemTitle, "activityId" => $activityId]);
if ($re_order) {
$where["itemId"] = $re_order['itemId'];
$itemId = $re_order['itemId'];
$itemPrice = $re_order['price'];
}
}
$re_order = $this->mdSyliveOrder->get($where);
if (!$re_order) {
$uname = $objWorksheet->getCell('B' . $_row)->getValue();
$totalPrice = $objWorksheet->getCell('E' . $_row)->getValue();
$createTime = $objWorksheet->getCell('F' . $_row)->getValue();
$bizName = $objWorksheet->getCell('G' . $_row)->getValue();
$cfMobile = $objWorksheet->getCell('I' . $_row)->getValue();
if ($cfMobile) {
$re_user = $this->mdSyliveUser->get(['mobile' => $cfMobile, 'organizationId>' => 0, 'status<>' => -1]);
if ($re_user['userId']) {
$cfUserId = $re_user['userId'];
$re_groUser = $this->mdSyliveGroupsUser->get(['activityId' => $activityId, 'userId' => $cfUserId, 'status<>' => -1]);
if ($re_groUser['bizId']) {
$bizId = $re_groUser['bizId'];
$levelId1 = $re_groUser['levelId1'];
$levelId2 = $re_groUser['levelId2'];
$levelId3 = $re_groUser['levelId3'];
}
}
}
if (!$bizId && $bizName) {
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'groupsName' => $bizName, 'ifBiz' => 1, 'status<>' => -1]);
if ($re_gro['groupsId']) {
$bizId = $re_gro['groupsId'];
$levelAry = $this->getLevelAry($re_gro['parentId']);
$levelAry['levelId1'] && $levelId1 = $levelAry['levelId1'];
$levelAry['levelId2'] && $levelId2 = $levelAry['levelId2'];
$levelAry['levelId3'] && $levelId3 = $levelAry['levelId3'];
}
}
//$re_user2 = $this->mdSyliveUser->get(['mobile' => $mobile, 'status<>' => -1]);
//手机号和订单金额为0的订单
$re_order = $this->mdSyliveOrder->get(['mobile' => $mobile, 'totalPrice' => 0]);
if ($re_order['userId']) {
$userId = $re_order['userId'];
}
!$sid && $sid = create_order_no('350200', 'market');
!$createTime && $createTime = "0000-00-00 00:00:00";
$addData = [
'itemId' => $itemId,
'itemTitle' => $itemTitle,
'itemPrice' => $itemPrice,
'createTime' => $createTime,
'payTime' => $createTime,
'totalPrice' => $totalPrice,
'uname' => $uname,
'mobile' => $mobile,
'status' => 1,
'activityId' => $activityId,
'sid' => $sid,
'bizId' => $bizId,
'levelId1' => $levelId1,
'levelId2' => $levelId2,
'levelId3' => $levelId3,
'userId' => $userId,
'cfUserId' => $cfUserId,
];
$id = $this->mdSyliveOrder->add($addData);
if ($id) {
//私域通增加记录
if ($cfUserId) {
$params = [
'a_id' => $activityId,
'uid' => $userId,
'cf_uid' => $cfUserId,
'kpi' => 'order',
'tagId' => $id,
'jsondata' => ['order_id' => $id, 'sid' => $sid],
'itemId' => $itemId,
'c_time' => strtotime($createTime)
];
$this->sylive2_entity->kpi_log($params);
}
$done++;
}
}
}
}
@unlink($file);
$this->return_response('', "成功导入订单{$done}");
}
/**
* Notes:获取分组等级ID
* Created on: 2023/3/01 14:30
* Created by: dengbw
* @param $groupsId
* @param array $data
* @return array
*/
private function getLevelAry($groupsId, $data = [])
{
$re = $this->mdSyliveGroups->get(['groupsId' => $groupsId], 'groupsId,parentId,groupsLevel');
if (!$re) {
return $data;
} else {
if ($re['groupsLevel']) {//分类id
$levelId = "levelId" . $re['groupsLevel'];
$data[$levelId] = $re['groupsId'];
}
if ($re['parentId']) {
return $this->getLevelAry($re['parentId'], $data);
} else {
return $data;
}
}
}
private function upload()
{
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/';
$config['allowed_types'] = '*';
$config['max_size'] = 5120;
$config['file_name'] = 'exchange_' . time() . rand(1, 99999);
$this->load->library('upload', $config);
if (!$this->upload->do_upload('file')) {
return ['code' => SYS_CODE_FAIL, 'message' => $this->upload->display_errors('', '')];
} else {
$data = $this->upload->data();
return ['code' => SYS_CODE_SUCCESS, 'path' => $data['full_path'], 'file_ext' => $data['file_ext']];
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,278 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_分组用户管理
* Created on: 2022/11/25 17:15
* Created by: dengbw
*/
class GroupsUser extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_groups_user_model', 'mdSyliveGroupsUser');
$this->load->model('agent/admin/Market_sylive_groups_model', 'mdSyliveGroups');
$this->load->model('agent/admin/Market_sylive_user_model', 'mdSyliveUser');
}
/**
* Notes:用户管理列表
* Created on: 2022/9/20 14:48
* Created by: dengbw
*/
public function page_get()
{
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$uname = $this->input_param('uname');
$nickname = $this->input_param('nickname');
$activityId = intval($this->input_param('activityId'));
$groupsId = intval($this->input_param('groupsId'));
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'type desc,groupsUserId desc';
$list = [];
$where['status>='] = 0;
$groupsId && $where['groupsId'] = $groupsId;
$activityId && $where['activityId'] = $activityId;
if ($uname || $nickname) {
$where_user = $uname ? "(uname LIKE '%{$uname}%')" : "(nickname LIKE '%{$nickname}%')";
$where["userId in (select userId from lc_market_sylive_user where {$where_user})"] = null;
}
$count = $this->mdSyliveGroupsUser->count($where);
if ($count) {
$res = $this->mdSyliveGroupsUser->select($where, $sort_order, $page, $limit);
$user_ids = implode(",", array_column($res, 'userId'));
$map_user = $this->mdSyliveUser->map('userId', 'uname,nickname,mobile', ["userId in({$user_ids})" => null]);
foreach ($res as $v) {
$uname = $nickname = $mobile = '';
$user = $map_user[$v['userId']];
if ($user) {
$uname = $user['uname'];
$nickname = $user['nickname'];
$mobile = $user['mobile'];
}
$status = intval($v['status']);
$createTime = $v['createTime'] != '0000-00-00 00:00:00' ? $v['createTime'] : '';
if ($v['type'] == 0) {
$roleName = '销售';
} else if ($v['type'] == 1) {
$roleName = $v['userFrom'] == 0 ? '店长' : '团长';
} else {
$roleName = '管理员';
}
$list[] = [
'groupsUserId' => $v['groupsUserId'], 'userId' => $v['userId'],'uname' => $uname, 'nickname' => $nickname, 'mobile' => $mobile
, 'groupsId' => $groupsId, 'roleName' => $roleName, 'status' => $status, 'createTime' => $createTime];
}
}
$date = ['list' => $list, 'count' => $count];
$this->return_response_list($date);
}
/**
* Notes:添加用户
* Created on: 2022/9/21 16:46
* Created by: dengbw
*/
public function index_post()
{
$activityId = intval($this->input_param('activityId'));
$groupsId = intval($this->input_param('groupsId'));
$userFrom = intval($this->input_param('userFrom'));
$chooseUsers = $this->input_param('chooseUsers');
if (!$groupsId) {
$this->return_json('未选择分组');
}
if (!$chooseUsers) {
$this->return_json('未选择用户');
}
$addData = [];
$levelAry = $this->getLevelAry($groupsId);
$re_gro = $this->mdSyliveGroups->get(['groupsId' => $groupsId], 'ifBiz');
$ifBiz = intval($re_gro['ifBiz']);//是否门店
foreach ($chooseUsers as $v) {
$re = $this->mdSyliveGroupsUser->get(['activityId' => $activityId, 'userId' => $v['userId'], 'status>=' => 0]);
if (!$re) {
$type = $ifBiz ? $v['type'] : 2;
$value = ['userId' => $v['userId'], 'type' => $type, 'activityId' => $activityId
, 'groupsId' => $groupsId, 'userFrom' => $userFrom, 'createTime' => date('Y-m-d H:i:s')];
$data = array_merge($value, $levelAry);
$addData[] = $data;
}
}
$addData && $this->mdSyliveGroupsUser->add_batch($addData);
$this->return_response();
}
/**
* Notes:同步原始门店用户
* Created on: 2022/12/9 12:21
* Created by: dengbw
*/
public function synchronous_get()
{
$groupsId = intval($this->input_param('groupsId'));
if (!$groupsId) {
$this->return_json('参数错误');
}
$re_gro = $this->mdSyliveGroups->get(['groupsId' => $groupsId]);
if (!$re_gro) {
$this->return_json('分组不存在');
}
$originalBizId = intval($re_gro['originalBizId']);
if (!$originalBizId) {
$this->return_json('未关连原始门店');
}
$activityId = intval($re_gro['activityId']);
$userFrom = intval($re_gro['userFrom']);
$levelAry = $this->getLevelAry($groupsId);
$res = $this->mdSyliveUser->select(['bizId' => $originalBizId, 'status' => 0], 'userId asc', 0, 0
, 'userId,organizationId,bizId');
$addUser = [];
foreach ($res as $v) {
$re_user = $this->mdSyliveGroupsUser->get(['activityId' => $activityId, 'userId' => $v['userId'], 'status>=' => 0]);
if (!$re_user) {
$type = $v['bizId'] == $v['organizationId'] ? 1 : 0;
$value = ['userId' => $v['userId'], 'type' => $type, 'activityId' => $activityId
, 'groupsId' => $groupsId, 'userFrom' => $userFrom, 'createTime' => date('Y-m-d H:i:s')];
$data = array_merge($value, $levelAry);
$addUser[] = $data;
}
}
$addUser && $this->mdSyliveGroupsUser->add_batch($addUser);
$this->return_response();
}
/**
* Notes:获取分组等级ID
* Created on: 2022/11/30 14:30
* Created by: dengbw
* @param $groupsId
* @param array $data
* @return array
*/
private function getLevelAry($groupsId, $data = [])
{
$re = $this->mdSyliveGroups->get(['groupsId' => $groupsId], 'groupsId,parentId,groupsLevel,ifBiz');
if (!$re) {
return $data;
} else {
if ($re['groupsLevel']) {//分类id
$levelId = "levelId" . $re['groupsLevel'];
$data[$levelId] = $re['groupsId'];
}
if ($re['ifBiz']) {//门店id
$data['bizId'] = $re['groupsId'];
}
if ($re['parentId']) {
return $this->getLevelAry($re['parentId'], $data);
} else {
return $data;
}
}
}
/**
* Notes:修改用户
* Created on: 2022/9/21 14:48
* Created by: dengbw
*/
public function index_put()
{
$userId = intval($this->input_param('userId'));
$teamId = intval($this->input_param('teamId'));
$uname = $this->input_param('uname');
if (!$userId) {
$this->return_json('参数错误');
}
if (!$teamId) {
$this->return_json('请选择所属团队');
}
if (!$uname) {
$this->return_json('请输入姓名');
}
$upDate = ['teamId' => $teamId, 'uname' => $uname];
$this->mdSyliveGroupsUser->update($upDate, ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:修改状态
* Created on: 2022/9/21 16:10
* Created by: dengbw
*/
public function status_put()
{
$groupsUserId = $this->input_param('groupsUserId');
$status = $this->input_param('status');
if (!$groupsUserId) {
$this->return_json('参数错误');
}
$this->mdSyliveGroupsUser->update(['status' => $status], ['groupsUserId' => $groupsUserId]);
$this->return_response();
}
/**
* Notes:删除用户
* Created on: 2022/9/21 16:10
* Created by: dengbw
* @param null $groupsUserId
*/
public function index_delete($groupsUserId = null)
{
if (!$groupsUserId) {
$this->return_json('参数错误');
}
$this->mdSyliveGroupsUser->update(['status' => -1], ['groupsUserId' => $groupsUserId]);
$this->return_response();
}
/**
* Notes:删除用户
* Created on: 2022/10/21 17:11
* Created by: dengbw
*/
public function batch_delete()
{
$ids = $this->input_param('ids');
if (!$ids) {
$this->return_json('参数错误');
}
$str_ids = implode(',', $ids);
if ($str_ids) {
$this->mdSyliveGroupsUser->update(['status' => -1], ["groupsUserId in($str_ids)" => null]);
}
$this->return_response();
}
/**
* Notes:栓验字段
* Created on: 2022/9/21 15:52
* Created by: dengbw
*/
public function existence_get()
{
$field = $this->input_param('field');
$value = $this->input_param('value');
$id = $this->input_param('id');
if (!$id) {
$where = [$field => $value, 'status<>' => -1];
$re = $this->mdSyliveGroupsUser->get($where);
if ($re) {
if ($field == 'mobile') {
if ($re['teamId'] || $re['organizationId']) {
$this->return_json('已存在', 0);
}
} else {
$this->return_json('已存在', 0);
}
}
}
$this->return_json('不存在', 1);
}
}
@@ -1,254 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_中奖名单管理
* Created on: 2022/12/08 17:15
* Created by: dengbw
*/
class groupsWin extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_order_model', 'mdSyliveOrder');
$this->load->model('agent/admin/Market_sylive_user_model', 'mdSyliveUser');
$this->load->model('agent/admin/Market_sylive_activity_kpidata_model', 'mdSyliveActivityKpidata');
$this->load->model('agent/admin/Market_sylive_groups_model', 'mdSyliveGroups');
$this->load->model('agent/admin/Market_sylive_activity_draw_model', 'mdSyliveActivityDraw');
$this->load->model('agent/admin/Market_sylive_organization_model', 'mdSyliveOrganization');
$this->load->model('agent/admin/Market_sylive_team_model', 'mdSyliveTeam');
}
/**
* Notes:订单管理列表
* Created on: 2022/12/08 14:48
* Created by: dengbw
*/
public function index_get()
{
$date = $this->orderList($this->inputs);
$this->return_response_list($date);
}
/**
* Notes:导出订单数据
* Created on: 2022/12/08 15:26
* Created by: dengbw
*/
public function export_get()
{
$this->inputs['page'] = 1;
$this->inputs['limit'] = 20000;
$date = $this->orderList($this->inputs);
$this->return_response_list($date);
}
/**
* Notes:中奖类型
* Created on: 2022/12/08 15:26
* Created by: dengbw
*/
public function win_type_get()
{
$activityId = intval($this->input_param('activityId'));
$re_draw = $this->mdSyliveActivityDraw->get(['activityId' => $activityId]);
$date = [];
if ($re_draw && $re_draw['winType']) {
$json_winType = json_decode($re_draw['winType'], true);
foreach ($json_winType as $v) {
$date[] = ['id' => $v['id'], 'name' => $v['title']];
}
}
$this->return_response_list($date);
}
private function orderList($params)
{
$activityId = intval($params['activityId']);
$page = $params['page'];
$limit = $params['limit'];
$uname = $params['uname'];
$mobile = $params['mobile'];
$type = $params['type'];
$sort = $params['sort'];
$order = $params['order'];
$bizId = $params['bizId'];
$itemId = $params['itemId'];
$winType = $params['winType'];
!$page && $page = 1;
!$limit && $limit = 10;
$levels = [];
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'parentId' => 0, 'status>=' => 0]);
if ($re_gro['statisticsType']) {
$this->load->model('agent/admin/Market_sys_dictionary_data_model', 'mdSysDictionaryData');
$res_dit = $this->mdSysDictionaryData->select(['status>=' => 0, 'dictId' => $re_gro['statisticsType']], 'sortNumber asc,dictDataId desc'
, 0, 0, 'dictDataCode,dictDataName');
foreach ($res_dit as $k => $v) {
$groupsLevel = intval($v['dictDataCode']);
$re_gro = $this->mdSyliveGroups->get(['activityId' => $activityId, 'groupsLevel' => $groupsLevel, 'status>=' => 0]);
if ($re_gro) {
$levels[] = ['label' => $v['dictDataName'], 'prop' => "levelName{$groupsLevel}"];
}
}
}
$sort_order = 'winTime desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$list = [];
$where['status'] = 1;
$where['win'] = 1;
$activityId && $where['activityId'] = $activityId;
$itemId && $where['itemId'] = $itemId;
$winType && $where['winType'] = $winType;
$uname && $where['uname LIKE "%' . trim($uname) . '%"'] = null;
$mobile && $where['mobile LIKE "%' . trim($mobile) . '%"'] = null;
strlen($type) && $where['type'] = $type;
if ($bizId) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $bizId]);
if ($res_org) {
if ($res_org['groupsLevel']) {
$levelId = 'levelId' . $res_org['groupsLevel'];
$where[$levelId] = $bizId;
} else if ($res_org['parentId']) {//门店
$where['bizId'] = $bizId;
}
}
}
$count = $this->mdSyliveOrder->count($where);
if ($limit >= 10000 && $count > 10000) {
$this->return_json('导出失败,每次导出不能超出10000条数据');
}
if ($count) {
$winTypeAry = [];
$re_draw = $this->mdSyliveActivityDraw->get(['activityId' => $activityId]);
if ($re_draw && $re_draw['winType']) {
$json_winType = json_decode($re_draw['winType'], true);
foreach ($json_winType as $v) {
$winTypeAry[$v['id']] = $v['title'];
}
}
$res = $this->mdSyliveOrder->select($where, $sort_order, $page, $limit);
foreach ($res as $v) {
$consultant = $this->consultantGet(['activityId' => $v['activityId'], 'userId' => $v['userId']
, 'levelId1' => $v['levelId1'], 'levelId2' => $v['levelId2'], 'levelId3' => $v['levelId3']
, 'bizId' => $v['bizId'], 'cfUserId' => $v['cfUserId']]);
$winName = $winTypeAry[$v['winType']] ? $winTypeAry[$v['winType']] : '';
$list1 = [
'id' => $v['id'], 'sid' => $v['sid'], 'uname' => $v['uname'], 'mobile' => $v['mobile'], 'itemTitle' => $v['itemTitle']
, 'totalPrice' => $v['totalPrice'], 'payTime' => $v['payTime'] != '0000-00-00 00:00:00' ? $v['payTime'] : ''
, 'winTime' => $v['winTime'] ? $v['winTime'] : '', 'winName' => $winName, 'consultant' => $consultant['consultant']
];
if ($limit >= 10000) {
unset($list1['id']);
} else {
unset($list1['sid']);
}
$list2 = [];
foreach ($levels as $k2 => $v2) {
$list2[$v2['prop']] = $consultant[$v2['prop']] ? $consultant[$v2['prop']] : '';
}
$item = count($list2) ? array_merge($list1, $list2) : $list1;
$item['stores'] = $consultant['stores'];
if ($limit >= 10000) {
$address = $biz = '';
$jsondata = $v['jsondata'] ? json_decode($v['jsondata'], true) : [];
if ($jsondata['address']) {
$address = $jsondata['address']['region'] . $jsondata['address']['detail'];
}
if ($jsondata['biz']) {
$biz = $jsondata['biz'];
}
$item['biz'] = $biz;
$item['address'] = $address;
}
$list[] = $item;
}
}
if ($limit >= 10000) {
$columns1 = ['订单号', '姓名', '手机号', '商品标题', '订单价格', '付款时间', '中奖时间', '中奖类型', '顾问'];
$columns2 = [];
foreach ($levels as $k => $v) {
$columns2[] = $v['label'];
}
$columns3 = count($columns2) ? array_merge($columns1, $columns2) : $columns1;
$columns = array_merge($columns3, ['门店', '所选经销商', '地址']);
return ['list' => $list, 'columns' => $columns];
} else {
$columns = '';
if ($page == 1) {
$columns1 = [
['prop' => 'id', 'label' => 'ID', 'align' => 'center', 'showOverflowTooltip' => true, 'minWidth' => 45, 'fixed' => 'left'],
['prop' => 'uname', 'label' => '姓名', 'showOverflowTooltip' => true, 'minWidth' => 60],
['prop' => 'mobile', 'label' => '手机号', 'showOverflowTooltip' => true, 'minWidth' => 80],
['prop' => 'itemTitle', 'label' => '商品标题', 'showOverflowTooltip' => true, 'minWidth' => 130],
['prop' => 'totalPrice', 'label' => '订单价格', 'showOverflowTooltip' => true, 'minWidth' => 70, 'sortable' => 'custom'],
['prop' => 'payTime', 'label' => '付款时间', 'showOverflowTooltip' => true, 'minWidth' => 100, 'sortable' => 'custom'],
['prop' => 'winTime', 'label' => '中奖时间', 'showOverflowTooltip' => true, 'minWidth' => 100, 'sortable' => 'custom'],
['prop' => 'winName', 'label' => '中奖类型', 'showOverflowTooltip' => true, 'minWidth' => 90],
['prop' => 'consultant', 'label' => '顾问', 'showOverflowTooltip' => true, 'minWidth' => 60]
];
$columns2 = [];
foreach ($levels as $k => $v) {
$columns2[] = ['prop' => $v['prop'], 'label' => $v['label'], 'showOverflowTooltip' => true, 'minWidth' => 80];
}
$columns = count($columns2) ? array_merge($columns1, $columns2) : $columns1;
$columns[] = ['prop' => 'stores', 'label' => '门店', 'showOverflowTooltip' => true, 'minWidth' => 80];
}
return ['list' => $list, 'count' => $count, 'columns' => $columns];
}
}
/**
* Notes:获取顾问信息
* Created on: 2022/12/08 11:29
* Created by: dengbw
* @param $params
* @return string
*/
private function consultantGet($params)
{
$stores = $consultant = $levelName1 = $levelName2 = $levelName3 = '';
$levelId1 = intval($params['levelId1']);
$levelId2 = intval($params['levelId2']);
$levelId3 = intval($params['levelId3']);
$bizId = intval($params['bizId']);
$cfUserId = intval($params['cfUserId']);
if (!$bizId && $params['userId']) {
$re = $this->mdSyliveActivityKpidata->get(['activityId' => $params['activityId'], 'userId' => $params['userId'], 'kpi' => 'order']);
if ($re) {
$levelId1 = $re['levelId1'];
$levelId2 = $re['levelId2'];
$levelId3 = $re['levelId3'];
$bizId = $re['bizId'];
$cfUserId = $re['cfUserId'];
}
}
if ($bizId) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $bizId]);
$res_org['groupsName'] && $stores = $res_org['groupsName'];
}
if ($levelId1) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId1]);
$res_org['groupsName'] && $levelName1 = $res_org['groupsName'];
}
if ($levelId2) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId2]);
$res_org['groupsName'] && $levelName2 = $res_org['groupsName'];
}
if ($levelId3) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId3]);
$res_org['groupsName'] && $levelName3 = $res_org['groupsName'];
}
if ($cfUserId) {
$re_user = $this->mdSyliveUser->get(['userId' => $cfUserId]);
$re_user['uname'] && $consultant = $re_user['uname'];
}
return ['stores' => $stores, 'consultant' => $consultant, 'levelName1' => $levelName1,
'levelName2' => $levelName2, 'levelName3' => $levelName3];
}
}
-346
View File
@@ -1,346 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_直播管理
* Created on: 2022/10/21 17:15
* Created by: dengbw
*/
class Live extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_activity_model', 'mdSyliveActivity');
$this->load->model('agent/admin/Market_sylive_viewlog_model', 'mdSyliveViewlog');
$this->load->model('live/Live_polyv_session_model', 'mdPolyvSession');
$this->load->model('live/Live_polyv_viewlog_model', 'mdPolyvViewlog');
}
/**
* Notes:直播管理列表
* Created on: 2022/9/20 14:48
* Created by: dengbw
*/
public function index_get()
{
$activityId = intval($this->input_param('activityId'));
$re = $this->mdSyliveActivity->get(['activityId' => $activityId]);
if (!$re) {
$this->return_json('活动不存在');
}
$channelId = $re['channelId'] ? $re['channelId'] : '';
$where = ['channelId' => $channelId];
$count = $this->mdPolyvSession->count($where);
$list = [];
if ($count) {
$res = $this->mdPolyvSession->select($where, "startTime desc");
foreach ($res as $key => $value) {
$setValue = $value;
$setValue['duration'] = $value['duration'] ? ceil($value['duration'] / 60) : '0';
$setValue['totalPlayDuration'] = $value['totalPlayDuration'] ? ceil($value['totalPlayDuration'] / 60) : '0';
$setValue['startTime'] = $value['startTime'] ? date('Y-m-d H:i:s', $value['startTime'] / 1000) : '';
$setValue['endTime'] = $value['endTime'] ? date('Y-m-d H:i:s', $value['endTime'] / 1000) : '';
$setValue['viewlogTime'] = $value['viewlog_time'] != '0000-00-00 00:00:00'
? date('Y-m-d H:i', strtotime($value['viewlog_time'])) : '';
$setValue['sessionTime'] = $value['session_time'] != '0000-00-00 00:00:00' ?
date('Y-m-d H:i', strtotime($value['session_time'])) : '';
$list[] = $setValue;
}
}
$date = ['list' => $list, 'count' => $count];
$this->return_response_list($date);
}
/**
* Notes:同步频道多场次数据
* Created on: 2023/1/3 14:28
* Created by: dengbw
*/
public function session_api_get()
{
$activityId = intval($this->input_param('activityId'));
$channelId = $this->input_param('channelId');
$sessionId = $this->input_param('sessionId');
if (!$channelId) {
$this->return_json('参数错误');
}
$this->load->library('PolyvApi');
$polyv = new PolyvApi(['channel_id' => $channelId]);
if ($sessionId) {
$where['sessionIds'] = $sessionId;
} else {
$re = $this->mdSyliveActivity->get(['activityId' => $activityId]);
if (!$re) {
$this->return_json('活动不存在');
}
$where['startTime'] = strtotime($re['timeStart']) * 1000;
$where['endTime'] = strtotime($re['timeEnd']) * 1000;
}
$results = $polyv->getSessionStats($where);
if ($results['status'] == 'success') {
foreach ($results['data']['list'] as $key => $value) {
$re = $this->mdPolyvSession->get(['channelId' => $channelId, 'sessionId' => $value['sessionId']]);
$data = [
'channelId' => $value['channelId'], 'sessionId' => $value['sessionId'], 'name' => $value['name'],
'startTime' => $value['startTime'], 'endTime' => $value['endTime'], 'duration' => $value['duration'],
'liveUV' => $value['liveUV'], 'livePV' => $value['livePV'], 'playbackUV' => $value['playbackUV'],
'playbackPV' => $value['playbackPV'], 'totalPlayDuration' => $value['totalPlayDuration'],
'session_time' => date('Y-m-d H:i:s'),
];
if ($re) {//同步更新数据
$this->mdPolyvSession->update($data, ['id' => $re['id']]);
} else {//新增
$data['c_time'] = time();
$this->mdPolyvSession->add($data);
}
}
$this->return_response($results);
} else {
$this->return_json($results['message']);
}
}
/**
* Notes:同步直播观看详情数据
* Created on: 2022/12/26 16:49
* Created by: dengbw
*/
public function view_api_get()
{
$this->load->model('agent/admin/market_sylive_user_model', 'mdSyliveUser');
$this->load->model('agent/admin/market_sylive_activity_user_model', 'mdSyliveActivityUser');
$this->load->model('agent/admin/Market_sylive_groups_user_model', 'mdSyliveGroupsUser');
$activityId = intval($this->input_param('activityId'));
$channelId = $this->input_param('channelId');
$sessionId = $this->input_param('sessionId');
$page = $this->input_param('page');
if (!$activityId) {
$this->return_json('活动id不能为空');
}
if (!$channelId) {
$this->return_json('频道id不能为空');
}
if (!$channelId) {
$this->return_json('场次id不能为空');
}
!$page && $page = 1;
$re_session = $this->mdPolyvSession->get(['channelId' => $channelId, 'sessionId' => $sessionId]);
if (!$re_session) {
$this->return_json('无此场次数据');
}
$params['sessionIds'] = $sessionId;
$params['startTime'] = $re_session['startTime'];
$params['endTime'] = $re_session['endTime'];
$params['page'] = $page;
$params['pageSize'] = 100;
$this->load->library('PolyvApi');
$polyv = new PolyvApi(['channel_id' => $channelId]);
$results = $polyv->getViewLog($params);
$percent = $nextPageNumber = 0;
if ($results['status'] == 'success') {
$percent = ceil(($results['data']['pageNumber'] / $results['data']['totalPages']) * 100);
if (!$results['data']['lastPage'] && ($results['data']['pageNumber'] != $results['data']['nextPageNumber'])) {
$nextPageNumber = $results['data']['nextPageNumber'];
}
foreach ($results['data']['contents'] as $key => $value) {
$re = $this->mdPolyvViewlog->get(['playId' => $value['playId']]);
$data = [
'channelId' => $value['channelId'], 'sessionId' => $value['sessionId'], 'playId' => $value['playId'],
'userId' => $value['userId'], 'playDuration' => $value['playDuration'], 'stayDuration' => $value['stayDuration'],
'flowSize' => $value['flowSize'], 'param1' => $value['param1'], 'param2' => $value['param2'],
'param3' => $value['param3'], 'param4' => $value['param4'], 'param5' => $value['param5'], 'ptype' => $value['ptype'],
'ipAddress' => $value['ipAddress'], 'country' => $value['country'], 'province' => $value['province'],
'city' => $value['city'], 'isp' => $value['isp'], 'referer' => $value['referer'], 'userAgent' => $value['userAgent'],
'operatingSystem' => $value['operatingSystem'], 'browser' => $value['browser'], 'isMobile' => $value['isMobile'],
'currentDay' => $value['currentDay'], 'createdTime' => $value['createdTime'], 'lastModified' => $value['lastModified'],
];
if ($re) {//同步更新数据
$this->mdPolyvViewlog->update($data, ['id' => $re['id']]);
$vlogId = $re['id'];
} else {//新增
$data['c_time'] = time();
//新增数据
$vlogId = $this->mdPolyvViewlog->add($data);
}
if ($vlogId) {//私域直播_观看日志
$re_user = $this->mdSyliveUser->get(['unionid' => $data['param1']]);
if ($re_user) {
$ac_user = $this->mdSyliveActivityUser->get(['activityId' => $activityId, 'userId' => $re_user['userId']]);
if ($ac_user) {
$addData = [
'userId' => $re_user['userId'],
'vlogId' => $vlogId,
'activityId' => $activityId,
'playId' => $data['playId'],
'playDuration' => $data['playDuration'],
'stayDuration' => $data['stayDuration']
];
$p_user = $ac_user;
if ($ac_user['channelId']) {//顾问
$ch_user = $this->mdSyliveGroupsUser->get(['activityId' => $activityId, 'userId' => $ac_user['channelId']]);
if ($ch_user) {
$p_user = $ch_user;
$addData['cfUserId'] = $p_user['userId'];
}
}
$p_user['bizId'] && $addData['bizId'] = $p_user['bizId'];
$p_user['levelId1'] && $addData['levelId1'] = $p_user['levelId1'];
$p_user['levelId2'] && $addData['levelId2'] = $p_user['levelId2'];
$p_user['levelId3'] && $addData['levelId3'] = $p_user['levelId3'];
$re_log = $this->mdSyliveViewlog->get(['vlogId' => $vlogId]);
if ($re_log) {
$this->mdSyliveViewlog->update($addData, ['id' => $re_log['id']]);
} else {
$addData['createTime'] = time();
$this->mdSyliveViewlog->add($addData);
}
}
}
}
}
$this->mdPolyvSession->update(['viewlog_time' => date('Y-m-d H:i:s')],
['channelId' => $channelId, 'sessionId' => $sessionId]);
}
$date = ['percent' => $percent, 'nextPageNumber' => $nextPageNumber];
$this->return_response_list($date);
}
/**
* Notes:订单管理列表
* Created on: 2022/12/08 14:48
* Created by: dengbw
*/
public function viewlog_get()
{
$date = $this->viewlogList($this->inputs);
$this->return_response_list($date);
}
/**
* Notes:导出订单数据
* Created on: 2022/12/08 15:26
* Created by: dengbw
*/
public function export_viewlog_get()
{
$this->inputs['page'] = 1;
$this->inputs['limit'] = 10000;
$date = $this->viewlogList($this->inputs);
$this->return_response_list($date);
}
private function viewlogList($params)
{
$this->load->model('agent/admin/Market_sylive_groups_model', 'mdSyliveGroups');
$this->load->model('agent/admin/Market_sylive_user_model', 'mdSyliveUser');
$activityId = intval($params['activityId']);
$bizId = intval($params['bizId']);
$sessionId = $params['sessionId'];
$page = $params['page'];
$limit = $params['limit'];
!$page && $page = 1;
!$limit && $limit = 10;
$where['a.activityId'] = $activityId;
$sessionId && $where['b.sessionId'] = $sessionId;
if ($bizId) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $bizId]);
if ($res_org) {
if ($res_org['groupsLevel']) {
$levelId = 'a.levelId' . $res_org['groupsLevel'];
$where[$levelId] = $bizId;
} else if ($res_org['parentId']) {//门店
$where['a.bizId'] = $bizId;
}
}
}
if ($limit == 10000) {
$count = $limit;
} else {
$count = $this->db->select('a.id')
->from('lc_market_sylive_viewlog as a')
->join('lc_live_polyv_viewlog as b', "b.id=a.vlogId", 'left')
->where($where)
->count_all_results();
}
$list = [];
if ($count) {
$offset = ($page - 1) * $limit;
$res = $this->db->select('a.*,b.createdTime as time,b.param2 as uname')
->from('lc_market_sylive_viewlog as a')
->join('lc_live_polyv_viewlog as b', "b.id=a.vlogId", 'left')
->where($where)
->order_by('b.id Desc')
->limit($limit, $offset)
->get()->result_array();
$user_ids = implode(",", array_column($res, 'userId'));
$map_user = $this->mdSyliveUser->map('userId', 'uname', ["userId in({$user_ids})" => null]);
foreach ($res as $v) {
$uname = $v['uname'];
$consultant = $this->consultantGet(['userId' => $v['userId']
, 'levelId1' => $v['levelId1'], 'levelId2' => $v['levelId2'], 'levelId3' => $v['levelId3']
, 'bizId' => $v['bizId'], 'cfUserId' => $v['cfUserId']]);
$playDuration = '0';
if ($v['playDuration']) {
$format = $v['playDuration'] >= 3600 ? 'H:i:s' : 'i:s';//大1小时
$playDuration = gmdate($format, $v['playDuration']);
}
$map_user[$v['userId']] && $uname = $map_user[$v['userId']];
$item = [
'userId' => $v['userId'], 'uname' => $uname, 'playDuration' => $playDuration,
'createTime' => date('Y-m-d H:i:s', $v['time'] / 1000)
, 'levelName1' => $consultant['levelName1'], 'levelName2' => $consultant['levelName2'], 'levelName3' => $consultant['levelName3']
, 'stores' => $consultant['stores'], 'consultant' => $consultant['consultant']
];
$list[] = $item;
}
}
if ($limit == 10000) {
return $list;
} else {
return ['list' => $list, 'count' => $count];
}
}
/**
* Notes:获取顾问信息
* Created on: 2022/12/08 11:29
* Created by: dengbw
* @param $params
* @return string
*/
private function consultantGet($params)
{
$stores = $consultant = $levelName1 = $levelName2 = $levelName3 = '';
$levelId1 = intval($params['levelId1']);
$levelId2 = intval($params['levelId2']);
$levelId3 = intval($params['levelId3']);
$bizId = intval($params['bizId']);
$cfUserId = intval($params['cfUserId']);
if ($bizId) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $bizId]);
$res_org['groupsName'] && $stores = $res_org['groupsName'];
}
if ($levelId1) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId1]);
$res_org['groupsName'] && $levelName1 = $res_org['groupsName'];
}
if ($levelId2) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId2]);
$res_org['groupsName'] && $levelName2 = $res_org['groupsName'];
}
if ($levelId3) {
$res_org = $this->mdSyliveGroups->get(["groupsId" => $levelId3]);
$res_org['groupsName'] && $levelName3 = $res_org['groupsName'];
}
if ($cfUserId) {
$re_user = $this->mdSyliveUser->get(['userId' => $cfUserId]);
$re_user['uname'] && $consultant = $re_user['uname'];
}
return ['stores' => $stores, 'consultant' => $consultant, 'levelName1' => $levelName1,
'levelName2' => $levelName2, 'levelName3' => $levelName3];
}
}
@@ -1,320 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_用户管理
* Created on: 2022/9/19 17:15
* Created by: dengbw
*/
class Members extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_user_model', 'mdSyliveUser');
$this->load->model('agent/admin/Market_sylive_organization_model', 'mdSyliveOrganization');
}
/**
* Notes:用户管理列表
* Created on: 2022/9/20 14:48
* Created by: dengbw
*/
public function page_get()
{
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$uname = $this->input_param('uname');
$mobile = $this->input_param('mobile');
$sort = $this->input_param('sort');
$order = $this->input_param('order');
$topOrgId = intval($this->input_param('topOrgId'));
$keywords = $this->input_param('keywords');
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'userId desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$list = $re_org = [];
$roleAry = $this->mdSyliveUser->roleAry();
$where['status>='] = 0;
$topOrgId && $where['topOrgId'] = $topOrgId;
$re_org && $organizationType = $re_org['organizationType'];
if ($keywords) {
$where["(uname LIKE '%{$keywords}%' OR mobile LIKE '%{$keywords}%' OR nickname LIKE '%{$keywords}%')"] = null;
} else {
$uname && $where["uname LIKE '%{$uname}%'"] = null;
$mobile && $where["mobile LIKE '%{$mobile}%'"] = null;
}
$count = $this->mdSyliveUser->count($where);
if ($count) {
$res = $this->mdSyliveUser->select($where, $sort_order, $page, $limit);
$maJiaIds = $organizationIds = $map_maJia = $map_organization = [];
foreach ($res as $v) {
$v['maJiaId'] && !in_array($v['maJiaId'], $maJiaIds) && $maJiaIds[] = $v['maJiaId'];
$v['organizationId'] && !in_array($v['organizationId'], $organizationIds) && $organizationIds[] = $v['organizationId'];
$v['bizId'] && !in_array($v['bizId'], $organizationIds) && $organizationIds[] = $v['bizId'];
$v['topOrgId'] && !in_array($v['topOrgId'], $organizationIds) && $organizationIds[] = $v['topOrgId'];
}
if ($maJiaIds) {
$str_maJiaIds = implode(",", $maJiaIds);
$map_maJia = $this->mdSyliveUser->map('userId', 'uname,nickname,mobile', ["userId in({$str_maJiaIds})" => null]);
}
if ($organizationIds) {
$str_organizationIds = implode(",", $organizationIds);
$map_organization = $this->mdSyliveOrganization->map('organizationId', 'organizationName,organizationType'
, ["organizationId in({$str_organizationIds})" => null]);
}
foreach ($res as $v) {
$maJia = $maJiaId = $maJiaName = $maJiaShow = $organizationName = '';
$roleName = '客户';
$userId = intval($v['userId']);
$status = intval($v['status']);
$organizationId = $v['organizationId'] ? intval($v['organizationId']) : '';
$createTime = $v['createTime'] != '0000-00-00 00:00:00' ? $v['createTime'] : '';
if ($map_organization[$organizationId]) {
$organizationType = $map_organization[$organizationId]['organizationType'];
$roleName = $roleAry[$organizationType] ? $roleAry[$organizationType] : '客户';
}
$organizationName = $map_organization[$v['topOrgId']]['organizationName'];
if ($map_organization[$v['bizId']]['organizationName']) {
$organizationName = $organizationName ? $organizationName . '-' . $map_organization[$v['bizId']]['organizationName'] :
$map_organization[$v['bizId']]['organizationName'];
} elseif ($map_organization[$v['organizationId']]['organizationName']) {
$organizationName = $organizationName ? $organizationName . '-' . $map_organization[$v['organizationId']]['organizationName'] :
$map_organization[$v['organizationId']]['organizationName'];
}
if ($_SESSION['roleCode'] == 'admin') { //角色标识是admin才显示
$maJia = 1;
if ($v['maJiaId']) {
$maJiaId = intval($v['maJiaId']);
$maJiaName = $map_maJia[$maJiaId]['uname'] ? $map_maJia[$maJiaId]['uname'] : $map_maJia[$maJiaId]['nickname'];
$maJiaName = $maJiaName ? $maJiaName . '(' . $map_maJia[$maJiaId]['mobile'] . ')' : $map_maJia[$maJiaId]['mobile'];
}
$maJiaShow = $v['uname'] ? $v['uname'] : $v['nickname'];
$maJiaShow = $maJiaShow ? $maJiaShow . '(' . $v['mobile'] . ')' : $v['mobile'];
}
$list[] = ['userId' => $userId, 'maJia' => $maJia, 'maJiaId' => $maJiaId, 'maJiaName' => $maJiaName, 'maJiaShow' => $maJiaShow,
'uname' => $v['uname'], 'nickname' => $v['nickname'], 'mobile' => $v['mobile'], 'organizationName' => $organizationName,
'roleName' => $roleName, 'organizationId' => $organizationId, 'status' => $status, 'createTime' => $createTime];
}
}
$date = ['list' => $list, 'count' => $count];
$this->return_response_list($date);
}
/**
* Notes:添加用户
* Created on: 2022/9/21 16:46
* Created by: dengbw
*/
public function index_post()
{
$mobile = $this->input_param('mobile');
$organizationId = intval($this->input_param('organizationId'));
$uname = $this->input_param('uname');
if (!$mobile) {
$this->return_json('请输入手机号');
}
if (!$organizationId) {
$this->return_json('请选择所属机构');
}
if (!$uname) {
$this->return_json('请输入姓名');
}
$topOrgId = $this->getTopOrgId($organizationId);
$re = $this->mdSyliveUser->get(['mobile' => $mobile, 'topOrgId' => $topOrgId]);
if ($re && $re['status'] != -1) {
if ($re['teamId'] || $re['organizationId']) {
$this->return_json('手机号已存在当前机构');
}
}
$bizId = 0;
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $organizationId]);
if ($re_org) {
if ($re_org['organizationType'] == 4 && $re_org['parentId']) {
$bizId = $re_org['parentId'];
} else if ($re_org['organizationType'] == 3) {
$bizId = $re_org['organizationId'];
}
}
$addDate = ['topOrgId' => $topOrgId, 'organizationId' => $organizationId, 'uname' => $uname,
'bizId' => $bizId, 'status' => 0, 'teamId' => 0];
if ($re['userId']) {
$this->mdSyliveUser->update($addDate, ['userId' => $re['userId']]);
$this->return_response([], '绑定用户成功');
} else {
$addDate['mobile'] = $mobile;
$addDate['createTime'] = date('Y-m-d H:i:s');
$id = $this->mdSyliveUser->add($addDate);
if (!$id) {
$this->return_json('添加用户失败');
}
$this->return_response();
}
}
/**
* Notes:修改用户
* Created on: 2022/9/21 14:48
* Created by: dengbw
*/
public function index_put()
{
$userId = intval($this->input_param('userId'));
$organizationId = intval($this->input_param('organizationId'));
$uname = $this->input_param('uname');
if (!$userId) {
$this->return_json('参数错误');
}
if (!$organizationId) {
$this->return_json('请选择所属机构');
}
if (!$uname) {
$this->return_json('请输入姓名');
}
$re = $this->mdSyliveUser->get(['userId' => $userId]);
if (!$re) {
$this->return_json('无此用户');
}
$topOrgId = $re['topOrgId'];
if ($re['organizationId'] != $organizationId) {
$topOrgId = $this->getTopOrgId($organizationId);
if ($re['topOrgId'] && $re['topOrgId'] != $topOrgId) {
$this->return_json('不可修改顶级机构');
}
}
$bizId = 0;
$re_org = $this->mdSyliveOrganization->get(['organizationId' => $organizationId]);
if ($re_org) {
if ($re_org['organizationType'] == 4 && $re_org['parentId']) {
$bizId = $re_org['parentId'];
} else if ($re_org['organizationType'] == 3) {
$bizId = $re_org['organizationId'];
}
}
$upDate = ['topOrgId' => $topOrgId, 'organizationId' => $organizationId, 'bizId' => $bizId, 'teamId' => 0, 'uname' => $uname];
$this->mdSyliveUser->update($upDate, ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:修改马甲
* Created on: 2022/9/21 14:48
* Created by: dengbw
*/
public function majia_put()
{
$userId = intval($this->input_param('userId'));
$maJiaId = intval($this->input_param('maJiaId'));
if (!$userId) {
$this->return_json('参数错误');
}
$this->mdSyliveUser->update(['maJiaId' => $maJiaId], ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:修改状态
* Created on: 2022/9/21 16:10
* Created by: dengbw
*/
public function status_put()
{
$userId = $this->input_param('userId');
$status = $this->input_param('status');
if (!$userId) {
$this->return_json('参数错误');
}
$this->mdSyliveUser->update(['status' => $status], ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:删除用户
* Created on: 2022/9/21 16:10
* Created by: dengbw
* @param null $userId
*/
public function index_delete($userId = null)
{
if (!$userId) {
$this->return_json('参数错误');
}
$this->mdSyliveUser->update(['status' => -1], ['userId' => $userId]);
$this->return_response();
}
/**
* Notes:批量删除用户
* Created on: 2022/9/19 15:35
* Created by: dengbw
*/
public function batch_delete()
{
$ids = $this->input_param('ids');
if (!$ids) {
$this->return_json('参数错误');
}
$str_ids = implode(',', $ids);
if ($str_ids) {
$this->mdSyliveUser->update(['status' => -1], ["userId in($str_ids)" => null]);
}
$this->return_response();
}
/**
* Notes:栓验字段
* Created on: 2022/9/21 15:52
* Created by: dengbw
*/
public function existence_get()
{
$field = $this->input_param('field');
$value = $this->input_param('value');
$organizationId = intval($this->input_param('organizationId'));
if ($organizationId) {
$topOrgId = $this->getTopOrgId($organizationId);
$where = [$field => $value, 'topOrgId' => $topOrgId, 'status>=' => 0];
$re = $this->mdSyliveUser->get($where);
if ($re) {
if ($field == 'mobile') {
if ($re['teamId'] || $re['organizationId']) {
$this->return_json('已存在', 0);
}
} else {
$this->return_json('已存在', 0);
}
}
}
$this->return_json('不存在', 1);
}
/**
* Notes:获取顶级机构id
* Created on: 2022/12/8 14:39
* Created by: dengbw
* @param $organizationId
* @param $topOrgId
* @return mixed
*/
private function getTopOrgId($organizationId, $topOrgId = 0)
{
$re = $this->mdSyliveOrganization->get(['organizationId' => $organizationId], 'organizationId,parentId');
if (!$re) {
return $topOrgId;
} else {
$topOrgId = $re['organizationId'];
if ($re['parentId']) {
return $this->getTopOrgId($re['parentId'], $topOrgId);
} else {
return $topOrgId;
}
}
}
}
@@ -1,186 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:私域直播_订单管理
* Created on: 2022/9/19 17:15
* Created by: dengbw
*/
class Order extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sylive_order_model', 'mdSyliveOrder');
$this->load->model('agent/admin/Market_sylive_user_model', 'mdSyliveUser');
$this->load->model('agent/admin/Market_sylive_organization_model', 'mdSyliveOrganization');
$this->load->model('agent/admin/Market_sylive_team_model', 'mdSyliveTeam');
$this->load->model('agent/admin/Market_sylive_activity_kpidata_model', 'mdSyliveActivityKpidata');
}
/**
* Notes:订单管理列表
* Created on: 2022/11/08 14:48
* Created by: dengbw
*/
public function index_get()
{
$date = $this->orderList($this->inputs);
$this->return_response_list($date);
}
/**
* Notes:导出订单数据
* Created on: 2022/11/08 15:26
* Created by: dengbw
*/
public function export_get()
{
$this->inputs['page'] = 1;
$this->inputs['limit'] = 10000;
$date = $this->orderList($this->inputs);
$this->return_response_list($date);
}
private function orderList($params)
{
$activityId = intval($params['activityId']);
$page = $params['page'];
$limit = $params['limit'];
$uname = $params['uname'];
$mobile = $params['mobile'];
$status = $params['status'];
$cfrom = $params['cfrom'];
$type = $params['type'];
$sort = $params['sort'];
$order = $params['order'];
$bizId = $params['bizId'];
$teamId = $params['teamId'];
$itemId = $params['itemId'];
!$page && $page = 1;
!$limit && $limit = 10;
$sort_order = 'id desc';
if ($sort && $order) {
if ($sort == 'statusName') {
$sort_order = 'status ' . $order;
} else if ($sort == 'typeName') {
$sort_order = 'type ' . $order;
} else if ($sort == 'cfromName') {
$sort_order = 'cfrom ' . $order;
} else {
$sort_order = $sort . ' ' . $order;
}
}
$list = [];
if (!strlen($status)) {
$status = 1;
}
$where['status'] = $status;
$activityId && $where['activityId'] = $activityId;
$itemId && $where['itemId'] = $itemId;
$uname && $where['uname LIKE "%' . trim($uname) . '%"'] = null;
$mobile && $where['mobile LIKE "%' . trim($mobile) . '%"'] = null;
strlen($cfrom) && $where['cfrom'] = $cfrom;
strlen($type) && $where['type'] = $type;
$cfrom == 1 && $bizId = 0;
if ($bizId) {
$res_org = $this->mdSyliveOrganization->get(["organizationId" => $bizId]);
if ($res_org) {
if ($res_org['organizationType'] == 3) {//门店
$where['bizId'] = $bizId;
} else if ($res_org['organizationType'] == 2) {//大区
$where['areaId'] = $bizId;
}
}
} elseif ($teamId) {
$res_team = $this->mdSyliveTeam->get(["teamId" => $bizId]);
if ($res_team) {
if ($res_team['teamType'] == 2) {//团队
$where['bizId'] = $bizId;
} else if ($res_team['teamType'] == 1) {//总部
$where['areaId'] = $bizId;
}
}
}
if ($limit == 10000) {
$count = $limit;
} else {
$count = $this->mdSyliveOrder->count($where);
}
if ($count) {
$res = $this->mdSyliveOrder->select($where, $sort_order, $page, $limit);
foreach ($res as $v) {
$consultant = $this->consultantGet(['activityId' => $v['activityId'], 'userId' => $v['userId']
, 'areaId' => $v['areaId'], 'bizId' => $v['bizId'], 'cfrom' => $v['cfrom'], 'cfUserId' => $v['cfUserId']]);
$item = [
'id' => $v['id'], 'sid' => $v['sid'], 'uname' => $v['uname'], 'mobile' => $v['mobile'], 'itemTitle' => $v['itemTitle']
, 'totalPrice' => $v['totalPrice'], 'payTime' => $v['payTime'] != '0000-00-00 00:00:00' ? $v['payTime'] : ''
, 'typeName' => $this->mdSyliveOrder->typeAry($v['type'])
, 'statusName' => $this->mdSyliveOrder->statusAry($v['status']), 'cfromName' => $this->mdSyliveOrder->cfromAry($v['cfrom'])
, 'createTime' => $v['createTime'], 'area' => $consultant['area'], 'stores' => $consultant['stores'], 'consultant' => $consultant['consultant']
];
if ($limit == 10000) {
$address = $biz = '';
$jsondata = $v['jsondata'] ? json_decode($v['jsondata'], true) : [];
if ($jsondata['address']) {
$address = $jsondata['address']['region'] . $jsondata['address']['detail'];
}
if ($jsondata['biz']) {
$biz = $jsondata['biz'];
}
$item['address'] = $address;
$item['biz'] = $biz;
}
$list[] = $item;
}
}
if ($limit == 10000) {
return $list;
} else {
return ['list' => $list, 'count' => $count];
}
}
/**
* Notes:获取顾问信息
* Created on: 2022/10/8 11:29
* Created by: dengbw
* @param $params
* @return string
*/
private function consultantGet($params)
{
$area = $stores = $consultant = '';
$areaId = intval($params['areaId']);
$bizId = intval($params['bizId']);
$cfUserId = intval($params['cfUserId']);
if (!$bizId && $params['userId']) {
$re = $this->mdSyliveActivityKpidata->get(['activityId' => $params['activityId'], 'userId' => $params['userId']
, 'type' => $params['cfrom'], 'kpi' => 'order']);
if ($re) {
$areaId = $re['areaId'];
$bizId = $re['bizId'];
$cfUserId = $re['cfUserId'];
}
}
if ($params['cfrom'] == 1) {
$res_teama = $this->mdSyliveTeam->get(["teamId" => $areaId]);
$res_teamb = $this->mdSyliveTeam->get(["teamId" => $bizId]);
$res_teama['teamName'] && $area = $res_teama['teamName'];
$res_teamb['teamName'] && $stores = $res_teamb['teamName'];
} else {
$res_orga = $this->mdSyliveOrganization->get(["organizationId" => $areaId]);
$res_orgb = $this->mdSyliveOrganization->get(["organizationId" => $bizId]);
$res_orga['organizationName'] && $area = $res_orga['organizationName'];
$res_orgb['organizationName'] && $stores = $res_orgb['organizationName'];
}
if ($cfUserId) {
$re_user = $this->mdSyliveUser->get(['userId' => $cfUserId]);
$re_user['uname'] && $consultant = $re_user['uname'];
}
return ['area' => $area, 'stores' => $stores, 'consultant' => $consultant];
}
}
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More