feat: Add CreateWeChatUser API
This commit is contained in:
parent
1857cc66e4
commit
af95a6e1b2
|
|
@ -10,4 +10,31 @@ public partial class MongoRepository
|
||||||
return weChatUser != null ? weChatUser.ToWeChatUser() : null;
|
return weChatUser != null ? weChatUser.ToWeChatUser() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WeChatUser? CreateWeChatUser(WeChatUser weChatUser)
|
||||||
|
{
|
||||||
|
if (weChatUser == null) return null;
|
||||||
|
|
||||||
|
var weChatUserInfo = new WeChatUserDocument
|
||||||
|
{
|
||||||
|
Id = weChatUser.Id ?? Guid.NewGuid().ToString(),
|
||||||
|
OpenId = weChatUser.OpenId,
|
||||||
|
SessionKey = weChatUser.SessionKey,
|
||||||
|
UnionId = weChatUser.UnionId,
|
||||||
|
Sex = weChatUser.Sex,
|
||||||
|
Province = weChatUser.Province,
|
||||||
|
City = weChatUser.City,
|
||||||
|
NickName = weChatUser.NickName,
|
||||||
|
Headimgurl = weChatUser.Headimgurl,
|
||||||
|
PhoneNumber = weChatUser.PhoneNumber,
|
||||||
|
Country = weChatUser.Country,
|
||||||
|
Privilege = weChatUser.Privilege,
|
||||||
|
CreatedAt = DateTime.UtcNow,
|
||||||
|
};
|
||||||
|
|
||||||
|
_dc.WeChatUsers.InsertOne(weChatUserInfo);
|
||||||
|
|
||||||
|
return weChatUserInfo.ToWeChatUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue