optimize source code layout

pull/196/head
Michael Li 2 years ago
parent 5433eb9e8f
commit 367e0b018b

@ -0,0 +1 @@
### RESTful API for paopao-ce use [go-mir](https://github.com/alimy/mir) to generate service interface code automatic.

@ -0,0 +1,2 @@
### gRPC API
This directory contain some gRPC API define files.

@ -1,23 +1,23 @@
package servants package core
import ( import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/rocboss/paopao-ce/internal/model" "github.com/rocboss/paopao-ce/internal/model"
) )
type baseServant struct { type BaseServant struct {
// TODO // TODO
} }
type baseBinding struct { type BaseBinding struct {
// TODO // TODO
} }
type baseRender struct { type BaseRender struct {
// TODO // TODO
} }
func (baseServant) userFrom(c *gin.Context) (*model.User, bool) { func (BaseServant) userFrom(c *gin.Context) (*model.User, bool) {
if u, exists := c.Get("USER"); exists { if u, exists := c.Get("USER"); exists {
user, ok := u.(*model.User) user, ok := u.(*model.User)
return user, ok return user, ok

@ -2,11 +2,11 @@ package servants
import ( import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
api "github.com/rocboss/paopao-ce/internal/mirc/auto/api/v1" api "github.com/rocboss/paopao-ce/internal/mirc/auto/api/v1"
"github.com/rocboss/paopao-ce/internal/servants/web"
) )
// RegisterServants register all the servants to gin.Engine // RegisterServants register all the servants to gin.Engine
func RegisterServants(e *gin.Engine) { func RegisterServants(e *gin.Engine) {
api.RegisterWebCoreServant(e, newWebCoreSrv(), newWebCoreBinding(), newWebCoreRender()) api.RegisterWebCoreServant(e, web.NewWebCoreSrv(), web.NewWebCoreBinding(), web.NewWebCoreRender())
} }

@ -1,4 +1,4 @@
package servants package web
type webAdminSrv struct { type webAdminSrv struct {
// TODO // TODO

@ -1,4 +1,4 @@
package servants package web
type webAlipaySrv struct { type webAlipaySrv struct {
// TODO // TODO

@ -1,32 +1,27 @@
package servants package web
import ( import (
api "github.com/rocboss/paopao-ce/internal/mirc/auto/api/v1" api "github.com/rocboss/paopao-ce/internal/mirc/auto/api/v1"
"github.com/rocboss/paopao-ce/internal/servants/core"
)
var (
_ api.WebCore = (*webCoreSrv)(nil)
_ api.WebCoreBinding = (*webCoreBinding)(nil)
_ api.WebCoreRender = (*webCoreRender)(nil)
) )
type webCoreSrv struct { type webCoreSrv struct {
baseServant core.BaseServant
api.UnimplementedWebCoreServant api.UnimplementedWebCoreServant
} }
type webCoreBinding struct { type webCoreBinding struct {
baseBinding core.BaseBinding
api.UnimplementedWebCoreBinding api.UnimplementedWebCoreBinding
} }
type webCoreRender struct { type webCoreRender struct {
baseRender core.BaseRender
api.UnimplementedWebCoreRender api.UnimplementedWebCoreRender
} }
func newWebCoreSrv() api.WebCore {
return &webCoreSrv{}
}
func newWebCoreBinding() api.WebCoreBinding {
return &webCoreBinding{}
}
func newWebCoreRender() api.WebCoreRender {
return &webCoreRender{}
}

@ -1,4 +1,4 @@
package servants package web
type webFollowshipSrv struct { type webFollowshipSrv struct {
// TODO // TODO

@ -1,4 +1,4 @@
package servants package web
type webFriendshipSrv struct { type webFriendshipSrv struct {
// TODO // TODO

@ -1,4 +1,4 @@
package servants package web
type webLooseSrv struct { type webLooseSrv struct {
// TODO // TODO

@ -1,4 +1,4 @@
package servants package web
type webPrivSrv struct { type webPrivSrv struct {
// TODO // TODO

@ -1,4 +1,4 @@
package servants package web
type webPubSrv struct { type webPubSrv struct {
// TODO // TODO

@ -0,0 +1,17 @@
package web
import (
api "github.com/rocboss/paopao-ce/internal/mirc/auto/api/v1"
)
func NewWebCoreSrv() api.WebCore {
return &webCoreSrv{}
}
func NewWebCoreBinding() api.WebCoreBinding {
return &webCoreBinding{}
}
func NewWebCoreRender() api.WebCoreRender {
return &webCoreRender{}
}

@ -0,0 +1,8 @@
package version
var (
// GitHash Value will be set during build
GitHash = ""
// BuildTime Value will be set during build
BuildTime = ""
)
Loading…
Cancel
Save