### WeChat Public Platform Setup Guide Source: https://github.com/testing365/w7/blob/main/web/themes/default/account/manage-base.html Provides instructions for connecting a WeChat Official Account to the platform. It details the steps required within the WeChat Public Platform to configure the URL and Token for automatic detection and integration. ```APIDOC WeChat Public Platform Connection: Status: Not Connected. Solution: 1. Navigate to WeChat Public Platform. 2. Select 'Developer Center' -> 'Modify Configuration'. 3. Copy the platform's URL and Token. 4. Paste these into the corresponding options in the WeChat Public Platform. 5. The platform will automatically perform detection. ``` -------------------------------- ### URL Generation Examples Source: https://github.com/testing365/w7/blob/main/web/themes/default/platform/draft.html Demonstrates the usage of a PHP function `url()` to generate platform-specific URLs for various actions like creating posts, displaying materials, and handling drafts. ```php echo url('platform/draft/post'); // Example: echo url('platform/draft/display', array('type' => $type)) // Example: echo url('platform/material/detail', array('newsid' => $material['id'])) ``` -------------------------------- ### Account List Iteration Source: https://github.com/testing365/w7/blob/main/web/themes/default/module/dropdown-menu.html This snippet iterates over a list of accounts (`$accounts_list`). For each account, it displays the account name and a link generated by PHP pointing to the account's URL. ```template {loop $accounts_list $account}* [{$account['account_name']}]({php echo $account['url']}) {/loop} ``` -------------------------------- ### Fetch and Loop Slides (PHP) Source: https://github.com/testing365/w7/blob/main/app/themes/default/common/slide.html Fetches slide data using `app_slide` and iterates through it, initializing a counter for slides. This snippet demonstrates server-side data preparation and iteration within a templating context. ```PHP $multiid)); $slideNum = 0; foreach ($slides as $row) { $slideNum++; } ?> ``` -------------------------------- ### Initialize AngularJS App and Configure Settings Source: https://github.com/testing365/w7/blob/main/web/themes/default/home/welcome.html Initializes the AngularJS application 'homeApp' and sets up global configuration values. It uses the 'moment' library for date handling and defines API links and family settings. This snippet is crucial for the application's frontend setup. ```javascript require(['moment'], function() { angular.module('homeApp').value('config', { family: "{IMS_FAMILY}", notices: {php echo !empty($notices) ? json_encode($notices) : 'null'}, apiLink: "{CLOUD_API_DOMAIN}", }); angular.bootstrap($('#js-home-welcome'), ['homeApp']); }); ``` -------------------------------- ### Module Listing and Quick Menu Rendering Source: https://github.com/testing365/w7/blob/main/app/themes/default/wxapp/wxapp.html This snippet demonstrates how a documentation page iterates through project modules and conditionally displays a quick menu. It uses a templating language to loop through data structures and render links. ```templating {template 'common/header'} {loop $version_info['modules'] $module} [ {$module['title']} ]({$module['url']}) {/loop} {if $version_info['quickmenu']['show']} {loop $version_info['quickmenu']['menus'] $menu} [![]({$menu['icon']}) {$menu['name']} ]({$menu['url']}) {/loop} {/if} ``` -------------------------------- ### Display Account Info and Navigation Links (PHP) Source: https://github.com/testing365/w7/blob/main/web/themes/default/common/header-phoneapp.html This snippet displays the user's profile image, account name, and version information. It also includes navigation links for switching versions, managing accounts (conditionally), and switching platforms. The code relies on framework-specific variables and functions like `tmedia` and `url`. ```php ![]({php echo tomedia('headimg_'.$phoneapp_info['acid'].'.jpg')}?time={php echo time()}) {$_W['account']['name']} {$version_info['version']} ``` ```php [切换版本]({php echo url('miniapp/version/display')}) {if in_array($role, array(ACCOUNT_MANAGE_NAME_OWNER, ACCOUNT_MANAGE_NAME_MANAGER)) || $_W['isfounder']} [管理]({php echo url('account/post', array('uniacid' => $_W['account']['uniacid'], 'account_type' => $_W['account']['type']))}) {/if} [切换平台]({php echo url('account/display', array('type' => 'all'))}) ``` -------------------------------- ### Time Period Validation Logic Source: https://github.com/testing365/w7/blob/main/framework/builtin/custom/template/display.html JavaScript function to validate the start and end times for two distinct time periods used for routing messages to the multi-customer service system. It checks for valid time ranges and overlaps. ```javascript window.validateReplyForm = function(form, $, _, util) { var start1 = parseInt($('#start1').val()); var end1 = parseInt($('#end1').val()); var start2 = parseInt($('#start2').val()); var end2 = parseInt($('#end2').val()); if(start1 == '-1' && end1 == '-1' && start2 == '-1' && end2 == '-1') { util.message('请选择有效的时间段'); // Please select a valid time period return false; } if(start1 > end1) { util.message('第一个时间段的开始接入时间大于结束时间'); // The start time of the first period is greater than the end time return false; } if(start2 != '-1' && (end1 > start2)) { util.message('第一个时间段的结束日期大于第二个时间段的开始时间'); // The end date of the first period is greater than the start time of the second period return false; } if(start2 != '-1' && (start2 > end2)) { util.message('第二个时间段的开始接入时间大于结束时间'); // The start time of the second period is greater than the end time return false; } }; ``` -------------------------------- ### Wxapp Front-download Links Source: https://github.com/testing365/w7/blob/main/web/themes/default/wxapp/version-front-download.html Provides links for downloading the WeChat Mini Program package and accessing platform-specific developer tools. These are generated dynamically using PHP. ```PHP $version_id)); ?> ``` ```PHP $version_id)); ?> ``` ```PHP $version_id)); ?> ``` ```PHP $version_id)); ?> ``` ```PHP $version_id)); ?> ``` -------------------------------- ### PHP Application Installation Workflow Steps Source: https://github.com/testing365/w7/blob/main/web/themes/default/module/manage-system.html Outlines the three-step process for installing and assigning application permissions: adding application permission groups, adding user permission groups, and assigning user permission groups. ```php 1. 安装应用 2. 分配应用权限 3. 安装成功 应用分配到公众号使用的流程说明 1 添加应用权限组 设置应用权限组名称,选择需要添加的公众号应用、小程序应用、微站模板,保存提交。 [去添加应用组 >]({php echo url('module/group/post')}) 2 添加用户权限组 设置用户权限组名称,选择可以添加的的公众号,小程序数量、有效期并选择应用权限组,然后保存提交。 [去添加用户权限组 >]({php echo url('user/group/post')}) 3 分配用户权限组 改用户组权限,分配成功后此用户组即可使用该应用组的所有应用。 [去分配用户组 >]({php echo url('user/group')}) ``` -------------------------------- ### PHP URL Generation Examples Source: https://github.com/testing365/w7/blob/main/web/themes/default/user/post.html Examples of PHP code used within the template to generate dynamic URLs for various actions like saving user data, retrieving group details, and checking user information. These are typically used for API endpoints. ```PHP url('founder/display') ``` ```PHP url('founder/create', array('is_used' => 'used')) ``` ```PHP url('founder/create', array('is_used' => '')) ``` ```PHP url('user/display') ``` ```PHP url('user/create/save') ``` ```PHP url('founder/create/get_user_founder_group_detail_info') ``` ```PHP url('user/create/get_user_group_detail_info') ``` ```PHP url('user/create/check_vice_founder_exists') ``` ```PHP url('user/create/check_user_info') ``` ```PHP url('user/create/check_vice_founder_permission_limit') ``` -------------------------------- ### Website Application Configuration (JavaScript) Source: https://github.com/testing365/w7/blob/main/web/themes/default/site/tpl-display.html Initializes an AngularJS module 'wesiteApp' and configures it with application settings, including style results, template types, current type, general settings, and API links. It uses jQuery to enable popovers and bootstraps the AngularJS application. ```javascript $(function () { $("[data-toggle='popover']").popover(); }); angular.module('wesiteApp').value('config', { stylesResult: {php echo !empty($stylesResult) ? json_encode($stylesResult) : 'null'}, temtypes: {php echo !empty($temtypes) ? json_encode($temtypes) : 'null'}, type: {php echo !empty($_GPC['type']) ? json_encode($_GPC['type']) : 'null'}, setting: {php echo !empty($setting) ? json_encode($setting) : 'null'}, links: { template: "{php echo url('site/style/template')}", default: "{php echo url('site/style/default')}", designer: "{php echo url('site/style/designer')}", copy: "{php echo url('site/style/copy')}", build: "{php echo url('site/style/build')}", del: "{php echo url('site/style/del')}", home: "{php echo murl('home', array(), true, true)}", }, }); angular.bootstrap($('#js-wesite-tpl-display'), ['wesiteApp']); ``` -------------------------------- ### Developer Tool Download Links Source: https://github.com/testing365/w7/blob/main/web/themes/default/wxapp/version-front-download.html Provides direct links to download developer tools for various mini-program platforms, including Alipay, Baidu, and Toutiao. These links are conditional based on the account type sign. ```APIDOC Developer Tool Download Links: - Alipay Mini Program: URL: https://docs.alipay.com/mini/ide/download/ Usage: javascript:openUrl('https://docs.alipay.com/mini/ide/download') - Baidu Smart Program: URL: https://smartprogram.baidu.com/docs/develop/devtools/show_sur/ Usage: javascript:openUrl('https://smartprogram.baidu.com/docs/develop/devtools/show_sur') - Toutiao Mini Program: URL: https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/developer-instrument/developer-instrument-update-and-download Usage: javascript:openUrl('https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/developer-instrument/developer-instrument-update-and-download') ``` -------------------------------- ### Module Management - Installed State Source: https://github.com/testing365/w7/blob/main/web/themes/default/module/manage-system.html This snippet represents the templating logic for displaying installed modules. It includes filtering options, module details like title, version, support status, and various action links such as 'Service Expiry', 'Upgrade', 'Manage Settings', 'Basic Information', 'Application Permissions Group', 'Subscription Messages', and 'Disable'. ```php {if $do == 'installed'} {php $\_GPC['support'] = empty($\_GPC['support']) ? '' : $\_GPC['support'];} {{item}} 按应用类型筛选 {loop $module_all_support $type_sign} {if ($type_sign['type'] == 'account')} {$type_sign['type_name']}应用 {$type_sign['type_name']}模板 {else} {$type_sign['type_name']} {/if} {/loop} {if permission_check_account_user('see_module_manage_system_ugrade')} 新版本 {/if} 应用名/版本[](javascript:;) 支持 来源 维护状态 操作 ![](./resource/images/init_module_logo.png) ![子应用icon](./resource/images/init_module_logo.png) ![主应用icon](./resource/images/init_module_logo.png) {{ module.title }} {if permission_check_account_user('see_module_manage_system_newversion')} 版本:{{ module.version }} 发现新版本 {/if} 商城 商城 本地 - 停止维护 [{{ module.label.content }}]({{ module.label.url }}) {if permission_check_account_user('see_module_manage_system_ugrade')} [服务到期]({php echo url('module/manage-system/module_detail')}&name={{ module.name }}&show=base) [升级]({php echo url('module/manage-system/upgrade')}&module_name={{module.name }}) [升级]({php echo url('module/manage-system/module_detail')}&name={{ module.name }}&show=upgrade) {/if} {if $module_support_name != 'all' && !empty($module_support_name)} [管理设置]({php echo url('module/manage-system/module_detail')}&name={{ module.name }}&support={$module_support_name}&type={ACCOUNT_TYPE_OFFCIAL_NORMAL}) {else} [管理设置]({php echo url('module/manage-system/module_detail')}&name={{ module.name }}&support={{ module.support }}&type={ACCOUNT_TYPE_OFFCIAL_NORMAL}) {/if} [基本信息]({php echo url('module/manage-system/module_detail')}&name={{ module.name }}&support={$module_support_name}&type={ACCOUNT_TYPE_OFFCIAL_NORMAL}) [应用权限组]({php echo url('module/manage-system/module_detail')}&name={{ module.name }}&support={$module_support_name}&type={ACCOUNT_TYPE_OFFCIAL_NORMAL}&show=group) {if $module_support_name == MODULE_SUPPORT_ACCOUNT_NAME} [订阅消息]({php echo url('module/manage-system/module_detail')}&name={{ module.name }}&support={$module_support_name}&type={ACCOUNT_TYPE_OFFCIAL_NORMAL}&show=subscribe) {/if} {if permission_check_account_user('see_module_manage_system_stop')} {if $module_support_name != 'all' && !empty($module_support_name)} [停用](javascript:;) {else} [停用](javascript:;) {/if} {/if} 暂无 × 应用停用后,会导致用户前台无法正常访问,是否停用? [可自定义提示,立即去编辑>]({php echo url('module/expire')}) 确认 取消 {$pager} {/if} ``` -------------------------------- ### WeChat Mini Program Upload & Audit Workflow Source: https://github.com/testing365/w7/blob/main/web/themes/default/wxapp/version-front-download.html Outlines the steps and actions involved in uploading a WeChat mini-program and submitting it for review. This includes downloading the code, configuring server domains, using the WeChat DevTools, uploading, and managing version submissions. ```APIDOC WeChat Mini Program Upload & Audit Workflow: 1. **Download Frontend Package**: Obtain the mini-program package. 2. **Configure Server Domain**: In the WeChat Official Accounts Platform (mp.weixin.qq.com), navigate to Settings -> Development Settings and update the Server Domain to your We7 domain (must be HTTPS). 3. **Prepare WeChat DevTools**: Download and update the WeChat web developer tool. Enter your mini-program AppID. 4. **Upload Code**: Unzip the downloaded package, upload it via WeChat DevTools, set a version number and project name. 5. **Submit for Review**: Go to the WeChat Official Accounts Platform -> Development Management. The mini-program administrator must scan the QR code to submit for review. 6. **Official Review**: Await approval from WeChat. **Version Update Process (Auto):** - If an update is available, you will be prompted to re-upload. - **Upload Steps**: Fill information, scan QR code to upload code, upload success confirmation. - **Version Details**: Display previous, current, and latest versions. - **Configuration Options**: Set version number, description, theme style, and configure jump-to mini-programs. - **Submission**: Submit development version, audit version, or confirm. **Jump-to Mini Program Management:** - **Limit**: Maximum of 10 jump-to mini-programs. - **Actions**: Add, edit, view existing jump-to mini-programs (APPID, name). **Platform Version Management:** - **Sections**: Online Version, Audit Version, Development Version. - **Online Version**: Displays version number, developer, submission time, description. Options: Revert Version. - **Audit Version**: Displays version number, status (Rejected, Auditing, Passed), developer, submission time, description. Options: Rejection Reason, Delete Audit, Withdraw Audit, Release Version. - **Development Version**: Displays version number, developer, submission time, description. Options: Scan QR Code Preview, Submit for Audit. If no development version exists, prompt to publish. **Preview:** - Scan QR code to preview the mini-program. **Plugin Support:** - If the mini-program supports plugins, select the relevant plugins based on platform account permissions. ``` -------------------------------- ### PHP Initialization Source: https://github.com/testing365/w7/blob/main/framework/builtin/paycenter/template/mobile/selfpay.html Defines a constant MUI for use within the PHP environment. This is typically an early setup step in a PHP application. ```PHP define(MUI, true); ``` -------------------------------- ### JavaScript Angular Module Initialization Source: https://github.com/testing365/w7/blob/main/web/themes/default/miniapp/post.html Initializes an Angular module named 'wxApp' with configuration data. This script sets up application-wide constants and bootstraps the Angular application on a specific DOM element. It requires 'fileUploader' and 'underscore' libraries. ```javascript require(['fileUploader','underscore'], function(uploader){ var miniapp = {'name' : '{if !empty($wxapp_info['name'])}{$wxapp_info['name']}{/if}'}; angular.module('wxApp').value('config', { 'type' : "{$type}", 'preset_type_info' : {php echo json_encode($account_all_type[$type])}, 'miniapp' : miniapp, 'uniacid' : "{$uniacid}", 'version_id' : "{$version_id}", 'postUrl': "{php echo url('miniapp/post/save_post', array('version_id' => $version_id))}", 'token' : "{$_W['token']}", 'mtype' : "{$mtype}", }); angular.bootstrap($('#js-miniapp-create'), ['wxApp']); }); ``` -------------------------------- ### Date Field Input Source: https://github.com/testing365/w7/blob/main/framework/builtin/custom/template/chatlog.html Renders a date input field using a template function. It's used for selecting a start time for queries. ```php ``` -------------------------------- ### Template Logic for Menu Display Source: https://github.com/testing365/w7/blob/main/web/themes/default/platform/menu.html Example of conditional rendering and looping within a template to display menu items based on user permissions and display settings. ```PHP {if $menu_display == 1 } 已开启 {else} 未启用 {/if} {if $menu_display == 1 } 停用 {else} 启用 {/if} ``` -------------------------------- ### AngularJS User Center App Initialization (JavaScript) Source: https://github.com/testing365/w7/blob/main/web/themes/default/site/editor.html Initializes the AngularJS application for the user center. It configures modules, menus, and site root, then bootstraps the application. ```javascript require(['underscore', 'jquery.ui', 'hammer', 'datetimepicker'], function(_) { var activeModules = ; var activeMenus = ; var siteroot = ""; angular.module('userCenterApp').value('config',{ 'activeModules' : activeModules, 'activeMenus' : activeMenus, 'siteroot' : siteroot, 'links' :{ 'murl':"" } }); angular.bootstrap($('#ng_userCenterApp'), ['userCenterApp']); }); ``` -------------------------------- ### Website Configuration and Initialization Source: https://github.com/testing365/w7/blob/main/web/themes/default/site/display.html Configures the AngularJS application 'wesiteApp' with site-specific data and initializes the application. It defines default site settings, multisite data, and API links for managing website operations. ```javascript require(['underscore'], function(){ angular.module('wesiteApp').value('config', { default_site: {"php echo !empty($default_site) ? json_encode($default_site) : '0'"}, multis: {"php echo !empty($multis) ? json_encode($multis) : 'null'"}, links: { post: "{php echo url('site/multi/post')}", del: "{php echo url('site/multi/del')}", copy: "{php echo url('site/multi/copy')}", switch: "{php echo url('site/multi/switch')}", appHome: "{php echo murl('home', array(), true, true)}" } }); angular.bootstrap($('#js-wesite-display'), ['wesiteApp']); }); ``` -------------------------------- ### PHP User ID Retrieval Source: https://github.com/testing365/w7/blob/main/web/themes/default/user/edit-account-dateline.html Retrieves the user ID from the server's global GET parameters, typically used to identify the current user being edited. ```php ``` -------------------------------- ### AngularJS Configuration and Bootstrapping Source: https://github.com/testing365/w7/blob/main/web/themes/default/site/category-post.html This snippet shows how an AngularJS application is configured with initial data values and then bootstrapped. It defines application values for 'config' and initializes the 'wesiteApp' module. ```JavaScript angular.module('wesiteApp').value('config', { id: , category: , parentid: , parent: , multis: , site_template: , styles: }); angular.bootstrap($('#js-wesite-category-post'), ['wesiteApp']); ``` -------------------------------- ### AngularJS Quick Menu App Initialization (JavaScript) Source: https://github.com/testing365/w7/blob/main/web/themes/default/site/editor.html Initializes the AngularJS application for the quick menu feature. It sets up configuration values like active items and bootstraps the application. ```javascript $(function() { require(['underscore'], function() { changeSwitch = function() { var clas = $('#switch').attr('class') == 'switch'? 'switch switchOn' : 'switch'; $('#switch').attr('class', clas); status = clas == 'switch' ? 0 : 1; $('input[name="status"]').val(status); } var activeItem = ; angular.module('quickMenuApp').value('config', { 'activeItem' : activeItem, }); angular.bootstrap($('#ng_quickmenu'), ['quickMenuApp']); $('.app-content').click(function(){ return false; }); }); }); ``` -------------------------------- ### AngularJS Application Bootstrap Source: https://github.com/testing365/w7/blob/main/web/themes/default/user/profile-modules-tpl.html Initializes the AngularJS application by specifying the root element and the main module to bootstrap. This command starts the Angular framework and makes the application interactive. ```javascript angular.bootstrap($('#js-user-edit-modulestpl'), ['userManageApp']); ``` -------------------------------- ### Plugin Menu Rendering Source: https://github.com/testing365/w7/blob/main/web/themes/default/common/header.html Renders lists of plugins, including main applications and additional plugins. Each plugin is displayed with an icon and title, linking to its respective page. ```PHP * [ 主应用 ]({php echo url('home/welcome/ext', array('m' => $frames['section']['platform_module_menu']['plugin_menu']['main_module'], 'version_id' => intval($_GPC['version_id'])))}) * 插件 {loop $frames['section']['platform_module_menu']['plugin_menu']['menu'] $plugin_name $plugin} * [![]({$plugin['icon']}) {$plugin['title']} ]({php echo url('home/welcome/ext', array('m' => $plugin_name, 'version_id' => intval($_GPC['version_id'])))}) {/loop} {php unset($plugin_name);} {php unset($plugin);} ``` ```PHP {loop $frames['section'] $frame_section_id $frame_section} {if !isset($frame_section['is_display']) || !empty($frame_section['is_display'])} {if $frame_section['title']} {$frame_section['title']} {/if} {loop $frame_section['menu'] $menu_id $menu} {if !empty($menu['is_display'])} {if $menu_id == 'platform_module_more'} * [更多应用]({url 'module/manage-account'}) {else} * [{if $menu['icon']} {if $frame_section_id == 'platform_module'} ![]({$menu['icon']}) {else} {/if} {/if} {$menu['title']}]({$menu['url']}) {/if} {/if} {/loop} {/if} {/loop} 常用插件 {loop $frames['section']['platform_module_menu']['plugin_menu']['menu'] $plugin_name $plugin} * [![]({$plugin['icon']}){$plugin['title']}]({php echo url('home/welcome/ext', array('m' => $plugin_name, 'version_id' => intval($_GPC['version_id'])))}) {/loop} * [更多插件]({php echo url('module/plugin', array('m' => $frames['section']['platform_module_menu']['plugin_menu']['main_module'], 'version_id' => intval($_GPC['version_id']), 'uniacid' => $_W['uniacid']))}) ``` -------------------------------- ### Quick Menu Configuration Overview (PHP) Source: https://github.com/testing365/w7/blob/main/web/themes/default/site/editor.html This section describes the concept of quick navigation menus for web pages, emphasizing their role in user experience and site navigation. ```php ### 快捷导航 微站的各个页面可以通过导航串联起来。通过精心设置的导航,方便访问者在页面或是栏目间快速切换,引导访问者前往您期望的页面。