注册协议增加attribute字段

This commit is contained in:
fangxiang 2023-02-23 16:45:39 +08:00
parent 5c7ac2a7d0
commit 3bc125cff0
4 changed files with 28 additions and 21 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "media_player_client", "name": "media_player_client",
"version": "1.5.9", "version": "1.6.0",
"description": "A Quasar Framework app", "description": "A Quasar Framework app",
"productName": "MediaPlayerClient", "productName": "MediaPlayerClient",
"author": "fangxiang <fangxiang@cloudview.work>", "author": "fangxiang <fangxiang@cloudview.work>",

View File

@ -823,6 +823,7 @@ export default class ClientConnection {
active_code: string, active_code: string,
online: boolean, online: boolean,
active_forever: boolean, active_forever: boolean,
attribute: number,
secret_key?: string, secret_key?: string,
hour?: number hour?: number
) { ) {
@ -833,6 +834,7 @@ export default class ClientConnection {
active_code, active_code,
online, online,
active_forever, active_forever,
attribute,
secret_key, secret_key,
hour, hour,
0 0

View File

@ -461,7 +461,7 @@ import {
nextTick, nextTick,
} from "vue"; } from "vue";
import { useStore } from "src/store"; import { useStore } from "src/store";
import { useQuasar, copyToClipboard } from "quasar"; import { useQuasar, copyToClipboard, Cookies } from "quasar";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import GlobalData from "src/common/GlobalData"; import GlobalData from "src/common/GlobalData";
import QrcodeVue from "qrcode.vue"; import QrcodeVue from "qrcode.vue";
@ -707,22 +707,9 @@ export default defineComponent({
} }
let success = false; let success = false;
const response = await GlobalData.getInstance()
.getCurrentClient()
?.registerDevice(
register_code.value,
active_code.value,
register_type.value == "online",
active_type.value == "forever",
secret_key.value,
parseInt(active_hour.value.toString())
);
if (response) {
success = response.success;
}
if (success) { let attribute = EDeviceAttribute.None;
let attribute = EDeviceAttribute.None; {
if (function_center_control.value) { if (function_center_control.value) {
attribute |= EDeviceAttribute.CenterControl; attribute |= EDeviceAttribute.CenterControl;
} }
@ -745,14 +732,28 @@ export default defineComponent({
function_fusion_count.value function_fusion_count.value
); );
} }
}
GlobalData.getInstance() const response = await GlobalData.getInstance()
.getCurrentClient() .getCurrentClient()
?.setDeviceAttribute(attribute); ?.registerDevice(
register_code.value,
active_code.value,
register_type.value == "online",
active_type.value == "forever",
attribute,
secret_key.value,
parseInt(active_hour.value.toString())
);
if (response) {
success = response.success;
}
if (success) {
GlobalData.getInstance() GlobalData.getInstance()
.getCurrentClient() .getCurrentClient()
?.setServerLanguage(target_language.value); ?.setServerLanguage(target_language.value);
Cookies.remove("language");
} }
$q.notify({ $q.notify({
@ -765,7 +766,7 @@ export default defineComponent({
position: "top", position: "top",
timeout: 1500, timeout: 1500,
}); });
show_dialog.value = false; show_dialog.value = !success;
} catch {} } catch {}
loading.value = false; loading.value = false;
}, },

View File

@ -1828,11 +1828,14 @@ export namespace Protocol {
online: boolean = false; online: boolean = false;
active_forever: boolean = false; active_forever: boolean = false;
hour: number = 0; hour: number = 0;
attribute: number = 0;
constructor( constructor(
register_code: string, register_code: string,
active_code: string, active_code: string,
online: boolean, online: boolean,
active_forever: boolean, active_forever: boolean,
attribute: number,
secret_key?: string, secret_key?: string,
hour?: number, hour?: number,
rcp_id?: number rcp_id?: number
@ -1847,6 +1850,7 @@ export namespace Protocol {
this.online = online; this.online = online;
this.active_forever = active_forever; this.active_forever = active_forever;
this.secret_key = secret_key ?? ""; this.secret_key = secret_key ?? "";
this.attribute = attribute ?? 0;
if (active_forever) { if (active_forever) {
this.hour = 0; this.hour = 0;
} else { } else {