- cms store management.

This commit is contained in:
gazebo
2018-09-03 18:28:37 +08:00
parent 426fe7c570
commit 70d5ae5dd1
17 changed files with 1522 additions and 628 deletions

View File

@@ -15,7 +15,7 @@ type StoreController struct {
// @Title 得到地点(省,城市,区)信息
// @Description parentCode与vendorID必传入一个vendorID的意思是得到所有与这个厂商相关的城市列表
// @Param token header string true "认证toke"
// @Param token header string true "认证token"
// @Param parentCode query int false "上级地点code。地点级别省为1市为2区为3缺省为市"
// @Param vendorID query int false "得到所有与这个厂商相关的省与城市列表"
// @Param includeDisabled query bool false "是否包括禁用的城市"
@@ -37,7 +37,7 @@ func (c *StoreController) GetPlaces() {
// @Title 修改地点信息
// @Description 只支持修改enabled, jd_code和mtps_price这三个属性
// @Param token header string true "认证toke"
// @Param token header string true "认证token"
// @Param payload formData string true "json数据place对象数组"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
@@ -50,3 +50,97 @@ func (c *StoreController) UpdatePlaces() {
return nil, "", err
})
}
// @Title 得到京西门店信息
// @Description 得到京西门店信息,如下条件之间是与的关系
// @Param token header string true "认证token"
// @Param id query int false "门店ID"
// @Param name query string false "门店名称(不要求完全一致)"
// @Param placeID query int false "所属地点ID"
// @Param placeLevel query int false "所属地点级别"
// @Param address query string false "门店地址"
// @Param tel query string false "电话"
// @Param fromStatus query int false "起始状态"
// @Param toStatus query int false "结束状态"
// @Param offset query int false "门店列表起始序号以0开始缺省为0"
// @Param pageSize query int false "门店列表页大小缺省为50"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStores [get]
func (c *StoreController) GetStores() {
c.callGetStores(func(params *tStoreGetStoresParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetStores(params.MapData, params.Offset, params.PageSize)
return retVal, "", err
})
}
// @Title 查询京西门店信息
// @Description 查询京西门店信息,根据关键字查询门店,如果关键字可以转换成数字,还会尝试数值相关的信息
// @Param token header string true "认证token"
// @Param keyword query string true "查询关键字"
// @Param fromStatus query int false "起始状态(缺省为营业中状态)"
// @Param toStatus query int false "结束状态"
// @Param offset query int false "门店列表起始序号以0开始缺省为0"
// @Param pageSize query int false "门店列表页大小缺省为50"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /SearchStores [get]
func (c *StoreController) SearchStores() {
c.callSearchStores(func(params *tStoreSearchStoresParams) (retVal interface{}, errCode string, err error) {
if params.MapData["fromStatus"] == nil {
params.FromStatus = 1
}
if params.MapData["toStatus"] == nil {
params.ToStatus = params.FromStatus
}
retVal, err = cms.SearchStores(params.Keyword, params.FromStatus, params.ToStatus, params.Offset, params.PageSize)
return retVal, "", err
})
}
// @Title 远程查询厂商门店信息
// @Description 远程查询厂商门店信息这个是实时调用API远程查询
// @Param token header string true "认证token"
// @Param vendorStoreID query string true "门店ID"
// @Param vendorID query int true "门店所属的厂商ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetVendorStore [get]
func (c *StoreController) GetVendorStore() {
c.callGetVendorStore(func(params *tStoreGetVendorStoreParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetVendorStore(params.VendorStoreID, params.VendorID)
return retVal, "", err
})
}
// @Title 修改门店信息
// @Description 修改门店信息
// @Param token header string true "认证token"
// @Param payload formData string true "json数据store对象"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateStore [put]
func (c *StoreController) UpdateStore() {
c.callUpdateStore(func(params *tStoreUpdateStoreParams) (retVal interface{}, errCode string, err error) {
store := make(map[string]interface{})
utils.UnmarshalUseNumber([]byte(params.Payload), &store)
err = cms.UpdateStore(store, GetUserNameFromToken(params.Token))
return nil, "", err
})
}
// @Title 创建京西门店
// @Description 创建京西门店
// @Param token header string true "认证token"
// @Param payload formData string true "json数据store对象"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /CreateStore [post]
func (c *StoreController) CreateStore() {
c.callCreateStore(func(params *tStoreCreateStoreParams) (retVal interface{}, errCode string, err error) {
store := &model.Store{}
utils.UnmarshalUseNumber([]byte(params.Payload), store)
retVal, err = cms.CreateStore(store, GetUserNameFromToken(params.Token))
return retVal, "", err
})
}