import http from "@/utils/http";
import { AppDispatch } from "..";
/**
 * 获取 积分商城 列表
 */
export const A4_APIgetList = (data: any) => {
  return async (dispatch: AppDispatch) => {
    const res = await http.post("cms/prize/pageList", data);
    if (res.code === 0) {
      const obj = {
        list: res.data.records,
        total: res.data.total,
      };
      dispatch({ type: "A4/getList", payload: obj });
    }
  };
};

/**
 * 获取商城设置详情
 */
export const A4_APIgetInfoSet = () => {
  return http.post("cms/prize/getRuleConfig");
};

/**
 * 商城设置编辑
 */
export const A4_APIsetInfoSet = (data: any) => {
  return http.post("cms/prize/editRule", data);
};

/**
 * 编辑获取详情
 */
export const A4_APIgetInfo = (id: number) => {
  return http.get(`cms/prize/detail/${id}`);
};

/**
 * 新增、修改
 */
export const A4_APIsave = (data: any) => {
  return http.post("cms/prize/save", data);
};

/**
 * 删除
 */
export const A4_APIdel = (id: number) => {
  return http.get(`cms/prize/removes/${id}`);
};
