|
|
|
<?php
|
|
|
|
declare (strict_types=1);
|
|
|
|
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
|
|
use cores\exception\BaseException;
|
|
|
|
use think\db\exception\DataNotFoundException;
|
|
|
|
use think\db\exception\DbException;
|
|
|
|
use think\db\exception\ModelNotFoundException;
|
|
|
|
use think\response\Json;
|
|
|
|
|
|
|
|
class Identity extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @notes:会员身份价格列表
|
|
|
|
* @return Json
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
* @throws DbException
|
|
|
|
* @throws ModelNotFoundException|BaseException
|
|
|
|
* @author: wanghousheng
|
|
|
|
*/
|
|
|
|
public function userPriceList(): Json
|
|
|
|
{
|
|
|
|
$client = $this->request->post('client');
|
|
|
|
$model = new \app\api\service\Identity();
|
|
|
|
$list = $model->userCenter($client);
|
|
|
|
return $this->renderSuccess(compact('list'));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @notes:分销身份价格列表
|
|
|
|
* @return Json
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
* @throws DbException
|
|
|
|
* @throws ModelNotFoundException|BaseException
|
|
|
|
* @author: wanghousheng
|
|
|
|
*/
|
|
|
|
public function dealerPriceList(): Json
|
|
|
|
{
|
|
|
|
$client = $this->request->post('client');
|
|
|
|
$model = new \app\api\service\Identity();
|
|
|
|
$list = $model->dealerCenter($client);
|
|
|
|
return $this->renderSuccess(compact('list'));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 确认充值订单
|
|
|
|
* @return Json
|
|
|
|
* @throws BaseException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
* @throws DbException
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
*/
|
|
|
|
public function submit(): Json
|
|
|
|
{
|
|
|
|
$data = $this->postForm();
|
|
|
|
$service = new \app\api\service\Identity();
|
|
|
|
$data = $service->setMethod($data['method'])
|
|
|
|
->setClient($data['client'])
|
|
|
|
->orderPay($data['identity_id'], $data['extra']);
|
|
|
|
return $this->renderSuccess($data, $service->getMessage() ?: '下单成功');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 交易查询
|
|
|
|
* @param string $outTradeNo 商户订单号
|
|
|
|
* @param string $method 支付方式
|
|
|
|
* @param string $client 指定的客户端
|
|
|
|
* @return Json
|
|
|
|
* @throws BaseException
|
|
|
|
* @throws DataNotFoundException
|
|
|
|
* @throws DbException
|
|
|
|
* @throws ModelNotFoundException
|
|
|
|
*/
|
|
|
|
public function tradeQuery(string $outTradeNo, string $method, string $client): Json
|
|
|
|
{
|
|
|
|
$service = new \app\api\service\Identity();
|
|
|
|
$result = $service->setMethod($method)->setClient($client)->tradeQuery($outTradeNo);
|
|
|
|
$message = $result ? '恭喜您,开通成功' : ($service->getError() ?: '很抱歉,订单未支付,请重新发起');
|
|
|
|
return $this->renderSuccess(['isPay' => $result], $message);
|
|
|
|
}
|
|
|
|
}
|