Browse Source

微信登录app接口

娄底高职分支
liangkun 2 years ago
parent
commit
913d847804
1 changed files with 54 additions and 0 deletions
  1. +54
    -0
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/WeixinApi.cs

+ 54
- 0
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/WeixinApi.cs View File

@@ -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<LoginModel>();
var userEntity = userIbll.GetEntityByWeixinOpenId(loginModel.openid);
if (userEntity != null)
{
ReqParameter req = this.Bind<ReqParameter>();
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 _)


Loading…
Cancel
Save