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

'use strict';


const library = '../../../library';
const API = require(`${library}/api`).API;
const sign = require(`${library}/sign`);
const log = require(`${library}/logger`);

const api = new API();

/**
 * 咨询内容列表
 */
module.exports.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('', sign.apiSign(param)).catch(log.error);
};

/**
 * 添加咨询操作
 */
module.exports.createAsync = function (uid, pid, content) {
    return api.post('', sign.apiSign({
        method: 'h5.consult.add',
        product_id: pid,
        content: content,
        uid: uid
    })).catch(log.error);
};