diff --git a/app/Constants/v3/ErrorCode.php b/app/Constants/v3/ErrorCode.php index 0c0a765..e2f7875 100644 --- a/app/Constants/v3/ErrorCode.php +++ b/app/Constants/v3/ErrorCode.php @@ -144,6 +144,12 @@ class ErrorCode extends AbstractConstants */ const STORE_NOT_AVAILABLE = 708; + /** + * 商户已休息 + * @Message("当前商户已歇业") + */ + const STORE_REST = 709; + /************************************/ /* 定位相关 751-800 */ /************************************/ @@ -242,6 +248,12 @@ class ErrorCode extends AbstractConstants */ const GOODS_ACTIVITY_CANNOT_USE_COUPON = 1156; + /** + * 活动商品不存在 + * @Message("商品不存在") + */ + const GOODS_ACTIVITY_NOT_EXISTS = 1156; + /************************************/ /* 优惠券相关 1201-1250 */ /************************************/ diff --git a/app/Controller/v3/GoodsRecommendController.php b/app/Controller/v3/GoodsRecommendController.php index 95ee76d..59a1325 100644 --- a/app/Controller/v3/GoodsRecommendController.php +++ b/app/Controller/v3/GoodsRecommendController.php @@ -28,7 +28,11 @@ class GoodsRecommendController extends BaseController $page = $this->request->input('page', 1); $pagesize = $this->request->input('pagesize', 10); - $builder = Goods::query()->with('store')->where('market_id', $marketId); + $builder = Goods::query()->with('store') + ->where('market_id', $marketId) + ->where(function ($query) { + $query->where('inventory', '>', 0)->orWhere('is_infinite', '=', 1); + }); switch ($tab) { case Tabs::APPLET_INDEX_RECOMMEND: @@ -67,6 +71,9 @@ class GoodsRecommendController extends BaseController $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(); diff --git a/app/Controller/v3/NotifyController.php b/app/Controller/v3/NotifyController.php index 126564b..35b6199 100644 --- a/app/Controller/v3/NotifyController.php +++ b/app/Controller/v3/NotifyController.php @@ -323,8 +323,7 @@ class NotifyController extends BaseController // 查询订单 $orderMain = OrderMain::query() ->whereIn('state', [OrderState::PAID, OrderState::DELIVERY, OrderState::COMPLETED, OrderState::EVALUATED, OrderState::REFUNDING]) - ->where(['global_order_id' => $message['global_order_id'], 'pay_type' => Payment::WECHAT]) - ->whereRaw('refund_time is null') + ->where(['global_order_id' => $message['global_order_id'], 'pay_type' => Payment::WECHAT, 'refund_time' => 0]) ->first(); // 订单不存在 diff --git a/app/JsonRpc/BadgeService.php b/app/JsonRpc/BadgeService.php new file mode 100644 index 0000000..7a5ad33 --- /dev/null +++ b/app/JsonRpc/BadgeService.php @@ -0,0 +1,26 @@ +badgeService->doByOrder($userId, $storeIds, $globalOrderId, $orderState); + + } +} \ No newline at end of file diff --git a/app/JsonRpc/BadgeServiceInterface.php b/app/JsonRpc/BadgeServiceInterface.php new file mode 100644 index 0000000..a7d85ce --- /dev/null +++ b/app/JsonRpc/BadgeServiceInterface.php @@ -0,0 +1,10 @@ +request->user->id ?? 0; - return $userId ? (integer)$this->shopCartService->check($userId, $this->id,1) : 0; + return 0; } public function getIsEffectiveAttribute() @@ -134,8 +133,4 @@ class Goods extends Model return $this->morphMany(ShoppingCart::class, 'goods'); } - public function getNameAttribute() - { - return $this->attributes['name'].' '.$this->attributes['goods_unit']; - } } \ No newline at end of file diff --git a/app/Model/v3/GoodsActivity.php b/app/Model/v3/GoodsActivity.php index f6050e3..bb78d70 100644 --- a/app/Model/v3/GoodsActivity.php +++ b/app/Model/v3/GoodsActivity.php @@ -2,7 +2,6 @@ namespace App\Model\v3; -use App\Constants\v3\Goods; use App\Constants\v3\Goods as GoodsConstants; use App\Constants\v3\SsdbKeys; use App\Model\Model; @@ -69,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,Goods::IS_ACTIVITY) : 0; + return 0; } public function getIsEffectiveAttribute() @@ -112,9 +110,4 @@ class GoodsActivity extends Model return $img_host . $item; }); } - - public function getNameAttribute() - { - return $this->attributes['name'].' '.$this->attributes['goods_unit']; - } } \ No newline at end of file diff --git a/app/Service/v3/Implementations/BannerService.php b/app/Service/v3/Implementations/BannerService.php index 05d30bd..cc340b1 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/app/Service/v3/Implementations/GoodsActivityService.php b/app/Service/v3/Implementations/GoodsActivityService.php index 9c5dc44..91370ad 100644 --- a/app/Service/v3/Implementations/GoodsActivityService.php +++ b/app/Service/v3/Implementations/GoodsActivityService.php @@ -24,7 +24,7 @@ class GoodsActivityService implements GoodsActivityServiceInterface { if (empty($goods)) { - return ErrorCode::GOODS_ACTIVITY_ON_SALE_NO; + return ErrorCode::GOODS_ACTIVITY_NOT_EXISTS; } // 活动是否已经结束 @@ -34,7 +34,7 @@ class GoodsActivityService implements GoodsActivityServiceInterface // 商户歇业 if($goods->store->is_rest == 1){ - return ErrorCode::GOODS_ACTIVITY_ON_SALE_NO; + return ErrorCode::STORE_REST; } // 商品下架或已删除 diff --git a/app/Service/v3/Implementations/GoodsService.php b/app/Service/v3/Implementations/GoodsService.php index ebe9eaa..f5f0026 100644 --- a/app/Service/v3/Implementations/GoodsService.php +++ b/app/Service/v3/Implementations/GoodsService.php @@ -21,12 +21,12 @@ class GoodsService implements GoodsServiceInterface { if (empty($goods)) { - return ErrorCode::GOODS_ON_SALE_NO; + return ErrorCode::GOODS_NOT_EXISTS; } // 商户歇业 if($goods->store->is_rest == 1){ - return ErrorCode::GOODS_ON_SALE_NO; + return ErrorCode::STORE_REST; } // 商品下架或已删除 if($goods->on_sale == 0 || !is_null($goods->deleted_at)){ diff --git a/app/Service/v3/Implementations/SearchService.php b/app/Service/v3/Implementations/SearchService.php index 6b6a0b1..ca609bd 100644 --- a/app/Service/v3/Implementations/SearchService.php +++ b/app/Service/v3/Implementations/SearchService.php @@ -19,7 +19,9 @@ class SearchService implements \App\Service\v3\Interfaces\SearchServiceInterface return $query->select(['id', 'logo', 'name']); }]) ->where(['market_id' => $params['market_id']]) - ->where('inventory', '>', 0); + ->where(function ($query) { + $query->where('inventory', '>', 0)->orWhere('is_infinite', '=', 1); + });; if (isset($params['type_id']) && $params['type_id']) { $typeIds = explode(',', $params['type_id']); diff --git a/config/autoload/dependencies.php b/config/autoload/dependencies.php index dd35d70..78a78a6 100644 --- a/config/autoload/dependencies.php +++ b/config/autoload/dependencies.php @@ -81,6 +81,7 @@ return [ \App\Service\v3\Interfaces\AttachmentServiceInterface::class => \App\Service\v3\Implementations\AttachmentService::class, \App\JsonRpc\PrintServiceInterface::class => \App\JsonRpc\FeieService::class, \App\JsonRpc\LocationServiceInterface::class => \App\JsonRpc\LocationService::class, + \App\JsonRpc\BadgeServiceInterface::class => \App\JsonRpc\BadgeService::class, \App\Service\v3\Interfaces\OrderStatisticsServiceInterface::class => \App\Service\v3\Implementations\OrderStatisticsService::class, \App\Service\v3\Interfaces\UserRelationBindServiceInterface::class => \App\Service\v3\Implementations\UserCommunityBindService::class, \App\Service\v3\Interfaces\BadgeServiceInterface::class => \App\Service\v3\Implementations\BadgeService::class, 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]]); // 微信支付回调