### Install Think-Queue Source: https://github.com/magicblack/maccms10/blob/master/vendor/topthink/think-queue/README.md Use Composer to install the Think-Queue package. ```bash composer require topthink/think-queue ``` -------------------------------- ### Install Think-Captcha using Composer Source: https://github.com/magicblack/maccms10/blob/master/vendor/topthink/think-captcha/README.md Use Composer to install the think-captcha library. ```bash composer require topthink/think-captcha ``` -------------------------------- ### Listen for Tasks Source: https://github.com/magicblack/maccms10/blob/master/vendor/topthink/think-queue/README.md Start listening for tasks in the queue using the `php think queue:listen` command. ```bash php think queue:listen ``` -------------------------------- ### Initialize Layui Form Module Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view/manga/batch.html Initializes the Layui form module. This is a common setup step for forms using the Layui framework. ```javascript layui.use(['form'], function () { }); ``` -------------------------------- ### Displaying Videos by Time (First Batch) Source: https://github.com/magicblack/maccms10/blob/master/template/default/html/module/typeho.html Displays a batch of 18 videos for a given area, ordered by time in descending order, starting from the first video. ```html {maccms:vod num="18" type="current" area="''.$vo1.''.'" order="desc" by="time"} {include file="widget/vod_box"} {/maccms:vod} ``` -------------------------------- ### AJAX Plugin Install/Uninstall (JavaScript) Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view_new/box/index.html Handles AJAX requests for installing or uninstalling plugins. Reloads the list upon successful completion. ```javascript $(document).on('click', '.btn-uninstall,.btn-install', function() { $.ajax({ type: 'get', dataType:'json', url: "{:url('uninstall')}", data:{name:$(this).attr('data-name'),action:$(this).attr('data-action'),force:0}, success:function($r){ if($r.code ==1){ load_list(); } layer.msg($r.msg) } }); }); ``` -------------------------------- ### Displaying Videos by Time (Second Batch) Source: https://github.com/magicblack/maccms10/blob/master/template/default/html/module/typeho.html Displays a batch of 18 videos for a given area, ordered by time in descending order, starting from the 19th video. ```html {maccms:vod num="18" type="current" area="''.$vo1.''.'" start="19" order="desc" by="time"} {include file="widget/vod_box"} {/maccms:vod} ``` -------------------------------- ### Initialize Player or Add Download Source Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view_new/vod/info.html Checks if there are any existing player or download source configurations. If none exist, it triggers the 'Add Player' action. ```javascript if(players\_arr\_len==0 && downers\_arr\_len==0) { $('.j-player-add').click(); } ``` -------------------------------- ### Get Recommended Actors Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a list of recommended actors. ```APIDOC ## GET /api.php/actor/get_recommend/ ### Description Retrieves a list of recommended actors, with options to specify IDs or retrieve a certain number. ### Method GET ### Endpoint /api.php/actor/get_recommend/ ### Parameters #### Query Parameters - **ids** (string) - Optional - Comma-separated list of actor IDs. - **num** (number) - Optional - The number of actors to retrieve (defaults to 8). - **start** (number) - Optional - Offset for pagination (defaults to 0). - **by** (string) - Optional - Sorting field (defaults to 'time', options: hits, hits_day, hits_week, hits_month, time) ### Response #### Success Response (200) - Each actor object includes `actor_link` and `actor_pic`. ``` -------------------------------- ### Initialize Layui and Handle Tab Switching Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view_new/addon/index.html Initializes Layui modules and sets up event listeners for tab switching. Loads addon lists based on the selected tab. ```javascript layui.use(['form','laypage', 'layer','upload','element'], function() { // 操作对象 var form = layui.form , layer = layui.layer , upload = layui.upload ,element = layui.element; //监听Tab切换 element.on('tab(tabs)', function(data){ if(data.index <2){ url = $(this).attr('data-href'); load_list(); } }); }); ``` -------------------------------- ### Get Latest Articles Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a list of the latest articles. ```APIDOC ## GET /api.php/art/get_latest/ ### Description Retrieves a list of the most recent articles. ### Method GET ### Endpoint /api.php/art/get_latest/ ### Parameters #### Query Parameters - **num** (number) - Optional - The number of articles to retrieve (defaults to 24) - **type_id** (number) - Optional - Filter by category ID - **start** (number) - Optional - Offset for pagination (defaults to 0) ### Response #### Success Response (200) - Each article object includes `art_link`, `art_pic`, and `art_time_text`. ``` -------------------------------- ### Get Comment List Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a list of comments for a given resource. ```APIDOC ## GET /api.php/comment/get_list/ ### Description Retrieves a list of comments for a specific resource, with pagination and sorting options. ### Method GET ### Endpoint /api.php/comment/get_list/ ### Parameters #### Query Parameters - **rid** (number) - Required - Resource ID (1..MAX) - **mid** (number) - Required - Module ID (1..99) - **offset** (number) - Optional - Pagination offset (defaults to 0) - **limit** (number) - Optional - Number of comments per page (1..100, defaults to 20) - **orderby** (string) - Optional - Sorting field (time, up, down, id; defaults to time) ### Response #### Success Response (200) - **code** (number) - Indicates success (1 for success) - **msg** (string) - Status message - **info** (object) - Contains pagination info and comments: `offset`, `limit`, `total`, `page`, `pagecount`, `rows`. - **rows** (array) - Array of comments. Each comment may contain a `sub` array for replies and fields like `user_portrait`, `comment_content`, `comment_time_iso`, etc. ``` -------------------------------- ### Initialize Video.js Player with Options Source: https://github.com/magicblack/maccms10/blob/master/static_new/player/videojs.html Configures and initializes a Video.js player instance with specified sources and playback rates. User preferences for playback speed are loaded from local storage. ```javascript var PLAYBACK_SPEEDS = [0.5, 0.75, 1, 1.25, 1.5, 2]; var LS_SPEED_KEY = 'mac_videojs_playback_speed'; var LS_QUALITY_KEY = 'mac_videojs_quality_name'; function detectMime(url) { url = String(url || ''); if (url.indexOf('.m3u8') > -1) return 'application/x-mpegURL'; if (url.indexOf('.mkv') > -1) return 'video/x-matroska'; return 'video/mp4'; } function parseQualityFromUrl(raw) { raw = String(raw || '').trim(); if (!raw || raw.indexOf('$') === -1) return null; var sep = raw.indexOf('$$') > -1 ? '$$' : (raw.indexOf('#') > -1 ? '#' : ''); if (!sep) return null; var segments = raw.split(sep); var out = []; for (var i = 0; i < segments.length; i++) { var seg = String(segments[i] || '').trim(); if (!seg) continue; var pos = seg.indexOf('$'); if (pos <= 0) return null; var name = seg.slice(0, pos).trim(); var url = seg.slice(pos + 1).trim(); if (!name || !url) return null; if (!/^https?:\/\//i.test(url) && url.indexOf('.') === -1 && url.indexOf('magnet:') !== 0) { return null; } out.push({ name: name, url: url }); } return out.length >= 2 ? out : null; } function readSavedQualityName() { try { return String(window.localStorage.getItem(LS_QUALITY_KEY) || '').trim(); } catch (e) { return ''; } } function saveQualityName(name) { try { if (name) window.localStorage.setItem(LS_QUALITY_KEY, String(name)); } catch (e2) {} } function resolveQualityIndex(items) { var pref = readSavedQualityName(); if (pref) { for (var i = 0; i < items.length; i++) { if (items[i].name === pref) return i; } } return 0; } function buildVideoConfig(playUrl, pa) { var qualities = pa && pa.qualities && pa.qualities.length >= 2 ? pa.qualities : null; if (!qualities) { qualities = parseQualityFromUrl(playUrl); } if (qualities && qualities.length >= 2) { var idx = resolveQualityIndex(qualities); var picked = qualities[idx]; return { url: picked.url, mime: detectMime(picked.url), qualities: qualities, activeIndex: idx, }; } return { url: playUrl, mime: detectMime(playUrl), qualities: null, activeIndex: 0, }; } function readSavedSpeed() { try { var v = parseFloat(window.localStorage.getItem(LS_SPEED_KEY)); if (!isNaN(v) && PLAYBACK_SPEEDS.indexOf(v) !== -1) return v; } catch (e) {} return 1; } function saveSpeed(rate) { try { window.localStorage.setItem(LS_SPEED_KEY, String(rate)); } catch (e) {} } function seekBySeconds(p, delta) { var cur = p.currentTime(); if (typeof cur !== 'number' || isNaN(cur)) cur = 0; var next = cur + delta; var dur = p.duration(); if (typeof dur === 'number' && isFinite(dur) && dur > 0) { next = Math.min(dur, Math.max(0, next)); } else { next = Math.max(0, next); } p.currentTime(next); } var pa = parent.player_aaaa || {}; var playUrl = parent.MacPlayer.PlayUrl; var videoCfg = buildVideoConfig(playUrl, pa); var options = { sources: [{ src: videoCfg.url, type: videoCfg.mime }], playbackRates: PLAYBACK_SPEEDS, }; var player = videojs('playerCnt', options, function onPlayerReady() { var p = this; var lastProgressPost = 0; var pendingSeekPoint = null; var hasUserPlayed = false; var qualityButtons = []; function canSeekNow() { return p.readyState() >= 1; } function seekToPoint(sec) { sec = ``` -------------------------------- ### Get Actor Detail Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves the details of a specific actor by their ID. ```APIDOC ## GET /api.php/actor/get_detail/ ### Description Retrieves the detailed information for a specific actor. ### Method GET ### Endpoint /api.php/actor/get_detail/ ### Parameters #### Query Parameters - **actor_id** (number) - Required - The ID of the actor (1..MAX) ``` -------------------------------- ### Publish Task Immediately Source: https://github.com/magicblack/maccms10/blob/master/vendor/topthink/think-queue/README.md Use `think\Queue::push` to publish a task for immediate execution. Specify the task class, data, and optionally a queue name. ```php think\Queue::push($job, $data = '', $queue = null) ``` -------------------------------- ### Get Article Detail Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves the details of a specific article by its ID. ```APIDOC ## GET /api.php/art/get_detail/ ### Description Retrieves the detailed information for a specific article. ### Method GET ### Endpoint /api.php/art/get_detail/ ### Parameters #### Query Parameters - **art_id** (number) - Required - The ID of the article (0..MAX) ``` -------------------------------- ### Batch Player Initialization Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view_new/mycj/allplayer.html This section describes a batch operation for initializing players. It requires selecting players first, then choosing the content for batch modification. ```N/A 批量操作 __初始化播放器 ``` -------------------------------- ### Get Withdrawal Details Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves detailed information about a specific withdrawal record. ```APIDOC ## GET /api.php/cash/get_detail ### Description Retrieves detailed information about a specific withdrawal record using its ID. ### Method GET ### Endpoint /api.php/cash/get_detail ### Parameters #### Query Parameters - **cash_id** (number) - Required - The ID of the withdrawal record ### Response #### Success Response (200) - **code** (number) - 1 for success - **msg** (string) - '获取成功' (Get successful) - **info** (object) - Contains detailed information about the withdrawal ``` -------------------------------- ### Get Withdrawal Configuration Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves the current configuration settings for the withdrawal feature. ```APIDOC ## GET /api.php/cash/get_config ### Description Retrieves the current configuration settings for the withdrawal feature, including status, minimum withdrawal amount, and exchange ratio. ### Method GET ### Endpoint /api.php/cash/get_config ### Parameters None ### Response #### Success Response (200) - **code** (number) - 1 for success - **msg** (string) - '获取成功' (Get successful) - **info** (object) - **cash_status** (number) - Withdrawal feature status (0=disabled, 1=enabled) - **cash_min** (number) - Minimum withdrawal amount in currency units (e.g., Yuan) - **cash_ratio** (number) - Exchange ratio (e.g., 1 Yuan = N points) ``` -------------------------------- ### Queue Configuration Source: https://github.com/magicblack/maccms10/blob/master/vendor/topthink/think-queue/README.md Configure the queue driver and other settings in `application/extra/queue.php`. The 'sync' driver executes tasks synchronously. ```php [ 'connector'=>'sync' //驱动类型,可选择 sync(默认):同步执行,database:数据库驱动,redis:Redis驱动,topthink:Topthink驱动 //或其他自定义的完整的类名 ] ``` -------------------------------- ### Initialize Hot Video Tabs List Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view_new/tplconfig/theme.html Initializes the list of tabs for the 'hot video' section. If the theme configuration for hot video tabs is not set or is not an array, it defaults to a predefined list. ```php ``` -------------------------------- ### Get Article Read Page Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves the content of a specific page for an article. ```APIDOC ## GET /api.php/art/get_read_page/ ### Description Retrieves the content of a specific page for an article, including read status. ### Method GET ### Endpoint /api.php/art/get_read_page/ ### Parameters #### Query Parameters - **art_id** (number) - Required - The ID of the article (0..MAX) - **page** (number) - Optional - The page number to retrieve (defaults to 1) ``` -------------------------------- ### Initialize Layui and Handle Tab Switching Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view/addon/index.html Initializes Layui modules and sets up event listeners for tab switching. It updates the 'url' variable based on the selected tab and reloads the addon list. ```javascript layui.use(['form','laypage', 'layer','element'], function() { // 操作对象 var form = layui.form , layer = layui.layer , upload = layui.upload ,element = layui.element; //监听Tab切换 element.on('tab(tabs)', function(data){ if(data.index <2){ url = $(this).attr('data-href'); load_list(); } }); }); ``` -------------------------------- ### Get User Portrait URL Source: https://github.com/magicblack/maccms10/blob/master/说明文档/标签说明.txt Retrieves the URL for a user's avatar. ```php {$user.user_id|mac_get_user_portrait} ``` -------------------------------- ### Get Withdrawal List Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a paginated list of withdrawal records, filterable by status. ```APIDOC ## GET /api.php/cash/get_list ### Description Retrieves a paginated list of withdrawal records. Users can filter the list by withdrawal status. ### Method GET ### Endpoint /api.php/cash/get_list ### Parameters #### Query Parameters - **page** (number) - Optional - Page number, defaults to 1 - **limit** (number) - Optional - Number of items per page, defaults to 20, max 100 - **status** (number) - Optional - Withdrawal status (0=pending review, 1=approved) ### Response #### Success Response (200) - **code** (number) - 1 for success - **msg** (string) - '获取成功' (Get successful) - **info** (object) - **page** (number) - Current page number - **pagecount** (number) - Total number of pages - **limit** (number) - Items per page - **total** (number) - Total number of records - **list** (array) - List of withdrawal records ``` -------------------------------- ### Get Link List Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a list of links with various filtering and sorting options. ```APIDOC ## GET /api.php/link/get_list/ ### Description Retrieves a list of links with filtering and sorting capabilities. ### Method GET ### Endpoint /api.php/link/get_list/ ### Parameters #### Query Parameters - **offset** (number) - Optional - Offset for pagination - **limit** (number) - Optional - Number of items per page (1..500) - **id** (number) - Optional - Link ID (1..MAX) - **type** (number) - Optional - Link type (1..MAX) - **name** (string) - Optional - Fuzzy search by name (<=100 characters) - **sort** (number) - Optional - Sort order (1..MAX) - **time_start** (number) - Optional - Start timestamp (1..MAX) - **time_end** (number) - Optional - End timestamp (1..MAX) - **orderby** (string) - Optional - Sorting field (id, time, time_add) ``` -------------------------------- ### Initialize System Configuration Form Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view/system/configplay.html Initializes the Layui form and layer components. Includes a click handler for the default button to reset all input fields to their default values. ```javascript layui.use(['form', 'layer'], function(){ // 操作对象 var form = layui.form , layer = layui.layer; $('#btnDef').click(function(){ $('input[name="play[width]"]').val('100%'); $('input[name="play[height]"]').val('100%'); $('input[name="play[widthmob]"]').val('100%'); $('input[name="play[heightmob]"]').val('100%'); $('input[name="play[widthpop]"]').val('600'); $('input[name="play[heightpop]"]').val('500'); $('input[name="play[second]"]').val('5'); $('input[name="play[prestrain]"]').val('//union.maccms.la/html/prestrain.html'); $('input[name="play[buffer]"]').val('//union.maccms.la/html/loading.html'); $('input[name="play[parse]"]').val(''); }); }); ``` -------------------------------- ### Get Actor List Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a list of actors with various filtering and sorting options. ```APIDOC ## GET /api.php/actor/get_list/ ### Description Retrieves a list of actors with filtering and sorting capabilities. ### Method GET ### Endpoint /api.php/actor/get_list/ ### Parameters #### Query Parameters - **offset** (number) - Optional - Offset for pagination - **limit** (number) - Optional - Number of items per page (1..MAX) - **id** (number) - Optional - Actor ID (1..MAX) - **type_id** (number) - Optional - Category ID (1..MAX) - **sex** (string) - Optional - Gender ('男' or '女') - **area** (string) - Optional - Area (<=255 characters) - **letter** (string) - Optional - Filter by first letter (<=1 character) - **level** (string) - Optional - Filter by level (<=1 character) - **name** (string) - Optional - Fuzzy search by name (<=64 characters) - **blood** (string) - Optional - Blood type (<=10 characters) - **starsign** (string) - Optional - Star sign (<=255 characters) - **time_start** (number) - Optional - Start timestamp (1..MAX) - **time_end** (number) - Optional - End timestamp (1..MAX) - **orderby** (string) - Optional - Sorting field (e.g., hits, time, level) ``` -------------------------------- ### Initialize Scrawl Dialog Settings and Instance Source: https://github.com/magicblack/maccms10/blob/master/static_new/ueditor/dialogs/scrawl/scrawl.html Sets up the default configuration for the scrawl tool, including brush properties and color options. It then instantiates the scrawl object and defines event handlers for the dialog's OK and Cancel buttons. ```javascript var settings = { drawBrushSize: 3, //画笔初始大小 drawBrushColor: "#4bacc6", //画笔初始颜色 colorList: ['c00000', 'ff0000', 'ffc000', 'ffff00', '92d050', '00b050', '00b0f0', '0070c0', '002060', '7030a0', 'ffffff', '000000', 'eeece1', '1f497d', '4f81bd', 'c0504d', '9bbb59', '8064a2', '4bacc6', 'f79646'] //画笔选择颜色 , saveNum: 10 //撤销次数 }; var scrawlObj = new scrawl(settings); scrawlObj.isCancelScrawl = false; dialog.onok = function () { exec(scrawlObj); return false; }; dialog.oncancel = function () { scrawlObj.isCancelScrawl = true; }; ``` -------------------------------- ### Get Hot Articles Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a list of popular articles based on various metrics. ```APIDOC ## GET /api.php/art/get_hot/ ### Description Retrieves a list of popular articles, sortable by different metrics. ### Method GET ### Endpoint /api.php/art/get_hot/ ### Parameters #### Query Parameters - **num** (number) - Optional - The number of articles to retrieve (defaults to 6) - **type_id** (number) - Optional - Filter by category ID - **start** (number) - Optional - Offset for pagination (defaults to 0) - **by** (string) - Optional - Sorting field (defaults to 'time', options: hits, hits_day, hits_week, hits_month, time) ``` -------------------------------- ### Initialize Layui Form and Upload Components Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view/type/info.html Sets up Layui form validation, file uploads, and handles select change events for type mid selection. Includes hover effect for image previews. ```javascript layui.use(['form','upload', 'layer'], function () { // 操作对象 var form = layui.form , layer = layui.layer , upload = layui.upload , $ = layui.jquery; upload.render({ elem: '.layui-upload' ,url: "{:url('upload/upload')}?flag=type" ,method: 'post' ,before: function(input) { layer.msg("{:lang('upload_ing')}", {time:3000000}); }, done: function(res, index, upload) { var obj = this.item; if (res.code == 0) { layer.msg(res.msg); return false; } layer.closeAll(); var input = $(obj).parent().parent().find('.upload-input'); if ($(obj).attr('lay-type') == 'image') { input.siblings('img').attr('src', res.data.file).show(); } input.val(res.data.file); if(res.data.thumb_class !=''){ $("."+ res.data.thumb_class).val(res.data.thumb[0].file); } } }); $('.upload-input').hover(function (e){ var e = window.event || e; var imgsrc = $(this).val(); if(imgsrc.trim()==""){ return; } var left = e.clientX+document.body.scrollLeft+20; var top = e.clientY+document.body.scrollTop+20; $(".showpic").css({left:left,top:top,display:""}); if(imgsrc.indexOf('://')<0){ imgsrc = ROOT_PATH + '/' + imgsrc; } else { imgsrc = imgsrc.replace('mac:','http:'); } $(".showpic_img").attr("src", imgsrc); },function (e){ $(".showpic").css("display","none"); }); // 验证 form.verify({ type_name: function (value) { if (value == "") { return "{:lang('name_empty')}"; } }, type_tpl: function (value) { if (value == "") { return "{:lang('admin/type/tpl_empty')}"; } } }); form.on('select(type_mid)', function(data){ selectOnChange(data.value); }); selectOnChange({$info.type_mid}); }); ``` -------------------------------- ### Get Article List Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a list of articles with various filtering and sorting options. ```APIDOC ## GET /api.php/art/get_list/ ### Description Retrieves a list of articles with filtering and sorting capabilities. ### Method GET ### Endpoint /api.php/art/get_list/ ### Parameters #### Query Parameters - **type_id** (number) - Optional - Category ID - **offset** (number) - Optional - Offset for pagination - **limit** (number) - Optional - Number of items per page (1-500) - **tag** (string) - Optional - Tag for fuzzy search (<=50 characters) - **orderby** (string) - Optional - Sorting field (e.g., id, time, score, hits) - **letter** (string) - Optional - Filter by first letter (<=1 character) - **status** (number) - Optional - Status of the article (1-10) - **name** (string) - Optional - Fuzzy search by title (<=100 characters) - **sub** (string) - Optional - Fuzzy search by subtitle (<=100 characters) - **blurb** (string) - Optional - Fuzzy search by blurb (<=100 characters) - **title** (string) - Optional - Title search (<=50 characters) - **content** (string) - Optional - Fuzzy search by content (<=100 characters) - **class** (string) - Optional - Fuzzy search by category name (<=50 characters) - **level** (string) - Optional - Filter by recommendation level (comma-separated IDs) - **time_start** (number) - Optional - Start timestamp - **time_end** (number) - Optional - End timestamp ``` -------------------------------- ### Initialize JavaScript Site Configuration Source: https://github.com/magicblack/maccms10/blob/master/application/index/view/index/index.html Initializes a JavaScript object with site configuration details like root path, module ID, and URLs. This is typically placed in the
or before other scripts. ```javascript var maccms={"path":"__ROOT__","mid":"{$maccms['mid']}","aid":"{$maccms['aid']}","url":"{$maccms['site_url']}","wapurl":"{$maccms['site_wapurl']}","mob_status":"{$maccms['mob_status']}"}; ``` -------------------------------- ### WebUploader Initialization for Image Uploads Source: https://github.com/magicblack/maccms10/blob/master/static_new/ueditor/dialogs/wordimage/wordimage.html Initializes the WebUploader instance for handling image uploads. Configures accepted file types, SWF path, server URL, file field name, duplicate file handling, single file size limits, and compression settings. This setup is crucial for the image upload functionality. ```javascript uploader = WebUploader.create({ accept: { title: 'Images', extensions: acceptExtensions, mimeTypes: 'image/*' }, swf: '../../third-party/webuploader/Uploader.swf', server: actionUrl, fileVal: editor.getOpt('imageFieldName'), duplicate: true, fileSingleSizeLimit: imageMaxSize, // 默认 2 M threads: 1, compress: editor.getOpt('imageCompressEnable') ? { width: imageCompressBorder, height: imageCompressBorder, // 图片质量,只有type为`image/jpeg`的时候才有效。 quality: 90, // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false. allowMagnify: false, // 是否允许裁剪。 crop: false, // 是否保留头部meta信息。 preserveHeaders: true } : false }); ``` -------------------------------- ### Get Video Detail Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves the detailed information for a specific video using its ID. ```APIDOC ## GET /api.php/vod/get_detail ### Description Retrieves the detailed information for a specific video. ### Method GET ### Endpoint /api.php/vod/get_detail ### Parameters #### Query Parameters - **vod_id** (number) - Required - The ID of the video. ### Response (Response structure not detailed in source, but implies detailed video information) ### Response Example (Example not provided in source) ``` -------------------------------- ### Get Gbook List Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a list of guestbook entries with various filtering and sorting options. ```APIDOC ## GET /api.php/gbook/get_list/ ### Description Retrieves a list of guestbook entries with filtering and sorting capabilities. ### Method GET ### Endpoint /api.php/gbook/get_list/ ### Parameters #### Query Parameters - **offset** (number) - Optional - Offset for pagination - **limit** (number) - Optional - Number of items per page (1..500) - **id** (number) - Optional - Guestbook entry ID (1..MAX) - **rid** (number) - Optional - Resource ID (1..MAX) - **user_id** (number) - Optional - User ID (1..MAX) - **status** (number) - Optional - Status of the entry (0..10) - **name** (string) - Optional - Fuzzy search by name (<=20 characters) - **content** (string) - Optional - Fuzzy search by content (<=20 characters) - **orderby** (string) - Optional - Sorting field (id, time, reply_time) - **time_start** (number) - Optional - Start timestamp (0..MAX) - **time_end** (number) - Optional - End timestamp (0..MAX) ``` -------------------------------- ### Get Areas Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a list of available areas for videos, filtered by a parent type ID. ```APIDOC ## GET /api.php/vod/get_area ### Description Retrieves a list of available areas for videos. ### Method GET ### Endpoint /api.php/vod/get_area ### Parameters #### Query Parameters - **type_id_1** (number) - Required - The parent type ID to filter areas by. ### Response (Response structure not detailed in source) ### Response Example (Example not provided in source) ``` -------------------------------- ### File and Directory Listing Logic Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view_new/annex/file.html Iterates through files and directories, displaying their names, sizes, and modification times. Conditional logic handles files versus directories. ```html {if condition="$ischild eq 1"} {/if} {volist name="files" id="vo"} {if condition="$vo.isfile eq 1"} {else} {/if} {/volist} ``` -------------------------------- ### Get Classes Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a list of video classes or categories, filtered by a parent type ID. ```APIDOC ## GET /api.php/vod/get_class ### Description Retrieves a list of video classes or categories. ### Method GET ### Endpoint /api.php/vod/get_class ### Parameters #### Query Parameters - **type_id_1** (number) - Required - The parent type ID to filter classes by. ### Response (Response structure not detailed in source) ### Response Example (Example not provided in source) ``` -------------------------------- ### Layui Initialization Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view/group/index.html Initializes Layui, a popular lightweight front-end framework, for interactive components like pagination and layers (modals). ```javascript layui.use(['laypage', 'layer'], function() { var laypage = layui.laypage , layer = layui.layer; }); ``` -------------------------------- ### Initialize Layui Upload Component Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view_new/addon/add.html Configures the Layui upload component to handle addon zip file uploads. It specifies the upload URL, method, allowed file extensions, and callback functions for before upload and after completion. ```javascript layui.use(["form","laypage", "layer","upload","element"], function() { // 操作对象 var form = layui.form , layer = layui.layer , upload = layui.upload , element = layui.element; upload.render({ elem: '.layui-upload' ,url: "{:url('addon/local')}?__token__=" + $('#token').val() ,method: 'post' ,exts: 'zip' ,before: function(input) { layer.msg("{:lang('upload_ing')}", {time:3000000}); }, done: function(res, index, upload) { var obj = this.item; if (res.code == 0) { layer.msg(res.msg); } setTimeout(function () { layer.closeAll(); location.reload(); },2000); } }); }); ``` -------------------------------- ### Get Years Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a list of available years for videos, filtered by a parent type ID. ```APIDOC ## GET /api.php/vod/get_year ### Description Retrieves a list of available years for videos. ### Method GET ### Endpoint /api.php/vod/get_year ### Parameters #### Query Parameters - **type_id_1** (number) - Required - The parent type ID to filter years by. ### Response (Response structure not detailed in source) ### Response Example (Example not provided in source) ``` -------------------------------- ### Get Video List Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a list of videos based on various filtering and sorting criteria. ```APIDOC ## GET /api.php/vod/get_list ### Description Retrieves a list of videos with filtering and sorting options. ### Method GET ### Endpoint /api.php/vod/get_list ### Parameters #### Query Parameters - **id** (number) - Optional - Filter by video ID. - **offset** (number) - Optional - Offset for pagination (default: 0). - **limit** (number) - Optional - Number of results per page (default: 20, max: 500). - **orderby** (string) - Optional - Sorting field. Options: hits, up, pubdate, hits_week, hits_month, hits_day, score. - **type_id** (number) - Optional - Filter by primary type ID. - **type_id_1** (number) - Optional - Filter by parent type ID. - **vod_letter** (string) - Optional - Filter by the first letter of the title (max 10 characters). - **vod_name** (string) - Optional - Fuzzy search by title (max 50 characters). - **vod_tag** (string) - Optional - Fuzzy search by tags (max 20 characters). - **vod_blurb** (string) - Optional - Fuzzy search by synopsis (max 20 characters). - **vod_class** (string) - Optional - Fuzzy search by class (max 10 characters). - **vod_area** (string) - Optional - Exact match by area (max 20 characters). - **vod_year** (string) - Optional - Exact match by year (max 10 characters). - **vod_lang** (string) - Optional - Exact match by language (max 20 characters). - **vod_level** (string) - Optional - Filter by recommendation level (comma-separated values). - **vod_state** (string) - Optional - Exact match by serialization status (max 20 characters). - **vod_isend** (number) - Optional - Filter by completion status (1=Completed, 0=Ongoing). - **vod_actor** (string) - Optional - Fuzzy search by actor (max 128 characters, supports multiple words). ### Response #### Success Response (200) - Each item in the returned list contains: - **vod_link** (string) - URL to the video. - **vod_pic** (string) - Processed thumbnail URL. - **vod_play_link** (string) - Playback URL (if enabled). - **type_is_vip_exclusive** (string) - VIP exclusive badge. ### Response Example (structure of a single item) ```json { "vod_id": 123, "vod_name": "Example Movie", "vod_pic": "http://example.com/pic.jpg", "vod_link": "/vod/123.html", "vod_play_link": "/play/123.html", "type_is_vip_exclusive": "" } ``` ``` -------------------------------- ### Initialize Layui and Event Handlers (JavaScript) Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view_new/batchplayer/index.html Initializes Layui modules (layer, form) and sets up event handlers for batch player operations. Defines language constants. ```javascript layui.use(['layer', 'form'], function(){ var layer = layui.layer, form = layui.form, $ = layui.$; var LANG = { select_player_first: '{:lang("admin/batchplayer/select_player_first")}', confirm_delete: '{:lang("admin/batchplayer/confirm_delete")}', input_parse_url: '{:lang("admin/batchplayer/input_parse_url")}', replace_from_title: '{:lang("admin/batchplayer/replace_from_title")}', old_from: '{:lang("admin/batchplayer/old_from")}', new_from: '{:lang("admin/batchplayer/new_from")}', btn_do_replace: '{:lang("admin/batchplayer/btn_do_replace")}', fill_complete: '{:lang("admin/batchplayer/fill_complete")}', confirm_replace: '{:lang("admin/batchplayer/confirm_replace")}' }; form.on('checkbox(allChoose)', function(data){ $('input[name="froms[]"]').prop('checked', data.elem.checked); form.render('checkbox'); }); function getSelected(){ var froms = []; $('input[name="froms[]"]:checked').each(function(){ froms.push($(this).val()); }); return froms; } $('#batchEnable').on('click', function(){ var froms = getSelected(); if(!froms.length){ layer.msg(LANG.select_player_first,{icon:0}); return; } $.post('{:url("batch_player/batchStatus")}', {froms:froms, status:1}, function(res){ layer.msg(res.msg, {icon:res.code==1?1:2}); if(res.code==1) setTimeout(function(){location.reload();},800); }); }); ``` -------------------------------- ### Initialize Content Import Source: https://github.com/magicblack/maccms10/blob/master/static_new/ueditor/dialogs/contentimport/contentimport.html Initializes the content import dialog with specified options and callbacks. This is the main entry point for the feature. ```javascript utils.domReady(function () { var options = {}; var callbacks = {}; contentImport.init(options, callbacks); }); ``` -------------------------------- ### Get Chatroom Messages Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a list of chat messages for a specific video, with support for incremental fetching. ```APIDOC ## GET /api.php/chatroom/get_list ### Description Retrieves a list of chat messages for a specific video. Supports incremental fetching by providing the `after_id` of the last received message. ### Method GET ### Endpoint /api.php/chatroom/get_list ### Parameters #### Query Parameters - **vod_id** (number) - Required - The ID of the video for which to fetch chat messages - **after_id** (number) - Optional - The `chat_id` of the last message received, to fetch new messages after it - **limit** (number) - Optional - The maximum number of messages to retrieve, defaults to 50, max 100 ### Response #### Success Response (200) - The response structure is consistent with the `model getNewMessages`. ``` -------------------------------- ### Get Recharge Card Usage Records Source: https://github.com/magicblack/maccms10/blob/master/说明文档/API接口说明V2.txt Retrieves a paginated list of recharge card usage records. ```APIDOC ## GET /api.php/payment/get_cards ### Description Retrieves a paginated list of recharge card usage records. ### Method GET ### Endpoint /api.php/payment/get_cards ### Parameters #### Query Parameters - **page** (number) - Optional - Page number, defaults to 1 - **limit** (number) - Optional - Number of items per page, defaults to 20, max 100 ### Response #### Success Response (200) - **code** (number) - 1 for success - **msg** (string) - '获取成功' (Get successful) - **info** (object) - **page** (number) - Current page number - **pagecount** (number) - Total number of pages - **limit** (number) - Items per page - **total** (number) - Total number of records - **list** (array) - List of recharge card records ``` -------------------------------- ### Layui Form Initialization and Table Selection Handling Source: https://github.com/magicblack/maccms10/blob/master/application/admin/view/database/rep.html Initializes Layui form and handles the 'select' event for the 'table' element. It fetches columns for the selected table via AJAX and dynamically populates field options. Includes form verification rules for table, field, findstr, and tostr. ```javascript layui.use(['form', 'layer'], function(){ // 操作对象 var form = layui.form , layer = layui.layer , $ = layui.jquery; form.on('select(table)', function(data){ $('.fields').html(''); if(data.value !=''){ $.post("{:url('columns')}", {table:data.value}, function(res) { if (res.code == 1) { $.each(res.data,function(index,row){ $(".fields").append(''+row.Field+' '); if(index>0 && index%5==0){ //$(".fields").append('