[이민우] 캐릭터 생성 제한 구현 (대신 커밋)
This commit is contained in:
26
core/api.go
26
core/api.go
@ -397,6 +397,30 @@ func (caller apiCaller) configAPI(w http.ResponseWriter, r *http.Request) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (caller apicaller) lockcreatecharAPI(w http.ResponseWriter, r *http.Request) error {
|
||||
mg, err := caller.mg.mongoClient.FindAll(CollectionService, bson.M{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
curregion, _ := gocommon.ReadStringFormValue(r.Form, "region")
|
||||
|
||||
for _, regioninfo := range mg {
|
||||
region := regioninfo["divisions"].(primitive.M)
|
||||
for idx, rl := range region {
|
||||
if idx == curregion {
|
||||
if rl.(primitive.M)["lockcreatechar"].(bool) {
|
||||
w.Write([]byte(fmt.Sprintf(`{"create":"%t"}`, true)))
|
||||
} else {
|
||||
w.Write([]byte(fmt.Sprintf(`{"create":"%t"}`, false)))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type apiCaller struct {
|
||||
userinfo map[string]any
|
||||
globalAdmins map[string]bool
|
||||
@ -503,6 +527,8 @@ func (mg *Maingate) api(w http.ResponseWriter, r *http.Request) {
|
||||
err = caller.blockAPI(w, r)
|
||||
} else if strings.HasSuffix(r.URL.Path, "/coupon") {
|
||||
err = caller.couponAPI(w, r)
|
||||
} else if strings.HasSuffix(r.URL.Path, "/lockcreatechar") {
|
||||
err = caller.lockcreatecharAPI(w, r)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user