Browse Source

分类商品 取消分页 webview

master
Lemon 5 years ago
parent
commit
2d54fe2360
  1. 4
      app/Controller/v3/StoreController.php
  2. 10
      app/Service/v3/Implementations/GoodsService.php
  3. 4
      app/Service/v3/Implementations/UserCenterBlockService.php
  4. 2
      app/Service/v3/Interfaces/GoodsServiceInterface.php

4
app/Controller/v3/StoreController.php

@ -95,9 +95,7 @@ class StoreController extends BaseController
{ {
$storeId = $this->request->input('store_id'); $storeId = $this->request->input('store_id');
$typeId = $this->request->input('type_id',''); $typeId = $this->request->input('type_id','');
$page = $this->request->input('page',1);
$pagesize = $this->request->input('pagesize',10);
$goods = $this->goodsService->getByType($storeId,$typeId,$page,$pagesize);
$goods = $this->goodsService->getByType($storeId,$typeId);
return $this->success($goods); return $this->success($goods);
} }

10
app/Service/v3/Implementations/GoodsService.php

@ -67,17 +67,13 @@ class GoodsService implements GoodsServiceInterface
public function detail($goodsId) public function detail($goodsId)
{ {
$res = Goods::query()->with('store')->where('id',$goodsId)->first();
$res = Goods::query()->with('store')->where('id',$goodsId)->select('*','name as goods_name')->first();
return $res; return $res;
} }
public function getByType($storeId,$typeId, $page=1, $pagesize=10)
public function getByType($storeId,$typeId)
{ {
$builder = Goods::query()->where(['store_id' => $storeId,'category_id' => $typeId]);
$paginate = $builder->orderByDesc('on_sale')->orderByDesc('created_at')->paginate($pagesize);
$goods = $paginate->toArray();
return ['has_more_pages' => $paginate->hasMorePages(), 'goods' => $goods['data']];
return Goods::query()->where(['store_id' => $storeId,'category_id' => $typeId])->orderByDesc('on_sale')->orderByDesc('created_at')->get()->toArray();
} }
public function update($params) public function update($params)

4
app/Service/v3/Implementations/UserCenterBlockService.php

@ -51,7 +51,7 @@ class UserCenterBlockService implements UserCenterBlockServiceInterface
[ [
'name' => '商品管理', 'icon' => $img_host . 'user_icons/service2.png', 'name' => '商品管理', 'icon' => $img_host . 'user_icons/service2.png',
'type' => 'webview', 'type' => 'webview',
'path' => '/pages/webview/webview?data=%27%7b%22webview_url%22%3a%22http%3a%2f%2flocalhost%3a8080%2f%23%2fpages%2fgoodsManagement%2fgoodsManagement%3fmarket_id%3d1%26user_id%3d694%26store_id%3d5%22%7d%27',
'path' => 'http://localhost:8080/#/pages/goodsManagement/goodsManagement?market_id=1&user_id=694&store_id=5',
'command'=>'sp_login' 'command'=>'sp_login'
] ]
] ]
@ -79,7 +79,7 @@ class UserCenterBlockService implements UserCenterBlockServiceInterface
[ [
'name' => '商品管理', 'icon' => $img_host . 'user_icons/service2.png', 'name' => '商品管理', 'icon' => $img_host . 'user_icons/service2.png',
'type' => 'webview', 'type' => 'webview',
'path' => '/pages/webview/webview?data=%27%7b%22webview_url%22%3a%22http%3a%2f%2flocalhost%3a8080%2f%23%2fpages%2fgoodsManagement%2fgoodsManagement%3fmarket_id%3d1%26user_id%3d694%26store_id%3d5%22%7d%27',
'path' => 'http://localhost:8080/#/pages/goodsManagement/goodsManagement?market_id=1&user_id=694&store_id=5',
'command'=>'sp_login' 'command'=>'sp_login'
] ]
] ]

2
app/Service/v3/Interfaces/GoodsServiceInterface.php

@ -10,6 +10,6 @@ interface GoodsServiceInterface
public function check(Goods $goods,$num = 1); public function check(Goods $goods,$num = 1);
public function undo(); public function undo();
public function getBanner($goodsId); public function getBanner($goodsId);
public function getByType($storeId,$typeId, $page=1, $pagesize=10);
public function getByType($storeId,$typeId);
public function update($params); public function update($params);
} }
Loading…
Cancel
Save