作者 潘浩文
1 个管道 的构建 通过 耗费 0 秒

XIAOPAN

... ... @@ -456,13 +456,21 @@ class UsersController extends HomeBaseController{
$user=Db::name('users')->where('id',$user_id)->find();
if ($user['fee']>=$fee) {
$order_sn=cmf_get_order_sn();
Db::name('users')->setDec('fee', $fee);
Db::startTrans();
try{
Db::name('users')->where('id',$user_id)->setDec('fee', $fee);
Db::name('withdraw')->insert([
'user_id'=>$user_id,
'money'=>$fee,
'create_time'=>time(),
'order_sn'=>$order_sn
]);
Db::commit();
}catch (\Exception $e) {
// 回滚事务
Db::rollback();
$this->apiResponse(301,'提现失败');
}
$app = new Application($this->options);
$merchantPay = $app->merchant_pay;
$merchantPayData = [
... ...