神像:修复无法强化bug
This commit is contained in:
@@ -8,7 +8,7 @@ import { getCurTask } from './taskService';
|
|||||||
import { RoleType } from '../db/Role';
|
import { RoleType } from '../db/Role';
|
||||||
import { FrontendOrBackendSession, pinus } from 'pinus';
|
import { FrontendOrBackendSession, pinus } from 'pinus';
|
||||||
import { resResult } from '../pubUtils/util';
|
import { resResult } from '../pubUtils/util';
|
||||||
import { STATUS, PUSH_BATCH, PUSH_INTERVAL } from '../consts';
|
import { STATUS, PUSH_BATCH, PUSH_INTERVAL, CONSUME_TYPE } from '../consts';
|
||||||
import { getAllShopList } from './shopService';
|
import { getAllShopList } from './shopService';
|
||||||
import { getGeneralRank } from './rankService';
|
import { getGeneralRank } from './rankService';
|
||||||
import { getFriendList, getApplyList } from './friendService';
|
import { getFriendList, getApplyList } from './friendService';
|
||||||
@@ -33,6 +33,7 @@ import { GuildType } from '../db/Guild';
|
|||||||
import UserGuild, { UserGuildType } from '../db/UserGuild';
|
import UserGuild, { UserGuildType } from '../db/UserGuild';
|
||||||
import { setMedianCe } from './guildActivityService';
|
import { setMedianCe } from './guildActivityService';
|
||||||
import { getAllOnlineRoles } from './redisService';
|
import { getAllOnlineRoles } from './redisService';
|
||||||
|
import Item from '../db/Item';
|
||||||
|
|
||||||
export async function pushData(role: RoleType, session: FrontendOrBackendSession, pushType: 'entry'|'refresh' = 'entry') {
|
export async function pushData(role: RoleType, session: FrontendOrBackendSession, pushType: 'entry'|'refresh' = 'entry') {
|
||||||
try{
|
try{
|
||||||
@@ -86,7 +87,8 @@ export async function pushData(role: RoleType, session: FrontendOrBackendSession
|
|||||||
return await getTowerEntryData(role);
|
return await getTowerEntryData(role);
|
||||||
case 'comBattle': // 寻宝
|
case 'comBattle': // 寻宝
|
||||||
const assistCnt = await getAllAssistCnt(roleId);
|
const assistCnt = await getAllAssistCnt(roleId);
|
||||||
return { assistCnt }
|
const blueprts = await Item.findByRoleAndType(roleId, CONSUME_TYPE.BLUEPRT);
|
||||||
|
return { assistCnt, blueprts }
|
||||||
case 'dungeon': // 秘境
|
case 'dungeon': // 秘境
|
||||||
return await getDungeonData(role);
|
return await getDungeonData(role);
|
||||||
case 'pvp': // pvp
|
case 'pvp': // pvp
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { STATUS } from '@consts';
|
|||||||
import { ActivityModel } from '@db/Activity';
|
import { ActivityModel } from '@db/Activity';
|
||||||
import { ActivityGroupModel } from '@db/ActivityGroup';
|
import { ActivityGroupModel } from '@db/ActivityGroup';
|
||||||
import { ServerlistModel } from '@db/Serverlist';
|
import { ServerlistModel } from '@db/Serverlist';
|
||||||
|
import { GMUserType } from '@db/GMUser';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Service
|
* Test Service
|
||||||
@@ -28,6 +29,7 @@ export default class Activity extends Service {
|
|||||||
|
|
||||||
public async updateActivity(activityId: number | string, groupId: number, beginTime: number, endTime: number, type: number, data: string) {
|
public async updateActivity(activityId: number | string, groupId: number, beginTime: number, endTime: number, type: number, data: string) {
|
||||||
const { ctx } = this;
|
const { ctx } = this;
|
||||||
|
let gmuser: GMUserType = ctx.user;
|
||||||
if (!type || !data) {
|
if (!type || !data) {
|
||||||
return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
|
||||||
}
|
}
|
||||||
@@ -43,7 +45,7 @@ export default class Activity extends Service {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const activities = await ActivityModel.addActivity(aids, groupId, beginTime ? new Date(beginTime) : undefined, endTime ? new Date(endTime) : undefined, type, data);
|
const activities = await ActivityModel.addActivity(aids, groupId, beginTime ? new Date(beginTime) : undefined, endTime ? new Date(endTime) : undefined, type, data, gmuser.uid);
|
||||||
return ctx.service.utils.resResult(STATUS.SUCCESS, {
|
return ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||||
activity: activities
|
activity: activities
|
||||||
})
|
})
|
||||||
|
|||||||
+10
-4
@@ -29,6 +29,12 @@ export default class Activity extends BaseModel {
|
|||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
days: number; // 活动持续天数 timeType=1、2
|
days: number; // 活动持续天数 timeType=1、2
|
||||||
|
|
||||||
|
@prop({ required: true })
|
||||||
|
createdBy: number; // 后台创建人
|
||||||
|
@prop({ required: true })
|
||||||
|
updatedBy: number; // 最近更新人
|
||||||
|
|
||||||
|
|
||||||
//根据活动类型查询开启的活动数据
|
//根据活动类型查询开启的活动数据
|
||||||
public static async findOpenActivityByType(activityGroupId: number[], type: number, date: Date) {
|
public static async findOpenActivityByType(activityGroupId: number[], type: number, date: Date) {
|
||||||
let result: ActivityModelType[] = await ActivityModel.find(
|
let result: ActivityModelType[] = await ActivityModel.find(
|
||||||
@@ -58,7 +64,7 @@ export default class Activity extends BaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//新增活动
|
//新增活动
|
||||||
public static async addActivity(aids: number[], groupId: number, beginTime: Date, endTime: Date, type: number, data: string) {
|
public static async addActivity(aids: number[], groupId: number, beginTime: Date, endTime: Date, type: number, data: string, uid = 1) {
|
||||||
let result: ActivityModelType[] = [];
|
let result: ActivityModelType[] = [];
|
||||||
for (let activityId of aids) {
|
for (let activityId of aids) {
|
||||||
if (!activityId) activityId = await CounterModel.getNewCounter(COUNTER.ACTIVITY);
|
if (!activityId) activityId = await CounterModel.getNewCounter(COUNTER.ACTIVITY);
|
||||||
@@ -69,7 +75,7 @@ export default class Activity extends BaseModel {
|
|||||||
if (endTime != undefined) {
|
if (endTime != undefined) {
|
||||||
update["endTime"] = endTime;
|
update["endTime"] = endTime;
|
||||||
}
|
}
|
||||||
let rec: ActivityModelType = await ActivityModel.findOneAndUpdate({ activityId }, { $set: update },
|
let rec: ActivityModelType = await ActivityModel.findOneAndUpdate({ activityId }, { $set: {...update, updatedBy: uid}, $setOnInsert: { createdBy: uid } },
|
||||||
{ new: true, upsert: true }).lean(true);
|
{ new: true, upsert: true }).lean(true);
|
||||||
result.push(rec);
|
result.push(rec);
|
||||||
}
|
}
|
||||||
@@ -132,8 +138,8 @@ export default class Activity extends BaseModel {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async updateGroupId(activityIds: number[], groupId: number) {
|
public static async updateGroupId(activityIds: number[], groupId: number, uid = 1) {
|
||||||
let result = await ActivityModel.updateMany({ activityId: { $in: activityIds } }, { $set: { groupId } });
|
let result = await ActivityModel.updateMany({ activityId: { $in: activityIds } }, { $set: { groupId, updatedBy: uid }, $setOnInsert: { createdBy: uid } });
|
||||||
console.log(result)
|
console.log(result)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,8 +168,8 @@ export function shouldRefreshWeek(preTime: Date, now: Date, day: number = 1, hou
|
|||||||
* @param cnt 返回随机元素个数
|
* @param cnt 返回随机元素个数
|
||||||
*/
|
*/
|
||||||
export function getRandEelm<T>(source: Array<T> = [], cnt = 1): Array<T> {
|
export function getRandEelm<T>(source: Array<T> = [], cnt = 1): Array<T> {
|
||||||
if (cnt > source.length || cnt == 0) return [];
|
if (cnt == 0) return [];
|
||||||
if (cnt === source.length) return source;
|
if (cnt >= source.length) return source;
|
||||||
let idxs = new Set();
|
let idxs = new Set();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user