|
@@ -3,18 +3,36 @@
|
|
namespace Modules\Video\Http\Controllers;
|
|
namespace Modules\Video\Http\Controllers;
|
|
|
|
|
|
use Catch\Base\CatchController;
|
|
use Catch\Base\CatchController;
|
|
|
|
+use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Request;
|
|
|
|
+use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 微信提审
|
|
* 微信提审
|
|
*/
|
|
*/
|
|
class WechatCheckController extends CatchController
|
|
class WechatCheckController extends CatchController
|
|
{
|
|
{
|
|
|
|
+ use ValidatesRequests;
|
|
/**
|
|
/**
|
|
* 添加提审
|
|
* 添加提审
|
|
* @param Request $request
|
|
* @param Request $request
|
|
*/
|
|
*/
|
|
- public function add(Request $request) {}
|
|
|
|
|
|
+ public function add(Request $request) {
|
|
|
|
+ $this->validate($request, [
|
|
|
|
+ 'video_id'=>'required',
|
|
|
|
+ 'producer' => 'required|string|max:256',
|
|
|
|
+ 'playwright' => 'required|string|max:256',
|
|
|
|
+ 'production_license_img' => 'required|url',
|
|
|
|
+ 'authorized_img' => 'required|url'
|
|
|
|
+ ]);
|
|
|
|
+
|
|
|
|
+ $data = $request->all();
|
|
|
|
+ $data['created_at'] = $data['updated_at'] = date('Y-m-d H:i:s');
|
|
|
|
+ DB::table('video_wechat_check')
|
|
|
|
+ ->insert($data);
|
|
|
|
+
|
|
|
|
+ return 'ok';
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 修改
|
|
* 修改
|
|
@@ -26,12 +44,46 @@ class WechatCheckController extends CatchController
|
|
* 删除
|
|
* 删除
|
|
* @param Request $request
|
|
* @param Request $request
|
|
*/
|
|
*/
|
|
- public function delete(Request $request) {}
|
|
|
|
|
|
+ public function delete(Request $request) {
|
|
|
|
+ $this->validate($request, ['id' => 'required']);
|
|
|
|
+ DB::table('video_wechat_check')
|
|
|
|
+ ->where([
|
|
|
|
+ 'id' => $request->input('id'),
|
|
|
|
+ 'is_enabled' => 1,
|
|
|
|
+ ])->update([
|
|
|
|
+ 'is_enabled' => 0,
|
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s')
|
|
|
|
+ ]);
|
|
|
|
+
|
|
|
|
+ return 'ok';
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 提审记录列表
|
|
* 提审记录列表
|
|
* @param Request $request
|
|
* @param Request $request
|
|
*/
|
|
*/
|
|
public function list(Request $request) {
|
|
public function list(Request $request) {
|
|
|
|
+ $videoId = $request->input('video_id');
|
|
|
|
+ $producer = $request->input('producer');
|
|
|
|
+ $playwright = $request->input('playwright');
|
|
|
|
+ $status = $request->input('status',0);
|
|
|
|
+
|
|
|
|
+ return DB::table('video_wechat_check as check')
|
|
|
|
+ ->join('videos', 'videos.id', 'check.video_id')
|
|
|
|
+ ->where([
|
|
|
|
+ 'check.status' => $status,
|
|
|
|
+ 'check.is_enabled' => 1,
|
|
|
|
+ ])->when($videoId, function ($query, $videoId) {
|
|
|
|
+ return $query->where('check.video_id', $videoId);
|
|
|
|
+ })->when($producer, function ($query, $producer){
|
|
|
|
+ return $query->where('check.producer', 'like', '%'. $producer. '%');
|
|
|
|
+ })->when($playwright, function ($query, $playwright){
|
|
|
|
+ return $query->where('check.playwright', 'like', '%'. $playwright. '%');
|
|
|
|
+ })->select('check.id', 'videos.name', 'videos.note', 'videos.total_episode_num',
|
|
|
|
+ 'videos.cover_image','check.status','check.producer',
|
|
|
|
+ 'check.playwright', 'check.production_license_img', 'check.authorized_img', 'check.apply_at',
|
|
|
|
+ 'check.check_at', 'check.check_reason')
|
|
|
|
+ ->orderBy('check.id','desc')
|
|
|
|
+ ->paginate($request->input('limit', 10));
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|