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

修改参数接收方法

... ... @@ -274,7 +274,7 @@ class Cart extends Api
*/
public function pay()
{
$data = $this->request->param();
$data = $this->request->get();
empty($data['cart_ids']) && $this->error(__('参数【cart_ids】不能为空'));
$order = $this->model->getList($this->user,['id'=>['in',$data['cart_ids']]],$data);
if (!$this->request->isPost()) {
... ...
... ... @@ -89,9 +89,9 @@ class Category extends Api
*/
public function goods()
{
$rows = $this->request->param('rows',null);// 每页条数
$page = $this->request->param('page',1);// 页码
$category_id = $this->request->param('category_id');
$rows = $this->request->get('rows',null);// 每页条数
$page = $this->request->get('page',1);// 页码
$category_id = $this->request->get('category_id');
$category = $this->model->get($category_id);
empty($category) && $this->error(__('分类信息不存在'));
$has_parent = $this->model->where('pid','>','0')->where('id',$category['pid'])->find();
... ...
... ... @@ -107,9 +107,9 @@ class Index extends Api
*/
public function searchGoodsList()
{
$rows = $this->request->param('rows',null);// 每页条数
$page = $this->request->param('page',1);// 页码
$keywords = $this->request->param('keywords','');
$rows = $this->request->get('rows',null);// 每页条数
$page = $this->request->get('page',1);// 页码
$keywords = $this->request->get('keywords','');
$list = Goods::getList(['goods_name'=>['like','%'.$keywords.'%']],$page,$rows);
$this->success(__('成功'),compact('list'));
}
... ... @@ -155,9 +155,9 @@ class Index extends Api
*/
public function goodsList()
{
$rows = $this->request->param('rows',null);// 每页条数
$page = $this->request->param('page',1);// 页码
$category_id = $this->request->param('category_id');// 分类id
$rows = $this->request->get('rows',null);// 每页条数
$page = $this->request->get('page',1);// 页码
$category_id = $this->request->get('category_id');// 分类id
empty($category_id) && $this->error(__('参数不合法!'));
$three_category_id_arr = Category::where('pid',$category_id)->column('id');
$where = "FIND_IN_SET('{$category_id}', category_ids)";
... ... @@ -185,8 +185,8 @@ class Index extends Api
*/
public function memberGoodsList()
{
$rows = $this->request->param('rows',null);// 每页条数
$page = $this->request->param('page',1);// 页码
$rows = $this->request->get('rows',null);// 每页条数
$page = $this->request->get('page',1);// 页码
$list = Goods::getList(['ismember'=>'1'],$page,$rows);
// 返回结果
$this->success(__('成功'),compact('list'));
... ... @@ -207,8 +207,8 @@ class Index extends Api
*/
public function hotGoodsList()
{
$rows = $this->request->param('rows',null);// 每页条数
$page = $this->request->param('page',1);// 页码
$rows = $this->request->get('rows',null);// 每页条数
$page = $this->request->get('page',1);// 页码
$list = Goods::getList(['ishot'=>'1'],$page,$rows);
// 返回结果
$this->success(__('成功'),compact('list'));
... ... @@ -229,7 +229,7 @@ class Index extends Api
public function goodsInfo()
{
// 商品id
$goods_id = $this->request->param('goods_id');
$goods_id = $this->request->get('goods_id');
$goods = Goods::get($goods_id);
empty($goods) && $this->error(__('商品不存在'));
$goods['issale'] == '0' && $this->error(__('商品已下架'));
... ... @@ -268,9 +268,9 @@ class Index extends Api
public function appraiseList()
{
// 商品id
$rows = $this->request->param('rows',null);
$page = $this->request->param('page',1);
$goods_id = $this->request->param('goods_id');
$rows = $this->request->get('rows',null);
$page = $this->request->get('page',1);
$goods_id = $this->request->get('goods_id');
$list = \app\common\model\GoodsAppraise::getList(['goods_id'=>$goods_id],$page,$rows);
// 返回结果
$this->success(__('成功'),compact('list'));
... ... @@ -290,7 +290,7 @@ class Index extends Api
*/
public function styleList()
{
$goods_id = $this->request->param('goods_id');
$goods_id = $this->request->get('goods_id');
$goods = Goods::get($goods_id);
empty($goods) && $this->error(__('商品信息不存在'));
$goods_style = GoodsStyle::get(['goods_id'=>$goods_id]);
... ... @@ -313,7 +313,7 @@ class Index extends Api
*/
public function specData()
{
$goods_id = $this->request->param('goods_id');
$goods_id = $this->request->get('goods_id');
$goods = Goods::get($goods_id);
empty($goods) && $this->error(__('商品信息不存在'));
$spec_data = $goods['spec_type'] == '2' ? $goods->getManySpecData($goods['spec_rel'], $goods['spec']) : null;
... ... @@ -335,8 +335,8 @@ class Index extends Api
*/
public function getGoodsSku()
{
$goods_id = $this->request->param('goods_id');
$spec_sku_id = $this->request->param('spec_sku_id');
$goods_id = $this->request->get('goods_id');
$spec_sku_id = $this->request->get('spec_sku_id');
$goods = Goods::get($goods_id,['spec_rel.spec']);
empty($goods) && $this->error(__('商品信息不存在'));
empty($spec_sku_id) && $this->error(__('请选择规格'));
... ...
... ... @@ -24,8 +24,7 @@ class Sms extends Api
public function send()
{
$mobile = $this->request->get("mobile");
$this->error('测试:'.$mobile);
$event = $this->request->param("event");
$event = $this->request->get("event");
$event = $event ? $event : 'changemobile';
if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) {
$this->error(__('手机号不正确'));
... ...
... ... @@ -178,8 +178,8 @@ class User extends Api
})
*/
public function scoreLog(){
$rows = $this->request->param('rows',null);// 每页条数
$page = $this->request->param('page',1);// 页码
$rows = $this->request->get('rows',null);// 每页条数
$page = $this->request->get('page',1);// 页码
$list = $this->model->scoreLog($this->user['id'],$page,$rows);
$this->success(__('成功'),array_merge([
'score' => $this->user['score']
... ... @@ -200,7 +200,7 @@ class User extends Api
})
*/
public function couponList(){
$status = $this->request->param('status');
$status = $this->request->get('status');
$list = \app\common\model\UserCoupon::couponList($this->user, $status);
$this->success(__('成功'),compact('list'));
}
... ... @@ -268,7 +268,7 @@ class User extends Api
*/
public function addressDetail()
{
$user_address_id = $this->request->param('user_address_id');
$user_address_id = $this->request->get('user_address_id');
$detail = UserAddress::detail($this->user['id'],$user_address_id);
$this->success(__('成功'),compact('detail'));
}
... ... @@ -323,7 +323,7 @@ class User extends Api
*/
public function addressDelete()
{
$user_address_id = $this->request->param('user_address_id');
$user_address_id = $this->request->get('user_address_id');
$model = UserAddress::detail($this->user['id'], $user_address_id);
if ($model->remove($this->user)) {
$this->success(__('删除成功'));
... ... @@ -346,7 +346,7 @@ class User extends Api
*/
public function addressDefault()
{
$user_address_id = $this->request->param('user_address_id');
$user_address_id = $this->request->get('user_address_id');
$model = UserAddress::detail($this->user['id'], $user_address_id);
if ($model->setDefault()) {
$this->success(__('设置成功'));
... ... @@ -386,7 +386,7 @@ class User extends Api
*/
public function bodyInfo()
{
$gender = $this->request->param('gender','1');
$gender = $this->request->get('gender','1');
$list = \app\common\model\Style::styleList($gender);
$this->success(__('成功'),compact('list'));
}
... ... @@ -480,7 +480,7 @@ class User extends Api
*/
public function sizeDetail()
{
$user_size_id = $this->request->param('user_size_id');
$user_size_id = $this->request->get('user_size_id');
$detail = UserSize::detail($this->user['id'],$user_size_id);
$this->success(__('成功'),compact('detail'));
}
... ... @@ -545,7 +545,7 @@ class User extends Api
*/
public function sizeDelete()
{
$user_size_id = $this->request->param('user_size_id');
$user_size_id = $this->request->get('user_size_id');
$model = UserSize::detail($this->user['id'], $user_size_id);
if ($model->remove($this->user)) {
$this->success(__('删除成功'));
... ... @@ -568,7 +568,7 @@ class User extends Api
*/
public function sizeDefault()
{
$user_size_id = $this->request->param('user_size_id');
$user_size_id = $this->request->get('user_size_id');
$model = UserSize::detail($this->user['id'], $user_size_id);
if ($model->setDefault()) {
$this->success(__('设置成功'));
... ...