|
@@ -1012,4 +1012,230 @@ class Area extends Common |
|
@@ -1012,4 +1012,230 @@ class Area extends Common |
|
1012
|
}
|
1012
|
}
|
|
1013
|
return view();
|
1013
|
return view();
|
|
1014
|
}
|
1014
|
}
|
|
|
|
1015
|
+
|
|
|
|
1016
|
+ /**
|
|
|
|
1017
|
+ * 商家菜系、类型配置
|
|
|
|
1018
|
+ */
|
|
|
|
1019
|
+ public function sellerconfig(){
|
|
|
|
1020
|
+ $data = Request::except('file');
|
|
|
|
1021
|
+ if(Request::isAjax()){
|
|
|
|
1022
|
+ $cuisine = !empty($data['cuisine']) ? implode(',', array_keys($data['cuisine'])) : '';
|
|
|
|
1023
|
+ $type = !empty($data['type']) ? implode(',', array_keys($data['type'])) : '';
|
|
|
|
1024
|
+ $mode = !empty($data['mode']) ? implode(',', array_keys($data['mode'])) : '';
|
|
|
|
1025
|
+ $sms_code = !empty($data['sms_code']) ? $data['sms_code'] : '';
|
|
|
|
1026
|
+ $label = !empty($data['label']) ? implode(',', array_keys($data['label'])) : '';
|
|
|
|
1027
|
+ $brand = !empty($data['brand']) ? implode(',', array_keys($data['brand'])) : '';
|
|
|
|
1028
|
+ $label_1_ = !empty($data['label_1_']) ? implode(',', array_keys($data['label_1_'])) : '';
|
|
|
|
1029
|
+ $label_2_ = !empty($data['label_2_']) ? implode(',', array_keys($data['label_2_'])) : '';
|
|
|
|
1030
|
+ $label_3_ = !empty($data['label_3_']) ? implode(',', array_keys($data['label_3_'])) : '';
|
|
|
|
1031
|
+
|
|
|
|
1032
|
+ if($sms_code)
|
|
|
|
1033
|
+ $res_sms_code= file_get_contents(ON_LINE.'App.SendSMS.SetSellerSmsTemplate&sid='.$data['sellerid'].'&sms_id='.$sms_code);
|
|
|
|
1034
|
+
|
|
|
|
1035
|
+ if($cuisine)
|
|
|
|
1036
|
+ $res_cuisine= file_get_contents(ON_LINE.'App.Seller.SetSellerCuisine&sellerid='.$data['sellerid'].'&cid='.$cuisine);
|
|
|
|
1037
|
+ //$res_cuisine = json_decode($res_cuisine,TRUE);
|
|
|
|
1038
|
+ if($type)
|
|
|
|
1039
|
+ $res_type= file_get_contents(ON_LINE.'App.Seller.SetSellerType&sellerid='.$data['sellerid'].'&typeid='.$type);
|
|
|
|
1040
|
+ //$res_type = json_decode($res_type,TRUE);
|
|
|
|
1041
|
+
|
|
|
|
1042
|
+ if($mode)
|
|
|
|
1043
|
+ $res_mode= file_get_contents(ON_LINE.'App.Seller.setSellerMode&sellerid='.$data['sellerid'].'&modeid='.$mode);
|
|
|
|
1044
|
+ //$res_mode = json_decode($res_mode,TRUE);
|
|
|
|
1045
|
+ if($label)
|
|
|
|
1046
|
+ $res_label= file_get_contents(ON_LINE.'App.Seller.setSellerLabel&sid='.$data['sellerid'].'&field='.$label);
|
|
|
|
1047
|
+
|
|
|
|
1048
|
+ if($brand){
|
|
|
|
1049
|
+ $del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_brand_rel WHERE sid =".$data['sellerid']);
|
|
|
|
1050
|
+ $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_brand_rel VALUES(".$data['sellerid'].",".$brand.")");
|
|
|
|
1051
|
+ }
|
|
|
|
1052
|
+
|
|
|
|
1053
|
+ if($label_1_){
|
|
|
|
1054
|
+ $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)");
|
|
|
|
1055
|
+ $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_1_.")");
|
|
|
|
1056
|
+ }
|
|
|
|
1057
|
+
|
|
|
|
1058
|
+ if($label_2_){
|
|
|
|
1059
|
+ $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)");
|
|
|
|
1060
|
+ $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_2_.")");
|
|
|
|
1061
|
+ }
|
|
|
|
1062
|
+
|
|
|
|
1063
|
+ if($label_3_){
|
|
|
|
1064
|
+ $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)");
|
|
|
|
1065
|
+ $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_3_.")");
|
|
|
|
1066
|
+ }
|
|
|
|
1067
|
+
|
|
|
|
1068
|
+ if(isset($data['edition'])){
|
|
|
|
1069
|
+ $up=Db::query("UPDATE `xt-member-two-LINE`.xt_seller set is_online_reserve = ".$data['edition']." where id = ".$data['sellerid']);
|
|
|
|
1070
|
+ }
|
|
|
|
1071
|
+
|
|
|
|
1072
|
+ if(isset($data['is_tele'])){
|
|
|
|
1073
|
+ $up=Db::query("UPDATE `xt-member-two-LINE`.xt_seller set is_tele = ".$data['is_tele']." where id = ".$data['sellerid']);
|
|
|
|
1074
|
+ }
|
|
|
|
1075
|
+
|
|
|
|
1076
|
+
|
|
|
|
1077
|
+ $result['code'] = 1;
|
|
|
|
1078
|
+ $result['msg'] = "配置成功!";
|
|
|
|
1079
|
+ return $result;
|
|
|
|
1080
|
+ }
|
|
|
|
1081
|
+
|
|
|
|
1082
|
+ //获取商家已有菜系
|
|
|
|
1083
|
+ $cuisine_list= file_get_contents(ON_LINE.'App.Seller.getSellerCuisine&sellerid='.$data['id']);
|
|
|
|
1084
|
+ $cuisine_list = json_decode($cuisine_list,TRUE);
|
|
|
|
1085
|
+ //获取所有菜系
|
|
|
|
1086
|
+ $list= file_get_contents(ON_LINE.'App.Reserve.GetCustomerConfig');
|
|
|
|
1087
|
+ $array = json_decode($list,TRUE);
|
|
|
|
1088
|
+ //组装数据
|
|
|
|
1089
|
+ foreach ($cuisine_list['data'] as $key => $value) {
|
|
|
|
1090
|
+ foreach ($array['data']['cate'] as $k => $v) {
|
|
|
|
1091
|
+ if($value['cid']==$v['id']){
|
|
|
|
1092
|
+ $array['data']['cate'][$k]['checked'] = 1;
|
|
|
|
1093
|
+ }
|
|
|
|
1094
|
+ }
|
|
|
|
1095
|
+ }
|
|
|
|
1096
|
+ $this->assign('list',$array['data']['cate']);//获取所有菜系
|
|
|
|
1097
|
+
|
|
|
|
1098
|
+ //获取商家已有来源
|
|
|
|
1099
|
+ $type_list= file_get_contents(ON_LINE.'App.Seller.GetSellerType&sellerid='.$data['id']);
|
|
|
|
1100
|
+ $type_list = json_decode($type_list,TRUE);
|
|
|
|
1101
|
+ //获取来源
|
|
|
|
1102
|
+ $channel = array(array('id'=>1,'name'=>'合作'),array('id'=>2,'name'=>'推广'),array('id'=>3,'name'=>'测试'));
|
|
|
|
1103
|
+ //组装数据
|
|
|
|
1104
|
+ foreach ($type_list['data'] as $key => $value) {
|
|
|
|
1105
|
+ foreach ($channel as $k => $v) {
|
|
|
|
1106
|
+ if($value['type_id']==$v['id']){
|
|
|
|
1107
|
+ $channel[$k]['checked'] = 1;
|
|
|
|
1108
|
+ }
|
|
|
|
1109
|
+ }
|
|
|
|
1110
|
+ }
|
|
|
|
1111
|
+ $this->assign('channel',$channel);//获取所有来源
|
|
|
|
1112
|
+
|
|
|
|
1113
|
+ //获取商家已有地图显示方式
|
|
|
|
1114
|
+ $mode_list= file_get_contents(ON_LINE.'App.Seller.getSellerMode&sellerid='.$data['id']);
|
|
|
|
1115
|
+ $mode_list = json_decode($mode_list,TRUE);
|
|
|
|
1116
|
+
|
|
|
|
1117
|
+ //获取所有地图显示方式
|
|
|
|
1118
|
+ $mode= array(array('id'=>1,'name'=>'地图上大图标'),array('id'=>2,'name'=>'地图上文字'));
|
|
|
|
1119
|
+ //组装数据
|
|
|
|
1120
|
+ foreach ($mode_list['data'] as $key => $value) {
|
|
|
|
1121
|
+ foreach ($mode as $k => $v) {
|
|
|
|
1122
|
+ if($value['sm_id']==$v['id']){
|
|
|
|
1123
|
+ $mode[$k]['checked'] = 1;
|
|
|
|
1124
|
+ }
|
|
|
|
1125
|
+ }
|
|
|
|
1126
|
+ }
|
|
|
|
1127
|
+ $this->assign('mode',$mode);//获取所有菜系
|
|
|
|
1128
|
+
|
|
|
|
1129
|
+ //获取商家已选短信模板
|
|
|
|
1130
|
+ $template = file_get_contents(ON_LINE.'App.Reserve.SellerInfo&seller_id='.$data['id']);
|
|
|
|
1131
|
+ $template = json_decode($template,TRUE);
|
|
|
|
1132
|
+ //获取短信模板列表
|
|
|
|
1133
|
+ $template_list = file_get_contents(ON_LINE.'App.SendSMS.GetSmsTemplate');
|
|
|
|
1134
|
+ $template_list = json_decode($template_list,TRUE);
|
|
|
|
1135
|
+
|
|
|
|
1136
|
+ //组装数据
|
|
|
|
1137
|
+ foreach ($template_list['data'] as $key => $value) {
|
|
|
|
1138
|
+ if($value['template_code']==$template['data']['setting']['template_code']){
|
|
|
|
1139
|
+ $template_list['data'][$key]['checked'] = 1;
|
|
|
|
1140
|
+ }
|
|
|
|
1141
|
+ switch ($value['template_code']) {
|
|
|
|
1142
|
+ case 'SMS_163050401':
|
|
|
|
1143
|
+ $vowels = array(
|
|
|
|
1144
|
+ '周到安排演示店' => '${seller_name}',
|
|
|
|
1145
|
+ '11月25日晚上18:00' => '${date}',
|
|
|
|
1146
|
+ '金台夕照、卢沟晓月' =>'${region_room_name}',
|
|
|
|
1147
|
+ '西电路447号南湖金地西门南100米' =>'${seller_addr}',
|
|
|
|
1148
|
+ '18792581193' =>'${seller_phone}',
|
|
|
|
1149
|
+ '毛毛' =>'${cusman}',
|
|
|
|
1150
|
+ );
|
|
|
|
1151
|
+ break;
|
|
|
|
1152
|
+ case 'SMS_162733710':
|
|
|
|
1153
|
+ $vowels = array(
|
|
|
|
1154
|
+ '4月6日中午' => '${reserve_date}',
|
|
|
|
1155
|
+ '周到1店西电路447号金台夕照' => '${seller_name_addr_room}',
|
|
|
|
1156
|
+ '毛毛' =>'${cusman}',
|
|
|
|
1157
|
+ );
|
|
|
|
1158
|
+ break;
|
|
|
|
1159
|
+ case 'SMS_154587043':
|
|
|
|
1160
|
+ $vowels = array(
|
|
|
|
1161
|
+ '侯先生' => '${guest}',
|
|
|
|
1162
|
+ '周到安排演示店' => '${seller_name}',
|
|
|
|
1163
|
+ '11月25日晚上18:00' =>'${date}',
|
|
|
|
1164
|
+ '包间(金台夕照)' =>'${region_room_name}',
|
|
|
|
1165
|
+ '西电路447号南湖金地西门南100米' =>'${seller_addr}',
|
|
|
|
1166
|
+ '18792581193' =>'${seller_phone}\n',
|
|
|
|
1167
|
+ '毛毛' =>'${cusman}',
|
|
|
|
1168
|
+ );
|
|
|
|
1169
|
+ break;
|
|
|
|
1170
|
+ case 'SMS_164277855':
|
|
|
|
1171
|
+ $vowels = array(
|
|
|
|
1172
|
+ '周到1店西电路447号' => '${seller_name}',
|
|
|
|
1173
|
+ '11月7日晚上18:30' => '${date}',
|
|
|
|
1174
|
+ '包间(金台夕照)' =>'${region_room_name}',
|
|
|
|
1175
|
+ '1879258119' =>'${seller_phone}',
|
|
|
|
1176
|
+ );
|
|
|
|
1177
|
+ break;
|
|
|
|
1178
|
+ case 'SMS_164268239':
|
|
|
|
1179
|
+ $vowels = array(
|
|
|
|
1180
|
+ '周到安排演示店' => '${seller_name}',
|
|
|
|
1181
|
+ '11月7日晚上18:30' => '${date}',
|
|
|
|
1182
|
+ '包间(金台夕照)' =>'${region_room_name}',
|
|
|
|
1183
|
+ '西电路447号南湖金地西门南100米' =>'${seller_addr}',
|
|
|
|
1184
|
+ '1879258119' =>'${seller_phone}',
|
|
|
|
1185
|
+ );
|
|
|
|
1186
|
+ break;
|
|
|
|
1187
|
+ default:
|
|
|
|
1188
|
+ # code...
|
|
|
|
1189
|
+ break;
|
|
|
|
1190
|
+ }
|
|
|
|
1191
|
+ $template_list['data'][$key]['content'] = str_replace($vowels, array_keys($vowels),$value['content']);
|
|
|
|
1192
|
+ }
|
|
|
|
1193
|
+ $this->assign('template_list',$template_list['data']);//获取短信模板列表
|
|
|
|
1194
|
+
|
|
|
|
1195
|
+ //获取商家拥有哪些标签
|
|
|
|
1196
|
+ $label_list= file_get_contents(ON_LINE.'App.Seller.GetSellerLabel&sid='.$data['id']);
|
|
|
|
1197
|
+ $label_list = json_decode($label_list,TRUE);
|
|
|
|
1198
|
+ $this->assign('label_list',$label_list['data']);
|
|
|
|
1199
|
+
|
|
|
|
1200
|
+ //商家标签
|
|
|
|
1201
|
+ //原生:
|
|
|
|
1202
|
+ //$label_c=Db::query("SELECT * from xt-member-two-LINE.xt_dc_dz_seller_label_c");
|
|
|
|
1203
|
+ $label_c=Db::table("xt-member-two-LINE.xt_dc_dz_seller_label_c")->select();
|
|
|
|
1204
|
+ $label_c_rel=Db::table("xt-member-two-LINE.xt_dc_dz_seller_label_c_rel")->where(array('sid'=>$data['id']))->select();
|
|
|
|
1205
|
+ //组装数据
|
|
|
|
1206
|
+ foreach ($label_c as $key => $value) {
|
|
|
|
1207
|
+ foreach ($label_c_rel as $k => $v) {
|
|
|
|
1208
|
+ if($value['id']==$v['lcid']){
|
|
|
|
1209
|
+ $label_c[$key]['checked'] = 1;
|
|
|
|
1210
|
+ }
|
|
|
|
1211
|
+ }
|
|
|
|
1212
|
+ }
|
|
|
|
1213
|
+ $this->assign('label_c',$label_c);
|
|
|
|
1214
|
+
|
|
|
|
1215
|
+ //商家品牌
|
|
|
|
1216
|
+ $brand=Db::table("xt-member-two-LINE.xt_dc_dz_seller_brand")->select();
|
|
|
|
1217
|
+ $brand_rel=Db::table("xt-member-two-LINE.xt_dc_dz_seller_brand_rel")->where(array('sid'=>$data['id']))->select();
|
|
|
|
1218
|
+ //组装数据
|
|
|
|
1219
|
+ foreach ($brand as $key => $value) {
|
|
|
|
1220
|
+ foreach ($brand_rel as $k => $v) {
|
|
|
|
1221
|
+ if($value['id']==$v['bid']){
|
|
|
|
1222
|
+ $brand[$key]['checked'] = 1;
|
|
|
|
1223
|
+ }
|
|
|
|
1224
|
+ }
|
|
|
|
1225
|
+ }
|
|
|
|
1226
|
+ $this->assign('brand',$brand);
|
|
|
|
1227
|
+
|
|
|
|
1228
|
+
|
|
|
|
1229
|
+ $is_online_reserve=Db::table("xt-member-two-LINE.xt_seller")->where(array('id'=>$data['id']))->select();
|
|
|
|
1230
|
+
|
|
|
|
1231
|
+ //获取商家在线预定版本情况
|
|
|
|
1232
|
+ $this->assign('is_online_reserve',$is_online_reserve[0]['is_online_reserve']);
|
|
|
|
1233
|
+ //是否安装电话机
|
|
|
|
1234
|
+ $this->assign('is_tele',$is_online_reserve[0]['is_tele']);
|
|
|
|
1235
|
+
|
|
|
|
1236
|
+ //商户信息
|
|
|
|
1237
|
+ $this->assign ('data',$data);
|
|
|
|
1238
|
+ $this->assign ( 'title','商户信息配置' );
|
|
|
|
1239
|
+ return $this->fetch();
|
|
|
|
1240
|
+ }
|
|
1015
|
} |
1241
|
} |