- cms place ok.
This commit is contained in:
@@ -3,7 +3,9 @@ package controllers
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
|
||||
@@ -19,16 +21,32 @@ type StoreController struct {
|
||||
// @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) {
|
||||
// @router /GetPlaces [get]
|
||||
func (c *StoreController) GetPlaces() {
|
||||
c.callGetPlaces(func(params *tStoreGetPlacesParams) (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)
|
||||
retVal, err = cms.GetPlaces(params.ParentCode, params.VendorID, params.IncludeDisabled)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 修改地点信息
|
||||
// @Description 只支持修改enabled, jd_code和mtps_price这三个属性
|
||||
// @Param token header string true "认证toke"
|
||||
// @Param payload formData string true "json数据,place对象数组"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /UpdatePlaces [put]
|
||||
func (c *StoreController) UpdatePlaces() {
|
||||
c.callUpdatePlaces(func(params *tStoreUpdatePlacesParams) (retVal interface{}, errCode string, err error) {
|
||||
placeList := []*model.Place{}
|
||||
utils.UnmarshalUseNumber([]byte(params.Payload), &placeList)
|
||||
err = cms.UpdatePlaces(placeList, GetUserNameFromToken(params.Token))
|
||||
return nil, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user