✨ feat(活动): 微信公众号口令
This commit is contained in:
@@ -5,6 +5,7 @@ import { ActivityBindPhoneRewardType } from '../../db/ActivityBindPhoneReward';
|
||||
import { LinkType } from '../../db/Link';
|
||||
import { UserType } from '../../db/User';
|
||||
import { ActivityBase } from './activityField';
|
||||
import { ActivityPublicAccountCodeType } from '../../db/ActivityPublicAccountCode';
|
||||
|
||||
// 数据库
|
||||
interface PageDataInDb {
|
||||
@@ -12,7 +13,6 @@ interface PageDataInDb {
|
||||
pageName: string;
|
||||
type: number;
|
||||
rewards: string;
|
||||
giftCode: string;
|
||||
}
|
||||
|
||||
interface BindPhoneDataInDb {
|
||||
@@ -49,18 +49,21 @@ class BindPhonePage extends PageData {
|
||||
super(pageData);
|
||||
this.rewards = pageData.rewards;
|
||||
}
|
||||
|
||||
public setBindPhoneStatus(user: UserType, data: ActivityBindPhoneRewardType) {
|
||||
if(user && user.channelInfo && user.channelInfo.is_phone_bind == 1) this.status = BIND_PHONE_STATUS.HAS_BIND;
|
||||
if(data) this.status = data.status;
|
||||
}
|
||||
}
|
||||
|
||||
class WXPublicAccountPage extends PageData {
|
||||
qrCodeLink: string; // 公众号二维码
|
||||
rewards: string; // 口令能有的奖励
|
||||
originGiftCode: string; // 加密后的口令
|
||||
giftCode: string; // 加密后的口令
|
||||
status: number = BIND_PHONE_STATUS.WAIT_BIND; // 状态 0-未使用 1-可领取 2-已领取
|
||||
|
||||
constructor(pageData: PageDataInDb) {
|
||||
super(pageData);
|
||||
this.originGiftCode = pageData.giftCode;
|
||||
this.rewards = pageData.rewards;
|
||||
}
|
||||
|
||||
@@ -72,6 +75,11 @@ class WXPublicAccountPage extends PageData {
|
||||
this.giftCode = giftCode;
|
||||
}
|
||||
|
||||
public setPlayerRecord(playerRecord: ActivityPublicAccountCodeType) {
|
||||
if(!playerRecord) return;
|
||||
this.status = playerRecord.hasReceived? BIND_PHONE_STATUS.HAS_BIND: BIND_PHONE_STATUS.RECEIVED;
|
||||
}
|
||||
|
||||
public getShowResult() {
|
||||
return pick(this, ['pageIndex', 'pageName', 'type', 'qrCodeLink', 'rewards', 'giftCode', 'status']);
|
||||
}
|
||||
@@ -133,15 +141,8 @@ export class BindPhoneData extends ActivityBase {
|
||||
}
|
||||
}
|
||||
|
||||
public setBindPhoneStatus(user: UserType, data: ActivityBindPhoneRewardType) {
|
||||
if(this.bindPhone) {
|
||||
if(user && user.channelInfo && user.channelInfo.is_phone_bind == 1) this.bindPhone.status = BIND_PHONE_STATUS.HAS_BIND;
|
||||
if(data) this.bindPhone.status = data.status;
|
||||
}
|
||||
}
|
||||
|
||||
public getShowResult() {
|
||||
let pages: (WXGroupPage|BindPhonePage|WXPublicAccountPage|BBSPage)[] = [];
|
||||
let pages: any[] = [];
|
||||
if(this.wxGroup) pages.push(this.wxGroup);
|
||||
if(this.bindPhone) pages.push(this.bindPhone);
|
||||
if(this.wxPublicAccount) pages.push(this.wxPublicAccount.getShowResult());
|
||||
|
||||
Reference in New Issue
Block a user