// 登录
export const businessConfig = (params) =>
	uni.$u?.http.post("/common/init", JSON.stringify(params));
// 验证是否升级
export const checkUpgrade = (params) =>
	uni.$u?.http.post("/common/checkUpgrade", JSON.stringify(params));
export const businessLogin = (params) =>
	uni.$u?.http.post("/common/login", JSON.stringify(params));
export const businessSendSms = (params) =>
	uni.$u?.http.post("/common/captcha", JSON.stringify(params));
export const businessVerifyCode = (params) =>
	uni.$u?.http.post("/common/verify_captcha", JSON.stringify(params));
export const businessRegister = (params) =>
	uni.$u?.http.post("/common/register", JSON.stringify(params));
export const businessReset = (params) =>
	uni.$u?.http.post("/common/resetpwd", JSON.stringify(params));

export const businessModify = (params) =>
	uni.$u?.http.post(
		"/user/change_password",
		JSON.stringify({
			...params,
		}), {
			header: {
				token: uni.getStorageSync("BusinessToken"),
			},
		}
	);

// 用户信息
export const businessInfoUpdate = (params) =>
	uni.$u?.http.post(
		"/user/profile",
		JSON.stringify({			...params,		}), 
		{
			header: {
				token: uni.getStorageSync("BusinessToken"),
			},
		}
	);
export const businessGetUserInfo = (userID) =>
	uni.$u?.http.post(
		"/user/find",
		JSON.stringify({			userIDs: [userID],		}), 
		{
			header: {
				token: uni.getStorageSync("BusinessToken"),
			},
		}
	);

export const businessSearchUserInfo = (keyword,searchtype) =>
	uni.$u?.http.post(
		"/user/search",
		JSON.stringify({
			keyword,
			searchtype:(searchtype? searchtype : 'id'),
			page: 1,
			limit: 10
		}), {
			header: {
				token: uni.getStorageSync("BusinessToken"),
			},
		}
	);

export const businessSearchUser = (keyword,searchtype) =>
	uni.$u?.http.post(
		"/friend/search",
		JSON.stringify({
			keyword,
			searchtype:(searchtype? searchtype : 'id'),
			page: 1,
			limit: 99,
		}), {
			header: {
				token: uni.getStorageSync("BusinessToken"),
			},
		}
	);
export const getArticle = (id,type) =>
	uni.$u?.http.post(
		"/article/detail",
		JSON.stringify({
			id,
			type:(type? type : 'id')
		}), {
			header: {
				token: uni.getStorageSync("BusinessToken"),
			},
		}
	);
export const getFriendCircle = (page=1,limit=10) =>{
	uni.$u?.http.get(
		"/friend_circle/list",
		JSON.stringify({
			limit:limit,
			page:page
		}), 
		{
			header: {
				token: uni.getStorageSync("BusinessToken"),
			},
		}
	);
}
export const getFriendCircleNewcount = () =>{
	uni.$u?.http.get(
		"/friend_circle/newcount",
		JSON.stringify({}), 
		{
			header: {
				token: uni.getStorageSync("BusinessToken"),
			},
		}
	);
}