/// <summary> /// 更新用户数据 /// 0 成功, -1 用户不存在 , -2 数据库错误 /// </summary> /// <param name="token"></param> /// <param name="model"></param> /// <returns></returns> public int UpdateInfo(UserToken token, UserModel model) { // 根据token获取账号id int acc_id = CacheFactory.accountCache.GetIdToToken(token); // 用户是否存在? bool result = CacheFactory.userCache.hasUser(acc_id); if (!result) { return(-1); } USER tmp = CacheFactory.userCache.GetUserInfo(acc_id); tmp.nickName = model.nickname; tmp.phone = model.phone; tmp.sex = model.sex; tmp.mail = model.mail; tmp.birthday = model.birthday; bool re = tmp.Update(); if (re) { return(0); } return(-2); }
// 重命名 public int ReName(int acc_id, string name) { USER tmp = cacheDic[acc_id]; tmp.nickName = name; tmp.Update(); return(0); }