正在显示
8 个修改的文件
包含
360 行增加
和
64 行删除
@@ -66,7 +66,7 @@ class Renwu extends Backend | @@ -66,7 +66,7 @@ class Renwu extends Backend | ||
66 | 66 | ||
67 | foreach ($list as $row) { | 67 | foreach ($list as $row) { |
68 | 68 | ||
69 | - $row->getRelation('user')->visible(['nickname','mobile','address','address_con','car_num','color','car_type']); | 69 | + $row->getRelation('user')->visible(['nickname','mobile','address','address_con','car_num','color','car_type','vip']); |
70 | $row->getRelation('vip')->visible(['title']); | 70 | $row->getRelation('vip')->visible(['title']); |
71 | } | 71 | } |
72 | $list = collection($list)->toArray(); | 72 | $list = collection($list)->toArray(); |
@@ -35,5 +35,8 @@ return [ | @@ -35,5 +35,8 @@ return [ | ||
35 | 'User.car_num' => '车牌号', | 35 | 'User.car_num' => '车牌号', |
36 | 'User.color' => '车辆颜色', | 36 | 'User.color' => '车辆颜色', |
37 | 'User.car_type' => '车型', | 37 | 'User.car_type' => '车型', |
38 | + 'User.vip' => '会员状态', | ||
39 | + 'User.vip 1' => '会员', | ||
40 | + 'User.vip 0' => '非会员', | ||
38 | 'Vip.title' => '会员名称' | 41 | 'Vip.title' => '会员名称' |
39 | ]; | 42 | ]; |
1 | <div class="panel panel-default panel-intro"> | 1 | <div class="panel panel-default panel-intro"> |
2 | - {:build_heading()} | 2 | + |
3 | + <div class="panel-heading"> | ||
4 | + {:build_heading(null,FALSE)} | ||
5 | + <ul class="nav nav-tabs" data-field="type"> | ||
6 | + <li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li> | ||
7 | + {foreach name="typeList" item="vo"} | ||
8 | + <li><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li> | ||
9 | + {/foreach} | ||
10 | + </ul> | ||
11 | + </div> | ||
12 | + | ||
3 | 13 | ||
4 | <div class="panel-body"> | 14 | <div class="panel-body"> |
5 | <div id="myTabContent" class="tab-content"> | 15 | <div id="myTabContent" class="tab-content"> |
@@ -6,6 +6,7 @@ use app\common\controller\Api; | @@ -6,6 +6,7 @@ use app\common\controller\Api; | ||
6 | use app\common\library\Sms as Smslib; | 6 | use app\common\library\Sms as Smslib; |
7 | use app\common\model\User; | 7 | use app\common\model\User; |
8 | use think\Hook; | 8 | use think\Hook; |
9 | +use think\Db; | ||
9 | 10 | ||
10 | /** | 11 | /** |
11 | * 手机短信接口 | 12 | * 手机短信接口 |
@@ -17,16 +18,12 @@ class Sms extends Api | @@ -17,16 +18,12 @@ class Sms extends Api | ||
17 | 18 | ||
18 | /** | 19 | /** |
19 | * 发送验证码 | 20 | * 发送验证码 |
20 | - * | ||
21 | - * @param string $mobile 手机号 | ||
22 | - * @param string $event 事件名称 | 21 | + * @ApiParams (name="mobile", type="integer", required=true, description="手机号") |
23 | */ | 22 | */ |
24 | public function send() | 23 | public function send() |
25 | { | 24 | { |
26 | $mobile = $this->request->request("mobile"); | 25 | $mobile = $this->request->request("mobile"); |
27 | - $event = $this->request->request("event"); | ||
28 | - $event = $event ? $event : 'register'; | ||
29 | - | 26 | + $event = 1; |
30 | if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) { | 27 | if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) { |
31 | $this->error(__('手机号不正确')); | 28 | $this->error(__('手机号不正确')); |
32 | } | 29 | } |
@@ -35,26 +32,27 @@ class Sms extends Api | @@ -35,26 +32,27 @@ class Sms extends Api | ||
35 | $this->error(__('发送频繁')); | 32 | $this->error(__('发送频繁')); |
36 | } | 33 | } |
37 | $ipSendTotal = \app\common\model\Sms::where(['ip' => $this->request->ip()])->whereTime('createtime', '-1 hours')->count(); | 34 | $ipSendTotal = \app\common\model\Sms::where(['ip' => $this->request->ip()])->whereTime('createtime', '-1 hours')->count(); |
38 | - if ($ipSendTotal >= 5) { | 35 | + if ($ipSendTotal >= 20) { |
39 | $this->error(__('发送频繁')); | 36 | $this->error(__('发送频繁')); |
40 | } | 37 | } |
41 | - if ($event) { | ||
42 | - $userinfo = User::getByMobile($mobile); | ||
43 | - if ($event == 'register' && $userinfo) { | ||
44 | - //已被注册 | ||
45 | - $this->error(__('已被注册')); | ||
46 | - } elseif (in_array($event, ['changemobile']) && $userinfo) { | ||
47 | - //被占用 | ||
48 | - $this->error(__('已被占用')); | ||
49 | - } elseif (in_array($event, ['changepwd', 'resetpwd']) && !$userinfo) { | ||
50 | - //未注册 | ||
51 | - $this->error(__('未注册')); | ||
52 | - } | ||
53 | - } | ||
54 | - if (!Hook::get('sms_send')) { | ||
55 | - $this->error(__('请在后台插件管理安装短信验证插件')); | ||
56 | - } | ||
57 | - $ret = Smslib::send($mobile, null, $event); | 38 | + $url = "https://api.mix2.zthysms.com/v2/sendSms"; |
39 | + $records = []; | ||
40 | + $code = mt_rand(1000, 9999); | ||
41 | + $tKey = time(); | ||
42 | + $password = md5(md5('cxz307311') . $tKey); | ||
43 | + $date = array( | ||
44 | + 'username' => 'xiche', //用户名 | ||
45 | + 'password' => $password, //密码 | ||
46 | + 'tKey' => $tKey, //tKey | ||
47 | + 'signature' => '【零感驿站】', | ||
48 | + 'records' => $records, | ||
49 | + 'mobile' => $mobile, | ||
50 | + 'content' => '【零感驿站】您的验证码是:"' . $code . '",请于10分钟内使用,如非本人操作,可忽略此消息。' | ||
51 | + ); | ||
52 | + $ret = $this->httpPost($url, $date); | ||
53 | + $time = time(); | ||
54 | + $ip = request()->ip(); | ||
55 | + $sms = \app\common\model\Sms::create(['event' => $event, 'mobile' => $mobile, 'code' => $code, 'ip' => $ip, 'createtime' => $time]); | ||
58 | if ($ret) { | 56 | if ($ret) { |
59 | $this->success(__('发送成功')); | 57 | $this->success(__('发送成功')); |
60 | } else { | 58 | } else { |
@@ -64,36 +62,23 @@ class Sms extends Api | @@ -64,36 +62,23 @@ class Sms extends Api | ||
64 | 62 | ||
65 | /** | 63 | /** |
66 | * 检测验证码 | 64 | * 检测验证码 |
67 | - * | ||
68 | - * @param string $mobile 手机号 | ||
69 | - * @param string $event 事件名称 | ||
70 | - * @param string $captcha 验证码 | 65 | + * @ApiParams (name="mobile", type="integer", required=true, description="手机号") |
66 | + * @ApiParams (name="code", type="integer", required=true, description="验证码") | ||
71 | */ | 67 | */ |
72 | public function check() | 68 | public function check() |
73 | { | 69 | { |
74 | $mobile = $this->request->request("mobile"); | 70 | $mobile = $this->request->request("mobile"); |
75 | - $event = $this->request->request("event"); | ||
76 | - $event = $event ? $event : 'register'; | ||
77 | - $captcha = $this->request->request("captcha"); | ||
78 | - | 71 | + $code = $this->request->request("code"); |
79 | if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) { | 72 | if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) { |
80 | $this->error(__('手机号不正确')); | 73 | $this->error(__('手机号不正确')); |
81 | } | 74 | } |
82 | - if ($event) { | ||
83 | - $userinfo = User::getByMobile($mobile); | ||
84 | - if ($event == 'register' && $userinfo) { | ||
85 | - //已被注册 | ||
86 | - $this->error(__('已被注册')); | ||
87 | - } elseif (in_array($event, ['changemobile']) && $userinfo) { | ||
88 | - //被占用 | ||
89 | - $this->error(__('已被占用')); | ||
90 | - } elseif (in_array($event, ['changepwd', 'resetpwd']) && !$userinfo) { | ||
91 | - //未注册 | ||
92 | - $this->error(__('未注册')); | ||
93 | - } | ||
94 | - } | ||
95 | - $ret = Smslib::check($mobile, $captcha, $event); | 75 | + $ret = Db::name('sms')->where('mobile', $mobile)->where('code', $code)->find(); |
76 | + $time = time(); | ||
77 | + $times = $ret['createtime'] + 60 * 10; | ||
96 | if ($ret) { | 78 | if ($ret) { |
79 | + if ($time > $times) { | ||
80 | + $this->error(__('验证码已失效')); | ||
81 | + } | ||
97 | $this->success(__('成功')); | 82 | $this->success(__('成功')); |
98 | } else { | 83 | } else { |
99 | $this->error(__('验证码不正确')); | 84 | $this->error(__('验证码不正确')); |
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | namespace app\api\controller; | 3 | namespace app\api\controller; |
4 | 4 | ||
5 | use app\common\controller\Api; | 5 | use app\common\controller\Api; |
6 | +use function fast\e; | ||
6 | use think\Db; | 7 | use think\Db; |
7 | 8 | ||
8 | /** | 9 | /** |
@@ -105,6 +106,171 @@ class User extends Api | @@ -105,6 +106,171 @@ class User extends Api | ||
105 | 106 | ||
106 | /** | 107 | /** |
107 | * 用户接口 | 108 | * 用户接口 |
109 | + * @ApiTitle (用户接口-开屏页Code) | ||
110 | + * @ApiSummary (开屏页Code) | ||
111 | + * @ApiMethod (POST) | ||
112 | + * @ApiRoute (/api/User/OpenCode) | ||
113 | + * @ApiParams (name="code", type="integer", required=true, description="Code") | ||
114 | + * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
115 | + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
116 | + * @ApiReturn ({ | ||
117 | + 'code':'1', | ||
118 | + 'msg':'返回成功', | ||
119 | + "data": { | ||
120 | + "avatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/0wpUDw5m0LRvdDueia3uMWmrYb53GXRaTnYwMWC18kRmX6P6PIaPDgQqarEIfwroicx1z51D6bjQicOV0PibBx2PqQ/132", | ||
121 | + "nickname": "Gody", | ||
122 | + "token": "3dda6e452f4778fcc72e21178494bbc1", | ||
123 | + "mobile": null, | ||
124 | + "is_user":1=已注册,0=未注册, | ||
125 | + "vip":会员状态:1=会员,0=非会员, | ||
126 | + "exptime":会员到期时间, | ||
127 | + "type":身份:1=用户,2=找车工,3=洗车工 | ||
128 | + } | ||
129 | + }) | ||
130 | + */ | ||
131 | + public function OpenCode() | ||
132 | + { | ||
133 | +// 授权登录 | ||
134 | + $ch = curl_init(); | ||
135 | + $appid = "wx243943911c16fbfc"; | ||
136 | + $secret = "297d8f02691bd23a6fb3828a200d5f7e"; | ||
137 | + $code = input('code'); | ||
138 | + $url = "https://api.weixin.qq.com/sns/jscode2session?appid=$appid&secret=$secret&js_code=$code&grant_type=authorization_code"; | ||
139 | + curl_setopt($ch, CURLOPT_URL, $url); | ||
140 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
141 | + curl_setopt($ch, CURLOPT_HEADER, 0); | ||
142 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); | ||
143 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); | ||
144 | + $output = curl_exec($ch); | ||
145 | + if ($output === FALSE) { | ||
146 | + echo "CURL Error:" . curl_error($ch); | ||
147 | + } | ||
148 | + curl_close($ch); | ||
149 | + $curl_result = json_decode($output, true); | ||
150 | + $openid = $curl_result['openid']; | ||
151 | + $is_open = Db::name('user')->where(['openid' => $openid])->find(); | ||
152 | + if ($is_open['is_black'] == 1) { | ||
153 | + $this->error('您已被拉黑', 0); | ||
154 | + die; | ||
155 | + } | ||
156 | + if (empty($is_open)) { | ||
157 | + $type = 0; | ||
158 | + $return = [ | ||
159 | + 'is_user' => $type, | ||
160 | + 'nickname' => '', | ||
161 | + 'avatar' => '', | ||
162 | + 'mobile' => '', | ||
163 | + 'vip' => '', | ||
164 | + 'exptime' => '', | ||
165 | + 'type' => '', | ||
166 | + 'token' => '' | ||
167 | + ]; | ||
168 | + } else { | ||
169 | + $type = 1; | ||
170 | + $token = $this->request->token(); | ||
171 | + $res = Db::name("user")->where(['openid' => $openid])->update(['token' => $token,]); | ||
172 | + if (!$res) { | ||
173 | + $this->error('令牌更新失败', 0); | ||
174 | + die; | ||
175 | + } | ||
176 | + $return = [ | ||
177 | + 'is_user' => $type, | ||
178 | + 'nickname' => $is_open['nickname'], | ||
179 | + 'avatar' => $is_open['avatar'], | ||
180 | + 'mobile' => $is_open['mobile'], | ||
181 | + 'vip' => $is_open['vip'], | ||
182 | + 'exptime' => $is_open['exptime'], | ||
183 | + 'type' => $is_open['type'], | ||
184 | + 'token' => $token | ||
185 | + ]; | ||
186 | + } | ||
187 | + $this->success('成功', $return); | ||
188 | + } | ||
189 | + | ||
190 | + | ||
191 | + /** | ||
192 | + * 用户接口 | ||
193 | + * @ApiTitle (用户接口-绑定手机) | ||
194 | + * @ApiSummary (绑定手机) | ||
195 | + * @ApiMethod (POST) | ||
196 | + * @ApiRoute (/api/User/CheckMobile) | ||
197 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
198 | + * @ApiParams (name="type", type="integer", required=true, description="1=手机号授权,2=验证码授权") | ||
199 | + * @ApiParams (name="mobile", type="integer", required=true, description="手机号") | ||
200 | + * @ApiParams (name="code", type="integer", required=true, description="验证码") | ||
201 | + * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
202 | + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
203 | + * @ApiReturn ({ | ||
204 | + 'code':'1', | ||
205 | + 'msg':'返回成功', | ||
206 | + "data": { | ||
207 | + } | ||
208 | + }) | ||
209 | + */ | ||
210 | + public function CheckMobile() | ||
211 | + { | ||
212 | + $user_id = $this->is_token($this->request->header()); | ||
213 | + $param = $this->request->param(); | ||
214 | + if ($param['type'] == 2) { | ||
215 | + $this->CheckCode($param['mobile'], $param['code']); | ||
216 | + } | ||
217 | + $res = Db::name('user')->where('id', $user_id)->update(['mobile' => $param['mobile']]); | ||
218 | + $this->res($res); | ||
219 | + } | ||
220 | + | ||
221 | + | ||
222 | + /** | ||
223 | + * 用户接口 | ||
224 | + * @ApiTitle (用户接口-完善信息) | ||
225 | + * @ApiSummary (完善信息) | ||
226 | + * @ApiMethod (POST) | ||
227 | + * @ApiRoute (/api/User/AddUserCon) | ||
228 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
229 | + * @ApiParams (name="mobile", type="integer", required=true, description="手机号") | ||
230 | + * @ApiParams (name="code", type="integer", required=true, description="code") | ||
231 | + * @ApiParams (name="car_num", type="integer", required=true, description="车牌号") | ||
232 | + * @ApiParams (name="car_type", type="integer", required=true, description="车型") | ||
233 | + * @ApiParams (name="color", type="integer", required=true, description="车辆颜色") | ||
234 | + * @ApiParams (name="address", type="integer", required=true, description="我的地址") | ||
235 | + * @ApiParams (name="address_con", type="integer", required=true, description="详细地址") | ||
236 | + * @ApiParams (name="lng", type="integer", required=true, description="经度") | ||
237 | + * @ApiParams (name="lat", type="integer", required=true, description="纬度") | ||
238 | + * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
239 | + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
240 | + * @ApiReturn ({ | ||
241 | + 'code':'1', | ||
242 | + 'msg':'返回成功', | ||
243 | + "data": { | ||
244 | + } | ||
245 | + }) | ||
246 | + */ | ||
247 | + public function AddUserCon() | ||
248 | + { | ||
249 | + $param = $this->request->param(); | ||
250 | + $user_id = $this->is_token($this->request->header()); | ||
251 | + $mobile = Db::name('user')->where('id', $user_id)->value('mobile'); | ||
252 | + $this->CheckCode($mobile, $param['code']); | ||
253 | + $data = [ | ||
254 | + 'mobile' => $param['mobile'], | ||
255 | + 'car_num' => $param['car_num'], | ||
256 | + 'car_type' => $param['car_type'], | ||
257 | + 'color' => $param['color'], | ||
258 | + 'address' => $param['address'], | ||
259 | + 'address_con' => $param['address_con'], | ||
260 | + 'lng' => $param['lng'], | ||
261 | + 'lat' => $param['lat'], | ||
262 | + ]; | ||
263 | + $res = Db::name('user')->where('id', $user_id)->update($data); | ||
264 | + if (!$res) { | ||
265 | + $this->error('请填写完整信息', 0); | ||
266 | + die; | ||
267 | + } | ||
268 | + $this->success('成功', 1); | ||
269 | + } | ||
270 | + | ||
271 | + | ||
272 | + /** | ||
273 | + * 用户接口 | ||
108 | * @ApiTitle (用户接口-用户协议) | 274 | * @ApiTitle (用户接口-用户协议) |
109 | * @ApiSummary (用户协议) | 275 | * @ApiSummary (用户协议) |
110 | * @ApiMethod (POST) | 276 | * @ApiMethod (POST) |
@@ -430,4 +596,91 @@ class User extends Api | @@ -430,4 +596,91 @@ class User extends Api | ||
430 | } | 596 | } |
431 | $this->success('成功', $list); | 597 | $this->success('成功', $list); |
432 | } | 598 | } |
599 | + | ||
600 | + | ||
601 | + /** | ||
602 | + * 用户接口 | ||
603 | + * @ApiTitle (用户接口-员工订单详情) | ||
604 | + * @ApiSummary (员工订单详情) | ||
605 | + * @ApiMethod (POST) | ||
606 | + * @ApiRoute (/api/User/OrderContent) | ||
607 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
608 | + * @ApiParams (name="id", type="int", required=true, description="ID") | ||
609 | + * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
610 | + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
611 | + * @ApiReturn ({ | ||
612 | + 'code':'1', | ||
613 | + 'msg':'返回成功', | ||
614 | + "data": { | ||
615 | + "id": 1, | ||
616 | + "title": "洗车季卡", | ||
617 | + "time": 1599209757, | ||
618 | + "mobile": "13292442918", | ||
619 | + "address": "河北省唐山市路南区", | ||
620 | + "address_con": "万达广场第五棵大杨树旁", | ||
621 | + "userlng": "116.39050", | ||
622 | + "userlat": "39.89223", | ||
623 | + "car_num": "冀B123456", | ||
624 | + "car_type": "AE86", | ||
625 | + "color": "五颜六色的白", | ||
626 | + "zhao_type": 0, | ||
627 | + "zhao_images": [], | ||
628 | + "car_address": "", | ||
629 | + "lat": "", | ||
630 | + "lng": "", | ||
631 | + "order_sn": "202009031647068127236526", | ||
632 | + "xi_type": 0, | ||
633 | + "xi_images": [], | ||
634 | + "createtime": "2020-09-04 16:55:57", | ||
635 | + "times": "2020-09-04 16:55:57", | ||
636 | + "user_level": 1 | ||
637 | + } | ||
638 | + }) | ||
639 | + */ | ||
640 | + public function OrderContent() | ||
641 | + { | ||
642 | + $user_id = $this->is_token($this->request->header()); | ||
643 | + $id = input('id'); | ||
644 | + $list = Db::name('renwu')->where('a.id', $id) | ||
645 | + ->alias('a') | ||
646 | + ->join('vip v', 'v.id=a.vip_id') | ||
647 | + ->join('user u', 'u.id=a.user_id') | ||
648 | + ->field('a.id,v.title,a.createtime as time,u.mobile,u.address,u.address_con,u.lng as userlng,u.lat as userlat,u.car_num,u.car_type,u.color,a.zhao_type,a.zhao_images,a.car_address,a.lat,a.lng,a.order_sn,a.xi_type,a.xi_images') | ||
649 | + ->find(); | ||
650 | + if (empty($list)) { | ||
651 | + $this->error('参数错误', 0); | ||
652 | + die; | ||
653 | + } | ||
654 | + if (empty($list['zhao_images'])) { | ||
655 | + $zhao_images = []; | ||
656 | + } else { | ||
657 | + if (strstr($list['zhao_images'], ',')) { | ||
658 | + $zhao_images = explode(',', $list['zhao_images']); | ||
659 | + } else { | ||
660 | + $zhao_images = explode(' ', $list['zhao_images']); | ||
661 | + } | ||
662 | + foreach ($zhao_images as $k => $v) { | ||
663 | + $zhao_images[$k] = cdnurl($v); | ||
664 | + } | ||
665 | + } | ||
666 | + if (empty($list['xi_images'])) { | ||
667 | + $xi_images = []; | ||
668 | + } else { | ||
669 | + if (strstr($list['xi_images'], ',')) { | ||
670 | + $xi_images = explode(',', $list['xi_images']); | ||
671 | + } else { | ||
672 | + $xi_images = explode(' ', $list['xi_images']); | ||
673 | + } | ||
674 | + foreach ($xi_images as $k => $v) { | ||
675 | + $xi_images[$k] = cdnurl($v); | ||
676 | + } | ||
677 | + } | ||
678 | + $list['createtime'] = date('Y-m-d H:i:s', $list['time']); | ||
679 | + $list['times'] = date('Y-m-d H:i:s', $list['time']); | ||
680 | + $list['zhao_images'] = $zhao_images; | ||
681 | + $list['xi_images'] = $xi_images; | ||
682 | + $user_type = Db::name('user')->where('id', $user_id)->value('type'); | ||
683 | + $list['user_level'] = $user_type; | ||
684 | + $this->success('成功', $list); | ||
685 | + } | ||
433 | } | 686 | } |
@@ -410,4 +410,48 @@ class Api | @@ -410,4 +410,48 @@ class Api | ||
410 | $osn = $order_id_main . str_pad((100 - $order_id_sum % 100) % 100, 2, '0', STR_PAD_LEFT); //生成唯一订单号 | 410 | $osn = $order_id_main . str_pad((100 - $order_id_sum % 100) % 100, 2, '0', STR_PAD_LEFT); //生成唯一订单号 |
411 | return $osn; | 411 | return $osn; |
412 | } | 412 | } |
413 | + | ||
414 | + | ||
415 | + function httpPost($url, $date) | ||
416 | + { // 模拟提交数据函数 | ||
417 | + $curl = curl_init(); // 启动一个CURL会话 | ||
418 | + curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址 | ||
419 | + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 对认证证书来源的检查 | ||
420 | + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); // 从证书中检查SSL加密算法是否存在 | ||
421 | + curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器 | ||
422 | + curl_setopt($curl, CURLOPT_POST, true); // 发送一个常规的Post请求 | ||
423 | + curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($date)); // Post提交的数据包 | ||
424 | + curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环 | ||
425 | + curl_setopt($curl, CURLOPT_HEADER, false); // 显示返回的Header区域内容 | ||
426 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // 获取的信息以文件流的形式返回 | ||
427 | + curl_setopt($curl, CURLOPT_HEADER, true); //开启header | ||
428 | + curl_setopt($curl, CURLOPT_HTTPHEADER, array( | ||
429 | + 'Content-Type: application/json; charset=utf-8' | ||
430 | + )); //类型为json | ||
431 | + $result = curl_exec($curl); // 执行操作 | ||
432 | + if (curl_errno($curl)) { | ||
433 | + echo 'Error POST' . curl_error($curl); | ||
434 | + } | ||
435 | + curl_close($curl); // 关键CURL会话 | ||
436 | + return $result; // 返回数据 | ||
437 | + } | ||
438 | + | ||
439 | + | ||
440 | + //检测验证码 | ||
441 | + function CheckCode($mobile, $code) | ||
442 | + { | ||
443 | + if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) { | ||
444 | + $this->error(__('手机号不正确')); | ||
445 | + } | ||
446 | + $ret = Db::name('sms')->where('mobile', $mobile)->where('code', $code)->find(); | ||
447 | + if ($ret) { | ||
448 | + $time = time(); | ||
449 | + $times = $ret['createtime'] + 60 * 10; | ||
450 | + if ($time > $times) { | ||
451 | + $this->error(__('验证码已失效')); | ||
452 | + } | ||
453 | + } else { | ||
454 | + $this->error(__('验证码不正确')); | ||
455 | + } | ||
456 | + } | ||
413 | } | 457 | } |
此 diff 太大无法显示。
@@ -26,22 +26,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -26,22 +26,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
26 | {checkbox: true}, | 26 | {checkbox: true}, |
27 | {field: 'id', title: __('Id')}, | 27 | {field: 'id', title: __('Id')}, |
28 | {field: 'order_sn', title: __('Order_sn')}, | 28 | {field: 'order_sn', title: __('Order_sn')}, |
29 | - {field: 'user_id', title: __('User_id')}, | ||
30 | - {field: 'vip_id', title: __('Vip_id')}, | ||
31 | - {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"0":__('Type 0'),"2":__('Type 2')}, formatter: Table.api.formatter.normal}, | ||
32 | - {field: 'xi_id', title: __('Xi_id')}, | ||
33 | - {field: 'xi_type', title: __('Xi_type'), searchList: {"1":__('Xi_type 1'),"0":__('Xi_type 0'),"2":__('Xi_type 2')}, formatter: Table.api.formatter.normal}, | ||
34 | - {field: 'xi_images', title: __('Xi_images'), events: Table.api.events.image, formatter: Table.api.formatter.images}, | ||
35 | - {field: 'zhao_id', title: __('Zhao_id')}, | ||
36 | - {field: 'zhao_type', title: __('Zhao_type'), searchList: {"1":__('Zhao_type 1'),"0":__('Zhao_type 0'),"2":__('Zhao_type 2')}, formatter: Table.api.formatter.normal}, | ||
37 | - {field: 'zhao_images', title: __('Zhao_images'), events: Table.api.events.image, formatter: Table.api.formatter.images}, | ||
38 | - {field: 'car_address', title: __('Car_address')}, | ||
39 | - {field: 'lat', title: __('Lat')}, | ||
40 | - {field: 'lng', title: __('Lng')}, | ||
41 | - {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
42 | - {field: 'startime', title: __('Startime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
43 | - {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
44 | - {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | 29 | + // {field: 'user_id', title: __('User_id')}, |
30 | + // {field: 'vip_id', title: __('Vip_id')}, | ||
45 | {field: 'user.nickname', title: __('User.nickname')}, | 31 | {field: 'user.nickname', title: __('User.nickname')}, |
46 | {field: 'user.mobile', title: __('User.mobile')}, | 32 | {field: 'user.mobile', title: __('User.mobile')}, |
47 | {field: 'user.address', title: __('User.address')}, | 33 | {field: 'user.address', title: __('User.address')}, |
@@ -49,7 +35,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -49,7 +35,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
49 | {field: 'user.car_num', title: __('User.car_num')}, | 35 | {field: 'user.car_num', title: __('User.car_num')}, |
50 | {field: 'user.color', title: __('User.color')}, | 36 | {field: 'user.color', title: __('User.color')}, |
51 | {field: 'user.car_type', title: __('User.car_type')}, | 37 | {field: 'user.car_type', title: __('User.car_type')}, |
38 | + {field: 'user.vip', title: __('User.vip')}, | ||
52 | {field: 'vip.title', title: __('Vip.title')}, | 39 | {field: 'vip.title', title: __('Vip.title')}, |
40 | + {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"0":__('Type 0'),"2":__('Type 2')}, formatter: Table.api.formatter.normal}, | ||
41 | + // {field: 'xi_id', title: __('Xi_id')}, | ||
42 | + {field: 'xi_type', title: __('Xi_type'), searchList: {"1":__('Xi_type 1'),"0":__('Xi_type 0'),"2":__('Xi_type 2')}, formatter: Table.api.formatter.normal}, | ||
43 | + // {field: 'xi_images', title: __('Xi_images'), events: Table.api.events.image, formatter: Table.api.formatter.images}, | ||
44 | + // {field: 'zhao_id', title: __('Zhao_id')}, | ||
45 | + {field: 'zhao_type', title: __('Zhao_type'), searchList: {"1":__('Zhao_type 1'),"0":__('Zhao_type 0'),"2":__('Zhao_type 2')}, formatter: Table.api.formatter.normal}, | ||
46 | + // {field: 'zhao_images', title: __('Zhao_images'), events: Table.api.events.image, formatter: Table.api.formatter.images}, | ||
47 | + {field: 'car_address', title: __('Car_address')}, | ||
48 | + // {field: 'lat', title: __('Lat')}, | ||
49 | + // {field: 'lng', title: __('Lng')}, | ||
50 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
51 | + {field: 'startime', title: __('Startime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
52 | + {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
53 | + {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
53 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | 54 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} |
54 | ] | 55 | ] |
55 | ] | 56 | ] |
-
请 注册 或 登录 后发表评论