正在显示
4 个修改的文件
包含
33 行增加
和
59 行删除
@@ -89,9 +89,9 @@ class Category extends Api | @@ -89,9 +89,9 @@ class Category extends Api | ||
89 | */ | 89 | */ |
90 | public function goods() | 90 | public function goods() |
91 | { | 91 | { |
92 | - $rows = $this->request->request('rows',null);// 每页条数 | ||
93 | - $page = $this->request->request('page',1);// 页码 | ||
94 | - $category_id = $this->request->request('category_id'); | 92 | + $rows = $this->request->param('rows',null);// 每页条数 |
93 | + $page = $this->request->param('page',1);// 页码 | ||
94 | + $category_id = $this->request->param('category_id'); | ||
95 | $category = $this->model->get($category_id); | 95 | $category = $this->model->get($category_id); |
96 | empty($category) && $this->error(__('分类信息不存在')); | 96 | empty($category) && $this->error(__('分类信息不存在')); |
97 | $has_parent = $this->model->where('pid','>','0')->where('id',$category['pid'])->find(); | 97 | $has_parent = $this->model->where('pid','>','0')->where('id',$category['pid'])->find(); |
@@ -107,9 +107,9 @@ class Index extends Api | @@ -107,9 +107,9 @@ class Index extends Api | ||
107 | */ | 107 | */ |
108 | public function searchGoodsList() | 108 | public function searchGoodsList() |
109 | { | 109 | { |
110 | - $rows = $this->request->request('rows',null);// 每页条数 | ||
111 | - $page = $this->request->request('page',1);// 页码 | ||
112 | - $keywords = $this->request->request('keywords',''); | 110 | + $rows = $this->request->param('rows',null);// 每页条数 |
111 | + $page = $this->request->param('page',1);// 页码 | ||
112 | + $keywords = $this->request->param('keywords',''); | ||
113 | $list = Goods::getList(['goods_name'=>['like','%'.$keywords.'%']],$page,$rows); | 113 | $list = Goods::getList(['goods_name'=>['like','%'.$keywords.'%']],$page,$rows); |
114 | $this->success(__('成功'),compact('list')); | 114 | $this->success(__('成功'),compact('list')); |
115 | } | 115 | } |
@@ -155,9 +155,9 @@ class Index extends Api | @@ -155,9 +155,9 @@ class Index extends Api | ||
155 | */ | 155 | */ |
156 | public function goodsList() | 156 | public function goodsList() |
157 | { | 157 | { |
158 | - $rows = $this->request->request('rows',null);// 每页条数 | ||
159 | - $page = $this->request->request('page',1);// 页码 | ||
160 | - $category_id = $this->request->request('category_id');// 分类id | 158 | + $rows = $this->request->param('rows',null);// 每页条数 |
159 | + $page = $this->request->param('page',1);// 页码 | ||
160 | + $category_id = $this->request->param('category_id');// 分类id | ||
161 | empty($category_id) && $this->error(__('参数不合法!')); | 161 | empty($category_id) && $this->error(__('参数不合法!')); |
162 | $three_category_id_arr = Category::where('pid',$category_id)->column('id'); | 162 | $three_category_id_arr = Category::where('pid',$category_id)->column('id'); |
163 | $where = "FIND_IN_SET('{$category_id}', category_ids)"; | 163 | $where = "FIND_IN_SET('{$category_id}', category_ids)"; |
@@ -185,8 +185,8 @@ class Index extends Api | @@ -185,8 +185,8 @@ class Index extends Api | ||
185 | */ | 185 | */ |
186 | public function memberGoodsList() | 186 | public function memberGoodsList() |
187 | { | 187 | { |
188 | - $rows = $this->request->request('rows',null);// 每页条数 | ||
189 | - $page = $this->request->request('page',1);// 页码 | 188 | + $rows = $this->request->param('rows',null);// 每页条数 |
189 | + $page = $this->request->param('page',1);// 页码 | ||
190 | $list = Goods::getList(['ismember'=>'1'],$page,$rows); | 190 | $list = Goods::getList(['ismember'=>'1'],$page,$rows); |
191 | // 返回结果 | 191 | // 返回结果 |
192 | $this->success(__('成功'),compact('list')); | 192 | $this->success(__('成功'),compact('list')); |
@@ -207,8 +207,8 @@ class Index extends Api | @@ -207,8 +207,8 @@ class Index extends Api | ||
207 | */ | 207 | */ |
208 | public function hotGoodsList() | 208 | public function hotGoodsList() |
209 | { | 209 | { |
210 | - $rows = $this->request->request('rows',null);// 每页条数 | ||
211 | - $page = $this->request->request('page',1);// 页码 | 210 | + $rows = $this->request->param('rows',null);// 每页条数 |
211 | + $page = $this->request->param('page',1);// 页码 | ||
212 | $list = Goods::getList(['ishot'=>'1'],$page,$rows); | 212 | $list = Goods::getList(['ishot'=>'1'],$page,$rows); |
213 | // 返回结果 | 213 | // 返回结果 |
214 | $this->success(__('成功'),compact('list')); | 214 | $this->success(__('成功'),compact('list')); |
@@ -229,7 +229,7 @@ class Index extends Api | @@ -229,7 +229,7 @@ class Index extends Api | ||
229 | public function goodsInfo() | 229 | public function goodsInfo() |
230 | { | 230 | { |
231 | // 商品id | 231 | // 商品id |
232 | - $goods_id = $this->request->request('goods_id'); | 232 | + $goods_id = $this->request->param('goods_id'); |
233 | $goods = Goods::get($goods_id); | 233 | $goods = Goods::get($goods_id); |
234 | empty($goods) && $this->error(__('商品不存在')); | 234 | empty($goods) && $this->error(__('商品不存在')); |
235 | $goods['issale'] == '0' && $this->error(__('商品已下架')); | 235 | $goods['issale'] == '0' && $this->error(__('商品已下架')); |
@@ -268,9 +268,9 @@ class Index extends Api | @@ -268,9 +268,9 @@ class Index extends Api | ||
268 | public function appraiseList() | 268 | public function appraiseList() |
269 | { | 269 | { |
270 | // 商品id | 270 | // 商品id |
271 | - $rows = $this->request->request('rows',null); | ||
272 | - $page = $this->request->request('page',1); | ||
273 | - $goods_id = $this->request->request('goods_id'); | 271 | + $rows = $this->request->param('rows',null); |
272 | + $page = $this->request->param('page',1); | ||
273 | + $goods_id = $this->request->param('goods_id'); | ||
274 | $list = \app\common\model\GoodsAppraise::getList(['goods_id'=>$goods_id],$page,$rows); | 274 | $list = \app\common\model\GoodsAppraise::getList(['goods_id'=>$goods_id],$page,$rows); |
275 | // 返回结果 | 275 | // 返回结果 |
276 | $this->success(__('成功'),compact('list')); | 276 | $this->success(__('成功'),compact('list')); |
@@ -290,7 +290,7 @@ class Index extends Api | @@ -290,7 +290,7 @@ class Index extends Api | ||
290 | */ | 290 | */ |
291 | public function styleList() | 291 | public function styleList() |
292 | { | 292 | { |
293 | - $goods_id = $this->request->request('goods_id'); | 293 | + $goods_id = $this->request->param('goods_id'); |
294 | $goods = Goods::get($goods_id); | 294 | $goods = Goods::get($goods_id); |
295 | empty($goods) && $this->error(__('商品信息不存在')); | 295 | empty($goods) && $this->error(__('商品信息不存在')); |
296 | $goods_style = GoodsStyle::get(['goods_id'=>$goods_id]); | 296 | $goods_style = GoodsStyle::get(['goods_id'=>$goods_id]); |
@@ -313,7 +313,7 @@ class Index extends Api | @@ -313,7 +313,7 @@ class Index extends Api | ||
313 | */ | 313 | */ |
314 | public function specData() | 314 | public function specData() |
315 | { | 315 | { |
316 | - $goods_id = $this->request->request('goods_id'); | 316 | + $goods_id = $this->request->param('goods_id'); |
317 | $goods = Goods::get($goods_id); | 317 | $goods = Goods::get($goods_id); |
318 | empty($goods) && $this->error(__('商品信息不存在')); | 318 | empty($goods) && $this->error(__('商品信息不存在')); |
319 | $spec_data = $goods['spec_type'] == '2' ? $goods->getManySpecData($goods['spec_rel'], $goods['spec']) : null; | 319 | $spec_data = $goods['spec_type'] == '2' ? $goods->getManySpecData($goods['spec_rel'], $goods['spec']) : null; |
@@ -335,8 +335,8 @@ class Index extends Api | @@ -335,8 +335,8 @@ class Index extends Api | ||
335 | */ | 335 | */ |
336 | public function getGoodsSku() | 336 | public function getGoodsSku() |
337 | { | 337 | { |
338 | - $goods_id = $this->request->request('goods_id'); | ||
339 | - $spec_sku_id = $this->request->request('spec_sku_id'); | 338 | + $goods_id = $this->request->param('goods_id'); |
339 | + $spec_sku_id = $this->request->param('spec_sku_id'); | ||
340 | $goods = Goods::get($goods_id,['spec_rel.spec']); | 340 | $goods = Goods::get($goods_id,['spec_rel.spec']); |
341 | empty($goods) && $this->error(__('商品信息不存在')); | 341 | empty($goods) && $this->error(__('商品信息不存在')); |
342 | empty($spec_sku_id) && $this->error(__('请选择规格')); | 342 | empty($spec_sku_id) && $this->error(__('请选择规格')); |
@@ -23,8 +23,8 @@ class Sms extends Api | @@ -23,8 +23,8 @@ class Sms extends Api | ||
23 | */ | 23 | */ |
24 | public function send() | 24 | public function send() |
25 | { | 25 | { |
26 | - $mobile = $this->request->request("mobile"); | ||
27 | - $event = $this->request->request("event"); | 26 | + $mobile = $this->request->param("mobile"); |
27 | + $event = $this->request->param("event"); | ||
28 | $event = $event ? $event : 'changemobile'; | 28 | $event = $event ? $event : 'changemobile'; |
29 | if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) { | 29 | if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) { |
30 | $this->error(__('手机号不正确')); | 30 | $this->error(__('手机号不正确')); |
@@ -106,30 +106,4 @@ class Sms extends Api | @@ -106,30 +106,4 @@ class Sms extends Api | ||
106 | return false; | 106 | return false; |
107 | } | 107 | } |
108 | } | 108 | } |
109 | - | ||
110 | - /** | ||
111 | - * post提交数据 | ||
112 | - */ | ||
113 | - protected function httpPost($url, $date) { // 模拟提交数据函数 | ||
114 | - $curl = curl_init(); // 启动一个CURL会话 | ||
115 | - curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址 | ||
116 | - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 对认证证书来源的检查 | ||
117 | - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); // 从证书中检查SSL加密算法是否存在 | ||
118 | - curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器 | ||
119 | - curl_setopt($curl, CURLOPT_POST, true); // 发送一个常规的Post请求 | ||
120 | - curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($date)); // Post提交的数据包 | ||
121 | - curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环 | ||
122 | - curl_setopt($curl, CURLOPT_HEADER, false); // 显示返回的Header区域内容 | ||
123 | - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // 获取的信息以文件流的形式返回 | ||
124 | - curl_setopt($curl, CURLOPT_HEADER, true); //开启header | ||
125 | - curl_setopt($curl, CURLOPT_HTTPHEADER, array( | ||
126 | - 'Content-Type: application/json; charset=utf-8' | ||
127 | - )); //类型为json | ||
128 | - $result = curl_exec($curl); // 执行操作 | ||
129 | - if (curl_errno($curl)) { | ||
130 | - echo 'Error POST' . curl_error($curl); | ||
131 | - } | ||
132 | - curl_close($curl); // 关键CURL会话 | ||
133 | - return $result; // 返回数据 | ||
134 | - } | ||
135 | } | 109 | } |
@@ -178,8 +178,8 @@ class User extends Api | @@ -178,8 +178,8 @@ class User extends Api | ||
178 | }) | 178 | }) |
179 | */ | 179 | */ |
180 | public function scoreLog(){ | 180 | public function scoreLog(){ |
181 | - $rows = $this->request->request('rows',null);// 每页条数 | ||
182 | - $page = $this->request->request('page',1);// 页码 | 181 | + $rows = $this->request->param('rows',null);// 每页条数 |
182 | + $page = $this->request->param('page',1);// 页码 | ||
183 | $list = $this->model->scoreLog($this->user['id'],$page,$rows); | 183 | $list = $this->model->scoreLog($this->user['id'],$page,$rows); |
184 | $this->success(__('成功'),array_merge([ | 184 | $this->success(__('成功'),array_merge([ |
185 | 'score' => $this->user['score'] | 185 | 'score' => $this->user['score'] |
@@ -200,7 +200,7 @@ class User extends Api | @@ -200,7 +200,7 @@ class User extends Api | ||
200 | }) | 200 | }) |
201 | */ | 201 | */ |
202 | public function couponList(){ | 202 | public function couponList(){ |
203 | - $status = $this->request->request('status'); | 203 | + $status = $this->request->param('status'); |
204 | $list = \app\common\model\UserCoupon::couponList($this->user, $status); | 204 | $list = \app\common\model\UserCoupon::couponList($this->user, $status); |
205 | $this->success(__('成功'),compact('list')); | 205 | $this->success(__('成功'),compact('list')); |
206 | } | 206 | } |
@@ -268,7 +268,7 @@ class User extends Api | @@ -268,7 +268,7 @@ class User extends Api | ||
268 | */ | 268 | */ |
269 | public function addressDetail() | 269 | public function addressDetail() |
270 | { | 270 | { |
271 | - $user_address_id = $this->request->request('user_address_id'); | 271 | + $user_address_id = $this->request->param('user_address_id'); |
272 | $detail = UserAddress::detail($this->user['id'],$user_address_id); | 272 | $detail = UserAddress::detail($this->user['id'],$user_address_id); |
273 | $this->success(__('成功'),compact('detail')); | 273 | $this->success(__('成功'),compact('detail')); |
274 | } | 274 | } |
@@ -323,7 +323,7 @@ class User extends Api | @@ -323,7 +323,7 @@ class User extends Api | ||
323 | */ | 323 | */ |
324 | public function addressDelete() | 324 | public function addressDelete() |
325 | { | 325 | { |
326 | - $user_address_id = $this->request->request('user_address_id'); | 326 | + $user_address_id = $this->request->param('user_address_id'); |
327 | $model = UserAddress::detail($this->user['id'], $user_address_id); | 327 | $model = UserAddress::detail($this->user['id'], $user_address_id); |
328 | if ($model->remove($this->user)) { | 328 | if ($model->remove($this->user)) { |
329 | $this->success(__('删除成功')); | 329 | $this->success(__('删除成功')); |
@@ -346,7 +346,7 @@ class User extends Api | @@ -346,7 +346,7 @@ class User extends Api | ||
346 | */ | 346 | */ |
347 | public function addressDefault() | 347 | public function addressDefault() |
348 | { | 348 | { |
349 | - $user_address_id = $this->request->request('user_address_id'); | 349 | + $user_address_id = $this->request->param('user_address_id'); |
350 | $model = UserAddress::detail($this->user['id'], $user_address_id); | 350 | $model = UserAddress::detail($this->user['id'], $user_address_id); |
351 | if ($model->setDefault()) { | 351 | if ($model->setDefault()) { |
352 | $this->success(__('设置成功')); | 352 | $this->success(__('设置成功')); |
@@ -386,7 +386,7 @@ class User extends Api | @@ -386,7 +386,7 @@ class User extends Api | ||
386 | */ | 386 | */ |
387 | public function bodyInfo() | 387 | public function bodyInfo() |
388 | { | 388 | { |
389 | - $gender = $this->request->request('gender','1'); | 389 | + $gender = $this->request->param('gender','1'); |
390 | $list = \app\common\model\Style::styleList($gender); | 390 | $list = \app\common\model\Style::styleList($gender); |
391 | $this->success(__('成功'),compact('list')); | 391 | $this->success(__('成功'),compact('list')); |
392 | } | 392 | } |
@@ -480,7 +480,7 @@ class User extends Api | @@ -480,7 +480,7 @@ class User extends Api | ||
480 | */ | 480 | */ |
481 | public function sizeDetail() | 481 | public function sizeDetail() |
482 | { | 482 | { |
483 | - $user_size_id = $this->request->request('user_size_id'); | 483 | + $user_size_id = $this->request->param('user_size_id'); |
484 | $detail = UserSize::detail($this->user['id'],$user_size_id); | 484 | $detail = UserSize::detail($this->user['id'],$user_size_id); |
485 | $this->success(__('成功'),compact('detail')); | 485 | $this->success(__('成功'),compact('detail')); |
486 | } | 486 | } |
@@ -545,7 +545,7 @@ class User extends Api | @@ -545,7 +545,7 @@ class User extends Api | ||
545 | */ | 545 | */ |
546 | public function sizeDelete() | 546 | public function sizeDelete() |
547 | { | 547 | { |
548 | - $user_size_id = $this->request->request('user_size_id'); | 548 | + $user_size_id = $this->request->param('user_size_id'); |
549 | $model = UserSize::detail($this->user['id'], $user_size_id); | 549 | $model = UserSize::detail($this->user['id'], $user_size_id); |
550 | if ($model->remove($this->user)) { | 550 | if ($model->remove($this->user)) { |
551 | $this->success(__('删除成功')); | 551 | $this->success(__('删除成功')); |
@@ -568,7 +568,7 @@ class User extends Api | @@ -568,7 +568,7 @@ class User extends Api | ||
568 | */ | 568 | */ |
569 | public function sizeDefault() | 569 | public function sizeDefault() |
570 | { | 570 | { |
571 | - $user_size_id = $this->request->request('user_size_id'); | 571 | + $user_size_id = $this->request->param('user_size_id'); |
572 | $model = UserSize::detail($this->user['id'], $user_size_id); | 572 | $model = UserSize::detail($this->user['id'], $user_size_id); |
573 | if ($model->setDefault()) { | 573 | if ($model->setDefault()) { |
574 | $this->success(__('设置成功')); | 574 | $this->success(__('设置成功')); |
-
请 注册 或 登录 后发表评论