import request from './index';
import qs from 'qs';

// 请求我的用户 标签分类
export const getMemberTag = () =>
  request({
    url: '/memberTag/platformHomePageV2',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web'
    }
  });

// 查询标签列表
export const getMemberTagList = params =>
  request({
    url: '/memberTag/platformTagPageListV2',
    method: 'get',
    params: params
  });

// 手工标签新增三级
export const newHandTag = params =>
  request({
    url: '/tagLevel/addHand',
    method: 'get',
    params: params
  });

// 手工三级标签列表
export const thirdHandTagList = params =>
  request({
    url: '/tagLevel/handThirdLevel',
    method: 'get',
    params: params
  });

// 上手手工标签三级
export const deleteThirdTag = params =>
  request({
    url: '/tagLevel/delHand',
    method: 'get',
    params: params
  });

// 修改三级手工标签
export const editThirdTag = params =>
  request({
    url: '/tagLevel/editHand',
    method: 'get',
    params: params
  });

// 删除手工标签
export const delThirdHandTag = params =>
  request({
    url: '/memberTag/delHandMemberTag',
    method: 'get',
    params: params
  });

// 会员分组分类 查询
export const memberGroupList = params =>
  request({
    url: '/member-tag-group-classify/list',
    method: 'get',
    params: params
  });

// 会员分层
export const getTagLists = (params) =>
  request({
    url: '/memberTagGrade/gradeList',
    method: 'get',
    params: params
  });

// 会员分组分类 新增 编辑  memberTagGroupClassifyId 新增不需要，编辑需要
export const memberGroupModify = params =>
  request({
    url: '/member-tag-group-classify/save',
    method: 'get',
    params: params
  });

// 会员分组删除分类
export const memberGroupDelete = params =>
  request({
    url: '/member-tag-group-classify/delete',
    method: 'get',
    params: params
  });

export const recommendGroupList = () =>
  request({
    url: '/member-tag-group-recommend/list?requestProject=gic-member-tag-web',
    method: 'get'
  });

// 推荐会员分组-列表
export const recommendList = params =>
  request({
    url: '/member-tag-group-recommend/group',
    method: 'get',
    params: params
  });

// 会员分组查列表第二级别
export const findSecondMemberList = params =>
  request({
    url: '/member-tag-group/findList.json',
    method: 'get',
    params: params
  });

// 固化人群创建分堆
export const fixedGroupAddPile = params =>
  request({
    url: '/member-tag-group/addPile',
    method: 'get',
    params: params
  });

/**
 * 批量修改失效
 */
export const batchModifyEffective = params =>
  request({
    url: '/member-tag-group/simpleUpdateBatch',
    method: 'get',
    params: params
  });

// 删除分组校验
export const batchDeleteGroupVerify = params =>
  request({
    url: '/member-tag-group/deleteBatchVerify',
    method: 'get',
    params: params
  });

// 删除分组
export const batchDeleteGroup = params =>
  request({
    url: '/member-tag-group/deleteBatch',
    method: 'get',
    params: params
  });

// 分组归属
export const batchChangeGroup = params =>
  request({
    url: '/member-tag-group/changeClassify',
    method: 'get',
    params: params
  });

// 会员分组新增 /member-tag-group/add

export const addNewGroup = params =>
  request({
    url: '/member-tag-group/add',
    method: 'post',
    data: qs.stringify(params)
  });


// 批量更新会员分组的人
export const refershMemberCount = params =>
  request({
    url: '/member-tag-member/getMemberCountByGroupIdBatch',
    method: 'get',
    params
  });

export const memberTagGroupList = params =>
  request({
    url: '/member-tag-group/findList.json',
    method: 'get',
    params
  });

export const getIsAllowAdd = params =>
  request({
    url: '/member-tag-group/over-count',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  });

// 会员分层刷新
export const updateGradeTag = params =>
  request({
    url: '/memberTagGrade/updateGradeCountBatch',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  });

// 会员分层列表
export const findMemberList = param =>
  request({
    url: '/memberTagGrade/findMemberList',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...param
    }
  });

// 是否开启会员分层
export const hasLevelFeature = () =>
  request({
    url: '/memberTagGrade/ensure',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
    }
  });

// 非实时分组数量
export const groupCount = () =>
  request({
    url: '/member-tag-group/group-count',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
    }
  });

// 分层具体分组信息
export const gradeList = (params = {}) =>
  request({
    url: '/memberTagGrade/gradeGroupList',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  });

  // 获取垃圾桶进度
export const getProgress = (params = {}) =>
  request({
    url: '/delTagItem/progress',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  });

  // 获取垃圾桶列表
export const getTrashList = (params = {}) =>
  request({
    url: '/delTagItem/list',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  });

  // 添加垃圾桶列表
export const addTrashList = (params = {}) =>
  request({
    url: '/delTagItem/add',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  });

  // 执行垃圾桶
export const cleanTrashList = (params = {}) =>
  request({
    url: '/delTagItem/execute',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  });

  // 距离下次的可以执行时间
export const isCleanTrashList = (params = {}) =>
  request({
    url: '/delTagItem/remainingTime',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  });

  // 清除垃圾桶里的标签
export const delTrashList = (params = {}) =>
  request({
    url: '/delTagItem/delAll',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  });
