$appId, 'album_id' => $albumId, 'seq' => $episodeInfo['seq'] ]; $attr = [ 'title' => $episodeInfo['title'], 'cover_list' => implode(',', $episodeInfo['cover_list']), 'open_video_id' => $episodeInfo['open_video_id'], 'episode_id' => $episodeId ]; $res = self::query()->updateOrCreate($con, $attr); if(!$res) { \DB::rollBack(); return false; } } \DB::commit(); return true; } public static function getList($appId, $albumId, $page, $pageSize) { $model = self::query()->where('app_id', $appId)->where('enable', 1) ->where('album_id', $albumId); $count = $model->count(); $data = $model->select(['title', 'seq', 'cover_list', 'open_video_id', 'episode_id', 'album_id']) ->orderBy('seq', 'ASC')->offset(($page - 1) * $pageSize)->limit($pageSize)->get(); return [$data, $count]; } public static function getInfo($appId, $albumId, $seq) { return self::query()->where('app_id', $appId)->where('album_id', $albumId)->where('seq', $seq) ->where('enable', 1)->first(); } public static function getInfoList($appId, $albumId, $episodeIdList) { return self::query()->where('app_id', $appId)->where('album_id', $albumId)->where('enable', 1) ->whereIn('episode_id', $episodeIdList)->get(); } }