作者 何书鹏
1 个管道 的构建 通过 耗费 2 秒

修改参数接收方法

@@ -274,7 +274,7 @@ class Cart extends Api @@ -274,7 +274,7 @@ class Cart extends Api
274 */ 274 */
275 public function pay() 275 public function pay()
276 { 276 {
277 - $data = $this->request->param(); 277 + $data = $this->request->get();
278 empty($data['cart_ids']) && $this->error(__('参数【cart_ids】不能为空')); 278 empty($data['cart_ids']) && $this->error(__('参数【cart_ids】不能为空'));
279 $order = $this->model->getList($this->user,['id'=>['in',$data['cart_ids']]],$data); 279 $order = $this->model->getList($this->user,['id'=>['in',$data['cart_ids']]],$data);
280 if (!$this->request->isPost()) { 280 if (!$this->request->isPost()) {
@@ -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->param('rows',null);// 每页条数  
93 - $page = $this->request->param('page',1);// 页码  
94 - $category_id = $this->request->param('category_id'); 92 + $rows = $this->request->get('rows',null);// 每页条数
  93 + $page = $this->request->get('page',1);// 页码
  94 + $category_id = $this->request->get('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->param('rows',null);// 每页条数  
111 - $page = $this->request->param('page',1);// 页码  
112 - $keywords = $this->request->param('keywords',''); 110 + $rows = $this->request->get('rows',null);// 每页条数
  111 + $page = $this->request->get('page',1);// 页码
  112 + $keywords = $this->request->get('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->param('rows',null);// 每页条数  
159 - $page = $this->request->param('page',1);// 页码  
160 - $category_id = $this->request->param('category_id');// 分类id 158 + $rows = $this->request->get('rows',null);// 每页条数
  159 + $page = $this->request->get('page',1);// 页码
  160 + $category_id = $this->request->get('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->param('rows',null);// 每页条数  
189 - $page = $this->request->param('page',1);// 页码 188 + $rows = $this->request->get('rows',null);// 每页条数
  189 + $page = $this->request->get('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->param('rows',null);// 每页条数  
211 - $page = $this->request->param('page',1);// 页码 210 + $rows = $this->request->get('rows',null);// 每页条数
  211 + $page = $this->request->get('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->param('goods_id'); 232 + $goods_id = $this->request->get('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->param('rows',null);  
272 - $page = $this->request->param('page',1);  
273 - $goods_id = $this->request->param('goods_id'); 271 + $rows = $this->request->get('rows',null);
  272 + $page = $this->request->get('page',1);
  273 + $goods_id = $this->request->get('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->param('goods_id'); 293 + $goods_id = $this->request->get('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->param('goods_id'); 316 + $goods_id = $this->request->get('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->param('goods_id');  
339 - $spec_sku_id = $this->request->param('spec_sku_id'); 338 + $goods_id = $this->request->get('goods_id');
  339 + $spec_sku_id = $this->request->get('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(__('请选择规格'));
@@ -24,8 +24,7 @@ class Sms extends Api @@ -24,8 +24,7 @@ class Sms extends Api
24 public function send() 24 public function send()
25 { 25 {
26 $mobile = $this->request->get("mobile"); 26 $mobile = $this->request->get("mobile");
27 - $this->error('测试:'.$mobile);  
28 - $event = $this->request->param("event"); 27 + $event = $this->request->get("event");
29 $event = $event ? $event : 'changemobile'; 28 $event = $event ? $event : 'changemobile';
30 if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) { 29 if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) {
31 $this->error(__('手机号不正确')); 30 $this->error(__('手机号不正确'));
@@ -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->param('rows',null);// 每页条数  
182 - $page = $this->request->param('page',1);// 页码 181 + $rows = $this->request->get('rows',null);// 每页条数
  182 + $page = $this->request->get('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->param('status'); 203 + $status = $this->request->get('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->param('user_address_id'); 271 + $user_address_id = $this->request->get('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->param('user_address_id'); 326 + $user_address_id = $this->request->get('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->param('user_address_id'); 349 + $user_address_id = $this->request->get('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->param('gender','1'); 389 + $gender = $this->request->get('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->param('user_size_id'); 483 + $user_size_id = $this->request->get('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->param('user_size_id'); 548 + $user_size_id = $this->request->get('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->param('user_size_id'); 571 + $user_size_id = $this->request->get('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(__('设置成功'));