|
@@ -32,7 +32,6 @@ class PromotionController extends CatchController
|
|
|
$miniprogramId = $request->input('miniprogram_id');
|
|
|
$result = DB::table('promotions')
|
|
|
->leftJoin('videos', 'videos.id', '=', 'promotions.video_id')
|
|
|
- ->leftJoin('miniprogram', 'miniprogram.id', '=', 'promotions.miniprogram_id')
|
|
|
->where(['promotions.is_enabled' => 1, 'promotions.uid' => $this->getLoginUserId()])
|
|
|
->when($miniprogramId, function ($query, $miniprogramId) {
|
|
|
return $query->where('promotions.miniprogram_id', $miniprogramId);
|
|
@@ -53,9 +52,9 @@ class PromotionController extends CatchController
|
|
|
return $query->where('promotions.created_at', '<=', $endTime . ' 23:59:59');
|
|
|
})->orderBy('created_at', 'desc')
|
|
|
->select('promotions.id', 'promotions.name', 'promotions.created_at',
|
|
|
- 'videos.name as video_name', 'promotions.series_sequence', 'promotions.callback_type',
|
|
|
+ 'videos.name as video_name', 'promotions.series_sequence', 'promotions.callback_type',
|
|
|
'promotions.callback_config_id', 'promotions.video_id', 'promotions.remark', 'promotions.status',
|
|
|
- 'promotions.first_charge_template_id', 'promotions.not_first_charge_template_id')
|
|
|
+ 'promotions.first_charge_template_id', 'promotions.not_first_charge_template_id')
|
|
|
->paginate($request->input('limit', 15));
|
|
|
$chargeTemplateIds = $result->pluck('first_charge_template_id')->merge($result->pluck('not_first_charge_template_id'))->unique();
|
|
|
|
|
@@ -92,7 +91,9 @@ class PromotionController extends CatchController
|
|
|
|
|
|
public function updateSeriesSequence(Request $request) {
|
|
|
$this->validate($request, ['id' => 'required',
|
|
|
- 'series_sequence' => 'required', 'remark' => 'nullable|string|max:140']);
|
|
|
+ 'series_sequence' => 'required', 'remark' => 'nullable|string|max:140',
|
|
|
+ 'first_charge_template_id' => 'required',
|
|
|
+ 'not_first_charge_template_id' => 'required',]);
|
|
|
|
|
|
DB::table('promotions')
|
|
|
->where(['id' => $request->input('id'), 'uid' => $this->getLoginUserId(), 'is_enabled' => 1])
|
|
@@ -111,6 +112,8 @@ class PromotionController extends CatchController
|
|
|
'series_sequence' => 'required',
|
|
|
'name' => 'required',
|
|
|
'miniprogram_id' => 'required',
|
|
|
+ 'first_charge_template_id' => 'required',
|
|
|
+ 'not_first_charge_template_id' => 'required',
|
|
|
]);
|
|
|
$now = date('Y-m-d H:i:s');
|
|
|
DB::table('promotions')
|
|
@@ -120,6 +123,8 @@ class PromotionController extends CatchController
|
|
|
'name' => $request->input('name'),
|
|
|
'video_id' => $request->input('video_id'),
|
|
|
'series_sequence' => $request->input('series_sequence'),
|
|
|
+ 'first_charge_template_id' => $request->input('first_charge_template_id'),
|
|
|
+ 'not_first_charge_template_id' => $request->input('not_first_charge_template_id'),
|
|
|
'created_at' => $now,
|
|
|
'updated_at' => $now,
|
|
|
]);
|