Exemplo n.º 1
0
        /// <summary>
        /// 删除应用授权
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public DelAppIdAuthResponse DelAppIdAuth(DelAppIdAuthRequest request)
        {
            var response = new DelAppIdAuthResponse();

            try
            {
                var entity = _appIdAuthTokenRepository.Find <AppIdAuthPo>(e => e.IsValid == 1 && e.Id == request.Id);

                if (entity == null)
                {
                    throw new Exception("删除应用授权不存在");
                }

                entity.IsValid = 0;
                EntityLogger.UpdateEntity(entity);

                _appIdAuthTokenRepository.UpdateColumns(entity, (e) => new { e.IsValid, e.UpdateTime, e.UpdateUserId });
            }
            catch (Exception ex)
            {
                response.IsSuccess   = false;
                response.MessageCode = "-1";
                response.MessageText = ex.Message;
                LogManager.LogicLogger.ErrorFormat("删除应用授权出错:{0}", new { request, err = ex.ToString() }.ToJson());
            }
            return(response);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取应用授权
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public GetAppIdAuthResponse GetAppIdAuth(GetAppIdAuthRequest request)
        {
            var response = new GetAppIdAuthResponse();

            try
            {
                var entity = _appIdAuthTokenRepository.Find <AppIdAuthPo>(e => e.IsValid == 1 && e.Id == request.Id);

                if (entity == null)
                {
                    return(response);
                }

                response.Entity = entity.As <AppIdAuthDto>();
            }
            catch (Exception ex)
            {
                response.IsSuccess   = false;
                response.MessageCode = "-1";
                response.MessageText = ex.Message;
                LogManager.LogicLogger.ErrorFormat("根据Id获取应用授权配置出错{0}", new { request, err = ex.ToString() }.ToJson());
            }
            return(response);
        }