package controllers import ( "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" ) type StoreController struct { beego.Controller } // @Title 得到京西门店信息 // @Description 得到京西门店信息,如下条件之间是与的关系 // @Param token header string true "认证token" // @Param keyword query string false "查询关键字(可以为空,为空表示不限制)" // @Param storeID 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 statuss query string false "门店状态列表[-1,0,1],(-1:禁用;0:休息,关店;1:正常开店),缺省不限制" // @Param vendorStoreCond query string false "查询关联门店的条件(如果此字段没有设置,vendorStoreConds无效),and:与,or:或,指的是vendorStoreConds里的条件间的关系,这组条件与其它条件都是与的关系" // @Param vendorStoreConds query string false "为厂商条件对象{vendorID: cond},注意vendorID是字符串形式,cond,-1:没有关联,0:不限定,1:有关联,缺省为0" // @Param courierStoreCond query string false "查询关联门店的条件(如果此字段没有设置,courierStoreConds无效),and:与,or:或,指的是courierStoreConds里的条件间的关系,这组条件与其它条件都是与的关系" // @Param courierStoreConds query string false "为厂商条件对象{vendorID: cond},注意vendorID是字符串形式,cond,-1:没有关联,0:不限定,1:有关联,缺省为0" // @Param mapLongitude query string false "地图中心经度" // @Param mapLatitude query string false "地图中心纬度" // @Param mapRadius query int false "地图半径(单位为米)" // @Param offset query int false "门店列表起始序号(以0开始,缺省为0)" // @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)" // @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.Ctx, params.Keyword, params.MapData, 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.Ctx, params.VendorStoreID, params.VendorID) return retVal, "", err }) } // @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 // @router /UpdateStore [put] func (c *StoreController) UpdateStore() { c.callUpdateStore(func(params *tStoreUpdateStoreParams) (retVal interface{}, errCode string, err error) { store := make(map[string]interface{}) if err = utils.UnmarshalUseNumber([]byte(params.Payload), &store); err == nil { retVal, err = cms.UpdateStore(params.Ctx, params.StoreID, store, params.Ctx.GetUserName()) } return retVal, "", err }) } // @Title 删除京西门店 // @Description 删除京西门店 // @Param token header string true "认证token" // @Param storeID query int true "门店ID" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /DeleteStore [delete] func (c *StoreController) DeleteStore() { c.callDeleteStore(func(params *tStoreDeleteStoreParams) (retVal interface{}, errCode string, err error) { retVal, err = cms.DeleteStore(params.Ctx, params.StoreID) 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 /CreateStore [post] func (c *StoreController) CreateStore() { c.callCreateStore(func(params *tStoreCreateStoreParams) (retVal interface{}, errCode string, err error) { store := &cms.StoreExt{} if err = utils.UnmarshalUseNumber([]byte(params.Payload), store); err == nil { retVal, err = cms.CreateStore(params.Ctx, store, params.Ctx.GetUserName()) } 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 /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) { if c.GetString("vendorID") == "" { params.VendorID = -1 } retVal, err = cms.GetStoreVendorMaps(params.Ctx, nil, params.StoreID, params.VendorID) return retVal, "", err }) } // @Title 修改门店映射信息 // @Description 修改门店映射信息 // @Param token header string true "认证token" // @Param storeID query int true "门店ID" // @Param vendorID query int true "厂商ID" // @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) { var storeMap map[string]interface{} var storeMapStruct model.StoreMap if storeMap, err = utils.Unmarshal2Map([]byte(params.Payload), &storeMapStruct); err == nil { retVal, err = cms.UpdateStoreVendorMap(params.Ctx, nil, params.StoreID, params.VendorID, storeMap, params.Ctx.GetUserName()) } return retVal, "", err }) } // @Title 新增门店映射信息 // @Description 新增门店映射信息 // @Param token header string true "认证token" // @Param storeID formData int true "门店ID,payload中的相应字段会被忽略" // @Param vendorID formData int true "厂商ID,payload中的相应字段会被忽略" // @Param payload formData string true "json数据,storeMap对象({'vendorStoreID':'11732425','autoPickup':1,'deliveryCompetition':1, 'pricePercentage':100})" // @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(params.Ctx, nil, params.StoreID, params.VendorID, storeMap, params.Ctx.GetUserName()) } 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(params.Ctx, nil, params.StoreID, params.VendorID, params.Ctx.GetUserName()) return retVal, "", err }) } // @Title 得到门店差评总数 // @Description 得到门店差评总数,此函数为兼容老系统,之后会被替换 // @Param token header string true "认证token" // @Param jxStoreId query int true "门店ID" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /TmpGetJxBadCommentsNo [get] func (c *StoreController) TmpGetJxBadCommentsNo() { c.callTmpGetJxBadCommentsNo(func(params *tStoreTmpGetJxBadCommentsNoParams) (retVal interface{}, errCode string, err error) { retVal, err = cms.TmpGetJxBadCommentsNo(params.Ctx, params.JxStoreId) return retVal, "", err }) } // @Title 得到门店差评总数 // @Description 得到门店差评总数 // @Param token header string true "认证token" // @Param jxStoreId query int true "门店ID" // @Param type query int true "评论类型,0:差评,1:所有" // @Param page query int true "起始页,从1开始" // @Param size query int true "页大小" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /TmpGetJxBadCommentsByStoreId [get] func (c *StoreController) TmpGetJxBadCommentsByStoreId() { c.callTmpGetJxBadCommentsByStoreId(func(params *tStoreTmpGetJxBadCommentsByStoreIdParams) (retVal interface{}, errCode string, err error) { retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, params.JxStoreId, params.Page, params.Size, params.Type) return retVal, "", err }) } // @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 /GetStoreCourierMaps [get] func (c *StoreController) GetStoreCourierMaps() { c.callGetStoreCourierMaps(func(params *tStoreGetStoreCourierMapsParams) (retVal interface{}, errCode string, err error) { if c.GetString("vendorID") == "" { params.VendorID = -1 } retVal, err = cms.GetStoreCourierMaps(params.Ctx, nil, params.StoreID, params.VendorID) 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数据,StoreCourierMap对象(当前只有status, vendorStoreId两项)" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /UpdateStoreCourierMap [put] func (c *StoreController) UpdateStoreCourierMap() { c.callUpdateStoreCourierMap(func(params *tStoreUpdateStoreCourierMapParams) (retVal interface{}, errCode string, err error) { storeCourierMap := make(map[string]interface{}) if err = utils.UnmarshalUseNumber([]byte(params.Payload), &storeCourierMap); err == nil { retVal, err = cms.UpdateStoreCourierMap(params.Ctx, nil, params.StoreID, params.VendorID, storeCourierMap, params.Ctx.GetUserName()) } return retVal, "", err }) } // @Title 新增门店快递映射信息 // @Description 新增门店快递映射信息 // @Param token header string true "认证token" // @Param storeID formData int true "门店ID,payload中的相应字段会被忽略" // @Param vendorID formData int true "快递厂商ID,payload中的相应字段会被忽略" // @Param payload formData string true "json数据,StoreCourierMap对象(当前只有status, vendorStoreId两项)" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /AddStoreCourierMap [post] func (c *StoreController) AddStoreCourierMap() { c.callAddStoreCourierMap(func(params *tStoreAddStoreCourierMapParams) (retVal interface{}, errCode string, err error) { storeCourierMap := &model.StoreCourierMap{} if err = utils.UnmarshalUseNumber([]byte(params.Payload), storeCourierMap); err == nil { retVal, err = cms.AddStoreCourierMap(params.Ctx, nil, params.StoreID, params.VendorID, storeCourierMap, params.Ctx.GetUserName()) } 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 /DeleteStoreCourierMap [delete] func (c *StoreController) DeleteStoreCourierMap() { c.callDeleteStoreCourierMap(func(params *tStoreDeleteStoreCourierMapParams) (retVal interface{}, errCode string, err error) { retVal, err = cms.DeleteStoreCourierMap(params.Ctx, nil, params.StoreID, params.VendorID, params.Ctx.GetUserName()) return retVal, "", err }) }