import request from '$project/utils/request'
import Qs from 'qs';

//根据code换取openid
export function getDataByCode(code) {
	return request({
		url: '/wechat/findUserInfo/' + code,
		params: {},
		method: 'get',
	})
}

//获取用户信息
export function getDataByOpenId(openId) {
	return request({
		url: '/mobile/personInfoApi/findByOpenId',
		data: Qs.stringify({
			openId: openId
		}),
		method: 'post',
	})
}

//获得配置
export function getConfig() {
	return request({
		url: '/wechat/getConfig',
		params: {
			url: window.location.href.split('#')[0]
		},
		method: 'get',
	})
}
