Browse Source

关于懒族,下单清空购物车

master
weigang 5 years ago
parent
commit
d5ce0b2021
  1. 26
      app/Controller/v3/HomeController.php
  2. 10
      app/Service/v3/Implementations/OrderOnlineService.php
  3. 10
      app/Service/v3/Implementations/ShopCartUpdateService.php
  4. 2
      app/Service/v3/Interfaces/ShopCartUpdateServiceInterface.php
  5. 1
      config/routes.php

26
app/Controller/v3/HomeController.php

@ -173,4 +173,30 @@ class HomeController extends BaseController
return $this->success($data);
}
/**
* 关于懒族
* about lanzu
*/
public function aboutLanzu()
{
$data = [
[
'id' => 1,
'title' => '关于懒族',
'sub_title' => '懒族生活678',
'path' => 'https://www.baidu.com/s?wd=%E6%87%92%E6%97%8F%E7%94%9F%E6%B4%BB',
'path_type' => 'webview'
],
[
'id' => 1,
'title' => '隐私政策',
'sub_title' => '隐私政策123',
'path' => 'https://www.baidu.com/s?wd=%E9%9A%90%E7%A7%81%E6%94%BF%E7%AD%96',
'path_type' => 'webview'
]
];
return $this->success(['data' => $data]);
}
}

10
app/Service/v3/Implementations/OrderOnlineService.php

@ -28,6 +28,7 @@ use App\Service\v3\Interfaces\DeliveryMoneyServiceInterface;
use App\Service\v3\Interfaces\GoodsActivityServiceInterface;
use App\Service\v3\Interfaces\GoodsServiceInterface;
use App\Service\v3\Interfaces\PaymentServiceInterface;
use App\Service\v3\Interfaces\ShopCartUpdateServiceInterface;
use App\TaskWorker\SSDBTask;
use Exception;
use Hyperf\Database\Model\Model;
@ -82,6 +83,12 @@ class OrderOnlineService implements OrderOnlineServiceInterface
*/
protected $paymentService;
/**
* @Inject
* @var ShopCartUpdateServiceInterface
*/
protected $shopCartUpdateService;
/**
* 下单
* @param $marketId
@ -320,6 +327,9 @@ class OrderOnlineService implements OrderOnlineServiceInterface
Db::commit();
// 清除购物车
$this->shopCartUpdateService->doClear($userId, $marketId);
// 支付
return $this->paymentService->do($globalOrderId, $totalAmount, $userId, config('wechat.notify_url.online'));
} catch (Exception $e) {

10
app/Service/v3/Implementations/ShopCartUpdateService.php

@ -46,4 +46,14 @@ class ShopCartUpdateService implements ShopCartUpdateServiceInterface
{
return true;
}
/**
* 清空购物车
* @param $userId
* @param $marketId
*/
public function doClear($userId, $marketId)
{
}
}

2
app/Service/v3/Interfaces/ShopCartUpdateServiceInterface.php

@ -9,4 +9,6 @@ interface ShopCartUpdateServiceInterface
public function check();
public function undo($params);
public function doClear($userId, $marketId);
}

1
config/routes.php

@ -92,6 +92,7 @@ Router::addGroup('/v3/', function () {
Router::post('store/index', 'App\Controller\v3\StoreController@index');
Router::post('Search/market', 'App\Controller\v3\SearchController@market');
Router::post('market/services', 'App\Controller\v3\LocationController@getMarketsInfo');
Router::post('home/aboutLanzu', 'App\Controller\v3\HomeController@aboutLanzu');
},['middleware' => [\App\Middleware\Auth\ApiMiddleware::class]]);
// 需要登录的路由

Loading…
Cancel
Save