✨ feat(活动): 添加关注豪礼
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { PackageModel } from '@db/Package';
|
||||
import { Service } from 'egg';
|
||||
import { REDIS_KEY, STATUS } from '@consts';
|
||||
import { REDIS_KEY, SNS_LINK_TYPE, STATUS } from '@consts';
|
||||
import { ServerlistModel } from '@db/Serverlist';
|
||||
import { gameData } from '@pubUtils/data';
|
||||
import { DicHero } from '@pubUtils/dictionary/DicHero';
|
||||
@@ -26,6 +26,7 @@ import { HiddenDataByIdModel } from '@db/HiddenDataById';
|
||||
import { isNumber } from 'util';
|
||||
import { ServerGroupModel } from '@db/ServerGroup';
|
||||
import { GVGConfigModel } from '@db/GVGConfig';
|
||||
import { LinkModel } from '@db/Link';
|
||||
|
||||
/**
|
||||
* Test Service
|
||||
@@ -420,4 +421,31 @@ export default class Game extends Service {
|
||||
list: gvgconfig?[{...gvgconfig, env: this.app.config.realEnv }]: []
|
||||
});
|
||||
}
|
||||
|
||||
public async getLinks(types: number[]) {
|
||||
const { ctx } = this;
|
||||
const links = await LinkModel.findByTypes(types);
|
||||
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
list: links.map(cur => ({...cur, env: this.app.config.realEnv }))
|
||||
});
|
||||
}
|
||||
|
||||
public async updateWXLink(serverId: number, link: string, qrCodeLink: string ) {
|
||||
const { ctx } = this;
|
||||
await LinkModel.updateByServerAndType(serverId, SNS_LINK_TYPE.WX_GROUP, { link, qrCodeLink }, ctx.user?.uid);
|
||||
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS);
|
||||
}
|
||||
|
||||
public async updateOtherLink(wxPublicAccountQrCode: string, bbsLink: string, customerLink: string ) {
|
||||
const { ctx } = this;
|
||||
let updateArr: { type: number, link?: string, qrCodeLink?: string }[] = [];
|
||||
if(wxPublicAccountQrCode) updateArr.push({ type: SNS_LINK_TYPE.WX_PUBLIC_ACCOUNT, qrCodeLink: wxPublicAccountQrCode });
|
||||
if(bbsLink) updateArr.push({ type: SNS_LINK_TYPE.BBS, link: bbsLink });
|
||||
if(customerLink) updateArr.push({ type: SNS_LINK_TYPE.CUSTOMER, link: customerLink });
|
||||
await LinkModel.updateLinks(updateArr, ctx.user?.uid);
|
||||
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user