Przeglądaj źródła

added attachment caching path for CRM

master
Patrick Peng Sun 8 lat temu
rodzic
commit
8cfad7ba5b
3 zmienionych plików z 13 dodań i 0 usunięć
  1. +1
    -0
      common_test.go
  2. +8
    -0
      main.go
  3. +4
    -0
      server.go

+ 1
- 0
common_test.go Wyświetl plik

"https://c.hitxy.org.au/", "https://c.hitxy.org.au/",
"wechat", "wechat",
"crmwechat.api"} "crmwechat.api"}
GlobalPath = PathsConfig{"/tmp"}
} }


func AssertEqual(t *testing.T, a interface{}, b interface{}, message string) { func AssertEqual(t *testing.T, a interface{}, b interface{}, message string) {

+ 8
- 0
main.go Wyświetl plik

"net/http" "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() { func main() {
err := readConfig() //wechat API config err := readConfig() //wechat API config
if err != nil { if err != nil {

+ 4
- 0
server.go Wyświetl plik

defer f.Close() defer f.Close()
io.Copy(f, file) io.Copy(f, file)
} }

func crmAttachmentHandler(w http.Response, r *http.Request) {
http.ServeFile(w, r)
}

Ładowanie…
Anuluj
Zapisz