모듈 충돌 해결 및 코드 정리
This commit is contained in:
@ -12,9 +12,8 @@ import (
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"repositories.action2quare.com/ayo/go-ayo/logger"
|
||||
|
||||
"repositories.action2quare.com/ayo/go-ayo/common"
|
||||
common "repositories.action2quare.com/ayo/gocommon"
|
||||
"repositories.action2quare.com/ayo/gocommon/logger"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
@ -98,11 +97,30 @@ func (wl *whitelist) isMember(email string, platform string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
const (
|
||||
DivisionState_Closed = string("closed")
|
||||
DivisionState_Maintenance = string("maintenance")
|
||||
DivisionState_RestrictedOpen = string("restricted")
|
||||
DivisionState_FullOpen = string("open")
|
||||
)
|
||||
|
||||
type maintenance struct {
|
||||
Link string
|
||||
StartTime primitive.Timestamp
|
||||
}
|
||||
|
||||
type division struct {
|
||||
Url string `bson:"url"`
|
||||
Priority int `bson:"priority"`
|
||||
State string `bson:"state"`
|
||||
Maintenance maintenance `bson:"maintenance"`
|
||||
}
|
||||
|
||||
type serviceDescription struct {
|
||||
// sync.Mutex
|
||||
Id primitive.ObjectID `bson:"_id"`
|
||||
ServiceName string `bson:"service"`
|
||||
Divisions map[string]any `bson:"divisions"`
|
||||
Divisions map[string]division `bson:"divisions"`
|
||||
ServiceCode string `bson:"code"`
|
||||
UseWhitelist bool `bson:"use_whitelist"`
|
||||
Closed bool `bson:"closed"`
|
||||
@ -118,7 +136,7 @@ type serviceDescription struct {
|
||||
getUserBrowserInfo func(r *http.Request) (string, error)
|
||||
getUserTokenWithCheck func(platform string, userid string, brinfo string) (usertokeninfo, error)
|
||||
updateUserinfo func(info usertokeninfo) (bool, string, string)
|
||||
getProviderInfo func(platform string, uid string) (error, string, string)
|
||||
getProviderInfo func(platform string, uid string) (string, string, error)
|
||||
|
||||
apiUsers unsafe.Pointer
|
||||
divisionsSerialized unsafe.Pointer
|
||||
@ -305,7 +323,7 @@ func (sh *serviceDescription) link(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
err, newType, newId = sh.getProviderInfo(newType, newId)
|
||||
newType, newId, err = sh.getProviderInfo(newType, newId)
|
||||
if err != nil {
|
||||
logger.Error("getProviderInfo failed :", err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
@ -416,7 +434,7 @@ func (sh *serviceDescription) authorize(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
logger.Println("auth success :", authtype, uid, email, session)
|
||||
|
||||
err, newType, newId := sh.getProviderInfo(authtype, uid)
|
||||
newType, newId, err := sh.getProviderInfo(authtype, uid)
|
||||
if err != nil {
|
||||
logger.Error("getProviderInfo failed :", err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
|
||||
Reference in New Issue
Block a user