import axios from 'axios'
// 创建一个名为 ApiService 的对象，包含您的异步方法
const ApiService = {
	// 三连日管理
	async tripletDayInfoPage(currentPage, pageSize, tripletDate) {
		return await axios.post('http://43.139.90.182:8888/dayInfo/page', {
			page: currentPage,
			pageSize: pageSize,
			startDate: tripletDate != null ? tripletDate[0] : '',
			endDate: tripletDate != null ? tripletDate[1] : '',
		})
	},

	async tripletDayReset() {
		return await axios.get('http://43.139.90.182:8888/dayInfo/add')
	},
	// 文章管理
	async triplet(articleId) {
		return await axios.get('http://43.139.90.182:8888/csdnArticleInfo/triplet?articleId=' + articleId)
	},

	async syncMyBlog() {
		return await axios.get('http://43.139.90.182:8888/csdnArticleInfo/syncMyBlog')
	},
	async resetLikes() {
		return await axios.get('http://43.139.90.182:8888/csdnArticleInfo/fixLikesStatus')
	},
	async allTriplet(articleIds) {
		return await axios.post('http://43.139.90.182:8888/csdnArticleInfo/multiTriplet', articleIds)
	},
	async articleInfoDelete(id) {
		return await axios.get('http://43.139.90.182:8888/csdnArticleInfo/delete', {
			params: {
				id: id,
			},
		})
	},

	//红包管理
	async dealViewCount(id) {
		return await axios.get('http://43.139.90.182:8888/csdn/redPackage/getViewCountById?id=' + id)
	},
	async getTodayRedPackageDetailInfo() {
		return await axios.get('http://43.139.90.182:8888/csdn/redPackage/detail/getTodayRedPackageDetailInfo')
	},
	async syncDetailInfo(id) {
		return await axios.get('http://43.139.90.182:8888/csdn/redPackage/detail/syncDetailInfo?id=' + id)
	},
	async redPackagePage(currentPage, pageSize, formInline) {
		return await axios.post('http://43.139.90.182:8888/csdn/redPackage/page', {
			page: currentPage,
			pageSize: pageSize,
			nickName: formInline.nickName,
			myAmountStart: formInline.myAmountStart,
			myAmountEnd: formInline.myAmountEnd,
			startDate: formInline.startDate,
			orderNo: formInline.orderNo,
			itemType: formInline.itemType == '全部' ? null : formInline.itemType,
			msg: formInline.msg == '全部' ? null : formInline.msg,
		})
	},
	async redPackageDetailList(currentPage, pageSize, orderNo, communityId, postId) {
		return await axios.post('http://43.139.90.182:8888/csdn/redPackage/detail/page', {
			page: currentPage,
			pageSize: pageSize,
			orderNo: orderNo,
			communityId: communityId == 'null' || communityId == -1 ? '' : communityId,
			postId: postId == 'null' || postId == -1 ? '' : postId,
		})
	},

	//粉丝管理
	async fansInfoPage(currentPage, pageSize, relationType) {
		return await axios.post('http://43.139.90.182:8888/csdn/followFans/page', {
			page: currentPage,
			pageSize: pageSize,
			relationType: relationType == '全部' ? '' : relationType,
		})
	},
	async syncFansInfo() {
		return await axios.get('http://43.139.90.182:8888/csdn/followFans/saveFans')
	},
	async syncFollowInfo() {
		return await axios.get('http://43.139.90.182:8888/csdn/followFans/saveFollow')
	},
	async cancleFollowInfo() {
		return await axios.get('http://43.139.90.182:8888/csdn/followFans/deleteFollow')
	},
	//我的图片
	async queryPic(currentPage, pageSize, picType) {
		return await axios.get('http://43.139.90.182:8888/picInfo/page', {
			params: {
				page: currentPage,
				pageSize: pageSize,
				picType: picType,
			},
		})
	},
	async editPicConfirm(currentRowId, type) {
		return await axios.post('http://43.139.90.182:8888/picInfo/update', {
			id: currentRowId,
			type: type,
		})
	},
}
export default ApiService
