|
|
|
<?php
|
|
|
|
namespace app\admin\controller;
|
|
|
|
use think\Db;
|
|
|
|
use think\facade\Request;
|
|
|
|
class Area extends Common
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
***代理商管理
|
|
|
|
***
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 商家list
|
|
|
|
*/
|
|
|
|
public function Seller(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$key= input('post.key') ? input('post.key') : "";
|
|
|
|
$channel = @$key['channel'] ? @$key['channel'] : 1;
|
|
|
|
|
|
|
|
$address = @$key['address'] ? @$key['address'] : '';
|
|
|
|
$prov = @$key['prov'] ? @$key['prov'] : '';
|
|
|
|
$city = @$key['city'] ? @$key['city'] : '';
|
|
|
|
$area = @$key['area'] ? @$key['area'] : '';
|
|
|
|
|
|
|
|
$limit = '&x='.$data["page"].'&y='.$data["limit"].'&areaid=61&channel=4&address='.$address.'&prov='.$prov.'&city='.$city.'&area='.$area;
|
|
|
|
|
|
|
|
//获取运营人员列表
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Agent.getSellerList'.$limit);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
foreach ($array['data']['data'] as $key => $value) {
|
|
|
|
$array['data']['data'][$key]['cdate'] = date("Y-m-d H:i:s",$value['cdate']);
|
|
|
|
if($value['status']==1)
|
|
|
|
$array['data']['data'][$key]['statusVal'] = "启用";
|
|
|
|
else
|
|
|
|
$array['data']['data'][$key]['statusVal'] = "停用";
|
|
|
|
|
|
|
|
$c_name = array();
|
|
|
|
$t_name = array();
|
|
|
|
//2019-03-05 增加菜系配置、商家类型配置
|
|
|
|
if(is_array($value['cuisine'])){
|
|
|
|
foreach ($value['cuisine'] as $k => $v) {
|
|
|
|
$c_name[] = $v['name'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(is_array($value['type'])){
|
|
|
|
foreach ($value['type'] as $k => $v) {
|
|
|
|
$t_name[] = $v['type_name'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!empty($c_name))
|
|
|
|
$array['data']['data'][$key]['cuisine'] = implode(',', $c_name);
|
|
|
|
if(!empty($t_name))
|
|
|
|
$array['data']['data'][$key]['type'] = implode(',', $t_name);
|
|
|
|
}
|
|
|
|
return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['data'],'count'=>$array['data']['total'],'rel'=>1];
|
|
|
|
}
|
|
|
|
$this->assign ( 'title','区域内商户维护');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addagent(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
//获取运营人员列表
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Agent.addAgent&areaid='.$data['areaid'].'&agent_name='.$data['agent_name'].'&agent_phone='.$data['agent_phone']);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
return $result = ['code'=>0,'msg'=>'添加成功!','data'=>$array['data'],'rel'=>1];#'count'=>$array['data'][0]['total']
|
|
|
|
}
|
|
|
|
$this->assign ( 'title','代理商管理');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 商家list
|
|
|
|
*/
|
|
|
|
public function agent(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$key= input('post.key') ? input('post.key') : "";
|
|
|
|
$channel = @$key['channel'] ? @$key['channel'] : 1;
|
|
|
|
|
|
|
|
$address = @$key['address'] ? @$key['address'] : '';
|
|
|
|
$prov = @$key['prov'] ? @$key['prov'] : '';
|
|
|
|
$city = @$key['city'] ? @$key['city'] : '';
|
|
|
|
$area = @$key['area'] ? @$key['area'] : '';
|
|
|
|
|
|
|
|
$limit = '';#'&x='.$data["page"].'&y='.$data["limit"];
|
|
|
|
|
|
|
|
//获取运营人员列表
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Agent.getAgentList'.$limit);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
/*foreach ($array['data'][0]['data'] as $key => $value) {
|
|
|
|
$array['data'][0]['data'][$key]['cdate'] = date("Y-m-d H:i:s",$value['cdate']);
|
|
|
|
|
|
|
|
}*/
|
|
|
|
return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'],'rel'=>1];#'count'=>$array['data'][0]['total']
|
|
|
|
}
|
|
|
|
$this->assign ( 'title','代理商管理');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 代理商运营list
|
|
|
|
*/
|
|
|
|
public function operate(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
//获取运营人员列表
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Agent.getAgentOperate&areaid=2');
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
foreach ($array['data'] as $key => $value) {
|
|
|
|
$array['data'][$key]['cdate'] = date("Y-m-d H:i:s",$value['cdate']);
|
|
|
|
|
|
|
|
}
|
|
|
|
return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'],'rel'=>1];#'count'=>$array['data'][0]['total']
|
|
|
|
}
|
|
|
|
$this->assign ( 'title','代理商管理');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 禁用运营
|
|
|
|
*/
|
|
|
|
public function setAgentOperate(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Agent.getAgentOperate&id='.$data['id']);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'],'rel'=>1];#'count'=>$array['data'][0]['total']
|
|
|
|
}
|
|
|
|
$this->assign ( 'title','代理商管理');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
//增加运营管理人员
|
|
|
|
public function operateAdd(){
|
|
|
|
//缓存60秒 不请求。
|
|
|
|
/*$arr = cache('qrcod_url');
|
|
|
|
if(!$arr){
|
|
|
|
$arr= file_get_contents("http://xt.colorcun.com/WechatApi/WechatApi/CreateOperateQrcode/");
|
|
|
|
$arr = json_decode($arr,TRUE);
|
|
|
|
cache('qrcod_url',$arr, 50);
|
|
|
|
}*/
|
|
|
|
|
|
|
|
$this->assign('qrcode_path','https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQGx8DwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyTHVYdVF0QmZlR2oxMDAwMDAwN2oAAgQ84vpdAwQAAAAA');
|
|
|
|
return view();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 停用商家
|
|
|
|
*/
|
|
|
|
public function configStop(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$data['status'] = $data['status'] ? 0 : 1;
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Seller.SetStopBySeller&sellerid='.$data['sellerid'].'&status='.$data['status']);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
if($array['ret']==200){
|
|
|
|
$result['code'] = 1;
|
|
|
|
$result['msg'] = 'SUCCESS!';
|
|
|
|
}else{
|
|
|
|
$result['code'] = 0;
|
|
|
|
$result['msg'] = '请求错误!';
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
return view();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 从商家维度统计:订单、短信等情况
|
|
|
|
*/
|
|
|
|
public function getStatistics(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$key= input('post.key') ? input('post.key') : "";
|
|
|
|
|
|
|
|
$sid = $data['sid'] ? implode(',', $data['sid']) : '';
|
|
|
|
$sellername = $data['key'] ? $data['key'] : '';
|
|
|
|
|
|
|
|
$time = $data['time'] ? explode(' - ', $data['time']) : '';
|
|
|
|
|
|
|
|
$stime = $time ? strtotime(date($time[0],time())) : '';
|
|
|
|
$etime = $time ? strtotime(date($time[1],time())) : '';
|
|
|
|
|
|
|
|
$data['time_type'] = $data['time_type'] ? $data['time_type'] : 1;
|
|
|
|
$data['channel'] = $data['channel'] ? $data['channel'] : 1;
|
|
|
|
|
|
|
|
$parame = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$sellername.'&stime='.@$stime.'&etime='.@$etime.'&channel='.@$data['channel'].'&sid='.$sid.'&time_type='.@$data['time_type'];
|
|
|
|
|
|
|
|
//获取运营人员列表
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Report.GetReserveData'.$parame);
|
|
|
|
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
|
|
|
|
$new_array = array();
|
|
|
|
foreach ($array['data'] as $key => $value) {
|
|
|
|
if(is_array($value)){
|
|
|
|
$new_array[$key]['id'] = $value['id'];
|
|
|
|
$new_array[$key]['sellername'] = $value['sellername'];
|
|
|
|
$new_array[$key]['contacts_total'] = $value['contacts_total'];
|
|
|
|
$new_array[$key]['inviting'] = $value['inviting'];
|
|
|
|
$new_array[$key]['reserve_count'] = $value['appReserveCount'] .'/'. $value['AndroidReserveCount'].'/'. $value['CReserveCount'];
|
|
|
|
$new_array[$key]['reserve_count_sort'] = $value['appReserveCount'] + $value['AndroidReserveCount'] + $value['CReserveCount'];
|
|
|
|
$new_array[$key]['sms_send_count'] = $value['appSmsCount'] .'/'. $value['AndroidSmsCount'];
|
|
|
|
$new_array[$key]['sms_send_count_sort'] = $value['appSmsCount'] + $value['AndroidSmsCount'];
|
|
|
|
$new_array[$key]['table_room_total'] = $value['table_total'] .'/'. $value['room_total'];
|
|
|
|
$new_array[$key]['address_component'] = $value['address_component']['province'] && $value['address_component']['city'] ? $value['address_component']['province'] .'-'. $value['address_component']['city'] : '无法获取地区,请检查经纬度是否正确!';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $result = [
|
|
|
|
'code'=>0,'msg'=>'获取成功!',
|
|
|
|
'data'=>$new_array,
|
|
|
|
'count'=>$array['data']['total'],
|
|
|
|
'countReserve'=>$array['data']['appReserveCount']+$array['data']['AndroidReserveCount']+$array['data']['CReserveCount'],
|
|
|
|
'countSms'=>$array['data']['appSmsCount']+$array['data']['AndroidSmsCount'],
|
|
|
|
'inviteeCount'=>$array['data']['inviteeCount'],
|
|
|
|
'appReserveCount'=>$array['data']['appReserveCount'],
|
|
|
|
'AndroidReserveCount'=>$array['data']['AndroidReserveCount'],
|
|
|
|
'CReserveCount'=>$array['data']['CReserveCount'],
|
|
|
|
'appSmsCount'=>$array['data']['appSmsCount'],
|
|
|
|
'AndroidSmsCount'=>$array['data']['AndroidSmsCount'],
|
|
|
|
'Contacts'=>$array['data']['Contacts'],
|
|
|
|
'rel'=>1
|
|
|
|
];
|
|
|
|
}
|
|
|
|
$this->assign ( 'title','预定订单统计');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 从设备(电话机)维度统计:订单、短信等情况
|
|
|
|
*/
|
|
|
|
public function getEquipment(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$key= input('post.key') ? input('post.key') : "";
|
|
|
|
|
|
|
|
$sid = $data['sid'] ? implode(',', $data['sid']) : '';
|
|
|
|
$sellername = $data['key'] ? $data['key'] : '';
|
|
|
|
|
|
|
|
$time = $data['time'] ? explode(' - ', $data['time']) : '';
|
|
|
|
|
|
|
|
$stime = $time ? strtotime(date($time[0],time())) : '';
|
|
|
|
$etime = $time ? strtotime(date($time[1],time())) : '';
|
|
|
|
|
|
|
|
$data['time_type'] = $data['time_type'] ? $data['time_type'] : 1;
|
|
|
|
$data['channel'] = $data['channel'] ? $data['channel'] : 1;
|
|
|
|
|
|
|
|
$parame = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$sellername.'&stime='.@$stime.'&etime='.@$etime.'&channel='.@$data['channel'].'&sid='.$sid.'&time_type='.@$data['time_type'];
|
|
|
|
|
|
|
|
//获取运营人员列表
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Report.GetReserveDataBydev'.$parame);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['list'],'count'=>$array['data']['total'],'rel'=>1];
|
|
|
|
}
|
|
|
|
$this->assign ( 'title','设备维度统计预定订单');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 商家菜系、类型配置
|
|
|
|
*/
|
|
|
|
public function sellerconfig(){
|
|
|
|
$data = Request::except('file');
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$cuisine = !empty($data['cuisine']) ? implode(',', array_keys($data['cuisine'])) : '';
|
|
|
|
$type = !empty($data['type']) ? implode(',', array_keys($data['type'])) : '';
|
|
|
|
$mode = !empty($data['mode']) ? implode(',', array_keys($data['mode'])) : '';
|
|
|
|
$sms_code = !empty($data['sms_code']) ? $data['sms_code'] : '';
|
|
|
|
$label = !empty($data['label']) ? implode(',', array_keys($data['label'])) : '';
|
|
|
|
$brand = !empty($data['brand']) ? implode(',', array_keys($data['brand'])) : '';
|
|
|
|
$label_1_ = !empty($data['label_1_']) ? implode(',', array_keys($data['label_1_'])) : '';
|
|
|
|
$label_2_ = !empty($data['label_2_']) ? implode(',', array_keys($data['label_2_'])) : '';
|
|
|
|
$label_3_ = !empty($data['label_3_']) ? implode(',', array_keys($data['label_3_'])) : '';
|
|
|
|
|
|
|
|
if($sms_code)
|
|
|
|
$res_sms_code= file_get_contents(ON_LINE.'App.SendSMS.SetSellerSmsTemplate&sid='.$data['sellerid'].'&sms_id='.$sms_code);
|
|
|
|
|
|
|
|
if($cuisine)
|
|
|
|
$res_cuisine= file_get_contents(ON_LINE.'App.Seller.SetSellerCuisine&sellerid='.$data['sellerid'].'&cid='.$cuisine);
|
|
|
|
//$res_cuisine = json_decode($res_cuisine,TRUE);
|
|
|
|
if($type)
|
|
|
|
$res_type= file_get_contents(ON_LINE.'App.Seller.SetSellerType&sellerid='.$data['sellerid'].'&typeid='.$type);
|
|
|
|
//$res_type = json_decode($res_type,TRUE);
|
|
|
|
|
|
|
|
if($mode)
|
|
|
|
$res_mode= file_get_contents(ON_LINE.'App.Seller.setSellerMode&sellerid='.$data['sellerid'].'&modeid='.$mode);
|
|
|
|
//$res_mode = json_decode($res_mode,TRUE);
|
|
|
|
if($label)
|
|
|
|
$res_label= file_get_contents(ON_LINE.'App.Seller.setSellerLabel&sid='.$data['sellerid'].'&field='.$label);
|
|
|
|
|
|
|
|
if($brand){
|
|
|
|
$del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_brand_rel WHERE sid =".$data['sellerid']);
|
|
|
|
$add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_brand_rel VALUES(".$data['sellerid'].",".$brand.")");
|
|
|
|
}
|
|
|
|
|
|
|
|
if($label_1_){
|
|
|
|
$del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel WHERE sid = ".$data['sellerid']." AND lcid in (SELECT id FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c WHERE pid = 1)");
|
|
|
|
$add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_1_.")");
|
|
|
|
}
|
|
|
|
|
|
|
|
if($label_2_){
|
|
|
|
$del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel WHERE sid = ".$data['sellerid']." AND lcid in (SELECT id FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c WHERE pid = 2)");
|
|
|
|
$add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_2_.")");
|
|
|
|
}
|
|
|
|
|
|
|
|
if($label_3_){
|
|
|
|
$del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel WHERE sid = ".$data['sellerid']." AND lcid in (SELECT id FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c WHERE pid = 3)");
|
|
|
|
$add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_3_.")");
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($data['edition'])){
|
|
|
|
$up=Db::query("UPDATE `xt-member-two-LINE`.xt_seller set is_online_reserve = ".$data['edition']." where id = ".$data['sellerid']);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($data['is_tele'])){
|
|
|
|
$up=Db::query("UPDATE `xt-member-two-LINE`.xt_seller set is_tele = ".$data['is_tele']." where id = ".$data['sellerid']);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$result['code'] = 1;
|
|
|
|
$result['msg'] = "配置成功!";
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取商家已有菜系
|
|
|
|
$cuisine_list= file_get_contents(ON_LINE.'App.Seller.getSellerCuisine&sellerid='.$data['id']);
|
|
|
|
$cuisine_list = json_decode($cuisine_list,TRUE);
|
|
|
|
//获取所有菜系
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Reserve.GetCustomerConfig');
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
//组装数据
|
|
|
|
foreach ($cuisine_list['data'] as $key => $value) {
|
|
|
|
foreach ($array['data']['cate'] as $k => $v) {
|
|
|
|
if($value['cid']==$v['id']){
|
|
|
|
$array['data']['cate'][$k]['checked'] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->assign('list',$array['data']['cate']);//获取所有菜系
|
|
|
|
|
|
|
|
//获取商家已有来源
|
|
|
|
$type_list= file_get_contents(ON_LINE.'App.Seller.GetSellerType&sellerid='.$data['id']);
|
|
|
|
$type_list = json_decode($type_list,TRUE);
|
|
|
|
//获取来源
|
|
|
|
$channel = array(array('id'=>1,'name'=>'合作'),array('id'=>2,'name'=>'推广'),array('id'=>3,'name'=>'测试'));
|
|
|
|
//组装数据
|
|
|
|
foreach ($type_list['data'] as $key => $value) {
|
|
|
|
foreach ($channel as $k => $v) {
|
|
|
|
if($value['type_id']==$v['id']){
|
|
|
|
$channel[$k]['checked'] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->assign('channel',$channel);//获取所有来源
|
|
|
|
|
|
|
|
//获取商家已有地图显示方式
|
|
|
|
$mode_list= file_get_contents(ON_LINE.'App.Seller.getSellerMode&sellerid='.$data['id']);
|
|
|
|
$mode_list = json_decode($mode_list,TRUE);
|
|
|
|
|
|
|
|
//获取所有地图显示方式
|
|
|
|
$mode= array(array('id'=>1,'name'=>'地图上大图标'),array('id'=>2,'name'=>'地图上文字'));
|
|
|
|
//组装数据
|
|
|
|
foreach ($mode_list['data'] as $key => $value) {
|
|
|
|
foreach ($mode as $k => $v) {
|
|
|
|
if($value['sm_id']==$v['id']){
|
|
|
|
$mode[$k]['checked'] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->assign('mode',$mode);//获取所有菜系
|
|
|
|
|
|
|
|
//获取商家已选短信模板
|
|
|
|
$template = file_get_contents(ON_LINE.'App.Reserve.SellerInfo&seller_id='.$data['id']);
|
|
|
|
$template = json_decode($template,TRUE);
|
|
|
|
//获取短信模板列表
|
|
|
|
$template_list = file_get_contents(ON_LINE.'App.SendSMS.GetSmsTemplate');
|
|
|
|
$template_list = json_decode($template_list,TRUE);
|
|
|
|
|
|
|
|
//组装数据
|
|
|
|
foreach ($template_list['data'] as $key => $value) {
|
|
|
|
if($value['template_code']==$template['data']['setting']['template_code']){
|
|
|
|
$template_list['data'][$key]['checked'] = 1;
|
|
|
|
}
|
|
|
|
switch ($value['template_code']) {
|
|
|
|
case 'SMS_163050401':
|
|
|
|
$vowels = array(
|
|
|
|
'周到安排演示店' => '${seller_name}',
|
|
|
|
'11月25日晚上18:00' => '${date}',
|
|
|
|
'金台夕照、卢沟晓月' =>'${region_room_name}',
|
|
|
|
'西电路447号南湖金地西门南100米' =>'${seller_addr}',
|
|
|
|
'18792581193' =>'${seller_phone}',
|
|
|
|
'毛毛' =>'${cusman}',
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case 'SMS_162733710':
|
|
|
|
$vowels = array(
|
|
|
|
'4月6日中午' => '${reserve_date}',
|
|
|
|
'周到1店西电路447号金台夕照' => '${seller_name_addr_room}',
|
|
|
|
'毛毛' =>'${cusman}',
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case 'SMS_154587043':
|
|
|
|
$vowels = array(
|
|
|
|
'侯先生' => '${guest}',
|
|
|
|
'周到安排演示店' => '${seller_name}',
|
|
|
|
'11月25日晚上18:00' =>'${date}',
|
|
|
|
'包间(金台夕照)' =>'${region_room_name}',
|
|
|
|
'西电路447号南湖金地西门南100米' =>'${seller_addr}',
|
|
|
|
'18792581193' =>'${seller_phone}\n',
|
|
|
|
'毛毛' =>'${cusman}',
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case 'SMS_164277855':
|
|
|
|
$vowels = array(
|
|
|
|
'周到1店西电路447号' => '${seller_name}',
|
|
|
|
'11月7日晚上18:30' => '${date}',
|
|
|
|
'包间(金台夕照)' =>'${region_room_name}',
|
|
|
|
'1879258119' =>'${seller_phone}',
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case 'SMS_164268239':
|
|
|
|
$vowels = array(
|
|
|
|
'周到安排演示店' => '${seller_name}',
|
|
|
|
'11月7日晚上18:30' => '${date}',
|
|
|
|
'包间(金台夕照)' =>'${region_room_name}',
|
|
|
|
'西电路447号南湖金地西门南100米' =>'${seller_addr}',
|
|
|
|
'1879258119' =>'${seller_phone}',
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
# code...
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$template_list['data'][$key]['content'] = str_replace($vowels, array_keys($vowels),$value['content']);
|
|
|
|
}
|
|
|
|
$this->assign('template_list',$template_list['data']);//获取短信模板列表
|
|
|
|
|
|
|
|
//获取商家拥有哪些标签
|
|
|
|
$label_list= file_get_contents(ON_LINE.'App.Seller.GetSellerLabel&sid='.$data['id']);
|
|
|
|
$label_list = json_decode($label_list,TRUE);
|
|
|
|
$this->assign('label_list',$label_list['data']);
|
|
|
|
|
|
|
|
//商家标签
|
|
|
|
//原生:
|
|
|
|
//$label_c=Db::query("SELECT * from xt-member-two-LINE.xt_dc_dz_seller_label_c");
|
|
|
|
$label_c=Db::table("xt-member-two-LINE.xt_dc_dz_seller_label_c")->select();
|
|
|
|
$label_c_rel=Db::table("xt-member-two-LINE.xt_dc_dz_seller_label_c_rel")->where(array('sid'=>$data['id']))->select();
|
|
|
|
//组装数据
|
|
|
|
foreach ($label_c as $key => $value) {
|
|
|
|
foreach ($label_c_rel as $k => $v) {
|
|
|
|
if($value['id']==$v['lcid']){
|
|
|
|
$label_c[$key]['checked'] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->assign('label_c',$label_c);
|
|
|
|
|
|
|
|
//商家品牌
|
|
|
|
$brand=Db::table("xt-member-two-LINE.xt_dc_dz_seller_brand")->select();
|
|
|
|
$brand_rel=Db::table("xt-member-two-LINE.xt_dc_dz_seller_brand_rel")->where(array('sid'=>$data['id']))->select();
|
|
|
|
//组装数据
|
|
|
|
foreach ($brand as $key => $value) {
|
|
|
|
foreach ($brand_rel as $k => $v) {
|
|
|
|
if($value['id']==$v['bid']){
|
|
|
|
$brand[$key]['checked'] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->assign('brand',$brand);
|
|
|
|
|
|
|
|
|
|
|
|
$is_online_reserve=Db::table("xt-member-two-LINE.xt_seller")->where(array('id'=>$data['id']))->select();
|
|
|
|
|
|
|
|
//获取商家在线预定版本情况
|
|
|
|
$this->assign('is_online_reserve',$is_online_reserve[0]['is_online_reserve']);
|
|
|
|
//是否安装电话机
|
|
|
|
$this->assign('is_tele',$is_online_reserve[0]['is_tele']);
|
|
|
|
|
|
|
|
//商户信息
|
|
|
|
$this->assign ('data',$data);
|
|
|
|
$this->assign ( 'title','商户信息配置' );
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 商家基础信息配置
|
|
|
|
*/
|
|
|
|
public function setsellerconfig(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$data['status'] = $data['status'] ? 0 : 1;
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Seller.SetSellerConfigByPC&sid='.$data['sellerid'].'&field='.$data['field'].'&value='.$data['value']);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
if($array['ret']==200){
|
|
|
|
$result['code'] = 1;
|
|
|
|
$result['msg'] = 'SUCCESS!';
|
|
|
|
}else{
|
|
|
|
$result['code'] = 0;
|
|
|
|
$result['msg'] = '请求错误!';
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
return view();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 商家详情
|
|
|
|
*/
|
|
|
|
public function sellerdetail(){
|
|
|
|
//print_r(Request::except('file'));die;
|
|
|
|
$data = Request::except('file');
|
|
|
|
//获取运营人员列表
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Seller.GetSellerById&sellerid='.$data['sid']);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
if($array['data']['data']){
|
|
|
|
$array['data']['data']['daily'] = json_decode($array['data']['data']['daily'],TRUE);
|
|
|
|
$array['data']['data']['daily_time'] = json_decode($array['data']['data']['daily_time'],TRUE);
|
|
|
|
$array['data']['data']['cdate'] = date("Y年m月d日 H时i分s秒",$array['data']['data']['cdate']);
|
|
|
|
}
|
|
|
|
//获取短信流水
|
|
|
|
$sms= file_get_contents(ON_LINE.'App.SendSMS.GetSellerSmsFlowing&sid='.$data['sid']);
|
|
|
|
$sms_data = json_decode($sms,TRUE);
|
|
|
|
$sms_data_list = $sms_data['data'] ? $sms_data['data'] : array();
|
|
|
|
$this->assign ( 'smslist',$sms_data_list);
|
|
|
|
$this->assign ( 'data',$array['data']['data']);
|
|
|
|
$this->assign ( 'title','商家详情页面');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
//商家列表 用于配置商家活动
|
|
|
|
public function seller_activity_list(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$key= input('post.key') ? input('post.key') : "";
|
|
|
|
$channel = @$key['channel'] ? @$key['channel'] : 1;
|
|
|
|
$limit = '&x='.$data["page"].'&y='.$data["limit"].'&keywords='.@$key['id'].'&channel='.$channel;
|
|
|
|
|
|
|
|
//获取运营人员列表
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Seller.GetSellerListByActivity'.$limit);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
foreach($array['data'][0]['data'] as $key=>$value){
|
|
|
|
if(!empty($value['activity'])){
|
|
|
|
foreach ($value['activity'] as $k => $v) {
|
|
|
|
$str[$key][] = ($k+1).'、'.$v['title'];
|
|
|
|
}
|
|
|
|
$array['data'][0]['data'][$key]['activity'] = implode('<br/>', $str[$key]);
|
|
|
|
//$array['data'][0]['data'][$key]['activity'] = implode('<br/>', array_column($value['activity'], 'title'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0]['data'],'count'=>$array['data'][0]['total'],'rel'=>1];
|
|
|
|
}
|
|
|
|
$this->assign ( 'title','商家活动配置');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 商家活动列表页
|
|
|
|
*/
|
|
|
|
public function seller_activity(){
|
|
|
|
$data = Request::except('file');
|
|
|
|
//获取商家现有活动
|
|
|
|
$seller_activity= file_get_contents(ON_LINE.'App.Seller.GetSellerActivity&sid='.$data['id']);
|
|
|
|
$seller_activity = json_decode($seller_activity,TRUE);
|
|
|
|
//活动列表
|
|
|
|
$this->assign('sid',$data['id']);
|
|
|
|
$this->assign ( 'seller_activity',$seller_activity['data']);
|
|
|
|
$this->assign ( 'title','商家活动配置页面');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
//添加活动
|
|
|
|
public function add_activity(){
|
|
|
|
$data = Request::except('file');
|
|
|
|
if(Request::isAjax()){
|
|
|
|
switch ($data['type']) {
|
|
|
|
case '1':
|
|
|
|
if($data['max_num']==0){
|
|
|
|
$data['title'] = '立减'.$data['min_num'];break;
|
|
|
|
}else{
|
|
|
|
$data['title'] = '满'.$data['max_num'].'立减'.$data['min_num'];break;
|
|
|
|
}
|
|
|
|
case '2':
|
|
|
|
$data['title'] = '满赠';
|
|
|
|
break;
|
|
|
|
case '3':
|
|
|
|
if($data['max_num']==0){
|
|
|
|
$data['title'] = $data['min_num'].'折';break;
|
|
|
|
}else{
|
|
|
|
$data['title'] = '满'.$data['max_num'].'立享'.$data['min_num'].'折';break;
|
|
|
|
}
|
|
|
|
case '4':
|
|
|
|
$data['title'] = $data['max_num'].'元代金券';
|
|
|
|
break;
|
|
|
|
case '5':
|
|
|
|
$data['title'] = '会员价';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
# code...
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
//字段空值过滤
|
|
|
|
//添加活动
|
|
|
|
$res= file_get_contents(ON_LINE.'App.Seller.SetActivity&str='.serialize($data));
|
|
|
|
$res = json_decode($res,TRUE);
|
|
|
|
if($data['aid']){
|
|
|
|
if($res['data']){
|
|
|
|
$result = ['code'=>1,'msg'=>'修改成功!','rel'=>1];
|
|
|
|
}else{
|
|
|
|
$result = ['code'=>0,'msg'=>'修改失败!','rel'=>1];
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if($res['data']){
|
|
|
|
$result = ['code'=>1,'msg'=>'添加成功!','rel'=>1];
|
|
|
|
}else{
|
|
|
|
$result = ['code'=>0,'msg'=>'添加失败!','rel'=>1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
if($data['id']){
|
|
|
|
//修改---需要获取对应的数据
|
|
|
|
$activity= file_get_contents(ON_LINE.'App.Seller.GetSellerActivityById&id='.$data['id']);
|
|
|
|
$activity = json_decode($activity,TRUE);
|
|
|
|
$this->assign ('data',$activity['data']);
|
|
|
|
$this->assign ( 'title','修改活动');
|
|
|
|
}
|
|
|
|
$this->assign ( 'hid',$data['sid']);
|
|
|
|
$this->assign ( 'title','添加活动');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
//删除活动
|
|
|
|
public function del_activity(){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$res= file_get_contents(ON_LINE.'App.Seller.DelSellerActivity&sid='.$data['sid'].'&aid='.$data['aid']);
|
|
|
|
$res = json_decode($res,TRUE);
|
|
|
|
$this->redirect('Seller/seller_activity', ['id' => $data['sid']]);
|
|
|
|
//return $this->fetch('seller_activity',['id' => $data['sid']]);
|
|
|
|
}
|
|
|
|
|
|
|
|
//商家设备列表
|
|
|
|
public function device_list(){
|
|
|
|
//获取类型
|
|
|
|
$facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer");
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$channel = @$data['channel'] ? @$data['channel'] : 1;
|
|
|
|
$manufacturer = @$data['manufacturer'] ? @$data['manufacturer'] : 1;
|
|
|
|
|
|
|
|
$limit = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$data['key'].'&channel='.$channel.'&type='.$manufacturer;
|
|
|
|
|
|
|
|
//获取运营人员列表
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Device.GetDeviceOnlineStatus'.$limit); //GetSellerDevice
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
foreach ($array['data']['list'] as $key => $value) {
|
|
|
|
switch ($value['type']) {
|
|
|
|
case '0':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[0]['facturer'];
|
|
|
|
break;
|
|
|
|
case '1':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[0]['facturer'];
|
|
|
|
break;
|
|
|
|
case '2':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[1]['facturer'];
|
|
|
|
break;
|
|
|
|
case '3':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[2]['facturer'];
|
|
|
|
break;
|
|
|
|
case '4':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[3]['facturer'];
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
$array['data']['list'][$key]['type'] = 'error: '.$value['type'];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['list'],'count'=>$array['data']['total'],'rel'=>1];
|
|
|
|
}
|
|
|
|
$this->assign ( 'facturer',$facturer);
|
|
|
|
$this->assign ( 'title','商家设备列表');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
//商家设备列表
|
|
|
|
public function add_gray_user(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Device.SetGrayUser&ids='.serialize($data['id']));
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
if($array['ret']==200){
|
|
|
|
$result['code'] = 1;
|
|
|
|
$result['msg'] = 'SUCCESS!';
|
|
|
|
}else{
|
|
|
|
$result['code'] = 0;
|
|
|
|
$result['msg'] = '服务器错误,请勿重复将设备号添加到灰度用户!';
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
return view();
|
|
|
|
}
|
|
|
|
|
|
|
|
//灰度用户列表
|
|
|
|
public function gray_user_list(){
|
|
|
|
//获取类型
|
|
|
|
$facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer");
|
|
|
|
$this->assign ( 'facturer',$facturer);
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$channel = @$data['channel'] ? @$data['channel'] : 1;
|
|
|
|
$manufacturer = @$data['manufacturer'] ? @$data['manufacturer'] : 1;
|
|
|
|
|
|
|
|
$limit = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$data['key'].'&channel='.$channel.'&type='.$manufacturer;
|
|
|
|
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Device.GetGrayUserList'.$limit);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
foreach ($array['data']['list'] as $key => $value) {
|
|
|
|
switch ($value['type']) {
|
|
|
|
case '1':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[0]['facturer'];
|
|
|
|
break;
|
|
|
|
case '2':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[1]['facturer'];
|
|
|
|
break;
|
|
|
|
case '3':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[2]['facturer'];
|
|
|
|
break;
|
|
|
|
case '4':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[3]['facturer'];
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
$array['data']['list'][$key]['type'] = 'error';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['list'],'count'=>$array['data']['total'],'rel'=>1];
|
|
|
|
}
|
|
|
|
//获取类型
|
|
|
|
$facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer");
|
|
|
|
$this->assign ( 'facturer',$facturer);
|
|
|
|
$this->assign ( 'title','灰度用户列表');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
//删除灰度用户
|
|
|
|
public function del_gray_user(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Device.DelGrayUser&jsstr='.serialize($data['id']));
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
|
|
|
|
if($array['ret']==200){
|
|
|
|
$result['code'] = 1;
|
|
|
|
$result['msg'] = 'SUCCESS!';
|
|
|
|
}else{
|
|
|
|
$result['code'] = 0;
|
|
|
|
$result['msg'] = '请刷新页面重新尝试!';
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
return view();
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取在线设备情况
|
|
|
|
public function get_device_online_status(){
|
|
|
|
//获取类型
|
|
|
|
$facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer");
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$channel = @$data['channel'] ? @$data['channel'] : 1;
|
|
|
|
$manufacturer = @$data['manufacturer'] ? @$data['manufacturer'] : 1;
|
|
|
|
|
|
|
|
$limit = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$data['key'].'&channel='.$channel.'&type='.$manufacturer;
|
|
|
|
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Device.GetDeviceOnlineStatus'.$limit);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
foreach ($array['data']['list'] as $key => $value) {
|
|
|
|
switch ($value['type']) {
|
|
|
|
case '0':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[0]['facturer'];
|
|
|
|
break;
|
|
|
|
case '1':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[0]['facturer'];
|
|
|
|
break;
|
|
|
|
case '2':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[1]['facturer'];
|
|
|
|
break;
|
|
|
|
case '3':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[2]['facturer'];
|
|
|
|
break;
|
|
|
|
case '4':
|
|
|
|
$array['data']['list'][$key]['type'] = $facturer[3]['facturer'];
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
$array['data']['list'][$key]['type'] = $value['type'];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['list'],'count'=>$array['data']['total'],'rel'=>1];
|
|
|
|
}
|
|
|
|
$this->assign ( 'facturer',$facturer);
|
|
|
|
$this->assign ( 'title','商家话机在线设备列表');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 从商家维度统计:订单、短信等情况
|
|
|
|
*/
|
|
|
|
public function GetReserveList(){
|
|
|
|
//获取类型
|
|
|
|
$facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer");
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$key= input('post.key') ? input('post.key') : "";
|
|
|
|
$nokey= input('post.nokey') ? input('post.nokey') : "";
|
|
|
|
|
|
|
|
$sellername = $data['key'] ? $data['key'] : ''; //商家名称
|
|
|
|
$id = $data['nokey'] ? $data['nokey'] : ''; //订单ID
|
|
|
|
|
|
|
|
$time = $data['time'] ? explode(' - ', $data['time']) : '';
|
|
|
|
|
|
|
|
$stime = $time ? strtotime(date($time[0],time())) : strtotime(date('Y-m-d 00:00:00',time()));
|
|
|
|
$etime = $time ? strtotime(date($time[1],time())) : strtotime(date('Y-m-d 23:59:59',time()));
|
|
|
|
|
|
|
|
$dtime = $data['dtime'] ? explode(' - ', $data['dtime']) : '';
|
|
|
|
|
|
|
|
$sdtime = $dtime ? strtotime(date($dtime[0],time())) : '';
|
|
|
|
$edtime = $dtime ? strtotime(date($dtime[1],time())) : '';
|
|
|
|
|
|
|
|
$data['status'] = $data['status'] ? $data['status'] : 2;
|
|
|
|
$data['channel'] = $data['channel'] ? $data['channel'] : 1;
|
|
|
|
|
|
|
|
$parame = '&offset='.$data["page"].'&limit='.$data["limit"].'&sellername='.@$sellername.'&stime='.@$stime.'&etime='.@$etime.'&channel='.@$data['channel'].'&id='.$id.'&status='.@$data['status'].'&sdtime='.$sdtime.'&edtime='.$edtime;
|
|
|
|
|
|
|
|
//获取运营人员列表
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Customer.GetReserveList'.$parame);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
|
|
|
|
$new_array = array();
|
|
|
|
foreach ($array['data']['list'] as $key => $value) {
|
|
|
|
//有无设备
|
|
|
|
if($value['is_tele']==1){
|
|
|
|
switch ($value['type']) {
|
|
|
|
case '1':
|
|
|
|
$array['data']['list'][$key]['dv'] = $facturer[0]['facturer'];
|
|
|
|
break;
|
|
|
|
case '2':
|
|
|
|
$array['data']['list'][$key]['dv'] = $facturer[1]['facturer'];
|
|
|
|
break;
|
|
|
|
case '3':
|
|
|
|
$array['data']['list'][$key]['dv'] = $facturer[2]['facturer'];
|
|
|
|
break;
|
|
|
|
case '4':
|
|
|
|
$array['data']['list'][$key]['dv'] = $facturer[3]['facturer'];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$array['data']['list'][$key]['dv'] = '无';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$array['data']['list'][$key]['dv'] = '无';
|
|
|
|
}
|
|
|
|
//订单接受时间段
|
|
|
|
switch ($value['ddate_solt']) {
|
|
|
|
//'未设置/早市/午市/晚市/夜宵 0/1/2/3/4',
|
|
|
|
case 0:
|
|
|
|
$value['ddate_solt'] = '未设置';
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
$value['ddate_solt'] = '早市';
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
$value['ddate_solt'] = '午市';
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
$value['ddate_solt'] = '晚市';
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
$value['ddate_solt'] = '夜宵';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
# code...
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$array['data']['list'][$key]['ddate'] = date('Y-m-d H:i:s',$value['ddate']).'['.$value['ddate_solt'].']';
|
|
|
|
$array['data']['list'][$key]['cdate'] = date('Y-m-d H:i:s',$value['cdate']);
|
|
|
|
$array['data']['list'][$key]['handle_time'] = $value['handle_time'] ? date('Y-m-d H:i:s',$value['handle_time']) : '';
|
|
|
|
$array['data']['list'][$key]['rec_date'] = $value['rec_date'] ? date('Y-m-d H:i:s',$value['rec_date']) : '';
|
|
|
|
switch ($value['status']) {
|
|
|
|
case 0:
|
|
|
|
$array['data']['list'][$key]['sta'] = '待确认';
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
$array['data']['list'][$key]['sta'] = '已定座';
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
$array['data']['list'][$key]['sta'] = '到店';
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
$array['data']['list'][$key]['sta'] = '离店';
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
$array['data']['list'][$key]['sta'] = '已取消';
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
$array['data']['list'][$key]['sta'] = '已分配';
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
$array['data']['list'][$key]['sta'] = '拒单';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
# code...
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch ($value['sex']) {
|
|
|
|
case 1:
|
|
|
|
$array['data']['list'][$key]['rname'] = $value['rname'].'先生'.'('.$value['phone'].')';
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
$array['data']['list'][$key]['rname'] = $value['rname'].'女士'.'('.$value['phone'].')';
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
$array['data']['list'][$key]['rname'] = $value['rname'].'公司'.'('.$value['phone'].')';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
# code...
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($value['room_demand']){
|
|
|
|
$array['data']['list'][$key]['room_demand'] = implode(',',array_column(json_decode($value['room_demand'],true), 'name'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$array['data']['list'][$key]['sta'] = $value['is_tele']==1 ? $array['data']['list'][$key]['sta'] : $array['data']['list'][$key]['sta'].'无话机';
|
|
|
|
|
|
|
|
//根据操作人识别操作终端
|
|
|
|
if(isset($template['operator_openid'])){
|
|
|
|
if(strstr($template['operator_openid'],'_',-4)=='tele'){ //话机操作
|
|
|
|
$array['data']['list'][$key]['operator_openid'] = '电话机';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(strstr($template['operator_openid'],'_',-4)=='wind'){ //PC操作
|
|
|
|
$array['data']['list'][$key]['operator_openid'] = 'PC';
|
|
|
|
}
|
|
|
|
|
|
|
|
if(strstr($template['operator_openid'],'_',-4)=='chat'){ //PC操作
|
|
|
|
$array['data']['list'][$key]['operator_openid'] = '小程序';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//print_r($array['data']['list']);die;
|
|
|
|
return $result = [
|
|
|
|
'code'=>0,'msg'=>'获取成功!',
|
|
|
|
'data'=>$array['data']['list'],
|
|
|
|
'count'=>$array['data']['total'],
|
|
|
|
'rel'=>1
|
|
|
|
];
|
|
|
|
}
|
|
|
|
$this->assign ( 'title','C端预定订单管理');
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 状态设置
|
|
|
|
*/
|
|
|
|
public function setReserveStatus(){
|
|
|
|
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
|
|
|
|
$data['cause'] = json_encode(array('uid'=>-1,'uname'=>session('username'),'desc'=>$data['cause']));
|
|
|
|
|
|
|
|
$list= file_get_contents(ON_LINE.'App.Reserve.SetReserveStatus&rid='.$data['id'].'&status='.$data['status'].'&cause='.$data['cause']);
|
|
|
|
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
if($array['ret']==200){
|
|
|
|
$result['code'] = 1;
|
|
|
|
$result['msg'] = 'SUCCESS!';
|
|
|
|
}else{
|
|
|
|
$result['code'] = 0;
|
|
|
|
$result['msg'] = '请求错误!';
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
return view();
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|