Showing
2 changed files
with
906 additions
and
0 deletions
application/admin/controller/Area.php
0 → 100644
| 1 | +<?php | ||
| 2 | +namespace app\admin\controller; | ||
| 3 | +use think\Db; | ||
| 4 | +use think\facade\Request; | ||
| 5 | +class Area extends Common | ||
| 6 | +{ | ||
| 7 | + /** | ||
| 8 | + ***代理商管理 | ||
| 9 | + *** | ||
| 10 | + **/ | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + /** | ||
| 14 | + * 商家list | ||
| 15 | + */ | ||
| 16 | + public function sellerList(){ | ||
| 17 | + if(Request::isAjax()){ | ||
| 18 | + $data = Request::except('file'); | ||
| 19 | + $key= input('post.key') ? input('post.key') : ""; | ||
| 20 | + $channel = @$key['channel'] ? @$key['channel'] : 1; | ||
| 21 | + | ||
| 22 | + $address = @$key['address'] ? @$key['address'] : ''; | ||
| 23 | + $prov = @$key['prov'] ? @$key['prov'] : ''; | ||
| 24 | + $city = @$key['city'] ? @$key['city'] : ''; | ||
| 25 | + $area = @$key['area'] ? @$key['area'] : ''; | ||
| 26 | + | ||
| 27 | + $limit = '&x='.$data["page"].'&y='.$data["limit"].'&keywords='.@$key['id'].'&channel='.$channel.'&address='.$address.'&prov='.$prov.'&city='.$city.'&area='.$area; | ||
| 28 | + | ||
| 29 | + //获取运营人员列表 | ||
| 30 | + $list= file_get_contents(ON_LINE.'App.Seller.GetSellerList'.$limit); | ||
| 31 | + $array = json_decode($list,TRUE); | ||
| 32 | + foreach ($array['data'][0]['data'] as $key => $value) { | ||
| 33 | + $array['data'][0]['data'][$key]['cdate'] = date("Y-m-d H:i:s",$value['cdate']); | ||
| 34 | + if($value['status']==1) | ||
| 35 | + $array['data'][0]['data'][$key]['statusVal'] = "启用"; | ||
| 36 | + else | ||
| 37 | + $array['data'][0]['data'][$key]['statusVal'] = "停用"; | ||
| 38 | + | ||
| 39 | + $c_name = array(); | ||
| 40 | + $t_name = array(); | ||
| 41 | + //2019-03-05 增加菜系配置、商家类型配置 | ||
| 42 | + if(is_array($value['cuisine'])){ | ||
| 43 | + foreach ($value['cuisine'] as $k => $v) { | ||
| 44 | + $c_name[] = $v['name']; | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + if(is_array($value['type'])){ | ||
| 48 | + foreach ($value['type'] as $k => $v) { | ||
| 49 | + $t_name[] = $v['type_name']; | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + if(!empty($c_name)) | ||
| 53 | + $array['data'][0]['data'][$key]['cuisine'] = implode(',', $c_name); | ||
| 54 | + if(!empty($t_name)) | ||
| 55 | + $array['data'][0]['data'][$key]['type'] = implode(',', $t_name); | ||
| 56 | + } | ||
| 57 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0]['data'],'count'=>$array['data'][0]['total'],'rel'=>1]; | ||
| 58 | + } | ||
| 59 | + $this->assign ( 'title','商户基本信息维护'); | ||
| 60 | + return $this->fetch(); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * 停用商家 | ||
| 65 | + */ | ||
| 66 | + public function configStop(){ | ||
| 67 | + if(Request::isAjax()){ | ||
| 68 | + $data = Request::except('file'); | ||
| 69 | + $data['status'] = $data['status'] ? 0 : 1; | ||
| 70 | + $list= file_get_contents(ON_LINE.'App.Seller.SetStopBySeller&sellerid='.$data['sellerid'].'&status='.$data['status']); | ||
| 71 | + $array = json_decode($list,TRUE); | ||
| 72 | + if($array['ret']==200){ | ||
| 73 | + $result['code'] = 1; | ||
| 74 | + $result['msg'] = 'SUCCESS!'; | ||
| 75 | + }else{ | ||
| 76 | + $result['code'] = 0; | ||
| 77 | + $result['msg'] = '请求错误!'; | ||
| 78 | + } | ||
| 79 | + return $result; | ||
| 80 | + } | ||
| 81 | + return view(); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * 从商家维度统计:订单、短信等情况 | ||
| 86 | + */ | ||
| 87 | + public function getStatistics(){ | ||
| 88 | + if(Request::isAjax()){ | ||
| 89 | + $data = Request::except('file'); | ||
| 90 | + $key= input('post.key') ? input('post.key') : ""; | ||
| 91 | + | ||
| 92 | + $sid = $data['sid'] ? implode(',', $data['sid']) : ''; | ||
| 93 | + $sellername = $data['key'] ? $data['key'] : ''; | ||
| 94 | + | ||
| 95 | + $time = $data['time'] ? explode(' - ', $data['time']) : ''; | ||
| 96 | + | ||
| 97 | + $stime = $time ? strtotime(date($time[0],time())) : ''; | ||
| 98 | + $etime = $time ? strtotime(date($time[1],time())) : ''; | ||
| 99 | + | ||
| 100 | + $data['time_type'] = $data['time_type'] ? $data['time_type'] : 1; | ||
| 101 | + $data['channel'] = $data['channel'] ? $data['channel'] : 1; | ||
| 102 | + | ||
| 103 | + $parame = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$sellername.'&stime='.@$stime.'&etime='.@$etime.'&channel='.@$data['channel'].'&sid='.$sid.'&time_type='.@$data['time_type']; | ||
| 104 | + | ||
| 105 | + //获取运营人员列表 | ||
| 106 | + $list= file_get_contents(ON_LINE.'App.Report.GetReserveData'.$parame); | ||
| 107 | + | ||
| 108 | + $array = json_decode($list,TRUE); | ||
| 109 | + | ||
| 110 | + $new_array = array(); | ||
| 111 | + foreach ($array['data'] as $key => $value) { | ||
| 112 | + if(is_array($value)){ | ||
| 113 | + $new_array[$key]['id'] = $value['id']; | ||
| 114 | + $new_array[$key]['sellername'] = $value['sellername']; | ||
| 115 | + $new_array[$key]['contacts_total'] = $value['contacts_total']; | ||
| 116 | + $new_array[$key]['inviting'] = $value['inviting']; | ||
| 117 | + $new_array[$key]['reserve_count'] = $value['appReserveCount'] .'/'. $value['AndroidReserveCount'].'/'. $value['CReserveCount']; | ||
| 118 | + $new_array[$key]['reserve_count_sort'] = $value['appReserveCount'] + $value['AndroidReserveCount'] + $value['CReserveCount']; | ||
| 119 | + $new_array[$key]['sms_send_count'] = $value['appSmsCount'] .'/'. $value['AndroidSmsCount']; | ||
| 120 | + $new_array[$key]['sms_send_count_sort'] = $value['appSmsCount'] + $value['AndroidSmsCount']; | ||
| 121 | + $new_array[$key]['table_room_total'] = $value['table_total'] .'/'. $value['room_total']; | ||
| 122 | + $new_array[$key]['address_component'] = $value['address_component']['province'] && $value['address_component']['city'] ? $value['address_component']['province'] .'-'. $value['address_component']['city'] : '无法获取地区,请检查经纬度是否正确!'; | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + return $result = [ | ||
| 126 | + 'code'=>0,'msg'=>'获取成功!', | ||
| 127 | + 'data'=>$new_array, | ||
| 128 | + 'count'=>$array['data']['total'], | ||
| 129 | + 'countReserve'=>$array['data']['appReserveCount']+$array['data']['AndroidReserveCount']+$array['data']['CReserveCount'], | ||
| 130 | + 'countSms'=>$array['data']['appSmsCount']+$array['data']['AndroidSmsCount'], | ||
| 131 | + 'inviteeCount'=>$array['data']['inviteeCount'], | ||
| 132 | + 'appReserveCount'=>$array['data']['appReserveCount'], | ||
| 133 | + 'AndroidReserveCount'=>$array['data']['AndroidReserveCount'], | ||
| 134 | + 'CReserveCount'=>$array['data']['CReserveCount'], | ||
| 135 | + 'appSmsCount'=>$array['data']['appSmsCount'], | ||
| 136 | + 'AndroidSmsCount'=>$array['data']['AndroidSmsCount'], | ||
| 137 | + 'Contacts'=>$array['data']['Contacts'], | ||
| 138 | + 'rel'=>1 | ||
| 139 | + ]; | ||
| 140 | + } | ||
| 141 | + $this->assign ( 'title','预定订单统计'); | ||
| 142 | + return $this->fetch(); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + /** | ||
| 146 | + * 从设备(电话机)维度统计:订单、短信等情况 | ||
| 147 | + */ | ||
| 148 | + public function getEquipment(){ | ||
| 149 | + if(Request::isAjax()){ | ||
| 150 | + $data = Request::except('file'); | ||
| 151 | + $key= input('post.key') ? input('post.key') : ""; | ||
| 152 | + | ||
| 153 | + $sid = $data['sid'] ? implode(',', $data['sid']) : ''; | ||
| 154 | + $sellername = $data['key'] ? $data['key'] : ''; | ||
| 155 | + | ||
| 156 | + $time = $data['time'] ? explode(' - ', $data['time']) : ''; | ||
| 157 | + | ||
| 158 | + $stime = $time ? strtotime(date($time[0],time())) : ''; | ||
| 159 | + $etime = $time ? strtotime(date($time[1],time())) : ''; | ||
| 160 | + | ||
| 161 | + $data['time_type'] = $data['time_type'] ? $data['time_type'] : 1; | ||
| 162 | + $data['channel'] = $data['channel'] ? $data['channel'] : 1; | ||
| 163 | + | ||
| 164 | + $parame = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$sellername.'&stime='.@$stime.'&etime='.@$etime.'&channel='.@$data['channel'].'&sid='.$sid.'&time_type='.@$data['time_type']; | ||
| 165 | + | ||
| 166 | + //获取运营人员列表 | ||
| 167 | + $list= file_get_contents(ON_LINE.'App.Report.GetReserveDataBydev'.$parame); | ||
| 168 | + $array = json_decode($list,TRUE); | ||
| 169 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['list'],'count'=>$array['data']['total'],'rel'=>1]; | ||
| 170 | + } | ||
| 171 | + $this->assign ( 'title','设备维度统计预定订单'); | ||
| 172 | + return $this->fetch(); | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + /** | ||
| 176 | + * 商家菜系、类型配置 | ||
| 177 | + */ | ||
| 178 | + public function sellerconfig(){ | ||
| 179 | + $data = Request::except('file'); | ||
| 180 | + if(Request::isAjax()){ | ||
| 181 | + $cuisine = !empty($data['cuisine']) ? implode(',', array_keys($data['cuisine'])) : ''; | ||
| 182 | + $type = !empty($data['type']) ? implode(',', array_keys($data['type'])) : ''; | ||
| 183 | + $mode = !empty($data['mode']) ? implode(',', array_keys($data['mode'])) : ''; | ||
| 184 | + $sms_code = !empty($data['sms_code']) ? $data['sms_code'] : ''; | ||
| 185 | + $label = !empty($data['label']) ? implode(',', array_keys($data['label'])) : ''; | ||
| 186 | + $brand = !empty($data['brand']) ? implode(',', array_keys($data['brand'])) : ''; | ||
| 187 | + $label_1_ = !empty($data['label_1_']) ? implode(',', array_keys($data['label_1_'])) : ''; | ||
| 188 | + $label_2_ = !empty($data['label_2_']) ? implode(',', array_keys($data['label_2_'])) : ''; | ||
| 189 | + $label_3_ = !empty($data['label_3_']) ? implode(',', array_keys($data['label_3_'])) : ''; | ||
| 190 | + | ||
| 191 | + if($sms_code) | ||
| 192 | + $res_sms_code= file_get_contents(ON_LINE.'App.SendSMS.SetSellerSmsTemplate&sid='.$data['sellerid'].'&sms_id='.$sms_code); | ||
| 193 | + | ||
| 194 | + if($cuisine) | ||
| 195 | + $res_cuisine= file_get_contents(ON_LINE.'App.Seller.SetSellerCuisine&sellerid='.$data['sellerid'].'&cid='.$cuisine); | ||
| 196 | + //$res_cuisine = json_decode($res_cuisine,TRUE); | ||
| 197 | + if($type) | ||
| 198 | + $res_type= file_get_contents(ON_LINE.'App.Seller.SetSellerType&sellerid='.$data['sellerid'].'&typeid='.$type); | ||
| 199 | + //$res_type = json_decode($res_type,TRUE); | ||
| 200 | + | ||
| 201 | + if($mode) | ||
| 202 | + $res_mode= file_get_contents(ON_LINE.'App.Seller.setSellerMode&sellerid='.$data['sellerid'].'&modeid='.$mode); | ||
| 203 | + //$res_mode = json_decode($res_mode,TRUE); | ||
| 204 | + if($label) | ||
| 205 | + $res_label= file_get_contents(ON_LINE.'App.Seller.setSellerLabel&sid='.$data['sellerid'].'&field='.$label); | ||
| 206 | + | ||
| 207 | + if($brand){ | ||
| 208 | + $del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_brand_rel WHERE sid =".$data['sellerid']); | ||
| 209 | + $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_brand_rel VALUES(".$data['sellerid'].",".$brand.")"); | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + if($label_1_){ | ||
| 213 | + $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)"); | ||
| 214 | + $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_1_.")"); | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + if($label_2_){ | ||
| 218 | + $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)"); | ||
| 219 | + $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_2_.")"); | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + if($label_3_){ | ||
| 223 | + $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)"); | ||
| 224 | + $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_3_.")"); | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + if(isset($data['edition'])){ | ||
| 228 | + $up=Db::query("UPDATE `xt-member-two-LINE`.xt_seller set is_online_reserve = ".$data['edition']." where id = ".$data['sellerid']); | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + if(isset($data['is_tele'])){ | ||
| 232 | + $up=Db::query("UPDATE `xt-member-two-LINE`.xt_seller set is_tele = ".$data['is_tele']." where id = ".$data['sellerid']); | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + | ||
| 236 | + $result['code'] = 1; | ||
| 237 | + $result['msg'] = "配置成功!"; | ||
| 238 | + return $result; | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + //获取商家已有菜系 | ||
| 242 | + $cuisine_list= file_get_contents(ON_LINE.'App.Seller.getSellerCuisine&sellerid='.$data['id']); | ||
| 243 | + $cuisine_list = json_decode($cuisine_list,TRUE); | ||
| 244 | + //获取所有菜系 | ||
| 245 | + $list= file_get_contents(ON_LINE.'App.Reserve.GetCustomerConfig'); | ||
| 246 | + $array = json_decode($list,TRUE); | ||
| 247 | + //组装数据 | ||
| 248 | + foreach ($cuisine_list['data'] as $key => $value) { | ||
| 249 | + foreach ($array['data']['cate'] as $k => $v) { | ||
| 250 | + if($value['cid']==$v['id']){ | ||
| 251 | + $array['data']['cate'][$k]['checked'] = 1; | ||
| 252 | + } | ||
| 253 | + } | ||
| 254 | + } | ||
| 255 | + $this->assign('list',$array['data']['cate']);//获取所有菜系 | ||
| 256 | + | ||
| 257 | + //获取商家已有来源 | ||
| 258 | + $type_list= file_get_contents(ON_LINE.'App.Seller.GetSellerType&sellerid='.$data['id']); | ||
| 259 | + $type_list = json_decode($type_list,TRUE); | ||
| 260 | + //获取来源 | ||
| 261 | + $channel = array(array('id'=>1,'name'=>'合作'),array('id'=>2,'name'=>'推广'),array('id'=>3,'name'=>'测试')); | ||
| 262 | + //组装数据 | ||
| 263 | + foreach ($type_list['data'] as $key => $value) { | ||
| 264 | + foreach ($channel as $k => $v) { | ||
| 265 | + if($value['type_id']==$v['id']){ | ||
| 266 | + $channel[$k]['checked'] = 1; | ||
| 267 | + } | ||
| 268 | + } | ||
| 269 | + } | ||
| 270 | + $this->assign('channel',$channel);//获取所有来源 | ||
| 271 | + | ||
| 272 | + //获取商家已有地图显示方式 | ||
| 273 | + $mode_list= file_get_contents(ON_LINE.'App.Seller.getSellerMode&sellerid='.$data['id']); | ||
| 274 | + $mode_list = json_decode($mode_list,TRUE); | ||
| 275 | + | ||
| 276 | + //获取所有地图显示方式 | ||
| 277 | + $mode= array(array('id'=>1,'name'=>'地图上大图标'),array('id'=>2,'name'=>'地图上文字')); | ||
| 278 | + //组装数据 | ||
| 279 | + foreach ($mode_list['data'] as $key => $value) { | ||
| 280 | + foreach ($mode as $k => $v) { | ||
| 281 | + if($value['sm_id']==$v['id']){ | ||
| 282 | + $mode[$k]['checked'] = 1; | ||
| 283 | + } | ||
| 284 | + } | ||
| 285 | + } | ||
| 286 | + $this->assign('mode',$mode);//获取所有菜系 | ||
| 287 | + | ||
| 288 | + //获取商家已选短信模板 | ||
| 289 | + $template = file_get_contents(ON_LINE.'App.Reserve.SellerInfo&seller_id='.$data['id']); | ||
| 290 | + $template = json_decode($template,TRUE); | ||
| 291 | + //获取短信模板列表 | ||
| 292 | + $template_list = file_get_contents(ON_LINE.'App.SendSMS.GetSmsTemplate'); | ||
| 293 | + $template_list = json_decode($template_list,TRUE); | ||
| 294 | + | ||
| 295 | + //组装数据 | ||
| 296 | + foreach ($template_list['data'] as $key => $value) { | ||
| 297 | + if($value['template_code']==$template['data']['setting']['template_code']){ | ||
| 298 | + $template_list['data'][$key]['checked'] = 1; | ||
| 299 | + } | ||
| 300 | + switch ($value['template_code']) { | ||
| 301 | + case 'SMS_163050401': | ||
| 302 | + $vowels = array( | ||
| 303 | + '周到安排演示店' => '${seller_name}', | ||
| 304 | + '11月25日晚上18:00' => '${date}', | ||
| 305 | + '金台夕照、卢沟晓月' =>'${region_room_name}', | ||
| 306 | + '西电路447号南湖金地西门南100米' =>'${seller_addr}', | ||
| 307 | + '18792581193' =>'${seller_phone}', | ||
| 308 | + '毛毛' =>'${cusman}', | ||
| 309 | + ); | ||
| 310 | + break; | ||
| 311 | + case 'SMS_162733710': | ||
| 312 | + $vowels = array( | ||
| 313 | + '4月6日中午' => '${reserve_date}', | ||
| 314 | + '周到1店西电路447号金台夕照' => '${seller_name_addr_room}', | ||
| 315 | + '毛毛' =>'${cusman}', | ||
| 316 | + ); | ||
| 317 | + break; | ||
| 318 | + case 'SMS_154587043': | ||
| 319 | + $vowels = array( | ||
| 320 | + '侯先生' => '${guest}', | ||
| 321 | + '周到安排演示店' => '${seller_name}', | ||
| 322 | + '11月25日晚上18:00' =>'${date}', | ||
| 323 | + '包间(金台夕照)' =>'${region_room_name}', | ||
| 324 | + '西电路447号南湖金地西门南100米' =>'${seller_addr}', | ||
| 325 | + '18792581193' =>'${seller_phone}\n', | ||
| 326 | + '毛毛' =>'${cusman}', | ||
| 327 | + ); | ||
| 328 | + break; | ||
| 329 | + case 'SMS_164277855': | ||
| 330 | + $vowels = array( | ||
| 331 | + '周到1店西电路447号' => '${seller_name}', | ||
| 332 | + '11月7日晚上18:30' => '${date}', | ||
| 333 | + '包间(金台夕照)' =>'${region_room_name}', | ||
| 334 | + '1879258119' =>'${seller_phone}', | ||
| 335 | + ); | ||
| 336 | + break; | ||
| 337 | + case 'SMS_164268239': | ||
| 338 | + $vowels = array( | ||
| 339 | + '周到安排演示店' => '${seller_name}', | ||
| 340 | + '11月7日晚上18:30' => '${date}', | ||
| 341 | + '包间(金台夕照)' =>'${region_room_name}', | ||
| 342 | + '西电路447号南湖金地西门南100米' =>'${seller_addr}', | ||
| 343 | + '1879258119' =>'${seller_phone}', | ||
| 344 | + ); | ||
| 345 | + break; | ||
| 346 | + default: | ||
| 347 | + # code... | ||
| 348 | + break; | ||
| 349 | + } | ||
| 350 | + $template_list['data'][$key]['content'] = str_replace($vowels, array_keys($vowels),$value['content']); | ||
| 351 | + } | ||
| 352 | + $this->assign('template_list',$template_list['data']);//获取短信模板列表 | ||
| 353 | + | ||
| 354 | + //获取商家拥有哪些标签 | ||
| 355 | + $label_list= file_get_contents(ON_LINE.'App.Seller.GetSellerLabel&sid='.$data['id']); | ||
| 356 | + $label_list = json_decode($label_list,TRUE); | ||
| 357 | + $this->assign('label_list',$label_list['data']); | ||
| 358 | + | ||
| 359 | + //商家标签 | ||
| 360 | + //原生: | ||
| 361 | + //$label_c=Db::query("SELECT * from xt-member-two-LINE.xt_dc_dz_seller_label_c"); | ||
| 362 | + $label_c=Db::table("xt-member-two-LINE.xt_dc_dz_seller_label_c")->select(); | ||
| 363 | + $label_c_rel=Db::table("xt-member-two-LINE.xt_dc_dz_seller_label_c_rel")->where(array('sid'=>$data['id']))->select(); | ||
| 364 | + //组装数据 | ||
| 365 | + foreach ($label_c as $key => $value) { | ||
| 366 | + foreach ($label_c_rel as $k => $v) { | ||
| 367 | + if($value['id']==$v['lcid']){ | ||
| 368 | + $label_c[$key]['checked'] = 1; | ||
| 369 | + } | ||
| 370 | + } | ||
| 371 | + } | ||
| 372 | + $this->assign('label_c',$label_c); | ||
| 373 | + | ||
| 374 | + //商家品牌 | ||
| 375 | + $brand=Db::table("xt-member-two-LINE.xt_dc_dz_seller_brand")->select(); | ||
| 376 | + $brand_rel=Db::table("xt-member-two-LINE.xt_dc_dz_seller_brand_rel")->where(array('sid'=>$data['id']))->select(); | ||
| 377 | + //组装数据 | ||
| 378 | + foreach ($brand as $key => $value) { | ||
| 379 | + foreach ($brand_rel as $k => $v) { | ||
| 380 | + if($value['id']==$v['bid']){ | ||
| 381 | + $brand[$key]['checked'] = 1; | ||
| 382 | + } | ||
| 383 | + } | ||
| 384 | + } | ||
| 385 | + $this->assign('brand',$brand); | ||
| 386 | + | ||
| 387 | + | ||
| 388 | + $is_online_reserve=Db::table("xt-member-two-LINE.xt_seller")->where(array('id'=>$data['id']))->select(); | ||
| 389 | + | ||
| 390 | + //获取商家在线预定版本情况 | ||
| 391 | + $this->assign('is_online_reserve',$is_online_reserve[0]['is_online_reserve']); | ||
| 392 | + //是否安装电话机 | ||
| 393 | + $this->assign('is_tele',$is_online_reserve[0]['is_tele']); | ||
| 394 | + | ||
| 395 | + //商户信息 | ||
| 396 | + $this->assign ('data',$data); | ||
| 397 | + $this->assign ( 'title','商户信息配置' ); | ||
| 398 | + return $this->fetch(); | ||
| 399 | + } | ||
| 400 | + | ||
| 401 | + /** | ||
| 402 | + * 商家基础信息配置 | ||
| 403 | + */ | ||
| 404 | + public function setsellerconfig(){ | ||
| 405 | + if(Request::isAjax()){ | ||
| 406 | + $data = Request::except('file'); | ||
| 407 | + $data['status'] = $data['status'] ? 0 : 1; | ||
| 408 | + $list= file_get_contents(ON_LINE.'App.Seller.SetSellerConfigByPC&sid='.$data['sellerid'].'&field='.$data['field'].'&value='.$data['value']); | ||
| 409 | + $array = json_decode($list,TRUE); | ||
| 410 | + if($array['ret']==200){ | ||
| 411 | + $result['code'] = 1; | ||
| 412 | + $result['msg'] = 'SUCCESS!'; | ||
| 413 | + }else{ | ||
| 414 | + $result['code'] = 0; | ||
| 415 | + $result['msg'] = '请求错误!'; | ||
| 416 | + } | ||
| 417 | + return $result; | ||
| 418 | + } | ||
| 419 | + return view(); | ||
| 420 | + } | ||
| 421 | + | ||
| 422 | + /** | ||
| 423 | + * 商家详情 | ||
| 424 | + */ | ||
| 425 | + public function sellerdetail(){ | ||
| 426 | + //print_r(Request::except('file'));die; | ||
| 427 | + $data = Request::except('file'); | ||
| 428 | + //获取运营人员列表 | ||
| 429 | + $list= file_get_contents(ON_LINE.'App.Seller.GetSellerById&sellerid='.$data['sid']); | ||
| 430 | + $array = json_decode($list,TRUE); | ||
| 431 | + if($array['data']['data']){ | ||
| 432 | + $array['data']['data']['daily'] = json_decode($array['data']['data']['daily'],TRUE); | ||
| 433 | + $array['data']['data']['daily_time'] = json_decode($array['data']['data']['daily_time'],TRUE); | ||
| 434 | + $array['data']['data']['cdate'] = date("Y年m月d日 H时i分s秒",$array['data']['data']['cdate']); | ||
| 435 | + } | ||
| 436 | + //获取短信流水 | ||
| 437 | + $sms= file_get_contents(ON_LINE.'App.SendSMS.GetSellerSmsFlowing&sid='.$data['sid']); | ||
| 438 | + $sms_data = json_decode($sms,TRUE); | ||
| 439 | + $sms_data_list = $sms_data['data'] ? $sms_data['data'] : array(); | ||
| 440 | + $this->assign ( 'smslist',$sms_data_list); | ||
| 441 | + $this->assign ( 'data',$array['data']['data']); | ||
| 442 | + $this->assign ( 'title','商家详情页面'); | ||
| 443 | + return $this->fetch(); | ||
| 444 | + } | ||
| 445 | + | ||
| 446 | + //商家列表 用于配置商家活动 | ||
| 447 | + public function seller_activity_list(){ | ||
| 448 | + if(Request::isAjax()){ | ||
| 449 | + $data = Request::except('file'); | ||
| 450 | + $key= input('post.key') ? input('post.key') : ""; | ||
| 451 | + $channel = @$key['channel'] ? @$key['channel'] : 1; | ||
| 452 | + $limit = '&x='.$data["page"].'&y='.$data["limit"].'&keywords='.@$key['id'].'&channel='.$channel; | ||
| 453 | + | ||
| 454 | + //获取运营人员列表 | ||
| 455 | + $list= file_get_contents(ON_LINE.'App.Seller.GetSellerListByActivity'.$limit); | ||
| 456 | + $array = json_decode($list,TRUE); | ||
| 457 | + foreach($array['data'][0]['data'] as $key=>$value){ | ||
| 458 | + if(!empty($value['activity'])){ | ||
| 459 | + foreach ($value['activity'] as $k => $v) { | ||
| 460 | + $str[$key][] = ($k+1).'、'.$v['title']; | ||
| 461 | + } | ||
| 462 | + $array['data'][0]['data'][$key]['activity'] = implode('<br/>', $str[$key]); | ||
| 463 | + //$array['data'][0]['data'][$key]['activity'] = implode('<br/>', array_column($value['activity'], 'title')); | ||
| 464 | + } | ||
| 465 | + } | ||
| 466 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0]['data'],'count'=>$array['data'][0]['total'],'rel'=>1]; | ||
| 467 | + } | ||
| 468 | + $this->assign ( 'title','商家活动配置'); | ||
| 469 | + return $this->fetch(); | ||
| 470 | + } | ||
| 471 | + | ||
| 472 | + /** | ||
| 473 | + * 商家活动列表页 | ||
| 474 | + */ | ||
| 475 | + public function seller_activity(){ | ||
| 476 | + $data = Request::except('file'); | ||
| 477 | + //获取商家现有活动 | ||
| 478 | + $seller_activity= file_get_contents(ON_LINE.'App.Seller.GetSellerActivity&sid='.$data['id']); | ||
| 479 | + $seller_activity = json_decode($seller_activity,TRUE); | ||
| 480 | + //活动列表 | ||
| 481 | + $this->assign('sid',$data['id']); | ||
| 482 | + $this->assign ( 'seller_activity',$seller_activity['data']); | ||
| 483 | + $this->assign ( 'title','商家活动配置页面'); | ||
| 484 | + return $this->fetch(); | ||
| 485 | + } | ||
| 486 | + | ||
| 487 | + //添加活动 | ||
| 488 | + public function add_activity(){ | ||
| 489 | + $data = Request::except('file'); | ||
| 490 | + if(Request::isAjax()){ | ||
| 491 | + switch ($data['type']) { | ||
| 492 | + case '1': | ||
| 493 | + if($data['max_num']==0){ | ||
| 494 | + $data['title'] = '立减'.$data['min_num'];break; | ||
| 495 | + }else{ | ||
| 496 | + $data['title'] = '满'.$data['max_num'].'立减'.$data['min_num'];break; | ||
| 497 | + } | ||
| 498 | + case '2': | ||
| 499 | + $data['title'] = '满赠'; | ||
| 500 | + break; | ||
| 501 | + case '3': | ||
| 502 | + if($data['max_num']==0){ | ||
| 503 | + $data['title'] = $data['min_num'].'折';break; | ||
| 504 | + }else{ | ||
| 505 | + $data['title'] = '满'.$data['max_num'].'立享'.$data['min_num'].'折';break; | ||
| 506 | + } | ||
| 507 | + case '4': | ||
| 508 | + $data['title'] = $data['max_num'].'元代金券'; | ||
| 509 | + break; | ||
| 510 | + case '5': | ||
| 511 | + $data['title'] = '会员价'; | ||
| 512 | + break; | ||
| 513 | + default: | ||
| 514 | + # code... | ||
| 515 | + break; | ||
| 516 | + } | ||
| 517 | + //字段空值过滤 | ||
| 518 | + //添加活动 | ||
| 519 | + $res= file_get_contents(ON_LINE.'App.Seller.SetActivity&str='.serialize($data)); | ||
| 520 | + $res = json_decode($res,TRUE); | ||
| 521 | + if($data['aid']){ | ||
| 522 | + if($res['data']){ | ||
| 523 | + $result = ['code'=>1,'msg'=>'修改成功!','rel'=>1]; | ||
| 524 | + }else{ | ||
| 525 | + $result = ['code'=>0,'msg'=>'修改失败!','rel'=>1]; | ||
| 526 | + } | ||
| 527 | + }else{ | ||
| 528 | + if($res['data']){ | ||
| 529 | + $result = ['code'=>1,'msg'=>'添加成功!','rel'=>1]; | ||
| 530 | + }else{ | ||
| 531 | + $result = ['code'=>0,'msg'=>'添加失败!','rel'=>1]; | ||
| 532 | + } | ||
| 533 | + } | ||
| 534 | + return $result; | ||
| 535 | + } | ||
| 536 | + if($data['id']){ | ||
| 537 | + //修改---需要获取对应的数据 | ||
| 538 | + $activity= file_get_contents(ON_LINE.'App.Seller.GetSellerActivityById&id='.$data['id']); | ||
| 539 | + $activity = json_decode($activity,TRUE); | ||
| 540 | + $this->assign ('data',$activity['data']); | ||
| 541 | + $this->assign ( 'title','修改活动'); | ||
| 542 | + } | ||
| 543 | + $this->assign ( 'hid',$data['sid']); | ||
| 544 | + $this->assign ( 'title','添加活动'); | ||
| 545 | + return $this->fetch(); | ||
| 546 | + } | ||
| 547 | + | ||
| 548 | + //删除活动 | ||
| 549 | + public function del_activity(){ | ||
| 550 | + $data = Request::except('file'); | ||
| 551 | + $res= file_get_contents(ON_LINE.'App.Seller.DelSellerActivity&sid='.$data['sid'].'&aid='.$data['aid']); | ||
| 552 | + $res = json_decode($res,TRUE); | ||
| 553 | + $this->redirect('Seller/seller_activity', ['id' => $data['sid']]); | ||
| 554 | + //return $this->fetch('seller_activity',['id' => $data['sid']]); | ||
| 555 | + } | ||
| 556 | + | ||
| 557 | + //商家设备列表 | ||
| 558 | + public function device_list(){ | ||
| 559 | + //获取类型 | ||
| 560 | + $facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer"); | ||
| 561 | + if(Request::isAjax()){ | ||
| 562 | + $data = Request::except('file'); | ||
| 563 | + $channel = @$data['channel'] ? @$data['channel'] : 1; | ||
| 564 | + $manufacturer = @$data['manufacturer'] ? @$data['manufacturer'] : 1; | ||
| 565 | + | ||
| 566 | + $limit = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$data['key'].'&channel='.$channel.'&type='.$manufacturer; | ||
| 567 | + | ||
| 568 | + //获取运营人员列表 | ||
| 569 | + $list= file_get_contents(ON_LINE.'App.Device.GetDeviceOnlineStatus'.$limit); //GetSellerDevice | ||
| 570 | + $array = json_decode($list,TRUE); | ||
| 571 | + foreach ($array['data']['list'] as $key => $value) { | ||
| 572 | + switch ($value['type']) { | ||
| 573 | + case '0': | ||
| 574 | + $array['data']['list'][$key]['type'] = $facturer[0]['facturer']; | ||
| 575 | + break; | ||
| 576 | + case '1': | ||
| 577 | + $array['data']['list'][$key]['type'] = $facturer[0]['facturer']; | ||
| 578 | + break; | ||
| 579 | + case '2': | ||
| 580 | + $array['data']['list'][$key]['type'] = $facturer[1]['facturer']; | ||
| 581 | + break; | ||
| 582 | + case '3': | ||
| 583 | + $array['data']['list'][$key]['type'] = $facturer[2]['facturer']; | ||
| 584 | + break; | ||
| 585 | + case '4': | ||
| 586 | + $array['data']['list'][$key]['type'] = $facturer[3]['facturer']; | ||
| 587 | + break; | ||
| 588 | + | ||
| 589 | + default: | ||
| 590 | + $array['data']['list'][$key]['type'] = 'error: '.$value['type']; | ||
| 591 | + break; | ||
| 592 | + } | ||
| 593 | + | ||
| 594 | + } | ||
| 595 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['list'],'count'=>$array['data']['total'],'rel'=>1]; | ||
| 596 | + } | ||
| 597 | + $this->assign ( 'facturer',$facturer); | ||
| 598 | + $this->assign ( 'title','商家设备列表'); | ||
| 599 | + return $this->fetch(); | ||
| 600 | + } | ||
| 601 | + | ||
| 602 | + //商家设备列表 | ||
| 603 | + public function add_gray_user(){ | ||
| 604 | + if(Request::isAjax()){ | ||
| 605 | + $data = Request::except('file'); | ||
| 606 | + $list= file_get_contents(ON_LINE.'App.Device.SetGrayUser&ids='.serialize($data['id'])); | ||
| 607 | + $array = json_decode($list,TRUE); | ||
| 608 | + if($array['ret']==200){ | ||
| 609 | + $result['code'] = 1; | ||
| 610 | + $result['msg'] = 'SUCCESS!'; | ||
| 611 | + }else{ | ||
| 612 | + $result['code'] = 0; | ||
| 613 | + $result['msg'] = '服务器错误,请勿重复将设备号添加到灰度用户!'; | ||
| 614 | + } | ||
| 615 | + return $result; | ||
| 616 | + } | ||
| 617 | + return view(); | ||
| 618 | + } | ||
| 619 | + | ||
| 620 | + //灰度用户列表 | ||
| 621 | + public function gray_user_list(){ | ||
| 622 | + //获取类型 | ||
| 623 | + $facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer"); | ||
| 624 | + $this->assign ( 'facturer',$facturer); | ||
| 625 | + if(Request::isAjax()){ | ||
| 626 | + $data = Request::except('file'); | ||
| 627 | + $channel = @$data['channel'] ? @$data['channel'] : 1; | ||
| 628 | + $manufacturer = @$data['manufacturer'] ? @$data['manufacturer'] : 1; | ||
| 629 | + | ||
| 630 | + $limit = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$data['key'].'&channel='.$channel.'&type='.$manufacturer; | ||
| 631 | + | ||
| 632 | + $list= file_get_contents(ON_LINE.'App.Device.GetGrayUserList'.$limit); | ||
| 633 | + $array = json_decode($list,TRUE); | ||
| 634 | + foreach ($array['data']['list'] as $key => $value) { | ||
| 635 | + switch ($value['type']) { | ||
| 636 | + case '1': | ||
| 637 | + $array['data']['list'][$key]['type'] = $facturer[0]['facturer']; | ||
| 638 | + break; | ||
| 639 | + case '2': | ||
| 640 | + $array['data']['list'][$key]['type'] = $facturer[1]['facturer']; | ||
| 641 | + break; | ||
| 642 | + case '3': | ||
| 643 | + $array['data']['list'][$key]['type'] = $facturer[2]['facturer']; | ||
| 644 | + break; | ||
| 645 | + case '4': | ||
| 646 | + $array['data']['list'][$key]['type'] = $facturer[3]['facturer']; | ||
| 647 | + break; | ||
| 648 | + | ||
| 649 | + default: | ||
| 650 | + $array['data']['list'][$key]['type'] = 'error'; | ||
| 651 | + break; | ||
| 652 | + } | ||
| 653 | + } | ||
| 654 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['list'],'count'=>$array['data']['total'],'rel'=>1]; | ||
| 655 | + } | ||
| 656 | + //获取类型 | ||
| 657 | + $facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer"); | ||
| 658 | + $this->assign ( 'facturer',$facturer); | ||
| 659 | + $this->assign ( 'title','灰度用户列表'); | ||
| 660 | + return $this->fetch(); | ||
| 661 | + } | ||
| 662 | + | ||
| 663 | + //删除灰度用户 | ||
| 664 | + public function del_gray_user(){ | ||
| 665 | + if(Request::isAjax()){ | ||
| 666 | + $data = Request::except('file'); | ||
| 667 | + $list= file_get_contents(ON_LINE.'App.Device.DelGrayUser&jsstr='.serialize($data['id'])); | ||
| 668 | + $array = json_decode($list,TRUE); | ||
| 669 | + | ||
| 670 | + if($array['ret']==200){ | ||
| 671 | + $result['code'] = 1; | ||
| 672 | + $result['msg'] = 'SUCCESS!'; | ||
| 673 | + }else{ | ||
| 674 | + $result['code'] = 0; | ||
| 675 | + $result['msg'] = '请刷新页面重新尝试!'; | ||
| 676 | + } | ||
| 677 | + return $result; | ||
| 678 | + } | ||
| 679 | + return view(); | ||
| 680 | + } | ||
| 681 | + | ||
| 682 | + //获取在线设备情况 | ||
| 683 | + public function get_device_online_status(){ | ||
| 684 | + //获取类型 | ||
| 685 | + $facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer"); | ||
| 686 | + if(Request::isAjax()){ | ||
| 687 | + $data = Request::except('file'); | ||
| 688 | + $channel = @$data['channel'] ? @$data['channel'] : 1; | ||
| 689 | + $manufacturer = @$data['manufacturer'] ? @$data['manufacturer'] : 1; | ||
| 690 | + | ||
| 691 | + $limit = '&page='.$data["page"].'&size='.$data["limit"].'&sellername='.@$data['key'].'&channel='.$channel.'&type='.$manufacturer; | ||
| 692 | + | ||
| 693 | + $list= file_get_contents(ON_LINE.'App.Device.GetDeviceOnlineStatus'.$limit); | ||
| 694 | + $array = json_decode($list,TRUE); | ||
| 695 | + foreach ($array['data']['list'] as $key => $value) { | ||
| 696 | + switch ($value['type']) { | ||
| 697 | + case '0': | ||
| 698 | + $array['data']['list'][$key]['type'] = $facturer[0]['facturer']; | ||
| 699 | + break; | ||
| 700 | + case '1': | ||
| 701 | + $array['data']['list'][$key]['type'] = $facturer[0]['facturer']; | ||
| 702 | + break; | ||
| 703 | + case '2': | ||
| 704 | + $array['data']['list'][$key]['type'] = $facturer[1]['facturer']; | ||
| 705 | + break; | ||
| 706 | + case '3': | ||
| 707 | + $array['data']['list'][$key]['type'] = $facturer[2]['facturer']; | ||
| 708 | + break; | ||
| 709 | + case '4': | ||
| 710 | + $array['data']['list'][$key]['type'] = $facturer[3]['facturer']; | ||
| 711 | + break; | ||
| 712 | + | ||
| 713 | + default: | ||
| 714 | + $array['data']['list'][$key]['type'] = $value['type']; | ||
| 715 | + break; | ||
| 716 | + } | ||
| 717 | + } | ||
| 718 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['list'],'count'=>$array['data']['total'],'rel'=>1]; | ||
| 719 | + } | ||
| 720 | + $this->assign ( 'facturer',$facturer); | ||
| 721 | + $this->assign ( 'title','商家话机在线设备列表'); | ||
| 722 | + return $this->fetch(); | ||
| 723 | + } | ||
| 724 | + | ||
| 725 | + /** | ||
| 726 | + * 从商家维度统计:订单、短信等情况 | ||
| 727 | + */ | ||
| 728 | + public function GetReserveList(){ | ||
| 729 | + //获取类型 | ||
| 730 | + $facturer = Db::query("SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_facturer"); | ||
| 731 | + if(Request::isAjax()){ | ||
| 732 | + $data = Request::except('file'); | ||
| 733 | + $key= input('post.key') ? input('post.key') : ""; | ||
| 734 | + $nokey= input('post.nokey') ? input('post.nokey') : ""; | ||
| 735 | + | ||
| 736 | + $sellername = $data['key'] ? $data['key'] : ''; //商家名称 | ||
| 737 | + $id = $data['nokey'] ? $data['nokey'] : ''; //订单ID | ||
| 738 | + | ||
| 739 | + $time = $data['time'] ? explode(' - ', $data['time']) : ''; | ||
| 740 | + | ||
| 741 | + $stime = $time ? strtotime(date($time[0],time())) : strtotime(date('Y-m-d 00:00:00',time())); | ||
| 742 | + $etime = $time ? strtotime(date($time[1],time())) : strtotime(date('Y-m-d 23:59:59',time())); | ||
| 743 | + | ||
| 744 | + $dtime = $data['dtime'] ? explode(' - ', $data['dtime']) : ''; | ||
| 745 | + | ||
| 746 | + $sdtime = $dtime ? strtotime(date($dtime[0],time())) : ''; | ||
| 747 | + $edtime = $dtime ? strtotime(date($dtime[1],time())) : ''; | ||
| 748 | + | ||
| 749 | + $data['status'] = $data['status'] ? $data['status'] : 2; | ||
| 750 | + $data['channel'] = $data['channel'] ? $data['channel'] : 1; | ||
| 751 | + | ||
| 752 | + $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; | ||
| 753 | + | ||
| 754 | + //获取运营人员列表 | ||
| 755 | + $list= file_get_contents(ON_LINE.'App.Customer.GetReserveList'.$parame); | ||
| 756 | + $array = json_decode($list,TRUE); | ||
| 757 | + | ||
| 758 | + $new_array = array(); | ||
| 759 | + foreach ($array['data']['list'] as $key => $value) { | ||
| 760 | + //有无设备 | ||
| 761 | + if($value['is_tele']==1){ | ||
| 762 | + switch ($value['type']) { | ||
| 763 | + case '1': | ||
| 764 | + $array['data']['list'][$key]['dv'] = $facturer[0]['facturer']; | ||
| 765 | + break; | ||
| 766 | + case '2': | ||
| 767 | + $array['data']['list'][$key]['dv'] = $facturer[1]['facturer']; | ||
| 768 | + break; | ||
| 769 | + case '3': | ||
| 770 | + $array['data']['list'][$key]['dv'] = $facturer[2]['facturer']; | ||
| 771 | + break; | ||
| 772 | + case '4': | ||
| 773 | + $array['data']['list'][$key]['dv'] = $facturer[3]['facturer']; | ||
| 774 | + break; | ||
| 775 | + default: | ||
| 776 | + $array['data']['list'][$key]['dv'] = '无'; | ||
| 777 | + break; | ||
| 778 | + } | ||
| 779 | + }else{ | ||
| 780 | + $array['data']['list'][$key]['dv'] = '无'; | ||
| 781 | + } | ||
| 782 | + //订单接受时间段 | ||
| 783 | + switch ($value['ddate_solt']) { | ||
| 784 | + //'未设置/早市/午市/晚市/夜宵 0/1/2/3/4', | ||
| 785 | + case 0: | ||
| 786 | + $value['ddate_solt'] = '未设置'; | ||
| 787 | + break; | ||
| 788 | + case 1: | ||
| 789 | + $value['ddate_solt'] = '早市'; | ||
| 790 | + break; | ||
| 791 | + case 2: | ||
| 792 | + $value['ddate_solt'] = '午市'; | ||
| 793 | + break; | ||
| 794 | + case 3: | ||
| 795 | + $value['ddate_solt'] = '晚市'; | ||
| 796 | + break; | ||
| 797 | + case 4: | ||
| 798 | + $value['ddate_solt'] = '夜宵'; | ||
| 799 | + break; | ||
| 800 | + default: | ||
| 801 | + # code... | ||
| 802 | + break; | ||
| 803 | + } | ||
| 804 | + $array['data']['list'][$key]['ddate'] = date('Y-m-d H:i:s',$value['ddate']).'['.$value['ddate_solt'].']'; | ||
| 805 | + $array['data']['list'][$key]['cdate'] = date('Y-m-d H:i:s',$value['cdate']); | ||
| 806 | + $array['data']['list'][$key]['handle_time'] = $value['handle_time'] ? date('Y-m-d H:i:s',$value['handle_time']) : ''; | ||
| 807 | + $array['data']['list'][$key]['rec_date'] = $value['rec_date'] ? date('Y-m-d H:i:s',$value['rec_date']) : ''; | ||
| 808 | + switch ($value['status']) { | ||
| 809 | + case 0: | ||
| 810 | + $array['data']['list'][$key]['sta'] = '待确认'; | ||
| 811 | + break; | ||
| 812 | + case 1: | ||
| 813 | + $array['data']['list'][$key]['sta'] = '已定座'; | ||
| 814 | + break; | ||
| 815 | + case 2: | ||
| 816 | + $array['data']['list'][$key]['sta'] = '到店'; | ||
| 817 | + break; | ||
| 818 | + case 3: | ||
| 819 | + $array['data']['list'][$key]['sta'] = '离店'; | ||
| 820 | + break; | ||
| 821 | + case 4: | ||
| 822 | + $array['data']['list'][$key]['sta'] = '已取消'; | ||
| 823 | + break; | ||
| 824 | + case 5: | ||
| 825 | + $array['data']['list'][$key]['sta'] = '已分配'; | ||
| 826 | + break; | ||
| 827 | + case 6: | ||
| 828 | + $array['data']['list'][$key]['sta'] = '拒单'; | ||
| 829 | + break; | ||
| 830 | + default: | ||
| 831 | + # code... | ||
| 832 | + break; | ||
| 833 | + } | ||
| 834 | + switch ($value['sex']) { | ||
| 835 | + case 1: | ||
| 836 | + $array['data']['list'][$key]['rname'] = $value['rname'].'先生'.'('.$value['phone'].')'; | ||
| 837 | + break; | ||
| 838 | + case 2: | ||
| 839 | + $array['data']['list'][$key]['rname'] = $value['rname'].'女士'.'('.$value['phone'].')'; | ||
| 840 | + break; | ||
| 841 | + case 3: | ||
| 842 | + $array['data']['list'][$key]['rname'] = $value['rname'].'公司'.'('.$value['phone'].')'; | ||
| 843 | + break; | ||
| 844 | + default: | ||
| 845 | + # code... | ||
| 846 | + break; | ||
| 847 | + } | ||
| 848 | + | ||
| 849 | + if($value['room_demand']){ | ||
| 850 | + $array['data']['list'][$key]['room_demand'] = implode(',',array_column(json_decode($value['room_demand'],true), 'name')); | ||
| 851 | + } | ||
| 852 | + | ||
| 853 | + $array['data']['list'][$key]['sta'] = $value['is_tele']==1 ? $array['data']['list'][$key]['sta'] : $array['data']['list'][$key]['sta'].'无话机'; | ||
| 854 | + | ||
| 855 | + //根据操作人识别操作终端 | ||
| 856 | + if(isset($template['operator_openid'])){ | ||
| 857 | + if(strstr($template['operator_openid'],'_',-4)=='tele'){ //话机操作 | ||
| 858 | + $array['data']['list'][$key]['operator_openid'] = '电话机'; | ||
| 859 | + } | ||
| 860 | + | ||
| 861 | + if(strstr($template['operator_openid'],'_',-4)=='wind'){ //PC操作 | ||
| 862 | + $array['data']['list'][$key]['operator_openid'] = 'PC'; | ||
| 863 | + } | ||
| 864 | + | ||
| 865 | + if(strstr($template['operator_openid'],'_',-4)=='chat'){ //PC操作 | ||
| 866 | + $array['data']['list'][$key]['operator_openid'] = '小程序'; | ||
| 867 | + } | ||
| 868 | + } | ||
| 869 | + } | ||
| 870 | + //print_r($array['data']['list']);die; | ||
| 871 | + return $result = [ | ||
| 872 | + 'code'=>0,'msg'=>'获取成功!', | ||
| 873 | + 'data'=>$array['data']['list'], | ||
| 874 | + 'count'=>$array['data']['total'], | ||
| 875 | + 'rel'=>1 | ||
| 876 | + ]; | ||
| 877 | + } | ||
| 878 | + $this->assign ( 'title','C端预定订单管理'); | ||
| 879 | + return $this->fetch(); | ||
| 880 | + } | ||
| 881 | + | ||
| 882 | + /** | ||
| 883 | + * 状态设置 | ||
| 884 | + */ | ||
| 885 | + public function setReserveStatus(){ | ||
| 886 | + | ||
| 887 | + if(Request::isAjax()){ | ||
| 888 | + $data = Request::except('file'); | ||
| 889 | + | ||
| 890 | + $data['cause'] = json_encode(array('uid'=>-1,'uname'=>session('username'),'desc'=>$data['cause'])); | ||
| 891 | + | ||
| 892 | + $list= file_get_contents(ON_LINE.'App.Reserve.SetReserveStatus&rid='.$data['id'].'&status='.$data['status'].'&cause='.$data['cause']); | ||
| 893 | + | ||
| 894 | + $array = json_decode($list,TRUE); | ||
| 895 | + if($array['ret']==200){ | ||
| 896 | + $result['code'] = 1; | ||
| 897 | + $result['msg'] = 'SUCCESS!'; | ||
| 898 | + }else{ | ||
| 899 | + $result['code'] = 0; | ||
| 900 | + $result['msg'] = '请求错误!'; | ||
| 901 | + } | ||
| 902 | + return $result; | ||
| 903 | + } | ||
| 904 | + return view(); | ||
| 905 | + } | ||
| 906 | +} |
application/admin/view/area/Seller.html
0 → 100644
-
Please register or login to post a comment