### Execute PhpSpreadsheet Sample Script from Command Line Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpspreadsheet/docs/index.md Run a specific PhpSpreadsheet sample directly from the command line to test functionality without a web server. This example runs the basic simple.php sample. ```shell php vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple.php ``` -------------------------------- ### Install PhpSpreadsheet via Composer Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpspreadsheet/docs/index.md Install the PhpSpreadsheet library using Composer package manager. This command adds the phpoffice/phpspreadsheet package to your project dependencies. ```shell composer require phpoffice/phpspreadsheet ``` -------------------------------- ### Run PhpSpreadsheet Samples with Built-in Web Server Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpspreadsheet/docs/index.md Serve PhpSpreadsheet sample files using PHP's built-in web server on localhost:8000. This allows interactive exploration of the library's capabilities through pre-built examples. ```shell php -S localhost:8000 -t vendor/phpoffice/phpspreadsheet/samples ``` -------------------------------- ### Install Guzzle via Composer Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/guzzlehttp/guzzle/README.md Instructions for installing Guzzle using Composer. This involves first installing Composer itself by downloading the installer script, and then using the composer.phar command to require the guzzlehttp/guzzle package. ```bash # Install Composer curl -sS https://getcomposer.org/installer | php ``` ```bash php composer.phar require guzzlehttp/guzzle ``` -------------------------------- ### PHP: Basic Carbon Usage after Composer Install Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/nesbot/carbon/readme.md A minimal example showing how to include the Composer autoloader and use Carbon::now() after installation. ```php getActiveSheet(); $sheet->setCellValue('A1', 'Hello World !'); $writer = new Xlsx($spreadsheet); $writer->save('hello world.xlsx'); ``` -------------------------------- ### XML Service Definition with Commands and Parameters Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/guzzlehttp/guzzle/UPGRADING.md XML structure defining API client commands with HTTP methods, URIs, and parameter specifications. Includes examples of GET, POST, PUT, and DELETE operations for group management endpoints with typed parameters and header configurations. ```xml Get a list of groups Uses a search query to get a list of groups Create a group Delete a group by ID Update a group ``` -------------------------------- ### POST /admin/live.aliyunlive/start_live - Start Live Streaming Source: https://context7.com/crmeb/crmeb_zzff_class/llms.txt Starts a live streaming session for a given live room ID. It updates the stream status, notifies subscribed users via WeChat, and broadcasts the event via WebSocket. ```APIDOC ## POST /admin/live.aliyunlive/start_live ### Description Starts a live streaming session for a given live room ID. It updates the stream status, notifies subscribed users via WeChat, and broadcasts the event via WebSocket. ### Method POST ### Endpoint /admin/live.aliyunlive/start_live ### Parameters #### Query Parameters - **id** (integer) - Required - The ID of the live stream to start. #### Request Body None ### Request Example ```bash curl -X POST "https://example.com/admin/live.aliyunlive/start_live?id=5001" \ -H "Cookie: PHPSESSID=admin_session" ``` ### Response #### Success Response (200) - **status** (integer) - Indicates the success of the operation. - **msg** (string) - A message confirming the successful start of the stream. #### Response Example ```json { "status": 200, "msg": "开播成功" } ``` ``` -------------------------------- ### PHP: Install Carbon with Composer Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/nesbot/carbon/readme.md Instructions for installing the Carbon library using Composer, a dependency manager for PHP. This is the recommended method for managing project dependencies. ```bash $ composer require nesbot/carbon ``` ```json { "require": { "nesbot/carbon": "~1.21" } } ``` -------------------------------- ### Install Monolog using Composer Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/monolog/monolog/README.md This command installs the latest version of Monolog using Composer, the dependency manager for PHP. Ensure Composer is installed and available in your system's PATH. ```bash $ composer require monolog/monolog ``` -------------------------------- ### Install OSS PHP SDK via Composer Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/aliyuncs/oss-sdk-php/README.md Install the Alibaba Cloud OSS SDK for PHP using Composer package manager. This method adds the dependency to your project and allows automatic version management. Requires PHP 5.3+ and cURL extension. ```bash composer require aliyuncs/oss-sdk-php ``` ```json "require": { "aliyuncs/oss-sdk-php": "~2.0" } ``` -------------------------------- ### Install Workerman using Composer Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/workerman/workerman/README.md This command uses Composer, a dependency manager for PHP, to install the Workerman library into your project. Ensure Composer is installed and available in your system's PATH. ```bash composer require workerman/workerman ``` -------------------------------- ### Start Aliyun Live Streaming Source: https://context7.com/crmeb/crmeb_zzff_class/llms.txt Backend PHP code to start a live stream, updating its status and notifying subscribed users. It also broadcasts a WebSocket message to connected viewers indicating the stream has started. This function requires the live stream ID as input. ```php // POST /admin/live.aliyunlive/start_live // Start streaming public function start_live() { $id = $this->request->param('id', 0); $live = LiveStudio::get($id); if (!$live) return Json::fail('直播间不存在'); if ($live->status == 1) return Json::fail('直播已开始'); // Update status LiveStudio::update(['status' => 1, 'real_start_time' => time()], ['id' => $id]); // Notify subscribed users via WeChat template message $users = LiveUser::where('live_id', $id)->where('is_remind', 1)->select(); foreach ($users as $user) { WechatTemplateService::sendTemplate($user->uid, 'LIVE_START', [ 'title' => $live->title, 'start_time' => date('Y-m-d H:i:s', $live->start_time) ]); } // Broadcast via WebSocket Gateway::sendToGroup('live_' . $id, json_encode([ 'type' => 'live_start', 'msg' => '直播已开始' ])); return Json::successful('开播成功'); } ``` ```bash // cURL example curl -X POST "https://example.com/admin/live.aliyunlive/start_live?id=5001" \ -H "Cookie: PHPSESSID=admin_session" // Response { "status": 200, "msg": "开播成功" } ``` -------------------------------- ### Install Pimple using Composer Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/pimple/pimple/README.rst This command adds the Pimple library to your project's composer.json file, ensuring you have version 3.0 or later. ```bash $ ./composer.phar require pimple/pimple "^3.0" ``` -------------------------------- ### PHP: Carbon Date and Time Manipulation Examples Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/nesbot/carbon/readme.md Demonstrates common Carbon functionalities including getting the current time, manipulating dates by adding/subtracting intervals, creating specific dates, and performing comparisons. It also shows how to set and reset test times for unit testing and check for weekends. ```php use Carbon\Carbon; printf("Right now is %s", Carbon::now()->toDateTimeString()); printf("Right now in Vancouver is %s", Carbon::now('America/Vancouver')); //implicit __toString() $tomorrow = Carbon::now()->addDay(); $lastWeek = Carbon::now()->subWeek(); $nextSummerOlympics = Carbon::createFromDate(2016)->addYears(4); $officialDate = Carbon::now()->toRfc2822String(); $howOldAmI = Carbon::createFromDate(1975, 5, 21)->age; $noonTodayLondonTime = Carbon::createFromTime(12, 0, 0, 'Europe/London'); $internetWillBlowUpOn = Carbon::create(2038, 01, 19, 3, 14, 7, 'GMT'); // Don't really want this to happen so mock now Carbon::setTestNow(Carbon::createFromDate(2000, 1, 1)); // comparisons are always done in UTC if (Carbon::now()->gte($internetWillBlowUpOn)) { die(); } // Phew! Return to normal behaviour Carbon::setTestNow(); if (Carbon::now()->isWeekend()) { echo 'Party!'; } echo Carbon::now()->subMinutes(2)->diffForHumans(); // '2 minutes ago' // ... but also does 'from now', 'after' and 'before' // rolling up to seconds, minutes, hours, days, months, years $daysSinceEpoch = Carbon::createFromTimestamp(0)->diffInDays(); ``` -------------------------------- ### Install Jenssegers Date Library using Composer Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/jenssegers/date/README.md This command installs the Jenssegers Date library using Composer, a dependency manager for PHP. Ensure Composer is installed and accessible in your terminal. ```bash composer require jenssegers/date ``` -------------------------------- ### Install PhpSpreadsheet via Composer Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpspreadsheet/docs/topics/architecture.md PhpSpreadsheet requires Composer autoloader for proper initialization. Use composer install for standalone projects or composer require to add it to existing projects. This ensures all necessary dependencies and autoloading mechanisms are properly configured. ```bash composer install ``` ```bash composer require phpoffice/phpspreadsheet ``` -------------------------------- ### Static Stringy Method Example Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/danielstjules/stringy/README.md Shows how to use static methods provided by StaticStringy for string manipulation. This example demonstrates the `slice` method, translating a common instance method call into its static equivalent. ```php use Stringy\StaticStringy as S; // Translates to Stringy::create('fòôbàř')->slice(0, 3); // Returns a Stringy object with the string "fòô" S::slice('fòôbàř', 0, 3); ``` -------------------------------- ### Get a Service Instance from Pimple Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/pimple/pimple/README.rst This PHP code illustrates how to retrieve an already defined service, 'session', from the Pimple container. Pimple automatically resolves dependencies and returns the service instance. ```php $session = $container['session']; ``` -------------------------------- ### Stringy Composer Installation Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/danielstjules/stringy/README.md Shows how to add the Stringy library as a dependency in a Composer project's composer.json file. ```json { "require": { "danielstjules/stringy": "~3.1.0" } } ``` -------------------------------- ### POST /wap/auth_api/memberPurchase - Membership Purchase Source: https://context7.com/crmeb/crmeb_zzff_class/llms.txt Handles the purchase of a membership, including order creation and initial setup. This endpoint initiates the membership purchase process. ```APIDOC ## POST /wap/auth_api/memberPurchase ### Description Handles the purchase of a membership, including order creation and initial setup. This endpoint initiates the membership purchase process. ### Method POST ### Endpoint /wap/auth_api/memberPurchase ### Parameters #### Query Parameters - **id** (integer) - Required - The ID of the membership package to purchase. - **pay_type** (string) - Required - The payment method (e.g., 'weixin'). ### Request Example ```json { "id": 3, "pay_type": "weixin" } ``` ### Response #### Success Response (200) - **order_id** (string) - The generated order ID. - **level** (integer) - The user's new membership level. - **overdue_time** (integer) - Timestamp indicating when the membership expires. - **benefits** (array of strings) - A list of benefits associated with the membership. #### Response Example ```json { "status": 200, "msg": "购买成功", "data": { "order_id": "VIP20230101123456789012", "level": 3, "overdue_time": 1704067200, "benefits": ["观看所有课程", "无广告", "专属客服"] } } ``` ``` -------------------------------- ### Initialize OSSClient for Alibaba Cloud OSS Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/aliyuncs/oss-sdk-php/README.md Create and initialize an OSSClient object using access credentials and endpoint. The OSSClient instance is used to perform all OSS operations. Wrap initialization in try-catch to handle OSSException for authentication failures or connection errors. ```php "; $accessKeySecret = ""; $endpoint = ""; try { $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint); } catch (OssException $e) { print $e->getMessage(); } ``` -------------------------------- ### GET Function Example in PHP Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpspreadsheet/docs/topics/calculation-engine.md Demonstrates the usage of the GET function to retrieve a specific value from a dataset based on criteria. It involves setting up a database array and a criteria array, then using PHP to interact with a worksheet object to calculate and retrieve the value. This function is useful for targeted data extraction. ```php $database = [ [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], [ 'Apple', 18, 20, 14, 105.00 ], [ 'Pear', 12, 12, 10, 96.00 ], [ 'Cherry', 13, 14, 9, 105.00 ], [ 'Apple', 14, 15, 10, 75.00 ], [ 'Pear', 9, 8, 8, 76.80 ], [ 'Apple', 8, 9, 6, 45.00 ], ]; $criteria = [ [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], ]; $worksheet->fromArray( $criteria, NULL, 'A1' ) ->fromArray( $database, NULL, 'A4' ); $worksheet->setCellValue('A12', '=GET(A4:E10,"Age",A1:F2)'); $retVal = $worksheet->getCell('A12')->getCalculatedValue(); // $retVal = 14 ``` -------------------------------- ### Create Alibaba Cloud Client with Access Key Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/alibabacloud/client/README.md Initialize an Alibaba Cloud client using access key credentials. This sets up the default client instance for making subsequent API requests. Requires valid accessKeyId and accessKeySecret from your Alibaba Cloud account. ```php asDefaultClient(); ``` -------------------------------- ### Get and Set Spreadsheet Company Properties (PHP) Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpspreadsheet/docs/references/features-cross-reference.md Provides examples for accessing and modifying the company property associated with a spreadsheet. This functionality allows for setting or retrieving the company name related to the spreadsheet's metadata. ```php $spreadsheet->getProperties()->getCompany(); $spreadsheet->getProperties()->setCompany('MyCompany'); ``` -------------------------------- ### Create Aliyun Live Streaming Room Source: https://context7.com/crmeb/crmeb_zzff_class/llms.txt Backend PHP code to create a live streaming room using Aliyun Live integration. It retrieves necessary API credentials from system configurations, generates push and pull URLs, and saves the live room data to the database. Requires Aliyun SDK and system configuration for API keys. ```php // POST /admin/live.aliyunlive/create_live // Backend: Create live streaming room $aliyunLive = \Api\AliyunLive::instance([ 'AccessKey' => SystemConfigService::get('accessKeyId'), 'AccessKeySecret' => SystemConfigService::get('accessKeySecret'), 'appName' => SystemConfigService::get('aliyun_live_appName'), 'payKey' => SystemConfigService::get('aliyun_live_play_key'), 'key' => SystemConfigService::get('aliyun_live_push_key'), 'playLike' => SystemConfigService::get('aliyun_live_playLike'), 'rtmpLink' => SystemConfigService::get('aliyun_live_rtmpLink'), ]); $stream_name = 'live_' . time() . '_' . rand(1000, 9999); $push_url = $aliyunLive->getPushUrl($stream_name, 3600); // Valid for 1 hour $play_url = $aliyunLive->getPlayUrl($stream_name); $liveData = [ 'title' => '直播课程:Spring Boot实战', 'stream_name' => $stream_name, 'push_url' => $push_url, 'pull_url' => $play_url['rtmp'], 'cover_img' => 'https://cdn.example.com/covers/live_101.jpg', 'start_time' => strtotime('2023-01-15 19:00:00'), 'end_time' => strtotime('2023-01-15 21:00:00'), 'type' => 1, // 1: live streaming, 2: playback 'status' => 0, // 0: not started, 1: ongoing, 2: ended 'is_show' => 1, 'is_del' => 0, 'add_time' => time(), ]; LiveStudio::create($liveData); ``` ```bash // cURL example curl -X POST https://example.com/admin/live.aliyunlive/create_live \ -H "Cookie: PHPSESSID=admin_session" \ -H "Content-Type: application/json" \ -d '{ "title": "直播课程:Spring Boot实战", "cover_img": "https://cdn.example.com/covers/live_101.jpg", "start_time": "2023-01-15 19:00:00", "end_time": "2023-01-15 21:00:00" }' // Response { "status": 200, "msg": "创建成功", "data": { "live_id": 5001, "stream_name": "live_1672531200_8765", "push_url": "rtmp://push.example.com/live/live_1672531200_8765?auth_key=...", "play_urls": { "rtmp": "rtmp://play.example.com/live/live_1672531200_8765", "flv": "https://play.example.com/live/live_1672531200_8765.flv", "m3u8": "https://play.example.com/live/live_1672531200_8765.m3u8" } } } ``` -------------------------------- ### Create a Pimple Container Instance Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/pimple/pimple/README.rst This PHP code demonstrates how to instantiate a new Pimple Container object, which will be used to manage services and parameters. ```php use Pimple\Container; $container = new Container(); ``` -------------------------------- ### Validate Numeric Range Input in Excel Cell Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpexcel/Documentation/markdown/Overview/08-Recipes.md Implements data validation restricting cell input to whole numbers within a specified range (10-20 in this example). Displays custom error and prompt messages to guide users on acceptable values. This validation prevents invalid numeric entries before they are committed to the cell. ```php $objValidation = $objPHPExcel->getActiveSheet()->getCell('B3') ->getDataValidation(); $objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_WHOLE ); $objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP ); $objValidation->setAllowBlank(true); $objValidation->setShowInputMessage(true); $objValidation->setShowErrorMessage(true); $objValidation->setErrorTitle('Input error'); $objValidation->setError('Number is not allowed!'); $objValidation->setPromptTitle('Allowed input'); $objValidation->setPrompt('Only numbers between 10 and 20 are allowed.'); $objValidation->setFormula1(10); $objValidation->setFormula2(20); ``` -------------------------------- ### Create Logger with Unix Socket Handler in PHP Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/monolog/monolog/doc/sockets.md Initializes a Monolog logger with a SocketHandler configured to use a Unix socket for persistent logging. The handler is set to DEBUG level and writes log messages to a Unix socket at /var/log/httpd_app_log.socket. This example demonstrates basic setup for socket-based logging with persistent connections enabled. ```php setPersistent(true); // Now add the handler $logger->pushHandler($handler, Logger::DEBUG); // You can now use your logger $logger->addInfo('My logger is now ready'); ``` -------------------------------- ### Migrate Cell Value Setting in PHP Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpspreadsheet/docs/topics/migration-from-PHPExcel.md This code example shows how to migrate from the old method of setting cell values in PHP, where the returned value could be the Worksheet, Cell, or Rule, to the new method. The updated approach chains method calls, first getting the cell and then setting its value, ensuring a consistent return of the Worksheet object. ```php // Before // $cell = $worksheet->setCellValue('A1', 'value', true); // After $cell = $worksheet->getCell('A1')->setValue('value'); ``` -------------------------------- ### Install mtdowling/cron-expression using Composer Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/mtdowling/cron-expression/README.md This command installs the mtdowling/cron-expression library into your project using Composer. Ensure Composer is installed and accessible in your environment. ```bash composer require mtdowling/cron-expression ``` -------------------------------- ### Create Bucket in Alibaba Cloud OSS Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/aliyuncs/oss-sdk-php/README.md Create a new bucket using the createBucket method. Buckets serve as containers for managing stored objects and must follow Alibaba Cloud naming conventions. Wrap in try-catch to handle creation failures or naming conflicts. ```php "; try { $ossClient->createBucket($bucket); } catch (OssException $e) { print $e->getMessage(); } ``` -------------------------------- ### POST /admin/live.aliyunlive/create_live - Create Live Streaming Room Source: https://context7.com/crmeb/crmeb_zzff_class/llms.txt Creates a new live streaming room integrated with Aliyun Live. This endpoint generates push and pull URLs, and stream keys for the new room. ```APIDOC ## POST /admin/live.aliyunlive/create_live ### Description Creates a new live streaming room integrated with Aliyun Live. This endpoint generates push and pull URLs, and stream keys for the new room. ### Method POST ### Endpoint /admin/live.aliyunlive/create_live ### Parameters #### Query Parameters None #### Request Body - **title** (string) - Required - The title of the live stream. - **cover_img** (string) - Required - The URL of the cover image for the live stream. - **start_time** (string) - Required - The start time of the live stream in 'YYYY-MM-DD HH:MM:SS' format. - **end_time** (string) - Required - The end time of the live stream in 'YYYY-MM-DD HH:MM:SS' format. ### Request Example ```json { "title": "直播课程:Spring Boot实战", "cover_img": "https://cdn.example.com/covers/live_101.jpg", "start_time": "2023-01-15 19:00:00", "end_time": "2023-01-15 21:00:00" } ``` ### Response #### Success Response (200) - **live_id** (integer) - The unique identifier for the created live stream. - **stream_name** (string) - The stream name generated for the live stream. - **push_url** (string) - The push URL for the live stream. - **play_urls** (object) - An object containing various playback URLs. - **rtmp** (string) - The RTMP playback URL. - **flv** (string) - The FLV playback URL. - **m3u8** (string) - The HLS (m3u8) playback URL. #### Response Example ```json { "status": 200, "msg": "创建成功", "data": { "live_id": 5001, "stream_name": "live_1672531200_8765", "push_url": "rtmp://push.example.com/live/live_1672531200_8765?auth_key=...", "play_urls": { "rtmp": "rtmp://play.example.com/live/live_1672531200_8765", "flv": "https://play.example.com/live/live_1672531200_8765.flv", "m3u8": "https://play.example.com/live/live_1672531200_8765.m3u8" } } } ``` ``` -------------------------------- ### Define a Factory Service in Pimple Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/pimple/pimple/README.rst This PHP example demonstrates how to define a 'factory' service. Using the factory() method ensures that a new instance of the service is returned every time it is accessed from the container, unlike default services which return the same instance. ```php $container['session'] = $container->factory(function ($c) { return new Session($c['session_storage']); }); ``` -------------------------------- ### Vue.js Initialization and Data Setup Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/application/wap/view/first/index/index.html Initializes a Vue.js application to manage dynamic content like live streams, banners, and news. It sets up data properties for these elements and includes methods for fetching data, handling user interactions, and managing the display of live stream information via cookies. ```javascript require(['vue', 'helper', 'store'], function (Vue, $h, storeApi) { new Vue({ el: '#app', data: { liveList: liveList, liveOne: liveOne ? liveOne : {}, swiperlist: banner, recommend: [], navList: [], loading: false, loadTitle: '', loading: "", loadend: false, page: 1, limit: 10, is_code: false, activity: activity, activityOne: {}, is_live_one: false, newsList: [] }, created: function () { this.getNewsList(); }, mounted: function () { var that = this; var live_one = $.cookie('live_one'); if (live_one != undefined && live_one != null) live_one = JSON.parse(live_one); if ($.isEmptyObject(that.liveOne) == true) { $.cookie('live_one', null); that.is_live_one = false; } else { if (live_one == undefined && live_one == null) { that.is_live_one = true; } else if (live_one.is_lives && live_one.id == that.liveOne.id) { that.is_live_one = false; } else if (live_one.id != that.liveOne.id) { that.is_live_one = true; } else { that.is_live_one = false; } } that.$nextTick(function () { var myBanner = new Swiper('#banner', { pagination: '#banner-pagination', paginationClickable: false, autoplay: 2500, speed: 1000, loop: true, effect: "coverflow", slidesPerView: "auto", centeredSlides: true, coverflow: { rotate: 0, stretch: -20, depth: 100, modifier: 2, slideShadows: false }, observer: true, observeParents: true, autoplayDisableOnInteraction: false }); }) if (this.activity.length) { var activityOne = this.activity.shift(); that.$set(that, "activityOne", activityOne); } this.get_content_recommend(); this.get_recommend(); }, methods: { getNewsList: function () { var that = this; storeApi.baseGet($h.U({ c: 'article', a: 'get_unifiend_list' }), function (res) { that.newsList = res.data.data; that.$nextTick(function () { new Swiper('#news', { direction: "vertical", speed: 1000, autoplay: 2500, loop: true, observer: true, observeParents: true, autoplayDisableOnInteraction: false }); }); }, function (res) { $h.pushMsgOnce(res.data.msg); }); }, clickLive: function (type, id) { this.is_live_one = false; var data = {}; data.is_lives = 1; data.id = id; $.cookie('live_one', JSON.stringify(data), { expires: 1 }); if (type) { window.location.href = $h.U({ c: 'special', a: 'details', q: { id: id } }); } }, activityDetails: function (id) { return $h.U({ c: 'special', a: 'activity_details', q: { id: id } }); }, getDetails: function (type, id) { return type == 1 ? $h.U({ c: 'article', a: 'details', q: { id: id } }) : $h.U({ c: 'special', a: 'details', q: { id: id } }); }, getNavHref: function (item, bo) { if (item.type == 3) { return item.link; } else { if (bo) { return $h.U({ c: 'special', a: 'special_cate', q: { cate_id: item.grade_id } }); } return $h.U({ c: 'index', a: 'unified_list', q: { type: item.type, title: item.title, recommend_id: item.id } }); } }, getActivityHref: function () { return $h.U({ c: 'activity', a: 'index' }); }, get_recommend: function () { storeApi.baseGet($h.U({ c: 'index', a: 'get_recommend' }), function (res) { this.$set(this, 'navList', res.data.data); }.bind(this)) }, goBannerLink: function (url) { if (url && url != '#') window.location.href = url; }, initSwiper: function () { var that = this; this.$nextTick(function () { var swiperScroll = new Swiper('.swiperScroll', { freeMode: true, freeModeMoment }); }) } } }); }); ``` -------------------------------- ### Initialize ConfigManager Object in PHP Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/clagiordano/weblibs-configmanager/README.md This code snippet shows how to instantiate the ConfigManager class, providing the path to a configuration file. The ConfigManager object can then be used to interact with the configuration. ```php use clagiordano\weblibs\configmanager\ConfigManager; /** * Instance object to read argument file */ $config = new ConfigManager("configfile.php"); ``` -------------------------------- ### Stringy OO Method Chaining Example Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/danielstjules/stringy/README.md Demonstrates the fluent interface and method chaining capabilities of the Stringy library, applying multiple string transformations in a single call. ```php use StringyStringy as S; echo S::create('fòô bàř')->collapseWhitespace()->swapCase(); // Outputs: 'FÒÔ BÀŘ' ``` -------------------------------- ### Get Spreadsheet Subject in PHP Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpspreadsheet/docs/references/features-cross-reference.md Retrieves the subject property of a spreadsheet object. This method is used to get the main topic or subject matter of the spreadsheet. ```php $spreadsheet->getProperties()->getSubject() ``` -------------------------------- ### Get Links from Link Header Object Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/guzzlehttp/guzzle/UPGRADING.md Move getLinks() method usage from Response object to Link header object. Requires accessing the header collection first to get the Link header implementation. ```php // Old usage (3.5) // $response->getLinks() // New usage (3.6) $linkHeader = $response->getHeader('Link'); $links = $linkHeader->getLinks(); ``` -------------------------------- ### Import OSS PHP SDK with Autoloader Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/aliyuncs/oss-sdk-php/README.md Three methods to import the Alibaba Cloud OSS SDK for PHP into your application: using Composer autoload, PHAR file, or direct source code. Choose the method that best fits your project structure. ```php require_once __DIR__ . '/vendor/autoload.php'; ``` ```php require_once '/path/to/oss-sdk-php.phar'; ``` ```php require_once '/path/to/oss-sdk/autoload.php'; ``` -------------------------------- ### GET /wap/my/spread_list - Get Referral List and Commission Stats Source: https://context7.com/crmeb/crmeb_zzff_class/llms.txt Retrieves a list of users referred by the current user, along with their commission statistics and total commission data. ```APIDOC ## GET /wap/my/spread_list ### Description Retrieves a list of users referred by the current user, along with their commission statistics and total commission data. ### Method GET ### Endpoint /wap/my/spread_list ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number for pagination. - **limit** (integer) - Optional - The number of items per page. ### Request Example ``` GET https://example.com/wap/my/spread_list?page=1&limit=20 ``` ### Response #### Success Response (200) - **list** (array) - An array of referral user objects. - **uid** (integer) - The unique ID of the referred user. - **nickname** (string) - The nickname of the referred user. - **avatar** (string) - The URL of the referred user's avatar. - **add_time** (string) - The timestamp when the user was referred. - **spread_count** (integer) - The number of users referred by this user. - **order_count** (integer) - The number of orders placed by this user. - **commission** (float) - The commission generated from this user. - **commission** (object) - Commission summary statistics. - **total_commission** (float) - Total commission earned. - **extract_commission** (float) - Total commission withdrawn. - **available_commission** (float) - The currently available commission balance. - **total** (integer) - The total number of referred users. #### Response Example ```json { "status": 200, "msg": "success", "data": { "list": [ { "uid": 10001, "nickname": "用户A", "avatar": "https://cdn.example.com/avatars/10001.jpg", "add_time": "2023-01-15 10:30:00", "spread_count": 5, "order_count": 12, "commission": 156.50 } ], "commission": { "total_commission": 1250.00, "extract_commission": 800.00, "available_commission": 450.00 }, "total": 38 } } ``` ``` -------------------------------- ### PHP DCOUNTA Function Example Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpspreadsheet/docs/topics/calculation-engine.md Illustrates the DCOUNTA function, which counts non-blank cells in a database column that meet specific criteria. The example uses PhpSpreadsheet to populate a worksheet and calculate the result of the DCOUNTA function. ```php $database = [ [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], [ 'Apple', 18, 20, 14, 105.00 ], [ 'Pear', 12, 12, 10, 96.00 ], [ 'Cherry', 13, 14, 9, 105.00 ], [ 'Apple', 14, 15, 10, 75.00 ], [ 'Pear', 9, 8, 8, 76.80 ], [ 'Apple', 8, 9, 6, 45.00 ], ]; $criteria = [ [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], ]; $worksheet->fromArray( $criteria, NULL, 'A1' ) ->fromArray( $database, NULL, 'A4' ); $worksheet->setCellValue('A12', '=DCOUNTA(A4:E10,"Yield",A1:A3)'); $retVal = $worksheet->getCell('A12')->getCalculatedValue(); // $retVal = 5 ``` -------------------------------- ### Stringy Create Method Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/danielstjules/stringy/README.md Provides an example of the `create` method, which initializes a Stringy object with a given string and optional encoding. It also mentions input validation and type casting. ```php $stringy = S::create('fòôbàř'); // 'fòôbàř' ``` -------------------------------- ### Initialize Vue Instance with Audio/Video Player Data Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/application/wap/view/first/special/task_info.html Sets up the Vue instance with initial data properties for media player state, task information, and audio player controls. Initializes audio player object with properties for tracking playback position, duration, and pause state. ```javascript new Vue({ el: '#app', data: { taskInfo: taskInfo, specialInfo: specialInfo, isMember: isMember ? isMember : 0, taskList: [], type: 0, where: { page: 1, limit: 10, special_id: specialId }, is_pay: isPay, loading: false, loadend: false, loadTitle: '上拉加载更多', bannerImg: '', audio: null, audioBar: null, audioPlayer: { src: taskInfo.link, currentIndex: 0, currentTime: '00:00', duration: '00:00', range: 0, paused: true }, currentMedia: null, windowWidth: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, timer: null } }); ``` -------------------------------- ### PHP: DATE Function Return Type Control Example Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpexcel/Documentation/markdown/CalculationEngine/FunctionReference/03-03-Date-and-Time-Functions.md Illustrates how to control the return type of the DATE function using `PHPExcel_Calculation_Functions::setReturnDateType()`. It shows examples for Excel timestamp and PHP numeric timestamp return types. ```php // Disable calculation cacheing for multiple calls PHPExcel_Calculation::getInstance()->setCalculationCacheEnabled(FALSE); $saveFormat = PHPExcel_Calculation_Functions::getReturnDateType(); // Set return type to Excel timestamp PHPExcel_Calculation_Functions::setReturnDateType( PHPExcel_Calculation_Functions::RETURNDATE_EXCEL ); $retVal = call_user_func_array( array('PHPExcel_Calculation_Functions', 'DATE'), array(2008, 12, 31) ); // $retVal = 39813.0 // Set return type to PHP numeric timestamp PHPExcel_Calculation_Functions::setReturnDateType( PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC ); $retVal = call_user_func_array( array('PHPExcel_Calculation_Functions', 'DATE'), array(2008, 12, 31) ); // $retVal = 1230681600 // Restore original return type PHPExcel_Calculation_Functions::setReturnDateType($saveFormat); ``` -------------------------------- ### PHP DGET Function Example Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpexcel/Documentation/markdown/CalculationEngine/FunctionReference/03-02-Database-Functions.md Illustrates how to use the DGET function to extract a single value from a database based on specific criteria. The example sets up a database and criteria, populates a worksheet, and then retrieves a value using the DGET formula. ```php $database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ), array( 'Apple', 18, 20, 14, 105.00 ), array( 'Pear', 12, 12, 10, 96.00 ), array( 'Cherry', 13, 14, 9, 105.00 ), array( 'Apple', 14, 15, 10, 75.00 ), array( 'Pear', 9, 8, 8, 76.80 ), array( 'Apple', 8, 9, 6, 45.00 ), ); $criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ), array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ), array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ), ); $worksheet->fromArray( $criteria, NULL, 'A1' ) ->fromArray( $database, NULL, 'A4' ); $worksheet->setCellValue('A12', '=GET(A4:E10,"Age",A1:F2)'); $retVal = $worksheet->getCell('A12')->getCalculatedValue(); // $retVal = 14 ``` -------------------------------- ### Configuring APCu Cache for PhpSpreadsheet Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpspreadsheet/docs/topics/memory_saving.md This demonstrates setting up APCu cache for PhpSpreadsheet. It involves installing the necessary packages, creating an APCu cache pool, bridging it to a simple cache interface, and then setting it in PhpSpreadsheet. Ensure the 'cache/simple-cache-bridge' and 'cache/apcu-adapter' packages are installed. ```sh composer require cache/simple-cache-bridge cache/apcu-adapter ``` ```php $pool = new \Cache\Adapter\Apcu\ApcuCachePool(); $simpleCache = new \Cache\Bridge\SimpleCache\SimpleCacheBridge($pool); \PhpOffice\PhpSpreadsheet\Settings::setCache($simpleCache); ``` -------------------------------- ### Create Workerman Server with Custom Protocol Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/workerman/workerman/README.md Instantiates a Workerman TCP server using the custom MyTextProtocol on port 5678. Registers event handlers for connection establishment, message reception, and connection closure. The onMessage handler echoes 'hello world' to connected clients. This demonstrates basic server setup with custom protocol binding. ```php require_once __DIR__ . '/vendor/autoload.php'; use Workerman\Worker; // #### MyTextProtocol worker #### $text_worker = new Worker("MyTextProtocol://0.0.0.0:5678"); $text_worker->onConnect = function($connection) { echo "New connection\n"; }; $text_worker->onMessage = function($connection, $data) { // send data to client $connection->send("hello world \n"); }; $text_worker->onClose = function($connection) { echo "Connection closed\n"; }; // run all workers Worker::runAll(); ``` -------------------------------- ### Set Cell Range from 2D Array in PhpSpreadsheet Source: https://github.com/crmeb/crmeb_zzff_class/blob/master/vendor/phpoffice/phpspreadsheet/docs/topics/accessing-cells.md Populates a range of cells starting from a specified coordinate using a 2D array. Each inner array represents a row. The second argument allows specifying a value to be ignored if present in the array. The default starting cell is 'A1' if not specified. ```php $arrayData = [ [NULL, 2010, 2011, 2012], ['Q1', 12, 15, 21], ['Q2', 56, 73, 86], ['Q3', 52, 61, 69], ['Q4', 30, 32, 0], ]; $spreadsheet->getActiveSheet() ->fromArray( $arrayData, // The data to set NULL, // Array values with this value will not be set 'C3' // Top left coordinate of the worksheet range where // we want to set these values (default is A1) ); ```