|
@@ -7,6 +7,8 @@ use Catch\Base\CatchController;
|
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
+use Modules\Common\Errors\Errors;
|
|
|
|
+use Modules\Common\Exceptions\CommonBusinessException;
|
|
use Modules\Manage\Services\WechatMiniprogramService;
|
|
use Modules\Manage\Services\WechatMiniprogramService;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -126,6 +128,28 @@ class WechatCheckController extends CatchController
|
|
]);
|
|
]);
|
|
$ids = $request->input('ids');
|
|
$ids = $request->input('ids');
|
|
$now = date('Y-m-d H:i:s');
|
|
$now = date('Y-m-d H:i:s');
|
|
|
|
+
|
|
|
|
+ foreach ($ids as $id) {
|
|
|
|
+ $record = DB::table('video_wechat_check as check')
|
|
|
|
+ ->join('videos', 'videos.id', 'check.video_id')
|
|
|
|
+ ->where(['check.is_enabled' => 1, 'check.id' => $id])
|
|
|
|
+ ->select('check.video_id', 'videos.total_episode_num', 'videos.name')
|
|
|
|
+ ->first();
|
|
|
|
+ if(!$record) {
|
|
|
|
+ CommonBusinessException::throwError(Errors::WECHAT_CHECK_RECORD_NOT_EXISTS);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $medias = DB::table('video_series_wechat_check')
|
|
|
|
+ ->where('video_id', $record->video_id)
|
|
|
|
+ ->where(['sync_status' => 4, 'is_enabled' => 1])
|
|
|
|
+ ->where('media_id', '<>', 0)
|
|
|
|
+ ->get();
|
|
|
|
+ if($medias->count() != $record->total_episode_num) {
|
|
|
|
+ CommonBusinessException::throwError([Errors::SYNC_WECHAT_NOT_OK[0],
|
|
|
|
+ sprintf('%s,同步到微信:%s集,总集数:%s集', $record->name, $medias->count(), $record->total_episode_num)]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
DB::table('video_wechat_check')
|
|
DB::table('video_wechat_check')
|
|
->whereIn('id', $ids)
|
|
->whereIn('id', $ids)
|
|
->whereIn('status', [0, 4])
|
|
->whereIn('status', [0, 4])
|