fix: 不存在的用户接口报错

This commit is contained in:
suxiaoxin 2017-10-07 07:05:54 +08:00
parent 2e000bb128
commit 72883a1a14

View File

@ -218,8 +218,10 @@ class interfaceController extends baseController {
yapi.emitHook('interface_get', params.id).then();
result = result.toObject();
result.username = userinfo.username;
if(userinfo){
result.username = userinfo.username;
}
ctx.body = yapi.commons.resReturn(result);
} catch (e) {
ctx.body = yapi.commons.resReturn(null, 402, e.message);