|
@@ -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);
|
|
@@ -54,7 +53,7 @@ class PromotionController extends CatchController
|
|
|
})->orderBy('created_at', 'desc')
|
|
|
->select('promotions.id', 'promotions.name', 'promotions.created_at',
|
|
|
'videos.name as video_name', 'promotions.series_sequence', 'promotions.callback_type',
|
|
|
- 'promotions.callback_config_id', 'promotions.video_id', 'promotions.remark', 'promotions.status', 'miniprogram.name as miniprogram_name')
|
|
|
+ 'promotions.callback_config_id', 'promotions.video_id', 'promotions.remark', 'promotions.status')
|
|
|
->paginate($request->input('limit', 15));
|
|
|
foreach ($result as $item) {
|
|
|
$item->status_str = $item->status ? '启用':'禁用';
|
|
@@ -82,12 +81,16 @@ 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])
|
|
|
->update(['series_sequence' => $request->input('series_sequence'),
|
|
|
'remark' => $request->input('remark', ''),
|
|
|
+ 'first_charge_template_id' => $request->input('first_charge_template_id'),
|
|
|
+ 'not_first_charge_template_id' => $request->input('not_first_charge_template_id'),
|
|
|
'updated_at' => date('Y-m-d H:i:s')]);
|
|
|
|
|
|
return 'ok';
|
|
@@ -99,6 +102,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')
|
|
@@ -108,6 +113,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,
|
|
|
]);
|