实现商户注册、管理员审核商户申请接口

This commit is contained in:
2025-06-04 15:10:56 +08:00
parent 00b889cfcc
commit caf3d42fe5
63 changed files with 1195 additions and 294 deletions

View File

@ -13,5 +13,7 @@ import (
type IAuthV1 interface {
AdminLogin(ctx context.Context, req *v1.AdminLoginReq) (res *v1.AdminLoginRes, err error)
MerchantLogin(ctx context.Context, req *v1.MerchantLoginReq) (res *v1.MerchantLoginRes, err error)
MerchantCode(ctx context.Context, req *v1.MerchantCodeReq) (res *v1.MerchantCodeRes, err error)
MerchantRegister(ctx context.Context, req *v1.MerchantRegisterReq) (res *v1.MerchantRegisterRes, err error)
StoreLogin(ctx context.Context, req *v1.StoreLoginReq) (res *v1.StoreLoginRes, err error)
}

View File

@ -7,6 +7,7 @@ type AdminLoginReq struct {
Username string `json:"username" v:"required" dc:"用户名"`
Password string `json:"password" v:"required" dc:"密码"`
}
type AdminLoginRes struct {
g.Meta `mime:"application/json"`
Token string `json:"token"`
@ -14,16 +15,37 @@ type AdminLoginRes struct {
type MerchantLoginReq struct {
g.Meta `path:"/merchant/login" method:"post" tags:"Merchant" summary:"(商户管理员)商户登录"`
Usernaem string `json:"username" v:"required" dc:"用户名"`
Username string `json:"username" dc:"用户名"`
Phone string `json:"phone" v:"regex:^1[3-9]\\d{9}$" dc:"手机号"`
Code string `json:"code" dc:"验证码"`
Password string `json:"password" v:"required" dc:"密码"`
}
type MerchantLoginRes struct {
g.Meta `mime:"application/json"`
Token string `json:"token"`
}
type MerchantRegisterReq struct {
type MerchantCodeReq struct {
g.Meta `path:"/merchant/code" method:"get" tags:"Merchant" summary:"(商户管理员)商户获取短信验证码"`
Phone string `json:"phone" v:"required" dc:"手机号"`
}
type MerchantCodeRes struct{}
type MerchantRegisterReq struct {
g.Meta `path:"/merchant/register" method:"post" tags:"Merchant" summary:"(商户管理员)商户注册"`
Username string `json:"username" v:"required" dc:"用户名"`
Phone string `json:"phone" v:"required|regex:^1[3-9]\\d{9}$" dc:"手机号"`
Code string `json:"code" v:"required" dc:"验证码"`
Password string `json:"password" v:"required|length:6,20" dc:"密码6-20位"`
Password2 string `json:"password2" v:"required|same:password" dc:"确认密码"`
ApplicationReason string `json:"applicationReason" v:"required|length:5,200" dc:"申请理由5~200字"`
}
type MerchantRegisterRes struct {
Success bool `json:"success" dc:"是否成功"`
Msg string `json:"msg" dc:"提示信息"`
}
type StoreLoginReq struct {
@ -31,6 +53,7 @@ type StoreLoginReq struct {
Username string `json:"username" v:"required" dc:"用户名"`
Password string `json:"password" v:"required" dc:"密码"`
}
type StoreLoginRes struct {
g.Meta `mime:"application/json"`
Token string `json:"token"`

View File

@ -2,15 +2,17 @@
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package roleMenu
package merchant
import (
"context"
"server/api/roleMenu/v1"
"server/api/merchant/v1"
)
type IRoleMenuV1 interface {
type IMerchantV1 interface {
List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error)
SaveRoleMenu(ctx context.Context, req *v1.SaveRoleMenuReq) (res *v1.SaveRoleMenuRes, err error)
Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error)
Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error)
Audit(ctx context.Context, req *v1.AuditReq) (res *v1.AuditRes, err error)
}

View File

@ -0,0 +1,39 @@
package v1
import "github.com/gogf/gf/v2/frame/g"
type ListReq struct {
g.Meta `path:"/merchant" method:"get" tags:"Merchant" summary:"(系统管理员)获取商户列表"`
Page int `json:"page" dc:"页数"`
Size int `json:"size" dc:"每页数量"`
Status int `json:"status" dc:"状态1=启用2=禁用"`
AuditStatus int `json:"auditStatus" dc:"审核状态0=待审核1=审核通过2=审核拒绝"`
}
type ListRes struct {
List interface{} `json:"list" dc:"商户列表"`
Total int `json:"total" dc:"总数"`
}
type CreateReq struct {
g.Meta `path:"/merchant" method:"post" tags:"Merchant" summary:"(系统管理员)创建商户"`
}
type CreateRes struct {
Id int64 `json:"id" dc:"商户ID"`
}
type UpdateReq struct {
g.Meta `path:"/merchant" method:"put" tags:"Merchant" summary:"(系统管理员、商户管理员)更新商户"`
}
type UpdateRes struct {
Success bool `json:"success" dc:"是否成功"`
}
type AuditReq struct {
g.Meta `path:"/merchant/audit" method:"post" tags:"Merchant" summary:"(系统管理员)商户审核"`
Id int64 `json:"id" v:"required" dc:"商户ID"`
AuditStatus int `json:"auditStatus" v:"required" dc:"审核状态1=审核通过2=审核拒绝" `
AuditRemark string `json:"auditRemark" dc:"审核备注"`
RejectReason string `json:"rejectReason" dc:"拒绝原因"`
}
type AuditRes struct {
}

View File

@ -0,0 +1,15 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package merchantAdmin
import (
"context"
"server/api/merchantAdmin/v1"
)
type IMerchantAdminV1 interface {
MerchantAdminInfo(ctx context.Context, req *v1.MerchantAdminInfoReq) (res *v1.MerchantAdminInfoRes, err error)
}

View File

@ -0,0 +1,11 @@
package v1
import (
"github.com/gogf/gf/v2/frame/g"
)
type MerchantAdminInfoReq struct {
g.Meta `path:"/merchant/info" method:"get" tags:"MerchantAdmin" summary:"(商户管理员)获取商户管理员信息"`
}
type MerchantAdminInfoRes struct {
}

View File

@ -1,27 +0,0 @@
package v1
import (
"github.com/gogf/gf/v2/frame/g"
)
// ListReq 角色菜单列表请求
type ListReq struct {
g.Meta `path:"/role-menu" method:"get" tags:"角色菜单" summary:"获取角色菜单列表"`
RoleId int64 `json:"roleId" v:"required#角色ID不能为空" dc:"角色ID"`
}
// ListRes 角色菜单列表响应
type ListRes struct {
List interface{} `json:"list" dc:"角色菜单列表"`
Total int `json:"total" dc:"总条数"`
}
type SaveRoleMenuReq struct {
g.Meta `path:"/role-menu" method:"post" tags:"角色菜单" summary:"保存角色菜单"`
RoleId int `json:"roleId" v:"required#角色ID不能为空" dc:"角色ID"`
MenuIds []int `json:"menuIds" v:"required#菜单ID列表不能为空" dc:"菜单ID列表"`
}
type SaveRoleMenuRes struct {
Success bool `json:"success" dc:"是否成功"`
}

37
api/store/v1/store.go Normal file
View File

@ -0,0 +1,37 @@
package v1
import (
"github.com/gogf/gf/v2/frame/g"
)
type ListReq struct {
g.Meta `path:"/store" method:"get" tags:"Store" summary:"(系统管理员、商户管理员)获取门店列表"`
Page int `json:"page" dc:"页数"`
Size int `json:"size" dc:"每页数量"`
MerchantId int `json:"merchantId" dc:"商户ID"`
}
type ListRes struct {
List interface{} `json:"list" dc:"商户列表"`
Total int `json:"total" dc:"总数"`
}
type CreateReq struct {
g.Meta `path:"/store" method:"post" tags:"Store" summary:"(商户管理员)创建门店"`
Name string `json:"name" v:"required" dc:"门店名称"`
ContactName string `json:"contactName" v:"required" dc:"联系人"`
ContactPhone string `json:"contactPhone" v:"required" dc:"联系人电话"`
}
type CreateRes struct {
Id int64 `json:"id" dc:"门店ID"`
}
type UpdateReq struct {
g.Meta `path:"/store" method:"put" tags:"Store" summary:"(商户管理员)更新门店"`
Id int64 `json:"id" v:"required" dc:"门店ID"`
Name string `json:"name" v:"required" dc:"门店名称"`
Address string `json:"address" v:"required" dc:"门店地址"`
ContactName string `json:"contactName" v:"required" dc:"联系人"`
ContactPhone string `json:"contactPhone" v:"required" dc:"联系人电话"`
}
type UpdateRes struct {
Success bool `json:"success" dc:"是否成功"`
}