同步数据
This commit is contained in:
parent
f64bea41e2
commit
cbed606d65
|
@ -1 +1 @@
|
|||
Subproject commit 3803c578876627b66110ad8748592aafddabfa03
|
||||
Subproject commit 49c235a66f0f6a89c68039bd904eadd9497f8219
|
|
@ -12,6 +12,7 @@ export namespace sync_data_message {
|
|||
datas?: UpdataData[];
|
||||
submenu?: string;
|
||||
station?: string;
|
||||
userId?: number;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
|
||||
|
@ -28,6 +29,9 @@ export namespace sync_data_message {
|
|||
if ("station" in data && data.station != undefined) {
|
||||
this.station = data.station;
|
||||
}
|
||||
if ("userId" in data && data.userId != undefined) {
|
||||
this.userId = data.userId;
|
||||
}
|
||||
}
|
||||
}
|
||||
get operationType() {
|
||||
|
@ -54,11 +58,18 @@ export namespace sync_data_message {
|
|||
set station(value: string) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get userId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
|
||||
}
|
||||
set userId(value: number) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
operationType?: string;
|
||||
datas?: ReturnType<typeof UpdataData.prototype.toObject>[];
|
||||
submenu?: string;
|
||||
station?: string;
|
||||
userId?: number;
|
||||
}): SyncData {
|
||||
const message = new SyncData({});
|
||||
if (data.operationType != null) {
|
||||
|
@ -73,6 +84,9 @@ export namespace sync_data_message {
|
|||
if (data.station != null) {
|
||||
message.station = data.station;
|
||||
}
|
||||
if (data.userId != null) {
|
||||
message.userId = data.userId;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
|
@ -81,6 +95,7 @@ export namespace sync_data_message {
|
|||
datas?: ReturnType<typeof UpdataData.prototype.toObject>[];
|
||||
submenu?: string;
|
||||
station?: string;
|
||||
userId?: number;
|
||||
} = {};
|
||||
if (this.operationType != null) {
|
||||
data.operationType = this.operationType;
|
||||
|
@ -94,6 +109,9 @@ export namespace sync_data_message {
|
|||
if (this.station != null) {
|
||||
data.station = this.station;
|
||||
}
|
||||
if (this.userId != null) {
|
||||
data.userId = this.userId;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
|
@ -108,6 +126,8 @@ export namespace sync_data_message {
|
|||
writer.writeString(3, this.submenu);
|
||||
if (this.station.length)
|
||||
writer.writeString(4, this.station);
|
||||
if (this.userId != 0)
|
||||
writer.writeUint32(5, this.userId);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
|
@ -129,6 +149,9 @@ export namespace sync_data_message {
|
|||
case 4:
|
||||
message.station = reader.readString();
|
||||
break;
|
||||
case 5:
|
||||
message.userId = reader.readUint32();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue