feat: 迁移游戏商务绑定审核流程和列表
This commit is contained in:
@@ -11,10 +11,62 @@ import (
|
||||
type Business struct {
|
||||
preference *business.UserPreferenceService
|
||||
accounts *business.AccountService
|
||||
bindings *business.BindingService
|
||||
}
|
||||
|
||||
func NewBusiness(preference *business.UserPreferenceService, accounts *business.AccountService) *Business {
|
||||
return &Business{preference: preference, accounts: accounts}
|
||||
func NewBusiness(preference *business.UserPreferenceService, accounts *business.AccountService, bindings *business.BindingService) *Business {
|
||||
return &Business{preference: preference, accounts: accounts, bindings: bindings}
|
||||
}
|
||||
|
||||
func (h *Business) BindingList(c *gin.Context) {
|
||||
var req dto.BusinessBindingQuery
|
||||
if err := c.ShouldBindQuery(&req); err != nil {
|
||||
Fail(c, "绑定查询参数格式错误")
|
||||
return
|
||||
}
|
||||
rows, err := h.bindings.List(c.Request.Context(), &req)
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, rows)
|
||||
}
|
||||
func (h *Business) UserBindings(c *gin.Context) {
|
||||
id, err := strconv.ParseUint(c.Param("userId"), 10, 64)
|
||||
if err != nil || id == 0 {
|
||||
Fail(c, "商务用户 ID 不正确")
|
||||
return
|
||||
}
|
||||
rows, err := h.bindings.ForUser(c.Request.Context(), uint(id))
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, rows)
|
||||
}
|
||||
func (h *Business) BindPlatform(c *gin.Context) {
|
||||
var req dto.BusinessBindingRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
Fail(c, "绑定参数格式错误")
|
||||
return
|
||||
}
|
||||
if err := h.bindings.Bind(c.Request.Context(), &req); err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OK(c)
|
||||
}
|
||||
func (h *Business) UnbindPlatform(c *gin.Context) {
|
||||
var req dto.BusinessBindingRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
Fail(c, "解绑参数格式错误")
|
||||
return
|
||||
}
|
||||
if err := h.bindings.Unbind(c.Request.Context(), &req); err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OK(c)
|
||||
}
|
||||
|
||||
func (h *Business) AccountList(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user