|
@@ -373,13 +373,14 @@ class User extends Backend
|
|
|
$row->validateFailException(true)->validate($validate);
|
|
|
}
|
|
|
if (!empty($params['jewel_add'])) {//钻石充值
|
|
|
- $userWhere['user_id'] = $row['id'];
|
|
|
- $user = Db::name('user_wallet')->where($userWhere)->lock(true)->find();
|
|
|
+ $userWhere['id'] = $row['id'];
|
|
|
+ $user = Db::name('user')->where($userWhere)->find();
|
|
|
+ $userwallet = Db::name('user_wallet')->where('user_id',$row['id'])->lock(true)->find();
|
|
|
$jewelRes = model('Wallet')->lockChangeAccountRemain($row['id'],$params['jewel_add'],'+',0,'钻石充值',17,'jewel');
|
|
|
if (!$jewelRes['status']) {
|
|
|
throw new Exception($jewelRes['msg']);
|
|
|
}
|
|
|
- $params['jewel'] = bcadd($user['jewel'],$params['jewel_add']);
|
|
|
+ $params['jewel'] = bcadd($userwallet['jewel'],$params['jewel_add']);
|
|
|
//充值日志记录
|
|
|
//判断是否首充
|
|
|
$jewellogWhere['user_id'] = $row['id'];
|
|
@@ -390,7 +391,7 @@ class User extends Backend
|
|
|
$isFirst = 0;
|
|
|
}
|
|
|
$preUserId = $user['pre_userid'];
|
|
|
- $userRechargeLogRes = model('UserRechargeLog')->addRecord($row['id'], $params['jewel_add'], $user['money'], $params['jewel'], $user['money'], 4, 4,$isFirst,$preUserId);
|
|
|
+ $userRechargeLogRes = model('UserRechargeLog')->addRecord($row['id'], $params['jewel_add'], $userwallet['money'], $params['jewel'], $userwallet['money'], 4, 4,$isFirst,$preUserId);
|
|
|
if (!$userRechargeLogRes) {
|
|
|
throw new Exception('充值记录生成失败');
|
|
|
}
|