public UserMeta(UserMeta userMeta) { username = userMeta.username; uid = userMeta.uid; nickname = userMeta.nickname; role = userMeta.role; }
//user public async Task updateProfile(string nickname, string password, Action <ResponseError, UserMeta, string> cb) { if (!this.role) { cb(null, null, "没有权限的操作"); return; } ; var body = new Dictionary <string, string> { { "uid", uid } }; if (nickname != null) { body["nickname"] = nickname; } if (password != null) { body["password"] = password; } string info = JsonConvert.SerializeObject(body, Formatting.Indented); string result = ""; ServerResponse <UserMeta> res = null; try { result = await Server.getInstance().put("api/user/update", info); } catch (Exception e) { cb(new ResponseError("NETWORK_ERROR", "无法连接服务器"), null, "无法连接服务器"); return; } try { res = JsonConvert.DeserializeObject <ServerResponse <UserMeta> >(result); } catch (Exception e) { cb(new ResponseError("BAD_DATA", "无法解析服务器返回的信息"), null, "无法解析服务器返回的信息: " + result); return; } if (res.isSuccess()) { UserMeta data = res.getData(); cb(null, data, res.getMessage()); } else { cb(res.getError(), null, res.getMessage()); } return; }
public User(UserMeta userMeta, string Email) : base(userMeta) { email = Email; }
public User(UserMeta userMeta, string Email, string Password) : base(userMeta) { email = Email; password = Password; }