|
@@ -8,12 +8,15 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
|
8
|
8
|
|
9
|
9
|
basicInfoData = _.cloneDeep(basicInfoData_cr)
|
10
|
10
|
|
11
|
|
- console.log('定向包:', pageInfo.directObj)
|
12
|
|
- console.log('创意素材:', cMaterial.resResult)
|
13
|
|
- console.log('创意文案:', pageInfo.copywriterInfoData.data)
|
14
|
|
- console.log('落地页:', pageInfo.copyLandPageInfoData)
|
15
|
|
- console.log('规则配置:', pageInfo.RuleConfigObj)
|
16
|
|
- console.log('外部配置:', basicInfoData.outerConfig)
|
|
11
|
+ console.log('pageInfo', pageInfo)
|
|
12
|
+ console.log('cMaterial', cMaterial)
|
|
13
|
+ console.log('basicInfoData_cr', basicInfoData_cr)
|
|
14
|
+ // console.log('定向包:', pageInfo.directObj)
|
|
15
|
+ // console.log('创意素材:', cMaterial.resResult)
|
|
16
|
+ // console.log('创意文案:', pageInfo.copywriterInfoData.data)
|
|
17
|
+ // console.log('落地页:', pageInfo.copyLandPageInfoData)
|
|
18
|
+ // console.log('规则配置:', pageInfo.RuleConfigObj)
|
|
19
|
+ // console.log('外部配置:', basicInfoData.outerConfig)
|
17
|
20
|
|
18
|
21
|
let accNum = pageInfo.accIdsList.length;
|
19
|
22
|
|
|
@@ -32,7 +35,7 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
|
32
|
35
|
if (main_1.id == i) {
|
33
|
36
|
pageInfo.copyLandPageInfoData.data[i].forEach((item) => {
|
34
|
37
|
main_2.ad_list.push({
|
35
|
|
- self_land_page: item
|
|
38
|
+ self_land_page: _.cloneDeep(item)
|
36
|
39
|
})
|
37
|
40
|
});
|
38
|
41
|
}
|
|
@@ -42,7 +45,7 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
|
42
|
45
|
})
|
43
|
46
|
}
|
44
|
47
|
// 创意素材
|
45
|
|
- let ad_show_list_scyc = JSON.parse(JSON.stringify(ad_show_list))
|
|
48
|
+ let ad_show_list_scyc = _.cloneDeep(ad_show_list)
|
46
|
49
|
ad_show_list.forEach((item) => {
|
47
|
50
|
for (let i = 0; i < item.chooseList.length; i++) {
|
48
|
51
|
let v_item = item.chooseList[i]
|
|
@@ -53,18 +56,21 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
|
53
|
56
|
let item = ad_show_list[index]
|
54
|
57
|
for (let v_index = 0; v_index < item.chooseList.length; v_index++) {
|
55
|
58
|
let v_item = item.chooseList[v_index]
|
56
|
|
- cMaterial.resResult.forEach((main) => {
|
57
|
|
- if (item.id == main.account_id) {
|
|
59
|
+ cMaterial.resResult.forEach((main2) => {
|
|
60
|
+ if (item.id == main2.account_id) {
|
58
|
61
|
let ad_list: any = _.cloneDeep(ad_show_list_scyc[index].chooseList[v_index].ad_list);
|
59
|
62
|
let common_obj = {
|
60
|
63
|
ad_name: basicInfoData.fillBack.ad_name,
|
61
|
64
|
bid_amount: '我是广告出价',
|
|
65
|
+ deep_bid_amount: '我是深度出价',
|
|
66
|
+ deep_roi: '我是期望ROI',
|
62
|
67
|
// bid_amount_optimization_goal: '优化目标',
|
63
|
68
|
targeting_id: v_item.targeting_id,
|
64
|
69
|
targeting_name: v_item.targeting_name
|
65
|
70
|
}
|
66
|
71
|
if (ad_list.length > 0) {
|
67
|
72
|
ad_list.forEach((v) => {
|
|
73
|
+ let main = _.cloneDeep(main2)
|
68
|
74
|
if (v.self_land_page) {
|
69
|
75
|
main['page_spec']['mini_program_spec']['mini_program_id'] = v.self_land_page.appid
|
70
|
76
|
main['page_spec']['mini_program_spec']['mini_program_path'] = v.self_land_page.applink
|
|
@@ -74,10 +80,10 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
|
74
|
80
|
main['link_page_spec']['mini_program_spec']['mini_program_path'] = v.self_land_page.applink
|
75
|
81
|
}
|
76
|
82
|
}
|
77
|
|
- v_item.ad_list.push(Object.assign(common_obj, { adcreatives_info: main }))
|
|
83
|
+ v_item.ad_list.push(Object.assign(_.cloneDeep(common_obj), { adcreatives_info: main }))
|
78
|
84
|
})
|
79
|
85
|
} else {
|
80
|
|
- v_item.ad_list.push(Object.assign(common_obj, { adcreatives_info: main }))
|
|
86
|
+ v_item.ad_list.push(Object.assign(common_obj, { adcreatives_info: main2 }))
|
81
|
87
|
}
|
82
|
88
|
}
|
83
|
89
|
});
|
|
@@ -130,23 +136,25 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
|
130
|
136
|
});
|
131
|
137
|
ad_show_list.forEach((item, index) => {
|
132
|
138
|
acc_plan_ad_count[item.id] = { 'plan_count': 0, 'ad_count': 0, }
|
|
139
|
+ let common_obj = {
|
|
140
|
+ 'account_id': item.id,
|
|
141
|
+ 'campaign_name': pageInfo.RuleConfigObj.campaign_name,
|
|
142
|
+ 'daily_budget': Number(pageInfo.RuleConfigObj.daily_budget),
|
|
143
|
+ 'total_budget': Number(pageInfo.RuleConfigObj.total_budget),
|
|
144
|
+ 'campaign_status': pageInfo.RuleConfigObj.campaign_status,
|
|
145
|
+ 'speed_mode': pageInfo.RuleConfigObj.speed_mode,
|
|
146
|
+ }
|
133
|
147
|
item.chooseList.forEach((item_1) => {
|
134
|
148
|
adNum += item_1.ad_list.length;
|
135
|
149
|
acc_plan_ad_count[item.id].ad_count += item_1.ad_list.length;
|
136
|
|
- let common_obj = {
|
137
|
|
- 'account_id': item.id,
|
138
|
|
- 'campaign_name': pageInfo.RuleConfigObj.campaign_name,
|
139
|
|
- 'daily_budget': Number(pageInfo.RuleConfigObj.daily_budget),
|
140
|
|
- 'total_budget': Number(pageInfo.RuleConfigObj.total_budget),
|
141
|
|
- 'campaign_status': pageInfo.RuleConfigObj.campaign_status,
|
142
|
|
- 'speed_mode': pageInfo.RuleConfigObj.speed_mode,
|
143
|
|
- }
|
144
|
150
|
if (item_1.ad_list.length > ad_max) {
|
145
|
151
|
function lun(num) {
|
|
152
|
+ let max_ad_list = _.cloneDeep(item_1.ad_list)
|
146
|
153
|
planNum += 1
|
147
|
154
|
acc_plan_ad_count[item.id].plan_count += 1;
|
148
|
|
- last_ad_show_list[index].chooseList.push(Object.assign(common_obj, { 'ad_list': item_1.ad_list.slice(num, (num + ad_max)) }))
|
149
|
|
- if ((num + ad_max) < item_1.ad_list.length) {
|
|
155
|
+ let list = Object.assign(_.cloneDeep(common_obj), { 'ad_list': max_ad_list.slice(num, (num + ad_max)) })
|
|
156
|
+ last_ad_show_list[index].chooseList.push(list)
|
|
157
|
+ if ((num + ad_max) < max_ad_list.length) {
|
150
|
158
|
lun(num + ad_max)
|
151
|
159
|
}
|
152
|
160
|
}
|
|
@@ -231,7 +239,9 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
|
231
|
239
|
}
|
232
|
240
|
item_ad.adcreatives_info.adcreative_name = handleName(item_ad.adcreatives_info.adcreative_name, wildcard)
|
233
|
241
|
item_ad.ad_name = handleName(item_ad.ad_name, Object.assign(wildcard, { 'dynamic': (Number(basicInfoData.fillBack.dynamic_num) + ad_count) }))
|
234
|
|
- item_ad.bid_amount = getBidAmount(ad_count, adNum)
|
|
242
|
+ item_ad.bid_amount = getBidAmount(ad_count, adNum, 'bid_amount')
|
|
243
|
+ item_ad.deep_bid_amount = getBidAmount(ad_count, adNum, 'deep_bid_amount')
|
|
244
|
+ item_ad.deep_roi = getBidAmount(ad_count, adNum, 'deep_roi')
|
235
|
245
|
item_ad.optimization_goal_name = basicInfoData.fillBack.optimization_goal_name
|
236
|
246
|
ad_count++;
|
237
|
247
|
// E 计划名、广告名、素材名
|
|
@@ -286,20 +296,61 @@ export const previewCompute = (pageInfo, cMaterial, basicInfoData_cr,) => {
|
286
|
296
|
})
|
287
|
297
|
}
|
288
|
298
|
|
289
|
|
-/**获取出价 ad_count为第几个广告,ad_total广告总数*/
|
290
|
|
-const getBidAmount = (ad_count, ad_total) => {
|
|
299
|
+/**获取出价 、 深度优化出价 、 期望ROi ad_count为第几个广告,ad_total广告总数*/
|
|
300
|
+const getBidAmount = (ad_count, ad_total, type) => {
|
|
301
|
+ if(ad_total <= 0){
|
|
302
|
+ return 0
|
|
303
|
+ }
|
|
304
|
+ let regular_way = '';
|
|
305
|
+ let min:number = 0;
|
|
306
|
+ let max:number = 0;
|
|
307
|
+ if ( type == 'bid_amount' ) {//出价
|
|
308
|
+ if( basicInfoData.fillBack.bid_way == 1 ){
|
|
309
|
+ regular_way = basicInfoData.fillBack.bid_amount
|
|
310
|
+ }
|
|
311
|
+ if ( basicInfoData.fillBack.bid_way == 3 || basicInfoData.fillBack.bid_way == 2 ) {
|
|
312
|
+ max = Number(basicInfoData.fillBack.bid_range.split('-')[1])
|
|
313
|
+ min = Number(basicInfoData.fillBack.bid_range.split('-')[0])
|
|
314
|
+ }
|
|
315
|
+ }
|
|
316
|
+ if( type == 'deep_bid_amount' && basicInfoData.fillBack.deep_conversion_behavior_spec) {//深度出价
|
|
317
|
+ let spec = JSON.parse( basicInfoData.fillBack.deep_conversion_behavior_spec )
|
|
318
|
+ if( basicInfoData.fillBack.bid_way == 1 ){
|
|
319
|
+ regular_way = spec.price
|
|
320
|
+ }
|
|
321
|
+ if ( basicInfoData.fillBack.bid_way == 3 || basicInfoData.fillBack.bid_way == 2 ) {
|
|
322
|
+ min = Number(spec?.min);
|
|
323
|
+ max = Number(spec?.max);
|
|
324
|
+ }
|
|
325
|
+ }
|
|
326
|
+ if( type == 'deep_roi' && basicInfoData.fillBack.deep_conversion_worth_spec) {//期望roi
|
|
327
|
+ let spec = JSON.parse( basicInfoData.fillBack.deep_conversion_worth_spec )
|
|
328
|
+ if( basicInfoData.fillBack.bid_way == 1 ){
|
|
329
|
+ regular_way = spec.roi
|
|
330
|
+ }
|
|
331
|
+ if ( basicInfoData.fillBack.bid_way == 3 || basicInfoData.fillBack.bid_way == 2 ) {
|
|
332
|
+ min = Number(spec?.min);
|
|
333
|
+ max = Number(spec?.max);
|
|
334
|
+ }
|
|
335
|
+ }
|
291
|
336
|
if (basicInfoData.fillBack.bid_way == 1) {//固定出价
|
292
|
|
- return basicInfoData.fillBack.bid_amount
|
|
337
|
+ return regular_way
|
|
338
|
+ }
|
|
339
|
+ if (basicInfoData.fillBack.bid_way == 2) {//随机出价
|
|
340
|
+ return parseFloat((Math.random() * (max - min) + min).toFixed(2))
|
293
|
341
|
}
|
294
|
|
- if (basicInfoData.fillBack.bid_way == 2 || basicInfoData.fillBack.bid_way == 3) {
|
295
|
|
- let max = Number(basicInfoData.fillBack.bid_range.split('-')[1])
|
296
|
|
- let min = Number(basicInfoData.fillBack.bid_range.split('-')[0])
|
297
|
|
- if (basicInfoData.fillBack.bid_way == 2) {//随机出价
|
298
|
|
- return parseFloat((Math.random() * (max - min) + min).toFixed(2))
|
|
342
|
+ if (basicInfoData.fillBack.bid_way == 3) { //阶梯出价
|
|
343
|
+ if(max == min && min == 0 ) {
|
|
344
|
+ return 0
|
|
345
|
+ }
|
|
346
|
+ if(ad_total == 1) {
|
|
347
|
+ return min
|
299
|
348
|
}
|
300
|
|
- if (basicInfoData.fillBack.bid_way == 3) { //阶梯出价
|
301
|
|
- let step = parseFloat(((max - min) / (ad_total - 1)).toFixed(2));// 计算等差差值
|
302
|
|
- return parseFloat((min + ad_count * step).toFixed(2))
|
|
349
|
+ let step = parseFloat(((max - min) / (ad_total - 1)).toFixed(2));// 计算等差差值
|
|
350
|
+ let last_num = parseFloat((min + ad_count * step).toFixed(2))
|
|
351
|
+ if( last_num > max ) {
|
|
352
|
+ last_num = max
|
303
|
353
|
}
|
|
354
|
+ return last_num
|
304
|
355
|
}
|
305
|
356
|
}
|