问卷
This commit is contained in:
@@ -157,4 +157,6 @@ export const PUSH_ROUTE = {
|
||||
TASK_UPDATE: 'onTaskUpdate',
|
||||
ACTIVITY_TASK_UPDATE: 'onActivityTaskUpdate',
|
||||
TASK_BOX_REFRESH: 'onTaskBoxRefresh',
|
||||
UPDATE_SURVEY: 'onUpdateSurvey',
|
||||
DELETE_SURVEY: 'onDeleteSurvey',
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export enum FRIEND_SELECT {
|
||||
}
|
||||
|
||||
export enum USER_GUILD_SELECT {
|
||||
ENTRY = '-_id -_v guildCode auth'
|
||||
ENTRY = '-_id -__v guildCode auth'
|
||||
}
|
||||
|
||||
export enum GUILD_SELECT {
|
||||
@@ -57,4 +57,9 @@ 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', 'consumeGoods', 'title', 'teraphs', 'showLineup', 'heads', 'head', 'frames', 'frame', 'spines', 'spine', 'hasGuild', 'guildCode', 'todayZeroPoint', 'apJson', 'skins', 'totalPay', 'guide', 'hasInit', 'renameCnt', 'totalCost', 'guildName', 'isVip'];
|
||||
export const ENTERY_ROLE_PICK = ['roleId', 'roleName', 'serverId', 'ce', 'topLineupCe', 'coin', 'lv', 'exp', 'vLv', 'gold', 'heros', 'jewels', 'consumeGoods', 'title', 'teraphs', 'showLineup', 'heads', 'head', 'frames', 'frame', 'spines', 'spine', 'hasGuild', 'guildCode', 'todayZeroPoint', 'apJson', 'skins', 'totalPay', 'guide', 'hasInit', 'renameCnt', 'totalCost', 'guildName', 'isVip'];
|
||||
|
||||
export enum SURVEY_SELECT {
|
||||
ENTRY = '-__v -_id -surveyId -surveyName -roleIndex -reward -mailContent -createdAt -updatedAt',
|
||||
FIND = '-__v -_id -surveyId -surveyName -roleIndex -reward -mailContent -receivedRole -createdAt -updatedAt'
|
||||
}
|
||||
@@ -33,6 +33,9 @@ export default class Region extends BaseModel {
|
||||
@prop({ required: true })
|
||||
gmPort: number; // 长链接地址
|
||||
|
||||
@prop({ required: true })
|
||||
webHost: string; // 短链接
|
||||
|
||||
@prop({ required: true })
|
||||
latestServer: number; // 最新服
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoos
|
||||
import { SearchSurveyParam } from '../domain/backEndField/search';
|
||||
import { Reward } from '../domain/battleField/pvp';
|
||||
import { genCode } from '../pubUtils/util';
|
||||
import { nowSeconds } from '../pubUtils/timeUtil';
|
||||
|
||||
@index({ id: 1 })
|
||||
@index({ seasonNum: 1 })
|
||||
@@ -17,6 +18,18 @@ export default class Survey extends BaseModel {
|
||||
@prop({ required: true })
|
||||
surveyName: string; // 问卷标题
|
||||
|
||||
@prop({ required: true })
|
||||
surveyLink: string; // 问卷地址
|
||||
|
||||
@prop({ required: true })
|
||||
beginTime: number; // 开始时间
|
||||
|
||||
@prop({ required: true })
|
||||
endTime: number; // 结束时间
|
||||
|
||||
@prop({ required: true })
|
||||
lv: number; // 限制等级
|
||||
|
||||
@prop({ required: true })
|
||||
roleIndex: number; // 玩家
|
||||
|
||||
@@ -26,14 +39,30 @@ export default class Survey extends BaseModel {
|
||||
@prop({ required: true })
|
||||
mailContent: string; // 邮件文字
|
||||
|
||||
@prop({ required: true })
|
||||
isEnable: boolean; // 是否显示
|
||||
|
||||
@prop({ required: true, type: String })
|
||||
receivedRole: string[]; // 是否显示
|
||||
|
||||
public static async findEnableSurvey(select = '') {
|
||||
let rec: SurveyType[] = await SurveyModel.find({ isEnable: true, endTime: { $gte: nowSeconds() } }).select(select).lean();
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static async findBySurveyId(surveyId: string) {
|
||||
let rec: SurveyType = await SurveyModel.findOne({ surveyId }).lean();
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static async updateSurvey(code: string, param: SurveyUpdate) {
|
||||
public static async updateSurvey(code: string, param: SurveyUpdate, select = '') {
|
||||
if(code == 'new') code = genCode(6);
|
||||
let rec: SurveyType = await SurveyModel.findOneAndUpdate({ code }, { $set: {...param, code} }, {new: true, upsert: true}).lean();
|
||||
let rec: SurveyType = await SurveyModel.findOneAndUpdate({ code }, { $set: {...param, code} }, {new: true, upsert: true}).select(select).lean();
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static async receive(code: string, roleId: string) {
|
||||
let rec: SurveyType = await SurveyModel.findOneAndUpdate({ code }, { $push: { receivedRole: roleId } }, { new: true }).lean();
|
||||
return rec;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@ export class CreateRegionParam {
|
||||
env: string = ''; // 环境变量
|
||||
gmLink: string; // 对应后台链接
|
||||
gameHost: string; // 长链接
|
||||
webHost: string; // 短链接
|
||||
gmPort: number; // 后台使用的connector端口
|
||||
|
||||
constructor(obj: any) {
|
||||
@@ -135,7 +136,7 @@ export class CreateRegionParam {
|
||||
}
|
||||
|
||||
checkParams() {
|
||||
if(!this.name || !this.prefix || !this.env || !this.gmLink || !this.gameHost || !this.gmPort || !isNumber(this.gmPort) ) {
|
||||
if(!this.name || !this.prefix || !this.env || !this.gmLink || !this.gameHost || !this.gmPort || !this.webHost || !isNumber(this.gmPort) ) {
|
||||
return false
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -796,5 +796,19 @@
|
||||
"name": "获取订单列表",
|
||||
"module": "order",
|
||||
"type": "get"
|
||||
},
|
||||
{
|
||||
"id": 115,
|
||||
"api": "gm.gmHandler.updateSurvey",
|
||||
"name": "更新问卷",
|
||||
"module": "survey",
|
||||
"type": "update"
|
||||
},
|
||||
{
|
||||
"id": 116,
|
||||
"api": "gm.gmHandler.deleteSurvey",
|
||||
"name": "更新问卷",
|
||||
"module": "survey",
|
||||
"type": "delete"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user