Files
one-pipe-system/src/api/modules/agentDistribution.ts
2026-09-17 12:16:20 +08:00

75 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 代理扫码分销注册相关 API公开无需登录
*/
import { BaseService } from '../BaseService'
import type { BaseResponse } from '@/types/api'
/**
* 发送短信验证码请求参数
*/
export interface SendCodeParams {
phone: string // 手机号
scene: 'bind_phone' // 业务场景
}
/**
* 发送短信验证码响应
*/
export interface SendCodeResponse {
cooldown_seconds: number // 冷却秒数,用于倒计时
}
/**
* 代理扫码注册请求参数
*/
export interface AgentDistributionRegistrationParams {
distribution_code: string // 分销码
phone: string // 手机号
code: string // 短信验证码
password: string // 密码
shop_name: string // 店铺名称
shop_code: string // 店铺编号
username: string // 用户名
contact_name?: string // 联系人(选填)
province?: string // 省(选填)
city?: string // 市(选填)
district?: string // 区县(选填)
address?: string // 详细地址(选填)
}
/**
* 代理扫码注册响应
*/
export interface AgentDistributionRegistrationResponse {
id: number // 注册记录ID
status: number // 状态0 待审批)
status_name: string // 状态名称
}
export class AgentDistributionService extends BaseService {
/**
* 发送短信验证码
* POST /api/c/v1/auth/send-code公开不带 Token
*/
static sendCode(params: SendCodeParams): Promise<BaseResponse<SendCodeResponse>> {
return this.post<BaseResponse<SendCodeResponse>>('/api/c/v1/auth/send-code', params, {
requestOptions: { withToken: false }
})
}
/**
* 代理扫码注册
* POST /api/c/v1/agent-distribution-registrations公开不带 Token
*/
static registerAgent(
params: AgentDistributionRegistrationParams
): Promise<BaseResponse<AgentDistributionRegistrationResponse>> {
return this.post<BaseResponse<AgentDistributionRegistrationResponse>>(
'/api/c/v1/agent-distribution-registrations',
params,
{ requestOptions: { withToken: false } }
)
}
}