From 913d847804f0d6d3ee0475b22e4397e63b9e957d Mon Sep 17 00:00:00 2001 From: liangkun Date: Wed, 9 Nov 2022 16:42:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=99=BB=E5=BD=95app?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/WeixinApi.cs | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/WeixinApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/WeixinApi.cs index ee3d82139..d6dd164dc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/WeixinApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/WeixinApi.cs @@ -41,6 +41,60 @@ namespace Learun.Application.WebApi.Modules Get["/GetACIp"] = GetACIp; //获取logo Get["/GetLogo"] = GetImg; + //登录for app + Post["/weixinapplogin"] = Weixinapplogin; + } + + public Response Weixinapplogin(dynamic _) + { + LoginModel loginModel = this.GetReqData(); + var userEntity = userIbll.GetEntityByWeixinOpenId(loginModel.openid); + if (userEntity != null) + { + ReqParameter req = this.Bind(); + string token = OperatorHelper.Instance.AddLoginUser(userEntity.F_Account, "Learun_ADMS_6.1_App", req.loginMark, false);//写入缓存信息 + #region 写入日志 + LogEntity logEntity = new LogEntity(); + logEntity.F_CategoryId = 1; + logEntity.F_OperateTypeId = ((int)OperationType.Login).ToString(); + logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Login); + logEntity.F_OperateAccount = userEntity.F_Account + "(" + userEntity.F_RealName + ")"; + logEntity.F_OperateUserId = !string.IsNullOrEmpty(userEntity.F_UserId) ? userEntity.F_UserId : userEntity.F_Account; + logEntity.F_Module = Config.GetValue("SoftName"); + logEntity.F_Description = "移动端"; + #endregion + //写入日志 + logEntity.F_ExecuteResult = 1; + logEntity.F_ExecuteResultJson = "登录成功"; + logEntity.WriteLog(); + + OperatorResult res = OperatorHelper.Instance.IsOnLine(token, req.loginMark); + res.userInfo.password = null; + res.userInfo.secretkey = null; + var studententity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(userEntity.F_Account); + if (studententity != null) + { + res.userInfo.grade = studententity.Grade; + var majorinfo = majorIbll.GetCdMajorEntityByMajorNo(studententity.MajorNo); + if (majorinfo != null) + { + res.userInfo.majorno = majorinfo.ID ?? ""; + } + + } + var jsonData = new + { + logined = true, + baseinfo = res.userInfo, + post = postIBLL.GetListByPostIds(res.userInfo.postIds), + role = roleIBLL.GetListByRoleIds(res.userInfo.roleIds) + }; + return Success(jsonData); + } + else + { + return Success(new{ logined = false }); + } } public Response GetImg(dynamic _)