|
@@ -124,6 +124,8 @@ class PopularizService
|
124
|
124
|
$datum->payUv = 0;
|
125
|
125
|
$datum->payPv = 0;
|
126
|
126
|
$datum->payMoney = 0;
|
|
127
|
+ $datum->newPayUv = 0;
|
|
128
|
+ $datum->newPayPv = 0;
|
127
|
129
|
$datum->newPayAmount = 0;
|
128
|
130
|
$datum->oldPayAmount = 0;
|
129
|
131
|
$datum->otherPayAmount = 0;
|
|
@@ -232,8 +234,15 @@ class PopularizService
|
232
|
234
|
->whereIn('rule_id', $ruleIds)->groupBy(['rule_id'])->get();
|
233
|
235
|
|
234
|
236
|
#统计回收信息
|
235
|
|
- $pids = $list->pluck('pid')->all();
|
236
|
|
- $pids = array_filter($pids);
|
|
237
|
+ $pids = [];
|
|
238
|
+ $pidVals = $list->pluck('pid')->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
|
+
|
237
|
246
|
if( !empty($pids) ){
|
238
|
247
|
$popu_data = MassPopularizData::select('viewPv', 'viewUv', 'payPv', 'payUv', 'payMoney', 'pid', 'playletActivityId')
|
239
|
248
|
->whereIn('pid', $pids)
|
|
@@ -286,35 +295,55 @@ class PopularizService
|
286
|
295
|
|
287
|
296
|
unset($datum->admin_id);
|
288
|
297
|
|
289
|
|
- $pid = $datum->pid;
|
|
298
|
+ $datumPids = json_decode($datum->pid, true);
|
290
|
299
|
#统计 总播放人数(:总uv) 充值人数 充值次数(今日) 充值金额(今日) 付费率 点击率
|
291
|
|
- if($pid){
|
292
|
|
- $popu_info = $popu_data->where('pid', $pid)->first();
|
293
|
|
-
|
294
|
|
- $datum->viewUv = $popu_info->viewUv ?? null;
|
295
|
|
- $datum->payUv = $popu_info->payUv ?? null;
|
296
|
|
- $datum->payPv = $popu_info->payPv ?? null;
|
297
|
|
- $datum->payMoney = $popu_info->payMoney ?? null;
|
|
300
|
+ if($datumPids){
|
298
|
301
|
$datum->payAvg = $datum->payUv>0 ? round($datum->payPv/$datum->payUv, 2) : null;
|
299
|
302
|
$datum->payRate = $datum->viewUv>0 ? round($datum->payUv/$datum->viewUv*100, 2) .'%' : null;
|
300
|
303
|
$datum->clickRate = $datum->published_count>0 ? round($datum->viewUv/$datum->published_count*100, 2) .'%' : null;
|
301
|
304
|
|
302
|
|
- if(isset($popu_info->playletActivityId)) {
|
303
|
|
- $datum->newPayUv = $orderData[$popu_info->playletActivityId]['newPayUv'] ?? null;
|
304
|
|
- $datum->newPayPv = $orderData[$popu_info->playletActivityId]['newPayPv'] ?? null;
|
305
|
|
- $datum->newPayAmount = isset($orderData[$popu_info->playletActivityId]['newPayAmount']) ? round($orderData[$popu_info->playletActivityId]['newPayAmount']/10000, 2) : null;
|
306
|
|
- $datum->oldPayAmount = isset($orderData[$popu_info->playletActivityId]['oldPayAmount']) ? round($orderData[$popu_info->playletActivityId]['oldPayAmount']/10000, 2) : null;
|
307
|
|
- $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;
|
308
|
335
|
} else {
|
309
|
|
- $datum->newPayUv = null;
|
310
|
|
- $datum->newPayPv = null;
|
311
|
|
- $datum->newPayAmount = null;
|
312
|
|
- $datum->oldPayAmount = null;
|
313
|
|
- $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;
|
314
|
346
|
}
|
315
|
|
-
|
316
|
|
- $datum->newPayAvg = $datum->newPayUv>0 ? round($datum->newPayPv/$datum->newPayUv, 2) : null;
|
317
|
|
-
|
318
|
347
|
} else {
|
319
|
348
|
$datum->viewUv = null;
|
320
|
349
|
$datum->payUv = null;
|