|
@@ -44,8 +44,15 @@ class PopularizService
|
44
|
44
|
->whereIn('rule_id', $ruleIds)->groupBy(['rule_id'])->get();
|
45
|
45
|
|
46
|
46
|
#统计回收信息
|
47
|
|
- $pids = $list->pluck('pid')->all();
|
48
|
|
- $pids = array_filter($pids);
|
|
47
|
+ $pids = [];
|
|
48
|
+ $pidVals = $list->pluck('pids')->all();
|
|
49
|
+ foreach ($pidVals as $pidVal) {
|
|
50
|
+ if (empty($pidVal)) continue;
|
|
51
|
+
|
|
52
|
+ $itemPids = json_decode($pidVal, true);
|
|
53
|
+ $pids = array_merge($pids, $itemPids);
|
|
54
|
+ }
|
|
55
|
+
|
49
|
56
|
if( !empty($pids) ){
|
50
|
57
|
$popu_data = MassPopularizData::select('viewPv', 'viewUv', 'payPv', 'payUv', 'payMoney', 'pid', 'playletActivityId')
|
51
|
58
|
->whereIn('pid', $pids)
|
|
@@ -102,35 +109,57 @@ class PopularizService
|
102
|
109
|
$datum->send_total = isset($sendStatInfo->send_total) ? $sendStatInfo->send_total : 0;
|
103
|
110
|
unset($datum->admin_id);
|
104
|
111
|
|
105
|
|
- $pid = $datum->pid;
|
|
112
|
+ $datumPids = json_decode($datum->pids, true);
|
106
|
113
|
#统计 总播放人数(:总uv) 充值人数 充值次数(今日) 充值金额(今日) 付费率 点击率
|
107
|
|
- if($pid){
|
108
|
|
- $popu_info = $popu_data->where('pid', $pid)->first();
|
109
|
|
-
|
110
|
|
- $datum->viewUv = $popu_info->viewUv ?? null;
|
111
|
|
- $datum->payUv = $popu_info->payUv ?? null;
|
112
|
|
- $datum->payPv = $popu_info->payPv ?? null;
|
113
|
|
- $datum->payMoney = $popu_info->payMoney ?? null;
|
|
114
|
+ if($datumPids){
|
114
|
115
|
$datum->payAvg = $datum->payUv>0 ? round($datum->payPv/$datum->payUv, 2) : null;
|
115
|
116
|
$datum->payRate = $datum->viewUv>0 ? round($datum->payUv/$datum->viewUv*100, 2) .'%' : null;
|
116
|
117
|
$datum->clickRate = $datum->send_success>0 ? round($datum->viewUv/$datum->send_success*100, 2) .'%' : null;
|
117
|
118
|
|
118
|
|
- if(isset($popu_info->playletActivityId)) {
|
119
|
|
- $datum->newPayUv = $orderData[$popu_info->playletActivityId]['newPayUv'] ?? null;
|
120
|
|
- $datum->newPayPv = $orderData[$popu_info->playletActivityId]['newPayPv'] ?? null;
|
121
|
|
- $datum->newPayAmount = isset($orderData[$popu_info->playletActivityId]['newPayAmount']) ? round($orderData[$popu_info->playletActivityId]['newPayAmount']/10000, 2) : null;
|
122
|
|
- $datum->oldPayAmount = isset($orderData[$popu_info->playletActivityId]['oldPayAmount']) ? round($orderData[$popu_info->playletActivityId]['oldPayAmount']/10000, 2) : null;
|
123
|
|
- $datum->otherPayAmount = isset($otherOrderData[$popu_info->playletActivityId]['otherPayAmount']) ? round($otherOrderData[$popu_info->playletActivityId]['otherPayAmount']/10000, 2) : null;
|
|
119
|
+ $popu_list = MassPopularizData::select('viewPv', 'viewUv', 'payPv', 'payUv', 'payMoney', 'pid', 'playletActivityId')
|
|
120
|
+ ->whereIn('pid', $datumPids)
|
|
121
|
+ ->get();
|
|
122
|
+ if ($popu_list->isNotEmpty()) {
|
|
123
|
+ $datum->viewUv = 0;
|
|
124
|
+ $datum->payUv = 0;
|
|
125
|
+ $datum->payPv = 0;
|
|
126
|
+ $datum->payMoney = 0;
|
|
127
|
+ $datum->newPayUv = 0;
|
|
128
|
+ $datum->newPayPv = 0;
|
|
129
|
+ $datum->newPayAmount = 0;
|
|
130
|
+ $datum->oldPayAmount = 0;
|
|
131
|
+ $datum->otherPayAmount = 0;
|
|
132
|
+ foreach ($popu_list as $popu_info) {
|
|
133
|
+ $datum->viewUv += ($popu_info->viewUv ?? 0);
|
|
134
|
+ $datum->payUv += ($popu_info->payUv ?? 0);
|
|
135
|
+ $datum->payPv += ($popu_info->payPv ?? 0);
|
|
136
|
+ $datum->payMoney += ($popu_info->payMoney ?? 0);
|
|
137
|
+
|
|
138
|
+ if(isset($popu_info->playletActivityId)) {
|
|
139
|
+ $datum->newPayUv += ($orderData[$popu_info->playletActivityId]['newPayUv'] ?? 0);
|
|
140
|
+ $datum->newPayPv += ($orderData[$popu_info->playletActivityId]['newPayPv'] ?? 0);
|
|
141
|
+ $datum->newPayAmount += ($orderData[$popu_info->playletActivityId]['newPayAmount'] ?? 0);
|
|
142
|
+ $datum->oldPayAmount += ($orderData[$popu_info->playletActivityId]['oldPayAmount'] ?? 0);
|
|
143
|
+ $datum->otherPayAmount += ($otherOrderData[$popu_info->playletActivityId]['otherPayAmount'] ?? 0);
|
|
144
|
+ }
|
|
145
|
+ }
|
|
146
|
+
|
|
147
|
+ $datum->newPayAmount = round($orderData[$popu_info->playletActivityId]['newPayAmount']/10000, 2);
|
|
148
|
+ $datum->oldPayAmount = round($orderData[$popu_info->playletActivityId]['oldPayAmount']/10000, 2);
|
|
149
|
+ $datum->otherPayAmount = round($otherOrderData[$popu_info->playletActivityId]['otherPayAmount']/10000, 2);
|
|
150
|
+ $datum->newPayAvg = $datum->newPayUv>0 ? round($datum->newPayPv/$datum->newPayUv, 2) : null;
|
124
|
151
|
} else {
|
125
|
|
- $datum->newPayUv = null;
|
126
|
|
- $datum->newPayPv = null;
|
127
|
|
- $datum->newPayAmount = null;
|
128
|
|
- $datum->oldPayAmount = null;
|
|
152
|
+ $datum->viewUv = null;
|
|
153
|
+ $datum->payUv = null;
|
|
154
|
+ $datum->payPv = null;
|
|
155
|
+ $datum->payMoney = null;
|
|
156
|
+ $datum->newPayUv = null;
|
|
157
|
+ $datum->newPayPv = null;
|
|
158
|
+ $datum->newPayAmount = null;
|
|
159
|
+ $datum->oldPayAmount = null;
|
129
|
160
|
$datum->otherPayAmount = null;
|
|
161
|
+ $datum->newPayAvg = null;
|
130
|
162
|
}
|
131
|
|
-
|
132
|
|
- $datum->newPayAvg = $datum->newPayUv>0 ? round($datum->newPayPv/$datum->newPayUv, 2) : null;
|
133
|
|
-
|
134
|
163
|
} else {
|
135
|
164
|
$datum->viewUv = null;
|
136
|
165
|
$datum->payUv = null;
|
|
@@ -205,8 +234,15 @@ class PopularizService
|
205
|
234
|
->whereIn('rule_id', $ruleIds)->groupBy(['rule_id'])->get();
|
206
|
235
|
|
207
|
236
|
#统计回收信息
|
208
|
|
- $pids = $list->pluck('pid')->all();
|
209
|
|
- $pids = array_filter($pids);
|
|
237
|
+ $pids = [];
|
|
238
|
+ $pidVals = $list->pluck('pids')->all();
|
|
239
|
+ foreach ($pidVals as $pidVal) {
|
|
240
|
+ if (empty($pidVal)) continue;
|
|
241
|
+
|
|
242
|
+ $itemPids = json_decode($pidVal, true);
|
|
243
|
+ $pids = array_merge($pids, $itemPids);
|
|
244
|
+ }
|
|
245
|
+
|
210
|
246
|
if( !empty($pids) ){
|
211
|
247
|
$popu_data = MassPopularizData::select('viewPv', 'viewUv', 'payPv', 'payUv', 'payMoney', 'pid', 'playletActivityId')
|
212
|
248
|
->whereIn('pid', $pids)
|
|
@@ -259,35 +295,55 @@ class PopularizService
|
259
|
295
|
|
260
|
296
|
unset($datum->admin_id);
|
261
|
297
|
|
262
|
|
- $pid = $datum->pid;
|
|
298
|
+ $datumPids = json_decode($datum->pids, true);
|
263
|
299
|
#统计 总播放人数(:总uv) 充值人数 充值次数(今日) 充值金额(今日) 付费率 点击率
|
264
|
|
- if($pid){
|
265
|
|
- $popu_info = $popu_data->where('pid', $pid)->first();
|
266
|
|
-
|
267
|
|
- $datum->viewUv = $popu_info->viewUv ?? null;
|
268
|
|
- $datum->payUv = $popu_info->payUv ?? null;
|
269
|
|
- $datum->payPv = $popu_info->payPv ?? null;
|
270
|
|
- $datum->payMoney = $popu_info->payMoney ?? null;
|
|
300
|
+ if($datumPids){
|
271
|
301
|
$datum->payAvg = $datum->payUv>0 ? round($datum->payPv/$datum->payUv, 2) : null;
|
272
|
302
|
$datum->payRate = $datum->viewUv>0 ? round($datum->payUv/$datum->viewUv*100, 2) .'%' : null;
|
273
|
303
|
$datum->clickRate = $datum->published_count>0 ? round($datum->viewUv/$datum->published_count*100, 2) .'%' : null;
|
274
|
304
|
|
275
|
|
- if(isset($popu_info->playletActivityId)) {
|
276
|
|
- $datum->newPayUv = $orderData[$popu_info->playletActivityId]['newPayUv'] ?? null;
|
277
|
|
- $datum->newPayPv = $orderData[$popu_info->playletActivityId]['newPayPv'] ?? null;
|
278
|
|
- $datum->newPayAmount = isset($orderData[$popu_info->playletActivityId]['newPayAmount']) ? round($orderData[$popu_info->playletActivityId]['newPayAmount']/10000, 2) : null;
|
279
|
|
- $datum->oldPayAmount = isset($orderData[$popu_info->playletActivityId]['oldPayAmount']) ? round($orderData[$popu_info->playletActivityId]['oldPayAmount']/10000, 2) : null;
|
280
|
|
- $datum->otherPayAmount = isset($otherOrderData[$popu_info->playletActivityId]['otherPayAmount']) ? round($otherOrderData[$popu_info->playletActivityId]['otherPayAmount']/10000, 2) : null;
|
|
305
|
+ $popu_list = MassPopularizData::select('viewPv', 'viewUv', 'payPv', 'payUv', 'payMoney', 'pid', 'playletActivityId')
|
|
306
|
+ ->whereIn('pid', $datumPids)
|
|
307
|
+ ->get();
|
|
308
|
+ if ($popu_list->isNotEmpty()) {
|
|
309
|
+ $datum->viewUv = 0;
|
|
310
|
+ $datum->payUv = 0;
|
|
311
|
+ $datum->payPv = 0;
|
|
312
|
+ $datum->payMoney = 0;
|
|
313
|
+ $datum->newPayUv = 0;
|
|
314
|
+ $datum->newPayPv = 0;
|
|
315
|
+ $datum->newPayAmount = 0;
|
|
316
|
+ $datum->oldPayAmount = 0;
|
|
317
|
+ $datum->otherPayAmount = 0;
|
|
318
|
+ foreach ($popu_list as $popu_info) {
|
|
319
|
+ $datum->viewUv += ($popu_info->viewUv ?? 0);
|
|
320
|
+ $datum->payUv += ($popu_info->payUv ?? 0);
|
|
321
|
+ $datum->payPv += ($popu_info->payPv ?? 0);
|
|
322
|
+ $datum->payMoney += ($popu_info->payMoney ?? 0);
|
|
323
|
+ if(isset($popu_info->playletActivityId)) {
|
|
324
|
+ $datum->newPayUv += ($orderData[$popu_info->playletActivityId]['newPayUv'] ?? 0);
|
|
325
|
+ $datum->newPayPv += ($orderData[$popu_info->playletActivityId]['newPayPv'] ?? 0);
|
|
326
|
+ $datum->newPayAmount += ($orderData[$popu_info->playletActivityId]['newPayAmount'] ?? 0);
|
|
327
|
+ $datum->oldPayAmount += ($orderData[$popu_info->playletActivityId]['oldPayAmount'] ?? 0);
|
|
328
|
+ $datum->otherPayAmount += ($otherOrderData[$popu_info->playletActivityId]['otherPayAmount'] ?? 0);
|
|
329
|
+ }
|
|
330
|
+ }
|
|
331
|
+ $datum->newPayAmount = round($orderData[$popu_info->playletActivityId]['newPayAmount']/10000, 2);
|
|
332
|
+ $datum->oldPayAmount = round($orderData[$popu_info->playletActivityId]['oldPayAmount']/10000, 2);
|
|
333
|
+ $datum->otherPayAmount = round($otherOrderData[$popu_info->playletActivityId]['otherPayAmount']/10000, 2);
|
|
334
|
+ $datum->newPayAvg = $datum->newPayUv>0 ? round($datum->newPayPv/$datum->newPayUv, 2) : null;
|
281
|
335
|
} else {
|
282
|
|
- $datum->newPayUv = null;
|
283
|
|
- $datum->newPayPv = null;
|
284
|
|
- $datum->newPayAmount = null;
|
285
|
|
- $datum->oldPayAmount = null;
|
286
|
|
- $datum->otherPayAmount = null;
|
|
336
|
+ $datum->viewUv = 0;
|
|
337
|
+ $datum->payUv = 0;
|
|
338
|
+ $datum->payPv = 0;
|
|
339
|
+ $datum->payMoney = 0;
|
|
340
|
+ $datum->newPayUv = 0;
|
|
341
|
+ $datum->newPayPv = 0;
|
|
342
|
+ $datum->newPayAmount = 0;
|
|
343
|
+ $datum->oldPayAmount = 0;
|
|
344
|
+ $datum->otherPayAmount = 0;
|
|
345
|
+ $datum->newPayAvg = 0;
|
287
|
346
|
}
|
288
|
|
-
|
289
|
|
- $datum->newPayAvg = $datum->newPayUv>0 ? round($datum->newPayPv/$datum->newPayUv, 2) : null;
|
290
|
|
-
|
291
|
347
|
} else {
|
292
|
348
|
$datum->viewUv = null;
|
293
|
349
|
$datum->payUv = null;
|