32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
"use strict";
|
|
const utils_request = require("../../../utils/request.js");
|
|
const config_setting = require("../../../config/setting.js");
|
|
async function pageMerchant(params) {
|
|
const res = await utils_request.http.get(config_setting.MODULES_API_URL + "/shop/merchant/page", {
|
|
params
|
|
});
|
|
if (res.data.code === 0) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
async function listMerchant(params) {
|
|
const res = await utils_request.http.get(config_setting.MODULES_API_URL + "/shop/merchant", {
|
|
params
|
|
});
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
async function getMerchant(id) {
|
|
const res = await utils_request.http.get(config_setting.MODULES_API_URL + "/shop/merchant/" + id);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
exports.getMerchant = getMerchant;
|
|
exports.listMerchant = listMerchant;
|
|
exports.pageMerchant = pageMerchant;
|