测试:添加公会

This commit is contained in:
qiaoxin
2021-07-07 16:25:52 +08:00
parent cc5cdd347e
commit 5a948d1741
2 changed files with 42 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
import { Application, BackendSession } from 'pinus';
import { resResult } from '../../../pubUtils/util';
import { STATUS, TASK_TYPE } from '../../../consts';
import { aesEncrypt, aesEncryptcfb, resResult } from '../../../pubUtils/util';
import { ENCRYPT_IV, ENCRYPT_KEY, STATUS, TASK_TYPE } from '../../../consts';
import { checkActivityTask } from '../../../services/taskService';
import { ActivityGroupModel } from '../../../db/ActivityGroup';
import { ServerlistModel } from '../../../db/Serverlist';
@@ -76,20 +76,25 @@ export class ActivityHandler {
// await checkActivityTask(serverId, sid, funcs, roleId, TASK_TYPE.BATTLE_TOWER_LV, 1, { towerLv: lv })
// await checkActivityTask(serverId, sid, funcs, roleId, TASK_TYPE.GASHA, 1)
if (lv == 2) {
await GTCreateListMessage('批量推送测试11', 259200000, '哈哈哈哈哈11', '噢噢噢噢噢噢噢噢11')
}
if (lv == 3) {
await GTPushListCidMessage('RASL_0630_da707a0c484d4ee39f2d462d5f52984', ['ba64ee9a9d516bbd341267d685baceb4'], true);
}
if (lv == 1) {
await GTPushSingleCidMessage('ba64ee9a9d516bbd341267d685baceb4', 259200000, '哈哈哈哈哈', '噢噢噢噢噢噢噢噢');
}
// if (lv == 2) {
// await GTCreateListMessage('批量推送测试11', 259200000, '哈哈哈哈哈11', '噢噢噢噢噢噢噢噢11')
// }
// if (lv == 3) {
// await GTPushListCidMessage('RASL_0630_da707a0c484d4ee39f2d462d5f52984', ['ba64ee9a9d516bbd341267d685baceb4'], true);
// }
// if (lv == 1) {
// await GTPushSingleCidMessage('ba64ee9a9d516bbd341267d685baceb4', 259200000, '哈哈哈哈哈', '噢噢噢噢噢噢噢噢');
// }
// let beginTime = 1624050000000;
// let interval = 86400;
// console.log('ddddddbbbbbbbbbbbbbb', moment(new Date).valueOf(), (moment(new Date).valueOf() - beginTime), ((moment(new Date).valueOf() - beginTime) % (interval * 1000)), 24 * 60 * 60 * 1000, ((moment(new Date).valueOf() - beginTime) % (interval * 1000)) / (24 * 60 * 60 * 1000))
// let aaa = Math.ceil(((moment(new Date).valueOf() - beginTime) / (24 * 60 * 60 * 1000)));
// console.log('xxxxxxxxxxxxxxxxxxx', aaa);
//aesEncryptcfb
console.log('13121622738', await aesEncryptcfb("13121622738", ENCRYPT_KEY, ENCRYPT_IV))
//18612532385:cc80b189dc03cff31fe75d
//13636354764:cc8bb18bd805c9f51be95c
//13121622738:cc8bb68adf00cef31bec50
return resResult(STATUS.SUCCESS,);
}

View File

@@ -9,6 +9,12 @@ import { addItems, handleCost } from '../../../services/rewardService';
import { getSimpleRoleInfo } from '../../../services/roleService';
import { getRoleOnlineInfo } from '../../../services/redisService';
import { lockData } from '../../../services/redLockService';
import { GuildModel } from '../../../db/Guild';
import { RoleModel, RoleType } from '../../../db/Role';
import { openGuildRefine } from '../../../services/guildRefineService';
import { unlockTrain } from '../../../services/guildTrainService';
import { UserGuildModel } from '../../../db/UserGuild';
import { UserGuildApplyModel } from '../../../db/UserGuildApply';
export default function (app: Application) {
return new AuctionHandler(app);
@@ -76,7 +82,7 @@ export class AuctionHandler {
const { roleName: buyerName } = await getSimpleRoleInfo(curBuyer);
const { isOnline, sid: buyerSid } = await getRoleOnlineInfo(curBuyer);
await addItems(curBuyer, buyerName, buyerSid, [{ id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.GOLD), count: curPrice }]);
if(isOnline) {
if (isOnline) {
this.channelService.pushMessageByUids('onAuctionOver', resResult(STATUS.SUCCESS, { code }), [{ uid: curBuyer, sid: buyerSid }]);
}
}
@@ -215,7 +221,25 @@ export class AuctionHandler {
const guildCode: string = session.get('guildCode');
const serverId: number = session.get('serverId');
if (!guildCode) return resResult(STATUS.GUILD_NOT_FOUND)
if (!guildCode) {//创建公会
const roleId = session.get('roleId');
const role: RoleType = await RoleModel.findByRoleId(roleId);
// 创建公会
const name = '测试公会'
const icon = 1
const notice = '测试公会'
const guild = await GuildModel.createGuild({ name, icon, notice }, role, serverId);
if (!guild) return resResult(STATUS.GUILD_CREATE_ERROR);
guild.leader = <RoleType>guild.leader;
//创建科技树
await openGuildRefine(guild.code);
await unlockTrain(guild.code, 1);
const userGuild = await UserGuildModel.createUserGuild(guild.code, role, true);
if (!userGuild) return resResult(STATUS.GUILD_CREATE_ERROR);
await RoleModel.joinGuild(roleId, guild.code, guild.name);
await UserGuildApplyModel.deleteApply(roleId); // 删除玩家所有对其他公会的申请
}
const result = await genAuction(guildCode, sourceType, sourceCode, serverId, rewards);
if (!result) {