You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.8 KiB
68 lines
1.8 KiB
<?php
|
|
|
|
namespace App\Controller\v3;
|
|
|
|
use App\Controller\BaseController;
|
|
use App\Request\v3\OrderOfflineRequest;
|
|
use App\Request\v3\OrderOnlineRequest;
|
|
use App\Service\v3\Interfaces\OrderOfflineServiceInterface;
|
|
use App\Service\v3\Interfaces\StoreServiceInterface;
|
|
use Hyperf\Validation\ValidationException;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
class OrderOfflineController extends BaseController
|
|
{
|
|
/**
|
|
* @Inject
|
|
* @var StoreServiceInterface
|
|
*/
|
|
protected $storeService;
|
|
|
|
/**
|
|
* @Inject
|
|
* @var OrderOfflineServiceInterface
|
|
*/
|
|
protected $orderOfflineService;
|
|
|
|
/**
|
|
* 当面付的页面详情
|
|
* 1、上传store_id,获取商户相关信息
|
|
* 2、返回商户相关信息即可
|
|
*/
|
|
public function review()
|
|
{
|
|
$validator = $this->validationFactory->make(
|
|
$this->request->all(),
|
|
['store_id' => 'required|nonempty'],
|
|
['*.*' => '商户ID参数异常']
|
|
);
|
|
|
|
if ($validator->fails()) {
|
|
throw new ValidationException($validator);
|
|
}
|
|
|
|
$params = $validator->validated();
|
|
$store = $this->storeService->detail($params['store_id']);
|
|
return $this->success(['store' => $store]);
|
|
}
|
|
|
|
/**
|
|
* 当面付下单支付
|
|
* 1、用户id、去商户id下支付、支付的金额
|
|
* 2、下单同时支付,下发支付参数
|
|
* @param OrderOfflineRequest $request
|
|
* @return ResponseInterface
|
|
*/
|
|
public function add(OrderOfflineRequest $request)
|
|
{
|
|
$params = $request->validated();
|
|
$data = $this->orderOfflineService->do(
|
|
$params['store_id'],
|
|
$params['user_id'],
|
|
$params['money'],
|
|
$params['plat']
|
|
);
|
|
return $this->success(['data' => $data]);
|
|
}
|
|
}
|