|
@@ -78,12 +78,12 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
}).Entity;
|
|
|
maindb.SaveChanges();
|
|
|
ConsumerId = check.Id;
|
|
|
- maindb.ConsumerOpenIds.Add(new ConsumerOpenIds()
|
|
|
- {
|
|
|
- OpenId = openid,
|
|
|
- ConsumerId = ConsumerId,
|
|
|
- });
|
|
|
- maindb.SaveChanges();
|
|
|
+ // maindb.ConsumerOpenIds.Add(new ConsumerOpenIds()
|
|
|
+ // {
|
|
|
+ // OpenId = openid,
|
|
|
+ // ConsumerId = ConsumerId,
|
|
|
+ // });
|
|
|
+ // maindb.SaveChanges();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -175,8 +175,8 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
{
|
|
|
JsonData data = JsonMapper.ToObject(value);
|
|
|
string code = data["code"].ToString(); //微信小程序获取的code
|
|
|
- // string nickName = data["nickName"].ToString(); //昵称
|
|
|
- // string avatarUrl = data["avatarUrl"].ToString(); //头像地址
|
|
|
+ string nickName = data["nickName"].ToString(); //昵称
|
|
|
+ string avatarUrl = data["avatarUrl"].ToString(); //头像地址
|
|
|
string encryptedData = data["encryptedData"].ToString(); //微信小程序获取手机号的数据包
|
|
|
// string iv = data["iv"].ToString(); //微信小程序获取手机号的IV
|
|
|
Dictionary<string, object> Obj = new Dictionary<string, object>();
|
|
@@ -188,31 +188,31 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
mobile = mobile.Split('|')[1];
|
|
|
}
|
|
|
int ConsumerId = 0;
|
|
|
- Consumers check = maindb.Consumers.FirstOrDefault(m => m.AlipayUserId == openid);
|
|
|
+ Consumers check = maindb.Consumers.FirstOrDefault(m => m.WechatOpenId == openid);
|
|
|
if (check == null)
|
|
|
{
|
|
|
check = maindb.Consumers.Add(new Consumers()
|
|
|
{
|
|
|
CreateDate = DateTime.Now,
|
|
|
- // NickName = filterEmoji(nickName),
|
|
|
- // HeadPhoto = avatarUrl,
|
|
|
- // Mobile = mobile,
|
|
|
- AlipayUserId = openid,
|
|
|
+ NickName = filterEmoji(nickName),
|
|
|
+ HeadPhoto = avatarUrl,
|
|
|
+ Mobile = mobile,
|
|
|
+ WechatOpenId = openid,
|
|
|
}).Entity;
|
|
|
maindb.SaveChanges();
|
|
|
ConsumerId = check.Id;
|
|
|
- maindb.ConsumerOpenIds.Add(new ConsumerOpenIds()
|
|
|
- {
|
|
|
- OpenId = openid,
|
|
|
- ConsumerId = ConsumerId,
|
|
|
- });
|
|
|
- maindb.SaveChanges();
|
|
|
+ // maindb.ConsumerOpenIds.Add(new ConsumerOpenIds()
|
|
|
+ // {
|
|
|
+ // OpenId = openid,
|
|
|
+ // ConsumerId = ConsumerId,
|
|
|
+ // });
|
|
|
+ // maindb.SaveChanges();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- // check.NickName = filterEmoji(nickName);
|
|
|
- // check.HeadPhoto = avatarUrl;
|
|
|
- // check.Mobile = mobile;
|
|
|
+ check.NickName = filterEmoji(nickName);
|
|
|
+ check.HeadPhoto = avatarUrl;
|
|
|
+ check.Mobile = mobile;
|
|
|
ConsumerId = check.Id;
|
|
|
maindb.SaveChanges();
|
|
|
}
|