This commit is contained in:
zpc 2025-09-07 22:58:32 +08:00
parent 9c0743a17e
commit 8fa62e16af

View File

@ -251,6 +251,41 @@ namespace CoreCms.Net.Web.WebApi.Controllers
}
/// <summary>
/// 微信小程序匿名转正式登录
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> UseWxAnonymousLogin([FromBody] FMWxLoginPhoneNumber entity)
{
var jm = new WebApiCallBack();
var userInfo = await _userWeChatInfoServices.QueryByClauseAsync(p => p.openid == entity.sessionAuthId);
if (userInfo == null)
{
jm.code = -1;
jm.msg = "用户信息获取失败";
return jm;
}
string phoneNumber = userInfo.mobile;
Random rnd = new Random();
var data = new FMWxAccountCreate
{
mobile = phoneNumber,
invitecode = entity.invitecode,
sessionAuthId = entity.sessionAuthId,
nickname = "微信用户" + rnd.Next(1000, 9999),
};
jm = await _userServices.SmsLogin(data);
return jm;
}
#region wx.login登陆成功之后发送的请求=========================================================
/// <summary>