private ShowUserInfo user2ShowUser(bsp_users user) { var ShowUser = new ShowUserInfo(); ShowUser.uid = user.uid; ShowUser.avater = user.avatar; ShowUser.nickname = user.nickname; ShowUser.openid = user.openid; ShowUser.username = user.username; ShowUser.gender = user.gender; return(ShowUser); }
/// <summary> /// 调用login判断无用户信息后,小程序端通过GetUserInfo之后获取用户信息之后发送给服务端存储,返回用户信息 /// </summary> public ResultModel SetUserInfo(ShowUserInfo showUserInfo) { using (brnshopEntities context = new brnshopEntities()) { try { var newuser = new bsp_users() { admingid = 0, avatar = showUserInfo.avater, email = "", gender = showUserInfo.gender, liftbantime = DateTime.Now, mobile = "", nickname = showUserInfo.nickname, openid = showUserInfo.openid, password = "", paycredits = 0, rankcredits = 0, salt = "", username = showUserInfo.username, userrid = 0, verifyemail = 0, verifymobile = 0 }; context.bsp_users.Add(newuser); context.SaveChanges(); showUserInfo.uid = newuser.uid; return(ResultModel.Success("", showUserInfo)); } catch (Exception ex) { Logger._.Error(ex); return(ResultModel.Error()); } } }