- store man almost ok.
This commit is contained in:
@@ -35,7 +35,7 @@ func (c *StoreController) GetPlaces() {
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 修改地点信息
|
||||
// @Title 批量修改地点信息
|
||||
// @Description 只支持修改enabled, jd_code和mtps_price这三个属性
|
||||
// @Param token header string true "认证token"
|
||||
// @Param payload formData string true "json数据,place对象数组"
|
||||
@@ -44,11 +44,29 @@ func (c *StoreController) GetPlaces() {
|
||||
// @router /UpdatePlaces [put]
|
||||
func (c *StoreController) UpdatePlaces() {
|
||||
c.callUpdatePlaces(func(params *tStoreUpdatePlacesParams) (retVal interface{}, errCode string, err error) {
|
||||
// placeList := []*model.Place{}
|
||||
placeList := make([]map[string]interface{}, 0)
|
||||
utils.UnmarshalUseNumber([]byte(params.Payload), &placeList)
|
||||
err = cms.UpdatePlaces(placeList, GetUserNameFromToken(params.Token))
|
||||
return nil, "", err
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
@@ -62,8 +80,12 @@ func (c *StoreController) UpdatePlaces() {
|
||||
// @Param placeLevel query int false "所属地点级别"
|
||||
// @Param address query string false "门店地址"
|
||||
// @Param tel query string false "电话"
|
||||
// @Param fromStatus query int false "起始状态(-1:禁用;0:休息,关店;1:正常开店)"
|
||||
// @Param toStatus query int false "结束状态(-1:禁用;0:休息,关店;1:正常开店)"
|
||||
// @Param fromStatus query int false "查询起始状态(-1:禁用;0:休息,关店;1:正常开店)"
|
||||
// @Param toStatus query int false "查询结束状态(-1:禁用;0:休息,关店;1:正常开店)"
|
||||
// @Param vendorStoreCond query string false "查询关联门店的条件,and:与,or:或,指的是jdCond,elmCond,ebaiCod这三个条件间的关系,这组条件与其它条件都是与的关系"
|
||||
// @Param jdCond query int false "京东关联条件,-1:没有关联,0:不限定,1:有关联,缺省为0"
|
||||
// @Param elmCond query int false "饿了么关联条件,-1:没有关联,0:不限定,1:有关联,缺省为0"
|
||||
// @Param ebaiCond query int false "饿百关联条件,-1:没有关联,0:不限定,1:有关联,缺省为0"
|
||||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||||
// @Param pageSize query int false "门店列表页大小(缺省为50)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
@@ -94,6 +116,7 @@ func (c *StoreController) GetVendorStore() {
|
||||
// @Title 修改门店信息
|
||||
// @Description 修改门店信息
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeID formData int true "京西门店编号,payload中的京西门店编号会被忽略"
|
||||
// @Param payload formData string true "json数据,store对象"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
@@ -101,9 +124,10 @@ func (c *StoreController) GetVendorStore() {
|
||||
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
|
||||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), &store); err == nil {
|
||||
retVal, err = cms.UpdateStore(params.StoreID, store, GetUserNameFromToken(params.Token))
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -117,8 +141,9 @@ func (c *StoreController) UpdateStore() {
|
||||
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))
|
||||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), store); err == nil {
|
||||
retVal, err = cms.CreateStore(store, GetUserNameFromToken(params.Token))
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
@@ -132,3 +157,69 @@ func (c *StoreController) CreateStore() {
|
||||
// @router /ZZZZZ [put]
|
||||
func (c *StoreController) ZZZZZ() {
|
||||
}
|
||||
|
||||
// @Title 得到门店映射信息
|
||||
// @Description 得到门店映射信息
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeID query int true "门店ID"
|
||||
// @Param vendorID query int false "厂商ID(缺省为全部)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetStoreVendorMaps [get]
|
||||
func (c *StoreController) GetStoreVendorMaps() {
|
||||
c.callGetStoreVendorMaps(func(params *tStoreGetStoreVendorMapsParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = cms.GetStoreVendorMaps(nil, params.StoreID)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 修改门店映射信息
|
||||
// @Description 修改门店映射信息
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeID query int true "门店ID,payload中的相应字段会被忽略"
|
||||
// @Param vendorID query int true "厂商ID,payload中的相应字段会被忽略"
|
||||
// @Param payload formData string true "json数据,storeMap对象"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /UpdateStoreVendorMap [put]
|
||||
func (c *StoreController) UpdateStoreVendorMap() {
|
||||
c.callUpdateStoreVendorMap(func(params *tStoreUpdateStoreVendorMapParams) (retVal interface{}, errCode string, err error) {
|
||||
storeMap := make(map[string]interface{})
|
||||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), &storeMap); err == nil {
|
||||
retVal, err = cms.UpdateStoreVendorMap(nil, params.StoreID, params.VendorID, storeMap, GetUserNameFromToken(params.Token))
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 新增门店映射信息
|
||||
// @Description 新增门店映射信息
|
||||
// @Param token header string true "认证token"
|
||||
// @Param payload formData string true "json数据,storeMap对象"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /AddStoreVendorMap [post]
|
||||
func (c *StoreController) AddStoreVendorMap() {
|
||||
c.callAddStoreVendorMap(func(params *tStoreAddStoreVendorMapParams) (retVal interface{}, errCode string, err error) {
|
||||
storeMap := &model.StoreMap{}
|
||||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), storeMap); err == nil {
|
||||
retVal, err = cms.AddStoreVendorMap(nil, storeMap, GetUserNameFromToken(params.Token))
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 删除门店映射信息
|
||||
// @Description 删除门店映射信息
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeID query int true "门店ID"
|
||||
// @Param vendorID query int true "厂商ID"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /DeleteStoreVendorMap [delete]
|
||||
func (c *StoreController) DeleteStoreVendorMap() {
|
||||
c.callDeleteStoreVendorMap(func(params *tStoreDeleteStoreVendorMapParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = cms.DeleteStoreVendorMap(nil, params.StoreID, params.VendorID, GetUserNameFromToken(params.Token))
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user