Commit aca9b531ee250642b3ea2e6696de402fbf565f14
1 parent
e682ab1b
Exists in
master
更新投放字段
Showing
7 changed files
with
52 additions
and
7 deletions
Show diff stats
wxsdk/base/SDKConst.ts
wxsdk/lib/sdk.d.ts
wxsdk/service/DataService.ts
... | ... | @@ -92,6 +92,9 @@ export default class DataService { |
92 | 92 | if (data.hasOwnProperty('ptm')) |
93 | 93 | this.setPtm(data.ptm); |
94 | 94 | |
95 | + if (data.hasOwnProperty('ad_info')) | |
96 | + this.setAdInfo(data.ad_info); | |
97 | + | |
95 | 98 | } |
96 | 99 | |
97 | 100 | get expice() { |
... | ... | @@ -499,6 +502,24 @@ export default class DataService { |
499 | 502 | this.setValue('request_id', request_id) |
500 | 503 | return this; |
501 | 504 | } |
505 | + setAdInfo(val) { | |
506 | + if (val && val != "" && val != "{}") { | |
507 | + try { | |
508 | + val = JSON.parse(val); | |
509 | + } catch (error) { | |
510 | + val = {}; | |
511 | + console.error('setAdInfo error', val, error); | |
512 | + } | |
513 | + }else{ | |
514 | + val = {}; | |
515 | + } | |
516 | + this.setValue('ad_info', val) | |
517 | + return this; | |
518 | + } | |
519 | + setLaunchAdInfo(val) { | |
520 | + this.setValue('launch_ad_info', val) | |
521 | + return this; | |
522 | + } | |
502 | 523 | |
503 | 524 | get IsCross(): boolean { |
504 | 525 | return this._data.isCross; | ... | ... |
wxsdk/service/LogService.ts
... | ... | @@ -549,6 +549,10 @@ export default class LogService { |
549 | 549 | let amount = DataService.I.amount; |
550 | 550 | let pon = DataService.I.pon; |
551 | 551 | let ptm = DataService.I.ptm; |
552 | + let account_id = DataService.I.Data.ad_info.account_id; | |
553 | + let adgroup_id = DataService.I.Data.ad_info.adgroup_id; | |
554 | + let creative_id = DataService.I.Data.ad_info.creative_id; | |
555 | + let strategy = DataService.I.Data.ad_info.strategy; | |
552 | 556 | return { |
553 | 557 | gameid, |
554 | 558 | channel, |
... | ... | @@ -566,7 +570,11 @@ export default class LogService { |
566 | 570 | amount, |
567 | 571 | pon, |
568 | 572 | pkv, |
569 | - ptm | |
573 | + ptm, | |
574 | + account_id, | |
575 | + adgroup_id, | |
576 | + creative_id, | |
577 | + strategy | |
570 | 578 | }; |
571 | 579 | } |
572 | 580 | ... | ... |
wxsdk/service/entity/SdkData.ts
... | ... | @@ -44,6 +44,8 @@ export default class SdkData { |
44 | 44 | public creative_id: string; // 创意ID |
45 | 45 | public advertister_id: string; // 广告账户ID |
46 | 46 | public request_id: string; // 请求下发ID |
47 | + public launch_ad_info:any; // 启动广告信息 | |
48 | + public ad_info: any; // 玩家广告信息 | |
47 | 49 | |
48 | 50 | |
49 | 51 | constructor() { |
... | ... | @@ -89,6 +91,8 @@ export default class SdkData { |
89 | 91 | this.creative_id = ''; |
90 | 92 | this.advertister_id = ''; |
91 | 93 | this.request_id = ''; |
94 | + this.launch_ad_info = {}; | |
95 | + this.ad_info ={}; | |
92 | 96 | } |
93 | 97 | } |
94 | 98 | ... | ... |
wxsdk/wx/WxInit.ts
... | ... | @@ -43,8 +43,15 @@ export default class WxInit { |
43 | 43 | ad_id, |
44 | 44 | creative_id, |
45 | 45 | advertister_id, |
46 | - request_id | |
46 | + request_id, | |
47 | 47 | // 抖音投放相关信息 end |
48 | + | |
49 | + | |
50 | + // account_id,//账户ID | |
51 | + adgroup_id,//广告ID | |
52 | + strategy,//策略ID | |
53 | + // creative_id,//创意ID | |
54 | + | |
48 | 55 | } = query; |
49 | 56 | |
50 | 57 | let fromChannel = channelId || channel_id || channel || td_channelid; |
... | ... | @@ -85,6 +92,7 @@ export default class WxInit { |
85 | 92 | .setCreativeId(creative_id) |
86 | 93 | .setAdvertisterId(advertister_id) |
87 | 94 | .setRequestId(request_id) |
95 | + .setLaunchAdInfo({account_id,adgroup_id,creative_id,strategy}) | |
88 | 96 | //clue_token=clue_token123&creative_id=creative_id213&ad_id=ad_id9999&request_id=request_id456&advertister_id=advertister_id9876 |
89 | 97 | // 设置网络类型 |
90 | 98 | WxApi.I.getNetworkType() | ... | ... |
wxsdk/wx/WxLogin.ts
... | ... | @@ -94,7 +94,7 @@ export default class WxLogin { |
94 | 94 | if (data) { |
95 | 95 | // 设置登录信息 |
96 | 96 | if (data.data) { |
97 | - let { channel, uid, firstlogin, token, reftoken, openid, expire, isnew, gameconfig, logindays, amount, pon } = data.data; | |
97 | + let { channel, uid, firstlogin, token, reftoken, openid, expire, isnew, gameconfig, logindays, amount, pon,ad_info } = data.data; | |
98 | 98 | LogService.I.setLogind({ |
99 | 99 | channel, |
100 | 100 | userId: uid, |
... | ... | @@ -106,7 +106,8 @@ export default class WxLogin { |
106 | 106 | expire, |
107 | 107 | logindays, |
108 | 108 | amount, |
109 | - pon | |
109 | + pon, | |
110 | + ad_info | |
110 | 111 | }); |
111 | 112 | OnlineService.I.setData(gameconfig) |
112 | 113 | LogService.I.active(); |
... | ... | @@ -144,6 +145,7 @@ export default class WxLogin { |
144 | 145 | let creative_id = DataService.I.Data.creative_id; |
145 | 146 | let advertister_id = DataService.I.Data.advertister_id; |
146 | 147 | let request_id = DataService.I.Data.request_id; |
148 | + let ad_info = JSON.stringify(DataService.I.Data.launch_ad_info); | |
147 | 149 | return { |
148 | 150 | channel, |
149 | 151 | brand, |
... | ... | @@ -159,7 +161,8 @@ export default class WxLogin { |
159 | 161 | clue_token, |
160 | 162 | creative_id, |
161 | 163 | advertister_id, |
162 | - request_id | |
164 | + request_id, | |
165 | + ad_info | |
163 | 166 | }; |
164 | 167 | } |
165 | 168 | ... | ... |