import { REQUEST_CONFIG } from '@/config';
import { request, handle } from '@kasite/uni-app-base';

const doPost = async (url, data, options) => {
	data.ChannelId = 'smallpro';
	let resp = handle.promistHandleNew(await request.doPost(url, data, options));
	return handle.catchPromiseNew(resp, () => resp, options);
};

/** 文章详情 */
export const ArticleDetail = async (saveData: any, options: any = {}) => {
	return doPost(
		`${REQUEST_CONFIG.BASE_URL}wsgw/article/mgr/ArticleDetail/callApiJSON.do`,
		saveData,
		options
	);
};
/** 点赞文章 */
export const LikeArticle = async (saveData: any, options: any = {}) => {
	return doPost(
		`${REQUEST_CONFIG.BASE_URL}wsgw/article/mgr/Like/callApiJSON.do`,
		saveData,
		options
	);
};
/** 分享文章 */
export const ShareArticle = async (saveData: any, options: any = {}) => {
	return doPost(
		`${REQUEST_CONFIG.BASE_URL}wsgw/article/mgr/Share/callApiJSON.do`,
		saveData,
		options
	);
};
/** 获取评论 */
export const GetCommentList = async (saveData: any, options: any = {}) => {
	return doPost(
		`${REQUEST_CONFIG.BASE_URL}wsgw/article/comment/page/callApiJSON.do`,
		saveData,
		options
	);
};
/** 发布评论 */
export const CreateComment = async (saveData: any, options: any = {}) => {
	return doPost(
		`${REQUEST_CONFIG.BASE_URL}wsgw/article/comment/create/callApiJSON.do`,
		saveData,
		options
	);
};