index-service.js
665 Bytes
/**
* Created by TaoHuang on 2016/6/21.
*/
'use strict';
const IndexApi = require('./index-api');
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
this.indexApi = new IndexApi(ctx);
}
/**
* 获得资源
*/
getResourceAsync(resourceCode) {
return this.indexApi.getResourceAsync(resourceCode)
.then(result => {
if (result.code === 200) {
return result.data;
} else {
return {};
}
})
.catch(() => {
return {};
});
}
};