Sfoglia il codice sorgente

added attachment caching path for CRM

master
Patrick Peng Sun 8 anni fa
parent
commit
8cfad7ba5b
3 ha cambiato i file con 13 aggiunte e 0 eliminazioni
  1. +1
    -0
      common_test.go
  2. +8
    -0
      main.go
  3. +4
    -0
      server.go

+ 1
- 0
common_test.go Vedi File

@@ -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) {

+ 8
- 0
main.go Vedi File

@@ -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 {

+ 4
- 0
server.go Vedi File

@@ -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)
}

Loading…
Annulla
Salva