/** * 游客轻身份接口(后端 controllers/guest.go) * 失败均由调用方静默处理,不弹全局 toast。 */ import { request } from '@/api/request.js' /** * 游客登录:微信手机号动态凭证换游客令牌 * @param {{ code: string, phoneCode: string, appid?: string }} params code=uni.login 的登录凭证 * @returns {Promise<{ token: string, guest_id: number, phone_mask: string, expires_in: number }>} */ export function guestMiniLogin({ code = '', phoneCode = '', appid = '' } = {}) { return request({ url: '/api/guest/mini-login', method: 'POST', data: { code, phone_code: phoneCode, appid }, silent: true }) } /** * 转正合并:正式登录令牌调用,把该手机号下的游客数据并入账号 * @returns {Promise} 各模块合并条数,如 { notebook: 3, schedule: 1, passwordStore: 2 } */ export function guestMerge() { return request({ url: '/api/guest/merge', method: 'POST', data: {}, silent: true }) }