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
b31c123c08
  1. 29
      app/Controller/v3/GoodsRecommendController.php
  2. 2
      app/Service/v3/Implementations/AppointmentTimeService.php
  3. 9
      app/Service/v3/Implementations/GoodsActivityService.php
  4. 9
      app/Service/v3/Implementations/GoodsService.php
  5. 8
      app/Service/v3/Implementations/SearchService.php
  6. 1
      config/config.php

29
app/Controller/v3/GoodsRecommendController.php

@ -52,17 +52,11 @@ class GoodsRecommendController extends BaseController
->where(function ($query) use ($goodsTable) { ->where(function ($query) use ($goodsTable) {
$query->where(''.$goodsTable.'.inventory', '>', 0)->orWhere(''.$goodsTable.'.is_infinite', '=', 1); $query->where(''.$goodsTable.'.inventory', '>', 0)->orWhere(''.$goodsTable.'.is_infinite', '=', 1);
}) })
->where('time1', '<=', date('H:i'))
/*->where('time1', '<=', date('H:i'))
->where(function ($query) { ->where(function ($query) {
$query->where('time2', '>=', date('H:i')) $query->where('time2', '>=', date('H:i'))
->orWhere('time4', '>=', date('H:i')); ->orWhere('time4', '>=', date('H:i'));
});
// $builder = Goods::query()->with('store')
// ->where('market_id', $marketId)
// ->where(function ($query) {
// $query->where('inventory', '>', 0)->orWhere('is_infinite', '=', 1);
// });
})*/;
switch ($tab) { switch ($tab) {
case Tabs::APPLET_INDEX_RECOMMEND: case Tabs::APPLET_INDEX_RECOMMEND:
@ -127,24 +121,15 @@ class GoodsRecommendController extends BaseController
->where(function ($query) use ($goodsTable) { ->where(function ($query) use ($goodsTable) {
$query->where(''.$goodsTable.'.inventory', '>', 0)->orWhere(''.$goodsTable.'.is_infinite', '=', 1); $query->where(''.$goodsTable.'.inventory', '>', 0)->orWhere(''.$goodsTable.'.is_infinite', '=', 1);
}) })
->where('time1', '<=', date('H:i'))
->where(function ($query) {
$query->where('time2', '>=', date('H:i'))
->orWhere('time4', '>=', date('H:i'));
})
// ->where('time1', '<=', date('H:i'))
// ->where(function ($query) {
// $query->where('time2', '>=', date('H:i'))
// ->orWhere('time4', '>=', date('H:i'));
// })
->inRandomOrder() ->inRandomOrder()
->limit(20) ->limit(20)
->get()->toArray(); ->get()->toArray();
// $goods = Goods::query()
// ->with(['store'])
// ->where('market_id', $marketId)
// ->where(function ($query) {
// $query->where('inventory', '>', 0)->orWhere('is_infinite', '=', 1);
// })
// ->inRandomOrder()
// ->limit(20)
// ->get()->toArray();
return $this->success(['has_more_pages' => false, 'tab_data' => $goods]); return $this->success(['has_more_pages' => false, 'tab_data' => $goods]);
} }

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

@ -44,7 +44,7 @@ class AppointmentTimeService implements AppointmentTimeServiceInterface
$nowTime = time(); $nowTime = time();
//服务站最晚营业时间 //服务站最晚营业时间
if (env('APP_ENV') === 'prod') { if (env('APP_ENV') === 'prod') {
$closedTime = strtotime('19:30');
$closedTime = strtotime(config('market_rest_time'));
if($nowTime > $closedTime){ if($nowTime > $closedTime){
throw new ErrorCodeException(ErrorCode::MARKET_REST); throw new ErrorCodeException(ErrorCode::MARKET_REST);
} }

9
app/Service/v3/Implementations/GoodsActivityService.php

@ -5,6 +5,7 @@ namespace App\Service\v3\Implementations;
use App\Constants\v3\ActivityType; use App\Constants\v3\ActivityType;
use App\Constants\v3\ErrorCode; use App\Constants\v3\ErrorCode;
use App\Constants\v3\SsdbKeys; use App\Constants\v3\SsdbKeys;
use App\Exception\ErrorCodeException;
use App\Service\v3\Interfaces\GoodsActivityServiceInterface; use App\Service\v3\Interfaces\GoodsActivityServiceInterface;
use App\TaskWorker\SSDBTask; use App\TaskWorker\SSDBTask;
use App\Constants\v3\Store; use App\Constants\v3\Store;
@ -59,6 +60,14 @@ class GoodsActivityService implements GoodsActivityServiceInterface
return ErrorCode::GOODS_ACTIVITY_BUY; return ErrorCode::GOODS_ACTIVITY_BUY;
} }
//服务站最晚营业时间
if (env('APP_ENV') === 'prod') {
$closedTime = strtotime(config('market_rest_time'));
if(time() > $closedTime){
throw new ErrorCodeException(ErrorCode::MARKET_REST);
}
}
return true; return true;
} }

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

