感动中国

This commit is contained in:
eson 2023-08-10 12:04:36 +08:00
parent 68488da99c
commit 440f13bee8
102 changed files with 146 additions and 125 deletions

0
config_replica_id.sh Normal file → Executable file
View File

View File

@ -26,12 +26,11 @@ type ServiceContext struct {
func NewServiceContext(c {{.config}}) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := fsm.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: StateServer,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
RabbitMq:initalize.InitRabbitMq(c.SourceRabbitMq, nil),
{{.middlewareAssignment}}

View File

@ -13,7 +13,7 @@ func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
{{if .HasRequest}}var req types.{{.RequestType}}
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,8 @@ func AcceptCookieHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserEmailConfirmationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestEmailConfirmation
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserEmailRegisterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestEmailRegister
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserGoogleLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestGoogleLogin
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestUserLogin
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -6,7 +6,6 @@ import (
"fusenapi/server/auth/internal/config"
"fusenapi/shared"
"fusenapi/utils/auth"
"fusenapi/utils/autoconfig"
"net/http"
"fusenapi/initalize"
@ -28,12 +27,12 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: StateServer,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
TokenManger: auth.NewConfirmationLink[auth.RegisterToken](c.Auth.AccessSecret, "http://localhost:9900/api/auth/oauth2/register"),
}

View File

@ -15,7 +15,7 @@ func GetCanteenDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetCanteenDetailReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func SaveCanteenTypeProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc
return func(w http.ResponseWriter, r *http.Request) {
var req types.SaveCanteenTypeProductReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -5,7 +5,6 @@ import (
"fmt"
"fusenapi/server/canteen/internal/config"
"fusenapi/shared"
"fusenapi/utils/autoconfig"
"net/http"
"fusenapi/initalize"
@ -25,12 +24,12 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: StateServer,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
}
}

View File

@ -15,7 +15,7 @@ func GetQrCodeSetListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetStandardLogoListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -5,7 +5,6 @@ import (
"fmt"
"fusenapi/server/data-transfer/internal/config"
"fusenapi/shared"
"fusenapi/utils/autoconfig"
"net/http"
"fusenapi/initalize"
@ -25,12 +24,12 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: StateServer,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
}
}

View File

@ -15,7 +15,7 @@ func UserAddAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestAddAddress
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserAddressListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserAgainOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UserAgainOrderReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserBasicInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserContactServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestContactService
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserFontsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserGetTypeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserLogoListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UserLogoListReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserOderDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestOrderId
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserOrderCancelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UserOrderCancelReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserOrderDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UserOrderDeleteReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserOrderListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UserOrderListReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserSaveBasicInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestBasicInfoForm
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UserStatusConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -4,7 +4,6 @@ import (
"fusenapi/initalize"
"fusenapi/model/gmodel"
"fusenapi/shared"
"fusenapi/utils/autoconfig"
"github.com/golang-jwt/jwt"
"gorm.io/gorm"
@ -25,12 +24,12 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: StateServer,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
}
}

View File

@ -1,6 +1,7 @@
Name: inventory
Host: localhost
Port: 9905
ReplicaId: 30
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
Auth:
AccessSecret: fusen2023

View File

@ -15,7 +15,7 @@ func GetCloudListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetCloudListReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetPickupListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetPickupListReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func SupplementHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SupplementReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func TakeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.TakeReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -5,7 +5,6 @@ import (
"fmt"
"fusenapi/server/inventory/internal/config"
"fusenapi/shared"
"fusenapi/utils/autoconfig"
"net/http"
"fusenapi/initalize"
@ -25,12 +24,12 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: StateServer,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
}
}

View File

@ -15,7 +15,7 @@ func GetMapLibraryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func SaveMapLibraryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -5,7 +5,6 @@ import (
"fmt"
"fusenapi/server/map-library/internal/config"
"fusenapi/shared"
"fusenapi/utils/autoconfig"
"net/http"
"fusenapi/initalize"
@ -25,12 +24,12 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: StateServer,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
}
}

View File

