/** * 认证模块 - 登录、注册、绑定相关接口 */ import RequestManager from '../request'; /** * 微信登录 * @param {Object} params 登录参数 * @param {String} params.code 微信登录code * @param {String} params.nickname 昵称 * @param {String} params.headimg 头像 * @param {String} params.pid 推荐人ID * @returns {Promise} 登录结果 */ export const wxLogin = async (params = {}) => { return await RequestManager.post('/login', params); }; /** * 手机号验证码登录 * @param {String} mobile 手机号 * @param {String} code 验证码 * @param {String} pid 推荐人ID * @returns {Promise} 登录结果 */ export const mobileLogin = async (mobile, code, pid = '') => { return await RequestManager.post('/mobileLogin', { mobile, code, pid }); }; /** * 发送短信验证码 * @param {String} phone 手机号 * @returns {Promise} 发送结果 */ export const sendSms = async (phone) => { return await RequestManager.post('/v2/account/sendSms', { phone }); }; /** * 微信绑定手机号(通过微信授权) * @param {String} code 微信授权code * @returns {Promise} 绑定结果 */ export const bindMobileByWx = async (code) => { return await RequestManager.post('/login_bind_mobile', { code }); }; /** * 验证码绑定手机号(H5端) * @param {String} mobile 手机号 * @param {String} code 验证码 * @returns {Promise} 绑定结果 */ export const bindMobileByCode = async (mobile, code) => { return await RequestManager.post('/login_bind_mobile_h5', { mobile, code }); }; /** * 记录登录 * @returns {Promise} 记录结果 */ export const recordLogin = async () => { return await RequestManager.post('/login_record', {}); }; /** * 账号注销 * @returns {Promise} 注销结果 */ export const logOff = async () => { return await RequestManager.post('/user_log_off', {}); }; /** * 绑定邀请码 * @param {String} inviteCode 邀请码 * @returns {Promise} 绑定结果 */ export const bindInviteCode = async (inviteCode) => { return await RequestManager.post('/bind_invite_code', { invite_code: inviteCode }); };