Преглед на файлове

Merge branch 'liuzj-weixin-tishen-dev' into liuzj-06-29

# Conflicts:
#	modules/Common/Errors/Errors.php
liuzejian преди 1 година
родител
ревизия
2e96a9e557

+ 1 - 0
modules/Common/Errors/Errors.php

@@ -37,4 +37,5 @@ class Errors
     public const  GET_WECHAT_MEDIA_LINK_ERROR = [500304, '获取短剧播放链接失败'];
     public const  OPENPLATFORM_COMPANY_INFO_NOT_EXISTS= [5000601, '公司没有对应的开放平台信息'];
     public const  OPENPLATFORM_OPTIMIZER_INFO_ERROR= [5000602, '优化师信息有误'];
+    public const  WECHAT_CHECK_RECORD_NOT_EXISTS = [500305, '微信提审记录不存在'];
 }

+ 1 - 1
modules/Video/Http/Controllers/VideoSeriesWechatCheckController.php

@@ -107,8 +107,8 @@ class VideoSeriesWechatCheckController extends CatchController
         if($info) {
             $evidence_material_id_lists = \json_decode($info->evidence_material_id_list, true);
             $accessToken = WechatMiniprogramService::getDuanjuCheckAccessToken($info->appid);
-
         }
+        return 'todo:待完善';
     }
 
     public function test(Request $request) {

+ 24 - 0
modules/Video/Http/Controllers/WechatCheckController.php

@@ -7,6 +7,8 @@ use Catch\Base\CatchController;
 use Illuminate\Foundation\Validation\ValidatesRequests;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
+use Modules\Common\Errors\Errors;
+use Modules\Common\Exceptions\CommonBusinessException;
 use Modules\Manage\Services\WechatMiniprogramService;
 
 /**
@@ -126,6 +128,28 @@ class WechatCheckController extends CatchController
         ]);
         $ids = $request->input('ids');
         $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')
             ->whereIn('id', $ids)
             ->whereIn('status', [0, 4])

+ 0 - 1
modules/Video/Services/WechatCheckSyncService.php

@@ -34,7 +34,6 @@ class WechatCheckSyncService
      * @throws \GuzzleHttp\Exception\GuzzleException
      */
     public static function getMedialinkInfo($seriesId) {
-        return ['mp4_url' => 'http://www.baidu.com'];
         $syncInfo = DB::table('video_series_wechat_check')
             ->where([
                 'series_id'=> $seriesId,

+ 1 - 0
modules/Video/routes/route.php

@@ -28,6 +28,7 @@ Route::prefix('videoStock')->group(function () {
         Route::prefix('videoSeries')->group(function(){
             Route::post('syncWechat', [VideoSeriesWechatCheckController::class, 'syncWechat']);
             Route::post('medialink', [VideoSeriesWechatCheckController::class, 'medialink']);
+            Route::post('listEvidence', [VideoSeriesWechatCheckController::class, 'listEvidence']);
             Route::get('test', [VideoSeriesWechatCheckController::class, 'test'])->withoutMiddleware(config('catch.route.middlewares'));
         });
     });