协议修改
This commit is contained in:
@@ -13,7 +13,32 @@ export class AccountData extends BaseData {
|
||||
// 是否新手
|
||||
private _isNewGuide = true;
|
||||
// 是否刚注册
|
||||
private _isNewRegist = true;
|
||||
private _isNewRegist = true;
|
||||
|
||||
public reset(): void {
|
||||
this._identifier = "";
|
||||
this._identityType = 1;
|
||||
this._uid = "";
|
||||
this._isNewGuide = true;
|
||||
this._isNewRegist = true;
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
this._identifier = "";
|
||||
this._identityType = 1;
|
||||
this._uid = "";
|
||||
this._isNewGuide = true;
|
||||
this._isNewRegist = true;
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
super.destroy();
|
||||
this._identifier = null;
|
||||
this._identityType = null;
|
||||
this._uid = null;
|
||||
this._isNewGuide = null;
|
||||
this._isNewRegist = null;
|
||||
}
|
||||
|
||||
/** 设置身份识别码 */
|
||||
public set identifier(value: string) {
|
||||
@@ -64,29 +89,4 @@ export class AccountData extends BaseData {
|
||||
public get isNewRegist(): boolean {
|
||||
return this._isNewRegist;
|
||||
}
|
||||
|
||||
public reset(): void {
|
||||
this._identifier = "";
|
||||
this._identityType = 1;
|
||||
this._uid = "";
|
||||
this._isNewGuide = true;
|
||||
this._isNewRegist = true;
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
this._identifier = "";
|
||||
this._identityType = 1;
|
||||
this._uid = "";
|
||||
this._isNewGuide = true;
|
||||
this._isNewRegist = true;
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
super.destroy();
|
||||
this._identifier = null;
|
||||
this._identityType = null;
|
||||
this._uid = null;
|
||||
this._isNewGuide = null;
|
||||
this._isNewRegist = null;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ export class LoginData extends BaseData {
|
||||
private _token = "";
|
||||
// refresh token
|
||||
private _refreshToken = "";
|
||||
// token 过期时间戳
|
||||
private _expire = 0;
|
||||
// 操作类型,1:登录界面;2:断线重连;3:其他
|
||||
private _operateType = 1;
|
||||
// 公网IP
|
||||
@@ -19,7 +21,44 @@ export class LoginData extends BaseData {
|
||||
// sdk体系的UID
|
||||
private _sdkUid = "";
|
||||
// 上次登陆时间
|
||||
private _lastLoginTime = "";
|
||||
private _lastLoginTime = "";
|
||||
|
||||
public reset(): void {
|
||||
this._loginState = 0;
|
||||
this._token = "";
|
||||
this._refreshToken = "";
|
||||
this._expire = 0;
|
||||
this._operateType = 1;
|
||||
this._ip = "";
|
||||
this._machineIdentifier = "";
|
||||
this._sdkUid = "";
|
||||
this._lastLoginTime = "";
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
this._loginState = 0;
|
||||
this._token = "";
|
||||
this._refreshToken = "";
|
||||
this._expire = 0;
|
||||
this._operateType = 1;
|
||||
this._ip = "";
|
||||
this._machineIdentifier = "";
|
||||
this._sdkUid = "";
|
||||
this._lastLoginTime = "";
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
super.destroy();
|
||||
this._loginState = null;
|
||||
this._token = null;
|
||||
this._refreshToken = null;
|
||||
this._expire = null;
|
||||
this._operateType = null;
|
||||
this._ip = null;
|
||||
this._machineIdentifier = null;
|
||||
this._sdkUid = null;
|
||||
this._lastLoginTime = null;
|
||||
}
|
||||
|
||||
/**是否已登录成功 */
|
||||
public isLogin(): boolean {
|
||||
@@ -55,8 +94,18 @@ export class LoginData extends BaseData {
|
||||
/** 获取登录refresh token */
|
||||
public get refreshToken(): string {
|
||||
return this._refreshToken;
|
||||
}
|
||||
}
|
||||
|
||||
/** 设置token 过期时间戳 */
|
||||
public set expire(value: number) {
|
||||
this._expire = value;
|
||||
}
|
||||
|
||||
/** 获取token 过期时间戳 */
|
||||
public get expire(): number {
|
||||
return this._expire;
|
||||
}
|
||||
|
||||
/** 设置操作类型 */
|
||||
public set operateType(value: number) {
|
||||
this._operateType = value;
|
||||
@@ -106,35 +155,4 @@ export class LoginData extends BaseData {
|
||||
public get lastLoginTime(): string {
|
||||
return this._lastLoginTime;
|
||||
}
|
||||
|
||||
public reset(): void {
|
||||
this._loginState = 0;
|
||||
this._token = "";
|
||||
this._operateType = 1;
|
||||
this._ip = "";
|
||||
this._machineIdentifier = "";
|
||||
this._sdkUid = "";
|
||||
this._lastLoginTime = "";
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
this._loginState = 0;
|
||||
this._token = "";
|
||||
this._operateType = 1;
|
||||
this._ip = "";
|
||||
this._machineIdentifier = "";
|
||||
this._sdkUid = "";
|
||||
this._lastLoginTime = "";
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
super.destroy();
|
||||
this._loginState = null;
|
||||
this._token = null;
|
||||
this._operateType = null;
|
||||
this._ip = null;
|
||||
this._machineIdentifier = null;
|
||||
this._sdkUid = null;
|
||||
this._lastLoginTime = null;
|
||||
}
|
||||
}
|
||||
@@ -4,29 +4,59 @@
|
||||
import { BaseData } from "./BaseData";
|
||||
|
||||
export class PlayerData extends BaseData {
|
||||
// 用户名
|
||||
private _name: string = '';
|
||||
private _score: number = 0;
|
||||
// 钻石数
|
||||
private _diamond: number = 0;
|
||||
// vip失效时间戳
|
||||
private _vipExpire: number = 0;
|
||||
|
||||
public reset(): void {
|
||||
this._name = '';
|
||||
this._score = 0;
|
||||
this._diamond = 0;
|
||||
this._vipExpire = 0;
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
this._name = '';
|
||||
this._score = 0;
|
||||
this._diamond = 0;
|
||||
this._vipExpire = 0;
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
super.destroy();
|
||||
// 这里可以做额外释放资源的操作
|
||||
this._name = null;
|
||||
this._diamond = null;
|
||||
this._vipExpire = null;
|
||||
}
|
||||
|
||||
public setName(name: string): void {
|
||||
this._name = name;
|
||||
/** 设置用户名 */
|
||||
public set name(value: string) {
|
||||
this._name = value;
|
||||
}
|
||||
|
||||
public getName(): string {
|
||||
/** 获取用户名 */
|
||||
public get name(): string {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
/** 设置钻石数 */
|
||||
public set diamond(value: number) {
|
||||
this._diamond = value;
|
||||
}
|
||||
|
||||
/** 获取钻石数 */
|
||||
public get diamond(): number {
|
||||
return this._diamond;
|
||||
}
|
||||
|
||||
/** 设置vip失效时间戳 */
|
||||
public set vipExpire(value: number) {
|
||||
this._vipExpire = value;
|
||||
}
|
||||
|
||||
/** 获取vip失效时间戳 */
|
||||
public get vipExpire(): number {
|
||||
return this._vipExpire;
|
||||
}
|
||||
}
|
||||
@@ -11,25 +11,14 @@ export class PlayerDataService {
|
||||
}
|
||||
private constructor(private api = ApiClient.I) {}
|
||||
|
||||
// 拉取玩家数据
|
||||
public async reqQueryPlayerData(req: proto.ProtoMsg.IQueryPlayerDataReq): Promise<ApiResponse<proto.ProtoMsg.IQueryPlayerDataRsp>> {
|
||||
let epData: Endpoint<proto.ProtoMsg.IQueryPlayerDataReq, proto.ProtoMsg.IQueryPlayerDataRsp> = {
|
||||
path: "playerdata/query_player_data",
|
||||
// 获取个人信息
|
||||
public async reqMyInfo(req: proto.cs.ICSMyInfoReq): Promise<ApiResponse<proto.cs.ICSMyInfoRes>> {
|
||||
let epData: Endpoint<proto.cs.ICSMyInfoReq, proto.cs.ICSMyInfoRes> = {
|
||||
path: "api/acc/info",
|
||||
method: "POST",
|
||||
codec: "json",
|
||||
needsAuth: true
|
||||
};
|
||||
return this.api.call(epData, req);
|
||||
}
|
||||
|
||||
// 保存玩家数据
|
||||
public async reqSavePlayerData(req: proto.ProtoMsg.ISavePlayerDataReq): Promise<ApiResponse<proto.ProtoMsg.ISavePlayerDataRsp>> {
|
||||
let epData: Endpoint<proto.ProtoMsg.ISavePlayerDataReq, proto.ProtoMsg.ISavePlayerDataRsp> = {
|
||||
path: "playerdata/save_player_data",
|
||||
method: "POST",
|
||||
codec: "json",
|
||||
needsAuth: true
|
||||
};
|
||||
return this.api.call(epData, req);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user