hotime/example/app/lxcx.go

30 lines
802 B
Go
Raw Normal View History

2022-04-28 19:08:32 +00:00
package app
import (
. "code.hoteas.com/golang/hotime"
"code.hoteas.com/golang/hotime/common"
"io/ioutil"
"log"
"net/http"
"net/url"
)
var Lxcx = Ctr{
"lists": func(that *Context) {
urlStr := "https://www.ruichuangshe.com/Resources/Services/sAppInterface.ashx?type=policyprojectbycompanyname&page=1&pagesize=10&code=8eb68adf79d660e57ccd69ea4bf340162e29e43ec344df62b364bd65b886da7fca9fb995ad93a5b485d66fd268f946f34cf0&CompanyName="
companyName := that.Req.FormValue("company")
companyName = url.QueryEscape(url.QueryEscape(companyName))
resp, err := http.Get(urlStr + companyName)
if err != nil {
log.Println("err")
}
defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Println("err")
}
that.Display(0, common.ObjToMap(string(b)))
},
}