// 登录
export const businessConfig = (params) =>
	uni.$u?.http.post("/common/init", 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) =>
	uni.$u?.http.post(
		"/user/search",
		JSON.stringify({
			keyword,
			pagination: {
				pageNumber: 1,
				showNumber: 10,
			},
		}), {
			header: {
				token: uni.getStorageSync("BusinessToken"),
			},
		}
	);

export const businessSearchUser = (keyword) =>
	uni.$u?.http.post(
		"/friend/search",
		JSON.stringify({
			keyword,
			pagination: {
				pageNumber: 1,
				showNumber: 99,
			},
		}), {
			header: {
				token: uni.getStorageSync("BusinessToken"),
			},
		}
	);