From 02c8f55f5a108f018c446f025a1e940a629ac68e Mon Sep 17 00:00:00 2001 From: weigang Date: Sat, 12 Sep 2020 15:46:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5banner=E5=92=8C=E4=B8=93?= =?UTF-8?q?=E5=91=98=E8=AF=84=E4=BB=B7=E7=9A=84=E8=B7=AF=E7=94=B1=E7=A7=BB?= =?UTF-8?q?=E5=88=B0v3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/v3/HomeController.php | 1 + app/Model/v3/Goods.php | 3 +-- app/Model/v3/GoodsActivity.php | 3 +-- app/Service/v3/Implementations/BannerService.php | 10 +++++----- config/routes.php | 4 ++++ 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/Controller/v3/HomeController.php b/app/Controller/v3/HomeController.php index 0fa5ed9..aa17f78 100644 --- a/app/Controller/v3/HomeController.php +++ b/app/Controller/v3/HomeController.php @@ -120,6 +120,7 @@ class HomeController extends BaseController */ public function appletIndex() { + var_dump($this->request); $marketId = $this->request->input('market_id', -1); $banners = $this->bannerService->all(Banner::TYPE_APPLET_INDEX, $marketId); $categories = $this->categoryService->allForAppletIndex(); diff --git a/app/Model/v3/Goods.php b/app/Model/v3/Goods.php index c0718cb..c1f971c 100644 --- a/app/Model/v3/Goods.php +++ b/app/Model/v3/Goods.php @@ -100,8 +100,7 @@ class Goods extends Model public function getCartNumAttribute() { - $userId = $this->request->user->id ?? 0; - return $userId ? (integer)$this->shopCartService->check($userId, $this->id) : 0; + return 0; } public function getIsEffectiveAttribute() diff --git a/app/Model/v3/GoodsActivity.php b/app/Model/v3/GoodsActivity.php index e6b6887..bb78d70 100644 --- a/app/Model/v3/GoodsActivity.php +++ b/app/Model/v3/GoodsActivity.php @@ -68,8 +68,7 @@ class GoodsActivity extends Model public function getCartNumAttribute() { - $userId = $this->request->user->id ?? 0; - return $userId ? (integer)$this->shopCartService->check($userId, $this->id) : 0; + return 0; } public function getIsEffectiveAttribute() diff --git a/app/Service/v3/Implementations/BannerService.php b/app/Service/v3/Implementations/BannerService.php index 05d30bd..fc3083c 100644 --- a/app/Service/v3/Implementations/BannerService.php +++ b/app/Service/v3/Implementations/BannerService.php @@ -10,11 +10,11 @@ class BannerService implements BannerServiceInterface public function all($type, $marketId) { $builder = Banner::query() - ->where(['type' => $type]); - - if ($marketId != -1) { - $builder = $builder->whereJsonContains('market_ids', [(string)$marketId]); - } + ->where(['type' => $type]) + >where(function ($query) use ($marketId) { + $query->whereJsonContains('market_ids', [(string)$marketId]) + ->orWhereJsonLength('market_ids', '=', 0); + }); return $builder->get()->toArray(); } diff --git a/config/routes.php b/config/routes.php index 9a0a58e..120869d 100644 --- a/config/routes.php +++ b/config/routes.php @@ -141,6 +141,10 @@ Router::addGroup('/v3/', function () { Router::post('userAddress/getAddressAndDistributionPrice', 'App\Controller\v3\UserAddressController@getAddressAndDistributionPrice'); Router::post('withdraw/applyByStore', 'App\Controller\v3\WithdrawController@applyByStore'); Router::post('community/bind', 'App\Controller\v3\CommunityController@bind'); + Router::post('serviceEvaluate/evaluate', 'App\Controller\ServiceEvaluateController@evaluate'); + Router::post('serviceEvaluate/isPersonnel', 'App\Controller\ServiceEvaluateController@isPersonnel'); + Router::post('serviceEvaluate/getPersonnelInfo', 'App\Controller\ServiceEvaluateController@getPersonnelInfo'); + Router::post('serviceEvaluate/getEvaluateList', 'App\Controller\ServiceEvaluateController@getEvaluateList'); },['middleware' => [\App\Middleware\Auth\ApiMiddleware::class, \App\Middleware\Auth\UserMiddleware::class]]); // 微信支付回调