/**
 * Web-zdx
 * moduleName: 商城首页
 */

import { request } from '../index'

// 首页信息
const index = () => {
  return request({
    url: 'mall',
    method: 'GET'
  })
}
// 今日特惠页面 （大于三显示3个 两个显示两个 1个就显示一张图）
const indexT = (data) => {
  return request({
    url: 'mall/goods',
    method: 'GET',
    data:data
  })
}
//  获取首页弹窗
const popups = () => {
  return request({
    url: 'popups/mall',
    method: 'GET'
  })
}
const banner = () => {
  return request({
    url: 'mall/banners',
    method: 'GET'
  })
}

//  全养头条
const cmsArticles = () => {
  return request({
    url: 'cms/articles',
    method: 'GET'
  })
}

//  全养头条详情
const cmsArticlesDetail = (id) => {
  return request({
    url: 'cms/articles/'+id,
    method: 'GET'
  })
}

// 获取是否有未读消息
const notifyCounts = () => {
  return request({
    url: 'notifications/counts',
    method: 'GET'
  })
}

// 判断是否能跳转到钱包页面
const canGoWallet = () => {
  return request({
    url: 'user/datas',
    method: 'GET'
  })
}

// 是否设置了激活激活钱包
const security = () => {
  return request({
    url: 'chain/safe/security',
    method: 'GET'
  })
}

// 是否个人认证成功
const certified = () => {
  return request({
    url: 'user/certified',
    method: 'GET'
  })
}

// 获取首页商品列表 taos ='淘宝客' goods/mall （自己商品）
const getIndexGoodsList = (name,data) => {
  return request({
    url: name,
    method: 'GET',
    data:data
  })
}
// 获取淘宝客的标签
const getTaoCategories = () =>{
  return request({
    url: 'tao/categories',
    method: 'GET'
  })
}
// 获取自营的标签
const getTags = () =>{
  return request({
    url: 'mall/tags',
    method: 'GET'
  })
}


export {
  index,
  cmsArticles,
  notifyCounts,
  cmsArticlesDetail,
  canGoWallet,
  security,
  certified,
  getIndexGoodsList,
  getTaoCategories,
  getTags,
  banner,
  popups,
  indexT
}
