diff --git a/common_test.go b/common_test.go index b8b60f2..059eb6f 100644 --- a/common_test.go +++ b/common_test.go @@ -19,6 +19,7 @@ func SetupConfig() { "https://c.hitxy.org.au/", "wechat", "crmwechat.api"} + GlobalPath = PathsConfig{"/tmp"} } func AssertEqual(t *testing.T, a interface{}, b interface{}, message string) { diff --git a/main.go b/main.go index 5ff9219..37dcccb 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,14 @@ import ( "net/http" ) +//PathsConfig all system available pathes +type PathsConfig struct { + CRMAttachment string `json:"crm_attachmeng"` +} + +//GlobalPath all global pathes configurations +var GlobalPath = PathsConfig{"/tmp/"} + func main() { err := readConfig() //wechat API config if err != nil { diff --git a/server.go b/server.go index 2e52d9f..aa63d56 100644 --- a/server.go +++ b/server.go @@ -187,3 +187,7 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) { defer f.Close() io.Copy(f, file) } + +func crmAttachmentHandler(w http.Response, r *http.Request) { + http.ServeFile(w, r) +}