feat:完善项目信息
This commit is contained in:
@ -19,15 +19,3 @@ func (*Config) Index(c *gin.Context) {
|
||||
data, err := controller.NewConfig()(nil).Instance(form.Kind)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Config) Area(c *gin.Context) {
|
||||
form := &struct {
|
||||
Code string `json:"code" form:"code"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data := controller.NewConfig()(nil).Area(form.Code)
|
||||
api.APIResponse(nil, data)(c)
|
||||
}
|
||||
|
||||
@ -10,6 +10,6 @@ type Docking struct{}
|
||||
|
||||
// Launch 联系客服对接
|
||||
func (*Docking) Launch(c *gin.Context) {
|
||||
err := controller.NewDocking()(nil, "").Form()
|
||||
err := controller.NewDocking()(nil).Form()
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -2,15 +2,13 @@ package controller
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/admin/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
config2 "SciencesServer/config"
|
||||
)
|
||||
|
||||
type Config struct{ *session.Admin }
|
||||
type Config struct{ *session.Enterprise }
|
||||
|
||||
type ConfigHandle func(session *session.Admin) *Config
|
||||
type ConfigHandle func(session *session.Enterprise) *Config
|
||||
|
||||
type (
|
||||
ConfigInfo struct {
|
||||
@ -33,16 +31,8 @@ func (c *Config) Instance(kind int) ([]*ConfigInfo, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Area 区域信息
|
||||
func (c *Config) Area(key string) map[string]string {
|
||||
if key == "" {
|
||||
key = config2.DefaultChinaAreaCode
|
||||
}
|
||||
return config.MemoryForAreaInfo[key]
|
||||
}
|
||||
|
||||
func NewConfig() ConfigHandle {
|
||||
return func(session *session.Admin) *Config {
|
||||
return &Config{Admin: session}
|
||||
return func(session *session.Enterprise) *Config {
|
||||
return &Config{Enterprise: session}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,10 +8,9 @@ import (
|
||||
|
||||
type Docking struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
}
|
||||
|
||||
type DockingHandle func(session *session.Enterprise, local string) *Docking
|
||||
type DockingHandle func(session *session.Enterprise) *Docking
|
||||
|
||||
// Form 联系客服对接
|
||||
func (c *Docking) Form() error {
|
||||
@ -24,10 +23,9 @@ func (c *Docking) Form() error {
|
||||
}
|
||||
|
||||
func NewDocking() DockingHandle {
|
||||
return func(session *session.Enterprise, local string) *Docking {
|
||||
return func(session *session.Enterprise) *Docking {
|
||||
return &Docking{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user