1. 添加角权

POST:http://api.xdua.com/roue

字段名 字段位置 字段类型 字段说明 举例 必选
apiv head string API版本,默认是1.0.0 1.0.0 可选
Authorization head string 客户端保存的鉴权token Authorization字符串 必选
role_id body String 角色id 角权id 必选
rule_id body String 权限id 角权id 必选

失败返回

{
    "error": >0,
    "reason": "失败原因",
    "result": {"失败返回的参考数据"(Dict)}

}

成功返回

{
  "error": 0,
  "reason": "Success",
  "result": {id:"7uYJnb3H"}
}

浏览器调用SDK

    //--------------------------------------------------
    const dua = await lovearth({
        APP_KEY: "您的app key",
        APP_SECRET: "您的app secret",
    })

    api_name = "创建角权";
    got_rule_id = "";
    const res_login = await dua.login({
        by  :   "tel",
        ustr:   '+86-15810419011',
        pwd :   '您的密码md5',
        ugrp:   "XdUaXduA",
        role:   "none"
    })
    const res = await dua.addRoue({
        role_id:"角色的id",
        rule_id:"权限的id",
    })
    console.log(res)
    if(res.error == 0){
        got_rule_id = res.result.id;
        console.log(api_name+"成功 "+got_rule_id);
    }else{
        got_rule_id = res.result.id;
        console.log(api_name+"失败 "+res.reason);
    }

results matching ""

    No results matching ""