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{
|
2022-05-03 07:17:27 +00:00
|
|
|
|
|
|
|
"search": func(that *Context) {
|
|
|
|
keywords := that.Req.FormValue("keywords")
|
|
|
|
if len(keywords) < 2 {
|
2022-05-03 00:09:25 +00:00
|
|
|
that.Display(0, Slice{})
|
|
|
|
return
|
|
|
|
}
|
2022-05-03 07:17:27 +00:00
|
|
|
|
|
|
|
res, err := aliyun.Company.GetCompanyList(keywords)
|
2022-05-03 00:09:25 +00:00
|
|
|
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"))
|
|
|
|
},
|
|
|
|
}
|