作者 Cool
1 个管道 的构建 通过 耗费 0 秒

充值调试

... ... @@ -1058,32 +1058,27 @@ class Store extends Api
$deposit = $this->deposit_model->findOrFail(['id'=>$param['deposit_id']]);
$order_sn = $param['order_sn'] = get_order_sn();
$pay_data = [];
if($this->auth->end_time > time()) {
$param['status'] = 2;
// 获取小程序配置
$options = \config('miniprogram.basic');
$app = new Application($options);
$payment = $app->payment;
// 获取支付参数
$attributes = [
'body' => '板币充值',
'out_trade_no' => $order_sn,
'total_fee' => 1, // $param['money'] * 100
'spbill_create_ip' => request()->ip(), // 可选,如不传该参数,SDK 将会自动获取相应 IP 地址
'notify_url' => url('index/ajax/notify',[],true,true), // 支付结果通知网址,如果不设置则会使用配置里的默认地址
'trade_type' => 'JSAPI', // 请对应换成你的支付方式对应的值类型
'openid' => Db::name('third')->where('user_id',$this->auth->id)->value('openid'),
];
$order = new Order($attributes);
$order_result = $payment->pay($order);
if($order_result['return_code'] == 'SUCCESS' && $order_result['result_code'] == 'SUCCESS') {
$prepayId = $order_result->prepay_id;
$pay_data = $payment->configForJSSDKPayment($prepayId); // 返回数组
} else {
$param['status'] = 1;
// 获取小程序配置
$options = \config('miniprogram.basic');
$app = new Application($options);
$payment = $app->payment;
// 获取支付参数
$attributes = [
'body' => '板币充值',
'out_trade_no' => $order_sn,
'total_fee' => 1, // $param['money'] * 100
'spbill_create_ip' => request()->ip(), // 可选,如不传该参数,SDK 将会自动获取相应 IP 地址
'notify_url' => url('index/ajax/notify',[],true,true), // 支付结果通知网址,如果不设置则会使用配置里的默认地址
'trade_type' => 'JSAPI', // 请对应换成你的支付方式对应的值类型
'openid' => Db::name('third')->where('user_id',$this->auth->id)->value('openid'),
];
$order = new Order($attributes);
$order_result = $payment->pay($order);
if($order_result['return_code'] == 'SUCCESS' && $order_result['result_code'] == 'SUCCESS') {
$prepayId = $order_result->prepay_id;
$pay_data = $payment->configForJSSDKPayment($prepayId); // 返回数组
} else {
$this->error($order_result['return_msg']);
}
$this->error($order_result['return_msg']);
}
$model = $this->deposit_order_model;
Db::startTrans();
... ...