Blame view

apps/home/models/index-api.js 2.14 KB
weiqingting authored
1 2
'use strict';
郝肖肖 authored
3 4 5 6
module.exports = class extends global.yoho.BaseModel {
    constructor(ctx) {
        super(ctx);
    }
weiqingting authored
7
郝肖肖 authored
8 9 10 11 12
    pendingOrderCount(uid) {
        let options = {
            method: 'web.SpaceOrders.getPendingOrderCount',
            uid: uid
        };
htoooth authored
13
郝肖肖 authored
14 15
        return this.get({data: options});
    }
htoooth authored
16
郝肖肖 authored
17 18 19 20 21 22
    unreadMessageCount(uid, udid) {
        let options = {
            method: 'app.home.getInfoNum',
            uid: uid,
            udid: udid
        };
htoooth authored
23
郝肖肖 authored
24 25
        return this.get({data: options});
    }
htoooth authored
26
郝肖肖 authored
27 28 29 30 31
    needCommentCount(uid) {
        let options = {
            method: 'show.notCommentRecordCount',
            uid: uid
        };
htoooth authored
32
郝肖肖 authored
33 34
        return this.get({data: options});
    }
htoooth authored
35
郝肖肖 authored
36 37 38 39 40
    guessBrand() {
        let options = {
            method: 'web.search.favorBrand'
        };
周少峰 authored
41
        return this.get({data: options, param: {cache: 86400}});
郝肖肖 authored
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
    }

    newArrival() {
        let options = {
            method: 'web.search.search',
            sales: 'Y',
            outlets: 2,
            stocknumber: 1,
            new: 'Y',
            order: 's_t_desc',
            viewNum: 0
        };

        return this.get({data: options});
    }

    /**
     * 优选新品
     *
     * @param int $channel 频道,1代表男生,2代表女生,3代表潮童,4代表创意生活
     * @param $uid 用户ID
     * @param $udid 设备ID
     * @param $rec_pos 位置码
     * @param $limit 数量限制
     * @return array 接口返回的数据
     */
    recommend(channelNum, uid, udid, pos, limit) {
        let options = {
            method: 'app.home.newPreference',
            yh_channel: channelNum,
            uid: uid,
            udid: udid,
            rec_pos: pos,
            limit: limit
        };

        return this.get({data: options});
    }

    /**
     * 根据节点和运行模式选择静态内容
     * @param $node 20141219-100447
     * @param string $mode
     * @return mixed
     */
周少峰 authored
87
    getByNodeContent(node, mode, params) {
郝肖肖 authored
88 89 90 91 92
        let options = {
            method: 'web.html.content',
            mode: mode,
            node: node
        };
weiqingting authored
93
周少峰 authored
94
        return this.get({data: options, param: params || {}});
郝肖肖 authored
95
    }
陈轩 authored
96
};