Переглянути джерело

feat:获取剑鱼商务联系方式

zhangxinlei1996 2 роки тому
коміт
3aad7f02a7

+ 13 - 0
src/config.json

@@ -0,0 +1,13 @@
+{
+	"webport": "830",
+	"info":{
+		"tripartiteAuth":{
+			"phone": "18624906090",
+			"wxCodeImg": "https://web-zxl.jydev.jianyu360.com/commercial/img/wxcode.png"
+		},
+		"medical":{
+			"phone": "1888888888",
+			"wxCodeImg": "https://web-zxl.jydev.jianyu360.com/commercial/img/wxcode.png"
+		}
+	}
+}

BIN
src/go_build_main_go.exe


+ 16 - 0
src/main.go

@@ -0,0 +1,16 @@
+package main
+
+import (
+	"net/http"
+	_ "service/a"
+	_ "service/action"
+	"service/config"
+	_ "service/filter"
+
+	"github.com/go-xweb/xweb"
+)
+
+func main() {
+	mux1 := http.NewServeMux()
+	xweb.RunBase(":"+config.Sysconfig.Webport, mux1)
+}

+ 21 - 0
src/service/a/init.go

@@ -0,0 +1,21 @@
+package init
+
+import (
+	"time"
+
+	"github.com/go-xweb/httpsession"
+	"github.com/go-xweb/xweb"
+)
+
+func init() {
+	httpsession.IsRedisSessionStore = true
+	xweb.Config.Profiler = true
+	xweb.RootApp().AppConfig.StaticFileVersion = false
+	xweb.RootApp().AppConfig.CheckXsrf = false
+	xweb.RootApp().AppConfig.EnableHttpCache = false
+	xweb.RootApp().AppConfig.Mode = xweb.Product
+	xweb.RootApp().AppConfig.SessionTimeout = 7 * 24 * time.Hour
+	xweb.RootApp().Logger.SetOutputLevel(1) //输出日志,改为4则不输出任何日志
+	xweb.RootApp().AppConfig.StaticDir = "web/staticres"
+	xweb.RootApp().BasePath = "/commercial"
+}

+ 35 - 0
src/service/action/customer.go

@@ -0,0 +1,35 @@
+package action
+
+import (
+	qu "qfw/util"
+	"service/config"
+
+	"github.com/go-xweb/xweb"
+)
+
+type Action struct {
+	*xweb.Action
+	info xweb.Mapper `xweb:"/customer/info"`
+}
+
+func init() {
+	xweb.AddAction(&Action{})
+}
+
+func (a *Action) Info() {
+	module := a.GetString("module")
+	data := config.Sysconfig.Info[module]
+	ret := map[string]interface{}{
+		"data":       nil,
+		"error_msg":  "暂未找到模块",
+		"erros_code": -1,
+	}
+	if data != nil {
+		ret = map[string]interface{}{
+			"data":       qu.ObjToMap(data),
+			"error_msg":  "",
+			"erros_code": 0,
+		}
+	}
+	a.ServeJson(ret)
+}

+ 18 - 0
src/service/config/config.go

@@ -0,0 +1,18 @@
+package config
+
+import (
+	"qfw/util"
+)
+
+type config struct {
+	Webport string
+	Info    map[string]interface{}
+}
+
+var (
+	Sysconfig *config
+)
+
+func init() {
+	util.ReadConfig(&Sysconfig)
+}

+ 7 - 0
src/service/filter/filter.go

@@ -0,0 +1,7 @@
+package filter
+
+import "github.com/go-xweb/xweb"
+
+func init() {
+	xweb.AddFilter(&sessionfilter{App: xweb.RootApp()})
+}

+ 22 - 0
src/service/filter/sessionfilter.go

@@ -0,0 +1,22 @@
+package filter
+
+import (
+	"net/http"
+
+	"github.com/go-xweb/xweb"
+)
+
+//登录限制
+type sessionfilter struct {
+	App *xweb.App
+}
+
+//继承过滤器方法
+func (l *sessionfilter) Do(w http.ResponseWriter, req *http.Request) bool {
+	//session := l.App.SessionManager.Session(req, w)
+	//if session.Get("userId") == nil {
+	//	R.ServeJson(w, req, &Result{Error_code_1001, Error_msg_1001, nil})
+	//	return false
+	//}
+	return true
+}



BIN
src/web/staticres/img/wxcode.png