Basicinfo.php
9.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<?php
namespace app\admin\controller;
use think\Db;
use think\facade\Request;
class Basicinfo extends Common
{
/********************************打印机管理*******************************/
//打印机型号列表
public function Printer($sys_id=1){
if(Request::isAjax()) {
$list= file_get_contents(ON_LINE.'App.Prints.QueryPrintsList');
$array = json_decode($list,TRUE);
foreach ($array['data'] as $key => $value) {
if($value['type']==1)
$array['data'][$key]['type'] = '50';
elseif($value['type']==2)
$array['data'][$key]['type'] = '80';
$array['data'][$key]['cdate'] = date('Y-m-d H:i:s',$value['cdate']);
}
return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'],'rel'=>1];
}
$this->assign('title','打印机型号列表');
return $this->fetch();
}
//打印机型号添加
public function printerAdd(){
if(Request::isAjax()){
$data = input('post.');
$list= file_get_contents(ON_LINE.'App.Prints.addPrintsInfo&name='.$data['modelname'].'&type='.$data['type']);
$array = json_decode($list,TRUE);
//添加
if ($array['ret']==200) {
return ['code'=>1,'msg'=>'添加成功!','url'=>url('Printer')];
} else {
return ['code'=>0,'msg'=>$array['msg']];
}
}else{
$this->assign('title','添加打印机型号');
$this->assign('info','null');
return view('printerForm');
}
}
//打印机型号修改
public function printerEdit(){
if(request()->isPost()){
$data = input('post.');
$list= file_get_contents(ON_LINE.'App.Prints.editPrintsInfo&data='.json_encode($data));
$array = json_decode($list,TRUE);
if($array['ret']==200){
return ['code'=>1,'msg'=>'修改成功!','url'=>url('Printer')];
}else{
return ['code'=>0,'msg'=>$array['msg']];
}
}else{
//根据ID获取打印型号信息
$list= file_get_contents(ON_LINE.'App.Prints.queryPrintsFetch&id='.input('id'));
$array = json_decode($list,TRUE);
$array['data']['modelname'] = $array['data']['name'];
$this->assign('info', json_encode($array['data'],true));
$this->assign('title','编辑打印机型号');
return view('printerForm');
}
}
//短信营销套餐管理
public function SmsManagement(){
if(Request::isAjax()) {
$list= file_get_contents(ON_LINE.'App.SendSMS.SmsInfo');
$array = json_decode($list,TRUE);
return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data']['meals'],'rel'=>1];
}
$this->assign('title','短信套餐列表');
return $this->fetch();
}
//短信套餐编辑
public function smsmanagementEdit(){
if(request()->isPost()){
$data = input('post.');
$list= file_get_contents(ON_LINE.'App.Reserve.SmsBatchInfoUpdate&data='.json_encode($data));
$array = json_decode($list,TRUE);
if($array['ret']==200){
return ['code'=>1,'msg'=>'修改成功!','url'=>url('SmsManagement')];
}else{
return ['code'=>0,'msg'=>$array['msg']];
}
}else{
//根据ID获取套餐信息
$list= file_get_contents(ON_LINE.'App.Reserve.SmsBatchInfoFetch&id='.input('id'));
$array = json_decode($list,TRUE);
$this->assign('info', json_encode($array['data'],true));
$this->assign('title','短信套餐管理(编辑)');
return view('smsmanagementForm');
}
}
//短信套餐添加
public function smsmanagementAdd(){
if(Request::isAjax()){
$data = input('post.');
$list= file_get_contents(ON_LINE.'App.Reserve.SmsBatchInfoUpdate&data='.json_encode($data));
$array = json_decode($list,TRUE);
//添加
if ($array['ret']==200) {
return ['code'=>1,'msg'=>'添加成功!','url'=>url('SmsManagement')];
} else {
return ['code'=>0,'msg'=>$array['msg']];
}
}else{
$this->assign('title','短信套餐管理(添加)');
$this->assign('info','null');
return view('smsmanagementForm');
}
}
//短信套餐删除
public function smsmanagementDel(){
if(Request::isAjax()){
$data = Request::except('file');
$list= file_get_contents(ON_LINE.'App.Reserve.SmsBatchInfoDel&id='.$data['id']);
$array = json_decode($list,TRUE);
if ($array['ret']==200) {
$result['code'] = 1;
$result['msg'] = '删除成功!';
} else {
$result['code'] = 0;
$result['msg'] = '请求错误!';
}
return $result;
}
return view();
}
//线下短信充值
public function SmsRecharge(){
$data = Request::except('file');
if(Request::isAjax()){
$smsdata = '&sid='.$data['sid'].'&total='.$data['total'].'&type='.$data['dishesVideo'].'&channel=PC&desc='.$data['content'];
$ret= file_get_contents(ON_LINE.'App.SendSMS.SmsULineRecharge'.$smsdata);
$code = json_decode($ret,TRUE);
if($code['ret']==200 && $code['data']){
$result['code'] = 200;
$result['msg'] = '充值成功';
$result['url'] =url('seller/sellerlist');
}else{
$result['code'] = 0;
$result['msg'] = '充值失败';
}
return $result;
}
$info = $data['id'] && $data['name'] ? $data : array();
$this->assign('info',$info);
$list= file_get_contents(ON_LINE.'App.SendSMS.SmsInfo');
$array = json_decode($list,TRUE);
$this->assign('list',$array['data']['meals']);
$this->assign('title','短信充值');
return $this->fetch();
}
//线下短信充值
public function getsellername(){
if(Request::isAjax()){
$data = Request::except('file');
$list= file_get_contents(ON_LINE.'App.Seller.GetSellerById&sellerid='.$data['key']);
$array = json_decode($list,TRUE);
$info = $array['data']['data']['id'] && $array['data']['data']['sellername'] ? $array['data']['data'] : array();
if($info){
$result['code'] = 200;
$result['msg'] = '获取成功';
$result['info'] = $info;
}else{
$result['code'] = 0;
$result['msg'] = '获取失败';
}
}
return $result;
}
//商家包间类型标签维护
public function SellerRoomLabel(){
$data = Request::except('file');
if(Request::isAjax()){
$smsdata = '&sid='.$data['sid'].'&total='.$data['total'].'&type='.$data['dishesVideo'].'&channel=PC&desc='.$data['content'];
$ret= file_get_contents(ON_LINE.'App.SendSMS.SmsULineRecharge'.$smsdata);
$code = json_decode($ret,TRUE);
if($code['ret']==200 && $code['data']){
$result['code'] = 200;
$result['msg'] = '充值成功';
$result['url'] =url('seller/sellerlist');
}else{
$result['code'] = 0;
$result['msg'] = '充值失败';
}
return $result;
}
$info = $data['id'] && $data['name'] ? $data : array();
$this->assign('info',$info);
//获取商家包间类型标签
$list = Db::query("SELECT
id,`name`
FROM
`xt-member-two-LINE`.xt_dc_seller_table_class where sellerid = ".$data['id']);
$this->assign('list',$list);
//获取通用标签库
$publist = Db::query("SELECT
id,`name`
FROM
`xt-member-two-LINE`.xt_dc_dz_seller_pub_room");
$this->assign('publist',$publist);
$this->assign('title','商家包间类型标签');
return $this->fetch();
}
//包间类型标签选中状况
public function getroomstatus(){
$data = Request::except('file');
if(Request::isAjax()){
//获取商家对应包间类型已选标签
$list = Db::query('SELECT * FROM `xt-member-two-LINE`.xt_dc_dz_seller_pub_room_rel where sid = '.$data['sid'].' and room_type_id = '.$data['room_type_id']);
}
$res['code'] = !empty($list) ? 1 : 0;
$res['list'] = $list;
$res['msgs'] = 'SUCCESS';
return $res;
}
//包间类型标签选中状况
public function setroomstatus(){
$data = Request::except('file');
if(Request::isAjax()){
//剔除原数据
$del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_pub_room_rel WHERE sid =".$data['sid'].' and room_type_id = '.$data['room_type_id']);
//批量插入
$sql = "INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_pub_room_rel(`sid`,`room_type_id`,`pid`,`type`) VALUES ";
foreach ($data['data'] as $key=>$value){
$sql .= "(".$data['sid'].",".$data['room_type_id'].",".$value.",0),";
}
$sql = substr( $sql,0, strlen($sql)-1 );
$add=Db::query($sql);
}
$res['code'] = 1;
$res['list'] = $add;
$res['msgs'] = 'SUCCESS';
return $res;
}
}