소스 검색

added attachment caching path for CRM

master
Patrick Peng Sun 8 년 전
부모
커밋
8cfad7ba5b
3개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. +1
    -0
      common_test.go
  2. +8
    -0
      main.go
  3. +4
    -0
      server.go

+ 1
- 0
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) {

+ 8
- 0
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 {

+ 4
- 0
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)
}

Loading…
취소
저장