- basic cms structure.
This commit is contained in:
34
controllers/cms_store.go
Normal file
34
controllers/cms_store.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
|
||||
type StoreController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// @Title 得到地点(省,城市,区)信息
|
||||
// @Description parentCode与vendorID必传入一个,vendorID的意思是得到所有与这个厂商相关的城市列表
|
||||
// @Param token header string true "认证toke"
|
||||
// @Param parentCode query int false "上级地点code。地点级别:省为1,市为2,区为3,缺省为市"
|
||||
// @Param vendorID query int false "得到所有与这个厂商相关的省与城市列表"
|
||||
// @Param includeDisabled query bool false "是否包括禁用的城市"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetCities [get]
|
||||
func (c *StoreController) GetCities() {
|
||||
c.callGetCities(func(params *tStoreGetCitiesParams) (retVal interface{}, errCode string, err error) {
|
||||
if c.GetString("vendorID") == "" {
|
||||
params.VendorID = -1 // -1表示没有指定,因为0表示京东到家
|
||||
}
|
||||
if params.VendorID == -1 && params.ParentCode == 0 {
|
||||
return nil, "", errors.New("parentCode与vendorID至少要指定一个")
|
||||
}
|
||||
retVal, err = cms.GetCities(params.ParentCode, params.VendorID, params.IncludeDisabled)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user