Blame view

apps/product/models/detail-consult-api.js 978 Bytes
htoooth authored
1 2 3 4 5 6
/**
 * Created by TaoHuang on 2016/6/13.
 */

'use strict';
htoooth authored
7
const api = global.yoho.API;
htoooth authored
8 9 10 11

/**
 * 咨询内容列表
 */
htoooth authored
12
const indexAsync = function(uid, pid, page, size) {
htoooth authored
13
    let param = {};
htoooth authored
14
htoooth authored
15 16 17
    param.method = 'app.consult.li';
    param.product_id = pid;
htoooth authored
18
    if (uid) {
htoooth authored
19 20 21 22 23 24
        param.uid = uid;
    }

    param.page = page;
    param.limit = size;
htoooth authored
25
    return api.get('', param);
htoooth authored
26 27 28 29 30
};

/**
 * 添加咨询操作
 */
htoooth authored
31 32
const createAsync = function(uid, pid, content) {
    return api.post('', {
htoooth authored
33 34 35 36
        method: 'h5.consult.add',
        product_id: pid,
        content: content,
        uid: uid
htoooth authored
37 38 39
    });
};
htoooth authored
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
const likeAsync = (uid, id) => {
    return api.get('', {
        method: 'app.consult.like',
        uid: uid,
        id: id
    });
};

const usefulAsync = (uid, id) => {
    return api.get('', {
        method: 'app.consult.useful',
        uid: uid,
        id: id
    });
};
htoooth authored
56 57
module.exports = {
    indexAsync,
htoooth authored
58 59 60
    createAsync,
    likeAsync,
    usefulAsync
htoooth authored
61
};