by Robin at 20241107

This commit is contained in:
Leufolium 2024-11-07 17:20:34 +08:00
parent 9b830999aa
commit 6706183f44
12 changed files with 29 additions and 11 deletions

View File

@ -14,7 +14,7 @@ const (
SysNotifTemp_StreamerPunishmentEnds = 3 // 主播封禁结束
SysNotifTemp_PswdChanged = 4 // 修改密码
SysNotifTemp_AcctCancellationApplied = 5 // 申请注销账号
SysNotifTemp_AcctCancelled = 6 // 账号已注销
SysNotifTemp_AcctCancelled = 6 // 账号已注销(todo)
SysNotifTemp_StreamerAuthApprovalPassed = 7 // 申请入驻、完善资料均通过
SysNotifTemp_ZoneCreated = 8 // 空间开通时
SysNotifTemp_ZoneVasUpdated = 9 // 设置空间付费信息

View File

@ -110,6 +110,7 @@ func main() {
port := cfg.App.Port
router := httpengine.NewRouter()
middleware.InitJwtAuthenticator(service.DefaultService.OpVerifyToken)
service.DefaultService.ConnectToNotifCenter(middleware.InitNotifSender)
validator.InitDefaultNotNullValidator()
controller.Init(router)
srv := &http.Server{

View File

@ -116,6 +116,7 @@ func main() {
// 初始化http server
router := httpengine.NewRouter()
middleware.InitJwtAuthenticator(service.DefaultService.OpVerifyToken)
service.DefaultService.ConnectToNotifCenter(middleware.InitNotifSender)
validator.InitDefaultNotNullValidator()
controller.InitOffline(router)
srv := &http.Server{

View File

@ -195,6 +195,7 @@ func ApiCancelAccount(ctx *gin.Context) {
}
ReplyOk(ctx, nil)
ctx.Next()
}
func ApiAbortAccountCancellation(ctx *gin.Context) {

View File

@ -22,6 +22,8 @@ func OpCreateAccountPunishment(ctx *gin.Context) {
}
ReplyOk(ctx, nil)
ctx.Next()
}
func OpGetAccountPunishmentList(ctx *gin.Context) {
@ -63,6 +65,7 @@ func OpUnblockAccountPunishment(ctx *gin.Context) {
}
ReplyOk(ctx, nil)
ctx.Next()
}
func OpGetTerminatedAccountPunishmentList(ctx *gin.Context) {

View File

@ -82,11 +82,11 @@ func Init(r *gin.Engine) {
// 登录
apiLoginGroup := r.Group("/api/login", PrepareToC())
apiLoginGroup.POST("login_by_pswd", middleware.JSONParamValidator(loginproto.ApiLoginByPswdReq{}), middleware.RequestDecryptor(), ApiLoginByPswd)
apiLoginGroup.POST("login_by_veri_code", middleware.JSONParamValidator(loginproto.ApiLoginByVeriCodeReq{}), middleware.RequestDecryptor(), ApiLoginByVeriCode)
apiLoginGroup.POST("login_by_veri_code", middleware.JSONParamValidator(loginproto.ApiLoginByVeriCodeReq{}), middleware.RequestDecryptor(), ApiLoginByVeriCode, middleware.NotifSender())
apiLoginGroup.POST("logout", middleware.JSONParamValidator(loginproto.ApiLogoutReq{}), middleware.JwtAuthenticator(), ApiLogout)
apiLoginGroup.POST("set_password", middleware.JSONParamValidator(loginproto.ApiSetPswdReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), ApiSetPassword)
apiLoginGroup.POST("reset_password", middleware.JSONParamValidator(loginproto.ApiResetPswdReq{}), middleware.RequestDecryptor(), ApiResetPassword)
apiLoginGroup.POST("update_password", middleware.JSONParamValidator(loginproto.ApiUpdatePswdReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), ApiUpdatePassword)
apiLoginGroup.POST("update_password", middleware.JSONParamValidator(loginproto.ApiUpdatePswdReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), ApiUpdatePassword, middleware.NotifSender())
apiLoginGroup.POST("validate", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), ApiValidate)
// 账号,用户端支持改、查自己、查别人、经验增长,不支持增删
@ -98,7 +98,7 @@ func Init(r *gin.Engine) {
apiAccountGroup.POST("list_others_by_mids", middleware.JSONParamValidator(accountproto.ApiListOthersByMidsReq{}), middleware.JwtAuthenticator(), ApiGetAccountListForOthersByMids)
apiAccountGroup.POST("list_others_by_user_id", middleware.JSONParamValidator(accountproto.ApiListOthersByUserIdReq{}), middleware.JwtAuthenticator(), ApiGetAccountListForOthersByUserId)
apiAccountGroup.POST("exp_inc", middleware.JSONParamValidator(accountproto.ApiExpIncReq{}), middleware.JwtAuthenticator(), ApiAccountExpInc)
apiAccountGroup.POST("cancel", middleware.JSONParamValidator(accountproto.ApiCancelReq{}), middleware.JwtAuthenticator(), ApiCancelAccount)
apiAccountGroup.POST("cancel", middleware.JSONParamValidator(accountproto.ApiCancelReq{}), middleware.JwtAuthenticator(), ApiCancelAccount, middleware.NotifSender())
apiAccountGroup.POST("abort_cancellation", middleware.JSONParamValidator(accountproto.ApiAbortCancellationReq{}), middleware.JwtAuthenticator(), ApiAbortAccountCancellation)
// GET通过token获取手机号
r.GET("api/account/get_mobile_phone", middleware.FORMParamValidator(accountproto.ApiGetMobilePhoneReq{}), ApiGetMobilePhone)
@ -240,8 +240,8 @@ func Init(r *gin.Engine) {
// 空间
apiZoneGroup := r.Group("/api/zone", PrepareToC())
apiZoneGroup.POST("create", middleware.JSONParamValidator(zoneproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateZone)
apiZoneGroup.POST("update", middleware.JSONParamValidator(zoneproto.ApiUpdateReq{}), middleware.JwtAuthenticator(), ApiUpdateZone)
apiZoneGroup.POST("create", middleware.JSONParamValidator(zoneproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateZone, middleware.NotifSender())
apiZoneGroup.POST("update", middleware.JSONParamValidator(zoneproto.ApiUpdateReq{}), middleware.JwtAuthenticator(), ApiUpdateZone, middleware.NotifSender())
apiZoneGroup.POST("delete", middleware.JSONParamValidator(zoneproto.ApiDeleteReq{}), middleware.JwtAuthenticator(), ApiDeleteZone)
apiZoneGroup.POST("list", middleware.JSONParamValidator(zoneproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetZoneList)
apiZoneGroup.POST("list_by_mid", middleware.JSONParamValidator(zoneproto.ApiListByMidReq{}), middleware.JwtAuthenticator(), ApiGetZoneListByMid)
@ -273,7 +273,7 @@ func Init(r *gin.Engine) {
// 空间代运营表
apiZoneThirdPartnerGroup := r.Group("/api/zone_third_partner", PrepareToC())
apiZoneThirdPartnerGroup.POST("create", middleware.JSONParamValidator(zone_third_partner_proto.ApiCreateReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), ApiCreateZoneThirdPartner)
apiZoneThirdPartnerGroup.POST("create", middleware.JSONParamValidator(zone_third_partner_proto.ApiCreateReq{}), middleware.JwtAuthenticator(), middleware.RequestDecryptor(), ApiCreateZoneThirdPartner, middleware.NotifSender())
//apiZoneThirdPartnerGroup.POST("update", middleware.JSONParamValidator(zone_third_partner_proto.ApiUpdateReq{}), middleware.JwtAuthenticator(), ApiUpdateZoneThirdPartner)
//apiZoneThirdPartnerGroup.POST("delete", middleware.JSONParamValidator(zone_third_partner_proto.ApiDeleteReq{}), middleware.JwtAuthenticator(), ApiDeleteZoneThirdPartner)
apiZoneThirdPartnerGroup.POST("list", middleware.JSONParamValidator(zone_third_partner_proto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetZoneThirdPartnerList)
@ -431,7 +431,7 @@ func Init(r *gin.Engine) {
opStreamerAuthApprovalGroup.POST("list_basic", middleware.JSONParamValidator(streamerauthapprovalbasicproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetStreamerAuthApprovalBasicList)
opStreamerAuthApprovalGroup.POST("approve_basic", middleware.JSONParamValidator(streamerauthapprovalbasicproto.OpApproveReq{}), middleware.JwtAuthenticator(), OpApproveStreamerAuthApprovalBasic)
opStreamerAuthApprovalGroup.POST("list_details", middleware.JSONParamValidator(streamerauthapprovaldetailsproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetStreamerAuthApprovalDetailsList)
opStreamerAuthApprovalGroup.POST("approve_details", middleware.JSONParamValidator(streamerauthapprovaldetailsproto.OpApproveReq{}), middleware.JwtAuthenticator(), OpApproveStreamerAuthApprovalDetails)
opStreamerAuthApprovalGroup.POST("approve_details", middleware.JSONParamValidator(streamerauthapprovaldetailsproto.OpApproveReq{}), middleware.JwtAuthenticator(), OpApproveStreamerAuthApprovalDetails, middleware.NotifSender())
// 主播认证审批历史表
opStreamerAuthApprovalHisGroup := r.Group("/op/streamer_auth_approval_his", PrepareOp())
@ -558,9 +558,9 @@ func Init(r *gin.Engine) {
// 账号处罚
opAccountPunishmentGroup := r.Group("/op/account_punishment", PrepareOp())
opAccountPunishmentGroup.POST("create", middleware.JSONParamValidator(accountpunishmentproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateAccountPunishment)
opAccountPunishmentGroup.POST("create", middleware.JSONParamValidator(accountpunishmentproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateAccountPunishment, middleware.NotifSender())
opAccountPunishmentGroup.POST("list", middleware.JSONParamValidator(accountpunishmentproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetAccountPunishmentList)
opAccountPunishmentGroup.POST("unblock", middleware.JSONParamValidator(accountpunishmentproto.OpUnblockReq{}), middleware.JwtAuthenticator(), OpUnblockAccountPunishment)
opAccountPunishmentGroup.POST("unblock", middleware.JSONParamValidator(accountpunishmentproto.OpUnblockReq{}), middleware.JwtAuthenticator(), OpUnblockAccountPunishment, middleware.NotifSender())
opAccountPunishmentGroup.POST("list_terminated", middleware.JSONParamValidator(accountpunishmentproto.OpListTerminatedReq{}), middleware.JwtAuthenticator(), OpGetTerminatedAccountPunishmentList)
// 账户注销

View File

@ -71,6 +71,7 @@ func ApiUpdatePassword(ctx *gin.Context) {
ReplyOk(ctx, &loginproto.ApiUpdatePswdData{
ApiResult: true,
})
ctx.Next()
}
func ApiLoginByVeriCode(ctx *gin.Context) {
@ -90,6 +91,8 @@ func ApiLoginByVeriCode(ctx *gin.Context) {
Token: token,
AccountVO: accountVO,
})
ctx.Next()
}
func ApiLogout(ctx *gin.Context) {

View File

@ -57,4 +57,5 @@ func OpApproveStreamerAuthApprovalDetails(ctx *gin.Context) {
}
ReplyOk(ctx, nil)
ctx.Next()
}

View File

@ -22,6 +22,7 @@ func ApiCreateZone(ctx *gin.Context) {
}
ReplyOk(ctx, nil)
ctx.Next()
}
func ApiUpdateZone(ctx *gin.Context) {
@ -34,6 +35,7 @@ func ApiUpdateZone(ctx *gin.Context) {
}
ReplyOk(ctx, nil)
ctx.Next()
}
func ApiDeleteZone(ctx *gin.Context) {

View File

@ -21,6 +21,7 @@ func ApiCreateZoneThirdPartner(ctx *gin.Context) {
}
ReplyOk(ctx, nil)
ctx.Next()
}
// func ApiUpdateZoneThirdPartner(ctx *gin.Context) {

View File

@ -328,6 +328,11 @@ func (s *Service) ConnectToStreamerRecommService(r *StreamerRecommService) {
})
}
// 通知推送接口
func (s *Service) ConnectToNotifCenter(connFunc func(*logic.Notification, *NotifBcstCenter)) {
connFunc(_DefaultNotification, DefaultNotifBcstCenter)
}
// Product
func (s *Service) OpCreateProduct(ctx *gin.Context, req *productproto.OpCreateReq) (ec errcode.ErrCode) {
ec = errcode.ErrCodeProductSrvOk

View File

@ -21,7 +21,7 @@ var (
DefaultNotifSender gin.HandlerFunc
)
func InitNotifSender(_DefaultNotification *logic.Notification, _DefaultNotifBcstCenter service.NotifBcstCenter) {
func InitNotifSender(_DefaultNotification *logic.Notification, _DefaultNotifBcstCenter *service.NotifBcstCenter) {
DefaultNotifSender = func(ctx *gin.Context) {
// 获取通知builder