import axios from '@/common/services/axios-instance'

class KmKnowledageService {
  // 知识门户  知识数量统计
  getKnowledgeCount(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-home/knowledge-count',
      method: 'get',
      params: params,
    })
  }

  // 知识门户  知识分类列表
  getKnowledgeCategory(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-home/knowledge-category',
      method: 'get',
      params: params,
    })
  }

  // 知识门户  获取个人榜和投稿榜
  getPersonalList(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-home/personal-list',
      method: 'get',
      params: params,
    })
  }

  // 知识门户 获取热搜标签
  getHotTag(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-home/hot-tag',
      method: 'get',
      params: params,
    })
  }

  // 知识门户 获取年度分享达人
  getTopSharer(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-home/top-sharer',
      method: 'get',
      params: params,
    })
  }

  // 知识门户 获取最新知识
  getLatestKnowledge(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-home/latest-knowledge',
      method: 'get',
      params: params,
    })
  }

  // 知识门户 获取阅读排行
  getTopRead(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-home/top-read',
      method: 'get',
      params: params,
    })
  }

  // 知识门户 获取推荐排行
  getRecommend(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-home/recommend',
      method: 'get',
      params: params,
    })
  }

  // 知识门户 获取知识地图
  getLatestKnowledgeMap(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-home/latest-knowledge-map',
      method: 'get',
      params: params,
    })
  }

  // 知识门户 获取我的积分
  getMyPoint(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-home/my-point',
      method: 'get',
      params: params,
    })
  }

  // 知识门户 获取热搜词的数组
  getHotWords(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/ftsearch/record/hotwords',
      method: 'get',
      params: params,
    })
  }

  // 知识门户 获取热词
  getHotwordsofday(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/ftsearch/record/hotwordsofday',
      method: 'get',
      params: params,
    })
  }

  // 知识查看
  getKnowledgeDetails(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/kmknowledge/knowledge-details',
      method: 'get',
      params: params,
    })
  }

  // 知识查看--知识点评，获取所有点评
  getKnowledgeComment(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/page/businessList',
      method: 'post',
      data: params,
    })
  }

  // 知识查看--知识点评，发表点评
  getComment(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/page/handleData',
      method: 'post',
      data: params,
    })
  }

  // 知识查看--知识点评，点赞点评
  getPraise(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/comment-manager/comment/praiseNumber',
      method: 'get',
      params: params,
    })
  }

  // 知识查看--知识点赞
  getKnowledgePraise(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/kmpraise/kmpraise-praise',
      method: 'get',
      params: params,
    })
  }

  // 知识查看--知识点赞数
  getKnowledgePraiseNum(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/kmpraise/kmpraise-praiseNum',
      method: 'get',
      params: params,
    })
  }

  // 知识查看--知识附件
  getAttachmentsInfo(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/attachment-extend/attachments-info',
      method: 'get',
      params: params,
    })
  }

  // 知识查看--下载记录
  getAttachmentRecord(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/kmattachmentrecord/attachmentRecord',
      method: 'post',
      data: params,
    })
  }

  // 配置中心---获取知识积分规则ID
  getKnowledageCountId() {
    return axios({
      url: 'api/xcoa-mobile/v1/km-point-rule/hierarchical-point-id',
      method: 'get',
    })
  }

  // 配置中心---获取个人知识等级设置
  getPersonalLevelConfig(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/page/businessList',
      method: 'post',
      data: params,
    })
  }

  // 配置中心---生成个人等级配置
  setPersonalLevelConfig(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-personal-level-config/personal-level-config',
      method: 'get',
      params: params,
    })
  }

  // 配置中心---保存/更新个人等级配置
  savePersonalLevelConfig(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-personal-level-config/personal-level-config',
      method: 'post',
      data: params,
    })
  }

  // 获取知识库分类树
  getKnowledgeTree(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-knowledge-category/knowledge-category-tree',
      method: 'get',
      params: params,
    })
  }

  // 获取知识库分类树
  getKnowledgeCategoryAdmin(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-knowledge-category/knowledge-category-admin',
      method: 'get',
      params: params,
    })
  }

  getKnowledgeCategoryParentAdmin(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-knowledge-category/parnet-category-admin',
      method: 'get',
      params: params,
    })
  }

  // 知识地图树
  getKmapTree(params) {
    return axios({
      url: ' api/xcoa-mobile/v1/km-kmap-category/kmap-category-tree',
      method: 'get',
      params: params,
    })
  }

  // 查询流程绑定的id和类型
  queryLiuchengIdOrType(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/page/wp/km/admin/kmApprovalFlow',
      method: 'get',
      params: params,
    })
  }

  // 获取知识封面详情的接口
  getCoverImgList(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/page/wp/km/admin/kmKnowledgeCover',
      method: 'get',
      params: params,
    })
  }

  // 知识投稿--- 业务领域
  getKmId(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-admin/hierarchical-admin-id',
      method: 'get',
      params,
    })
  }

  // 知识查看--- 知识借阅
  getKnowledgeCheck(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/kmknowledge/knowledge-check',
      method: 'get',
      params: params,
    })
  }

  // 知识新版本  附件拷贝
  copyAttachment(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/copy-manager/new-process-form',
      method: 'post',
      data: params,
    })
  }

  // 知识推荐  推荐到个人
  kmRecommendPerson(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/kmRecommend/kmRecommend-person',
      method: 'post',
      data: params,
    })
  }

  // 管理中心获取当前用户有权限的节点
  getUserAsAdminList(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-knowledge-category/knowledge-category-list',
      method: 'get',
      params,
    })
  }

  // 积分统计
  getKmPointStatistics(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/page/wp/km/point/kmPointStatistics',
      method: 'get',
      params: params,
    })
  }

  // 积分统计  --- 提交
  getPreviewStatistics(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-point/preview-statistics',
      method: 'post',
      data: params,
    })
  }

  // 积分统计  --- 统计结果列表
  getStatisticsList(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-point/statistics-list',
      method: 'post',
      data: params,
    })
  }

  // 积分统计 ----- 导出
  getExportStatistics(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-point/export-statistics',
      method: 'get',
      responseType: 'blob',
      params,
    }).then((res) => {
      return res.data
    })
  }

  // 下载原子知识导入模板
  downloadAtomTemplateExcel() {
    return axios({
      url: 'api/xcoa-mobile/v1/km-knowledge-atom/downloadExcel',
      method: 'get',
      responseType: 'blob',
    })
  }

  // 导入原子知识
  importAtom(param) {
    return axios({
      method: 'post',
      url: 'api/xcoa-mobile/v1/km-knowledge-atom/importExcel',
      data: param,
    })
  }

  // 专家库----专家详情
  getkmExpertDetails(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/kmexpertdata/kmexpertdata-details',
      method: 'get',
      params,
    })
  }

  // 专家库----提问回复列表
  getQuestionAccountExpert(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/kmexpertquestion/question-account-expert',
      method: 'post',
      data: params,
    })
  }

  // 专家库----提问回复列表
  getQuestionAccountDetails(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/kmexpertquestion/question-account-details',
      method: 'get',
      params,
    })
  }

  // 专家库----答复列表
  getAnswersAccountPages(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/kmexpertanswers/answers-account-pages',
      method: 'post',
      data: params,
    })
  }

  // 获取知识管理草稿箱的树
  getFrameWorktree(dataType) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-draft/category-businesstype-tree?label=' + dataType,
      method: 'get',
    })
  }

  // 知识地图阅读次数
  setKmapReadNum(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/kmkmap/count-and-one',
      method: 'get',
      params,
    })
  }

  // 统计知识库、原子知识等
  getStatisticsAnalysis(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-point/statistics-analysis',
      method: 'get',
      params,
    })
  }

  // 统计访问趋势图
  getVisitTrend(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-point/visit-trend',
      method: 'get',
      params,
    })
  }

  // 知识投稿趋势图
  getKnowledgeContribute(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-point/knowledge-contribute',
      method: 'get',
      params,
    })
  }

  // 知识投稿部门来源
  getKnowledgeDeptSource(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-point/knowledge-dept-source',
      method: 'get',
      params,
    })
  }

  // 各部门访问量分布
  getDeptVisit(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-point/dept-visit',
      method: 'get',
      params,
    })
  }

  // 各分类访问量
  getClassPie() {
    return axios({
      url: 'api/xcoa-mobile/v1/km-point/classify-read',
      method: 'get',
    })
  }

  // 投稿分类来源分布
  getClassifyVisit() {
    return axios({
      url: 'api/xcoa-mobile/v1/km-point/classify-visit',
      method: 'get',
    })
  }

  // 知识管理全文检索
  getSearchList(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/kmsearch/search',
      method: 'post',
      data: params,
    })
  }

  // 导出文档
  searchExport(params) {
    return axios({
      url: `api/xcoa-mobile/v1/kmsearch/export`,
      method: 'post',
      data: params,
    }).then((res) => {
      return res.data
    })
  }

  // 导出excel文件接口
  exportDownload(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/file-download/download/',
      method: 'get',
      responseType: 'blob',
      params,
    }).then((res) => {
      return res.data
    })
  }

  // 根据参数名称获取系统参数配置
  getKmSystemConfig(params) {
    return axios({
      url: 'api/xcoa-mobile/v1/km-system-config/config-name',
      method: 'get',
      params,
    })
  }

  // 应用
  applySearch(text) {
    return axios({
      url: `api/xcoa-mobile/v1/ftsearch/app-search?text=${text}`,
      method: 'get',
    })
  }

  // 输入框提示
  seachInputTip(text) {
    return axios({
      url: `api/xcoa-mobile/v1/ftsearch/record/suggester?text=${text}`,
      method: 'get',
    })
  }

  // 获取个人常用搜索
  getHotserch() {
    return axios({
      url: 'api/xcoa-mobile/v1/ftsearch/record/search-record',
      method: 'get',
    })
  }

  // 获取收藏夹树
  getFavoritesTree(params) {
    return axios({
      url: `api/xcoa-mobile/v1/bookmark-folder/bookmarkTree?type=${params}`,
      method: 'get',
    })
  }

  // 删除我的收藏
  deletedMyFavorites(params) {
    return axios({
      url: `api/xcoa-mobile/v1/page/kmBookmarkContent`,
      method: 'delete',
      params,
    })
  }

  // 删除我的收藏
  getAllList(params) {
    return axios({
      url: `api/xcoa-mobile/v1/kmknowledge/all-list`,
      method: 'post',
      data: params,
    }).then((res) => {
      return res.data
    })
  }
}

export default new KmKnowledageService()
