好友:参数表配置
This commit is contained in:
@@ -3,7 +3,8 @@ import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoos
|
||||
import { getFriendLvByExp } from '../pubUtils/data';
|
||||
import * as util from '../pubUtils/friendUtil';
|
||||
import { nowSeconds } from '../pubUtils/timeUtil';
|
||||
import { FRIEND } from '../consts';
|
||||
import { FRIEND } from '../pubUtils/dicParam';
|
||||
import { FRIEND_SELECT } from '../consts';
|
||||
|
||||
/**
|
||||
* 好友直接的亲密值
|
||||
@@ -107,12 +108,12 @@ export default class FriendShip extends BaseModel {
|
||||
if(shouldRefresh) {
|
||||
let obj = this.getRefData();
|
||||
result = await FriendShipModel.findOneAndUpdate({ roleIds }, {
|
||||
$inc: { friendValue: 5},
|
||||
$inc: { friendValue: FRIEND.FRIEND_CLOSEPOINT_ADD},
|
||||
$set: { ...obj, ...params.inc, ...params.set }
|
||||
}, { new: true }).lean({ virtuals: true });
|
||||
} else {
|
||||
result = await FriendShipModel.findOneAndUpdate({ roleIds, ...params.lt }, {
|
||||
$inc: { ...params.inc, friendValue: 5},
|
||||
$inc: { ...params.inc, friendValue: FRIEND.FRIEND_CLOSEPOINT_ADD},
|
||||
$set: params.set
|
||||
}, { new: true }).lean({ virtuals: true });
|
||||
}
|
||||
@@ -150,7 +151,7 @@ export default class FriendShip extends BaseModel {
|
||||
public static async addFriendValue(roleId: string, hisRoleId: string, inc: number) {
|
||||
let { roleIds } = util.getRoleIds([roleId, hisRoleId]);
|
||||
let result: FriendShipType = await FriendShipModel.findOneAndUpdate({ roleIds }, { $inc: { friendValue: inc } }, { new: true })
|
||||
.select(FRIEND.SEND_PRESENT)
|
||||
.select(FRIEND_SELECT.SEND_PRESENT)
|
||||
.lean({ virtuals: true });
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user