From d21caded6f45d7e8019b8de1e73d3b5d8c9d0f81 Mon Sep 17 00:00:00 2001 From: Patrick Peng Sun Date: Wed, 12 Jul 2017 01:12:44 +1000 Subject: [PATCH] adapt to exported AvatarCacheURL function. --- procGetBasicUserInfo.go | 6 +++--- spaEdit.go | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 spaEdit.go diff --git a/procGetBasicUserInfo.go b/procGetBasicUserInfo.go index bb4af4f..232a561 100644 --- a/procGetBasicUserInfo.go +++ b/procGetBasicUserInfo.go @@ -64,9 +64,9 @@ func (m *getBasicUserInfoDef) intro(ss *openIDSessionData, in *InWechatMsg) { func (m crmdLead) getBasicUserInfoPhoto() (ret sendNewsArticle) { a := sendNewsArticle{} a.Description = "" - a.PicURL = m.avatarCacheURL() + a.PicURL = m.AvatarCacheURL() a.Title = m.Name - a.URL = m.avatarCacheURL() + a.URL = m.AvatarCacheURL() log.Println(a.URL) return a } @@ -102,6 +102,6 @@ func (m crmdLead) getBasicUserInfoEditButton() (ret sendNewsArticle) { a.Description = "" a.PicURL = "" a.Title = "点击这里编辑您的资料" - a.URL = "https://google.com.au" + a.URL = "http://192.168.1.39:65500/spa/editprofile" return a } diff --git a/spaEdit.go b/spaEdit.go new file mode 100644 index 0000000..0ffa191 --- /dev/null +++ b/spaEdit.go @@ -0,0 +1,25 @@ +package main + +import ( + "html/template" + "io/ioutil" + "log" + "net/http" +) + +func spaEditProfile(w http.ResponseWriter, r *http.Request) { + + tTest := template.New("spaEditProfile") + str, err := ioutil.ReadFile("spa/edit.html") + log.Println(string(str)) + log.Println(err) + tTest, err = tTest.Parse(string(str)) + log.Println(err) + id := "595a323d4d639d84d" + lead, err := crmGetLead(id) + log.Println(err) + err = tTest.Execute(w, lead) + log.Println(err) + //http.ServeFile(w, r, "spa/edit.html") + +}