请求头:
| 参数名 | 是否必须 | 类型 | 说明 | 
|---|---|---|---|
| XownerId | 是 | string | 项目唯一ID,对应 {ownerId}, 值如 mxxs | 
| XsysId | 否 | string | 所属系统 对应 bo_system 表 | 
| XuserFromFirstShareId | string | 否 | 一级分享用户ID, bo_user user_id | 
| XuserFromSecondShareId | string | 否 | 二级分享用户ID, bo_user user_id | 
| XverifyApi | 是 | string | 加密规则encryptByDES(`${newGuid()} | 
| XfilterAreaCode | 否 | string | 行政区编码, 对应 bo_sys_area area_code | 
| Content-Type: | 是 | string | application/json; charset=utf-8 请求类型 | 
- XverifyApi 前端参考代码
https://doc.rg1008.com/docs/rg_pass_api/rg_pass_api-1dpa82endpiuo 
请求参数:
- 当事件发生时,调用http/https接口,传递参数信息,响应请求结果。
 
| 参数名 | 是否必须 | 类型 | 说明 | 
|---|---|---|---|
| pageSize | 是 | string | 当前显示记录数 | 
| _nodejs | 是 | string | common-data 对应/Config/AppNodeJs/Plugins/fn- common-data.js, 通过nodejs插件,对响应结果进行二次处理 common-data 普通数据(小写驼峰)common-data-under 普通数据下划线 | 
请求URL:
- 列表
 
- http://{url参数}/bo/api/v3/{mkey}/list/res/{resField}?_nodejs=common-data
 
- 分页
 
- http://{url参数}/bo/api/v3/{mkey}/page/res/{resField}?_nodejs=common-data&pageSize=10&pageIndex=1
 
- 详情
 
- http://{url参数}/bo/api/v3/{mkey}/detail/res/{resField}?_nodejs=common-data&pageIndex=1&{primaryIdField}={primaryIdValue}
 
- 统计
 
- http://{url参数}/bo/api/v3/{mkey}/statistics/res/{resField}?_nodejs=common-data&pageIndex=1
 
- 维数据(下拉资源数据)
 
- http://{url参数}/bo/api/v3/{mkey}/dim/res/manager?columnField=mapperField&nodejs=common-dim-list&_dataT=string
 
- {mkey} 对应mapper文件
 - {resField} 对应 {mkey}里面 responseField键
 - {primaryIdField} 对应 主键id字段, 如库里面是 product_id 值为 productId
 - {primaryIdValue} 对应 主键id值
 
websoket接入
https://doc.rg1008.com/docs/rg_pass_api/rg_pass_api-1d2u807l835e4
XverifyApi 设置的规则
\RG3.BO.Core\Attributes\VerifyApiFilter.cs
operation:verifySpan
var configRoot = _configurationBuilderService.GetConfigurationAppAuth(ownerId, sysId);
     //永久生效
            List<string> lstPermanent = new List<string>();
            configRoot.GetSection("permanent").Bind(lstPermanent);
            if (ValidateUtil.ValidateExistsValue(verifyApi) && lstPermanent != null && lstPermanent.Count > 0 && lstPermanent.Contains(verifyApi.Replace(" ", "+"))) return;
            List<DataKeyValue> listRouteAuthorized = new List<DataKeyValue>();
            Dictionary<string, DataKeyValue> dicRouteAuthorized = new Dictionary<string, DataKeyValue>();
            //使用键值对方式便于继承处理
            configRoot.GetSection("router").Bind(dicRouteAuthorized);
            foreach (string key in dicRouteAuthorized.Keys)
            {
                listRouteAuthorized.Add(dicRouteAuthorized[key]);
            }
            #region 全局认证
            if (listRouteAuthorized.Count > 0)
            {
                var item = listRouteAuthorized.Where<DataKeyValue>(temp =>
                {
                    if (string.IsNullOrEmpty(temp.Path)) return false;
                    if ((temp.Path == "global")) return true;
                    bool auth = temp.Auth == null;
                    if (auth && (temp.Path == path.ToLower())) return true;
                    if (auth && (temp.Path != "/" && path.ToLower().Contains(temp.Path.ToLower()))) return true;
                    return false;
                });
                if (item.Count() > 0) return;
            }
            #endregion
   public BizException Verify(string ownerId, string sysId, string data, HttpContext httpContext = null)
        {
            if (!ValidateUtil.ValidateExistsValue(data))
            {
                return new BizException(10405, $"{VerifyConst.VERIFY_API}值必须传递01。");
            }
            SecurityConfig sc = _configurationBuilderService.GetSecurityConfigByOwnerId(ownerId, sysId);
            //注意空格替换为加号,避免url传递导致的错误
            string value = _desService.Decrypt(ownerId, sysId, data.Replace(" ", "+"), sc.Security.WebSecurityKey, sc.Security.WebSecurityVI)?.Result;
            if (value == null)
            {
                return new BizException(10405, $"{VerifyConst.VERIFY_API}格式不合法02。【解密失败】");
            }
            if (!value.Contains("|"))
            {
                return new BizException(10405, $"{VerifyConst.VERIFY_API}格式不合法03。【{value}】");
            }
            string[] values = value.Split('|', StringSplitOptions.RemoveEmptyEntries);
            if (values.Length != 2)
            {
                return new BizException(10405, $"{VerifyConst.VERIFY_API}格式不合法04。【{value}】");
            }
            if (!_configuration.GetValue<bool>("operation:verifyApiClosed"))
            {
                //关闭有效期,避免liunx时间问题
                DateTime dateN = Convert.ToDateTime(DateTimeUtil.ConvertTimestamp(Convert.ToDouble(values[1])));
                double seconds = (dateN - DateTime.Now).TotalSeconds;
                if ((seconds > _second || seconds < 0))
                {
                    return new BizException(10405, $"差值:【{_second}】{VerifyConst.VERIFY_API}格式不合法05。N:【${dateN}】。【C:${DateTime.Now}】。【S:${seconds}】");
                }
            }
            return null;
        }

XverifyApi 特殊应用永久不验证,前端写死

文档更新时间: 2022-04-23 00:14   作者:admin