Blame view

apps/product/models/shop-api.js 1.64 KB
htoooth authored
1 2 3
/**
 * Created by TaoHuang on 2016/6/28.
 */
yoho authored
4 5
'use strict';
htoooth authored
6
const config = global.yoho.config;
yyq authored
7
htoooth authored
8 9 10 11
module.exports = class extends global.yoho.BaseModel {
    constructor(ctx) {
        super(ctx);
    }
htoooth authored
12
htoooth authored
13 14 15 16 17 18 19 20
    /**
     * 获取店铺装修的所有资源接口
     */
    shopsDecoratorListAsync(shopId) {
        return this.get({
            data: {
                method: 'app.shopsdecorator.getList',
                shop_id: shopId
htoooth authored
21
            }, param: config.apiCache
htoooth authored
22
        });
htoooth authored
23
    }
htoooth authored
24
htoooth authored
25 26 27 28 29 30 31
    /**
     * 获取店铺优惠券接口
     */
    shopCouponListAsync(shopId, uid) {
        let extra = {
            code: 200
        };
htoooth authored
32
htoooth authored
33 34 35 36 37 38 39 40 41
        if (!uid) {
            extra.cache = true;
        }

        return this.get({
            data: {
                method: 'shop.coupons.list',
                shop_id: shopId,
                uid: uid
htoooth authored
42
            }, param: extra
htoooth authored
43 44
        });
    }
htoooth authored
45
htoooth authored
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
    shopBannerAsync(shopId) {
        return this.get({
            data: {
                method: 'app.shop.banner',
                shop_id: shopId
            }
        });
    }

    queryShopsByBrandId(sid, bid) {
        return this.get({
            data: {
                method: 'app.product.queryShopsInfoById',
                brand_id: bid,
                shop_id: sid
            }
        });
    }
htoooth authored
64
htoooth authored
65 66 67 68 69 70 71 72 73 74 75 76 77
    /**
     * 根据shopId获取店铺基本信息
     * @return
     */
    getShopInfo(shopId, uid) {
        let finalParams = {
            method: 'app.shops.getIntro',
            shop_id: shopId || 0,
            uid: uid || 0
        };

        return this.get({
            data: finalParams,
htoooth authored
78
            param: config.apiCache
htoooth authored
79
        });
htoooth authored
80
    }
htoooth authored
81
};
yyq authored
82 83 84


htoooth authored
85