Browse Source

类型关联字段+订单删除状态冲突

master
weigang 5 years ago
parent
commit
ed0d2963ef
  1. 10
      app/Constants/v3/OrderState.php
  2. 4
      app/Model/v3/StoreType.php
  3. 6
      app/Service/v3/Implementations/CategoryService.php
  4. 8
      app/Service/v3/Implementations/OrderListService.php
  5. 4
      app/Service/v3/Implementations/SearchService.php

10
app/Constants/v3/OrderState.php

@ -75,14 +75,4 @@ class OrderState extends AbstractConstants
*/ */
const REFUND = [self::REFUNDING, self::REFUNDED, self::REFUND_REFUSE]; const REFUND = [self::REFUNDING, self::REFUNDED, self::REFUND_REFUSE];
/**
* @Message("已删除")
*/
const DELETED = 1;
/**
* @Message("未删除")
*/
const NOT_DELETED = 2;
} }

4
app/Model/v3/StoreType.php

@ -26,10 +26,10 @@ class StoreType extends Model
return $this->hasManyThrough( return $this->hasManyThrough(
GoodsType::class, GoodsType::class,
TypeCorrelation::class, TypeCorrelation::class,
'store_type_id',
'category_id',
'id', 'id',
'id', 'id',
'goods_type_id'
'category_id'
); );
} }

6
app/Service/v3/Implementations/CategoryService.php

@ -37,13 +37,13 @@ class CategoryService implements CategoryServiceInterface
public function allForStore($storeId) public function allForStore($storeId)
{ {
$goodsTypeIds = Goods::query()->select('goods_type_id')
$goodsTypeIds = Goods::query()->select('category_id')
->where(['store_id' => $storeId]) ->where(['store_id' => $storeId])
->groupBy(['goods_type_id'])
->groupBy(['category_id'])
->get()->toArray(); ->get()->toArray();
return GoodsType::query() return GoodsType::query()
->whereIn('id', array_column($goodsTypeIds, 'goods_type_id'))
->whereIn('id', array_column($goodsTypeIds, 'category_id'))
->orderBy('sort', 'DESC') ->orderBy('sort', 'DESC')
->orderBy('id', 'DESC') ->orderBy('id', 'DESC')
->get()->toArray(); ->get()->toArray();

8
app/Service/v3/Implementations/OrderListService.php

@ -29,13 +29,7 @@ class OrderListService implements OrderListServiceInterface
public function onlineByUser($userId, $tab, $page=1, $pagesize=10) public function onlineByUser($userId, $tab, $page=1, $pagesize=10)
{ {
$builder = OrderMain::query() $builder = OrderMain::query()
->select('id', 'global_order_id', 'money', 'state', 'market_id', 'created_at')
->with(['orderGoods' => function($query) {
$query->select(['lanzu_order_goods.id', 'lanzu_order_goods.name', 'lanzu_order_goods.cover_img']);
}])
->with(['market' => function($query) {
$query->select(['lanzu_market.id', 'lanzu_market.name', 'lanzu_market.tel']);
}])
->with(['orderGoods', 'market'])
->where([ ->where([
['user_id','=',$userId], ['user_id','=',$userId],
['type','=',1] ['type','=',1]

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

@ -21,7 +21,7 @@ class SearchService implements \App\Service\v3\Interfaces\SearchServiceInterface
->where('inventory', '>', 0); ->where('inventory', '>', 0);
if (isset($params['type_id']) && $params['type_id']) { if (isset($params['type_id']) && $params['type_id']) {
$builder->where(['goods_type_id' => $params['type_id']]);
$builder->where(['category_id' => $params['type_id']]);
} }
if (isset($params['keyword']) && $params['keyword']) { if (isset($params['keyword']) && $params['keyword']) {
@ -73,7 +73,7 @@ class SearchService implements \App\Service\v3\Interfaces\SearchServiceInterface
} }
if (isset($params['type_id']) && $params['type_id']) { if (isset($params['type_id']) && $params['type_id']) {
$builder->where(['store_type_id' => $params['type_id']]);
$builder->where(['category_id' => $params['type_id']]);
} }
if (isset($params['keyword']) && $params['keyword']) { if (isset($params['keyword']) && $params['keyword']) {

Loading…
Cancel
Save