From 7d4358af8339737b954431761c7100b2c06630eb Mon Sep 17 00:00:00 2001 From: hoteas <等> Date: Fri, 29 Apr 2022 03:08:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=91=E5=88=9B=E5=9C=B0=E5=9B=BE=E6=89=93?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/app/init.go | 1 + example/app/lxcx.go | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 example/app/lxcx.go diff --git a/example/app/init.go b/example/app/init.go index 628f570..8a929a4 100644 --- a/example/app/init.go +++ b/example/app/init.go @@ -15,6 +15,7 @@ import ( // Project 管理端项目 var Project = Proj{ + "lxcx": Lxcx, "wechat": Wechat, "websocket": WebsocketCtr, } diff --git a/example/app/lxcx.go b/example/app/lxcx.go new file mode 100644 index 0000000..ca10987 --- /dev/null +++ b/example/app/lxcx.go @@ -0,0 +1,30 @@ +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))) + + }, +}