@ -3,6 +3,7 @@
namespace App\Service\v3\Implementations; namespace App\Service\v3\Implementations;
use App\Constants\v3\ErrorCode; use App\Constants\v3\ErrorCode;
use App\Exception\ErrorCodeException;
use App\Service\v3\Interfaces\GoodsServiceInterface; use App\Service\v3\Interfaces\GoodsServiceInterface;
use Hyperf\DbConnection\Db; use Hyperf\DbConnection\Db;
use App\Model\v3\Goods; use App\Model\v3\Goods;
@ -42,6 +43,14 @@ class GoodsService implements GoodsServiceInterface
return ErrorCode::GOODS_RESTRICT_LIMIT; return ErrorCode::GOODS_RESTRICT_LIMIT;
} }
//服务站最晚营业时间
if (env('APP_ENV') === 'prod') {
$closedTime = strtotime(config('market_rest_time'));
if(time() > $closedTime){
throw new ErrorCodeException(ErrorCode::MARKET_REST);
}
}
return true; return true;
} }

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

@ -39,11 +39,11 @@ class SearchService implements SearchServiceInterface
->where(function ($query) use ($goodsTable) { ->where(function ($query) use ($goodsTable) {
$query->where(''.$goodsTable.'.inventory', '>', 0)->orWhere(''.$goodsTable.'.is_infinite', '=', 1); $query->where(''.$goodsTable.'.inventory', '>', 0)->orWhere(''.$goodsTable.'.is_infinite', '=', 1);
}) })
->where('time1', '<=', date('H:i'))
/*->where('time1', '<=', date('H:i'))
->where(function ($query) { ->where(function ($query) {
$query->where('time2', '>=', date('H:i')) $query->where('time2', '>=', date('H:i'))
->orWhere('time4', '>=', date('H:i')); ->orWhere('time4', '>=', date('H:i'));
});
})*/;
if (isset($params['store_id']) && $params['store_id']) { if (isset($params['store_id']) && $params['store_id']) {
$builder->where([''.$goodsTable.'.store_id' => $params['store_id']]); $builder->where([''.$goodsTable.'.store_id' => $params['store_id']]);
@ -108,11 +108,11 @@ class SearchService implements SearchServiceInterface
}) })
->whereRaw(''.$goodsTable.'.deleted_at IS NULL') ->whereRaw(''.$goodsTable.'.deleted_at IS NULL')
->where([''.$storeTable.'.market_id' => $params['market_id']]) ->where([''.$storeTable.'.market_id' => $params['market_id']])
->where('time1', '<=', date('H:i'))
/*->where('time1', '<=', date('H:i'))
->where(function ($query) { ->where(function ($query) {
$query->where('time2', '>=', date('H:i')) $query->where('time2', '>=', date('H:i'))
->orWhere('time4', '>=', date('H:i')); ->orWhere('time4', '>=', date('H:i'));
});
})*/;
if (isset($params['store_id']) && $params['store_id']) { if (isset($params['store_id']) && $params['store_id']) {
$builder->where([''.$storeTable.'.store_id' => $params['store_id']]); $builder->where([''.$storeTable.'.store_id' => $params['store_id']]);

1
config/config.php

@ -55,6 +55,7 @@ return [
'login' => [ 'login' => [
'authkey' => env('STORE_LOGIN_AUTHKEY', ''), 'authkey' => env('STORE_LOGIN_AUTHKEY', ''),
], ],
'market_rest_time' => env('MARKET_REST_TIME', '19:30'),
'map' => [ 'map' => [
'tencent' => env('TENCENT_MAP_KEY', ''), 'tencent' => env('TENCENT_MAP_KEY', ''),
], ],

Loading…
Cancel
Save