🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
>[danger] 权限功能暂时仅仅对代理自己创建的用户生效。其他暂时不涉及到权限。存放的是权限的 id [TOC=2] ## 权限列表 ~~~[api] get:/auth_power/list <<< success { "code": 0, "data": { "device_power": [ { "id": 2, "type": 29, // 设备类型 "code_name": "KD5P1", // 设备代号 "name": "电暖温控器", // 设备名称 "is_enabled": true, // 是否启用 true 启用 false 不启用 "rule": [ // 验证字段规则 { "id": 201, // id "field": "k_close", // 字段名 "name": "开关机", // 字段说明 "is_enabled": true // 是否启用 true 启用 false 不启用 }, { "id": 202, "field": "mode", "name": "模式切换", "is_enabled": true }, { "id": 203, "field": "bg_cfg", "name": "高级参数", "is_enabled": true }, { "id": 204, "field": "hw_temp_set", "name": "恒温模式温度设置", "is_enabled": true }, { "id": 205, "field": "is_heat", "name": "加热开关", "is_enabled": true }, { "id": 206, "field": "is_key_lock", "name": "儿童锁", "is_enabled": true }, { "id": 207, "field": "xj_hours", "name": "休假模式设置", "is_enabled": true }, { "id": 208, "field": "sys_lock", "name": "权限设置", "is_enabled": true }, { "id": 209, "field": "timer_set", "name": "定时配置", "is_enabled": true }, { "id": 210, "field": "smart_cfg_index", "name": "智能模式配置", "is_enabled": true }, { "id": 211, "field": "t_f_show", "name": "地温显示", "is_enabled": true } ] }, { "id": 3, "type": 46, "code_name": "KD5P5", "name": "空调温控器", "is_enabled": true, "rule": [ { "id": 301, "field": "k_close", "name": "开关机", "is_enabled": true }, { "id": 302, "field": "mode", "name": "模式切换", "is_enabled": true }, { "id": 303, "field": "cool_heat", "name": "运行方式", "is_enabled": true }, { "id": 304, "field": "bg_cfg", "name": "高级参数", "is_enabled": true }, { "id": 305, "field": "hw_temp_set", "name": "休假模式温度设置", "is_enabled": true }, { "id": 306, "field": "is_heat", "name": "是否加热", "is_enabled": true }, { "id": 307, "field": "is_key_lock", "name": "儿童锁", "is_enabled": true }, { "id": 308, "field": "xj_hours", "name": "休假模式配置", "is_enabled": true }, { "id": 309, "field": "sys_lock", "name": "系统锁定", "is_enabled": true }, { "id": 310, "field": "fan_speed", "name": "风速设置", "is_enabled": true }, { "id": 311, "field": "timer_set", "name": "定时配置", "is_enabled": true }, { "id": 312, "field": "smart_cfg_index", "name": "智能模式配置", "is_enabled": true } ] }, { "id": 4, "type": 53, "code_name": "KD5P6", "name": "彩云8000", "is_enabled": true, "rule": [ { "id": 401, "field": "k_close", "name": "开关机", "is_enabled": true }, { "id": 402, "field": "count", "name": "设备列表", "is_enabled": true }, { "id": 403, "field": "mode", "name": "模式切换", "is_enabled": true }, { "id": 404, "field": "is_lock", "name": "儿童锁", "is_enabled": true }, { "id": 405, "field": "fixed_temp", "name": "非程温度配置", "is_enabled": true }, { "id": 406, "field": "bg_cfg", "name": "高级参数", "is_enabled": true }, { "id": 407, "field": "week_cfg", "name": "日/周程温度", "is_enabled": true }, { "id": 408, "field": "month", "name": "历史配置", "is_enabled": true }, { "id": 409, "field": "power_off_and_lock", "name": "设备锁定", "is_enabled": true } ] } ] } } <<< error { "code": -1, "msg": "参数错误" } ~~~ ## 权限查询 ~~~[api] get:/auth_power/read int:user_id=1#用户 id 不填默认自己的 <<< success { "code": 0, "data": { "list": { "id": 5, "user_id": 5, "role_id": 3, "device_power": [], "role_power": [ 501,502,503,601,602,603,604, 605,606,607,701,702,703,704,705,706,801,802,101, 803,804,805,806,807,901,902,903,904,905,906,907,908, 909,910,911,912,913,1001, 1002,1003,1004,1005,1006,1007,1008,1101,1201,1201,1203,1301,1302,1303,1304, 1305,1306,1307,1308,1312 ] } } } <<< error { "code": -1, "msg": "参数错误" } ~~~ ## 授予权限 ~~~[api] post:/auth_power/save *int:user_id=1#用户 id *array:device_power=[]#设备权限 id 数组 <<< success { "code": 0 } <<< error { "code": -1, "msg": "参数错误" } ~~~