import http from './https.js'
import tools from './tools.js'
import store from '@/store'
export default {
	// 登录
	getonlogin(param) { // 登录
		return http.post("/kitchenscale3/login_action", param).then(res => {
			return res
		})
	},
	getSendCode(param) { // 验证码
		return http.post("/kitchenscale3/send_phone_email_code", param).then(res => {
			return res
		})
	},
	getregister(param) { // 注册
		return http.post("/kitchenscale3/register_action", param).then(res => {
			return res
		})
	},
	getloginOut(param) { // 退出登录
		return http.post("/kitchenscale3/user_quit_account", param).then(res => {
			return res
		})
	},
	getRegisterPhone(param) { // 手机号快捷登录
		return http.post("/kitchenscale3/wechat_quick_login", param).then(res => {
			return res
		})
	},
	getResetPassword(param) { // 重置密码
		return http.post("/kitchenscale3/reset_password", param).then(res => {
			return res
		})
	},
	getAccountPassword(param) { // 修改密码
		return http.post("/kitchenscale3/reset_password", param).then(res => {
			return res
		})
	},
	getAccountMsg(param) { // 邮箱/手机号绑定
		return http.post("/kitchenscale3/update_my_account_msg", param).then(res => {
			return res
		})
	},
	getloginversion(param) { // 版本信息
		return http.post("/kitchenscale3/login_invalid_version", param).then(res => {
			return res
		})
	},
	getSetLanguage(param) { // 语言设置
		return http.post("/kitchenscale3/update_language", param).then(res => {
			return res
		})
	},
	getCheckDevice(param) { // 设备过滤   
		return http.post("/de/check_device_msg", param).then(res => {
			return res
		})
	},

	getDeleteAccount(param) { // 账号注销
		return http.post("/kitchenscale3/delete_account", param).then(res => {
			return res
		})
	},

	// 首页
	getHomeInfo(param) { // 默认数据
		return http.post("/kitchenscale3/get_homepage_information", param).then(res => {
			return res
		})
	},
	getHomeUserInfo(param) { // 用户信息
		return http.post("/kitchenscale3/get_user_msg", param).then(res => {
			return res
		})
	},
	getHomeConfig(param) { // 配置
		return http.post("/kitchenscale3/get_default_config", param).then(res => {
			return res
		})
	},
	getHomeSearch(param) { // 首页搜索
		return http.post("/kitchenscale3/search_column", param).then(res => {
			return res
		})
	},
	getUserInfoEdit(param) { // 修改用户信息
		return http.post("/kitchenscale3/update_user_msg", param).then(res => {
			return res
		})
	},
	getSearchPopularFood(param) { //获取搜索页面常用食材
		return http.post("/kitchenscale3/get_search_food_page_list", param).then(res => {
			return res
		})
	},
	getFoodSearch(param) { //搜索食材
		return http.post("/kitchenscale3/get_food_list", param).then(res => {
			return res
		})
	},
	getMenuSearch(param) { //搜索菜谱
		return http.post("/find_by_food", param).then(res => {
			return res
		})
	},
	getMenuSearchColumn(param) { //搜索菜谱2
		return http.post("/kitchenscale3/search_column", param).then(res => {
			return res
		})
	},
	getPhotoSearch(param) { //图像识别
		return http.post("/kitchenscale3/baidu_identify_food", param).then(res => {
			return res
		})
	},

	// 通用
	getUploadImg(param) { // 上传素材
		return http.upload("/kitchenscale3/pic_upload_one_action", param).then(res => {
			return res
		})
	},

	// 菜谱
	getAddCookbook(param) { // 添加菜谱
		return http.post("/kitchenscale3/add_cookbook", param).then(res => {
			return res
		})
	},
	getEditCookbook(param) { // 修改菜谱
		return http.post("/kitchenscale3/update_cookbook", param).then(res => {
			return res
		})
	},
	getCookListLabel(param) { // 菜谱查询(根据菜谱标签拉取)
		return http.post("/kitchenscale3/find_by_cook_label", param).then(res => {
			return res
		})
	},
	getCookListFood(param) { // 菜谱列表（根据食材名称拉取）
		return http.post("/kitchenscale3/find_by_food", param).then(res => {
			return res
		})
	},
	getCookListDetails(param) { // 查询菜谱详情
		return http.post("/kitchenscale3/cookbook_details", param).then(res => {
			return res
		})
	},
	getCookFollow(param) { // 关注行为
		return http.post("/kitchenscale3/cookbook_follow", param).then(res => {
			return res
		})
	},
	getCookLike(param) { // 点赞收藏菜谱
		return http.post("/kitchenscale3/cookbook_like", param).then(res => {
			return res
		})
	},
	getCookKcal(param) { // 食材卡路里计算
		return http.post("/kitchenscale3/food_count_kcal", param).then(res => {
			return res
		})
	},
	// 食材
	getCookFoodList(param) { // 食材列表
		return http.post("/kitchenscale3/get_food_list", param).then(res => {
			return res
		})
	},
	getCookListSave(param) { // 食材列表查询
		return http.post("/kitchenscale3/save_food_list", param).then(res => {
			return res
		})
	},
	// 计食器
	getAddIntakeFood(param) { // 添加每日摄入记录
		return http.post("/kitchenscale3/add_intake_food", param).then(res => {
			return res
		})
	},
	getAddEveryMealFood(param) { // 当次食材添加的卡路里摄入记录
		return http.post("/kitchenscale3/current_food_statistics", param).then(res => {
			return res
		})
	},
	getCountfootCon(param) { // 每日记食器板块详细内容
		return http.post("/kitchenscale3/get_countfoot_content", param).then(res => {
			return res
		})
	},
	delCEatAction(param) { // 删除餐饮食物
		return http.post("/kitchenscale3/del_user_eat_log", param).then(res => {
			return res
		})
	},
	getLogList(param) { // 记食器角色饮食记录列表
		return http.post("/kitchenscale3/get_log_list", param).then(res => {
			return res
		})
	},
	getSetUpContent(param) { // 计食器板块-设置里的内容
		return http.post("/kitchenscale3/set_up_content", param).then(res => {
			return res
		})
	},
	getSetUserKcal(param) { // 设置用户的卡路里
		return http.post("/kitchenscale3/set_user_kcal", param).then(res => {
			return res
		})
	},
	// 个人中心
	getUserCollectList(param) { // 用户收藏点赞列表
		return http.post("/kitchenscale3/get_user_collect_list", param).then(res => {
			return res
		})
	},
	getMyCookbook(param) { // 我的菜谱
		return http.post("/kitchenscale3/get_my_cookbook", param).then(res => {
			return res
		})
	},
	getMyCookbookDel(param) { // 删除我的菜谱
		return http.post("/kitchenscale3/del_my_cookbook", param).then(res => {
			return res
		})
	},
	getMyLogList(param) { // 饮食列表
		return http.post("/kitchenscale3/get_log_list", param).then(res => {
			// let pkList = {
			// 	list: [],
			// 	Dlist: []
			// }
			// if (res.code == 0) {
			// 	for (var i = 0; i < res.data.content_list.length; i++) {
			// 		pkList.list.push(res.data.content_list[i])
			// 		if (!pkList.Dlist.includes(res.data.content_list[i].time)) { //includes 检测数组是否有某个值
			// 			pkList.Dlist.push(res.data.content_list[i].time);
			// 		}
			// 	}
			// }
			// res.data.pkList = pkList
			return res
		})
	},
	// 计食器
	getAddIntakeFood(param) { // 添加每日摄入记录
		return http.post("/kitchenscale3/add_intake_food", param).then(res => {
			return res
		})
	},
	getCountFoodInfo(param) { // 获取记食器板块详细内容
		return http.post("/kitchenscale3/get_countfoot_content", param).then(res => {
			return res
		})
	},
	getCountSetKcal(param) { // 获取记食器设置里的内容
		return http.post("/kitchenscale3/set_up_content", param).then(res => {
			return res
		})
	},
	getCountSetUserKcal(param) { // 获取记食器设置里的内容
		return http.post("/kitchenscale3/set_user_kcal", param).then(res => {
			return res
		})
	},
}