detail-consult-api.js 978 Bytes
/**
 * Created by TaoHuang on 2016/6/13.
 */

'use strict';

const api = global.yoho.API;

/**
 * 咨询内容列表
 */
const indexAsync = function(uid, pid, page, size) {
    let param = {};

    param.method = 'app.consult.li';
    param.product_id = pid;

    if (uid) {
        param.uid = uid;
    }

    param.page = page;
    param.limit = size;

    return api.get('', param);
};

/**
 * 添加咨询操作
 */
const createAsync = function(uid, pid, content) {
    return api.post('', {
        method: 'h5.consult.add',
        product_id: pid,
        content: content,
        uid: uid
    });
};

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
    });
};

module.exports = {
    indexAsync,
    createAsync,
    likeAsync,
    usefulAsync
};