diff --git a/components/models/Character.js b/components/models/Character.js index e0364a24..2d980bb5 100644 --- a/components/models/Character.js +++ b/components/models/Character.js @@ -104,19 +104,23 @@ let getMeta = function (name) { Character.get = function (val) { let roleid, name; - if (typeof (val) === "number") { + if (typeof (val) === "number" || /^\d*$/.test(val)) { roleid = val; } else if (val.id) { roleid = val.id; name = val.name || YunzaiApps.mysInfo['roleIdToName'](roleid, true); } else { roleid = YunzaiApps.mysInfo['roleIdToName'](val); + + } + if (!name) { name = YunzaiApps.mysInfo['roleIdToName'](roleid, true); } if (!name) { return false; } + return new Character(name, roleid); };