ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] ### 获取使用者权限数据 #### URL >web/index.php?c=account&a=post-user&do=set_permission #### 请求方式 > GET #### 请求参数 | 名称 | 类型 | 必填 | 描述 | | ----------- | :-----: | :-----: | ----------- | | uniacid | int | 是 | 平台uniacid | | uid | int | 是 | 使用者uid || #### 返回数据 ``` { "message": { "errno": 0, "message": { "uni_modules_permission": { //模块所有权限列表及用户是否拥有该权限 "weliam_merchant": { "module_title": "智慧城市同城", "permission": [ { "title": "后台管理", "permission": "weliam_merchant_menu_dashboard", "checked": 0 } ] }, "we7_diyspecial": { "module_title": "专题页面", "permission": [ { "title": "二级菜单-1-2", "permission": "we7_diyspecial_menu_menutwo", "checked": 0 }, { "title": "二级菜单-2-2", "permission": "we7_diyspecial_menu_menufour", "checked": 0 }, { "title": "专题管理", "permission": "we7_diyspecial_menu_index", "checked": 0 }, { "title": "二级菜单-1-1", "permission": "we7_diyspecial_menu_menuone", "checked": 0 }, { "title": "二级菜单-2-1", "permission": "we7_diyspecial_menu_menuthree", "checked": 0 } ] }, "we7_0511": { "module_title": "米粥测试模块", "permission": [ { "title": "参数设置", "permission": "we7_0511_settings", "checked": 1 } ] }, "we7_wmall": { //模块没有子权限,没有该模块的权限 "module_title": "微擎外送|外卖|餐饮|生鲜|超市系统", "permission": [] }, "we7_coupon": { //模块没有自权限,有该模块权限 "module_title": "系统卡券", "permission": [ "all" ] } }, "menus": { //菜单权限数据 "title": "公众号", "icon": "wi wi-white-collar", "dimension": 3, "url": "./index.php?c=home&a=welcome&do=platform&", "section": { "platform": { "title": "增强功能", "menu": { "platform_reply": { "is_system": 1, "permission_display": [ 1, 3, 9, 10 ], "is_display": 0, "title": "自动回复", "url": "./index.php?c=platform&a=reply&", "permission_name": "platform_reply", "checked": 1 //用户拥有该权限 "icon": "wi wi-reply", "displayorder": 6, "id": null, "sub_permission": { "platform_reply_keyword": { "title": "关键字自动回复", "url": "./index.php?c=platform&a=reply&m=keyword", "permission_name": "platform_reply_keyword", "active": "keyword", "checked": 1 //用户拥有该权限 }, "platform_reply_setting": { "title": "回复设置", "url": "./index.php?c=profile&a=reply-setting&", "permission_name": "platform_reply_setting", "is_display": [ 1, 3 ], "checked": 0 //用户不拥有该权限 } } }, "platform_site": { "is_system": 1, "permission_display": [ 1, 3 ], "is_display": 0, "title": "微官网-文章", "url": "./index.php?c=site&a=multi&", "permission_name": "platform_site", "checked": 0 //用户不拥有该权限 "icon": "wi wi-home", "displayorder": 1, "id": null, "sub_permission": { "platform_site_multi": { "title": "微官网", "url": "./index.php?c=site&a=multi&do=display&", "permission_name": "platform_site_multi", "active": "multi", "checked": 0 //用户不拥有该权限 }, "platform_site_style": { "title": "微官网模板", "url": "./index.php?c=site&a=style&do=template&", "permission_name": "platform_site_style", "active": "style", "checked": 0 //用户不拥有该权限 } } } }, "permission_display": [ 1, 3, 9, 10 ], "is_display": 0 }, "statistics": { "title": "统计", "menu": { "statistics_fans": { "is_system": 1, "permission_display": [ 1, 3, 9, 10 ], "is_display": 0, "title": "用户统计", "url": "./index.php?c=statistics&a=fans&", "permission_name": "statistics_fans", "checked": 0 //用户不拥有该权限 "icon": "wi wi-statistical", "displayorder": "2", "id": null, "sub_permission": null } }, "permission_display": [ 1, 3, 9, 10, 5 ], "is_display": 0 } }, "is_system": true, "is_display": true, "displayorder": 13 } } }, "redirect": "", "type": "ajax" } ``` ### 获取模块权限数据(商业版在用) #### URL >/web/index.php?c=account&a=post-user&do=module #### 请求方式 > POST #### 请求参数 | 名称 | 类型 | 必填 | 描述 | | ----------- | :-----: | :-----: | ----------- | | uniacid | int | 是 | 平台uniacid | | uid | int | 是 | 使用者uid | | m | string | 是 | 模块标识 || #### 返回数据 成功: ``` { "message": { "errno": 0, "message": [ { "title": "店铺设置", //权限名称 "permission": "wn_storex_plugin_printer_menu_printerset", //权限标识 "checked": 1 //是否拥有此项权限,1是,0否 }, { "title": "打印机设置", "permission": "wn_storex_plugin_printer_menu_printermanage", "checked": 0 } ] }, "redirect": "", "type": "ajax" } ``` 失败: ``` { "message": { "errno": -1, "message": "访问错误, 未找到指定操作用户." }, "redirect": "", "type": "ajax" } ``` ### 修改使用者权限 #### URL >/web/index.php?c=account&a=post-user&do=save_permission #### 请求方式 > POST #### 请求参数 | 名称 | 类型 | 必填 | 描述 | | ----------- | :-----: | :-----: | ----------- | | uniacid | int | 是 | 平台uniacid | | uid | int | 是 | 使用者uid | | menus | array | 否 | 一维数组,菜单权限项的 permission_name | | module | array | 否 | 一维数组,有权限的模块标识 | | module_模块标识 | array | 否 | 一维数组,某一模块已选中权限的组合 | | 模块标识_select | int | 否 | 若选中模块所有权限,该值为1;否则为0 | 示例: ``` [module] => Array ( [0] => we7_diyspecial [1] => we7_coupon ) [module_we7_diyspecial] => Array ( [0] => we7_diyspecial_menu_menufour [1] => we7_diyspecial_menu_index [2] => we7_diyspecial_menu_menuthree ) [we7_diyspecial_select] => 0 [we7_coupon_select] => 1 ``` #### 返回数据 修改成功: ``` { "message": { "errno": 0, "message": "操作菜单权限成功!" }, "redirect": "", "type": "ajax" } ``` 失败: ``` { "message": { "errno": -1, "message": "您操作的用户不存在或是已经被删除!" }, "redirect": "", "type": "ajax" } ```