From 72ced211e9c688ea2e2ce6849bd8751d3134d502 Mon Sep 17 00:00:00 2001 From: gazebo Date: Tue, 18 Sep 2018 08:52:17 +0800 Subject: [PATCH] - move place man from store to cms. --- controllers/cms.go | 51 ++++++++++++++++++++++++++++++++++++++++ controllers/cms_store.go | 50 --------------------------------------- 2 files changed, 51 insertions(+), 50 deletions(-) diff --git a/controllers/cms.go b/controllers/cms.go index aef3e8f47..a8e46b9cd 100644 --- a/controllers/cms.go +++ b/controllers/cms.go @@ -1,6 +1,7 @@ package controllers import ( + "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxstore/cms" "github.com/astaxie/beego" ) @@ -9,6 +10,56 @@ type CmsController struct { beego.Controller } +// @Title 得到地点(省,城市,区)信息 +// @Description parentCode与vendorID必传入一个,vendorID的意思是得到所有与这个厂商相关的城市列表。地点级别:省为1,市为2,区为3,注意直辖市也要分省与市级 +// @Param token header string true "认证token" +// @Param parentCode query int true "上级地点code,这个指的是国家标准CODE(中国为:100000,北京为:110000,北京市为:110100),不是数据库中的ID" +// @Param includeDisabled query bool false "是否包括禁用的城市(缺省不包括)" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /GetPlaces [get] +func (c *CmsController) GetPlaces() { + c.callGetPlaces(func(params *tCmsGetPlacesParams) (retVal interface{}, errCode string, err error) { + retVal, err = cms.GetPlaces(params.ParentCode, params.IncludeDisabled) + return retVal, "", err + }) +} + +// @Title 批量修改地点信息 +// @Description 只支持修改enabled, jd_code和mtps_price这三个属性 +// @Param token header string true "认证token" +// @Param payload formData string true "json数据,place对象数组" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /UpdatePlaces [put] +func (c *CmsController) UpdatePlaces() { + c.callUpdatePlaces(func(params *tCmsUpdatePlacesParams) (retVal interface{}, errCode string, err error) { + placeList := make([]map[string]interface{}, 0) + if err = utils.UnmarshalUseNumber([]byte(params.Payload), &placeList); err == nil { + retVal, err = cms.UpdatePlaces(placeList, GetUserNameFromToken(params.Token)) + } + return retVal, "", err + }) +} + +// @Title 修改地点信息 +// @Description 只支持修改enabled, jd_code和mtps_price这三个属性 +// @Param token header string true "认证token" +// @Param code formData int true "地点编号,注意是code不是ID,payload中的code会被忽略" +// @Param payload formData string true "json数据,place对象" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /UpdatePlace [put] +func (c *CmsController) UpdatePlace() { + c.callUpdatePlace(func(params *tCmsUpdatePlaceParams) (retVal interface{}, errCode string, err error) { + place := make(map[string]interface{}, 0) + if err = utils.UnmarshalUseNumber([]byte(params.Payload), &place); err == nil { + retVal, err = cms.UpdatePlace(params.Code, place, GetUserNameFromToken(params.Token)) + } + return retVal, "", err + }) +} + // @Title 得到服务相关的一些基础信息 // @Description 得到服务相关的一些基础信息,包括版本,及一些元数据信息 // @Param token header string true "认证token" diff --git a/controllers/cms_store.go b/controllers/cms_store.go index d8e321f7a..b3f285e32 100644 --- a/controllers/cms_store.go +++ b/controllers/cms_store.go @@ -11,56 +11,6 @@ type StoreController struct { beego.Controller } -// @Title 得到地点(省,城市,区)信息 -// @Description parentCode与vendorID必传入一个,vendorID的意思是得到所有与这个厂商相关的城市列表。地点级别:省为1,市为2,区为3,注意直辖市也要分省与市级 -// @Param token header string true "认证token" -// @Param parentCode query int true "上级地点code,这个指的是国家标准CODE(中国为:100000,北京为:110000,北京市为:110100),不是数据库中的ID" -// @Param includeDisabled query bool false "是否包括禁用的城市(缺省不包括)" -// @Success 200 {object} controllers.CallResult -// @Failure 200 {object} controllers.CallResult -// @router /GetPlaces [get] -func (c *StoreController) GetPlaces() { - c.callGetPlaces(func(params *tStoreGetPlacesParams) (retVal interface{}, errCode string, err error) { - retVal, err = cms.GetPlaces(params.ParentCode, params.IncludeDisabled) - return retVal, "", err - }) -} - -// @Title 批量修改地点信息 -// @Description 只支持修改enabled, jd_code和mtps_price这三个属性 -// @Param token header string true "认证token" -// @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 := make([]map[string]interface{}, 0) - if err = utils.UnmarshalUseNumber([]byte(params.Payload), &placeList); err == nil { - retVal, err = cms.UpdatePlaces(placeList, GetUserNameFromToken(params.Token)) - } - return retVal, "", err - }) -} - -// @Title 修改地点信息 -// @Description 只支持修改enabled, jd_code和mtps_price这三个属性 -// @Param token header string true "认证token" -// @Param code formData int true "地点编号,注意是code不是ID,payload中的code会被忽略" -// @Param payload formData string true "json数据,place对象" -// @Success 200 {object} controllers.CallResult -// @Failure 200 {object} controllers.CallResult -// @router /UpdatePlace [put] -func (c *StoreController) UpdatePlace() { - c.callUpdatePlace(func(params *tStoreUpdatePlaceParams) (retVal interface{}, errCode string, err error) { - place := make(map[string]interface{}, 0) - if err = utils.UnmarshalUseNumber([]byte(params.Payload), &place); err == nil { - retVal, err = cms.UpdatePlace(params.Code, place, GetUserNameFromToken(params.Token)) - } - return retVal, "", err - }) -} - // @Title 得到京西门店信息 // @Description 得到京西门店信息,如下条件之间是与的关系 // @Param token header string true "认证token"