/**
 * Web-zdx
 * moduleName:个人中心相关操作
 */

import { request } from '../index'

// 关注店铺
const shopSubscribe = (id) => {
  return request({
    url: 'mall/shops/subscribe/' + id,
    method: 'POST'
  })
}

// 我的关注店铺列表
const shopSubscribeList = (page) => {
  return request({
    url: 'mall/shops/subscribe',
    method:'get',
    data:{
      page:page
    }
  })
}

// 关于我们
const aboutUs = () => {
  return request({
    url: 'articles/about'
  })
}

// 获取用户信息
const getUserInfo = () => {
  return request({
    url: 'user/app'
  })
}

// 获取用户设置中心的信息
const getUserSettingInfo = () => {
  return request({
    url: 'user/setting'
  })
}

// 账号余额等信息
const chaineb = (data) => {
  return request({
    url: 'user/account/chaineb',
    method:'get',
    data:data
  })
}

// 我的足迹
const browsers = (page) => {
  return request({
    url: 'mall/goods/browsers',
    method: 'get',
    data: {
      page:page,
	  page_size:20
    }
  })
}

// 修改用户头像或昵称
const resetUserInfo= (data) => {
  return request({
    url: 'user/'+data.key,
    method: 'PUT',
    data:{
		value:data.value
	}
  })
}

// 我的推广码
const appcode = () => {
  return request({
    url: 'user/appcode'
  })
}

export {
  shopSubscribe,
  shopSubscribeList,
  aboutUs,
  getUserInfo,
  getUserSettingInfo,
  chaineb,
  browsers,
  resetUserInfo,
  appcode
}
