hotime/example/app/company.go

32 lines
631 B
Go
Raw Normal View History

2022-05-03 00:09:25 +00:00
package app
import (
. "code.hoteas.com/golang/hotime"
. "code.hoteas.com/golang/hotime/common"
"code.hoteas.com/golang/hotime/dri/aliyun"
"fmt"
)
var CompanyCtr = Ctr{
"lists": func(that *Context) {
companyName := that.Req.FormValue("company_name")
if len(companyName) < 2 {
that.Display(0, Slice{})
return
}
res, err := aliyun.Company.GetCompanyList(companyName)
if err != nil {
fmt.Println(err)
that.Display(0, Slice{})
return
}
if res.GetCeilInt64("status") != 200 {
fmt.Println(err)
that.Display(0, Slice{})
return
}
that.Display(0, res.GetMap("data").GetSlice("list"))
},
}