Browse Source

Merge branch 'phoenix' of http://120.24.33.109:11081/hyzjshwo/lanzu_api_hyperf into phoenix

master
Lemon 5 years ago
parent
commit
6faefb1f34
  1. 2
      app/Controller/v3/GoodsRecommendController.php
  2. 5
      app/Model/v3/Goods.php
  3. 5
      app/Model/v3/GoodsActivity.php
  4. 4
      app/Service/v3/Implementations/BadgeService.php
  5. 2
      app/Service/v3/Implementations/OrderListService.php

2
app/Controller/v3/GoodsRecommendController.php

@ -100,6 +100,8 @@ class GoodsRecommendController extends BaseController
$goodsTable = ApplicationContext::getContainer()->get(Goods::class)->getTable(); $goodsTable = ApplicationContext::getContainer()->get(Goods::class)->getTable();
$goods = Goods::query() $goods = Goods::query()
->select(''.$goodsTable.'.*')
->addSelect(''.$goodsTable.'.sales as total_sales')
->join($storeTable,''.$storeTable.'.id', '=', ''.$goodsTable.'.store_id') ->join($storeTable,''.$storeTable.'.id', '=', ''.$goodsTable.'.store_id')
->where([ ->where([
''.$storeTable.'.is_open' => StoreConstants::IS_OPEN_YES, ''.$storeTable.'.is_open' => StoreConstants::IS_OPEN_YES,

5
app/Model/v3/Goods.php

@ -125,6 +125,11 @@ class Goods extends Model
}); });
} }
public function getNameAttribute($value)
{
return $value . ' ' . $this->attributes['goods_unit'];
}
public function store() public function store()
{ {
return $this->belongsTo(Store::class, 'store_id', 'id'); return $this->belongsTo(Store::class, 'store_id', 'id');

5
app/Model/v3/GoodsActivity.php

@ -94,6 +94,11 @@ class GoodsActivity extends Model
return $this->attachmentService->switchImgToAliOss($value, OssThumbnail::THUMBNAIL_600_Q90); return $this->attachmentService->switchImgToAliOss($value, OssThumbnail::THUMBNAIL_600_Q90);
} }
public function getNameAttribute($value)
{
return $value . ' ' . $this->attributes['goods_unit'];
}
public function store() public function store()
{ {
return $this->belongsTo(Store::class, 'store_id', 'id'); return $this->belongsTo(Store::class, 'store_id', 'id');

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

@ -96,7 +96,7 @@ class BadgeService implements BadgeServiceInterface
return [ return [
'paid' => count($redis->sMembers('badge_paid_store_'.$storeId)), 'paid' => count($redis->sMembers('badge_paid_store_'.$storeId)),
'delivery' => count($redis->sMembers('badge_delivery_store_'.$storeId)), 'delivery' => count($redis->sMembers('badge_delivery_store_'.$storeId)),
'finish' => count($redis->sMembers('badge_canceled_store_'.$storeId)),
'finish' => count($redis->sMembers('badge_finish_store_'.$storeId)),
'refund' => count($redis->sMembers('badge_refund_store_'.$storeId)), 'refund' => count($redis->sMembers('badge_refund_store_'.$storeId)),
'canceled' => count($redis->sMembers('badge_canceled_store_'.$storeId)), 'canceled' => count($redis->sMembers('badge_canceled_store_'.$storeId)),
'rejection' => count($redis->sMembers('badge_rejection_store_'.$storeId)), 'rejection' => count($redis->sMembers('badge_rejection_store_'.$storeId)),
@ -155,7 +155,7 @@ class BadgeService implements BadgeServiceInterface
* @inheritDoc * @inheritDoc
*/ */
public function clearStoreOrder($storeId, $badge = 'all') public function clearStoreOrder($storeId, $badge = 'all')
{
{var_dump('badge_'.$badge.'_store_'.$storeId);
$redis = ApplicationContext::getContainer()->get(Redis::class); $redis = ApplicationContext::getContainer()->get(Redis::class);
if ($badge == 'all') { if ($badge == 'all') {
$redis->del('badge_paid_store_'.$storeId); # 移除商户待付款 $redis->del('badge_paid_store_'.$storeId); # 移除商户待付款

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

@ -149,7 +149,7 @@ class OrderListService implements OrderListServiceInterface
->with('user'); ->with('user');
if(!empty($start_time) && !empty($end_time)){ if(!empty($start_time) && !empty($end_time)){
$builder->whereBetween('lanzu_order_main.created_at',[strtotime($start_time.' 23:59:59'),strtotime($end_time.' 23:59:59')]);
$builder->whereBetween('lanzu_order_main.created_at',[strtotime($start_time.' 00:00:00'),strtotime($end_time.' 23:59:59')]);
} }
$paginate = $builder->orderBy('lanzu_order_main.created_at', 'desc')->paginate($pagesize); $paginate = $builder->orderBy('lanzu_order_main.created_at', 'desc')->paginate($pagesize);

Loading…
Cancel
Save