增加好车补后台和接口
This commit is contained in:
@@ -58,7 +58,7 @@ $autoload['packages'] = array();
|
||||
|
|
||||
| $autoload['libraries'] = array('user_agent' => 'ua');
|
||||
*/
|
||||
$autoload['libraries'] = array('database');
|
||||
$autoload['libraries'] = array('database','myResponse');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
|
||||
@@ -415,9 +415,12 @@ 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 = intval($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'));
|
||||
@@ -430,6 +433,7 @@ 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;
|
||||
@@ -437,8 +441,9 @@ 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;
|
||||
$type && $where['type'] = $type;
|
||||
|
||||
if ($province_id && $city_id) {
|
||||
if (($province_id && $city_id) || $unset_city_limit) {
|
||||
$count = $this->mdBiz->count($where);
|
||||
if ($count) {
|
||||
$resBiz = $this->mdBiz->select($where, 'id desc', $page, $size);
|
||||
@@ -1103,7 +1108,7 @@ class Common extends CI_Controller
|
||||
$lists = $this->auto_brand_model->select($where, 'initial asc', $page, $size);
|
||||
foreach ($lists as $key => $val) {
|
||||
$itemsList[] = [
|
||||
'id' => $val['id'],
|
||||
'id' => intval($val['id']),
|
||||
'name' => $val['name'],
|
||||
'is_checked' => $itemsChecked[$val['id']] ? 1 : 0
|
||||
];
|
||||
|
||||
@@ -5,7 +5,7 @@ defined('BASEPATH') or exit('No direct script access allowed');
|
||||
class Member extends HD_Controller
|
||||
{
|
||||
|
||||
private $groups = [1 => '车管家', 2 => '店长', 3 => '投资人', 4 => '客户成功经理'];
|
||||
private $groups;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -13,6 +13,7 @@ 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();
|
||||
}
|
||||
|
||||
//首页信息
|
||||
|
||||
@@ -19,6 +19,9 @@ 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');
|
||||
}
|
||||
|
||||
public function index()
|
||||
@@ -69,11 +72,23 @@ class Store extends HD_Controller
|
||||
$biz_lists = $this->biz_model->select($where, 'id desc', $page, $pagesize);
|
||||
$count = $this->biz_model->count($where);
|
||||
$bizlists = [];
|
||||
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;
|
||||
$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']];
|
||||
$bizlists[] = $v;
|
||||
}
|
||||
}
|
||||
$this->data['brandAry'] = $brandAry;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['lists'] = $bizlists;
|
||||
$this->data['typeAry'] = $typeAry;
|
||||
@@ -101,6 +116,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']) : '';
|
||||
|
||||
$this->data['biz'] = $biz;
|
||||
} else {
|
||||
@@ -118,7 +134,7 @@ class Store extends HD_Controller
|
||||
'type' => 0,
|
||||
'company_id' => 0,
|
||||
'auto_brands' => array(),
|
||||
'car_brand_id' => 0
|
||||
'car_brand_id' => ''
|
||||
);//默认福建城市
|
||||
$this->data['biz'] = $biz;
|
||||
}
|
||||
@@ -150,6 +166,7 @@ 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');
|
||||
@@ -191,6 +208,7 @@ 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));
|
||||
@@ -270,7 +288,7 @@ class Store extends HD_Controller
|
||||
$county_id && $where['county_id'] = $county_id;
|
||||
$title && $where["biz_name like '%{$title}%'"] = null;
|
||||
|
||||
if($province_id||$city_id||$county_id||$title){
|
||||
if ($province_id || $city_id || $county_id || $title) {
|
||||
$total = $this->biz_model->count($where);
|
||||
}
|
||||
|
||||
@@ -291,4 +309,29 @@ 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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ 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->log_dir = 'receiver_clues';
|
||||
}
|
||||
@@ -44,7 +45,7 @@ class Clues extends HD_Controller
|
||||
$where = array("status" => $key);
|
||||
if ($this->admin_biz_str) {
|
||||
$where["belong_id in ($this->admin_biz_str)"] = null;
|
||||
}else{
|
||||
} else {
|
||||
$this->belong && $where["belong_id"] = $this->belong;
|
||||
}
|
||||
$count1 = $this->clues_model->count($where);
|
||||
@@ -96,7 +97,7 @@ class Clues extends HD_Controller
|
||||
}
|
||||
if ($this->admin_biz_str) {
|
||||
$where["belong_id in ($this->admin_biz_str)"] = null;
|
||||
}else{
|
||||
} else {
|
||||
$params['belong_id'] && $where["belong_id"] = $params['belong_id'];
|
||||
}
|
||||
//创建时间
|
||||
@@ -162,7 +163,8 @@ class Clues extends HD_Controller
|
||||
$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';
|
||||
$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';
|
||||
$rows = $this->clues_model->select($where, 'en_time desc,id desc', $page, $size, $fileds);
|
||||
$map_admin = $map_cf_pid = $cf_title_arr = [];
|
||||
|
||||
@@ -259,6 +261,7 @@ 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'] : '';
|
||||
$lists[] = $val;
|
||||
}
|
||||
}
|
||||
@@ -266,7 +269,6 @@ 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];
|
||||
}
|
||||
|
||||
@@ -298,6 +300,7 @@ 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) {
|
||||
@@ -321,6 +324,7 @@ class Clues extends HD_Controller
|
||||
}
|
||||
$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'];
|
||||
@@ -338,12 +342,20 @@ class Clues extends HD_Controller
|
||||
|
||||
$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);
|
||||
}
|
||||
@@ -423,7 +435,7 @@ class Clues extends HD_Controller
|
||||
$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);
|
||||
}
|
||||
|
||||
//添加单条数据
|
||||
@@ -555,6 +567,19 @@ 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,
|
||||
@@ -716,7 +741,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;
|
||||
@@ -1233,4 +1258,124 @@ 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']));
|
||||
$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' => 'H',
|
||||
'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']
|
||||
);
|
||||
|
||||
$customers_id = $this->customers_model->add($add);
|
||||
if (!$customers_id) {
|
||||
continue;
|
||||
}
|
||||
//同步线索日志到客户日志
|
||||
$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['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个客户线索。请及时到小程序"理车宝-待分配客户”分配给销售顾问跟进。祝您生活愉快!');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
$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 delete_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 enroll_list()
|
||||
{
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<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>
|
||||
@@ -266,6 +266,18 @@
|
||||
</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 wp20">
|
||||
<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="submit">提交</button>
|
||||
@@ -366,10 +378,33 @@
|
||||
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');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {},
|
||||
created: function () {
|
||||
},
|
||||
watch: {}
|
||||
|
||||
@@ -48,6 +48,18 @@
|
||||
</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>
|
||||
@@ -64,14 +76,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
|
||||
<div class="am-form-group">
|
||||
<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">
|
||||
@@ -82,6 +100,8 @@
|
||||
<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>
|
||||
@@ -95,9 +115,13 @@
|
||||
</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'] ?>"
|
||||
@@ -187,9 +211,41 @@
|
||||
</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?>,
|
||||
@@ -372,36 +428,6 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
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) ?>
|
||||
});
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
<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">
|
||||
@@ -69,13 +72,15 @@
|
||||
<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>
|
||||
@@ -169,6 +174,11 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">意向购车周期:</div>
|
||||
{{ infoShow.buy_time_cn }}
|
||||
</div>
|
||||
<!--
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">平安推荐:</div>
|
||||
<el-select v-model="info.cf_pid" filterable placeholder="请选择" clearable>
|
||||
@@ -180,17 +190,20 @@
|
||||
</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 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>
|
||||
@@ -198,6 +211,39 @@
|
||||
</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">
|
||||
@@ -210,44 +256,79 @@
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="am-para-inline ml30">派单门店:</div>
|
||||
<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 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>
|
||||
</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>
|
||||
@@ -302,18 +383,138 @@
|
||||
</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">内容:</label>
|
||||
<div class="am-para-input" style="width: 80%">
|
||||
<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">
|
||||
<label class="am-para-label label-width w150">内容:</label>
|
||||
<div class="am-para-input wp80" style="margin-left: 150px">
|
||||
<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({
|
||||
@@ -321,7 +522,7 @@
|
||||
data: {
|
||||
info: {},
|
||||
infoShow: {},
|
||||
goods: {"imgs_url": [], "imgs": [], "log": ''},
|
||||
goods: {log: '', id: <?=$info['id']?>, type: 0, buy_time: ''},
|
||||
provinceAry: [],
|
||||
cityAry: [],
|
||||
countyAry: [],
|
||||
@@ -329,8 +530,24 @@
|
||||
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;
|
||||
@@ -338,6 +555,8 @@
|
||||
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();
|
||||
@@ -345,6 +564,7 @@
|
||||
},
|
||||
computed: {},
|
||||
created: function () {
|
||||
this.loadModelList();
|
||||
},
|
||||
updated: function () {
|
||||
},
|
||||
@@ -451,9 +671,7 @@
|
||||
url: '/receiver/clues/add_log',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
act_type: 1, id: <?= $info['id'] ?>, type: 0, log: vm.goods.log, imgs: vm.goods.imgs
|
||||
},
|
||||
data: vm.goods,
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
@@ -480,9 +698,10 @@
|
||||
},
|
||||
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',
|
||||
@@ -518,6 +737,194 @@
|
||||
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: 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/delete_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/enroll_list', {
|
||||
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: {
|
||||
|
||||
@@ -77,20 +77,20 @@
|
||||
</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>
|
||||
</select>
|
||||
<?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>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php }else{ ?>
|
||||
<input name="belong_id" value="<?= $params['belong_id'] ?>" type="hidden">
|
||||
<?php } else { ?>
|
||||
<input name="belong_id" value="<?= $params['belong_id'] ?>" type="hidden">
|
||||
<?php } ?>
|
||||
<div class="fl" style="width:1920px">
|
||||
<label class="am-para-label w100">线索来源:</label>
|
||||
@@ -283,16 +283,14 @@
|
||||
<th width="12%"><span>所在地区</span></th>
|
||||
<th width="12%"><span>所派门店</span></th>
|
||||
<th width="8%"><span>状态</span></th>
|
||||
<th width="12%"><span>分配时间</span></th>
|
||||
<th width="12%"><span>创建时间</span></th>
|
||||
<th width="12%"><span>更新时间</span></th>
|
||||
<th width="15%"><span>时间</span></th>
|
||||
<th width="10%"><span>跟进人员</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<? if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<tr >
|
||||
<td style="vertical-align: middle;"><input type="checkbox" name="ids[]" class="order-ids"
|
||||
value="<?= $v['id'] ?>"/></td>
|
||||
<td style="vertical-align: middle;"><a
|
||||
@@ -302,9 +300,12 @@
|
||||
<td style="vertical-align: middle;"><?= $v['poi'] ?></td>
|
||||
<td style="vertical-align: middle;"><?= $v['biz_poi'] ?><br><?= $v['biz_name'] ?></td>
|
||||
<td style="vertical-align: middle;"><?= $v['status_name'] ?></td>
|
||||
<td style="vertical-align: middle;"><?= $v['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="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['admin_name'] ?></td>
|
||||
</tr>
|
||||
<? }
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<IfModule authz_core_module>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !authz_core_module>
|
||||
Deny from all
|
||||
</IfModule>
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
$config = array();
|
||||
@@ -0,0 +1,135 @@
|
||||
<?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();
|
||||
@@ -0,0 +1,523 @@
|
||||
<?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'] = '';
|
||||
@@ -0,0 +1,112 @@
|
||||
<?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', '好店云'); // 短信签名
|
||||
@@ -0,0 +1,117 @@
|
||||
<?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
|
||||
);
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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">'
|
||||
);
|
||||
@@ -0,0 +1,103 @@
|
||||
<?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'
|
||||
);
|
||||
@@ -0,0 +1,20 @@
|
||||
<?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' => []
|
||||
);
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?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';
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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',
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,84 @@
|
||||
<?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/';
|
||||
@@ -0,0 +1,184 @@
|
||||
<?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'
|
||||
);
|
||||
@@ -0,0 +1,11 @@
|
||||
<?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;
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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
|
||||
|
|
||||
*/
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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';
|
||||
@@ -0,0 +1,11 @@
|
||||
<?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;
|
||||
@@ -0,0 +1,605 @@
|
||||
<?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'] = [];
|
||||
@@ -0,0 +1,54 @@
|
||||
<?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;
|
||||
@@ -0,0 +1,64 @@
|
||||
<?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')
|
||||
|
||||
);
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
$config['host'] = '192.168.0.16';
|
||||
$config['port'] = 9512;
|
||||
$config['SPHINX_MAX_MATCHES'] = '2000';
|
||||
@@ -0,0 +1,214 @@
|
||||
<?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'
|
||||
);
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
//服务号-车卖场
|
||||
$config['default']['appid'] = 'wx42cfb5a705233394';
|
||||
$config['default']['appSecret'] = 'a34f842ce9ad0f3ec732590e36e15c10';
|
||||
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Common extends CI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('area_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* 省市区数据
|
||||
* @return void
|
||||
*/
|
||||
public function regionsData()
|
||||
{
|
||||
$req = $this->area_model->getDataByTree();
|
||||
echo json_encode($req, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取品牌
|
||||
* @return void
|
||||
*/
|
||||
public function autoBrand()
|
||||
{
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->mdAutoBrand->set_db('ssdb');
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
];
|
||||
$lists = $this->mdAutoBrand->select($where, 'initial asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车系
|
||||
* @return void
|
||||
*/
|
||||
public function autoSeries()
|
||||
{
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$this->mdAutoSeries->set_db('ssdb');
|
||||
$brandId = intval($this->input->get('brandId'));
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
'brand_id' => $brandId
|
||||
];
|
||||
$lists = $this->mdAutoSeries->select($where, 'id asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车型
|
||||
* @return void
|
||||
*/
|
||||
public function autoCar()
|
||||
{
|
||||
$this->load->model('auto/auto_cars_model', 'mdAutoCar');
|
||||
$this->mdAutoCar->set_db('ssdb');
|
||||
$seriesId = intval($this->input->get('seriesId'));
|
||||
$where = [
|
||||
'status>' => -1,
|
||||
'series_id' => $seriesId
|
||||
];
|
||||
$lists = $this->mdAutoCar->select($where, 'id asc', 0, 0, 'id,name');
|
||||
echo json_encode($lists, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有门店
|
||||
* @return void
|
||||
*/
|
||||
public function allBiz()
|
||||
{
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('agent/auto_product_model');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$productId = intval($this->input->get('productId'));
|
||||
$where = [
|
||||
'status' => 1,
|
||||
'type' => Biz_model::BIZ_TYPE_4s
|
||||
];
|
||||
if ($productId) {
|
||||
$product = $this->auto_product_model->get(['id' => $productId]);
|
||||
$where['car_brand_id'] = $product['brandId'] ?: 0;
|
||||
}
|
||||
$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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?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';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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'] = Authorization::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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
<?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();
|
||||
$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');
|
||||
if (!$this->autoProduct->get(['id' => $id])) {
|
||||
$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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?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();
|
||||
$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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,325 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,318 @@
|
||||
<?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
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/pingan/pingan_users_model', 'pinganUsers');
|
||||
$this->load->model('agent/organization/Organization_model', 'mdOrganization');
|
||||
$this->load->model('area_model');
|
||||
}
|
||||
|
||||
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');
|
||||
$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;
|
||||
$orgId && $where['orgId'] = $orgId;
|
||||
$teamId && $where['orgTeamId'] = $teamId;
|
||||
$centerNumber && $where['centerNumber'] = $centerNumber;
|
||||
strlen($groupType) && $where['groupType'] = $groupType;
|
||||
$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');
|
||||
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']]);
|
||||
|
||||
$list[] = [
|
||||
'id' => $v['id'], 'mobile' => $v['mobile'],
|
||||
'username' => $v['username'], 'userCode' => $v['userCode'],
|
||||
'status' => $status, 'updateTime' => $v['updateTime'],
|
||||
'orgName' => $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']]
|
||||
];
|
||||
}
|
||||
}
|
||||
$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 index_put()
|
||||
{
|
||||
$id = $this->input_param('id');
|
||||
$username = $this->input_param('username');
|
||||
$mobile = $this->input_param('mobile');
|
||||
$groupType = intval($this->input_param('groupType'));
|
||||
$row = $this->pinganUsers->get(['id' => $id]);
|
||||
if (!$row) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
if ($mobile != $row['mobile']) {
|
||||
$mobileRow = $this->pinganUsers->get(['mobile' => $mobile, 'status>=' => 0]);
|
||||
if ($mobileRow) {
|
||||
$this->return_json('手机号已存在');
|
||||
}
|
||||
}
|
||||
$upDate = ['username' => $username, 'mobile' => $mobile, 'groupType' => $groupType];
|
||||
$this->pinganUsers->update($upDate, ['id' => $id]);
|
||||
$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();
|
||||
}
|
||||
|
||||
public function import_post()
|
||||
{
|
||||
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;
|
||||
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();
|
||||
$orgTeamId = $objWorksheet->getCell('K' . $i)->getValue();
|
||||
$groupType = $objWorksheet->getCell('L' . $i)->getValue();
|
||||
$user = $this->pinganUsers->get(['userCode' => $userCode]);
|
||||
if ($user) {
|
||||
continue;
|
||||
}
|
||||
$org = $this->mdOrganization->get(['id' => $orgTeamId]);
|
||||
$cityRow = $this->area_model->get(['city_id' => $cityId]);
|
||||
$teamUserId = $depUserId = $areaUserId = '';
|
||||
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
|
||||
];
|
||||
$org && $areaAddData['orgId'] = $org['parentId'];
|
||||
$cityRow && $areaAddData['cityId'] = $cityRow['city_id'];
|
||||
$cityRow && $areaAddData['provinceId'] = $cityRow['province_id'];
|
||||
$areaUserId = $this->pinganUsers->add($areaAddData);
|
||||
}
|
||||
}
|
||||
if ($depCode) { //获取部门用户uid
|
||||
$depRow = $this->pinganUsers->get(['userCode' => $depCode]);
|
||||
if ($depRow) {
|
||||
$depUserId = $areaRow['id'];
|
||||
} else {
|
||||
$depAddData = [
|
||||
'username' => $depName,
|
||||
'userCode' => $depCode,
|
||||
'groupType' => Pingan_users_model::GROUP_TYPE_DEP,
|
||||
'orgTeamId' => $orgTeamId
|
||||
];
|
||||
$org && $depAddData['orgId'] = $org['parentId'];
|
||||
$cityRow && $depAddData['cityId'] = $cityRow['city_id'];
|
||||
$cityRow && $depAddData['provinceId'] = $cityRow['province_id'];
|
||||
$areaUserId && $depAddData['areaId'] = $areaUserId;
|
||||
$depUserId = $this->pinganUsers->add($depAddData);
|
||||
}
|
||||
}
|
||||
if ($teamCode) { //获取团队用户id
|
||||
$teamRow = $this->pinganUsers->get(['userCode' => $teamCode]);
|
||||
if ($teamRow) {
|
||||
$teamUserId = $areaRow['id'];
|
||||
} else {
|
||||
$teamAddData = [
|
||||
'username' => $teamName,
|
||||
'userCode' => $teamCode,
|
||||
'groupType' => Pingan_users_model::GROUP_TYPE_TEAM,
|
||||
'orgTeamId' => $orgTeamId
|
||||
];
|
||||
$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;
|
||||
$teamUserId = $this->pinganUsers->add($teamAddData);
|
||||
}
|
||||
}
|
||||
$userData = [
|
||||
'username' => $name,
|
||||
'userCode' => $userCode,
|
||||
'groupType' => $groupType,
|
||||
'orgTeamId' => $orgTeamId
|
||||
];
|
||||
$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;
|
||||
$number && $userData['centerNumber'] = $number;
|
||||
$result = $this->pinganUsers->add($userData);
|
||||
if ($result) {
|
||||
$successNum += 1;
|
||||
}
|
||||
}
|
||||
$failNum = $rowCnt - 1 - $successNum;
|
||||
$this->return_response([], "成功导入{$successNum}条数据,失败{$failNum}");
|
||||
} catch (Exception $e) {
|
||||
$this->return_json($e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
<?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', 'mdReceiverXz');
|
||||
$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->mdReceiverXz->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']);
|
||||
$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;
|
||||
$list[] = $setValue;
|
||||
}
|
||||
}
|
||||
$data = ['list' => $list, 'count' => $count];
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
<?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_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->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) {
|
||||
$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);
|
||||
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 = [];
|
||||
$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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
<?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_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/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_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']]);
|
||||
$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'];
|
||||
}
|
||||
$list[] = [
|
||||
'id' => $row['id'],
|
||||
'sid' => $order['sid'],
|
||||
'cityName' => $area['city_name'],
|
||||
'bizName' => $biz['biz_name'],
|
||||
'brandName' => $brand_detail,
|
||||
'statusCn' => Receiver_order_subsidy_model::IF_CHECK_STATUS[$row['ifcheck']],
|
||||
'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']
|
||||
];
|
||||
}
|
||||
}
|
||||
$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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,825 @@
|
||||
<?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']];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
<?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']];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,332 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
<?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']];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,451 @@
|
||||
<?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']];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,431 @@
|
||||
<?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
@@ -0,0 +1,278 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
<?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];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,346 @@
|
||||
<?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];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,320 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
<?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
@@ -0,0 +1,125 @@
|
||||
<?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 Dictionary extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/admin/Market_sys_dictionary_model', 'mdSysDictionary');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取字典
|
||||
* Created on: 2022/9/19 11:11
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_get()
|
||||
{
|
||||
$dictCode = $this->input_param('dictCode');
|
||||
$where['status>='] = 0;
|
||||
$dictCode && $where['dictCode like "%' . $dictCode . '%"'] = null;
|
||||
$sort_order = 'sortNumber asc,dictId desc';
|
||||
$res = $this->mdSysDictionary->select($where, $sort_order);
|
||||
foreach ($res as $k => $v) {
|
||||
$res[$k]['dictId'] = intval($v['dictId']);
|
||||
}
|
||||
$this->return_response_list($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:添加字典
|
||||
* Created on: 2022/9/19 11:01
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_post()
|
||||
{
|
||||
$dictName = $this->input_param('dictName');
|
||||
$dictCode = $this->input_param('dictCode');
|
||||
$sortNumber = intval($this->input_param('sortNumber'));
|
||||
$comments = $this->input_param('comments');
|
||||
if (!$dictName) {
|
||||
$this->return_json('请输入字典名称');
|
||||
}
|
||||
if (!$dictCode) {
|
||||
$this->return_json('请输入字典值');
|
||||
}
|
||||
!$comments && $comments = '';
|
||||
$addDate = ['dictName' => $dictName, 'dictCode' => $dictCode, 'sortNumber' => $sortNumber, 'comments' => $comments
|
||||
, 'createTime' => date('Y-m-d H:i:s')];
|
||||
$id = $this->mdSysDictionary->add($addDate);
|
||||
if (!$id) {
|
||||
$this->return_json('添加字典失败');
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:修改字典
|
||||
* Created on: 2022/9/19 11:05
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_put()
|
||||
{
|
||||
$dictId = intval($this->input_param('dictId'));
|
||||
$dictName = $this->input_param('dictName');
|
||||
$dictCode = $this->input_param('dictCode');
|
||||
$sortNumber = intval($this->input_param('sortNumber'));
|
||||
$comments = $this->input_param('comments');
|
||||
if (!$dictId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
if (!$dictName) {
|
||||
$this->return_json('请输入字典名称');
|
||||
}
|
||||
if (!$dictCode) {
|
||||
$this->return_json('请输入字典值');
|
||||
}
|
||||
!$comments && $comments = '';
|
||||
$upDate = ['dictName' => $dictName, 'dictCode' => $dictCode, 'sortNumber' => $sortNumber, 'comments' => $comments];
|
||||
$this->mdSysDictionary->update($upDate, ['dictId' => $dictId]);
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:删除字典
|
||||
* Created on: 2022/9/19 11:08
|
||||
* Created by: dengbw
|
||||
* @param null $dictId
|
||||
*/
|
||||
public function index_delete($dictId = null)
|
||||
{
|
||||
$dictId = intval($dictId);
|
||||
if (!$dictId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$this->mdSysDictionary->update(['status' => -1], ['dictId' => $dictId]);
|
||||
$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->mdSysDictionary->update(['status' => -1], ["dictId in($str_ids)" => null]);
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
<?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 DictionaryData extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/admin/Market_sys_dictionary_data_model', 'mdSysDictionaryData');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:字典项列表
|
||||
* Created on: 2022/9/16 11:11
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function page_get()
|
||||
{
|
||||
$dictId = $this->input_param('dictId');
|
||||
$page = $this->input_param('page');
|
||||
$limit = $this->input_param('limit');
|
||||
$sort = $this->input_param('sort');
|
||||
$order = $this->input_param('order');
|
||||
$keywords = $this->input_param('keywords');
|
||||
!$page && $page = 1;
|
||||
!$limit && $limit = 10;
|
||||
if (!$dictId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$res = [];
|
||||
$sort_order = 'sortNumber asc,dictDataId desc';
|
||||
$where = ['status>=' => 0, 'dictId' => $dictId];
|
||||
if ($keywords) {
|
||||
$where["dictDataName = '{$keywords}' OR dictDataCode = '{$keywords}'"] = null;
|
||||
}
|
||||
if ($sort && $order) {
|
||||
$sort_order = $sort . ' ' . $order;
|
||||
}
|
||||
$count = $this->mdSysDictionaryData->count($where);
|
||||
if ($count) {
|
||||
$res = $this->mdSysDictionaryData->select($where, $sort_order, $page, $limit);
|
||||
foreach ($res as $k => $v) {
|
||||
$res[$k]['dictDataId'] = intval($v['dictDataId']);
|
||||
$res[$k]['dictId'] = intval($v['dictId']);
|
||||
$res[$k]['sortNumber'] = intval($v['sortNumber']);
|
||||
}
|
||||
}
|
||||
$date = ['list' => $res, 'count' => $count];
|
||||
$this->return_response_list($date);
|
||||
}
|
||||
|
||||
public function index_get()
|
||||
{
|
||||
$dictCode = $this->input_param('dictCode');
|
||||
if (!$dictCode) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$this->load->model('agent/admin/Market_sys_dictionary_model', 'mdSysDictionary');
|
||||
$re = $this->mdSysDictionary->get(['status>=' => 0, 'dictCode' => $dictCode]);
|
||||
$res = [];
|
||||
if ($re) {
|
||||
$dictId = $re['dictId'];
|
||||
$sort_order = 'sortNumber asc,dictDataId desc';
|
||||
$where = ['status>=' => 0, 'dictId' => $dictId];
|
||||
$res = $this->mdSysDictionaryData->select($where, $sort_order, 0, 0);
|
||||
foreach ($res as $k => $v) {
|
||||
$res[$k]['dictDataId'] = intval($v['dictDataId']);
|
||||
$res[$k]['dictId'] = intval($v['dictId']);
|
||||
$res[$k]['dictCode'] = $re['dictCode'];
|
||||
$res[$k]['dictName'] = $re['dictName'];
|
||||
}
|
||||
}
|
||||
$this->return_response_list($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:添加字典项
|
||||
* Created on: 2022/9/19 11:01
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_post()
|
||||
{
|
||||
$dictId = intval($this->input_param('dictId'));
|
||||
$dictDataName = $this->input_param('dictDataName');
|
||||
$dictDataCode = $this->input_param('dictDataCode');
|
||||
$sortNumber = intval($this->input_param('sortNumber'));
|
||||
$comments = $this->input_param('comments');
|
||||
if (!$dictDataName) {
|
||||
$this->return_json('请输入字典项名称');
|
||||
}
|
||||
if (!$dictDataCode) {
|
||||
$this->return_json('请输入字典项值');
|
||||
}
|
||||
!$comments && $comments = '';
|
||||
$addDate = ['dictId' => $dictId, 'dictDataName' => $dictDataName, 'dictDataCode' => $dictDataCode,
|
||||
'sortNumber' => $sortNumber, 'comments' => $comments, 'createTime' => date('Y-m-d H:i:s')];
|
||||
$id = $this->mdSysDictionaryData->add($addDate);
|
||||
if (!$id) {
|
||||
$this->return_json('添加字典项失败');
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:修改字典项
|
||||
* Created on: 2022/9/19 11:05
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_put()
|
||||
{
|
||||
$dictDataId = intval($this->input_param('dictDataId'));
|
||||
$dictDataName = $this->input_param('dictDataName');
|
||||
$dictDataCode = $this->input_param('dictDataCode');
|
||||
$sortNumber = intval($this->input_param('sortNumber'));
|
||||
$comments = $this->input_param('comments');
|
||||
if (!$dictDataName) {
|
||||
$this->return_json('请输入字典项名称');
|
||||
}
|
||||
if (!$dictDataCode) {
|
||||
$this->return_json('请输入字典项值');
|
||||
}
|
||||
!$comments && $comments = '';
|
||||
$upDate = ['dictDataName' => $dictDataName, 'dictDataCode' => $dictDataCode, 'sortNumber' => $sortNumber, 'comments' => $comments];
|
||||
$this->mdSysDictionaryData->update($upDate, ['dictDataId' => $dictDataId]);
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:删除字典项
|
||||
* Created on: 2022/9/19 11:08
|
||||
* Created by: dengbw
|
||||
* @param null $dictDataId
|
||||
*/
|
||||
public function index_delete($dictDataId = null)
|
||||
{
|
||||
$dictDataId = intval($dictDataId);
|
||||
if (!$dictDataId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$this->mdSysDictionaryData->update(['status' => -1], ['dictDataId' => $dictDataId]);
|
||||
$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->mdSysDictionaryData->update(['status' => -1], ["dictDataId in($str_ids)" => null]);
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/api/BaseController.php';
|
||||
|
||||
/**
|
||||
* Notes:登录日志
|
||||
* Created on: 2022/9/14 17:15
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class LoginRecord extends BaseController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/admin/Market_sys_login_record_model', 'mdSysLoginRecord');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:登录日志列表
|
||||
* Created on: 2022/9/14 16:28
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function page_get()
|
||||
{
|
||||
$page = $this->input_param('page');
|
||||
$limit = $this->input_param('limit');
|
||||
$sort = $this->input_param('sort');
|
||||
$order = $this->input_param('order');
|
||||
$username = $this->input_param('username');
|
||||
$nickname = $this->input_param('nickname');
|
||||
$createTimeStart = $this->input_param('createTimeStart');
|
||||
$createTimeEnd = $this->input_param('createTimeEnd');
|
||||
!$page && $page = 1;
|
||||
!$limit && $limit = 10;
|
||||
$where = $list = [];
|
||||
$createTimeStart && $where['createTime>='] = $createTimeStart;
|
||||
$createTimeEnd && $where['createTime<='] = $createTimeEnd;
|
||||
$username && $where['username'] = $username;
|
||||
$nickname && $where['nickname'] = $nickname;
|
||||
$sort_order = 'createTime desc';
|
||||
if ($sort && $order) {
|
||||
$sort_order = $sort . ' ' . $order;
|
||||
}
|
||||
$count = $this->mdSysLoginRecord->count($where);
|
||||
if ($count) {
|
||||
$list = $this->mdSysLoginRecord->select($where, $sort_order, $page, $limit);
|
||||
}
|
||||
$date = ['list' => $list, 'count' => $count];
|
||||
$this->return_response_list($date);
|
||||
}
|
||||
|
||||
public function index_get()
|
||||
{
|
||||
$date = [];
|
||||
$this->return_response_list($date);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/api/BaseController.php';
|
||||
|
||||
/**
|
||||
* Notes:菜单管理
|
||||
* Created on: 2022/9/09 17:15
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class Menu extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/admin/Market_sys_menu_model', 'mdSysMenu');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes菜单管理
|
||||
* Created on: 2022/9/9 14:48
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_get()
|
||||
{
|
||||
$title = $this->input_param('title');
|
||||
$path = $this->input_param('path');
|
||||
$authority = $this->input_param('authority');
|
||||
$where['status>='] = 0;
|
||||
$sort_order = 'sortNumber asc,menuId desc';
|
||||
$title && $where['title'] = $title;
|
||||
$path && $where['path'] = $path;
|
||||
$authority && $where['authority'] = $authority;
|
||||
$res = $this->mdSysMenu->select($where, $sort_order);
|
||||
foreach ($res as $k => $v) {
|
||||
$res[$k]['menuId'] = intval($v['menuId']);
|
||||
$res[$k]['parentId'] = intval($v['parentId']);
|
||||
$res[$k]['menuType'] = intval($v['menuType']);
|
||||
$res[$k]['openType'] = intval($v['openType']);
|
||||
$res[$k]['sortNumber'] = intval($v['sortNumber']);
|
||||
$res[$k]['hide'] = intval($v['hide']);
|
||||
$res[$k]['meta'] = json_decode($v['meta'], true);
|
||||
}
|
||||
$this->return_response_list($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:修改菜单
|
||||
* Created on: 2022/9/9 17:58
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_put()
|
||||
{
|
||||
$menuId = $this->input_param('menuId');
|
||||
$parentId = intval($this->input_param('parentId'));
|
||||
$menuType = intval($this->input_param('menuType'));
|
||||
$title = $this->input_param('title');
|
||||
$openType = intval($this->input_param('openType'));
|
||||
$icon = $this->input_param('icon');
|
||||
$path = $this->input_param('path');
|
||||
$component = $this->input_param('component');
|
||||
$authority = $this->input_param('authority');
|
||||
$sortNumber = intval($this->input_param('sortNumber'));
|
||||
$hide = intval($this->input_param('hide'));
|
||||
$meta = $this->input_param('meta');
|
||||
if (!$menuId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
if (!$title) {
|
||||
$this->return_json('请输入菜单名称');
|
||||
}
|
||||
!$icon && $icon = '';
|
||||
!$path && $path = '';
|
||||
!$component && $component = '';
|
||||
!$authority && $authority = '';
|
||||
$upDate = ['parentId' => $parentId, 'menuType' => $menuType, 'title' => $title, 'openType' => $openType,
|
||||
'icon' => $icon, 'path' => $path, 'component' => $component, 'authority' => $authority,
|
||||
'sortNumber' => $sortNumber, 'hide' => $hide];
|
||||
$upDate['meta'] = $meta ? json_encode($meta, JSON_UNESCAPED_UNICODE) : null;
|
||||
$this->mdSysMenu->update($upDate, ['menuId' => $menuId]);
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:添加菜单
|
||||
* Created on: 2022/9/9 11:47
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_post()
|
||||
{
|
||||
$parentId = intval($this->input_param('parentId'));
|
||||
$menuType = intval($this->input_param('menuType'));
|
||||
$title = $this->input_param('title');
|
||||
$openType = intval($this->input_param('openType'));
|
||||
$icon = $this->input_param('icon');
|
||||
$path = $this->input_param('path');
|
||||
$component = $this->input_param('component');
|
||||
$authority = $this->input_param('authority');
|
||||
$sortNumber = intval($this->input_param('sortNumber'));
|
||||
$hide = intval($this->input_param('hide'));
|
||||
$meta = $this->input_param('meta');
|
||||
if (!$title) {
|
||||
$this->return_json('请输入菜单名称');
|
||||
}
|
||||
!$icon && $icon = '';
|
||||
!$path && $path = '';
|
||||
!$component && $component = '';
|
||||
!$authority && $authority = '';
|
||||
$addDate = ['parentId' => $parentId, 'menuType' => $menuType, 'title' => $title, 'openType' => $openType,
|
||||
'icon' => $icon, 'path' => $path, 'component' => $component, 'authority' => $authority,
|
||||
'sortNumber' => $sortNumber, 'hide' => $hide, 'createTime' => date('Y-m-d H:i:s')];
|
||||
$meta && $addDate['meta'] = json_encode($meta, JSON_UNESCAPED_UNICODE);
|
||||
$id = $this->mdSysMenu->add($addDate);
|
||||
if (!$id) {
|
||||
$this->return_json('添加菜单失败');
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:删除菜单
|
||||
* Created on: 2022/9/9 16:10
|
||||
* Created by: dengbw
|
||||
* @param null $menuId
|
||||
*/
|
||||
public function index_delete($menuId = null)
|
||||
{
|
||||
$menuId = intval($menuId);
|
||||
if (!$menuId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$this->mdSysMenu->update(['status' => -1], ['menuId' => $menuId]);
|
||||
$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->mdSysMenu->update(['status' => -1], ["menuId in($str_ids)" => null]);
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/api/BaseController.php';
|
||||
|
||||
/**
|
||||
* Notes:操作日志
|
||||
* Created on: 2022/9/15 17:15
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class operationRecord extends BaseController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/admin/Market_sys_operation_record_model', 'mdSysOperationRecord');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:操作日志列表
|
||||
* Created on: 2022/9/15 16:28
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function page_get()
|
||||
{
|
||||
$page = $this->input_param('page');
|
||||
$limit = $this->input_param('limit');
|
||||
$sort = $this->input_param('sort');
|
||||
$order = $this->input_param('order');
|
||||
$username = $this->input_param('username');
|
||||
$module = $this->input_param('module');
|
||||
$createTimeStart = $this->input_param('createTimeStart');
|
||||
$createTimeEnd = $this->input_param('createTimeEnd');
|
||||
!$page && $page = 1;
|
||||
!$limit && $limit = 10;
|
||||
$where = $list = [];
|
||||
$createTimeStart && $where['createTime>='] = $createTimeStart;
|
||||
$createTimeEnd && $where['createTime<='] = $createTimeEnd;
|
||||
$username && $where['username'] = $username;
|
||||
$module && $where['module'] = $module;
|
||||
$sort_order = 'createTime desc';
|
||||
if ($sort && $order) {
|
||||
$sort_order = $sort . ' ' . $order;
|
||||
}
|
||||
$count = $this->mdSysOperationRecord->count($where);
|
||||
if ($count) {
|
||||
$list = $this->mdSysOperationRecord->select($where, $sort_order, $page, $limit);
|
||||
foreach ($list as $k => $v) {
|
||||
$list[$k]['params'] = json_decode($v['params'], true);
|
||||
$list[$k]['result'] = json_decode($v['result'], true);
|
||||
$list[$k]['error'] = json_decode($v['error'], true);
|
||||
$list[$k]['status'] = intval($v['status']);
|
||||
}
|
||||
}
|
||||
$date = ['list' => $list, 'count' => $count];
|
||||
$this->return_response_list($date);
|
||||
}
|
||||
|
||||
private function dataSelect($params)
|
||||
{
|
||||
$page = $params['page'];
|
||||
$limit = $params['limit'];
|
||||
|
||||
$limit = $this->input_param('limit');
|
||||
$sort = $this->input_param('sort');
|
||||
$order = $this->input_param('order');
|
||||
$username = $this->input_param('username');
|
||||
$module = $this->input_param('module');
|
||||
$createTimeStart = $this->input_param('createTimeStart');
|
||||
$createTimeEnd = $this->input_param('createTimeEnd');
|
||||
!$page && $page = 1;
|
||||
!$limit && $limit = 10;
|
||||
$where = $list = [];
|
||||
$createTimeStart && $where['createTime>='] = $createTimeStart;
|
||||
$createTimeEnd && $where['createTime<='] = $createTimeEnd;
|
||||
$username && $where['username'] = $username;
|
||||
$module && $where['module'] = $module;
|
||||
$sort_order = 'createTime desc';
|
||||
if ($sort && $order) {
|
||||
$sort_order = $sort . ' ' . $order;
|
||||
}
|
||||
$count = $this->mdSysOperationRecord->count($where);
|
||||
if ($count) {
|
||||
$list = $this->mdSysOperationRecord->select($where, $sort_order, $page, $limit);
|
||||
foreach ($list as $k => $v) {
|
||||
$list[$k]['params'] = json_decode($v['params'], true);
|
||||
$list[$k]['result'] = json_decode($v['result'], true);
|
||||
$list[$k]['error'] = json_decode($v['error'], true);
|
||||
$list[$k]['status'] = intval($v['status']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function index_get()
|
||||
{
|
||||
$date = [];
|
||||
$this->return_response_list($date);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
<?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 Role extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/admin/Market_sys_role_model', 'mdSysRole');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes角色管理
|
||||
* Created on: 2022/9/8 14:48
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_get()
|
||||
{
|
||||
$page = intval($this->input_param('page'));
|
||||
$limit = intval($this->input_param('limit'));
|
||||
$roleName = $this->input_param('roleName');
|
||||
$roleCode = $this->input_param('roleCode');
|
||||
$comments = $this->input_param('comments');
|
||||
$sort = $this->input_param('sort');
|
||||
$order = $this->input_param('order');
|
||||
$list = $where = [];
|
||||
if (!$page) {
|
||||
$where['status'] = 0;
|
||||
} else {
|
||||
$where['status>='] = 0;
|
||||
}
|
||||
$sort_order = 'roleId desc';
|
||||
if ($sort && $order) {
|
||||
$sort_order = $sort . ' ' . $order;
|
||||
}
|
||||
$roleName && $where['roleName'] = $roleName;
|
||||
$roleCode && $where['roleCode'] = $roleCode;
|
||||
$comments && $where['comments'] = $comments;
|
||||
$count = $this->mdSysRole->count($where);
|
||||
$res = $this->mdSysRole->select($where, $sort_order, $page, $limit);
|
||||
foreach ($res as $v) {
|
||||
$list[] = $v;
|
||||
}
|
||||
$date = ['list' => $list, 'count' => $count];
|
||||
$this->return_response_list($date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:修改角色
|
||||
* Created on: 2022/9/8 17:58
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_put()
|
||||
{
|
||||
$roleId = $this->input_param('roleId');
|
||||
$roleName = $this->input_param('roleName');
|
||||
$roleCode = $this->input_param('roleCode');
|
||||
$comments = $this->input_param('comments');
|
||||
if (!$roleId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
if (!$roleName) {
|
||||
$this->return_json('请输入角色名称');
|
||||
}
|
||||
if (!$roleCode) {
|
||||
$this->return_json('请输入角色标识');
|
||||
}
|
||||
$upDate = ['roleName' => $roleName, 'roleCode' => $roleCode, 'comments' => $comments];
|
||||
$this->mdSysRole->update($upDate, ['roleId' => $roleId]);
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:添加角色
|
||||
* Created on: 2022/9/9 11:47
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_post()
|
||||
{
|
||||
$roleName = $this->input_param('roleName');
|
||||
$roleCode = $this->input_param('roleCode');
|
||||
$comments = $this->input_param('comments');
|
||||
if (!$roleName) {
|
||||
$this->return_json('请输入角色名称');
|
||||
}
|
||||
if (!$roleCode) {
|
||||
$this->return_json('请输入角色标识');
|
||||
}
|
||||
$addDate = ['roleName' => $roleName, 'roleCode' => $roleCode, 'comments' => $comments, 'createTime' => date('Y-m-d H:i:s')];
|
||||
$id = $this->mdSysRole->add($addDate);
|
||||
if (!$id) {
|
||||
$this->return_json('添加角色失败');
|
||||
}
|
||||
if ($roleCode == 'brand') {//角色品牌
|
||||
$this->load->model('agent/admin/Market_sylive_organization_model', 'mdSyliveOrganization');
|
||||
$re_org = $this->mdSyliveOrganization->get(['organizationName' => $roleName, 'parentId' => 0, 'status' => 0]);
|
||||
if (!$re_org) {//创建品牌
|
||||
$addDate = ['parentId' => 0, 'organizationName' => $roleName, 'organizationType' => 1, 'createTime' => date('Y-m-d H:i:s')];
|
||||
$this->mdSyliveOrganization->add($addDate);
|
||||
}
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:删除用户
|
||||
* Created on: 2022/9/9 16:10
|
||||
* Created by: dengbw
|
||||
* @param null $roleId
|
||||
*/
|
||||
public function index_delete($roleId = null)
|
||||
{
|
||||
if (!$roleId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$this->mdSysRole->update(['status' => -1], ['roleId' => $roleId]);
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:批量删除用户
|
||||
* Created on: 2022/9/9 17:11
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function batch_delete()
|
||||
{
|
||||
$roleIds = $this->input_param('ids');
|
||||
if (!$roleIds) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$str_roleIds = implode(',', $roleIds);
|
||||
if ($str_roleIds) {
|
||||
$this->mdSysRole->update(['status' => -1], ["roleId in($str_roleIds)" => null]);
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/api/BaseController.php';
|
||||
|
||||
/**
|
||||
* Notes:角色分配的菜单
|
||||
* Created on: 2022/9/09 17:15
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class RoleMenu 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');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取角色分配的菜单 (ele-admin:/system/role-menu)
|
||||
* Created on: 2022/9/13 9:47
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_get()
|
||||
{
|
||||
$roleId = $this->input_param('roleId');
|
||||
if (!$roleId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$re_ro = $this->mdSysRole->get(['roleId' => $roleId, 'status' => 0]);
|
||||
$menuIds = $re_ro['menuIds'] ? explode(',', $re_ro['menuIds']) : [];
|
||||
$where['status>='] = 0;
|
||||
$res = $this->mdSysMenu->select($where, 'sortNumber asc,menuId desc');
|
||||
foreach ($res as $k => $v) {
|
||||
$menuId = intval($v['menuId']);
|
||||
$res[$k]['menuId'] = $menuId;
|
||||
$res[$k]['parentId'] = intval($v['parentId']);
|
||||
$res[$k]['menuType'] = intval($v['menuType']);
|
||||
$res[$k]['openType'] = intval($v['openType']);
|
||||
$res[$k]['sortNumber'] = intval($v['sortNumber']);
|
||||
$res[$k]['hide'] = intval($v['hide']);
|
||||
$res[$k]['meta'] = json_decode($v['meta'], true);
|
||||
$res[$k]['children'] = '';
|
||||
$res[$k]['checked'] = in_array($menuId, $menuIds) ? true : false;
|
||||
}
|
||||
$this->return_response_list($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:修改角色菜单(ele-admin:/system/role-menu)
|
||||
* Created on: 2022/9/13 11:50
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_put()
|
||||
{
|
||||
$roleId = $this->input_param('roleId');
|
||||
if (!$roleId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$menuIds = $this->input_param('menuIds');
|
||||
$menuIds = $menuIds ? implode(',', $menuIds) : '';
|
||||
$this->mdSysRole->update(['menuIds' => $menuIds], ['roleId' => $roleId]);
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
<?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_admin_model', 'mdSysAdmin');
|
||||
$this->load->model('agent/admin/Market_sys_role_model', 'mdSysRole');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:用户管理列表
|
||||
* Created on: 2022/9/8 14:48
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function page_get()
|
||||
{
|
||||
$page = $this->input_param('page');
|
||||
$limit = $this->input_param('limit');
|
||||
$username = $this->input_param('username');
|
||||
$nickname = $this->input_param('nickname');
|
||||
$sex = $this->input_param('sex');
|
||||
$sort = $this->input_param('sort');
|
||||
$order = $this->input_param('order');
|
||||
!$page && $page = 1;
|
||||
!$limit && $limit = 10;
|
||||
$sort_order = 'userId desc';
|
||||
if ($sort && $order) {
|
||||
if ($sort == 'sexName') {
|
||||
$sort_order = 'sex ' . $order;
|
||||
} else {
|
||||
$sort_order = $sort . ' ' . $order;
|
||||
}
|
||||
}
|
||||
$where = $list = [];
|
||||
$where['status>='] = 0;
|
||||
$username && $where['username'] = $username;
|
||||
$nickname && $where['nickname'] = $nickname;
|
||||
$sex && $where['sex'] = $sex;
|
||||
$count = $this->mdSysAdmin->count($where);
|
||||
if ($count) {
|
||||
$res = $this->mdSysAdmin->select($where, $sort_order, $page, $limit);
|
||||
foreach ($res as $v) {
|
||||
$sexName = $v['sex'] == 2 ? '女' : '男';
|
||||
$status = intval($v['status']);
|
||||
$roles = [];
|
||||
if ($v['roleId']) {
|
||||
$re_ro = $this->mdSysRole->get(['roleId' => $v['roleId']]);
|
||||
if ($re_ro) {
|
||||
$re_ro['userId'] = $v['userId'];
|
||||
$re_ro['deleted'] = 0;
|
||||
$roles[] = $re_ro;
|
||||
}
|
||||
}
|
||||
$list[] = [
|
||||
'userId' => $v['userId'], 'username' => $v['username'], 'nickname' => $v['nickname'], 'phone' => $v['phone']
|
||||
, 'status' => $status, 'sex' => $v['sex'], 'sexName' => $sexName, 'birthday' => $v['birthday']
|
||||
, 'introduction' => $v['introduction'], 'email' => $v['email'], 'createTime' => $v['createTime'], 'roles' => $roles,
|
||||
];
|
||||
}
|
||||
}
|
||||
$date = ['list' => $list, 'count' => $count];
|
||||
$this->return_response_list($date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:用户详情
|
||||
* Created on: 2022/9/21 16:15
|
||||
* Created by: dengbw
|
||||
* @param null $userId
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:修改用户
|
||||
* Created on: 2022/9/8 14:48
|
||||
* Created by: dengbw
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:添加用户
|
||||
* Created on: 2022/9/8 16:46
|
||||
* Created by: dengbw
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes:修改状态
|
||||
* Created on: 2022/9/8 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->mdSysAdmin->update(['status' => $status], ['userId' => $userId]);
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:修改密码
|
||||
* Created on: 2022/9/8 16:11
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function password_put()
|
||||
{
|
||||
$userId = $this->input_param('userId');
|
||||
$password = $this->input_param('password');
|
||||
if (!$userId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
if (!$password) {
|
||||
$this->return_json('请输入重置密码');
|
||||
}
|
||||
$password = password_hash($password, PASSWORD_BCRYPT);
|
||||
$this->mdSysAdmin->update(['password' => $password], ['userId' => $userId]);
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:删除用户
|
||||
* Created on: 2022/9/8 16:10
|
||||
* Created by: dengbw
|
||||
* @param null $userId
|
||||
*/
|
||||
public function index_delete($userId = null)
|
||||
{
|
||||
if (!$userId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$this->mdSysAdmin->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->mdSysAdmin->update(['status' => -1], ["userId in($str_ids)" => null]);
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes:栓验字段
|
||||
* Created on: 2022/9/8 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->mdSysAdmin->get($where);
|
||||
if ($re) {
|
||||
$this->return_json('已存在', 0);
|
||||
}
|
||||
}
|
||||
$this->return_json('不存在', 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/api/BaseController.php';
|
||||
|
||||
class Enroll extends BaseController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/admin/Market_sytopic_model', 'mSytopic');
|
||||
$this->load->model('agent/admin/Market_sytopic_enroll_model', 'sytopic_enroll_model');
|
||||
$this->load->model('agent/admin/market_sylive_user_model', 'user_model');
|
||||
$this->load->model('agent/admin/market_sylive_organization_model');
|
||||
$this->load->library('MyEncryption');
|
||||
}
|
||||
|
||||
public function page_get()
|
||||
{
|
||||
$limit = $this->input_param('limit');
|
||||
!$limit && $limit = 10;
|
||||
$data = $this->orderList($limit);
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
public function status_get()
|
||||
{
|
||||
$statusArray = $this->sytopic_enroll_model->statusCn();
|
||||
$this->return_response_list($statusArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
*/
|
||||
public function status_put()
|
||||
{
|
||||
$id = $this->input_param('id');
|
||||
$status = $this->input_param('status');
|
||||
if (!$id) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$this->sytopic_enroll_model->update(['status' => $status], ['id' => $id]);
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:导出订单数据
|
||||
*/
|
||||
public function export_get()
|
||||
{
|
||||
$data = $this->orderList(20000);
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报名列表数据
|
||||
*/
|
||||
private function orderList($limit = '')
|
||||
{
|
||||
$page = $this->input_param('page');
|
||||
$sort = $this->input_param('sort');
|
||||
$order = $this->input_param('order');
|
||||
$name = $this->input_param('name');
|
||||
$mobile = $this->input_param('mobile');
|
||||
$topicId = (int)$this->input_param('topicId');
|
||||
$status = $this->input_param('status');
|
||||
!$page && $page = 1;
|
||||
$sort_order = 'id desc';
|
||||
if ($sort && $order) {
|
||||
$sort_order = $sort . ' ' . $order;
|
||||
}
|
||||
$list = [];
|
||||
$where['status>='] = 0;
|
||||
if ($name) {
|
||||
$where['name'] = $name;
|
||||
}
|
||||
if ($mobile) {
|
||||
$where['mobile'] = $mobile;
|
||||
}
|
||||
if ($topicId) {
|
||||
$where['topicId'] = $topicId;
|
||||
}
|
||||
if (strlen($status)) {
|
||||
$where['status'] = (int)$status;
|
||||
}
|
||||
$count = $this->sytopic_enroll_model->count($where);
|
||||
$columns = [];
|
||||
if ($count) {
|
||||
$statusCn = $this->sytopic_enroll_model->statusCn();
|
||||
$res = $this->sytopic_enroll_model->select($where, $sort_order, $page, $limit);
|
||||
$topicIds = array_column($res, 'topicId');
|
||||
$topicIdsStr = implode(',', $topicIds);
|
||||
$topicMap = [];
|
||||
$topicIdsStr && $topicMap = $this->mSytopic->map('id', 'title', ["id in ({$topicIdsStr})" => null], '', '', '', 'id,title');
|
||||
$channelUserIds = array_column($res, 'channelId');
|
||||
$channelUserIdsStr = implode(',', array_unique($channelUserIds));
|
||||
$channelUserMap = [];
|
||||
$channelUserIdsStr && $channelUserMap = $this->user_model->map('userId', '', ["userId in ({$channelUserIdsStr})" => null], '', '', '', 'userId,uname,bizId');
|
||||
foreach ($res as $val) {
|
||||
$channelUser = $channelUserMap[$val['channelId']];
|
||||
$bizId = $channelUser[0]['bizId'];
|
||||
if ($bizId) {
|
||||
$biz = $this->market_sylive_organization_model->get(['organizationId' => $bizId]);
|
||||
}
|
||||
$tmp_data = [
|
||||
'id' => $val['id'],
|
||||
'name' => $val['name'],
|
||||
'mobile' => $val['mobile'],
|
||||
'enTime' => $val['enTime'],
|
||||
'enrollDeal' => (int)$val['enrollDeal']
|
||||
];
|
||||
$tmp_data['channelName'] = $channelUser ? $channelUser[0]['uname'] : '';
|
||||
$tmp_data['topicTitle'] = $topicMap[$val['topicId']] ?: '';
|
||||
$tmp_data['status_cn'] = $statusCn[$val['status']];
|
||||
$tmp_data['bizName'] = $biz ? $biz['organizationName'] : '';
|
||||
if ($limit < 10000) {
|
||||
$tmp_data['status'] = intval($val['status']);
|
||||
}
|
||||
$list[] = $tmp_data;
|
||||
}
|
||||
}
|
||||
if ($limit >= 10000) {
|
||||
$columns = ['ID', '姓名', '手机号', '留资时间', '来源人', '来源专题', '状态'];
|
||||
}
|
||||
return ['list' => $list, 'count' => $count, 'columns' => $columns];
|
||||
}
|
||||
|
||||
/**
|
||||
* 专题管理列表
|
||||
*/
|
||||
public function topicList_get()
|
||||
{
|
||||
$lists = $this->mSytopic->select(['status>=' => 0], 'id desc', 1, 10000, 'id,title');
|
||||
!$lists && $lists = [];
|
||||
|
||||
$this->return_response_list($lists);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/api/BaseController.php';
|
||||
|
||||
class Module extends BaseController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/admin/Market_sytopic_model', 'mSytopic');
|
||||
$this->load->model('agent/admin/Market_sytopic_module_model', 'mSModule');
|
||||
$this->load->model('agent/admin/Market_sytopic_module_option_model', 'mSModuleOption');
|
||||
}
|
||||
|
||||
/**
|
||||
* 专题模块列表
|
||||
* @return void
|
||||
*/
|
||||
public function page_get()
|
||||
{
|
||||
$topicId = intval($this->input_param('topicId'));
|
||||
$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 = 'sort desc,type asc';
|
||||
if ($sort && $order) {
|
||||
$sort_order = $sort . ' ' . $order;
|
||||
}
|
||||
$list = [];
|
||||
$where = [
|
||||
'topicId' => $topicId,
|
||||
'status>=' => 0
|
||||
];
|
||||
$title && $where['title LIKE "%' . trim($title) . '%"'] = null;
|
||||
$count = $this->mSModule->count($where);
|
||||
if ($count) {
|
||||
$res = $this->mSModule->select($where, $sort_order, $page, $limit);
|
||||
$mSModule = new Market_sytopic_module_model();
|
||||
foreach ($res as $v) {
|
||||
$v['options'] = $this->mSModuleOption->count(['moduleId' => $v['id'], 'status' => 0]);
|
||||
$v['type_cn'] = $mSModule::TYPE_ARRAY[$v['type']] ?: '';
|
||||
$v['type'] = intval($v['type']);
|
||||
$list[] = $v;
|
||||
}
|
||||
}
|
||||
$data = ['list' => $list, 'count' => $count];
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加专题模块
|
||||
*/
|
||||
public function index_post()
|
||||
{
|
||||
$topicId = intval($this->input_param('topicId'));
|
||||
$title = $this->input_param('title');
|
||||
$type = $this->input_param('type');
|
||||
$sort = intval($this->input_param('sort'));
|
||||
if (!$topicId) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
if (!$title) {
|
||||
$this->return_json('请输入活动标题');
|
||||
}
|
||||
if (!$type) {
|
||||
$this->return_json('请选择类型');
|
||||
}
|
||||
$createTime = date('Y-m-d H:i:s');
|
||||
$addData = ['title' => $title, 'topicId' => $topicId, 'createTime' => $createTime, 'type' => $type, 'sort' => $sort ?: 0];
|
||||
$topicId = $this->mSModule->add($addData);
|
||||
if (!$topicId) {
|
||||
$this->return_json('添加专题模块失败');
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改活动
|
||||
*/
|
||||
public function index_put()
|
||||
{
|
||||
$id = $this->input_param('id');
|
||||
$title = $this->input_param('title');
|
||||
$sort = intval($this->input_param('sort'));
|
||||
if (!$title) {
|
||||
$this->return_json('请输入活动标题');
|
||||
}
|
||||
$addData = ['title' => $title, 'sort' => $sort];
|
||||
$topicId = $this->mSModule->update($addData, ['id' => $id]);
|
||||
if (!$topicId) {
|
||||
$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->mSModule->update(['status' => $status], ['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->mSModule->update(['status' => -1], ["id in($str_ids)" => null]);
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* 类型列表
|
||||
* @return void
|
||||
*/
|
||||
public function types_get()
|
||||
{
|
||||
$mSModule = new Market_sytopic_module_model();
|
||||
$list = [];
|
||||
if ($mSModule::TYPE_ARRAY) {
|
||||
foreach ($mSModule::TYPE_ARRAY as $key => $item) {
|
||||
$list[] = [
|
||||
'key' => $key,
|
||||
'value' => $item
|
||||
];
|
||||
}
|
||||
}
|
||||
$data = ['list' => $list];
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模块配置项
|
||||
* @return void
|
||||
*/
|
||||
public function options_get()
|
||||
{
|
||||
$moduleId = $this->input_param('moduleId');
|
||||
$moduleRow = $this->mSModule->get(['id' => $moduleId]);
|
||||
if (!$moduleRow) $this->return_json('参数错误');
|
||||
$where = [
|
||||
'moduleId' => $moduleId,
|
||||
'status' => 0
|
||||
];
|
||||
$rows = $this->mSModuleOption->select($where, 'id desc', 1, 1000);
|
||||
$lists = [];
|
||||
if ($rows) {
|
||||
foreach ($rows as $item) {
|
||||
$lists[] = $this->form_data($moduleRow, $item);
|
||||
}
|
||||
}
|
||||
$data['lists'] = $lists;
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存模块配置项
|
||||
* @return void
|
||||
*/
|
||||
public function options_post()
|
||||
{
|
||||
$postData = $this->input_param('');
|
||||
$modelRow = $this->mSModule->get(['id' => $postData['moduleId']]);
|
||||
if (!$modelRow) $this->return_json('参数错误');
|
||||
if (!$postData['title']) $this->return_json('请输入标题');
|
||||
$banner = $postData['banner'] ? $postData['banner'][0]['fileUrl'] : '';
|
||||
$setOtherImg = '';
|
||||
if ($postData['otherImg']) {
|
||||
foreach ($postData['otherImg'] as $v) {
|
||||
$setOtherImg[] = $v['fileUrl'];
|
||||
}
|
||||
$setOtherImg = json_encode($setOtherImg, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
$data = [
|
||||
'title' => $postData['title'],
|
||||
'banner' => $banner,
|
||||
'subTitle' => $postData['subTitle'] ?: '',
|
||||
'introduction' => $postData['introduction'] ?: '',
|
||||
'showBtn' => $postData['showBtn'] ? 1 : 0,
|
||||
'btnText' => $postData['btnText'] ?: '',
|
||||
'popUpType' => $postData['popUpType'] ? 1 : 0,
|
||||
'targetUrl' => $postData['targetUrl'] ?: '',
|
||||
'otherImg' => $setOtherImg,
|
||||
'enrollLimit' => $postData['enrollLimit'] ?: 0,
|
||||
'enrollEndTime' => $postData['enrollEndTime'] ?: '0000-00-00 00:00:00'
|
||||
];
|
||||
if ($postData['jsondata']) {
|
||||
$data['jsondata'] = json_encode($postData['jsondata'], JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
if ($postData['id']) {
|
||||
$result = $this->mSModuleOption->update($data, ['id' => $postData['id']]);
|
||||
} else {
|
||||
$data['topicId'] = $modelRow['topicId'];
|
||||
$data['moduleId'] = $modelRow['id'];
|
||||
$data['createTime'] = date('Y-m-d H:i:s', time());
|
||||
$result = $this->mSModuleOption->add($data);
|
||||
}
|
||||
if (!$result) {
|
||||
$this->return_json('操作失败');
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
*/
|
||||
public function options_delete()
|
||||
{
|
||||
$id = $this->input_param('id');
|
||||
if (!$id) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$this->mSModuleOption->update(['status' => -1], ['id' => $id]);
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
private function form_data($moduleType, $row)
|
||||
{
|
||||
$otherImg = $banner = [];
|
||||
$jsondata = [
|
||||
'dis_title' => '',
|
||||
'dis_money' => ''
|
||||
];
|
||||
if ($row['banner']) {
|
||||
$banner = [['uid' => 1, 'fileUrl' => $row['banner'], 'url' => build_qiniu_image_url($row['banner']), 'status' => 'done']];
|
||||
}
|
||||
if ($row['otherImg']) {
|
||||
$getOtherImg = json_decode($row['otherImg'], true);
|
||||
foreach ($getOtherImg as $key => $val) {
|
||||
$otherImg[] = ['uid' => $key, 'fileUrl' => $val, 'url' => build_qiniu_image_url($val), 'status' => 'done'];
|
||||
}
|
||||
}
|
||||
$row['otherImg'] = $otherImg;
|
||||
if ($row['jsondata']) {
|
||||
$jsondata = json_decode($row['jsondata'], true);
|
||||
}
|
||||
$row['jsondata'] = $jsondata;
|
||||
$row['banner'] = $banner;
|
||||
$row['enrollEndTime'] = $row['enrollEndTime'] != '0000-00-00 00:00:00' ? $row['enrollEndTime'] : '';
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/api/BaseController.php';
|
||||
|
||||
class Topic extends BaseController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/admin/Market_sytopic_model', 'mSytopic');
|
||||
$this->load->library('MyEncryption');
|
||||
}
|
||||
|
||||
/**
|
||||
* 专题管理列表
|
||||
* @return void
|
||||
*/
|
||||
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 = 'id 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->mSytopic->count($where);
|
||||
if ($count) {
|
||||
$this->load->library('MyEncryption');
|
||||
$res = $this->mSytopic->select($where, $sort_order, $page, $limit);
|
||||
foreach ($res as $v) {
|
||||
$shareImg = $sharePhoto = $banner = [];
|
||||
$jsonData = json_decode($v['jsondata'], true);
|
||||
$jsonData['bg_color'] = $jsonData['bg_color'] ?: '';
|
||||
$jsonData['button_type'] = $jsonData['button_type'] ?: '';
|
||||
if ($v['banner']) {
|
||||
$banner = [['uid' => 1, 'fileUrl' => $v['banner'], 'url' => build_qiniu_image_url($v['banner']), '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['banner']){
|
||||
$jsonData['banner'] = [['uid' => 1, 'fileUrl' => $jsonData['banner'], 'url' => build_qiniu_image_url($jsonData['banner']), 'status' => 'done']];
|
||||
}else{
|
||||
$jsonData['banner'] = [];
|
||||
}
|
||||
if($jsonData['bottom_img']){
|
||||
$jsonData['bottom_img'] = [['uid' => 1, 'fileUrl' => $jsonData['bottom_img'], 'url' => build_qiniu_image_url($jsonData['bottom_img']), 'status' => 'done']];
|
||||
}else{
|
||||
$jsonData['bottom_img'] = [];
|
||||
}
|
||||
$v['status'] = intval($v['status']);
|
||||
$v['sharePhoto'] = $sharePhoto;
|
||||
$v['banner'] = $banner;
|
||||
$v['shareImg'] = $shareImg;
|
||||
$v['organizationId'] = intval($v['organizationId']);
|
||||
$v['dateRange'] = $v['timeStart'] ? [$v['timeStart'], $v['timeEnd']] : [];
|
||||
$v['shareTitle'] = $v['shareTitle'] ? json_decode($v['shareTitle'], true) : [];
|
||||
$v['json'] = $jsonData;
|
||||
$list[] = $v;
|
||||
}
|
||||
}
|
||||
$date = ['list' => $list, 'count' => $count];
|
||||
$this->return_response_list($date);
|
||||
}
|
||||
|
||||
public function detail_get()
|
||||
{
|
||||
$id = $this->input_param('id');
|
||||
$res = $this->mSytopic->get(['id' => $id]);
|
||||
if (!$res) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$skey = $this->myencryption->base64url_encode("a_id=" . $res['id']);
|
||||
$date = ['url' => http_host_com('home') . "/h5/market/sylive2?skey=" . $skey];
|
||||
$this->return_response_list($date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加专题
|
||||
*/
|
||||
public function index_post()
|
||||
{
|
||||
$title = $this->input_param('title');
|
||||
$dateRange = $this->input_param('dateRange');
|
||||
$shareTitle = $this->input_param('shareTitle');
|
||||
$shareImg = $this->input_param('shareImg');
|
||||
$sharePhoto = $this->input_param('sharePhoto');
|
||||
$organizationId = intval($this->input_param('organizationId'));
|
||||
$banner = $this->input_param('banner');
|
||||
$introduction = $this->input_param('introduction');
|
||||
$jsonData = $this->input_param('json');
|
||||
if (!$title) {
|
||||
$this->return_json('请输入活动标题');
|
||||
}
|
||||
if (!$banner[0]['fileUrl']) {
|
||||
$this->return_json('请选择banner图');
|
||||
}
|
||||
if (!$dateRange) {
|
||||
$this->return_json('请选择活动时间');
|
||||
}
|
||||
$sharePhoto = $sharePhoto ? $sharePhoto[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);
|
||||
}
|
||||
$setJsonData = [];
|
||||
if ($jsonData['banner']) {
|
||||
$setJsonData['banner'] = $jsonData['banner'] ? $jsonData['banner'][0]['fileUrl'] : '';
|
||||
} else {
|
||||
$setJsonData['banner'] = '';
|
||||
}
|
||||
if ($jsonData['bottom_img']) {
|
||||
$setJsonData['bottom_img'] = $jsonData['bottom_img'] ? $jsonData['bottom_img'][0]['fileUrl'] : '';
|
||||
} else {
|
||||
$setJsonData['bottom_img'] = '';
|
||||
}
|
||||
$setJsonData['bg_color'] = $jsonData['bg_color'] ?: '';
|
||||
$setJsonData['button_type'] = $jsonData['button_type'] ?: '';
|
||||
$createTime = date('Y-m-d H:i:s');
|
||||
$addData = ['title' => $title, 'banner' => $banner, 'status' => 1, 'createTime' => $createTime, 'organizationId' => $organizationId,
|
||||
'sharePhoto' => $sharePhoto, 'shareTitle' => $shareTitle, 'timeStart' => $dateRange[0], 'timeEnd' => $dateRange[1], 'jsondata' => json_encode($setJsonData, JSON_UNESCAPED_UNICODE)];
|
||||
$setShareImg && $addData['shareImg'] = $setShareImg;
|
||||
$addData['introduction'] = $introduction ?: '';
|
||||
$topicId = $this->mSytopic->add($addData);
|
||||
if (!$topicId) {
|
||||
$this->return_json('添加专题失败');
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改活动
|
||||
*/
|
||||
public function index_put()
|
||||
{
|
||||
$id = $this->input_param('id');
|
||||
$title = $this->input_param('title');
|
||||
$dateRange = $this->input_param('dateRange');
|
||||
$shareTitle = $this->input_param('shareTitle');
|
||||
$shareImg = $this->input_param('shareImg');
|
||||
$sharePhoto = $this->input_param('sharePhoto');
|
||||
$organizationId = intval($this->input_param('organizationId'));
|
||||
$banner = $this->input_param('banner');
|
||||
$introduction = $this->input_param('introduction');
|
||||
$jsonData = $this->input_param('json');
|
||||
if (!$title) {
|
||||
$this->return_json('请输入活动标题');
|
||||
}
|
||||
if (!$banner[0]['fileUrl']) {
|
||||
$this->return_json('请选择banner图');
|
||||
}
|
||||
if (!$dateRange) {
|
||||
$this->return_json('请选择活动时间');
|
||||
}
|
||||
$sharePhoto = $sharePhoto ? $sharePhoto[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);
|
||||
}
|
||||
$setJsonData = [];
|
||||
if ($jsonData['banner']) {
|
||||
$setJsonData['banner'] = $jsonData['banner'] ? $jsonData['banner'][0]['fileUrl'] : '';
|
||||
} else {
|
||||
$setJsonData['banner'] = '';
|
||||
}
|
||||
if ($jsonData['bottom_img']) {
|
||||
$setJsonData['bottom_img'] = $jsonData['bottom_img'] ? $jsonData['bottom_img'][0]['fileUrl'] : '';
|
||||
} else {
|
||||
$setJsonData['bottom_img'] = '';
|
||||
}
|
||||
$setJsonData['bg_color'] = $jsonData['bg_color'] ?: '';
|
||||
$setJsonData['button_type'] = $jsonData['button_type'] ?: '';
|
||||
$addData = ['title' => $title, 'banner' => $banner, 'organizationId' => $organizationId, 'sharePhoto' => $sharePhoto,
|
||||
'shareTitle' => $shareTitle, 'timeStart' => $dateRange[0], 'timeEnd' => $dateRange[1], 'jsondata' => json_encode($setJsonData, JSON_UNESCAPED_UNICODE)];
|
||||
$setShareImg && $addData['shareImg'] = $setShareImg;
|
||||
$addData['introduction'] = $introduction ?: '';
|
||||
$topicId = $this->mSytopic->update($addData, ['id' => $id]);
|
||||
if (!$topicId) {
|
||||
$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->mSytopic->update(['status' => $status], ['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->mSytopic->update(['status' => -1], ["id in($str_ids)" => null]);
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/auto/BaseController.php';
|
||||
|
||||
class Area extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('area_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取城市列表
|
||||
* @return void
|
||||
*/
|
||||
public function index_get()
|
||||
{
|
||||
$province_rows = $this->area_model->select([], '', '', '', 'DISTINCT province_id,province_name');
|
||||
$city_rows = $this->area_model->select([], '', '', '', 'DISTINCT city_id,city_name');
|
||||
$county_rows = $this->area_model->select([], '', '', '', 'DISTINCT county_id,county_name');
|
||||
$county_list = $city_list = $province_list = [];
|
||||
foreach ($province_rows as $item) {
|
||||
$province_list[$item['province_id'] . '000'] = $item['province_name'];
|
||||
}
|
||||
foreach ($city_rows as $item) {
|
||||
$city_list[$item['city_id']] = $item['city_name'];
|
||||
}
|
||||
foreach ($county_rows as $item) {
|
||||
$county_list[$item['county_id']] = $item['county_name'];
|
||||
}
|
||||
$data = [
|
||||
'province_list' => $province_list,
|
||||
'city_list' => $city_list,
|
||||
'county_list' => $county_list
|
||||
];
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取首页城市列表
|
||||
* @return void
|
||||
*/
|
||||
public function city_get()
|
||||
{
|
||||
$city_rows = $this->area_model->select_groupby('city_id', [], 'firstchar asc', '', '', 'firstchar,province_name,city_id,city_name');
|
||||
$data = [];
|
||||
foreach ($city_rows as $item) {
|
||||
$data[$item['firstchar']][] = [
|
||||
'city_id' => $item['city_id'],
|
||||
'city_name' => $item['city_name'] != '市辖区' ? $item['city_name'] : $item['province_name']
|
||||
];
|
||||
}
|
||||
foreach (range('A', 'Z') as $letter) {
|
||||
if(!isset($data[$letter])){
|
||||
$data[$letter] = [];
|
||||
}
|
||||
}
|
||||
ksort($data);
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?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;
|
||||
protected $groupType;
|
||||
|
||||
public $userId;
|
||||
|
||||
const CODE_BM = 'bm'; //报名
|
||||
const CODE_BANK = 'bank'; //绑定银行卡
|
||||
|
||||
//短信验证码类型
|
||||
protected $codeCachePre = [
|
||||
self::CODE_BM => 'AUTO_BM_%s',
|
||||
self::CODE_BANK => 'AUTO_BANK_%s'
|
||||
];
|
||||
const SERVICE_PHONE = '13388887777';
|
||||
const APP_ID = 1; //应用id
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->input_param();
|
||||
$this->start_time = microtime(true);
|
||||
$this->load->model('agent/auto_user_model', 'autoUserModel');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = API_CODE_FAIL)
|
||||
{
|
||||
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, '操作成功', API_CODE_SUCCESS, 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 = API_CODE_SUCCESS, $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;
|
||||
}
|
||||
$this->response($set_data, $http_code, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
* @param $mobile
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getCodeCacheKey($type, $mobile)
|
||||
{
|
||||
if (!in_array($type, $this->codeCachePre)) {
|
||||
$this->return_response('验证码类型错误');
|
||||
}
|
||||
return sprintf($this->codeCachePre['login'], $mobile);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/auto/BaseController.php';
|
||||
|
||||
class Biz extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('area_model');
|
||||
$this->load->model('agent/auto_product_coupon_biz_model', 'productCouponBiz');
|
||||
$this->load->model('agent/auto_user_coupon_model');
|
||||
}
|
||||
|
||||
public function index_get()
|
||||
{
|
||||
$cityId = $this->get('cityId');
|
||||
$userCouponId = $this->get('couponId');
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$where = [
|
||||
'status' => 1,
|
||||
'type' => Biz_model::BIZ_TYPE_4s
|
||||
];
|
||||
$cityId && $where['city_id'] = $cityId;
|
||||
if ($userCouponId) {
|
||||
$userCoupon = $this->auto_user_coupon_model->get(['id'=>$userCouponId]);
|
||||
$couponBiz = $this->productCouponBiz->select(['coupon_id' => $userCoupon['couponId']], '', '', '', 'biz_id');
|
||||
$bizIds = implode(',', array_column($couponBiz, 'biz_id')) ?: 0;
|
||||
$where['id in (' . $bizIds . ')'] = null;
|
||||
}
|
||||
$list = $this->biz_model->select($where, 'id desc', 0, 0, 'id,biz_name as name');
|
||||
$data = ['list' => $list, 'count' => count($list)];
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/auto/BaseController.php';
|
||||
|
||||
class Brand extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/auto_product_model', 'autoProduct');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_cars_model');
|
||||
$this->auto_brand_model->set_db('ssdb');
|
||||
$this->auto_series_model->set_db('ssdb');
|
||||
$this->auto_cars_model->set_db('ssdb');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车品牌
|
||||
* @return void
|
||||
*/
|
||||
public function index_get()
|
||||
{
|
||||
$page = $this->get('page');
|
||||
$limit = $this->get('size');
|
||||
$where = [
|
||||
'status' => 1
|
||||
];
|
||||
$count = $this->auto_brand_model->count($where);
|
||||
$list = $this->auto_brand_model->select($where, 'id desc', $page, $limit, 'id,name');
|
||||
$data = ['list' => $list, 'count' => $count];
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车系
|
||||
* @return void
|
||||
*/
|
||||
public function series_get()
|
||||
{
|
||||
$page = $this->get('page');
|
||||
$limit = $this->get('size');
|
||||
$where = [
|
||||
'status' => 1,
|
||||
'brand_id' => $this->get('brand_id')
|
||||
];
|
||||
$count = $this->auto_series_model->count($where);
|
||||
$list = $this->auto_series_model->select($where, 'id desc', $page, $limit, 'id,name');
|
||||
$data = ['list' => $list, 'count' => $count];
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
public function cityBrand_get()
|
||||
{
|
||||
$params = $this->input_param();
|
||||
$cityId = intval($params['cityId']);
|
||||
$where = ['status' => Auto_product_model::STATUS_NORMAL];
|
||||
$where["(cityId is null or cityId={$cityId})"] = null;
|
||||
$res = $this->autoProduct->selectProduct($where, 'lc_auto_product.id desc', 1, 5, 'lc_auto_product.brandId');
|
||||
$brandIdArray = array_unique(array_column($res, 'brandId'));
|
||||
$list = [];
|
||||
if ($brandIdArray) {
|
||||
$brandIds = implode(',', $brandIdArray);
|
||||
$where = ["id in ({$brandIds})" => null];
|
||||
$list = $this->auto_brand_model->select($where, 'id desc', '', '', 'id,name');
|
||||
foreach ($list as $key => $item) {
|
||||
$list[$key]['logo'] = build_qiniu_image_url("auto/{$item['id']}.png", 100, 100);
|
||||
}
|
||||
}
|
||||
$data = ['list' => $list];
|
||||
$this->return_response($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,407 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/auto/BaseController.php';
|
||||
|
||||
class Config extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->library('Jssdk');
|
||||
$this->load->library('TcGeocoder');
|
||||
$this->load->model('area_model');
|
||||
}
|
||||
|
||||
public function wechat_get()
|
||||
{
|
||||
$url = $this->input_param('url');
|
||||
if (!$url) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$jssdk = new Jssdk();
|
||||
$sign_package = $jssdk->getSignPackage($url);
|
||||
$data = [
|
||||
'debug' => true,
|
||||
'appId' => $sign_package['appId'],
|
||||
'timestamp' => $sign_package['timestamp'], // 必填,生成签名的时间戳
|
||||
'nonceStr' => $sign_package['nonceStr'], // 必填,生成签名的随机串
|
||||
'signature' => $sign_package['signature'],// 必填,签名
|
||||
'jsApiList' => ['chooseImage', 'uploadImage', 'getLocation', 'openLocation','hideMenuItems','hideAllNonBaseMenuItem']
|
||||
];
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典数据
|
||||
* @return void
|
||||
*/
|
||||
public function dictionaryData_get()
|
||||
{
|
||||
$dictCode = $this->input_param('dictCode');
|
||||
$dictCodeArray = explode(',', $dictCode);
|
||||
if (!$dictCodeArray) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$dictCodeString = implode("','", $dictCodeArray);
|
||||
$this->load->model('agent/admin/Market_sys_dictionary_model', 'mdSysDictionary');
|
||||
$this->load->model('agent/admin/Market_sys_dictionary_data_model', 'mdSysDictionaryData');
|
||||
$re = $this->mdSysDictionary->select(['status>=' => 0, "dictCode in ('{$dictCodeString}')" => null], '', '', '', 'dictId,dictCode');
|
||||
$data = [];
|
||||
if ($re) {
|
||||
foreach ($re as $item) {
|
||||
$dictId = $item['dictId'];
|
||||
$sort_order = 'sortNumber asc,dictDataId desc';
|
||||
$where = ['status>=' => 0, 'dictId' => $dictId];
|
||||
$rows = $this->mdSysDictionaryData->select($where, $sort_order, 0, 0, 'dictDataId,dictDataName');
|
||||
$res = [];
|
||||
if ($rows) {
|
||||
foreach ($rows as $k => $v) {
|
||||
$res[$k]['id'] = intval($v['dictDataId']);
|
||||
$res[$k]['name'] = $v['dictDataName'];
|
||||
}
|
||||
}
|
||||
$data[$item['dictCode']] = $res;
|
||||
}
|
||||
}
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 经纬度获取城市和城市编码
|
||||
* @return void
|
||||
*/
|
||||
public function city_get()
|
||||
{
|
||||
$data = [
|
||||
'provinceId' => '',
|
||||
'provinceName' => '',
|
||||
'cityId' => '',
|
||||
'cityName' => '全国',
|
||||
];
|
||||
$latitude = $this->input_param('latitude');
|
||||
$longitude = $this->input_param('longitude');
|
||||
if (!$latitude || !$longitude) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$tcGeocoder = new TcGeocoder();
|
||||
$result = $tcGeocoder->reverseGeocode($latitude, $longitude);
|
||||
if (!$result) {
|
||||
$this->return_json('地址解析失败');
|
||||
}
|
||||
$adcode = $result['ad_info']['adcode'];
|
||||
$row = $this->area_model->get(['county_id' => $adcode]);
|
||||
if ($row) {
|
||||
$data = [
|
||||
'provinceId' => $row['province_id'] . '000',
|
||||
'provinceName' => $row['province_name'],
|
||||
'cityId' => $row['city_id'],
|
||||
'cityName' => $row['city_name'],
|
||||
];
|
||||
}
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
public function index_get()
|
||||
{
|
||||
$result = [
|
||||
"item_bottom" => [
|
||||
[
|
||||
"title" => "《用户须知》",
|
||||
"content" => '<h3 align="center"><strong>用户须知</strong></h3>
|
||||
<p class="MsoNormal">
|
||||
尊敬的用户:
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
欢迎使用平安好车补平台(以下简称“本平台”)。为了保障您的权益,请在参与活动前仔细阅读本须知。您点击确认或使用优惠权益即视为同意本须知的全部内容。
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
<!-- [if !supportLists]-->一、<!--[endif]--><strong>优惠权益说明</strong>
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
<strong> </strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<!--[endif]--><strong>权益获取</strong>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="MsoNormal">
|
||||
您可通过本平台活动页面领取或兑换“平安好车补”优惠权益,该权益适用于指定合作品牌、车型及经销商,具体规则以活动页面公示为准。
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
优惠权益可能以电子券、验证码等形式发放,请妥善保存,遗失不补。
|
||||
</p>
|
||||
<ul>
|
||||
<li class="MsoNormal">
|
||||
<!-- [if !supportLists]--><strong>使用规则</strong>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="MsoNormal">
|
||||
优惠权益需在有效期内使用,过期自动失效。
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
使用前请与经销商确认车型、补贴金额及所需材料(如购车合同、身份证明等),因材料不全或不符合要求导致的权益无法兑现,由用户自行承担。
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
<!-- [if !supportLists]-->二、<!--[endif]--><strong>用户义务与责任</strong>
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
<strong> </strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li class="MsoNormal">
|
||||
<!-- [if !supportLists]-->信息真实性
|
||||
</li>
|
||||
</ul>
|
||||
<p class="MsoNormal">
|
||||
您需保证参与活动时提交的所有信息(如身份信息、联系方式等)真实有效,否则本平台有权取消您的优惠资格。
|
||||
</p>
|
||||
<ul>
|
||||
<li class="MsoNormal">
|
||||
<!-- [if !supportLists]-->权益使用限制
|
||||
</li>
|
||||
</ul>
|
||||
<p class="MsoNormal">
|
||||
优惠权益不得转让、出售或用于其他商业用途,一经发现,本平台有权收回权益并追究责任。
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
若经销商拒绝兑现优惠,您可向本平台提供书面证据(如合同、沟通记录等),我们将协助核实并协调处理。
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
<strong>三、责任划分</strong>
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
<strong> 平台责任</strong>
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
本平台仅作为优惠权益的发放方,不参与您与经销商之间的购车交易,相关争议需由您与经销商协商解决。
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
因系统维护、不可抗力等原因可能导致服务暂停,本平台将提前公告,但不承担由此产生的间接损失。
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
用户责任
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
非因本平台过错导致的权益无法使用(如经销商违约、用户操作失误等),本平台不承担责任。
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
<strong>四、数据与隐私</strong>
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
您授权本平台在合法范围内收集并使用您的个人信息(如手机号、车型偏好等),以便为您提供优惠服务及后续活动通知。
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
您的信息将严格保密,仅限与合作经销商共享必要数据以核验优惠权益。
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
<strong>五、其他条款</strong>
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
法律适用:本须知受中华人民共和国法律管辖,争议提交深圳市福田区人民法院诉讼解决。
|
||||
</p>
|
||||
<p class="MsoNormal">
|
||||
条款更新:本平台有权修订须知内容,修订后将通过官网或APP公示,继续使用服务视为接受新条款。
|
||||
</p>
|
||||
<br />',
|
||||
"type" => 1
|
||||
], [
|
||||
"title" => "《隐私政策》",
|
||||
"content" => '<h3 align="center"><strong><span style="font-family: 宋体;">隐私政策</span></strong></h3>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 保护用户个人信息是平安好车补平台的核心原则。我们将按照本政策及《隐私政策》(链接:平安好车补隐私政策)的规定收集、使用、存储和分享您的个人信息。本政策未明确的条款,以《隐私政策》为准;若本政策与《隐私政策》冲突,以本政策为准。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">一、本政策的适用范围</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 适用于平安好车补通过网站、</span><span style="font-family: Calibri;">App</span><span style="font-family: 宋体;">、小程序及未来技术形态提供的车补申领、购车优惠及汽车金融服务。若关联公司使用本服务但无独立隐私政策,则本政策同样适用。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;">不适用于第三方提供的服务(如合作经销商服务),其个人信息处理规则以其说明为准。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">二、我们如何收集和使用您的个人信息</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;">1. </span><span style="font-family: 宋体;">车补申领服务</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 购车补贴申请:需提供姓名、手机号、购车发票、车辆信息,用于审核及发放补贴。拒绝提供将无法完成申领。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 优惠券领取:需提供手机号、购车意向车型,用于推送定制化优惠。拒绝提供将无法使用此功能。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 礼品寄送:需提供收件人、地址、联系电话,用于活动奖品寄送。拒绝提供将无法接收礼品。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;">2. </span><span style="font-family: 宋体;">位置服务</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 查看附近合作经销商时,需授权精准位置信息。拒绝授权将无法使用此功能。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;">3. </span><span style="font-family: 宋体;">用户权利说明</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;">以上信息均为自愿提供,拒绝提供可能影响服务使用。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;">不满</span><span style="font-family: Calibri;">14</span><span style="font-family: 宋体;">周岁用户需由法定监护人同意后方可提供信息。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;">非必要个人信息(如个性化推荐)将单独征得同意。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">三、我们如何使用</span><span style="font-family: Calibri;">Cookie</span><span style="font-family: 宋体;">和同类技术</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 为优化访问体验、保障账户安全,我们使用</span><span style="font-family: Calibri;">Cookie</span><span style="font-family: 宋体;">存储站点标识符。您可管理浏览器设置阻止</span><span style="font-family: Calibri;">Cookie</span><span style="font-family: 宋体;">,但可能导致部分功能异常。</span></p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">四、我们如何分享、转让、公开披露您的个人信息</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;">1. </span><span style="font-family: 宋体;">共享</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 仅在以下情形与第三方共享:</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 经您明确授权;为提供车补服务,与合作经销商、金融机构共享必要信息(如购车证明);</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;">履行法定义务(如配合司法机关调查)。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;">2. </span><span style="font-family: 宋体;">转让</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 仅限:合并、收购等资产转移时,要求新持有方继续受本政策约束;法律法规要求。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;">3. </span><span style="font-family: 宋体;">公开披露</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 仅在您同意或法律强制要求时进行。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">五、我们如何存储个人信息</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 存储期限:网络日志保存</span><span style="font-family: 宋体;">≥</span><span style="font-family: Calibri;">6</span><span style="font-family: 宋体;">个月;其他信息在服务必需期内保留,超期后匿名化处理。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 存储地点:中国境内,无跨境传输。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 停运处理:停止运营时将删除或匿名化您的信息。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">六、我们如何保护个人信息的安全</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 技术措施:</span><span style="font-family: Calibri;">SSL</span><span style="font-family: 宋体;">加密、权限管控、监控系统。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 管理措施:设立个人信息保护负责人;员工签署保密协议并接受安全培训;合作方需签署数据保护协议。尽管全力保障,无法承诺</span><span style="font-family: Calibri;">100%</span><span style="font-family: 宋体;">安全,重大过失导致损害将承担法律责任。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">七、个人信息的管理</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 注销账户:</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 通过客服申请,</span><span style="font-family: Calibri;">15</span><span style="font-family: 宋体;">日内处理完毕。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">八、未成年人个人信息保护</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 不面向未成年人提供服务。若发现误收未满</span><span style="font-family: Calibri;">18</span><span style="font-family: 宋体;">周岁用户信息,将立即删除。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">九、修订和通知</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 修订本政策将通过弹窗公告通知。若您不同意修改,请停止使用服务;继续使用视为接受更新。重大变更时将显著提醒。</span></p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">十、联系我们</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 个人信息问题反馈:</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 电话:</span><span style="font-family: Calibri;">400-XXX-XXXX</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 邮箱:</span><span style="font-family: Calibri;">privacy@pinganhaochebu.com</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;"> 15</span><span style="font-family: 宋体;">个工作日内回复,争议可向监管机构投诉。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">十一、附则</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 本政策适用中国法律,争议提交深圳市福田区人民法院管辖。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 政策标题仅为便于阅读,不影响条款解释。</span></p>',
|
||||
"type" => 1
|
||||
]
|
||||
],
|
||||
"allowance_bottom" => [
|
||||
[
|
||||
"title" => "《车主信息共享授权书》",
|
||||
"content" => '<h3 align="center"><strong><span style="font-family: 宋体;">车主信息共享授权书</span></strong></h3>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">车主信息授权</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 本人授权中国平安财产保险股份有限公司(以下简称</span><span style="font-family: 宋体;">“平安产险”)使用本授权书项下共享的个人信息,以便享受平安产险提供的专属车险服务及相关权益(如适用)。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">信息授权协议</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 【平安好车补平台】(由中国平安财产保险股份有限公司运营,以下称为</span><span style="font-family: 宋体;">“我们”)致力于保护您的个人信息及隐私安全。为了向您提供更为优质便捷的服务(例如:车险续保优惠、专属保险咨询、特定权益领取等),在您使用“平安好车补”平台相关功能与</span><span style="font-family: Calibri;">/</span><span style="font-family: 宋体;">或服务时,为了实现车主身份认证及获取相关服务与权益的目的,我们会将您提供的、与实现上述目的相关的个人信息共享给我们的关联公司中国平安财产保险股份有限公司(以下称为“数据接收方”)。请您结合《平安好车补隐私政策》阅读本授权书。您应当在仔细阅读、充分理解本授权书及其所包含的所有内容后选择是否授权我们将您的个人信息进行共享。您勾选同意本授权书即代表您已充分理解并同意其全部内容。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">一、</span> <span style="font-family: 宋体;">我们共享的个人信息类型、目的与期限</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 共享的个人信息种类:</span> <span style="font-family: 宋体;">当您完成授权时,我们与数据接收方共享的您的个人信息种类包括:</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;"> (1) </span><span style="font-family: 宋体;">车辆品牌</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;"> (2) </span><span style="font-family: 宋体;">车辆识别码(</span><span style="font-family: Calibri;">VIN</span><span style="font-family: 宋体;">)</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;"> (3) </span><span style="font-family: 宋体;">发动机号</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;"> (4) </span><span style="font-family: 宋体;">您的手机号码</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;"> (5) </span><span style="font-family: 宋体;">购车发票开票日期</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;"> (6) </span><span style="font-family: 宋体;">购车人姓名</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;"> (7) </span><span style="font-family: 宋体;">购车城市</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;"> (8) </span><span style="font-family: 宋体;">车型名称</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;"> (9) </span><span style="font-family: 宋体;">其他为实现服务目的所必需且在您提交资料时明确告知的信息(例如:行驶证信息、车牌号等,具体根据您申请的服务类型确定)。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 共享目的:</span> <span style="font-family: 宋体;">我们将您的个人信息共享给数据接收方的主要目的是:向您提供车辆保险(尤其是续保)报价、投保及相关咨询服务。为您提供与车辆相关的其他专属保险产品及服务信息。核验您的车主身份,以便您获取通过</span><span style="font-family: 宋体;">“平安好车补”平台申请的特定权益(如优惠券、服务包等)。提升服务质量,进行必要的业务处理与风险控制。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 共享期限:</span> <span style="font-family: 宋体;">在遵从相关法律法规的前提下,个人信息共享的期限自您点击同意本授权书之时起,至您撤回该授权时止,或至实现本授权书所述共享目的所必需的最短时间止(以较早者为准)。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;">请您知悉:</span> <span style="font-family: 宋体;">如果您选择撤回该授权,不会影响您正常使用</span><span style="font-family: 宋体;">“平安好车补”平台的其他功能与</span><span style="font-family: Calibri;">/</span><span style="font-family: 宋体;">或服务。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 共享方式与安全:</span> <span style="font-family: 宋体;">我们会通过安全加密的网络专线或其他符合法律法规及行业标准的安全渠道将您的个人信息共享给数据接收方,并按照《平安好车补隐私政策》所述的严格安全措施和技术手段保障信息传输与处理过程的安全。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">二、</span> <span style="font-family: 宋体;">数据接收方的名称与联络方式</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 数据接收方:</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 名称:中国平安财产保险股份有限公司</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 联系方式:平安官方客服电话</span> <span style="font-family: Calibri;">95511</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 我们的承诺:</span> <span style="font-family: 宋体;">我们会以高度的勤勉义务保护您的个人信息安全。除本授权书明确列明的情形外,未经您另行明确授权同意,我们不会在未告知您的情况下,与任何其他公司、组织或个人共享本授权书所列明的您的个人信息。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">三、</span> <span style="font-family: 宋体;">您的权利</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 您有权向我们和数据接收方行使以下与您个人信息相关的权利:</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 知情权与决定权:</span> <span style="font-family: 宋体;">您有权了解我们如何处理您的个人信息,并有权限制或拒绝我们及数据接收方对您的个人信息进行处理。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 查阅权与复制权:</span> <span style="font-family: 宋体;">您有权向我们请求查阅、复制我们持有的您的个人信息。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 更正权与补充权:</span> <span style="font-family: 宋体;">您有权核实您的个人信息,并在发现信息有错误或不完整时,要求我们及时更正或补充。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 撤回同意权:您有权随时向我们撤回您对我们向数据接收方共享您的个人信息的授权。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 您可以通过联系本授权书第五条(联系我们)</span> <span style="font-family: 宋体;">提供的方式(如客服热线)向我们提出撤回</span> <span style="font-family: 宋体;">授权申请。我们将在收到请求并验证您的身份后尽快处理。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 删除权:</span> <span style="font-family: 宋体;">在以下情形发生时,您有权请求我们删除您的个人信息:</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;"> (1) </span><span style="font-family: 宋体;">您已撤回对我们向数据接收方共享您的个人信息的授权,且该信息不再为实现其他合法目的所必需;</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;"> (2) </span><span style="font-family: 宋体;">我们违反法律法规规定或违反本授权书的约定处理您的个人信息;</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: Calibri;"> (3) </span><span style="font-family: 宋体;">法律法规规定的其他应当删除的情形。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 解释说明权:</span> <span style="font-family: 宋体;">您有权要求我们对您的个人信息处理规则进行解释说明。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;">关于向第三方行使权利的说明:</span> <span style="font-family: 宋体;">本授权书项下数据接收方为我们的关联公司。若您需要直接向数据接收方(中国平安财产保险股份有限公司)主张上述权利,您可以通过其官方客服电话</span> <span style="font-family: Calibri;">95511 </span><span style="font-family: 宋体;">进行联系。我们将根据法律法规要求,在必要范围内协助您与数据接收方沟通。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">四、</span> <span style="font-family: 宋体;">授权书的修订与更新</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 我们保留根据业务发展、法律法规变化等需要,适时修订和</span><span style="font-family: Calibri;">/</span><span style="font-family: 宋体;">或更新本授权书的权利。更新后的授权书将在生效后构成本授权书的最新版本。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;">对于本授权书的重大变更,我们将通过平台公告、推送通知、弹窗提示或其他显著方式向您告知。若您在本授权书更新生效后继续使用相关服务,即表示您已充分阅读、理解并同意接受更新后的授权书内容。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;">请您知悉:</span> <span style="font-family: 宋体;">如果您选择不同意更新后的授权书,可能影响您继续使用本授权书所涉及的相关服务功能,但不会影响您正常使用</span><span style="font-family: 宋体;">“平安好车补”平台的其他功能与</span><span style="font-family: Calibri;">/</span><span style="font-family: 宋体;">或服务。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">五、</span> <span style="font-family: 宋体;">联系我们</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 如您对本授权书有任何疑问、意见、建议,或需要行使您的个人信息相关权利(特别是撤回授权、查询、更正、删除等),您可以通过以下方式联系我们的个人信息保护负责人或客服部门:</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 平安产险客服</span> <span style="font-family: Calibri;">95511 </span><span style="font-family: 宋体;">转接咨询或通过“平安好车补”平台内提供的在线客服、意见反馈渠道联系我们。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 我们将在收到您的请求并验证您的身份后的</span> <span style="font-family: Calibri;">15 </span><span style="font-family: 宋体;">个工作日 内予以回复。对于复杂请求或法律法规规定的情形,回复时间可能相应延长,但我们会及时告知您延期原因。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;">如果您对我们的回复不满意,或认为我们对您个人信息的处理侵害了您的合法权益,您还可以向相关监管机构(如网信部门、工信部门、消协等)进行投诉或举报。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">六、</span> <span style="font-family: 宋体;">附则</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 法律适用与争议解决:</span> <span style="font-family: 宋体;">本授权书的订立、效力、解释、履行及争议解决均适用中华人民共和国大陆地区法律(不包括冲突法)。因本授权书引起的或与本授权书有关的任何争议,双方应首先友好协商解决;协商不成的,您同意将争议提交至</span> <span style="font-family: 宋体;">中国平安财产保险股份有限公司主要办事机构所在地(深圳市)有管辖权的人民法院</span> <span style="font-family: 宋体;">诉讼解决。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 条款可分性:</span> <span style="font-family: 宋体;">如果本授权书的任何条款被有管辖权的法院认定为无效或不可执行,该条款将尽可能按可执行且反映双方原意的宗旨进行解释,其余条款仍继续有效。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 标题:</span> <span style="font-family: 宋体;">本授权书中的标题仅为方便阅读而设,不影响任何条款的含义或解释。</span></p>',
|
||||
"type" => 1
|
||||
], [
|
||||
"title" => "《车主服务个人信息保护声明》",
|
||||
"content" => '<h3 align="center"><strong><span style="font-family: 宋体;">车主服务个人信息保护声明</span></strong></h3>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">特别提示:</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 平安好车补车主服务是平安集团推出的面向使用平安好车补产品与</span><span style="font-family: Calibri;">/</span><span style="font-family: 宋体;">或服务的车主的专属服务。本服务严格遵循平安集团保护用户个人信息的基本原则,承诺不会通过任何渠道非法泄露您的个人信息,请您放心上传相关认证资料。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 平安好车补车主服务将按照本声明及平安集团《隐私政策》的规定收集、使用、储存和分享您的个人信息。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 本声明对个人信息保护规定的内容与上述《隐私政策》有相冲突的,及本声明对个人信息保护相关内容未作明确规定的,均以《隐私政策》的内容为准。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">一、个人信息的收集</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 我们收集您的个人信息的最终目的是为了为您提供便捷、高效的车险相关服务(如理赔协助、优惠信息、服务提醒等),优化并丰富您的用户体验。这些个人信息是能够单独或者与其他信息结合识别您的个人身份的信息,包括:</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> ① 车辆相关证件信息照片(例如行驶证照片,其中可能包含:车主姓名、车牌号、车辆识别码、发动机号、注册日期等);</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> ② 身份证明信息照片(例如驾驶证或身份证照片,其中包含姓名、证件号码等);</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> ③ 手机号;</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> ④ 车辆保险信息(如保单号、保险公司、险种等,用于服务匹配)。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;">(注:具体收集信息项可能根据服务功能调整,以页面实际要求为准)</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 以上个人信息均是您自愿提供。您有权拒绝提供,但如果您拒绝提供某些必要的个人信息,</span> <span style="font-family: 宋体;">您将可能无法使用我们提供的特定服务,或者可能对您使用服务的完整性和体验造成影响。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 平安好车补车主服务主要面向年满</span><span style="font-family: Calibri;">18</span><span style="font-family: 宋体;">周岁的车主用户。我们原则上不主动收集未成年人的个人信息。如果存在特殊情形需要处理未成年人的信息,我们将在获得其监护人的明确同意后,依法合规进行。</span></p>
|
||||
<p class="MsoNormal"><strong> </strong></p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">二、个人信息的使用和分享</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 您同意,平安好车补车主服务可以通过以下方式对个人信息进行使用和分享(包含对于个人信息的存储和处理):</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 为您提供服务:</span> <span style="font-family: 宋体;">使用您提供的信息进行身份验证、匹配保险信息、处理理赔申请、提供相关服务咨询与支持、发送服务状态通知等;</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 服务优化与沟通:</span> <span style="font-family: 宋体;">为提升服务质量,我们可能在必要时使用您的信息进行内部分析;同时,</span> <span style="font-family: 宋体;">我们可能定期或不定期向您发送与服务相关的信息(如服务更新、优惠活动、满意度调研等),您同意接收上述信息;</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 必要的共享:</span> <span style="font-family: 宋体;">为履行服务目的,在法律法规允许且必要的范围内,您的个人信息可能会与平安集团内的关联公司以及提供车险服务的合作保险公司进行共享,以便为您提供更完善的车险相关服务。我们将严格要求接收方按照本声明及我们的指示处理您的个人信息,并采取必要的保密措施。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 您同意免除上述个人信息的接收和</span><span style="font-family: Calibri;">/</span><span style="font-family: 宋体;">或使用方在按照本声明所述授权情形下进行信息披露和使用而导致的或可能导致的所有索赔、责任和损失(因接收方</span><span style="font-family: Calibri;">/</span><span style="font-family: 宋体;">使用方故意或重大过失造成的除外)。</span></p>
|
||||
<p class="MsoNormal"> </p>
|
||||
<p class="MsoNormal"><strong><span style="font-family: 宋体;">三、更正或投诉</span></strong></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 我们致力于保障您个人信息的安全与准确。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 查询、修改或更正:</span> <span style="font-family: 宋体;">如果您需要查询、修改或更正您在平安好车补服务中提交的个人信息,您可以通过平安好车补</span><span style="font-family: Calibri;">APP</span><span style="font-family: 宋体;">或小程序内的相关功能进行操作,或联系客服协助。</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 疑问或投诉:</span> <span style="font-family: 宋体;">如果您对平安好车补车主服务的个人信息保护有任何疑问、建议或投诉,您可以通过以下方式联系我们:</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 客服热线:平安统一客服热线</span> <span style="font-family: Calibri;">95511 (</span><span style="font-family: 宋体;">请根据语音提示选择相应服务</span><span style="font-family: Calibri;">)</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 在线客服:</span> <span style="font-family: 宋体;">通过平安好车补</span><span style="font-family: Calibri;">APP</span><span style="font-family: 宋体;">或小程序内的在线客服功能</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 邮件:</span> <span style="font-family: Calibri;">(</span><span style="font-family: 宋体;">可补充官方指定邮箱,例如:</span><span style="font-family: Calibri;">privacy@pingan.com)</span></p>
|
||||
<p class="MsoNormal"><span style="font-family: 宋体;"> 我们将尽快响应您的请求。</span></p>',
|
||||
"type" => 1
|
||||
]
|
||||
],
|
||||
"allowance_invoice" => [
|
||||
"title" => "查看示例",
|
||||
"content" => "https://img.liche.cn/space/agent/admin/202506/p_2d71a58d31a5733a219d1529c3a4553d.png",
|
||||
"type" => 2
|
||||
],
|
||||
"allowance_insuranc" => [
|
||||
"title" => "查看示例",
|
||||
"content" => "https://img.liche.cn/space/agent/admin/202506/p_760ad21bfc51e60a6ebfb7db0d9dd9c9.jpg",
|
||||
"type" => 2
|
||||
]
|
||||
];
|
||||
$this->return_response($result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/auto/BaseController.php';
|
||||
|
||||
class Home extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index_get()
|
||||
{
|
||||
$this->return_response('欢迎使用');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/auto/BaseController.php';
|
||||
|
||||
class Login extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index_post()
|
||||
{
|
||||
$path = 'login';
|
||||
try {
|
||||
$this->load->config('wechat');
|
||||
$config = $this->config->item('default');
|
||||
$code = $this->input_param('code');
|
||||
$accountId = $this->input_param('accountId');
|
||||
if (!$code) {
|
||||
throw new Exception('参数错误');
|
||||
}
|
||||
$auth_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$config['appid']}&secret={$config['appSecret']}&code={$code}&grant_type=authorization_code";
|
||||
$res = file_get_contents($auth_url);
|
||||
$ret = json_decode($res, true);
|
||||
if (!$ret || !$ret['openid']) {
|
||||
debug_log("[error]# " . $res, $path);
|
||||
throw new Exception($ret['errmsg'] ?: '获取授权码失败');
|
||||
}
|
||||
$access_token = $ret['access_token'];
|
||||
$openid = $ret['openid'];
|
||||
$otherInfo = [
|
||||
'unionid' => $ret['unionid'] ?: '',
|
||||
];
|
||||
if ($access_token) {
|
||||
$u_info_url = "https://api.weixin.qq.com/sns/userinfo?access_token={$access_token}&openid={$openid}&lang=zh_CN";
|
||||
$u_ret = file_get_contents($u_info_url);
|
||||
$ret = json_decode($u_ret, true);
|
||||
$otherInfo['nickname'] = $ret['nickname'] ?: '';
|
||||
$otherInfo['headimg'] = $ret['headimgurl'] ?: '';
|
||||
}
|
||||
|
||||
/** @var MyResponse $response */
|
||||
$response = $this->autoUserModel->initUser($ret['openid'], $accountId, $otherInfo);
|
||||
if (!$response->isSuccess()) {
|
||||
$this->return_json($response->getMessage());
|
||||
}
|
||||
$responseData = $response->getData();
|
||||
$data = [
|
||||
'Authorization' => Authorization::generateToken($responseData['id'], 'jwt_key_auto'),
|
||||
];
|
||||
$this->return_response($data, API_CODE_SUCCESS);
|
||||
} catch (Exception $e) {
|
||||
$this->return_json($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/auto/BaseController.php';
|
||||
|
||||
class Sms extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取短信验证码
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function index_post()
|
||||
{
|
||||
$mobile = $this->post('mobile');
|
||||
$type = $this->input_param('type');//验证码类型
|
||||
if (!mobile_valid($mobile)) {
|
||||
$this->return_json('请输入正确手机号');
|
||||
}
|
||||
!$type && $type = self::CODE_BM;
|
||||
$cacheKey = '';
|
||||
switch ($type) {
|
||||
case self::CODE_BM:
|
||||
$cacheKey = $this->getCodeCacheKey(self::CODE_BM, $mobile);
|
||||
break;
|
||||
case self::CODE_BANK:
|
||||
$cacheKey = $this->getCodeCacheKey(self::CODE_BANK, $mobile);
|
||||
break;
|
||||
default:
|
||||
$this->return_json('验证码类型错误');
|
||||
}
|
||||
$redis = &load_cache();
|
||||
// $key = $this->getCodeCacheKey(self::CODE_BM, $mobile);
|
||||
if (!$redis->get($cacheKey)) {
|
||||
$this->load->helper('string');
|
||||
$code = random_string('numeric', 4);
|
||||
$content = "【" . HDY_SMS_SIGN . "】" . "您的验证码为:{$code},请勿泄露于他人!";
|
||||
b2m_send_sms($mobile, $content);
|
||||
$redis->save($cacheKey, $code, 600);
|
||||
}
|
||||
$this->return_response([], '发送成功');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/auto/BaseController.php';
|
||||
|
||||
class Subsidy extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('area_model');
|
||||
$this->load->model('agent/auto_user_coupon_model');
|
||||
$this->load->model('agent/receiver_order_subsidy_model');
|
||||
$this->load->model('receiver/order/receiver_orders_model');
|
||||
$this->load->model("biz/biz_model");
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->auto_brand_model->set_db('ssdb');
|
||||
$this->auto_series_model->set_db('ssdb');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$this->receiver_orders_model->set_db('ssdb');
|
||||
}
|
||||
|
||||
public function index_post()
|
||||
{
|
||||
try {
|
||||
$params = $this->post();
|
||||
$couponId = $params['couponId'];
|
||||
/** @var AutoUserCouponEntity $userCoupon */
|
||||
$userCoupon = $this->auto_user_coupon_model->get(['id' => $couponId, 'userId' => $this->userId], '', 'AutoUserCouponEntity');
|
||||
if (!$userCoupon) {
|
||||
throw new Exception('优惠券不存在');
|
||||
}
|
||||
$result = $userCoupon->useCoupon($params);
|
||||
if (!$result->isSuccess()) {
|
||||
throw new Exception($result->getMessage());
|
||||
}
|
||||
$this->return_response();
|
||||
} catch (Exception $e) {
|
||||
$this->return_json($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改审核资料
|
||||
* @return void
|
||||
*/
|
||||
public function index_put()
|
||||
{
|
||||
$params = $this->input_param();
|
||||
$row = $this->receiver_order_subsidy_model->get(['id' => $params['id'], 'userId' => $this->userId]);
|
||||
if (!$row) {
|
||||
$this->return_json("数据不存在");
|
||||
}
|
||||
$update = [
|
||||
'billImg' => $params['billImg'] ?: '',
|
||||
'businessImg' => $params['businessImg'] ?: '',
|
||||
'ifcheck' => Receiver_order_subsidy_model::IF_CHECK_NO
|
||||
];
|
||||
$result = $this->receiver_order_subsidy_model->update($update, ['id' => $params['id']]);
|
||||
if (!$result) {
|
||||
$this->return_json("保存失败");
|
||||
}
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* 补贴详情
|
||||
* @return void
|
||||
*/
|
||||
public function detail_get()
|
||||
{
|
||||
$id = $this->input_param('id');
|
||||
$row = $this->receiver_order_subsidy_model->get(['id' => $id, 'userId' => $this->userId]);
|
||||
if (!$row) {
|
||||
$this->return_json("参数错误");
|
||||
}
|
||||
$userCoupon = $this->auto_user_coupon_model->get(['couponId' => $row['couponId'], 'userId' => $this->userId]);
|
||||
$order = $this->receiver_orders_model->get(['id' => $row['orderId']]);
|
||||
$cityRow = $this->area_model->get(['city_id' => $row['cityId']]);
|
||||
$rowBiz = $this->biz_model->get(array('id' => $row['bizId']));
|
||||
$brand = $this->auto_brand_model->get(['id' => $row['brandId']], 'name');
|
||||
$series = $this->auto_series_model->get(['id' => $row['seriesId']], 'name');
|
||||
$insuranceFile = [];
|
||||
if ($row['businessImg']) {
|
||||
$insuranceFile[] = ['url' => $row['businessImg'] ? build_qiniu_image_url($row['businessImg']) : ''];
|
||||
}
|
||||
$data = [
|
||||
'mobile' => mobile_asterisk($userCoupon['mobile']),
|
||||
'name' => $order['name'],
|
||||
'city' => $cityRow['province_name'] . '/' . $cityRow['city_name'],
|
||||
'cityId' => $row['cityId'],
|
||||
'store' => $rowBiz['biz_name'],
|
||||
'storeId' => $rowBiz['id'],
|
||||
'model' => "{$brand['name']} {$series['name']}",
|
||||
'brandId' => $row['brandId'],
|
||||
'seriesId' => $row['seriesId'],
|
||||
'invoiceFile' => [
|
||||
['url' => $row['billImg'] ? build_qiniu_image_url($row['billImg']) : '']
|
||||
],
|
||||
'invoiceUrl' => $row['billImg'] ?: '',
|
||||
'insuranceFile' => $insuranceFile,
|
||||
'insuranceUrl' => $row['businessImg'] ?: '',
|
||||
'reason' => Receiver_order_subsidy_model::IF_CHECK_NO_PASS ? $row['reason'] : '',
|
||||
];
|
||||
$this->return_response($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/auto/BaseController.php';
|
||||
|
||||
class Ucenter extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('area_model');
|
||||
$this->load->model('agent/receiver_order_subsidy_model');
|
||||
$this->load->model('agent/auto_user_coupon_model');
|
||||
$this->load->model('agent/auto_user_data_model');
|
||||
$this->load->model('agent/auto_product_coupon_model');
|
||||
$this->load->model('agent/auto_product_model');
|
||||
$this->load->model('receiver/order/receiver_orders_model');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_cars_model');
|
||||
$this->load->model("biz/biz_model");
|
||||
$this->load->model('receiver/receiver_clues_model', 'clues_model');
|
||||
$this->receiver_orders_model->set_db('ssdb');
|
||||
$this->auto_brand_model->set_db('ssdb');
|
||||
$this->auto_series_model->set_db('ssdb');
|
||||
$this->auto_cars_model->set_db('ssdb');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$this->clues_model->set_db('ssdb');
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户中心
|
||||
* @return void
|
||||
*/
|
||||
public function index_get()
|
||||
{
|
||||
$user = $this->autoUserModel->get(['id' => $this->userId]);
|
||||
$data = [
|
||||
'user_info' => ['username' => $user['nickname'], 'avatar' => $user['headimg']],
|
||||
'menu_list' => [
|
||||
['title' => '我的券', 'type' => 1, 'url' => '/my/coupon'],
|
||||
// ['title' => '我的订单', 'type' => 1, 'url' => '/my/order'],
|
||||
['title' => '我的补贴', 'type' => 1, 'url' => '/my/allowance'],
|
||||
['title' => '我的账户', 'type' => 1, 'url' => '/my/bank'],
|
||||
['title' => '我的客服', 'type' => 2, 'url' => self::SERVICE_PHONE]
|
||||
]
|
||||
];
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 优惠券列表
|
||||
* @return void
|
||||
*/
|
||||
public function coupons_get()
|
||||
{
|
||||
$page = $this->get('page');
|
||||
$limit = $this->get('size');
|
||||
$list = [];
|
||||
$where = [
|
||||
'userId' => $this->userId,
|
||||
];
|
||||
$count = $this->auto_user_coupon_model->count($where);
|
||||
/** @var AutoUserCouponEntity[] $rows */
|
||||
$rows = $this->auto_user_coupon_model->select($where, 'id desc', $page, $limit, '', 'AutoUserCouponEntity');
|
||||
if ($count) {
|
||||
foreach ($rows as $v) {
|
||||
/** @var AutoProductCouponEntity $autoProductCouponEntity */
|
||||
$autoProductCouponEntity = $this->auto_product_coupon_model->get(['id' => $v->couponId], '', 'AutoProductCouponEntity');
|
||||
$list[] = [
|
||||
'id' => $v->id,
|
||||
'sid' => $v->sid,
|
||||
'couponId' => $v->couponId,
|
||||
'title' => $v->title,
|
||||
'price' => intval($v->price),
|
||||
'timeStart' => date('Y-m-d', strtotime($v->timeStart)),
|
||||
'timeEnd' => date('Y-m-d', strtotime($v->timeEnd)),
|
||||
'rule' => $autoProductCouponEntity->rule,
|
||||
'bizTip' => $v->getBizName(),
|
||||
'typeCn' => '好车补专项补贴',
|
||||
'btText' => $v->getBtText(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$data = ['list' => $list, 'count' => $count, 'show' => 0];
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的订单
|
||||
* @return void
|
||||
*/
|
||||
public function orders_get()
|
||||
{
|
||||
$page = $this->get('page');
|
||||
$limit = $this->get('size');
|
||||
$userCoupons = $this->auto_user_coupon_model->select(['userId' => $this->userId], 'id desc', 0, 0, 'DISTINCT mobile');
|
||||
$mobileList = implode("','", array_column($userCoupons, 'mobile'));
|
||||
$where = [
|
||||
"mobile in ('{$mobileList}')" => null
|
||||
];
|
||||
$count = $this->receiver_orders_model->count($where);
|
||||
$list = [];
|
||||
if ($count) {
|
||||
$rows = $this->receiver_orders_model->select($where, 'id desc', $page, $limit);
|
||||
foreach ($rows as $item) {
|
||||
$clues = $this->clues_model->get(['id' => $item['clue_id']]);
|
||||
/** @var AutoProductEntity $product */
|
||||
$product = '';
|
||||
if ($clues) {
|
||||
$product = $this->auto_product_model->get(['id' => $clues['out_id']], '', 'AutoProductEntity');
|
||||
}
|
||||
$temp = [
|
||||
'id' => $item['id'],
|
||||
'sid' => $item['sid'],
|
||||
'title' => $product->title ?: '',
|
||||
'logo' => $product ? $product->getFirstBanner() : '',
|
||||
'guide_price' => $product ? $product->guide_price : '',
|
||||
'bill_price' => '0',
|
||||
'status' => $item['status'] == 3 ? '已提车' : '进行中',
|
||||
];
|
||||
$list[] = $temp;
|
||||
}
|
||||
}
|
||||
$data = ['list' => $list, 'count' => $count, 'show' => 0];
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 补贴列表
|
||||
* @return void
|
||||
*/
|
||||
public function subsidy_get()
|
||||
{
|
||||
$page = $this->get('page');
|
||||
$limit = $this->get('size');
|
||||
$where = [
|
||||
'userId' => $this->userId
|
||||
];
|
||||
$count = $this->receiver_order_subsidy_model->count($where);
|
||||
$list = [];
|
||||
if ($count) {
|
||||
$userCardInfo = $this->auto_user_data_model->get(['userId' => $this->userId]);
|
||||
$rows = $this->receiver_order_subsidy_model->select($where, 'id desc', $page, $limit);
|
||||
foreach ($rows as $item) {
|
||||
$order = $this->receiver_orders_model->get(['id' => $item['orderId']]);
|
||||
|
||||
$userCoupon = $this->auto_user_coupon_model->get(['userId' => $item['userId'], 'couponId' => $item['couponId']]);
|
||||
$product = $this->auto_product_model->get(['id' => $userCoupon['productId']], '', 'AutoProductEntity');
|
||||
$row_biz = $this->biz_model->get(array('id' => $item['bizId']));
|
||||
$cityRow = $this->area_model->get(['city_id' => $item['cityId']]);
|
||||
$brand = $this->auto_brand_model->get(['id' => $item['brandId']], 'name');
|
||||
$series = $this->auto_series_model->get(['id' => $item['seriesId']], 'name');
|
||||
$brand_name = $brand['name'];
|
||||
$s_name = $series['name'];
|
||||
$car_name = $brand_name . '—' . $s_name;
|
||||
$step = $item['ifcheck'] == Receiver_order_subsidy_model::IF_CHECK_YES ? 3 : 2;
|
||||
$checkName = '系统审核';
|
||||
$showBtn = 0;
|
||||
if ($item['ifcheck'] == Receiver_order_subsidy_model::IF_CHECK_NO_PASS) {
|
||||
$checkName = '审核未通过';
|
||||
$showBtn = 1;
|
||||
}
|
||||
$temp = [
|
||||
'id' => $item['id'],
|
||||
'sid' => $order['sid'],
|
||||
'title' => $product ? $product->title : '',
|
||||
'logo' => $product ? $product->getFirstBanner() : '',
|
||||
'price' => $userCoupon['price'] ? intval($userCoupon['price']) . '元' : 0,
|
||||
'biz' => $row_biz['biz_name'],
|
||||
'city' => $cityRow['city_name'],
|
||||
'car' => "{$car_name}",
|
||||
'step' => $step,
|
||||
'progress' => [
|
||||
'完成订单', '提交资料', $checkName, '补贴发放'
|
||||
],
|
||||
'btn_info' => [
|
||||
'id' => $item['id'],
|
||||
'show' => $showBtn,
|
||||
],
|
||||
'bind_btn_info' => [
|
||||
'tip' => '您的现金补贴已审核通过,绑定银行卡等待系统发放',
|
||||
'show' => $item['ifcheck'] == Receiver_order_subsidy_model::IF_CHECK_YES ? 1 : 0,
|
||||
'btText' => $userCardInfo ? '我的银行卡' : '立即绑定',
|
||||
],
|
||||
'reason' => $item['reason']
|
||||
];
|
||||
$list[] = $temp;
|
||||
}
|
||||
}
|
||||
$data = ['list' => $list, 'count' => $count, 'show' => 0];
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
|
||||
public function couponDetail_get()
|
||||
{
|
||||
$id = $this->get('id');
|
||||
$userCoupon = $this->auto_user_coupon_model->get(['id' => $id, 'userId' => $this->userId]);
|
||||
$data = [
|
||||
'mobile' => mobile_asterisk($userCoupon['mobile'])
|
||||
];
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
public function cardInfo_get()
|
||||
{
|
||||
$row = $this->auto_user_data_model->get(['userId' => $this->userId]);
|
||||
$data = ['mobile' => '', 'bankCardNum' => '', 'bankName' => '', 'bankFile' => []];
|
||||
if ($row) {
|
||||
$data['id'] = $row['id'];
|
||||
$data['mobile'] = mobile_asterisk($row['bankMobile']);
|
||||
$data['bankCardNum'] = $row['bankCardNum'];
|
||||
$data['bankName'] = $row['bankName'];
|
||||
$data['bankFile'] = [
|
||||
['url' => $row['bankImg'] ? build_qiniu_image_url($row['bankImg']) : '', 'deletable' => false]
|
||||
];
|
||||
if (strlen($data['bankCardNum']) > 8) {
|
||||
$data['bankCardNum'] = substr($data['bankCardNum'], 0, 4) . '*******' . substr($data['bankCardNum'], -4);
|
||||
}
|
||||
}
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
public function cardInfo_post()
|
||||
{
|
||||
try {
|
||||
$params = $this->post();
|
||||
$row = $this->auto_user_data_model->get(['userId' => $this->userId]);
|
||||
if ($row) {
|
||||
$this->return_json('您已绑定银行卡,修改请联系客服');
|
||||
}
|
||||
if (!$params['bankCardNum'] || !$params['mobile'] || !$params['bankName']
|
||||
|| !$params['bankName'] || !$params['bankUrl'] || !$params['code']) {
|
||||
$this->return_json('请填写完整信息');
|
||||
}
|
||||
//验证码验证
|
||||
$cacheKey = $this->getCodeCacheKey(self::CODE_BANK, $params['mobile']);
|
||||
$redis = &load_cache();
|
||||
$code = $redis->get($cacheKey);
|
||||
if (!$code || $code != $params['code']) {
|
||||
$this->return_json('验证码错误');
|
||||
}
|
||||
$data = [
|
||||
'userId' => $this->userId,
|
||||
'bankCardNum' => $params['bankCardNum'],
|
||||
'bankName' => $params['bankName'],
|
||||
'bankImg' => $params['bankUrl'],
|
||||
'bankMobile' => $params['mobile'],
|
||||
'createTime' => date('Y-m-d H:i:s')
|
||||
];
|
||||
$this->auto_user_data_model->add($data);
|
||||
$this->return_response();
|
||||
} catch (Exception $e) {
|
||||
$this->return_json($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/auto/BaseController.php';
|
||||
|
||||
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,'/');
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/auto/BaseController.php';
|
||||
|
||||
class Brand extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index_get()
|
||||
{
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->mdAutoBrand->set_db('ssdb');
|
||||
$where = [
|
||||
'status' => 1,
|
||||
];
|
||||
$list = $this->mdAutoBrand->select($where, 'initial asc', 0, 0, 'id,initial,name');
|
||||
$data = [];
|
||||
if ($list) {
|
||||
foreach ($list as $item) {
|
||||
$item['logo'] = build_qiniu_image_url("auto/{$item['id']}.png", 100, 100);
|
||||
$data[$item['initial']][] = $item;
|
||||
}
|
||||
}
|
||||
foreach (range('A', 'Z') as $letter) {
|
||||
if (!isset($data[$letter])) {
|
||||
$data[$letter] = [];
|
||||
}
|
||||
}
|
||||
ksort($data);
|
||||
$this->return_response($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/auto/BaseController.php';
|
||||
|
||||
class Coupon extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/auto_product_coupon_biz_model', 'productCouponBiz');
|
||||
$this->load->model('agent/auto_user_coupon_model');
|
||||
}
|
||||
|
||||
/**
|
||||
* 报名领取优惠券
|
||||
* @return void
|
||||
*/
|
||||
public function index_post()
|
||||
{
|
||||
try {
|
||||
if (!$this->userId) {
|
||||
throw new Exception("请先登录");
|
||||
}
|
||||
$couponId = $this->post('couponId');
|
||||
$mobile = $this->post('mobile');
|
||||
$code = $this->post('code');
|
||||
if (!$couponId || !$mobile || !$code) {
|
||||
throw new Exception("参数错误");
|
||||
}
|
||||
//校验验证码
|
||||
$redis = &load_cache();
|
||||
$key = $this->getCodeCacheKey(self::CODE_BM, $mobile);
|
||||
$cacheCode = $redis->get($key);
|
||||
if (!$cacheCode || $cacheCode != $code) {
|
||||
throw new Exception("验证码错误");
|
||||
}
|
||||
$result = $this->auto_user_coupon_model->getCoupon(self::APP_ID, $this->userId, $couponId, $mobile);
|
||||
if (!$result->isSuccess()) {
|
||||
throw new Exception($result->getMessage());
|
||||
}
|
||||
$redis->delete($key);
|
||||
$this->return_response([], '领取成功');
|
||||
} catch (Exception $e) {
|
||||
$this->return_json($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 适用门店
|
||||
* @return void
|
||||
*/
|
||||
public function bizs_get()
|
||||
{
|
||||
$couponId = $this->get('couponId');
|
||||
$provinceId = $this->get('provinceId');
|
||||
$cityId = $this->get('cityId');
|
||||
$page = $this->get('page');
|
||||
$size = $this->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 10;
|
||||
if (!$couponId) {
|
||||
$this->return_json('优惠券ID不能为空');
|
||||
}
|
||||
$couponRows = $this->productCouponBiz->select(['coupon_id' => $couponId], '', '', '', 'biz_id');
|
||||
$bizIds = implode(',', array_column($couponRows, 'biz_id')) ?: 0;
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->biz_model->set_db('ssdb');
|
||||
$where = [
|
||||
'status' => 1,
|
||||
"id in ($bizIds)" => null
|
||||
];
|
||||
$provinceId && $where['province_id'] = $provinceId;
|
||||
$cityId && $where['city_id'] = $cityId;
|
||||
$count = $this->biz_model->count($where);
|
||||
$list = [];
|
||||
if ($count) {
|
||||
$list = $this->biz_model->select($where, 'id desc', $page, $size, 'id,biz_name,address,lat,lng');
|
||||
}
|
||||
$data = [
|
||||
'total' => $count,
|
||||
'list' => $list
|
||||
];
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/auto/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');
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品列表
|
||||
* @return void
|
||||
*/
|
||||
public function list_get()
|
||||
{
|
||||
$params = $this->input_param();
|
||||
$page = $params['page'];
|
||||
$limit = $params['size'];
|
||||
$title = $params['title'];
|
||||
$brandId = $params['brandId'];
|
||||
$labelIds = $params['labelIds'];
|
||||
$cityId = intval($params['cityId']);
|
||||
!$page && $page = 1;
|
||||
!$limit && $limit = 10;
|
||||
|
||||
$list = [];
|
||||
$where = ['status' => Auto_product_model::STATUS_NORMAL];
|
||||
$title && $where['title LIKE "%' . trim($title) . '%"'] = null;
|
||||
$brandId && $where['brandId'] = $brandId;
|
||||
$labelIdArray = $labelIds ? explode(',', $labelIds) : [];
|
||||
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 ($cityId) {
|
||||
$where["(cityId is null or cityId={$cityId})"] = null;
|
||||
} else {
|
||||
$where['cityId'] = null;
|
||||
}
|
||||
$count = $this->autoProduct->selectProductCount($where);
|
||||
if ($count) {
|
||||
$res = $this->autoProduct->selectProduct($where, 'id desc', $page, $limit, '', 'AutoProductEntity');
|
||||
/** @var AutoProductEntity[] $res */
|
||||
foreach ($res as $v) {
|
||||
$temp = [
|
||||
'id' => $v->id,
|
||||
'title' => $v->title,
|
||||
'guide_price' => $v->guide_price,
|
||||
'discounts' => $v->discounts,
|
||||
'discounts2' => $v->discounts2,
|
||||
'discounts3' => $v->discounts3,
|
||||
'banner' => $v->getFirstBanner(),
|
||||
'carProductLabel' => $v->getLabelName(),
|
||||
'btText' => '立即领取',
|
||||
];
|
||||
|
||||
$list[] = $temp;
|
||||
}
|
||||
}
|
||||
$data = ['list' => $list, 'count' => $count];
|
||||
$this->return_response_list($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品详情
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function detail_get()
|
||||
{
|
||||
$id = $this->input_param('id');
|
||||
/** @var AutoProductEntity $result */
|
||||
$result = $this->autoProduct->get(['id' => $id], '', 'AutoProductEntity');
|
||||
if (!$result) {
|
||||
$this->return_json('数据不存在');
|
||||
}
|
||||
$coupon = $result->getOneCoupons($this->userId);
|
||||
$data = [
|
||||
'id' => $result->id,
|
||||
'title' => $result->title,
|
||||
'guide_price' => $result->guide_price,
|
||||
'discounts' => $result->discounts,
|
||||
'discounts2' => $result->discounts2,
|
||||
'discounts3' => $result->discounts3,
|
||||
'banner' => $result->getFirstBanner(),
|
||||
'carProductLabel' => $result->getLabelName(),
|
||||
'imgs' => $result->getImagesList(),
|
||||
'coupons' => $coupon,
|
||||
];
|
||||
$this->return_response($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<?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
|
||||
{
|
||||
const CODE_LOGIN = 'login'; //登录
|
||||
const CODE_REGISTER = 'register'; //注册
|
||||
protected $inputs;
|
||||
protected $start_time;
|
||||
const CF2_PRODUCT = 39; //二级来源车型
|
||||
const CF2_ACTIVITY = 40; //二级来源活动
|
||||
const APP_ID = 1; //应用id
|
||||
|
||||
//短信验证码类型
|
||||
protected $codeCachePre = [
|
||||
self::CODE_LOGIN => 'PINGAN_LOGIN_%s',
|
||||
self::CODE_REGISTER => 'PINGAN_REGISTER_%s'
|
||||
];
|
||||
const DEFAULT_AVATAR = 'https://qs.liche.cn/web/images/project/H5-ShiYu/default-avatar.jpg?v=1';
|
||||
protected $groupType;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
* @param $mobile
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getCodeCacheKey($type, $mobile)
|
||||
{
|
||||
if (!in_array($type, $this->codeCachePre)) {
|
||||
$this->return_response('验证码类型错误');
|
||||
}
|
||||
return sprintf($this->codeCachePre['login'], $mobile);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/pingan/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() . 'mycaptchapingan');
|
||||
// 拼接上签名作为 Redis 的 key
|
||||
$key = 'code_' . $sign;
|
||||
if ($this->redis->exists($key)) {
|
||||
// 如果生成的 Sign 已存在,就进行递归,直到生成出一个不存在的。
|
||||
return $this->generateSign();
|
||||
}
|
||||
return $key;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/pingan/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/pingan/Pingan_users_model', 'mdSysAdmin');
|
||||
$this->load->model('agent/pingan/Pingan_sys_role_model', 'mdSysRole');
|
||||
$this->load->model('agent/pingan/Pingan_sys_menu_model', 'mdSysMenu');
|
||||
$this->load->model('agent/pingan/Pingan_sys_login_record_model', 'mdSysLoginRecord');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:用户登录
|
||||
* Created on: 2022/9/8 14:49
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function index_post()
|
||||
{
|
||||
$mobile = $this->input_param('phone');
|
||||
$code = $this->input_param('code');
|
||||
if (!$mobile) {
|
||||
$this->return_json('请输入手机号');
|
||||
}
|
||||
if (!$code) {
|
||||
$this->return_json('请输入验证码');
|
||||
}
|
||||
$redis = &load_cache('redis');
|
||||
$chackKey = $this->getCodeCacheKey(self::CODE_LOGIN, $mobile);
|
||||
$cache_code = $redis->get($chackKey);
|
||||
if (!$cache_code) {
|
||||
$this->return_json('验证码已过期');
|
||||
}
|
||||
if ($cache_code != $code) {
|
||||
$this->return_json('验证码错误');
|
||||
}
|
||||
$re = $this->mdSysAdmin->get(['mobile' => $mobile, 'status > 0' => null]);
|
||||
if (!$re) {
|
||||
$this->return_json('账号不存在');
|
||||
}
|
||||
if (!$re['status']) {
|
||||
$this->return_json('该账号已禁用');
|
||||
}
|
||||
$user = [
|
||||
'userId' => $re['id'], 'username' => $re['username'],
|
||||
'avatar' => self::DEFAULT_AVATAR, 'phone' => $re['mobile'],
|
||||
'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'] = Authorization::generateToken($re['id'], 'jwt_key_pingan');
|
||||
$data['user'] = $user;
|
||||
$this->load->library('api/record');
|
||||
$this->record->loginRecordPinAn(['userId' => $re['id'], 'username' => $re['username'], 'nickname' => $re['nickname'] ?: '', 'mobile' => $re['mobile']]);
|
||||
$redis->delete($chackKey);
|
||||
$this->return_response($data, '登录成功');
|
||||
}
|
||||
|
||||
public function code_get()
|
||||
{
|
||||
$phone = $this->input_param('phone');
|
||||
$type = $this->input_param('type');//验证码类型
|
||||
if (!$phone) {
|
||||
$this->return_json('请输入绑定手机号');
|
||||
}
|
||||
$cacheKey = '';
|
||||
switch ($type) {
|
||||
case self::CODE_LOGIN:
|
||||
$re = $this->mdSysAdmin->get(["mobile" => $phone, 'status > 0' => null]);
|
||||
if (!$re) {
|
||||
$this->return_json('绑定手机号不存在');
|
||||
}
|
||||
if (!$re['status']) {
|
||||
$this->return_json('该账号已禁用');
|
||||
}
|
||||
$cacheKey = $this->getCodeCacheKey(self::CODE_LOGIN, $phone);
|
||||
break;
|
||||
case self::CODE_REGISTER:
|
||||
$re = $this->mdSysAdmin->get(["mobile" => $phone, 'status > 0' => null]);
|
||||
if ($re) {
|
||||
$this->return_json('手机号已绑定');
|
||||
}
|
||||
$cacheKey = $this->getCodeCacheKey(self::CODE_REGISTER, $phone);
|
||||
break;
|
||||
default:
|
||||
$this->return_json('验证码类型错误');
|
||||
}
|
||||
$redis = &load_cache('redis');
|
||||
$code = $redis->get($cacheKey);
|
||||
if (!$code) {
|
||||
$code = rand(100000, 999999);
|
||||
$content = "【" . HDY_SMS_SIGN . "】" . "您的验证码为:{$code},请勿泄露于他人!";
|
||||
b2m_send_sms($phone, $content);
|
||||
$redis->save($cacheKey, $code, 5 * 60);
|
||||
}
|
||||
$this->return_response('短信验证码发送成功, 请注意查收!');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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([], '密码修改成功');
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require_once APPPATH . 'controllers/pingan/BaseController.php';
|
||||
|
||||
class Register extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('agent/pingan/Pingan_users_model', 'mdSysAdmin');
|
||||
}
|
||||
|
||||
public function index_post()
|
||||
{
|
||||
$params = $this->input_param();
|
||||
if (!$params['userName']) {
|
||||
$this->return_json('请输入姓名');
|
||||
}
|
||||
if (!$params['phone']) {
|
||||
$this->return_json('请输入姓名');
|
||||
}
|
||||
if (!$params['userCode']) {
|
||||
$this->return_json('请输入工号');
|
||||
}
|
||||
if (!$params['agreement']) {
|
||||
$this->return_json('请同意协议');
|
||||
}
|
||||
$redis = &load_cache('redis');
|
||||
$chackKey = $this->getCodeCacheKey(self::CODE_REGISTER, $params['phone']);
|
||||
$cache_code = $redis->get($chackKey);
|
||||
if (!$cache_code) {
|
||||
$this->return_json('验证码已过期');
|
||||
}
|
||||
if ($cache_code != $params['code']) {
|
||||
$this->return_json('验证码错误');
|
||||
}
|
||||
if ($this->mdSysAdmin->get(['mobile' => $params['phone'], 'status>0' => null])) {
|
||||
$this->return_json('手机号已绑定');
|
||||
}
|
||||
$user = $this->mdSysAdmin->get(['userCode' => $params['userCode'], 'status>0' => null]);
|
||||
if (!$user) {
|
||||
$this->return_json('请输入正确工号');
|
||||
}
|
||||
if ($user['mobile']) {
|
||||
$this->return_json('工号已绑定手机号');
|
||||
}
|
||||
// if ($this->mdSysAdmin->get(['userCode' => $params['userCode'], "mobile!=''" => null, 'status>0' => null])) {
|
||||
// $this->return_json('工号已绑定手机号');
|
||||
// }
|
||||
// $data = [
|
||||
// 'username' => $params['userName'],
|
||||
// 'mobile' => $params['phone'],
|
||||
// 'userCode' => $params['userCode'],
|
||||
// 'createTime' => date('Y-m-d H:i:s'),
|
||||
// 'roleId' => 1
|
||||
// ];
|
||||
// $req = $this->mdSysAdmin->add($data);
|
||||
$req = $this->mdSysAdmin->update(['mobile' => $params['phone']], ['id' => $user['id']]);
|
||||
if (!$req) {
|
||||
$this->return_json('绑定失败');
|
||||
}
|
||||
$this->return_response( '注册成功');
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user