1
0
iidx-plugin/handlers/IIDXshop.ts
2022-02-19 17:36:39 -05:00

78 lines
1.6 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { shop_data } from "../models/shop_data";
export const shopgetname: EPR = async (info, data, send) => {
// バージョン
console.debug(`Version:${info.module.substr(0, 6)}`);
const shop_data = await DB.FindOne<shop_data>({
collection: "shop_data",
});
const shop_data_old = await DB.FindOne<shop_data>(null, {
collection: "shop_data",
});
if(shop_data_old){
await DB.Remove<shop_data>(null, {
collection: "shop_data",
});
}
if (_.isNil(shop_data)) {
await DB.Insert<shop_data>({
collection: "shop_data",
shop_name: "",
});
send.object(
K.ATTR({
cls_opt: "0",
hr: "0",
mi: "0",
opname: "",
pid: "57",
// status: "0",
})
);
} else {
send.object(
K.ATTR({
cls_opt: "0",
hr: "0",
mi: "0",
opname: shop_data.shop_name,
pid: "57",
// status: "0",
})
);
}
};
export const shopgetconvention: EPR = async (info, data, send) => {
send.object(
K.ATTR(
{
end_time: "0",
music_0: "23051",
music_1: "24010",
music_2: "12004",
music_3: "26007",
start_time: "0",
// status: "0",
},
{
valid: K.ITEM("bool", 0),
}
)
);
};
export const shopsavename: EPR = async (info, data, send) => {
await DB.Upsert<shop_data>(
{
collection: "shop_data",
},
{
$set: {
shop_name: $(data).attr().opname,
},
}
);
send.success();
};