Browse Source

首页banner和专员评价的路由移到v3

master
weigang 5 years ago
parent
commit
02c8f55f5a
  1. 1
      app/Controller/v3/HomeController.php
  2. 3
      app/Model/v3/Goods.php
  3. 3
      app/Model/v3/GoodsActivity.php
  4. 10
      app/Service/v3/Implementations/BannerService.php
  5. 4
      config/routes.php

1
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();

3
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()

3
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()

10
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();
}

4
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]]);
// 微信支付回调

Loading…
Cancel
Save