添加天气信号源请求城市信息时带上本地语言

This commit is contained in:
fangxiang 2022-09-16 15:55:31 +08:00
parent 1f781e1f7a
commit ce1b108f2a
3 changed files with 9 additions and 5 deletions

View File

@ -1166,10 +1166,10 @@ export default class ClientConnection {
}
}
public async getCityList() {
public async getCityList(language?: string) {
try {
return await this.doRpc<Protocol.GetCityListResponseEntity>(
new Protocol.GetCityListRequestEntity()
new Protocol.GetCityListRequestEntity(language)
);
} catch (e) {
console.error(e);

View File

@ -227,7 +227,7 @@
import { defineComponent, ref, Ref, watch, computed, reactive } from "vue";
import { useStore } from "src/store";
import GlobalData from "src/common/GlobalData";
import { useQuasar, date as DateHelper } from "quasar";
import { useQuasar, date as DateHelper, Cookies } from "quasar";
import { useI18n } from "vue-i18n";
import WeatherWindowParamEntity from "src/entities/WeatherWindowParamEntity";
import { api } from "src/boot/axios";
@ -412,8 +412,10 @@ export default defineComponent({
get_all_city_data = () => {
const global_data = GlobalData.getInstance().getCurrentClient();
if (global_data) {
let language = Cookies.get("language");
global_data
.getCityList()
.getCityList(language ?? "")
.then((resposne) => {
if (!resposne) {
return;

View File

@ -2828,13 +2828,15 @@ export namespace Protocol {
}
export class GetCityListRequestEntity extends PacketEntity {
constructor(rpc_id = 0) {
constructor(language?: string, rpc_id = 0) {
super();
super.command = Commands.kRpcGetCityList;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;
this.language = language ?? "";
}
timestamp = Date.now();
language = "";
}
export class GetCityListResponseEntity extends PacketEntity {