修改账号接口返回结构
修改部分账号接口逻辑
This commit is contained in:
liangtongchuan
2020-10-16 20:22:44 +08:00
parent f6509532ac
commit df2da73006
7 changed files with 39 additions and 48 deletions

View File

@@ -1,5 +1,7 @@
import { STATUS } from './../../../consts/statusCode';
import { dispatch } from '../../../util/dispatcher';
import { Application , BackendSession} from 'pinus';
import { resResult } from '../../../pubUtils/util';
export default function (app: Application) {
return new GateHandler(app);
@@ -16,26 +18,18 @@ export class GateHandler {
* @param {Object} session
*
*/
async queryEntry(msg: {uid: string}, session: BackendSession) {
let uid = msg.uid;
if (!uid) {
return {
code: 500
};
async queryEntry(msg: {userCode: string}, session: BackendSession) {
let { userCode } = msg;
if (!userCode) {
return resResult(STATUS.WRONG_PARMS);
}
// get all connectors
let connectors = this.app.getServersByType('connector');
if (!connectors || connectors.length === 0) {
return {
code: 500
};
return resResult(STATUS.CONNECTOR_ERR);
}
// select connector
let res = dispatch(uid, connectors);
return {
code: 200,
host: res.clientHost,
port: res.clientPort
};
let res = dispatch(userCode, connectors);
return resResult(STATUS.SUCCESS, {host: res.clientHost, port: res.clientPort});
}
}