Pārlūkot izejas kodu

增加推广链接名称

liuzejian 1 gadu atpakaļ
vecāks
revīzija
ee150a5d9b

+ 7 - 1
modules/Statistic/Http/Controllers/ROITJController.php

@@ -58,7 +58,7 @@ class ROITJController extends CatchController
         $sql = $this->_sql($request)->select(
             'day_at', 'user_id', 'puser_id', 'new_user_num', 'new_user_pay_uv',
             'cost_money', 'new_user_pay_money', 'new_user_vip_pay_money', 'new_user_common_pay_money',
-            'new_user_vip_pay_uv', 'new_user_common_pay_uv', 'miniprogram_id'
+            'new_user_vip_pay_uv', 'new_user_common_pay_uv', 'miniprogram_id', 'promotion_id'
         );
         $isExport = $request->integer('is_export', false);
         if ($isExport) {
@@ -77,6 +77,10 @@ class ROITJController extends CatchController
                 ->get()->keyBy('id');
             $companyUserName = DB::table('users')
                 ->where('id', $result->first()->puser_id)->value('username');
+            $promotions = DB::table('promotions')
+                ->whereIn('id', $result->pluck('promotion_id'))
+                ->select('id', 'name')
+                ->get()->keyBy('id');
             foreach ($result as $item) {
                 // 商户
                 $item->company_username = $companyUserName;
@@ -84,6 +88,8 @@ class ROITJController extends CatchController
                 $item->optimizer_name = $users->get($item->user_id)->username ?? '';
                 // 小程序
                 $item->miniprogram_name = $miniprograms->get($item->miniprogram_id)->name ?? '';
+                // 推广链接
+                $item->promotion_name = $promotions->get($item->promotion_id)->name ?? '';
                 // 回本
                 $item->huiben = $item->cost_money !== '0.00' ? intval($item->new_user_pay_money * 10000 / $item->cost_money) / 100 . '%' : '0%';
                 // 新增用户成本