Browse Source

Merge branch 'liuzj-1000959-dev' into test

liuzejian 1 year ago
parent
commit
55ddab9ed2
1 changed files with 9 additions and 0 deletions
  1. 9 0
      modules/Tuiguang/Http/Controllers/PromotionController.php

+ 9 - 0
modules/Tuiguang/Http/Controllers/PromotionController.php

@@ -56,6 +56,12 @@ class PromotionController extends CatchController
                 'promotions.callback_config_id', 'promotions.video_id', 'promotions.remark', 'promotions.status',
             'promotions.first_charge_template_id', 'promotions.not_first_charge_template_id')
             ->paginate($request->input('limit', 15));
+        $chargeTemplateIds = $result->pluck('first_charge_template_id')->merge('not_first_charge_template_id')->unique();
+
+        $payTemplates = DB::table('pay_templates')->whereIn('id', $chargeTemplateIds)
+            ->select('id', 'name')
+            ->get()->keyBy('id')->toArray();
+
         foreach ($result as $item) {
             $item->status_str = $item->status ? '启用':'禁用';
             $item->series_sequence_name = '第'. $item->series_sequence . '集';
@@ -65,6 +71,9 @@ class PromotionController extends CatchController
                 '/track?dycallback=1&connection_id='.$item->id.
                 '&link_source=' .( $linkSourceMap[$item->callback_type] ?? '') .
                 '&adid=__AID__&cid=__CID__&imei=__IMEI__&oaid=__OAID__&mac=__MAC__&os=__OS__&ip=__IP__&androidid=__ANDROIDID__&ua=__UA__&timestamp=__TS__&callback_url=__CALLBACK_URL__&projectid=__PROJECT_ID__&promotionid=__PROMOTION_ID__&advertiser_id=__ADVERTISER_ID__&campaign_id=__CAMPAIGN_ID__';
+            $item->first_charge_template_str = $payTemplates[$item->first_charge_template_id]->name ?? '';
+            $item->not_first_charge_template_str = $payTemplates[$item->not_first_charge_template_id]->name ?? '';
+
         }
         return $result;