...
|
...
|
@@ -605,18 +605,18 @@ class OrderController extends HomeBaseController{ |
|
|
// }
|
|
|
//余额支付
|
|
|
if ($user['fee']>=$order['price']){
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
// Db::startTrans();
|
|
|
// try {
|
|
|
Db::name('users')->where('id', $user['id'])->setDec('fee',$order['price']);
|
|
|
Db::name('order')->where('id',$order['id'])->update(['state'=>3]);
|
|
|
Db::name('fee_log')->insert(['user_id'=>$user['id'],'fee'=>$order['price'],'type'=>2,'add_time'=>time()]);
|
|
|
// 提交事务
|
|
|
Db::commit();
|
|
|
} catch (\Exception $e) {
|
|
|
// 回滚事务
|
|
|
Db::rollback();
|
|
|
$this->apiResponse(400,'余额支付失败');
|
|
|
}
|
|
|
// Db::commit();
|
|
|
// } catch (\Exception $e) {
|
|
|
// // 回滚事务
|
|
|
// Db::rollback();
|
|
|
// $this->apiResponse(400,'余额支付失败');
|
|
|
// }
|
|
|
$this->apiResponse(201, '余额支付成功');
|
|
|
}elseif ($user['fee']<$price){
|
|
|
Db::name('order')->where('id',$order['id'])->update(['group_money'=>($order['price']-$user['fee'])]);
|
...
|
...
|
|