ソースを参照

CRM attachment now using global config

master
Patrick Peng Sun 8年前
コミット
e3783bb365
2個のファイルの変更8行の追加3行の削除
  1. +7
    -3
      crmAttachment.go
  2. +1
    -0
      crmAttachment_test.go

+ 7
- 3
crmAttachment.go ファイルの表示

} }


func crmUploadAttachmentURL() string { func crmUploadAttachmentURL() string {
return "https://c.hitxy.org.au/api/v1/Attachment/action/upload"

return CRMConfig.BaseURL + "api/v1/Attachment/action/upload"
} }


func crmAuthHeader() string { func crmAuthHeader() string {
//return "Basic cGF0cmljazpiNjFmYWRlMTM5OWYwY2ZjNmZjZjcxNTU0OTljNTNkOQ==" //return "Basic cGF0cmljazpiNjFmYWRlMTM5OWYwY2ZjNmZjZjcxNTU0OTljNTNkOQ=="
return "Basic cGF0cmljazp3b3JraGFyZA=="
s := CRMConfig.UserName + ":" + CRMConfig.UserPass
r := base64.StdEncoding.EncodeToString([]byte(s))
return "Basic " + r
} }


//crmFileDataString, encode a base64 string of the given file //crmFileDataString, encode a base64 string of the given file
} }


func crmAttachmentMetaURL(fileID string) string { func crmAttachmentMetaURL(fileID string) string {
return "https://c.hitxy.org.au/api/v1/Attachment/" + fileID
//return "https://c.hitxy.org.au/api/v1/Attachment/" + fileID
return CRMConfig.BaseURL + "api/v1/Attachment/" + fileID
} }


type attachmentInfo struct { type attachmentInfo struct {

+ 1
- 0
crmAttachment_test.go ファイルの表示

import "encoding/json" import "encoding/json"


func TestCRMAttachFile(t *testing.T) { func TestCRMAttachFile(t *testing.T) {
SetupConfig()
r, e := crmCreateAttachment("media_for_test/200x200.png") r, e := crmCreateAttachment("media_for_test/200x200.png")
log.Println(r) log.Println(r)
log.Println(e) log.Println(e)

読み込み中…
キャンセル
保存