Files
jx-callback/controllers/net_spider.go
2019-06-25 09:26:12 +08:00

33 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package controllers
import (
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/netspider"
"github.com/astaxie/beego"
)
type NetSpiderController struct {
beego.Controller
}
// @Title 同步商家商品信息
// @Description 同步商家商品信息
// @Param token header string true "认证token"
// @Param vendorIDs formData string false "厂商ID列表"
// @Param cityCodes formData string false "城市列表,缺省为后台启用了的城市"
// @Param radius formData int false "区域半径单位为米缺省8000米"
// @Param gridWith formData int false "网格大小单位为米缺省为3000米"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetAndStoreCitiesShops [post]
func (c *NetSpiderController) GetAndStoreCitiesShops() {
c.callGetAndStoreCitiesShops(func(params *tNetspiderGetAndStoreCitiesShopsParams) (retVal interface{}, errCode string, err error) {
var vendorIDs, cityCodes []int
err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDs, params.CityCodes, &cityCodes)
if err == nil {
retVal, err = netspider.GetAndStoreCitiesShops(params.Ctx, vendorIDs, cityCodes, params.Radius, params.GridWith)
}
return retVal, "", err
})
}