liaoxujun@qq.com
2023-09-01 a7981690ac9480ce932c9a9436e952022165e2a9
DocumentServiceAPI.Application/UserAndLogin/LogInController.cs
@@ -1,5 +1,7 @@
using DocumentServiceAPI.Application.UserAndLogin.Services;
using DocumentServiceAPI.Application.UserAndLogin.ViewMode;
using DocumentServiceAPI.Model.cyDocumentModel;
using DocumentServiceAPI.Model.UserInfoModel;
using DocumentServiceAPI.Utility;
using Furion.DynamicApiController;
using Furion.JsonSerialization;
@@ -74,7 +76,7 @@
                        case 0:
                            throw Oops.Oh($"账户或者密码错误");
                        case 1:
                        if (!needtoken)
                        if (!IsTokenPass)
                        {
                            needtoken = await _userService.CheckPsw(Tender[0].TenderId, Tender[0].EmployeeID, Parma.PassWord);
@@ -171,6 +173,14 @@
                    if (!needtoken)
                        throw Oops.Oh($"账户或者密码错误");
                }
                 var hasPermissions=   await _userService.TenderHasPermissions(Tender.TenderId);
                if(!hasPermissions)
                {
                    throw Oops.Oh($"集团用账号:{Tender.ItCode}使用期限已经过期或者没有使用权限");
                }
                    var token = _tokenService.CreateToken(new Model.JwtInfo
                    {
                        EID = Tender.EmployeeID,
@@ -193,34 +203,33 @@
        }
        /// <summary>
        /// 获取公司列表
        /// 是否是用户租户,或者是员工
        /// </summary>
        /// <returns>登录信息</returns>
        public bool GetUnitList()
        /// <param name="ITCode">账号</param>
        /// <returns>  返回true 代表是, false代表不是</returns>
        [HttpGet("IDIsEmployee")]
        public async Task<bool> IDIsEmployee(string ITCode, [FromServices] ISqlSugarClient db)
        {
          var ad=  ITCode.TryValidate(ValidationTypes.PhoneNumber);
            if(!ad.IsValid)
            {
                throw Oops.Oh("请输入正确的账号");
            }
          var count= await db.Queryable<TenantInfo>().Where(x=>x.ItCode==ITCode&&x.IsEn==true&&x.IsDel==false).WithCache(600).CountAsync();
            if (count > 0)
                return true;
            count=await db.Queryable<Document_EmployeeInfo>().Where(x=>x.UserName==ITCode).WithCache(600).CountAsync();
            if (count > 0)
                return true;
            return false;
            return true;
        }
        /// <summary>
        /// 获取公司列表
        /// </summary>
        /// <returns>登录信息</returns>
        public bool GetTenantInfoList()
        {
            return true;
        }
        public string Get()
        {
            return $"Hello {nameof(Furion)}";
        }
    }
}