...
|
...
|
@@ -139,9 +139,9 @@ class Wxpay extends Api |
|
|
$porderModel = new Porder();
|
|
|
$porderModel->where(['pay_order_sn'=>$data['out_trade_no']])->update(['status'=>$this->order_status[1]]);
|
|
|
//下面这句必须要执行,且在此之前不能有任何输出
|
|
|
echo $pay->success();
|
|
|
$this->success('成功',$pay->success());
|
|
|
}
|
|
|
return;
|
|
|
$this->success();
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -156,10 +156,23 @@ class Wxpay extends Api |
|
|
$this->success("恭喜你!支付成功!");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (充值)
|
|
|
* @ApiSummary (充值)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/wxpay/toPay)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="o_id", type="integer", required=true, description="订单id")
|
|
|
* @ApiReturn ({
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1554184134",
|
|
|
"data": null
|
|
|
})
|
|
|
*/
|
|
|
public function payCharge(){
|
|
|
if($this->request->isPost()){
|
|
|
$amount = $this->request->request('amount');
|
|
|
$amount = $this->request->post('amount');
|
|
|
$openid = $this->request->post('openid');//小程序传递openid
|
|
|
if(empty($openid)){
|
|
|
$this->error("openid必填");
|
...
|
...
|
@@ -173,7 +186,6 @@ class Wxpay extends Api |
|
|
$order = [
|
|
|
'out_trade_no' => $pay_order_sn,//支付订单号
|
|
|
'body' => '广西小纸皮再生资源回收有限公司',
|
|
|
// 'total_fee' => 1,
|
|
|
'total_fee' => floatval($amount)*100,//单位:分
|
|
|
'openid' => $openid,
|
|
|
'notify_url' => url('api/Wxpay/notifyCharge','','',true),
|
...
|
...
|
@@ -203,11 +215,11 @@ class Wxpay extends Api |
|
|
$money = $data['total_fee']/100;
|
|
|
$account = $accountModel::create(['uid'=>$user['id'],'type'=>config('site.pay_charge'),'money'=>$money]);
|
|
|
$messageModel = new Message();
|
|
|
$messageModel::create(['aid'=>$account->id,'title'=>config('site.message')]);
|
|
|
$messageModel::create(['account_id'=>$account->id,'title'=>config('site.message')]);
|
|
|
//下面这句必须要执行,且在此之前不能有任何输出
|
|
|
echo $pay->success();
|
|
|
$this->success('成功',$pay->success());
|
|
|
}
|
|
|
return;
|
|
|
$this->success();
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|