Revert "✨ feat(db): 修改role表数据库操作方式"
This reverts commit e39af3649288cc5802739cfe862c818fe56e194e.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { gameData, getDicFriendByLv } from "../pubUtils/data";
|
||||
import Role, { RoleType } from "../db/Role";
|
||||
import { RoleType, RoleModel } from "../db/Role";
|
||||
import { FriendRelationType, Relation, FriendRelationModel } from "../db/FriendRelation";
|
||||
import { getResStr, shouldRefresh } from "../pubUtils/util";
|
||||
import { STATUS, FRIEND_RELATION_TYPE, POPULATE_TYPE, FRIEND_DROP_TYPE } from "../consts";
|
||||
@@ -91,7 +91,7 @@ export async function getApplyList(roleId: string) {
|
||||
result.push(param);
|
||||
}
|
||||
let deleteCount = await FriendApplyModel.deleteApply(delApplyCodeList);
|
||||
await Role.increaseFriendApplyCnt(roleId, -1 * deleteCount, FRIEND.FRIEND_MANAGE_APPLICATION);
|
||||
await RoleModel.increaseFriendApplyCnt(roleId, -1 * deleteCount, FRIEND.FRIEND_MANAGE_APPLICATION);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -135,11 +135,11 @@ export async function increaseFrdCnt(role1: RoleType, role2: RoleType, originalF
|
||||
let _dicFriend = getDicFriendByLv(_lv);
|
||||
if(_friendCnt >= _dicFriend.frdCnt) return getResStr(STATUS.FRIEND_THEY_CNT_MAX);
|
||||
|
||||
let incMyFrdCnt = await Role.increaseFriendCnt(roleId, 1, dicFriend.frdCnt);
|
||||
let incMyFrdCnt = await RoleModel.increaseFriendCnt(roleId, 1, dicFriend.frdCnt);
|
||||
if(!incMyFrdCnt) return getResStr(STATUS.FRIEND_MY_CNT_MAX);
|
||||
let incHisFrdCnt = await Role.increaseFriendCnt(_roleId, 1, _dicFriend.frdCnt);
|
||||
let incHisFrdCnt = await RoleModel.increaseFriendCnt(_roleId, 1, _dicFriend.frdCnt);
|
||||
if(!incHisFrdCnt) { // 回滚
|
||||
await Role.increaseFriendCnt(roleId, -1, dicFriend.frdCnt);
|
||||
await RoleModel.increaseFriendCnt(roleId, -1, dicFriend.frdCnt);
|
||||
return getResStr(STATUS.FRIEND_THEY_CNT_MAX);
|
||||
}
|
||||
originalFriendCnt = incMyFrdCnt.friendCnt;
|
||||
|
||||
Reference in New Issue
Block a user