62 lines
2.9 KiB
Go
62 lines
2.9 KiB
Go
package controllers
|
||
|
||
import (
|
||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||
"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 "区域半径(市或街道的半径会自动增加或缩小),单位为米,缺省5000米"
|
||
// @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
|
||
})
|
||
}
|
||
|
||
// @Title 同步商家商品信息
|
||
// @Description 同步商家商品信息
|
||
// @Param token header string true "认证token"
|
||
// @Param offset query int false "列表起始序号(以0开始,缺省为0)"
|
||
// @Param pageSize query int false "列表页大小(缺省为50,-1表示全部)"
|
||
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
||
// @Param vendorStoreID query string false "门店号"
|
||
// @Param vendorID query int false "平台ID"
|
||
// @Param orgCode query string false "连锁品牌名"
|
||
// @Param cityCode query int false "城市代码"
|
||
// @Param districtCode query int false "行政区代码"
|
||
// @Param tel query string false "手机号"
|
||
// @Param minShopScore query float64 false "门店分值最小值"
|
||
// @Param minRecentOrderNum query int false "最近单量最小值"
|
||
// @Param minSkuCount query int false "SKU数量最小值"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /QueryPageStores [get]
|
||
func (c *NetSpiderController) QueryPageStores() {
|
||
c.callQueryPageStores(func(params *tNetspiderQueryPageStoresParams) (retVal interface{}, errCode string, err error) {
|
||
if params.MapData["vendorID"] == nil {
|
||
params.VendorID = -1
|
||
}
|
||
retVal, err = dao.QueryPageStores(dao.GetDB(), params.PageSize, params.Offset, params.Keyword, params.VendorStoreID, params.VendorID, params.OrgCode, params.CityCode, params.DistrictCode, params.Tel, float32(params.MinShopScore), params.MinRecentOrderNum, params.MinSkuCount)
|
||
return retVal, "", err
|
||
})
|
||
}
|