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

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

@ -1,16 +1,55 @@
package model
type (
AdminLoginIn struct {
Username string
Password string
}
// Admin 管理员信息
type Admin struct {
Id int64 `json:"id" orm:"id,primary"` // 管理员ID
RoleId int64 `json:"roleId" orm:"role_id,not null"` // 角色ID
Username string `json:"username" orm:"username,not null"` // 管理员用户名
PasswordHash string `json:"passwordHash" orm:"password_hash,not null"` // 密码哈希
RealName string `json:"realName" orm:"real_name"` // 真实姓名
Phone string `json:"phone" orm:"phone"` // 手机号
Email string `json:"email" orm:"email"` // 邮箱
Status int `json:"status" orm:"status,default:1"` // 状态1=正常2=禁用
}
AdminInfoIn struct {
Id int
}
AdminInfoOut struct {
Id int64
Username string
}
)
// AdminCreateIn 创建管理员请求
type AdminCreateIn struct {
RoleId int64
Username string
Password string
RealName string
Phone string
Email string
Status int
}
// AdminUpdateIn 更新管理员请求
type AdminUpdateIn struct {
Id int64
RoleId int64
RealName string
Phone string
Email string
Status int
}
// AdminOut 管理员响应
type AdminOut struct {
*Admin
}
type AdminLoginIn struct {
Username string
Password string
}
type AdminInfoIn struct {
Id int64
}
type AdminInfoOut struct {
Id int64
Username string
PasswordHash string
RealName string
Phone string
Email string
}

View File

@ -25,4 +25,7 @@ type MerchantAdmins struct {
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
IsPrimary interface{} // 是否主账号0=否1=是
LastLoginIp interface{} // 最后登录IP
RoleId interface{} // 角色ID
}

View File

