|
|
@@ -4,6 +4,7 @@ namespace app\admin\controller\trade;
|
|
|
|
|
|
use think\Db;
|
|
|
use Exception;
|
|
|
+use app\common\model\MoneyLog;
|
|
|
use think\exception\DbException;
|
|
|
use think\exception\PDOException;
|
|
|
use app\common\controller\Backend;
|
|
|
@@ -83,9 +84,22 @@ class MoneyOut extends Backend
|
|
|
$this->error(__('No Results were found'));
|
|
|
}
|
|
|
$result = false;
|
|
|
+ Db::startTrans();
|
|
|
try {
|
|
|
+
|
|
|
+ //余额变动
|
|
|
+ $amount = $row->amount;
|
|
|
+ $action = MoneyLog::Reject;
|
|
|
+ if($status == $this->model::Success){
|
|
|
+ $amount = $row->real_amount;
|
|
|
+ $action = MoneyLog::Withdraw;
|
|
|
+ }
|
|
|
+ $action = $status == $this->model::Success? MoneyLog::Withdraw :MoneyLog::Reject;
|
|
|
+ (new MoneyLog())->change($row->user_id, $amount, $action, $row->user_id, '提现');
|
|
|
$result = $row->allowField(true)->save(['status'=>$status]);
|
|
|
+ Db::commit();
|
|
|
} catch (ValidateException|PDOException|Exception $e) {
|
|
|
+ Db::rollback();
|
|
|
$this->error($e->getMessage());
|
|
|
}
|
|
|
if (false === $result) {
|
|
|
@@ -93,4 +107,6 @@ class MoneyOut extends Backend
|
|
|
}
|
|
|
$this->success();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|