$msg, 'err_msg' => '必要响应参数缺失']); return 500; } # 验证小程序appid $res = self::checkAppId($appId); if(!$res) { Log::logError('uoload_video_callback', ['msg_data' => $msg, 'err_msg' => '小程序app_id不合法']); return 500; } # 验证视频id是否存在 $videoInfo = Material::getVideoInfo($appId, $openVideoId); if(empty($videoInfo)) { Log::logError('uoload_video_callback', ['msg_data' => $msg, 'err_msg' => '视频ID不在系统中']); return 500; } if($success && 2 != $videoInfo->status){ $status = 2; # 更新视频状态 $res = Material::updateVideoStatus($appId, $openVideoId, $status); if(!$res) { Log::logError('uoload_video_callback', ['msg_data' => $msg, 'err_msg' => '更新视频状态失败']); return 500; } } return 0; } public static function albumAuditCallBack($msg, $v) { /** { "ma_app_id":"tt498f3f32d6xxxxxxxx", "album_id":7270100931638329856, "version":1, "audit_status":1, "scope_list":"["可播放","可挂载"]", "audit_msg":"[23-24]错别字字幕" } */ $appId = $msg['ma_app_id'] ?? null; $albumId = $msg['album_id'] ?? null; $version = $msg['version'] ?? null; $scopeList = $msg['scope_list'] ?? null; $auditStatus = $msg['audit_status'] ?? null; $auditMsg = $msg['audit_msg'] ?? null; if(is_null($appId) || is_null($albumId) || is_null($version) || is_null($scopeList) || is_null($auditStatus)) { Log::logError('album_audit_callback', ['msg_data' => $msg, 'err_msg' => '必要响应参数缺失']); return 500; # 参数异常 } # 验证小程序appid $res = self::checkAppId($appId); if(!$res) { Log::logError('album_audit_callback', ['msg_data' => $msg, 'err_msg' => '小程序app_id不合法']); return 500; } # 验证短剧ID是否存在,不存在时需要通过脚本同步一遍短剧列表 $albumInfo = Album::getInfo($appId, $albumId); if(empty($albumInfo)) { RedisModel::lPush(Album::SYNC_ALBUM_LIST, json_encode([ 'app_id' => $appId, 'album_id' => $albumId ], 256)); return 0; } # 审核状态格式化 switch($auditStatus) { case 1:# 审核不通过 $auditStatus = 3; break; case 2: # 审核通过 $auditStatus = 4; break; default: return 500; } if($auditStatus != $albumInfo->audit_status) { # 判断审核状态,修改系统中短剧审核信息 $res = Album::updateAuditStatus($appId, $albumId, $version, json_encode($scopeList), $auditStatus, $auditMsg); if(!$res) { return 500; } } return 0; } public static function postReviewCallBack($msg, $v) { /** { "review_id":"RT7358655xxxxxxxx", "album_id":"7358397726xxxxxxxx", "episode_id":"7358397751xxxxxxxx", "app_id":"tt19b56f0886xxxxxxxx", "review_type":"path重定向校验", "review_result":"REJECT", "tips":"绑定path存在重定向问题", "review_init_timestamp":1713322906 } */ $appId = $msg['app_id'] ?? null; $reviewId = $msg['review_id'] ?? null; $reviewType = $msg['review_type'] ?? null; $albumId = $msg['album_id'] ?? null; $episodeId = $msg['episode_id'] ?? null; $reviewResult = $msg['review_result'] ?? null; $failReason = $msg['fail_reason'] ?? null; $tips = $msg['tips'] ?? null; if(is_null($appId) || is_null($reviewId) || is_null($reviewType) || is_null($albumId) || is_null($reviewResult)) { return 500; # 参数异常 } # 验证小程序appid $res = self::checkAppId($appId); if(!$res) { return 500; } } public static function checkAppId($appId) { $appConfig = config('douyin.app_info'); $appIdList = array_keys($appConfig); if(!is_array($appId, $appIdList)) { return false; } return true; } }