后台:可以设置固定ip属地

This commit is contained in:
luying
2022-08-04 19:33:36 +08:00
parent 0d1eb9c7b6
commit 0449983cd1
8 changed files with 22 additions and 18 deletions
@@ -126,6 +126,7 @@ export async function getModuleData(type: string, data: { role: RoleType, sessio
role['skins'] = skins;
let apJson = await getAp(role.roleId, '', role.lv);
role['apJson'] = apJson;
role['ipLocation'] = role.fixedIpLocation||role.ipLocation||'未知';
if (!role.showLineup) role.showLineup = role.topLineup.map(cur => cur.hid);
role.heads = role.heads.filter(cur => cur.status);
+2 -2
View File
@@ -293,11 +293,11 @@ export async function getSchoolPoint(roleId: string) {
}, 0);
}
export async function setIpLocation(roleId: string, ip: string) {
export async function getIpLocation(ip: string) {
try {
const res = query.search(ip);
console.log('##### setIpLocation', res)
await RoleModel.updateRoleInfo(roleId, { ip, ipLocation: res.province||res.country })
return res.province||res.country||'未知';
} catch(e) {
console.error('setIpLocation', e)
}