...
|
...
|
@@ -483,7 +483,7 @@ class User extends Api |
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="is_custom", type="string", required=true, description="是否自定义:0=否,1=是")
|
|
|
* @ApiParams (name="gift_id", type="inter", required=false, description="礼物ID")
|
|
|
* @ApiParams (name="pay_price", type="float", required=false, description="自定义金额")
|
|
|
* @ApiParams (name="money", type="float", required=false, description="自定义金额")
|
|
|
* @ApiReturn({
|
|
|
"code": 1, //返回码:0=错误普通提示,1=成功,2=普通弹窗提示,3=跳转弹窗提示
|
|
|
"msg": "成功",
|
...
|
...
|
@@ -497,17 +497,18 @@ class User extends Api |
|
|
public function payGift(){
|
|
|
$is_custom = $this->request->post('is_custom');
|
|
|
$gift_id = $this->request->post('gift_id');
|
|
|
$pay_price = $this->request->post('pay_price');
|
|
|
$money = $this->request->post('money');
|
|
|
!isset($is_custom) && $this->error('缺少必需参数');
|
|
|
switch ($is_custom){
|
|
|
case '0':
|
|
|
empty($gift_id) && $this->error('请选择礼物');
|
|
|
$gift = Gift::get($gift_id);
|
|
|
empty($gift) && $this->error('礼物不存在');
|
|
|
$pay_price = $gift['price'];
|
|
|
$pay_fee = $gift['price'];
|
|
|
break;
|
|
|
case '1':
|
|
|
empty($pay_price) && $this->error('请填写自定义金额');
|
|
|
empty($money) && $this->error('请填写自定义金额');
|
|
|
$pay_fee = $money;
|
|
|
break;
|
|
|
default:
|
|
|
$this->error('参数不合法');
|
...
|
...
|
@@ -516,10 +517,10 @@ class User extends Api |
|
|
'user_id' => $this->auth->id,
|
|
|
'order_sn' => get_order_sn(),
|
|
|
'gift_id' => $is_custom == '0' ? $gift_id : 0,
|
|
|
'pay_price' => $pay_price,
|
|
|
'pay_fee' => $pay_fee,
|
|
|
]);
|
|
|
$payment = [];
|
|
|
if($pay_price <= 0){
|
|
|
if($pay_fee <= 0){
|
|
|
(new Notify())->notifyGiftZero([
|
|
|
'out_trade_no' => $order['order_sn'],
|
|
|
'transaction_id' => ''
|
...
|
...
|
@@ -528,7 +529,7 @@ class User extends Api |
|
|
// // 发起微信支付
|
|
|
// $Wechat = new Wechat;
|
|
|
// $openid = Db::name('third')->where('user_id',$this->auth->id)->value('openid');
|
|
|
// if(!$payment = $Wechat->wxPay($this->model['order_sn'], $openid, $pay_price)){
|
|
|
// if(!$payment = $Wechat->wxPay($this->model['order_sn'], $openid, $pay_fee)){
|
|
|
// $this->error($Wechat->getError());
|
|
|
// }
|
|
|
(new Notify())->notifyGiftZero([
|
...
|
...
|
|