token信息说明

  1. timeStamp(1970年以来的时间戳) 表示提供给前端使用的有效时间,前端可以通过值减去10秒左右,调用refreshToken接口,重新给token赋值 通常2分钟
  2. expires token存放在缓存或者数据库里面的时间,通常7天
  3. expiresIn token有效的秒数
{
        token: {
          tokenType: "Bearer",
          timeStamp: 1611309530975.2864,
          refreshToken: "vSMmvxYBYAtyNcmrOU8ie1g1mXpakjRP",
          accessToken:
            "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJSRzMiLCJhdWQiOiJhcGkiLCJpZCI6InB0ZGV2IiwibmFtZSI6ImRldiIsImNsaWVudF9pZCI6InB0ZGV2Iiwib3Blbl9pZCI6IiIsIndiX2lkIjoiIiwid3hfb3Blbl9pZCI6IiIsInd4X3VuaW9uX2lkIjoiIiwidGVsZXBob25lIjoiIiwicHVzaF9uYW1lIjoi5byA5Y-R566h55CG5ZGYIiwiaGVhZF9pY29uIjoiIiwiZGVwX2lkIjoiIiwic3lzX2lkIjoiIiwibWVyZ2VfdXNlcl9pZCI6IiIsImFyZWFfY29kZSI6IiIsInJvbGVfaWQiOiJkZXZlbG9wbWVudCIsImRldmVsb3BlciI6IjEiLCJuYmYiOjE2MTEzMDkyMzAsImV4cCI6MTYxMTMwOTUzMCwiaWF0IjoxNjExMzA5MjMwfQ.XtYVbsJFpzWb0kA26sgLSHu17_sYScIll2_Js1ujVGg",
          expires: "2021-01-29T17:58:50",
        },
        user: {
          headIcon: "",
          userId: "test",
          roleId: ["development"],
          depId: [],
          pushName: "开发管理员",
          jobId: [],
          sysId: [],
          areaCode: [],
          developer: 1,
          mergeUserId: [],
        },
        success: true,
      }

不存在注册,存在登录

RG3.BO.Auth.Provider.LoginProvider : ILoginProvider

SqlConfig sqlConfigSaveT = _sqlConfigService.BuildUseSqlConfigMapper(true, pfSaveT, pfSaveT.ModuleKey, pfSaveT.ReponseField);

SqlOpSave sos = _dbExecuteService.StarAdd(pfSaveT, sqlConfigSaveT, jobjectOpen, dictionaryUrl, securityMethod);

控制登录相关信息变更后清空缓存,重新加载数据

  //处理数据变更后重新从数据库获取数据
                if (_cache.Get<bool>($"login-{userId}"))
                {
                    resultT = _detailRepository.Detail(pfNew, mkey, resUserId, dictionaryUrl, out sqlConfig);
                    resultT.CacheDate = DateTime.Now;
                    _quDataResultCache.Set<ResultObject<DataTable>>(pfNew, dictionaryUrlTemp, cacheKey, resultT);
                    _cache.Remove($"login-{userId}");
                }
                else
                {
                    resultT = _quDataResultCache.Get<ResultObject<DataTable>>(pfNew, dictionaryUrlTemp, out cacheKey);
                    DateTime lastDate = _isubPush.LastDate(pfNew);
                    if (resultT == null || resultT.Success == false || resultT.CacheDate <= lastDate)
                    {
                        resultT = _detailRepository.Detail(pfNew, mkey, resUserId, dictionaryUrl, out sqlConfig);
                        resultT.CacheDate = DateTime.Now;
                        _quDataResultCache.Set<ResultObject<DataTable>>(pfNew, dictionaryUrlTemp, cacheKey, resultT);
                        _cache.Remove($"login-{userId}");
                    }
                }

文档更新时间: 2023-05-22 11:19   作者:admin