@ -11,18 +11,26 @@ import (
// Merchants is the golang structure of table merchants for DAO operations like Where/Data.
type Merchants struct {
g.Meta `orm:"table:merchants, do:true"`
Id interface{} // 商户ID
Name interface{} // 商户名称
BusinessLicense interface{} // 营业执照号
LegalPerson interface{} // 法人姓名
ContactName interface{} // 联系人姓名
ContactPhone interface{} // 联系人电话
ContactEmail interface{} // 联系人邮箱
Address interface{} // 商户地址
Status interface{} // 状态1=正常2=禁用3=待审核
ExpireAt *gtime.Time // 服务到期时间
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
g.Meta `orm:"table:merchants, do:true"`
Id interface{} // 商户ID
Name interface{} // 商户名称
BusinessLicense interface{} // 营业执照号
LegalPerson interface{} // 法人姓名
ContactName interface{} // 联系人姓名
ContactPhone interface{} // 联系人电话
ContactEmail interface{} // 联系人邮箱
Address interface{} // 商户地址
Status interface{} // 状态1=正常2=禁用
ExpireAt *gtime.Time // 服务到期时间
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
ApplicationReason interface{} // 申请理由
CreatedBy interface{} // 创建人ID
CreatedByType interface{} // 创建人类型1=系统管理员2=商户注册
AuditStatus interface{} // 审核状态0=待审核1=审核通过2=审核拒绝
AuditBy interface{} // 审核人ID
AuditAt *gtime.Time // 审核时间
AuditRemark interface{} // 审核备注
RejectReason interface{} // 拒绝原因
}

View File

@ -25,4 +25,5 @@ type StoreAdmins struct {
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
RoleId interface{} // 角色ID
}

View File

@ -11,17 +11,16 @@ import (
// Stores is the golang structure of table stores for DAO operations like Where/Data.
type Stores struct {
g.Meta `orm:"table:stores, do:true"`
Id interface{} // 门店ID
MerchantId interface{} // 所属商户ID
Name interface{} // 门店名称
StoreCode interface{} // 门店编号
Address interface{} // 门店地址
ContactName interface{} // 联系人姓名
ContactPhone interface{} // 联系人电话
BusinessHours interface{} // 营业时间
Status interface{} // 状态1=正常营业2=暂停营业3=已关闭
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
g.Meta `orm:"table:stores, do:true"`
Id interface{} // 门店ID
MerchantId interface{} // 所属商户ID
Name interface{} // 门店名称
StoreCode interface{} // 门店编号
Address interface{} // 门店地址
ContactName interface{} // 联系人姓名
ContactPhone interface{} // 联系人电话
Status interface{} // 状态1=正常营业2=暂停营业3=已关闭
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间
}

View File

@ -23,4 +23,7 @@ type MerchantAdmins struct {
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
IsPrimary bool `json:"isPrimary" orm:"is_primary" description:"是否主账号0=否1=是"` // 是否主账号0=否1=是
LastLoginIp string `json:"lastLoginIp" orm:"last_login_ip" description:"最后登录IP"` // 最后登录IP
RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` // 角色ID
}

View File

@ -10,17 +10,25 @@ import (
// Merchants is the golang structure for table merchants.
type Merchants struct {
Id int64 `json:"id" orm:"id" description:"商户ID"` // 商户ID
Name string `json:"name" orm:"name" description:"商户名称"` // 商户名称
BusinessLicense string `json:"businessLicense" orm:"business_license" description:"营业执照号"` // 营业执照号
LegalPerson string `json:"legalPerson" orm:"legal_person" description:"法人姓名"` // 法人姓名
ContactName string `json:"contactName" orm:"contact_name" description:"联系人姓名"` // 联系人姓名
ContactPhone string `json:"contactPhone" orm:"contact_phone" description:"联系人电话"` // 联系人电话
ContactEmail string `json:"contactEmail" orm:"contact_email" description:"联系人邮箱"` // 联系人邮箱
Address string `json:"address" orm:"address" description:"商户地址"` // 商户地址
Status int `json:"status" orm:"status" description:"状态1=正常2=禁用3=待审核"` // 状态1=正常2=禁用3=待审核
ExpireAt *gtime.Time `json:"expireAt" orm:"expire_at" description:"服务到期时间"` // 服务到期时间
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
Id int64 `json:"id" orm:"id" description:"商户ID"` // 商户ID
Name string `json:"name" orm:"name" description:"商户名称"` // 商户名称
BusinessLicense string `json:"businessLicense" orm:"business_license" description:"营业执照号"` // 营业执照号
LegalPerson string `json:"legalPerson" orm:"legal_person" description:"法人姓名"` // 法人姓名
ContactName string `json:"contactName" orm:"contact_name" description:"联系人姓名"` // 联系人姓名
ContactPhone string `json:"contactPhone" orm:"contact_phone" description:"联系人电话"` // 联系人电话
ContactEmail string `json:"contactEmail" orm:"contact_email" description:"联系人邮箱"` // 联系人邮箱
Address string `json:"address" orm:"address" description:"商户地址"` // 商户地址
Status int `json:"status" orm:"status" description:"状态1=正常2=禁用"` // 状态1=正常2=禁用
ExpireAt *gtime.Time `json:"expireAt" orm:"expire_at" description:"服务到期时间"` // 服务到期时间
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
ApplicationReason string `json:"applicationReason" orm:"application_reason" description:"申请理由"` // 申请理由
CreatedBy int64 `json:"createdBy" orm:"created_by" description:"创建人ID"` // 创建人ID
CreatedByType int `json:"createdByType" orm:"created_by_type" description:"创建人类型1=系统管理员2=商户注册"` // 创建人类型1=系统管理员2=商户注册
AuditStatus int `json:"auditStatus" orm:"audit_status" description:"审核状态0=待审核1=审核通过2=审核拒绝"` // 审核状态0=待审核1=审核通过2=审核拒绝
AuditBy int64 `json:"auditBy" orm:"audit_by" description:"审核人ID"` // 审核人ID
AuditAt *gtime.Time `json:"auditAt" orm:"audit_at" description:"审核时间"` // 审核时间
AuditRemark string `json:"auditRemark" orm:"audit_remark" description:"审核备注"` // 审核备注
RejectReason string `json:"rejectReason" orm:"reject_reason" description:"拒绝原因"` // 拒绝原因
}

View File

@ -23,4 +23,5 @@ type StoreAdmins struct {
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` // 角色ID
}

View File

@ -10,16 +10,15 @@ import (
// Stores is the golang structure for table stores.
type Stores struct {
Id int64 `json:"id" orm:"id" description:"门店ID"` // 门店ID
MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID
Name string `json:"name" orm:"name" description:"门店名称"` // 门店名称
StoreCode string `json:"storeCode" orm:"store_code" description:"门店编号"` // 门店编号
Address string `json:"address" orm:"address" description:"门店地址"` // 门店地址
ContactName string `json:"contactName" orm:"contact_name" description:"联系人姓名"` // 联系人姓名
ContactPhone string `json:"contactPhone" orm:"contact_phone" description:"联系人电话"` // 联系人电话
BusinessHours string `json:"businessHours" orm:"business_hours" description:"营业时间"` // 营业时间
Status int `json:"status" orm:"status" description:"状态1=正常营业2=暂停营业3=已关闭"` // 状态1=正常营业2=暂停营业3=已关闭
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
Id int64 `json:"id" orm:"id" description:"门店ID"` // 门店ID
MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID
Name string `json:"name" orm:"name" description:"门店名称"` // 门店名称
StoreCode string `json:"storeCode" orm:"store_code" description:"门店编号"` // 门店编号
Address string `json:"address" orm:"address" description:"门店地址"` // 门店地址
ContactName string `json:"contactName" orm:"contact_name" description:"联系人姓名"` // 联系人姓名
ContactPhone string `json:"contactPhone" orm:"contact_phone" description:"联系人电话"` // 联系人电话
Status int `json:"status" orm:"status" description:"状态1=正常营业2=暂停营业3=已关闭"` // 状态1=正常营业2=暂停营业3=已关闭
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
}

View File

@ -0,0 +1,80 @@
package model
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Merchant 商户信息
type Merchant struct {
Id int64 `json:"id" orm:"id,primary"` // 商户ID
Name string `json:"name" orm:"name,not null"` // 商户名称
BusinessLicense string `json:"businessLicense" orm:"business_license"` // 营业执照号
LegalPerson string `json:"legalPerson" orm:"legal_person"` // 法人姓名
ContactName string `json:"contactName" orm:"contact_name"` // 联系人姓名
ContactPhone string `json:"contactPhone" orm:"contact_phone"` // 联系人电话
ContactEmail string `json:"contactEmail" orm:"contact_email"` // 联系人邮箱
Address string `json:"address" orm:"address"` // 商户地址
Status int `json:"status" orm:"status,default:1"` // 状态1=正常2=禁用
ExpireAt *gtime.Time `json:"expireAt" orm:"expire_at"` // 服务到期时间
ApplicationReason int64 `json:"applicationReason" orm:"application_reason"` // 申请理由
CreatedBy int64 `json:"createdBy" orm:"created_by"` // 创建人ID
CreatedByType int `json:"createdByType" orm:"created_by_type"` // 创建人类型1=系统管理员2=商户注册
AuditStatus int `json:"auditStatus" orm:"audit_status,default:0"` // 审核状态0=待审核1=审核通过2=审核拒绝
AuditBy int64 `json:"auditBy" orm:"audit_by"` // 审核人ID
AuditAt *gtime.Time `json:"auditAt" orm:"audit_at"` // 审核时间
AuditRemark string `json:"auditRemark" orm:"audit_remark"` // 审核备注
RejectReason string `json:"rejectReason" orm:"reject_reason"` // 拒绝原因
}
// MerchantCreateIn 创建商户请求
type MerchantCreateIn struct {
Name string
BusinessLicense string
LegalPerson string
ContactName string
ContactPhone string
ContactEmail string
Address string
ApplicationReason int64
}
// MerchantUpdateIn 更新商户请求
type MerchantUpdateIn struct {
Id int64
Name string
BusinessLicense string
LegalPerson string
ContactName string
ContactPhone string
ContactEmail string
Address string
Status int
ExpireAt *gtime.Time
}
// MerchantAuditIn 审核商户请求
type MerchantAuditIn struct {
AdminId int64
Id int64
AuditStatus int
AuditRemark string
RejectReason string
}
type MerchantAuditOut struct {
}
// MerchantOut 商户响应
type MerchantOut struct {
*Merchant
}
type MerchantListIn struct {
Page int
Size int
Status int
AuditStatus int
}
type MerchantListOut struct {
List []Merchant
Total int
}

View File

@ -0,0 +1,46 @@
package model
// MerchantAdmin 商户管理员信息
type MerchantAdmin struct {
}
// MerchantLoginIn 商户登录入参
type MerchantLoginIn struct {
Phone string
Username string
Password string
Code string
}
type MerchantLoginOut struct {
Token string
}
type MerchantAdminInfoIn struct {
MerchantAdminId int64
}
type MerchantAdminInfoOut struct {
*MerchantAdmin
}
type MerchantAdminCodeIn struct {
Phone string
}
type MerchantAdminCodeOut struct {
}
type MerchantAdminVertifyPhoneIn struct {
MerchantAdminId int64
Phone string
Code string
}
type MerchantAdminVertifyPhoneOut struct {
}
type MerchantAdminRegisterIn struct {
Username string
Phone string
Password string
Password2 string
Code string
ApplicationReason string
}
type MerchantAdminRegisterOut struct {
Success bool
}

View File

@ -1,24 +0,0 @@
package model
import "github.com/gogf/gf/v2/frame/g"
type RoleMenu struct {
g.Meta `orm:"table:role_menus"`
Id int64 `json:"id" orm:"id" dc:"角色菜单ID"`
RoleId int64 `json:"roleId" orm:"role_id" dc:"角色ID"`
MenuId int64 `json:"menuId" orm:"menu_id" dc:"菜单ID"`
}
type RoleMenuListInput struct {
Page int
Size int
RoleId int64
}
type RoleMenuListOutput struct {
List []RoleMenu
Total int
}
type RoleMenuSaveInput struct {
RoleId int
MenuIds []int
}

29
internal/model/upload.go Normal file
View File

@ -0,0 +1,29 @@
package model
import "github.com/gogf/gf/v2/net/ghttp"
type UploadIn struct {
File *ghttp.UploadFile
}
type UploadOut struct {
Url string
}
type OssOutput struct {
Url string
}
type OssBytesInput struct {
Bytes []byte
Name string
}
type OssGetFileInput struct {
FilePath string
Name string
}
type OssUploadFileInput struct {
Filename string
File *ghttp.UploadFile
}

View File

@ -1,6 +1,58 @@
package model
import "time"
import (
"time"
"github.com/gogf/gf/v2/os/gtime"
)
// User 用户信息
type User struct {
Id int64 `json:"id" orm:"id,primary"` // 用户ID
Username string `json:"username" orm:"username,not null"` // 用户名
PasswordHash string `json:"passwordHash" orm:"password_hash,not null"` // 密码哈希
Nickname string `json:"nickname" orm:"nickname"` // 昵称
Avatar string `json:"avatar" orm:"avatar"` // 头像
Phone string `json:"phone" orm:"phone"` // 手机号
Email string `json:"email" orm:"email"` // 邮箱
Gender int `json:"gender" orm:"gender,default:0"` // 性别0=未知1=男2=女
Birthday *gtime.Time `json:"birthday" orm:"birthday"` // 生日
Status int `json:"status" orm:"status,default:1"` // 状态1=正常2=禁用
LastLoginAt *gtime.Time `json:"lastLoginAt" orm:"last_login_at"` // 最后登录时间
LastLoginIp string `json:"lastLoginIp" orm:"last_login_ip"` // 最后登录IP
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at"` // 软删除时间戳
}
// UserCreateIn 创建用户请求
type UserCreateIn struct {
Username string
Password string
Nickname string
Avatar string
Phone string
Email string
Gender int
Birthday *gtime.Time
}
// UserUpdateIn 更新用户请求
type UserUpdateIn struct {
Id int64
Nickname string
Avatar string
Phone string
Email string
Gender int
Birthday *gtime.Time
Status int
}
// UserOut 用户响应
type UserOut struct {
*User
}
type LoginCache struct {
Token string `json:"token"`
@ -23,7 +75,5 @@ type UserInfoOut struct {
Id int64
}
type UserUpdateIn struct {
}
type UserBindPhoneIn struct {
}