Blame view

apps/passport/models/index-service.js 665 Bytes
htoooth authored
1 2 3
/**
 * Created by TaoHuang on 2016/6/21.
 */
htoooth authored
4
'use strict';
htoooth authored
5
王水玲 authored
6
const IndexApi = require('./index-api');
htoooth authored
7
王水玲 authored
8 9 10 11 12 13 14 15 16 17 18 19
module.exports = class extends global.yoho.BaseModel {
    constructor(ctx) {
        super(ctx);

        this.indexApi = new IndexApi(ctx);
    }

    /**
     * 获得资源
     */
    getResourceAsync(resourceCode) {
        return this.indexApi.getResourceAsync(resourceCode)
yyq authored
20 21 22 23 24 25 26 27
            .then(result => {
                if (result.code === 200) {
                    return result.data;
                } else {
                    return {};
                }
            })
            .catch(() => {
htoooth authored
28
                return {};
yyq authored
29
            });
王水玲 authored
30
    }
王水玲 authored
31
};