渠道
This commit is contained in:
@@ -11,6 +11,7 @@ import { RedisClient } from 'redis';
|
||||
import { REDIS_KEY } from '@consts';
|
||||
import { RegionModel } from '@db/Region';
|
||||
import { getRandEelmWithWeight, resResult } from 'app/pubUtils/util';
|
||||
import { ChannelInfoModel } from '@db/ChannelInfo';
|
||||
|
||||
export default class GameController extends Controller {
|
||||
|
||||
@@ -33,11 +34,19 @@ export default class GameController extends Controller {
|
||||
|
||||
public async checkReview() {
|
||||
const { ctx } = this;
|
||||
const { version } = ctx.request.body;
|
||||
const { version, platformAppid } = ctx.request.body;
|
||||
|
||||
let curRegion = await RegionModel.findRegionByEnv(this.app.config.realEnv);
|
||||
if(!curRegion) return resResult(STATUS.VERSION_ERR);
|
||||
|
||||
let hasPolicy = false, userPolicyLink = '', privacyPolicyLink = ''; // 是否需要替换协议,有就是用下面两个字段替换
|
||||
let channelInfo = await ChannelInfoModel.findByPlatform(platformAppid);
|
||||
if(channelInfo && !channelInfo.isDefaultPolicy) {
|
||||
hasPolicy = true;
|
||||
userPolicyLink = channelInfo.userPolicyLink;
|
||||
privacyPolicyLink = channelInfo.privacyPolicyLink;
|
||||
}
|
||||
|
||||
let isReview = await ctx.service.update.checkReview(curRegion, version);
|
||||
let hasNewWebServer = false, webServerUrl = '';
|
||||
if(isReview && curRegion.reviewEnv) {
|
||||
@@ -46,7 +55,8 @@ export default class GameController extends Controller {
|
||||
hasNewWebServer = true, webServerUrl = reviewRegion.webHost;
|
||||
}
|
||||
}
|
||||
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, { isReview, hasNewWebServer, webServerUrl });
|
||||
|
||||
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, { isReview, hasNewWebServer, webServerUrl, hasPolicy, userPolicyLink, privacyPolicyLink });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user