feat(37需求): 评论引导记录

This commit is contained in:
luying
2023-04-10 16:15:20 +08:00
parent 98411f2725
commit 33560c93df
5 changed files with 38 additions and 14 deletions

View File

@@ -215,18 +215,7 @@ export class ChatHandler {
if (!accuseRec) return resResult(STATUS.WRONG_PARMS);
return resResult(STATUS.SUCCESS, accuseRec);
}
async setPushMsgTrigger(msg: { isClosePush: boolean }, session: BackendSession) {
const roleId = session.get('roleId');
const { isClosePush } = msg;
let role = await RoleModel.setPushMsgOpen(roleId, isClosePush);
if(!role) return resResult(STATUS.ROLE_NOT_FOUND);
return resResult(STATUS.SUCCESS, {
isClosePushPush: role.isClosePush
})
}
// 客户端推送消息
async debugPushMessage(msg: { uid: number }, session: BackendSession) {
let dic = gameData.dicPushMessage.get(SDK_PUSH_MSG_TYPE.GUILD_ACTIVITY_START);

View File

@@ -503,6 +503,28 @@ export class RoleHandler {
});
}
async setPushMsgTrigger(msg: { isClosePush: boolean }, session: BackendSession) {
const roleId = session.get('roleId');
const { isClosePush } = msg;
let role = await RoleModel.setPushMsgOpen(roleId, isClosePush);
if(!role) return resResult(STATUS.ROLE_NOT_FOUND);
return resResult(STATUS.SUCCESS, {
isClosePushPush: role.isClosePush
})
}
async setHasComment(msg: { hasComment: boolean }, session: BackendSession) {
const roleId = session.get('roleId');
const { hasComment } = msg;
let role = await RoleModel.setHasComment(roleId, hasComment);
if(!role) return resResult(STATUS.ROLE_NOT_FOUND);
return resResult(STATUS.SUCCESS, {
hasComment: role.hasComment
})
}
// 防沉迷调试用,推送窗口
async debugPlayerTime(msg: { type: number }, session: BackendSession) {
let { type } = msg;

View File

@@ -1994,11 +1994,16 @@ export function checkRouteParam(route: string, msg: any) {
if(!isDevelopEnv() && !checkNaturalNumbers(msg.id, msg.count)) return false;
break;
}
case "chat.chatHandler.setPushMsgTrigger":
case "role.roleHandler.setPushMsgTrigger":
{
if(!isBoolean(msg.isClosePush)) return false;
break;
}
case "role.roleHandler.setHasComment":
{
if(!isBoolean(msg.hasComment)) return false;
break;
}
case 'activity.activityHandler.debugActivityMemory':
case 'activity.popUpShopHandler.debugPushPopUpShop':
case 'activity.popUpShopHandler.debugPushPopUpInterval':

View File

@@ -57,7 +57,7 @@ export enum FRIEND_SHIP_SELECT {
GET_FRIEND_VALUE = 'friendValue friendLv'
}
export const ENTERY_ROLE_PICK = ['roleId', 'roleName', 'serverId', 'ce', 'topLineupCe', 'coin', 'lv', 'exp', 'vLv', 'gold', 'heros', 'jewels', 'artifacts', 'consumeGoods', 'title', 'teraphs', 'showLineup', 'heads', 'head', 'frames', 'frame', 'spines', 'spine', 'hasGuild', 'guildCode', 'todayZeroPoint', 'apJson', 'skins', 'totalPay', 'guide', 'hasInit', 'renameCnt', 'totalCost', 'guildName', 'isVip', 'createTime', 'ipLocation', 'activityItems', 'customerLink', 'isClosePush'];
export const ENTERY_ROLE_PICK = ['roleId', 'roleName', 'serverId', 'ce', 'topLineupCe', 'coin', 'lv', 'exp', 'vLv', 'gold', 'heros', 'jewels', 'artifacts', 'consumeGoods', 'title', 'teraphs', 'showLineup', 'heads', 'head', 'frames', 'frame', 'spines', 'spine', 'hasGuild', 'guildCode', 'todayZeroPoint', 'apJson', 'skins', 'totalPay', 'guide', 'hasInit', 'renameCnt', 'totalCost', 'guildName', 'isVip', 'createTime', 'ipLocation', 'activityItems', 'customerLink', 'isClosePush', 'hasComment'];
export enum SURVEY_SELECT {
FIND = '-__v -_id -surveyName -roleIndex -reward -mailContent -receivedRole -createdAt -updatedAt'

View File

@@ -351,6 +351,9 @@ export default class Role extends BaseModel {
// 是否打开推送
@prop({ required: false })
isClosePush: boolean;
// 是否评论过
@prop({ required: false })
hasComment: boolean;
public static async findAllByUid(uid: number, getters = false, virtuals = true) {
const role: RoleType[] = await RoleModel.find({ 'userInfo.uid': uid }).select('roleId roleName serverId head frame spine heads frames spines lv updatedAt createTime').lean({ getters, virtuals });
@@ -850,6 +853,11 @@ export default class Role extends BaseModel {
let role: RoleType = await RoleModel.findOneAndUpdate({ roleId }, { $set: { isClosePush } }, { new: true }).select('-_id roleId isClosePush').lean();
return role;
}
public static async setHasComment(roleId: string, hasComment: boolean) {
let role: RoleType = await RoleModel.findOneAndUpdate({ roleId }, { $set: { hasComment } }, { new: true }).select('-_id roleId hasComment').lean();
return role;
}
}
export const RoleModel = getModelForClass(Role);