@ -15,7 +15,7 @@ func GetOrderDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetOrderDetailReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetOrderInvoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetOrderInvoiceReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -5,7 +5,6 @@ import (
"fmt"
"fusenapi/server/orders/internal/config"
"fusenapi/shared"
"fusenapi/utils/autoconfig"
"net/http"
"fusenapi/initalize"
@ -25,12 +24,12 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: StateServer,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
}
}

View File

@ -1,6 +1,7 @@
Name: pay
Host: 0.0.0.0
Port: 9915
ReplicaId: 45
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
Auth:
AccessSecret: fusen2023

View File

@ -15,7 +15,7 @@ func OrderPaymentIntentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.OrderPaymentIntentReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func OrderRefundHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.OrderRefundReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -25,7 +25,7 @@ func StripeWebhookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
var req types.StripeWebhookReq
// userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
// userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
// if err != nil {
// return
// }

View File

@ -5,7 +5,6 @@ import (
"fmt"
"fusenapi/server/pay/internal/config"
"fusenapi/shared"
"fusenapi/utils/autoconfig"
"net/http"
"fusenapi/initalize"
@ -25,12 +24,12 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: StateServer,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
}
}

View File

@ -15,7 +15,7 @@ func GetProductTemplateTagsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetProductTemplateTagsReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -5,7 +5,6 @@ import (
"fmt"
"fusenapi/server/product-template-tag/internal/config"
"fusenapi/shared"
"fusenapi/utils/autoconfig"
"net/http"
"fusenapi/initalize"
@ -25,12 +24,12 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: StateServer,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
}
}

View File

@ -15,7 +15,7 @@ func DesignGatherHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DesignGatherReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetFittingByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetFittingByPidReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetLastProductDesignHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetLightByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetLightByPidReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetModelByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetModelByPidReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetPriceByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetPriceByPidReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetProductDesignHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetProductDesignReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetProductInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetProductInfoReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetProductListReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetRecommandProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetRecommandProductListReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetRenderDesignHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetRenderDesignReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetRenderSettingByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetRenderSettingByPidReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetSizeByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetSizeByPidReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetSizeByProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetSuccessRecommandHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetSuccessRecommandReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetTagProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetTagProductListReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func GetTemplateByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetTemplateByPidReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func HomePageRecommendProductListHandler(svcCtx *svc.ServiceContext) http.Handle
return func(w http.ResponseWriter, r *http.Request) {
var req types.HomePageRecommendProductListReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func OtherProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.OtherProductListReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func SaveDesignHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SaveDesignReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -1,6 +1,7 @@
Name: render
Host: 0.0.0.0
Port: 9919
ReplicaId: 55
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
Auth:
AccessSecret: fusen2023

View File

@ -15,7 +15,7 @@ func GetFaceSliceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func RenderNotifyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RenderNotifyReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -5,7 +5,6 @@ import (
"fmt"
"fusenapi/server/render/internal/config"
"fusenapi/shared"
"fusenapi/utils/autoconfig"
"net/http"
"github.com/aws/aws-sdk-go/aws"
@ -31,14 +30,14 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
config := aws.Config{
Credentials: credentials.NewStaticCredentials(c.AWS.S3.Credentials.AccessKeyID, c.AWS.S3.Credentials.Secret, c.AWS.S3.Credentials.Token),
}
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: StateServer,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
RabbitMq: initalize.InitRabbitMq(c.SourceRabbitMq, nil),
AwsSession: session.Must(session.NewSession(&config)),

View File

@ -1,6 +1,7 @@
Name: resource
Host: 0.0.0.0
Port: 9916
ReplicaId: 60
Timeout: 15000 #服务超时时间(毫秒)
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
Auth:

View File

@ -15,7 +15,7 @@ func LogoCombineHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.LogoCombineReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func ResourceInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ResourceInfoReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -1,7 +1,7 @@
Name: shopping-cart-confirmation
Host: localhost
Port: 9911
ReplicaId: 60
ReplicaId: 65
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
Auth:
AccessSecret: fusen2023

View File

@ -15,7 +15,7 @@ func CartAddHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CartAddReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func CartDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CartDeleteReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func CartListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CartListReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func CartNumberHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func CartOrderDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CartOrderDetailReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func ChangeOrderMethodHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ChangeOrderMethodReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func CreateOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateOrderReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -5,7 +5,6 @@ import (
"fmt"
"fusenapi/server/shopping-cart-confirmation/internal/config"
"fusenapi/shared"
"fusenapi/utils/autoconfig"
"net/http"
"fusenapi/initalize"
@ -25,12 +24,12 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: StateServer,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
}
}

View File

@ -1,7 +1,7 @@
Name: upload
Host: localhost
Port: 9912
ReplicaId: 65
ReplicaId: 70
SourceMysql: "fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest"
Env: "test"
Auth:

View File

@ -15,7 +15,7 @@ func UploadCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UploadCallbackReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -16,7 +16,7 @@ func UploadFileBaseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
// data, _ := io.ReadAll(r.Body)
// log.Println(string(data))
var req types.UploadFileBaseReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UploadFileFrontendHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestUploadFileFrontend
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UploadFilesBackendHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UploadFilesReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UploadFilesFrontendHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UploadFilesReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UploadLogoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UploadLogoReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UploadQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UploadQrcodeReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -15,7 +15,7 @@ func UploadUpFileHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestUpFile
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -1,7 +1,7 @@
Name: webset
Host: localhost
Port: 9913
ReplicaId: 70
ReplicaId: 75
SourceMysql: "fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest"
Auth:
AccessSecret: fusen2023

View File

@ -15,7 +15,7 @@ func WebSetSettingHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestWebSet
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}

View File

@ -5,7 +5,6 @@ import (
"fmt"
"fusenapi/server/webset/internal/config"
"fusenapi/shared"
"fusenapi/utils/autoconfig"
"net/http"
"fusenapi/initalize"
@ -25,12 +24,12 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: StateServer,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
}
}

View File

@ -1,7 +1,7 @@
Name: websocket
Host: 0.0.0.0
Port: 9914
ReplicaId: 75
ReplicaId: 80
Timeout: 15000 #服务超时时间
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
Auth:

View File

@ -5,7 +5,6 @@ import (
"fmt"
"fusenapi/server/websocket/internal/config"
"fusenapi/shared"
"fusenapi/utils/autoconfig"
"net/http"
"fusenapi/initalize"
@ -26,12 +25,12 @@ type ServiceContext struct {
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
return &ServiceContext{
Config: c,
SharedState: StateServer,
MysqlConn: initalize.InitMysql(c.SourceMysql),
SharedState: nil,
MysqlConn: conn,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
RabbitMq: initalize.InitRabbitMq(c.SourceRabbitMq, nil),
}

View File

@ -119,7 +119,7 @@ func StartNode(ServerID uint64, serverconfigs []*autoconfig.ConfigServer, gdb *g
panic(err)
}
if err := nh.StartReplica(initialMembers, false, NewFsStateMachine, rc); err != nil {
if err := nh.StartReplica(initialMembers, true, NewFsStateMachine, rc); err != nil {
fmt.Fprintf(os.Stderr, "failed to add cluster, %v\n", err)
os.Exit(1)
}
@ -186,6 +186,7 @@ func StartNodeEx(ServerID uint64, serverconfigs []*autoconfig.ConfigServer, gdb
CompactionOverhead: 5,
}
datadir := filepath.Join(
"shared-state",
fmt.Sprintf("node%d", ServerID))
@ -203,6 +204,7 @@ func StartNodeEx(ServerID uint64, serverconfigs []*autoconfig.ConfigServer, gdb
// RaftAddress is used to identify the NodeHost instance
RaftAddress: nodeAddr,
}
nh, err := dragonboat.NewNodeHost(nhc)
if err != nil {
panic(err)

Some files were not shown because too many files have changed in this diff Show More