|
@@ -199,7 +199,6 @@ class AccountLogService extends BaseService
|
|
|
$accountName = isset($userTypes[$userType])? $userTypes[$userType] : '会员';
|
|
$accountName = isset($userTypes[$userType])? $userTypes[$userType] : '会员';
|
|
|
ActionLogModel::setTitle("{$accountName}[ID:{$accountId}]{$coinName}账户上下分");
|
|
ActionLogModel::setTitle("{$accountName}[ID:{$accountId}]{$coinName}账户上下分");
|
|
|
ActionLogModel::record();
|
|
ActionLogModel::record();
|
|
|
- $amount = $type == 1? $amount : -$amount;
|
|
|
|
|
$userInfo = MemberModel::where(['id'=> $accountId,'mark'=>1])->first();
|
|
$userInfo = MemberModel::where(['id'=> $accountId,'mark'=>1])->first();
|
|
|
$userId = isset($userInfo['id'])? $userInfo['id'] : 0;
|
|
$userId = isset($userInfo['id'])? $userInfo['id'] : 0;
|
|
|
if(empty($userInfo) || $userId<=0){
|
|
if(empty($userInfo) || $userId<=0){
|
|
@@ -211,7 +210,15 @@ class AccountLogService extends BaseService
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 账户余额
|
|
|
|
|
+ $userAmount = isset($userInfo[$field])? $userInfo[$field] : 0;
|
|
|
|
|
+ if($userAmount < $amount){
|
|
|
|
|
+ $this->error = 2035;
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
DB::beginTransaction();
|
|
DB::beginTransaction();
|
|
|
|
|
+ $amount = $type == 1? $amount : -$amount;
|
|
|
$updateData = [$field=>DB::raw("{$field} + {$amount}"),'update_time'=>time()];
|
|
$updateData = [$field=>DB::raw("{$field} + {$amount}"),'update_time'=>time()];
|
|
|
if(!MemberModel::where(['id'=> $accountId])->update($updateData)){
|
|
if(!MemberModel::where(['id'=> $accountId])->update($updateData)){
|
|
|
DB::rollBack();
|
|
DB::rollBack();
|