作者 刘朕
1 个管道 的构建 通过 耗费 1 秒

合并分支 'Branch_liuzhen' 到 'master'

提现优化



查看合并请求 !261
... ... @@ -1507,8 +1507,6 @@ class Store extends Api
'money' => $param['money'],
];
$result = $withdraw_model->isUpdate(false)->save($withdraw);
// 记录用户余额
$result_user = $user_model->isUpdate(true)->save(['id'=>$this->auth->id,'score' => $user['score'] - $param['money'] * $withdraw_percent]);
// 记录余额变更
$insert_data = array(
'user_id' => $this->auth->id,
... ... @@ -1520,6 +1518,8 @@ class Store extends Api
'memo' => '提现',
);
$res_log = Db::name('user_score_log')->insert($insert_data);
// 记录用户余额
$result_user = $user_model->isUpdate(true)->save(['id'=>$this->auth->id,'score' => $user['score'] - $param['money'] * $withdraw_percent]);
if (!$result || !$result_user || !$res_log) {
Db::rollback();
$this->error('提现申请失败', [$result, $result_user]);
... ...