|
|
@@ -102,22 +102,13 @@ class User extends Backend
|
|
|
$result = false;
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
- $balance = build_amount_compute($params['type'], $params['amount'], $row->balance);
|
|
|
- //操作记录
|
|
|
- MoneyLog::create(['user_id'=> $params['id'],
|
|
|
- 'from_id'=> $this->auth->id,
|
|
|
- 'amount'=> $params['amount'],
|
|
|
- 'balance'=> $balance
|
|
|
- ]);
|
|
|
- $result = $row->allowField(true)->save(['balance'=>$balance]);
|
|
|
+ (new MoneyLog())->change($params['id'], $params['amount'], MoneyLog::SystemChange, $this->auth->id, '后台操作');
|
|
|
+
|
|
|
Db::commit();
|
|
|
} catch (ValidateException|PDOException|Exception $e) {
|
|
|
Db::rollback();
|
|
|
$this->error($e->getMessage());
|
|
|
}
|
|
|
- if (false === $result) {
|
|
|
- $this->error(__('No rows were updated'));
|
|
|
- }
|
|
|
$this->success();
|
|
|
}
|
|
|
|