|
@@ -2,8 +2,10 @@
|
|
|
|
|
|
|
|
namespace app\admin\controller\trade;
|
|
namespace app\admin\controller\trade;
|
|
|
|
|
|
|
|
|
|
+use think\Db;
|
|
|
|
|
+use Exception;
|
|
|
use app\common\controller\Backend;
|
|
use app\common\controller\Backend;
|
|
|
-use app\common\model\Users;
|
|
|
|
|
|
|
+use app\common\model\MoneyLog;
|
|
|
use think\exception\DbException;
|
|
use think\exception\DbException;
|
|
|
use think\exception\PDOException;
|
|
use think\exception\PDOException;
|
|
|
use think\exception\ValidateException;
|
|
use think\exception\ValidateException;
|
|
@@ -79,12 +81,20 @@ class MoneyIn extends Backend
|
|
|
$this->error(__('No Results were found'));
|
|
$this->error(__('No Results were found'));
|
|
|
}
|
|
}
|
|
|
$result = false;
|
|
$result = false;
|
|
|
|
|
+ Db::startTrans();
|
|
|
try {
|
|
try {
|
|
|
|
|
+
|
|
|
|
|
+ //充值
|
|
|
|
|
+ if ($status == $this->model::Success) {
|
|
|
|
|
+ (new MoneyLog())->change($row->user_id, $row->amount, MoneyLog::Recharge, $row->user_id, '充值');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$result = $row->allowField(true)->save(['status' => $status]);
|
|
$result = $row->allowField(true)->save(['status' => $status]);
|
|
|
//累积充值金额
|
|
//累积充值金额
|
|
|
//(new Users())->where('id', $row->user_id)->setInc('money_in_sum', $row->amount);
|
|
//(new Users())->where('id', $row->user_id)->setInc('money_in_sum', $row->amount);
|
|
|
-
|
|
|
|
|
|
|
+ Db::commit();
|
|
|
} catch (ValidateException|PDOException $e) {
|
|
} catch (ValidateException|PDOException $e) {
|
|
|
|
|
+ Db::rollback();
|
|
|
$this->error($e->getMessage());
|
|
$this->error($e->getMessage());
|
|
|
}
|
|
}
|
|
|
if (false === $result) {
|
|
if (false === $result) {
|