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 getMemberTagGradeEnsure = params =>
  request({
    url: '/memberTagGrade/ensure',
    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 batchDeactiveGroupVerify = params =>
  request({
    url: '/member-tag-group/updateBatchVerify',
    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 getGroupUseList = params =>
  request({
    url: '/member-tag-group/getGroupUseCondition ',
    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
    }
  });

  // 是否开启自动同步开关
export const isAutomaticSync = (params = {}) =>
  request({
    url: '/memberTag/isAutoSyncWm',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  });

// 手工标签同步标签
export const getSyncTag = (params = {}) =>
  request({
    url: '/tagLevel/findGroupLevelPage',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
    // data: qs.stringify(params)
  })

// 手工标签更新同步标签
export const updateSyncTag = (params = {}) =>
  request({
    url: '/tagLevel/updateSyncWmFlag',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
    // data: qs.stringify(params)
  })

// 变更常用标签状态
export const updateMoreUse = (params = {}) =>
  request({
    url: '/memberTag/updateMoreUse',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  })

// 标签值排序
export const changeTagSort = (params = {}) =>
  request({
    url: '/memberTag/updateTagSort',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  })

// 是否展示系统标签
export const isShowSystemTag = (params = {}) =>
  request({
    url: '/tagLevel/isShowTag',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  })

// 查询覆盖人数
export const searchRecordPreson = (params = {}) =>
  request({
    url: '/member-es/count-member-by-group-id',
    method: 'get',
    params: {
      requestProject: 'gic-member-tag-web',
      ...params
    }
  })

