hotime/example/app/company.go
2022-05-03 08:09:25 +08:00

32 lines
631 B
Go

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"))
},
}