mirror of
https://gitee.com/niucloud-team/niucloud
synced 2026-08-13 07:55:41 +08:00
update code
This commit is contained in:
@@ -13,6 +13,10 @@ namespace app\api\controller\pay;
|
||||
|
||||
use app\service\api\pay\PayService;
|
||||
use core\base\BaseApiController;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\Response;
|
||||
|
||||
/**
|
||||
* 微信服务端通信以及网页授权
|
||||
@@ -22,7 +26,7 @@ class Pay extends BaseApiController
|
||||
|
||||
/**
|
||||
* 接收消息并推送
|
||||
* @return void
|
||||
* @return void|null
|
||||
*/
|
||||
public function notify($site_id, $channel, $type, $action)
|
||||
{
|
||||
@@ -31,26 +35,39 @@ class Pay extends BaseApiController
|
||||
|
||||
/**
|
||||
* 去支付
|
||||
* @return \think\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function pay()
|
||||
{
|
||||
|
||||
$data = $this->request->params([
|
||||
['type', ''],
|
||||
['out_trade_no', ''],
|
||||
// ['out_trade_no', ''],
|
||||
['trade_type', ''],//业务类型
|
||||
['trade_id', ''],//业务id
|
||||
['quit_url', ''],
|
||||
['buyer_id', ''],
|
||||
['return_url', '']
|
||||
['return_url', ''],
|
||||
['voucher', '']
|
||||
]);
|
||||
|
||||
return success('SUCCESS',(new PayService())->pay($data['type'], $data['out_trade_no'], $data['return_url'], $data['quit_url'], $data['buyer_id']));
|
||||
return success('SUCCESS',(new PayService())->pay($data['type'], $data['trade_type'], $data['trade_id'], $data['return_url'], $data['quit_url'], $data['buyer_id'], $data['voucher']));
|
||||
}
|
||||
|
||||
public function info($out_trade_no)
|
||||
public function info($trade_type, $trade_id)
|
||||
{
|
||||
return success((new PayService())->getInfoByTrade($trade_type, $trade_id));
|
||||
}
|
||||
|
||||
return success((new PayService())->getInfoByOutTradeNo($out_trade_no));
|
||||
|
||||
/**
|
||||
* 获取可用的支付方法
|
||||
* @param $trade_type
|
||||
* @return Response
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function getPayType($trade_type){
|
||||
return success((new PayService())->getPayTypeByTrade($trade_type));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user