import request from "@/service/request";
import { devProxy } from "@/service/network";
import { KEY_NO_LOADING } from "@/service/request";

//////////////////////////// 服务地址 ////////////////////////////

// target: http://106.14.189.173:8080

// 致拓宜搭服务地址
function _requestUrl (url) {
  return `http://106.14.189.173:8080/api/dd${url}`;
}

/////////////////////  业务逻辑:thunk包装调用  /////////////////////

// 查询首页轮播图
export function getBannerResource (params) {
  return request.getParams(
    _requestUrl("/sys/maintenance/getBannerResource"),
    params
  );
}

// 查询首页配置模块
export function getHomepageResource (params) {
  return request.getParams(
    _requestUrl("/sys/maintenance/getHomepageResource"),
    params
  );
}

// 获取竞品速链页维护数据
export function getOtherProductResource (params) {
  return request.getParams(
    _requestUrl("/sys/maintenance/getOtherProductResource"),
    params
  );
}

// PK查询多产品详情: pk详情页
export function queryProductDetailList (params) {
  return request.getParams(
    _requestUrl("/product/queryProductDetailList"),
    params
  );
}

// 查询产品详情
export function queryProductDetail (params) {
  return request.getParams(_requestUrl("/product/queryProductDetail"), params);
}

// 搜索产品列表
export function searchProduct (params) {
  return request.getParams(_requestUrl("/product/searchProduct"), params, {
    [KEY_NO_LOADING]: true
  });
}

// 获取所有文宣模块
export function getAllWx (params) {
  return request.getParams(_requestUrl("/sys/wx/getAllWx"), params);
}

// 根据模块分页查询文章
export function pageDetailByModuleId (params) {
  return request.getParams(_requestUrl("/sys/wx/pageDetailByModuleId"), params);
}

// 获取所有参数数据
export function listAll (params) {
  return request.getParams(_requestUrl("/sys/product/param/listAll"), params);
}
