package controllers

import (
	"bytes"
	"encoding/json"
	"errors"
	"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
	"git.rosy.net.cn/jx-callback/business/authz/autils"
	"git.rosy.net.cn/jx-callback/business/model/dao"
	"git.rosy.net.cn/jx-callback/business/partner"
	"git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm"
	"strings"

	"git.rosy.net.cn/jx-callback/business/partner/purchase/tao_vegetable"

	"git.rosy.net.cn/baseapi/utils"
	"git.rosy.net.cn/jx-callback/business/jxstore/cms"
	"git.rosy.net.cn/jx-callback/business/jxstore/common"
	"git.rosy.net.cn/jx-callback/business/jxstore/misc"
	"git.rosy.net.cn/jx-callback/business/jxstore/secretNumber"
	"git.rosy.net.cn/jx-callback/business/jxutils"
	"git.rosy.net.cn/jx-callback/business/jxutils/netprinter"
	"git.rosy.net.cn/jx-callback/business/model"
	"git.rosy.net.cn/jx-callback/business/partner/purchase/tiktok_store"
	"git.rosy.net.cn/jx-callback/globals/api"
	"github.com/astaxie/beego/server/web"
)

type StoreController struct {
	web.Controller
}

// @Title 得到京西门店信息
// @Description 得到京西门店信息，如下条件之间是与的关系
// @Param	token			header		string	false	"认证token"
// @Param	keyword			query		string	false	"查询关键字（可以为空，为空表示不限制）"
// @Param	storeID			query		int		false	"门店ID"
// @Param	startStoreID	query		int		false	"起始门店ID"
// @Param	coordinateType	query		int		false	"返回坐标类型，0：火星坐标，1：百度，缺省0"
// @Param	storeIDs		query		string	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，其它值表示vendorOrgCode"
// @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	orderTimeFrom		query	string		false	"订单创建起始时间"
// @Param	orderTimeTo			query	string		false	"订单创建结束时间"
// @Param	orderCountFrom		query	int			false	"订单量起始"
// @Param	orderCountTo		query	int			false	"订单量结束"
// @Param	marketManPhone		query	string		false	"市场负责人电话"
// @Param	briefLevel			query	int			false	"返回信息精简模式"
// @Param	storeLevels			query	string		false	"门店等级"
// @Param	brandID				query	int			false	"品牌ID"
// @Param	marketManPhones  	query	string		false	"市场负责人电话们"
// @Param	jdPhone			  	query	string		false	"京东运营负责人电话"
// @Param	mtPhone			  	query	string		false	"美团运营负责人电话"
// @Param	ebaiPhone		  	query	string		false	"饿百运营负责人电话"
// @Param	earningType 		query	int			false	"结算方式（1为报价，2为扣点）"
// @Param	isBussinessStatus 	query	bool		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,post]
func (c *StoreController) GetStores() {
	c.callGetStores(func(params *tStoreGetStoresParams) (retVal interface{}, errCode string, err error) {
		timeList, err := jxutils.BatchStr2Time(params.OrderTimeFrom, params.OrderTimeTo)
		if err != nil {
			return nil, "", err
		}
		retVal, err = cms.GetStores(params.Ctx, params.Keyword, params.MapData, params.Offset, params.PageSize, timeList[0], timeList[1], params.OrderCountFrom, params.OrderCountTo)
		return retVal, "", err
	})
}

// @Title 远程查询厂商门店信息
// @Description 远程查询厂商门店信息，这个是实时调用API远程查询
// @Param	token			header		string	true	"认证token"
// @Param	vendorStoreID	query		string	true	"门店ID"
// @Param	vendorID		query		int		true	"门店所属的厂商ID"
// @Param	vendorOrgCode	query		string	false	"厂商内组织代码"
// @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.VendorID, params.VendorOrgCode, params.VendorStoreID)
		return retVal, "", err
	})
}

// @Title 查询远程平台可以金额
// @Description 查询远程平台可以金额
// @Param	token			header		string	true	"认证token"
// @Param	vendorID		query		int		true	"门店所属的厂商ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /QueryPlatformBalance [get]
func (c *StoreController) QueryPlatformBalance() {
	c.callQueryPlatformBalance(func(params *tStoreQueryPlatformBalanceParams) (retVal interface{}, errCode string, err error) {
		retVal, err = cms.QueryPlatformBalance(params.VendorID)
		return retVal, "", err

	})
}

// @Title 远程平台充值
// @Description 远程平台充值
// @Param	token			header		string	true	"认证token"
// @Param	vendorID		query		int		true	"门店所属的厂商ID"
// @Param	amount			query		int		true	"充值金额分"
// @Param	category		query		string	true	"链接场景[PC,H5]"
// @Param	notifyUrl		query		string	false	"成功跳转链接(支付宝有,微信没有)"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /BalanceRecharge [post]
func (c *StoreController) BalanceRecharge() {
	c.callBalanceRecharge(func(params *tStoreBalanceRechargeParams) (retVal interface{}, errCode string, err error) {
		retVal, err = cms.BalanceRecharge(params.VendorID, &utils.RechargeBalance{
			Amount:    float64(params.Amount) / 100,
			Category:  params.Category,
			NotifyUrl: params.NotifyUrl,
		})
		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) {
		payload := make(map[string]interface{})
		if err = utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err == nil {
			retVal, err = cms.UpdateStore(params.Ctx, params.StoreID, payload, params.Ctx.GetUserName())
		}
		return retVal, "", err
	})
}

// @Title 获取门店违约金详情
// @Description 获取门店违约金详情
// @Param	token			header	string	true	"认证token"
// @Param	storeIDs		query	string	false	"京西门店ID列表[1,2,3]，缺省不限制"
// @Param	fromTime		query	string	true	"起始时间"
// @Param	toTime			query	string	true	"结束时间"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStoreFineDesc [get]
func (c *StoreController) GetStoreFineDesc() {
	c.callGetStoreFineDesc(func(params *tStoreGetStoreFineDescParams) (retVal interface{}, errCode string, err error) {
		timeList, err := jxutils.BatchStr2Time(params.FromTime, params.ToTime)
		if err == nil {
			var storeIDList []int
			if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
				retVal, err = dao.StatisticsFineFee(dao.GetDB(), timeList[0], timeList[1], storeIDList)
			}
		}
		return retVal, "", err
	})
}

// @Title 统计门店订单结算以及京西收益,与美团订单对比
// @Description 统计门店订单结算以及京西收益,与美团订单对比
// @Param	token			header	string	true	"认证token"
// @Param	storeIDs		query	string	false	"京西门店ID列表[1,2,3]，缺省不限制"
// @Param	vendorIds		query	string	false	"京西门店ID列表[1,2,3]，缺省不限制"
// @Param	start			query	string	true	"起始时间1970-01-01 00:00:00"
// @Param	end				query	string	true	"结束时间1970-01-01 23:59:59"
// @Param	size			query	int		true	"每页最大数"
// @Param	offset			query	int		true	"跳过数量"
// @Param	ranke			query	string	false	"排序字段 order_count,desc"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStoreSettlementInfo [get]
func (c *StoreController) GetStoreSettlementInfo() {
	c.callGetStoreSettlementInfo(func(params *tStoreGetStoreSettlementInfoParams) (retVal interface{}, errCode string, err error) {
		timeList, err := jxutils.BatchStr2Time(params.Start, params.End)
		if err != nil {
			return nil, "", err
		}
		var storeIDList []int
		var vendorIdList []int
		if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList, params.VendorIds, &vendorIdList); err != nil {
			return nil, "", err
		}
		retVal, err = cms.GetStoreSettlementList(storeIDList, timeList[0], timeList[1], vendorIdList, params.Size, params.Offset, params.Ranke)
		return
	})
}

// @Title 根据城市code统计京西收益
// @Description 根据城市code统计京西收益
// @Param	token			header	string	true	"认证token"
// @Param	cityCode		query	string	false	"京西门店城市列表["1","2","3"]，缺省不限制"
// @Param	vendorIds		query	string	false	"京西门店ID列表[1,2,3]，缺省不限制"
// @Param	start			query	string	true	"起始时间1970-01-01 00:00:00"
// @Param	end				query	string	true	"结束时间1970-01-01 23:59:59"
// @Param	size			query	int		true	"每页最大数"
// @Param	offset			query	int		true	"跳过数量"
// @Param	ranke			query	string	false	"排序字段 order_count,desc"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetCitySettlementInfo [get]
func (c *StoreController) GetCitySettlementInfo() {
	c.callGetCitySettlementInfo(func(params *tStoreGetCitySettlementInfoParams) (retVal interface{}, errCode string, err error) {
		timeList, err := jxutils.BatchStr2Time(params.Start, params.End)
		if err != nil {
			return nil, "", err
		}
		var cityList []string
		var vendorIdList []int
		if err = jxutils.Strings2Objs(params.CityCode, &cityList, params.VendorIds, &vendorIdList); err != nil {
			return nil, "", err
		}
		retVal, err = cms.GetCityCodeSettlementList(cityList, timeList[0], timeList[1], vendorIdList, params.Size, params.Offset, params.Ranke)
		return
	})
}

// @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	isAsync			formData	bool	true	"是否异步操作"
// @Param	isContinueWhenError	formData	bool	false	"单个同步失败是否继续，缺省false"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /EnableHaveRestStores [put]
func (c *StoreController) EnableHaveRestStores() {
	c.callEnableHaveRestStores(func(params *tStoreEnableHaveRestStoresParams) (retVal interface{}, errCode string, err error) {
		retVal, err = cms.EnableHaveRestStores(params.Ctx, params.IsAsync, params.IsContinueWhenError)
		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())
			// 将创建门店用户添加到管理组
			if retVal != 0 {
				cms.AddUsers4Role(params.Ctx, autils.NewRole("StoreBoss", retVal.(int)), []string{params.Ctx.GetUserID()})
			}
		}
		return retVal, "", err
	})
}

// @Title 打印机授权创建京西门店(除门店名称和登录授权电话真实有效其他使用默认值)
// @Description 打印机授权创建京西门店
// @Param	payload			formData	string	true	"json数据，store对象"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /CreateStore2Print [post]
func (c *StoreController) CreateStore2Print() {
	c.callCreateStore2Print(func(params *tStoreCreateStore2PrintParams) (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	mobile			formData	string	true	"电话"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /CreateStoreByUser [post]
func (c *StoreController) CreateStoreByUser() {
	c.callCreateStoreByUser(func(params *tStoreCreateStoreByUserParams) (retVal interface{}, errCode string, err error) {
		retVal, err = cms.CreateStoreByUser(params.Ctx, params.Mobile)
		return retVal, "", err
	})
}

// @Title 得到门店映射信息
// @Description 得到门店映射信息
// @Param	token			header		string	false	"认证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) {
		payload := make(map[string]interface{})
		if err = utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err == nil {
			retVal, err = cms.UpdateStoreVendorMap(params.Ctx, nil, params.StoreID, params.VendorID, payload, 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	vendorOrgCode	formData	string	false	"厂商内组织代码"
// @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.VendorID, params.VendorOrgCode, params.StoreID, storeMap, true)
		}
		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	"页大小（-1表示无限大）"
// @Param	fromTime		query		string	false	"创建起始时间"
// @Param	toTime			query		string	false	"创建结束时间"
// @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) {
		timeList, err2 := jxutils.BatchStr2Time(params.FromTime, params.ToTime)
		if err = err2; err == nil {
			pageSize := jxutils.FormalizePageSize(params.Size)
			offset := (params.Page - 1) * pageSize
			retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, "", []int{params.JxStoreId}, offset, pageSize, params.Type, timeList[0], timeList[1], "", "")
		}
		return retVal, "", err
	})
}

// @Title 得到门店评价列表（多店）
// @Description 得到门店评价列表（多店）
// @Param	token			header		string	true	"认证token"
// @Param	type			query		int		true	"评论类型，0：差评，1：所有，2：已解决"
// @Param	keyword			query		string	false	"关键字"
// @Param	storeIDs		query		string	false	"门店Id列表"
// @Param	fromTime		query		string	false	"创建起始时间"
// @Param	toTime			query		string	false	"创建结束时间"
// @Param	orderFlag		query		string	false	"订单平台[0,1,2]"
// @Param	operatorPhone	query		string	false	"负责人电话"
// @Param	offset			query		int		false	"起始页，从1开始"
// @Param	pageSize		query		int		false	"页大小（-1表示无限大）"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpGetJxBadComments [get]
func (c *StoreController) TmpGetJxBadComments() {
	c.callTmpGetJxBadComments(func(params *tStoreTmpGetJxBadCommentsParams) (retVal interface{}, errCode string, err error) {
		var storeIDs []int
		if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
			timeList, err2 := jxutils.BatchStr2Time(params.FromTime, params.ToTime)
			if err = err2; err == nil {
				retVal, err = cms.TmpGetJxBadCommentsByStoreId(params.Ctx, params.Keyword, storeIDs, params.Offset, params.PageSize, params.Type, timeList[0], timeList[1], params.OrderFlag, params.OperatorPhone)
			}
		}
		return retVal, "", err
	})
}

// @Title 根据cookie获取美团差评订单id（多店）不一定准确
// @Description 根据cookie获取美团差评订单id（多店）
// @Param	vendorID		query		int		false	"厂商ID（缺省为全部）"
// @Param	userName		query		string	true	"平台账号id"
// @Param	appOrgCode		query		string	true	"平台号"
// @Param	fromTime		query		string	true	"创建起始时间"
// @Param	toTime			query		string	true	"创建结束时间"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetOrderID4Comment [get]
func (c *StoreController) GetOrderID4Comment() {
	c.callGetOrderID4Comment(func(params *tStoreGetOrderID4CommentParams) (retVal interface{}, errCode string, err error) {
		err = mtwm.GetMtwmCommentList4ShanGou(params.UserName, params.AppOrgCode, params.FromTime, params.ToTime)
		return nil, "", 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			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 /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)
		}
		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
	})
}

// @Title 自动创建或更新快递门店
// @Description 自动创建或更新快递门店
// @Param	token			header		string	true	"认证token"
// @Param	storeID			formData		int		false	"门店ID"
// @Param	isForceUpdate	formData		bool	false	"是否强制更新"
// @Param	isAsync			formData		bool	false	"是否异步操作"
// @Param	isContinueWhenError	formData	bool	false	"单个同步失败是否继续，缺省false"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateOrCreateCourierStores [put]
func (c *StoreController) UpdateOrCreateCourierStores() {
	c.callUpdateOrCreateCourierStores(func(params *tStoreUpdateOrCreateCourierStoresParams) (retVal interface{}, errCode string, err error) {
		retVal, err = cms.UpdateOrCreateCourierStores(params.Ctx, params.StoreID, params.IsForceUpdate, params.IsAsync, params.IsContinueWhenError)
		return retVal, "", err
	})
}

// @Title 导出门店健康度信息
// @Description 导出门店健康度信息
// @Param	token			header		string	true	"认证token"
// @Param	vendorIDs		query		string		false	"平台ID列表"
// @Param	storeIDs		query		string		false	"门店ID列表"
// @Param	isAsync			query		bool		false	"是否异步操作"
// @Param	isContinueWhenError	query	bool	false	"单个同步失败是否继续，缺省false"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /ExportShopsHealthInfo [get]
func (c *StoreController) ExportShopsHealthInfo() {
	c.callExportShopsHealthInfo(func(params *tStoreExportShopsHealthInfoParams) (retVal interface{}, errCode string, err error) {
		var vendorIDList, storeIDList []int
		if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDList, params.StoreIDs, &storeIDList); err == nil {
			retVal, err = cms.ExportShopsHealthInfo(params.Ctx, vendorIDList, storeIDList, params.IsAsync, params.IsContinueWhenError)
		}
		return retVal, "", err
	})
}

// @Title 得到工商执照企业信息
// @Description 得到工商执照企业信息
// @Param	token			header		string	true	"认证token"
// @Param	licenceCode		query		string	true	"营业执照号"
// @Param	licenceImg		query		string	true	"营业执图片"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetCorporationInfo [get]
func (c *StoreController) GetCorporationInfo() {
	c.callGetCorporationInfo(func(params *tStoreGetCorporationInfoParams) (retVal interface{}, errCode string, err error) {
		retVal, err = cms.GetCorporationInfo(params.Ctx, params.LicenceCode, params.LicenceImg)
		return retVal, "", err
	})
}

// @Title 门店绑定打印
// @Description 门店绑定打印
// @Param	token			header		string	true	"认证token"
// @Param	storeID			formData	int		true	"京西门店ID"
// @Param	data			formData	string	true	"原始数据"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /BindPrinter [post]
func (c *StoreController) BindPrinter() {
	c.callBindPrinter(func(params *tStoreBindPrinterParams) (retVal interface{}, errCode string, err error) {
		retVal, err = netprinter.BindPrinter(params.Ctx, params.StoreID, params.Data)
		return retVal, "", err
	})
}

// @Title 同步门店资质信息至平台（当前只支持京东）
// @Description 同步门店资质信息至平台（当前只支持京东）
// @Param	token			header		string	true	"认证token"
// @Param	storeIDs		formData	string	true	"京西门店ID列表，必须非空值"
// @Param	vendorID		formData	int		true	"平台ID"
// @Param	isAsync			formData	bool	true	"是否异步操作"
// @Param	isContinueWhenError	formData	bool	false	"单个同步失败是否继续，缺省false"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /SyncStoresQualify [post]
func (c *StoreController) SyncStoresQualify() {
	c.callSyncStoresQualify(func(params *tStoreSyncStoresQualifyParams) (retVal interface{}, errCode string, err error) {
		var storeIDs []int
		err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs)
		if err == nil {
			retVal, err = cms.SyncStoresQualify(params.Ctx, storeIDs, params.VendorID, params.IsAsync, params.IsContinueWhenError)
		}
		return retVal, "", err
	})
}

// @Title 门店评分
// @Description 门店评分
// @Param	token			header		string	true	"认证token"
// @Param	storeIDs		formData	string	false	"京西门店ID列表"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /ScoreStore [post]
func (c *StoreController) ScoreStore() {
	c.callScoreStore(func(params *tStoreScoreStoreParams) (retVal interface{}, errCode string, err error) {
		var storeIDList []int
		if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
			misc.ScoreStore(params.Ctx, storeIDList)
		}

		return retVal, "", err
	})
}

// @Title 得到门店近期周平均分数数据
// @Description 得到门店近期周平均分数数据
// @Param	token			header		string	true	"认证token"
// @Param	storeID			query		int		true	"京西门店ID"
// @Param	weekIndex		query		int		true	"周索引(起始索引为0, -1为所有周数据)"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetWeeklyStoreScore [get]
func (c *StoreController) GetWeeklyStoreScore() {
	c.callGetWeeklyStoreScore(func(params *tStoreGetWeeklyStoreScoreParams) (retVal interface{}, errCode string, err error) {
		retVal, err = misc.GetWeeklyStoreScore(params.StoreID, params.WeekIndex)
		return retVal, "", err
	})
}

// @Title 得到门店总分排名
// @Description 得到门店总分排名
// @Param	token				header		string	true	"认证token"
// @Param	storeIDs			formData	string	false	"京西门店ID列表"
// @Param	cityCode			formData	int		false	"城市编码"
// @Param	keyword				formData	string	false	"关键字"
// @Param	beginTime			formData	string	true	"开始日期"
// @Param	endTime				formData	string	true	"结束日期"
// @Param	isDesc				formData	bool	true	"是否降序"
// @Param	checkScoreLow		formData	int		false	"在某个分数范围-低"
// @Param	checkScoreHigh		formData	int		false	"在某个分数范围-高"
// @Param	offset				formData	int		false	"列表起始序号（以0开始，缺省为0）"
// @Param	pageSize			formData	int		false	"列表页大小（缺省为50，-1表示全部）"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStoreTotalScoreList [post]
func (c *StoreController) GetStoreTotalScoreList() {
	c.callGetStoreTotalScoreList(func(params *tStoreGetStoreTotalScoreListParams) (retVal interface{}, errCode string, err error) {
		timeList, err := jxutils.BatchStr2Time(params.BeginTime, params.EndTime)
		if err == nil {
			var storeIDList []int
			if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
				retVal, err = misc.GetStoreTotalScoreList(params.Ctx, storeIDList, params.CityCode, params.Keyword, timeList[0], timeList[1], params.IsDesc, params.CheckScoreLow, params.CheckScoreHigh, params.Offset, params.PageSize)
			}
		}
		return retVal, "", err
	})
}

// @Title 得到门店触犯红线/黄线数据
// @Description 得到门店触犯红线/黄线数据
// @Param	token				header		string	true	"认证token"
// @Param	storeIDs			formData	string	false	"京西门店ID列表"
// @Param	cityCode			formData	int		false	"城市编码"
// @Param	keyword				formData	string	false	"关键字"
// @Param	dateTime			formData	string	true	"统计日期"
// @Param	offset				formData	int		false	"列表起始序号（以0开始，缺省为0）"
// @Param	pageSize			formData	int		false	"列表页大小（缺省为50，-1表示全部）"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStoreAlertList [post]
func (c *StoreController) GetStoreAlertList() {
	c.callGetStoreAlertList(func(params *tStoreGetStoreAlertListParams) (retVal interface{}, errCode string, err error) {
		timeList, err := jxutils.BatchStr2Time(params.DateTime)
		if err == nil {
			var storeIDList []int
			if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
				retVal, err = misc.GetStoreAlertList(storeIDList, params.CityCode, params.Keyword, timeList[0], params.Offset, params.PageSize)
			}
		}
		return retVal, "", err
	})
}

// @Title 同步快递平台门店信息并报警
// @Description 同步快递平台门店信息并报警
// @Param	token				header		string	true	"认证token"
// @Param	storeIDs			formData	string	false	"京西门店ID列表，必须非空值"
// @Param	isAsync				formData	bool	false	"是否异步操作"
// @Param	isContinueWhenError	formData	bool	false	"单个同步失败是否继续，缺省false"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /SyncStoresCourierInfo [post]
func (c *StoreController) SyncStoresCourierInfo() {
	c.callSyncStoresCourierInfo(func(params *tStoreSyncStoresCourierInfoParams) (retVal interface{}, errCode string, err error) {
		var storeIDs []int
		if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
			retVal, err = cms.SyncStoresCourierInfo(params.Ctx, storeIDs, params.IsAsync, params.IsContinueWhenError)
		}
		return retVal, "", err
	})
}

// @Title 根据位置得到推荐门店列表
// @Description 根据位置得到推荐门店列表
// @Param	lng				query		float64	true	"经度"
// @Param	lat				query		float64	true	"纬度"
// @Param	needWalkDistance	query	bool	false	"是否需要返回步行距离（且以步行距离排序）"
// @Param	brandID				query	int		false	"品牌ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStoreListByLocation [get]
func (c *StoreController) GetStoreListByLocation() {
	c.callGetStoreListByLocation(func(params *tStoreGetStoreListByLocationParams) (retVal interface{}, errCode string, err error) {
		locationList, err := common.GetStoreListByLocation(params.Ctx, params.Lng, params.Lat, 50000, params.NeedWalkDistance, false, []int{params.BrandID})
		//if params.Token != "" {
		result, _, err := cms.FilterByB2B(locationList)
		if err != nil {
			return nil, "", err
		} else {
			return result, "", err
		}
		//}
		//return locationList, "", err
	})
}

// @Title 根据位置得到首页商店详细信息
// @Description 根据位置得到首页商店详细信息
// @Param	lng					query		float64	true	"经度"
// @Param	lat					query		float64	true	"纬度"
// @Param	needWalkDistance	query		bool	false	"是否需要返回步行距离（且以步行距离排序）"
// @Param	brandID				query		string	false	"品牌ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetHomePageByLocation [get]
func (c *StoreController) GetHomePageByLocation() {
	c.callGetHomePageByLocation(func(params *tStoreGetHomePageByLocationParams) (retVal interface{}, code string, err error) {
		var brandIDs []int
		if err = jxutils.Strings2Objs(params.BrandID, &brandIDs); err != nil {
			return retVal, "", err
		}

		details, _, err := cms.GetHomePageByLocation(params.Ctx, params.Lng, params.Lat, params.NeedWalkDistance, brandIDs)
		if err != nil {
			return nil, "根据经纬度获取门店详细信息失败", err
		}
		return details, "", err
	})
}

// @Title 老格恢复拓店进度
// @Description 老格恢复拓店进度
// @Param	token			header		string	true	"认证token"
// @Param	vendorOrgCode	formData	string	false	"厂商内组织代码"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /JdStoreInfoCoordinateRecover [post]
func (c *StoreController) JdStoreInfoCoordinateRecover() {
	c.callJdStoreInfoCoordinateRecover(func(params *tStoreJdStoreInfoCoordinateRecoverParams) (retVal interface{}, errCode string, err error) {
		r := c.Ctx.Request
		files := r.MultipartForm.File["userfiles"]
		err = cms.JdStoreInfoCoordinateRecover(params.Ctx, params.VendorOrgCode, files)
		return retVal, "", err
	})
}

// @Title 导出平台门店信息
// @Description 导出平台门店信息
// @Param	token				header		string	true	"认证token"
// @Param	vendorIDs			formData	string	true	"平台ID列表"
// @Param	isAsync				formData	bool	false	"是否异步操作"
// @Param	isContinueWhenError	formData	bool	false	"单个同步失败是否继续，缺省false"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetVendorStoreInfo [post]
func (c *StoreController) GetVendorStoreInfo() {
	var vendorIDList []int
	c.callGetVendorStoreInfo(func(params *tStoreGetVendorStoreInfoParams) (retVal interface{}, errCode string, err error) {
		if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDList); err == nil {
			retVal, err = cms.GetVendorStoreInfo(params.Ctx, vendorIDList, params.IsAsync, params.IsContinueWhenError)
		}
		return retVal, "", err
	})
}

// @Title 查询门店价格评分
// @Description 查询门店价格评分
// @Param	token			header			string	true	"认证token"
// @Param	storeIDs		formData		string	false	"门店列表"
// @Param	vendorIDs		formData		string	false	"厂商列表"
// @Param	snapDate		formData		string	true	"时间，默认前一天（格式2006-01-02"
// @Param	fromScore		formData		int		false	"分数范围开始 默认0"
// @Param	toScore			formData		int		false	"分数范围结束 默认100"
// @Param	sort			formData		int		false	"分数排序，-1降序，-升序 ,直降排序，-2降序，2升序,秒杀排序，-3降序，3升序"
// @Param	offset			formData		int		false	"门店列表起始序号（以0开始，缺省为0）"
// @Param	pageSize		formData		int		false	"门店列表页大小（缺省为50，-1表示全部）"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStorePriceScore [post]
func (c *StoreController) GetStorePriceScore() {
	var storeIDList, vendorIDList []int
	c.callGetStorePriceScore(func(params *tStoreGetStorePriceScoreParams) (retVal interface{}, errCode string, err error) {
		if jxutils.Strings2Objs(params.StoreIDs, &storeIDList, params.VendorIDs, &vendorIDList); err == nil {
			retVal, err = cms.GetStorePriceScore(params.Ctx, storeIDList, vendorIDList, params.FromScore, params.ToScore, params.Sort, params.SnapDate, params.Offset, params.PageSize)
		}
		return retVal, "", err
	})
}

// @Title 生成门店价格分数表
// @Description  生成门店价格分数表
// @Param	token			header		string	true	"认证token"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /CreateStorePriceScore [post]
func (c *StoreController) CreateStorePriceScore() {
	c.callCreateStorePriceScore(func(params *tStoreCreateStorePriceScoreParams) (retVal interface{}, errCode string, err error) {
		err = cms.CreateStorePriceScore(params.Ctx)
		return retVal, "", err
	})
}

// @Title 刷新store_map的京东等级
// @Description  刷新store_map的京东等级
// @Param	token			header		string	true	"认证token"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /RefreshJdLevel [post]
func (c *StoreController) RefreshJdLevel() {
	c.callRefreshJdLevel(func(params *tStoreRefreshJdLevelParams) (retVal interface{}, errCode string, err error) {
		err = cms.RefreshJdLevel(params.Ctx)
		return retVal, "", err
	})
}

// @Title 同步指定京东门店
// @Description  同步京东门店
// @Param	token			header		string	true	"认证token"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /SyncJdStore [post]
func (c *StoreController) SyncJdStore() {
	c.callSyncJdStore(func(params *tStoreSyncJdStoreParams) (retVal interface{}, errCode string, err error) {
		err = cms.UpdateJdStoreNameAll(params.Ctx)
		return retVal, "", err
	})
}

// @Title 清空打印机打印队列
// @Description  清空打印机打印队列
// @Param	token			header		string	true	"认证token"
// @Param	storeIDs		formData	string	true	"门店列表"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /DeletePrinterSeq [post]
func (c *StoreController) DeletePrinterSeq() {
	var storeIDList []int
	c.callDeletePrinterSeq(func(params *tStoreDeletePrinterSeqParams) (retVal interface{}, errCode string, err error) {
		if jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
			err = cms.DeletePrinterSeq(params.Ctx, storeIDList)
		}
		return retVal, "", err
	})
}

// @Title 得到门店类别
// @Description 得到门店类别
// @Param	token			header		string	false	"认证token"
// @Param	parentID		query		int		false	"父ID"
// @Param	level			query		int		false	"分类等级"
// @Param	storeID			query		int		true	"门店ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStoreCategoryMap [get]
func (c *StoreController) GetStoreCategoryMap() {
	c.callGetStoreCategoryMap(func(params *tStoreGetStoreCategoryMapParams) (retVal interface{}, errCode string, err error) {
		// 获取门店分类
		categoryList, err := cms.GetStoreCategoryMap(params.Ctx, params.ParentID, params.Level, params.StoreID)
		return categoryList, "", err
	})
}

// GetStoreCategoryNoDefault 得到门店分类，该功能属于手机客户端！与上功能相同！只是不再返回默认门店分类。
// @Title 得到门店类别
// @Description 得到门店分类，该功能属于手机客户端！与上功能相同！只是不再返回默认门店分类。
// @Param	token			header		string	true	"认证token"
// @Param	parentID		query		int		false	"父ID"
// @Param	level			query		int		false	"分类等级"
// @Param	storeID			query		int		true	"门店ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStoreCategoryNoDefault [get]
func (c *StoreController) GetStoreCategoryNoDefault() {
	c.callGetStoreCategoryNoDefault(func(params *tStoreGetStoreCategoryNoDefaultParams) (interface{}, string, error) {
		// 获取门店分类
		categoryList, err := cms.GetStoreCategoryMapNoDefault(params.Ctx, params.ParentID, params.Level, params.StoreID)
		return categoryList, "", err
	})
}

// @Title 新增门店类别
// @Description 新增门店类别
// @Param	token				header		string	true	"认证token"
// @Param	storeID				formData	int		true	"门店ID"
// @Param	categroyID			formData	int		false	"京西分类id"
// @Param	level				formData	int		true	"分类级别"
// @Param	parentID			formData	int		true	"分类父ID"
// @Param	storeCategroyName	formData	string	true	"类别name"
// @Param	isHidden			formData	int		true	"是否隐藏"
// @Param	storeCategroySeq	formData	int		true	"类别序号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /AddStoreCategoryMap [post]
func (c *StoreController) AddStoreCategoryMap() {
	c.callAddStoreCategoryMap(func(params *tStoreAddStoreCategoryMapParams) (retVal interface{}, errCode string, err error) {
		storeCategoryMap := &model.StoreCategoryMap{
			StoreID:           params.StoreID,
			CategoryID:        params.CategroyID,
			StoreCategoryName: params.StoreCategroyName,
			StoreCategorySeq:  params.StoreCategroySeq,
			Level:             params.Level,
			ParentID:          params.ParentID,
			IsHidden:          params.IsHidden,
		}
		retVal, err = cms.AddStoreCategoryMap(params.Ctx, storeCategoryMap)
		return retVal, "", err
	})
}

// @Title 修改门店类别
// @Description 修改门店类别
// @Param	token				header		string	true	"认证token"
// @Param	ID					formData	int		true	"记录ID"
// @Param	categoryID			formData	int		false	"京西分类id"
// @Param	storeCategroyName	formData	string	false	"类别name"
// @Param	level				formData	int		true	"分类级别"
// @Param	parentID			formData	int		true	"分类父ID"
// @Param	isHidden			formData	int		true	"是否隐藏"
// @Param	isDelete			formData	bool	false	"是否是删除操作，默认false"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateStoreCategoryMap [put]
func (c *StoreController) UpdateStoreCategoryMap() {
	c.callUpdateStoreCategoryMap(func(params *tStoreUpdateStoreCategoryMapParams) (retVal interface{}, errCode string, err error) {
		storeCategoryMap := &model.StoreCategoryMap{
			CategoryID:        params.CategoryID,
			StoreCategoryName: params.StoreCategroyName,
			Level:             params.Level,
			ParentID:          params.ParentID,
			IsHidden:          params.IsHidden,
		}
		retVal, err = cms.UpdateStoreCategoryMap(params.Ctx, params.ID, storeCategoryMap, params.IsDelete)
		return retVal, "", err
	})
}

// @Title 门店类别重排序
// @Description 门店类别重排序
// @Param	token			header		string	true	"认证token"
// @Param	categoryID		formData	int		true	"父ID"
// @Param	storeID			formData	int		true	"门店ID"
// @Param	categoryIDs		formData	string	true	"同一父类别下的所有子类别ID列表([1,2,3,4])"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /ReorderStoreCategories [put]
func (c *SkuController) ReorderStoreCategories() {
	c.callReorderStoreCategories(func(params *tSkuReorderStoreCategoriesParams) (retVal interface{}, errCode string, err error) {
		var idList []int
		if err = utils.UnmarshalUseNumber([]byte(params.CategoryIDs), &idList); err == nil {
			err = cms.ReorderStoreCategories(params.Ctx, params.CategoryID, params.StoreID, idList)
		}
		return retVal, "", err
	})
}

// @Title 复制门店类别
// @Description 复制门店类别
// @Param	token				header		string	true	"认证token"
// @Param	fromStoreID			formData	int		true	"源门店ID"
// @Param	toStoreIDs			formData	string	true	"目标门店的IDs"
// @Param	categoryIDs			formData	string	false	"原门店的分类IDs,不传代表整个复制"
// @Param	isAsync				formData	bool	false	"是否异步操作"
// @Param	isContinueWhenError	formData	bool	false	"单个同步失败是否继续，缺省false"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /CopyStoreCategories [put]
func (c *SkuController) CopyStoreCategories() {
	var toStoreIDs, categoryIDs []int
	c.callCopyStoreCategories(func(params *tSkuCopyStoreCategoriesParams) (retVal interface{}, errCode string, err error) {
		if jxutils.Strings2Objs(params.ToStoreIDs, &toStoreIDs, params.CategoryIDs, &categoryIDs); err == nil {
			retVal, err = cms.CopyStoreCategories(params.Ctx, params.FromStoreID, toStoreIDs, categoryIDs, params.IsAsync, params.IsContinueWhenError)
		}
		return retVal, "", err
	})
}

// @Title 修改门店专属调价包
// @Description 修改门店专属调价包
// @Param	token				header		string	true	"认证token"
// @Param	storeID				formData	int		true	"门店ID"
// @Param	vendorID			formData	int		true	"平台ID"
// @Param	pricePack			formData	string	true	"门店调价包"
// @Param	value				formData	string	false	"调价包json串"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateStorePricePack [put]
func (c *StoreController) UpdateStorePricePack() {
	c.callUpdateStorePricePack(func(params *tStoreUpdateStorePricePackParams) (retVal interface{}, errCode string, err error) {
		err = cms.UpdateStorePricePack(params.Ctx, params.StoreID, params.VendorID, params.PricePack, params.Value)
		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 /GetNearSupplyGoodsStoreByStoreID [get]
func (c *StoreController) GetNearSupplyGoodsStoreByStoreID() {
	c.callGetNearSupplyGoodsStoreByStoreID(func(params *tStoreGetNearSupplyGoodsStoreByStoreIDParams) (retVal interface{}, errCode string, err error) {
		retVal, err = common.GetNearSupplyGoodsStoreByStoreID(params.Ctx, params.StoreID)
		return retVal, "", err
	})
}

// @Title 获取京东门店手动划的配送范围面积
// @Description 获取京东门店手动划的配送范围面积
// @Param	token				header		string	true	"认证token"
// @Param	storeIDs			query		string	true	"门店IDs"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetJdDeliveryArea [get]
func (c *StoreController) GetJdDeliveryArea() {
	var storeIDs []int
	c.callGetJdDeliveryArea(func(params *tStoreGetJdDeliveryAreaParams) (retVal interface{}, errCode string, err error) {
		if jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
			err = cms.GetJdDeliveryArea(params.Ctx, storeIDs)
		}
		return retVal, "", err
	})
}

// @Title 修改门店对应Cid（个推推送uniapp消息用）
// @Description 修改门店对应Cid（个推推送uniapp消息用）
// @Param	token				header		string	true	"认证token"
// @Param	storeID				formData	int		true	"门店ID"
// @Param	clientID			formData	string	true	"cID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateStorePushClient [post]
func (c *StoreController) UpdateStorePushClient() {
	c.callUpdateStorePushClient(func(params *tStoreUpdateStorePushClientParams) (retVal interface{}, errCode string, err error) {
		err = cms.UpdateStorePushClient(params.Ctx, params.StoreID, params.ClientID)
		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 /CreateStoreAudit [post]
func (c *StoreController) CreateStoreAudit() {
	c.callCreateStoreAudit(func(params *tStoreCreateStoreAuditParams) (retVal interface{}, errCode string, err error) {
		store := &model.StoreAudit{}
		if err = utils.UnmarshalUseNumber([]byte(params.Payload), store); err == nil {
			err = cms.CreateStoreAudit(params.Ctx, store)
		}
		return retVal, "", err
	})
}

// @Title 获取用户申请门店审核
// @Description 获取用户申请门店审核
// @Param	token			header		string	true	"认证token"
// @Param	applyTimeStart	query		string	false	"申请开始时间"
// @Param	applyTimeEnd	query		string	false	"申请结束时间"
// @Param	auditTimeStart	query		string	false	"审核开始时间"
// @Param	auditTimeEnd	query		string	false	"审核结束时间"
// @Param	name			query		string	false	"审核人"
// @Param	statuss			query		string	false	"审核状态"
// @Param	keyword			query		string	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 /GetStoreAudit [get]
func (c *StoreController) GetStoreAudit() {
	c.callGetStoreAudit(func(params *tStoreGetStoreAuditParams) (retVal interface{}, errCode string, err error) {
		var (
			statuss []int
		)
		if err = jxutils.Strings2Objs(params.Statuss, &statuss); err != nil {
			return retVal, "", err
		}
		retVal, err = cms.GetStoreAudit(params.Ctx, statuss, params.Keyword, params.ApplyTimeStart, params.ApplyTimeEnd, params.AuditTimeStart, params.AuditTimeEnd, params.PageSize, params.Offset)
		return retVal, "", err
	})
}

// @Title 门店审核
// @Description 门店审核
// @Param	token			header		string	true	"认证token"
// @Param	payload			formData	string	true	"json数据，storeaudit对象"
// @Param	status			formData	int		false	"审核标志，1通过，-1 不通过"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /StoreAudit [post]
func (c *StoreController) StoreAudit() {
	c.callStoreAudit(func(params *tStoreStoreAuditParams) (retVal interface{}, errCode string, err error) {
		var stores []*model.StoreAudit
		if err = utils.UnmarshalUseNumber([]byte(params.Payload), &stores); err == nil {
			retVal, err = cms.StoreAudit(params.Ctx, stores, params.Status)
		}
		return retVal, "", err
	})
}

// @Title 比较美团配送门店信息
// @Description 比较美团配送门店信息
// @Param	token			header		string	true	"认证token"
// @Param	storeIDs		formData	string	true	"门店ids"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetDiffJxStoreAndMTWMStoreInfo [post]
func (c *StoreController) GetDiffJxStoreAndMTWMStoreInfo() {
	c.callGetDiffJxStoreAndMTWMStoreInfo(func(params *tStoreGetDiffJxStoreAndMTWMStoreInfoParams) (retVal interface{}, errCode string, err error) {
		var storeIDs []int
		if err = utils.UnmarshalUseNumber([]byte(params.StoreIDs), &storeIDs); err == nil {
			err = cms.GetDiffJxStoreAndMTWMStoreInfo(params.Ctx, storeIDs)
		}
		return retVal, "", err
	})
}

// @Title 查询京东到家app上门店信息
// @Description 查询京东到家app上门店信息
// @Param	token			header		string	true	"认证token"
// @Param	vendorStoreID	query		string	true	"门店id"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetJddjStoreInfo [get]
func (c *StoreController) GetJddjStoreInfo() {
	c.callGetJddjStoreInfo(func(params *tStoreGetJddjStoreInfoParams) (retVal interface{}, errCode string, err error) {
		api.JdAPI.SetCookieWithStr(`
			shshshfpa=13b38d4a-8ba0-df12-0012-82d9a37fb835-1573795914; shshshfpb=abYp8Dq5JobRtp2pkZa7MbA%3D%3D; cart_uuid=1bd562b37ef02371; track=46099cdb-39fb-abe6-579e-ea9536a8cf9c; deviceid_pdj_jd=H5_DEV_92DD6F05-B71A-43D7-9790-529335C43AAC; mba_muid=1605755815875269445822; TrackerID=E6aNCj4mNlBVkq6eyFfWLvkbWl9DhdG-pRGVaQPbvt2ewCa2n0QM-p0mViOLv_Uem9pAWgbNZEeaJuaz4gARAW9rTj8PJK-3hmcbl9N9h1qg-DMYXvdwc3Iau-AMlWin29CojqE8YnUPMtlJUf2gnA; pt_token=y2wjxzef; pwdt_id=jd_5e10f2d70fb4c; h5_coords_obj=""; o2o_m_h5_sid=5cb8b4db-feaa-4b25-aa96-df96cf9dba6d; PDJ_H5_JDPIN=jd_5e10f2d70fb4c; PDJ_H5_MOBILE=181****0913; PDJ_H5_PIN=JD_222ea79f49b3211; navigation=[%22shop_jxcs2020%22]; shshshfp=34eda22ad0af63b76392daccd2d03f2e; cid=NWtRMjE2NndZMzc4N2hWNzMyOHFBNDcwMXdTMjEwMm9BMjE4M3JPNjkwNHJQODk2; 3AB9D23F7A4B3C9B=AK36FFYF5J6WMPRH7YTXMEX4CATHR6NAA3IQEESU2I33FEJRQ3DRLU4SZJYD2XGFLCFW43DHYP5HQKOMR4EFQSLKLA; __jdu=1591327001141529223150; __jdv=27966078|direct|-|none|-|1606900892557; pt_key=app_openAAJfzzr6ADCQcdEYCKb4BH4DNh-9sVcgVB7nYveTS-J-x3tuin7otTCG7qTRTasxQdi-pr8mkFU; pt_pin=jd_5e10f2d70fb4c; sid=7fc3a18bc45c5766395cd2a8ad1c6daw; is_sz_old_version=false; language=zh_CN; TrackID=1a_Q7xLAd79K-ifyBFeTkWcSF5DEgCm9ISEjFoCF1VhbmI0XLzk-3Np5Wa0O0f0W2UZCX327iWisSzKkCasW_kqc4MqKSXDbOxk3w4AByhjM; pinId=qA40zQJfoxUJ0BznFrVelbV9-x-f3wj7; pin=jd_5e10f2d70fb4c; unick=jd_181600jgy; ceshi3.com=201; _tp=tPAwCz7dZ2wG9FcrXkvXEPcH%2FgU%2BK8r%2FxTPrJfx1wo8%3D; _pst=jd_5e10f2d70fb4c; b-sec=2GBADPFJ55VHNAQ2DUPKR7Y2CEX6NF5ABOAAZCYCWLTBU4NIRBCM7FKZVF35XOCEUIAEOLVWWE3OPD6NRWBX675VTE; thor=E6F66DF4AD3A159C1AE9872C7BB0CF4D5E2B8B9C52714A91A28E40CDCDB5FE53C00D4CD2A91B92947D52C5EE00FBE8D652EBD6251926555789988488332962E56D7343A6B07A071F9FF37C24CE28506474AD1E996F78691C9194C9B3171F9255349E4A94AE37D23F6A1BBE49880177B7E3D701F06FAEC88026BA9E09D25E789B59226B670D64ECA829E356891A1FB2E2D0036899FE49F651BBE4F7BCCE857385; __jda=191429163.1591327001141529223150.1591327001.1607907141.1607938587.81; __jdc=191429163; __jdb=191429163.4.1591327001141529223150|81.1607938587; _base_=YKH2KDFHMOZBLCUV7NSRBWQUJPBI7JIMU5R3EFJ5UDHJ5LCU7R2NILKK5UJ6GLA2RGYT464UKXAI5KK7PNC5B5UHJ2HVQ4ENFP57OC2NCIWTST4KDNCWZES6EV2TD5XDTCNE6YVKRXISVWNQHZDBO6QEKYXMXGPYGVEOCQCSG4SOQWCP5WPWO6EFS7HEHMRWVKBRVHB33TFD4AUHV3TOJD7MGBX53BNNP2E6MSSOORYGL5H2GYFRURR5ACFJ54GH7PTHFL22YL3C6ODFYFTWGV5UAWCX5C6J372TDCL6LDNEERERTGC3XZYHUWG3GYQCRBMGP7O2Q2MPVVQAQIWW3S2YBGSPJZVO3XPNMOJI6RFTJD5NXZUZMBDK4FVEVR2D		
			`)
		retVal, err = api.JdAPI.GetJdStoreInfo(params.VendorStoreID)
		return retVal, "", err
	})
}

// @Title 查询品牌
// @Description 查询品牌
// @Param	token		header		string		false	"认证token"
// @Param	brandID		query		int			false	"品牌ID"
// @Param	name		query		string		false	"品牌名"
// @Param	isManage	query		bool		false	"是否是查自己管理的品牌"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetBrands [get]
func (c *StoreController) GetBrands() {
	c.callGetBrands(func(params *tStoreGetBrandsParams) (retVal interface{}, errCode string, err error) {
		retVal, err = cms.GetBrands(params.Ctx, params.Name, params.BrandID, params.IsManage)
		return retVal, "", err
	})
}

// @Title 新增品牌
// @Description 新增品牌
// @Param	token		header		string		true	"认证token"
// @Param	payload		formData	string		true	"brand payload"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /AddBrand [post]
func (c *StoreController) AddBrand() {
	c.callAddBrand(func(params *tStoreAddBrandParams) (retVal interface{}, errCode string, err error) {
		var brand = &model.Brand{}
		if err = utils.UnmarshalUseNumber([]byte(params.Payload), brand); err == nil {
			err = cms.AddBrand(params.Ctx, brand)
		}
		return retVal, "", err
	})
}

// @Title 修改品牌
// @Description 修改品牌
// @Param	token		header		string		true	"认证token"
// @Param	payload		formData	string		true	"brand payload"
// @Param	isDel		formData	bool		false	"是否是删除"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateBrand [post]
func (c *StoreController) UpdateBrand() {
	c.callUpdateBrand(func(params *tStoreUpdateBrandParams) (retVal interface{}, errCode string, err error) {
		payload := make(map[string]interface{})
		if err = utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err == nil {
			err = cms.UpdateBrand(params.Ctx, payload, params.IsDel)
		}
		return retVal, "", err
	})
}

// @Title 修改门店分类为京西分类
// @Description 修改门店分类为京西分类
// @Param	token		header		string		true	"认证token"
// @Param	storeID		formData	int			true	"门店ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /InsertStoreCategories [post]
func (c *StoreController) InsertStoreCategories() {
	c.callInsertStoreCategories(func(params *tStoreInsertStoreCategoriesParams) (retVal interface{}, errCode string, err error) {
		err = cms.InsertStoreCategories(params.Ctx, nil, params.StoreID)
		return retVal, "", err
	})
}

// @Title 创建平台门店
// @Description 创建平台门店
// @Param	token			header		string	true	"认证token"
// @Param	storeID			formData	int		true	"门店ID"
// @Param	vendorID		formData	int		true	"平台ID"
// @Param	payload			formData	string	true	"json数据，store对象"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /CreateVendorStore [post]
func (c *StoreController) CreateVendorStore() {
	c.callCreateVendorStore(func(params *tStoreCreateVendorStoreParams) (retVal interface{}, errCode string, err error) {
		payload := make(map[string]interface{})
		if err = utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err == nil {
			err = cms.CreateVendorStore(params.Ctx, params.StoreID, params.VendorID, payload)
		}
		return retVal, "", err
	})
}

// @Title 查询品牌店铺
// @Description 查询品牌店铺
// @Param	token			header	string		false	"认证token"
// @Param	name			query	string		false	"品牌名"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetBrandStore [get]
func (c *StoreController) GetBrandStore() {
	c.callGetBrandStore(func(params *tStoreGetBrandStoreParams) (retVal interface{}, errCode string, err error) {
		retVal, err = cms.GetBrandStore(params.Ctx, params.Name)
		return retVal, "", err
	})
}

// @Title 商家确认参与活动
// @Description 商家确认参与活动
// @Param	token			header		string		false	"认证token"
// @Param	status			formData	int			true	"确认或取消，确认1，取消-1"
// @Param	msgStatusID		formData	int			true	"消息状态ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /StoreConfirmAct [post]
func (c *StoreController) StoreConfirmAct() {
	c.callStoreConfirmAct(func(params *tStoreStoreConfirmActParams) (retVal interface{}, errCode string, err error) {
		err = cms.StoreConfirmAct(params.Ctx, params.Status, params.MsgStatusID)
		return retVal, "", err
	})
}

// @Title 查询门店账户余额
// @Description 查询门店账户余额
// @Param	token			header		string	true	"认证token"
// @Param	storeID			formData	int		true	"门店ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStoreAcctBalance [get]
func (c *StoreController) GetStoreAcctBalance() {
	c.callGetStoreAcctBalance(func(params *tStoreGetStoreAcctBalanceParams) (retVal interface{}, errCode string, err error) {
		retVal, err = cms.GetStoreAcctBalance(params.Ctx, params.StoreID)
		return retVal, "", err
	})
}

// @Title 直接修改平台门店上下线
// @Description 直接修改平台门店上下线
// @Param	token			header		string	true	"认证token"
// @Param	storeID			formData	int		true	"门店ID"
// @Param	vendorIDs		formData	string	true	"订单所属厂商列表[1,2,3]，缺省不限制"
// @Param	status			formData	int		true	"状态，-1 下线，1上线"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateVendorStoreBussinessStatus [post]
func (c *StoreController) UpdateVendorStoreBussinessStatus() {
	c.callUpdateVendorStoreBussinessStatus(func(params *tStoreUpdateVendorStoreBussinessStatusParams) (retVal interface{}, errCode string, err error) {
		var vendorIDList []int
		temp := strings.Split(params.VendorIDs, ",")
		for _, v := range temp {
			vendorIDList = append(vendorIDList, utils.Str2Int(v))
		}
		err = cms.UpdateVendorStoreBussinessStatus(params.Ctx, params.StoreID, vendorIDList, params.Status)
		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	vendorOrgCode	formData	string	false	"厂商内组织代码"
// @Param	vendorStoreID	formData	string	false	"平台门店ID"
// @Param	vendorStoreName	formData	string	false	"平台门店名"
// @Param	vendorAccount	formData	string	true	"平台账号"
// @Param	vendorPasswaord	formData	string	false	"平台账号密码"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /AddStoreMapAudit [post]
func (c *StoreController) AddStoreMapAudit() {
	c.callAddStoreMapAudit(func(params *tStoreAddStoreMapAuditParams) (retVal interface{}, errCode string, err error) {
		err = cms.AddStoreMapAudit(params.Ctx, params.StoreID, params.VendorID, params.VendorOrgCode, params.VendorStoreID, params.VendorStoreName, params.VendorAccount, params.VendorPasswaord)
		return retVal, "", err
	})
}

// @Title 审核商户申请授权
// @Description 审核商户申请授权
// @Param	token			header		string	true	"认证token"
// @Param	ID				formData	int		true	"申请记录的ID"
// @Param	vendorOrgCode	formData	string	false	"厂商内组织代码"
// @Param	vendorStoreID	formData	string	false	"平台门店ID"
// @Param	auditStatus		formData	int		false	"审核标志，1为通过，-1为不通过"
// @Param	comment			formData	string	false	"不通过原因"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /AuditStoreMap [post]
func (c *StoreController) AuditStoreMap() {
	c.callAuditStoreMap(func(params *tStoreAuditStoreMapParams) (retVal interface{}, errCode string, err error) {
		err = cms.AuditStoreMap(params.Ctx, params.ID, params.VendorOrgCode, params.VendorStoreID, params.AuditStatus, params.Comment)
		return retVal, "", err
	})
}

// @Title 查询商户申请授权
// @Description 查询商户申请授权
// @Param	token			header		string	true	"认证token"
// @Param	storeIDs		query		string	false	"门店IDs"
// @Param	vendorIDs		query		string	false	"平台IDs"
// @Param	auditStatuss	query		string	false	"审核状态s"
// @Param	fromTime		query		string	false	"审核时间"
// @Param	toTime			query		string	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 /GetStoreMapAudit [get]
func (c *StoreController) GetStoreMapAudit() {
	c.callGetStoreMapAudit(func(params *tStoreGetStoreMapAuditParams) (retVal interface{}, errCode string, err error) {
		var (
			storeIDs     []int
			vendorIDs    []int
			auditStatuss []int
		)
		jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.VendorIDs, &vendorIDs, params.AuditStatuss, &auditStatuss)
		retVal, err = cms.GetStoreMapAudit(params.Ctx, storeIDs, vendorIDs, auditStatuss, params.FromTime, params.ToTime, params.Offset, params.PageSize)
		return retVal, "", err
	})
}

// @Title 查询品牌用户
// @Description 查询品牌用户
// @Param	token		header		string		true	"认证token"
// @Param	brandID		query		int			true	"brandID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetBrandUser [get]
func (c *StoreController) GetBrandUser() {
	c.callGetBrandUser(func(params *tStoreGetBrandUserParams) (retVal interface{}, errCode string, err error) {
		retVal, err = cms.GetBrandUser(params.Ctx, params.BrandID)
		return retVal, "", err
	})
}

// @Title 修改品牌用户
// @Description 修改品牌用户
// @Param	token		header		string		true	"认证token"
// @Param	brandID		formData	int			true	"brandID"
// @Param	userID		formData	string		true	"userID"
// @Param	isDel		formData	bool		true	"true是删除，false是添加"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateBrandUser [post]
func (c *StoreController) UpdateBrandUser() {
	c.callUpdateBrandUser(func(params *tStoreUpdateBrandUserParams) (retVal interface{}, errCode string, err error) {
		err = cms.UpdateBrandUser(params.Ctx, params.BrandID, params.UserID, params.IsDel)
		return retVal, "", err
	})
}

// @Title 根据品牌自动创建或更新快递门店
// @Description 根据品牌自动创建或更新快递门店
// @Param	token			header			string	true	"认证token"
// @Param	brandID			formData		int		true	"品牌ID"
// @Param	vendorID		formData		int		true	"平台ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateOrCreateCourierStoresByBrand [post]
func (c *StoreController) UpdateOrCreateCourierStoresByBrand() {
	c.callUpdateOrCreateCourierStoresByBrand(func(params *tStoreUpdateOrCreateCourierStoresByBrandParams) (retVal interface{}, errCode string, err error) {
		retVal, err = cms.UpdateOrCreateCourierStoresByBrand(params.Ctx, params.BrandID, params.VendorID)
		return retVal, "", err
	})
}

// @Title 得到品牌类别
// @Description 得到品牌类别
// @Param	token			header		string	true	"认证token"
// @Param	parentID		query		int		false	"父ID"
// @Param	level			query		int		false	"分类等级"
// @Param	brandID			query		int		true	"品牌ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetBrandCategoryMap [get]
func (c *StoreController) GetBrandCategoryMap() {
	c.callGetBrandCategoryMap(func(params *tStoreGetBrandCategoryMapParams) (retVal interface{}, errCode string, err error) {
		retVal, err = cms.GetBrandCategoryMap(params.Ctx, params.ParentID, params.Level, params.BrandID)
		return retVal, "", err
	})
}

// @Title 新增品牌类别
// @Description 新增品牌类别
// @Param	token				header		string	true	"认证token"
// @Param	brandID				formData	int		true	"品牌ID"
// @Param	categroyID			formData	int		false	"京西分类id"
// @Param	level				formData	int		true	"分类级别"
// @Param	parentID			formData	int		true	"分类父ID"
// @Param	brandCategroyName	formData	string	true	"类别name"
// @Param	brandCategroySeq	formData	int		true	"类别序号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /AddBrandCategoryMap [post]
func (c *StoreController) AddBrandCategoryMap() {
	c.callAddBrandCategoryMap(func(params *tStoreAddBrandCategoryMapParams) (retVal interface{}, errCode string, err error) {
		brandCategoryMap := &model.BrandCategoryMap{
			BrandID:           params.BrandID,
			CategoryID:        params.CategroyID,
			BrandCategoryName: params.BrandCategroyName,
			BrandCategorySeq:  params.BrandCategroySeq,
			Level:             params.Level,
			ParentID:          params.ParentID,
		}
		retVal, err = cms.AddBrandCategoryMap(params.Ctx, brandCategoryMap)
		return retVal, "", err
	})
}

// @Title 修改品牌类别
// @Description 修改品牌类别
// @Param	token				header		string	true	"认证token"
// @Param	ID					formData	int		true	"记录ID"
// @Param	categoryID			formData	int		false	"京西分类id"
// @Param	brandCategroyName	formData	string	false	"类别name"
// @Param	level				formData	int		true	"分类级别"
// @Param	parentID			formData	int		true	"分类父ID"
// @Param	isDelete			formData	bool	false	"是否是删除操作，默认false"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateBrandCategoryMap [put]
func (c *StoreController) UpdateBrandCategoryMap() {
	c.callUpdateBrandCategoryMap(func(params *tStoreUpdateBrandCategoryMapParams) (retVal interface{}, errCode string, err error) {
		brandCategoryMap := &model.BrandCategoryMap{
			CategoryID:        params.CategoryID,
			BrandCategoryName: params.BrandCategroyName,
			Level:             params.Level,
			ParentID:          params.ParentID,
		}
		retVal, err = cms.UpdateBrandCategoryMap(params.Ctx, params.ID, brandCategoryMap, params.IsDelete)
		return retVal, "", err
	})
}

// @Title 品牌类别重排序
// @Description 品牌类别重排序
// @Param	token			header		string	true	"认证token"
// @Param	categoryID		formData	int		true	"父ID"
// @Param	brandID			formData	int		true	"门店ID"
// @Param	categoryIDs		formData	string	true	"同一父类别下的所有子类别ID列表([1,2,3,4])"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /ReorderBrandCategories [put]
func (c *StoreController) ReorderBrandCategories() {
	c.callReorderBrandCategories(func(params *tStoreReorderBrandCategoriesParams) (retVal interface{}, errCode string, err error) {
		var idList []int
		if err = utils.UnmarshalUseNumber([]byte(params.CategoryIDs), &idList); err == nil {
			err = cms.ReorderBrandCategories(params.Ctx, params.CategoryID, params.BrandID, idList)
		}
		return retVal, "", err
	})
}

// @Title 修改品牌分类为京西分类
// @Description 修改品牌分类为京西分类
// @Param	token		header		string		true	"认证token"
// @Param	brandID		formData	int			true	"品牌ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /InsertBrandCategories [post]
func (c *StoreController) InsertBrandCategories() {
	c.callInsertBrandCategories(func(params *tStoreInsertBrandCategoriesParams) (retVal interface{}, errCode string, err error) {
		err = cms.InsertBrandCategories(params.Ctx, params.BrandID)
		return retVal, "", err
	})
}

// @Title 查询品牌号码
// @Description 查询品牌号码
// @Param	token			header		string	true	"认证token"
// @Param	brandID 		query		int		true	"品牌ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetBrandSecretNumbers [get]
func (c *StoreController) GetBrandSecretNumbers() {
	c.callGetBrandSecretNumbers(func(params *tStoreGetBrandSecretNumbersParams) (retVal interface{}, errCode string, err error) {
		retVal, err = secretNumber.GetBrandSecretNumbers(params.Ctx, params.BrandID)
		return retVal, "", err
	})
}

// @Title 查询号码绑定关系
// @Description 查询号码绑定关系
// @Param	token			header		string		true	"认证token"
// @Param	poolKey 		query		string		true	"号码池key"
// @Param	secretNumber 	query		string		true	"隐私号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetSecretNumberBind [get]
func (c *StoreController) GetSecretNumberBind() {
	c.callGetSecretNumberBind(func(params *tStoreGetSecretNumberBindParams) (retVal interface{}, errCode string, err error) {
		retVal, err = secretNumber.QuerySubscriptionDetail(params.PoolKey, params.SecretNumber)
		return retVal, "", err
	})
}

// @Title 购买号码
// @Description 购买号码
// @Param	token			header		string	true	"认证token"
// @Param	poolKey 		formData	string	false	"号码池key"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /BuySecretNo [post]
func (c *StoreController) BuySecretNo() {
	c.callBuySecretNo(func(params *tStoreBuySecretNoParams) (retVal interface{}, errCode string, err error) {
		err = secretNumber.BuySecretNo(params.Ctx, params.PoolKey, "成都")
		return retVal, "", err
	})
}

// @Title 绑定号码
// @Description 绑定号码
// @Param	token			header		string		true	"认证token"
// @Param	secretNumber 	formData	string		true	"隐私号"
// @Param	numberA 		formData	string		true	"号码1"
// @Param	numberB		 	formData	string		true	"号码2"
// @Param	expiration 		formData	string		true	"绑定时间（绑定到多久"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /BindSecretNumber [post]
func (c *StoreController) BindSecretNumber() {
	c.callBindSecretNumber(func(params *tStoreBindSecretNumberParams) (retVal interface{}, errCode string, err error) {
		err = secretNumber.BindAxb(params.Ctx, params.SecretNumber, params.NumberA, params.NumberB, params.Expiration)
		return retVal, "", err
	})
}

// @Title 修改绑定
// @Description 修改绑定
// @Param	token			header		string		true	"认证token"
// @Param	poolKey 		formData	string		true	"号码池key"
// @Param	subsID		 	formData	string		true	"绑定关系ID（查询列表中有"
// @Param	secretNumber 	formData	string		true	"号码x"
// @Param	numberA 		formData	string		false	"号码1"
// @Param	numberB		 	formData	string		false	"号码2"
// @Param	expiration 		formData	string		false	"绑定时间（绑定到多久"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateSecretBind [post]
func (c *StoreController) UpdateSecretBind() {
	c.callUpdateSecretBind(func(params *tStoreUpdateSecretBindParams) (retVal interface{}, errCode string, err error) {
		err = secretNumber.UpdateSubscription(params.PoolKey, params.SubsID, params.SecretNumber, params.NumberA, params.NumberB, params.Expiration)
		return retVal, "", err
	})
}

// @Title 解除绑定
// @Description 解除绑定
// @Param	token			header		string		true	"认证token"
// @Param	poolKey 		formData	string		true	"号码池key"
// @Param	subsID		 	formData	string		true	"绑定关系ID（查询列表中有"
// @Param	secretNumber 	formData	string		true	"号码x"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /DelSecretBind [post]
func (c *StoreController) DelSecretBind() {
	c.callDelSecretBind(func(params *tStoreDelSecretBindParams) (retVal interface{}, errCode string, err error) {
		err = secretNumber.UnbindSubscription(params.PoolKey, params.SubsID, params.SecretNumber)
		return retVal, "", err
	})
}

// @Title 更新打印模板
// @Description 更新打印模板
// @Param	token			header		string		true	"认证token"
// @Param	storeID 		formData	int			true	"门店ID"
// @Param	content		 	formData	string		false	"模板内容"
// @Param	sound		 	formData	string		false	"语音内容"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateStoreTemplate [post]
func (c *StoreController) UpdateStoreTemplate() {
	c.callUpdateStoreTemplate(func(params *tStoreUpdateStoreTemplateParams) (retVal interface{}, errCode string, err error) {
		err = cms.UpdateStoreTemplate(params.Ctx, params.StoreID, params.Content, params.Sound)
		return retVal, "", err
	})
}

// @Title 获取抖店门店建议范围
// @Description 获取抖店门店建议范围
// @Param	token			header	string		true	"认证token"
// @Param	storeID 		query	int			true	"门店ID"
// @Param	vendorStoreID	query	string	    true	"平台门店ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetDDScope [get]
func (c *StoreController) GetDDScope() {
	c.callGetDDScope(func(params *tStoreGetDDScopeParams) (retVal interface{}, errCode string, err error) {
		retVal, err = cms.GetDDScope(params.Ctx, params.StoreID, params.VendorStoreID)
		return retVal, "", nil
	})
}

// @Title 创建抖店电子围栏
// @Description 创建抖店电子围栏
// @Param	token			header		string	true	"认证token"
// @Param	payload			formData	string	true	"json数据，[]string对象"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /CreateDDStoreFence [post]
func (c *StoreController) CreateDDStoreFence() {
	c.callCreateDDStoreFence(func(params *tStoreCreateDDStoreFenceParams) (retVal interface{}, errCode string, err error) {
		payload := make(map[string][]tiktok_store.RelInfo)
		if err := utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err == nil {
			retVal, err = cms.AssistCreateFence(payload)
		}
		return retVal, "", err
	})
}

// @Title 批量创建抖店包邮运费模板
// @Description 批量创建抖店包邮运费模板
// @Param	token			header		string	true	"认证token"
// @Param	shipFee 		formData	int 	true	"包邮金额"
// @Param	payload			formData	string	true	"json数据，[]string对象"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /CreateFreeShipTemplates [post]
func (c *StoreController) CreateFreeShipTemplates() {
	c.callCreateFreeShipTemplates(func(params *tStoreCreateFreeShipTemplatesParams) (retVal interface{}, errCode string, err error) {
		payload := make(map[string][]tiktok_store.RelInfo)
		if err := utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err == nil {
			retVal, err = cms.BatchCreateFreeShipTemplate(payload, int64(params.ShipFee))
		}
		return retVal, "", err
	})
}

// @Title 批量配置抖音门店自动呼叫运力
// @Description 批量配置抖音门店自动呼叫运力
// @Param	token			header		string	    true	"认证token"
// @Param	vendorOrgCode	formData	string	    true	"抖音总账号"
// @Param	openIDs			formData	string	    false	"开启自动运力门店，string对象"
// @Param	closeIDs		formData	string	    false	"关闭自动运力门店，string对象"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /SetStoreAutoCallRider [post]
func (c *StoreController) SetStoreAutoCallRider() {
	c.callSetStoreAutoCallRider(func(params *tStoreSetStoreAutoCallRiderParams) (retVal interface{}, errCode string, err error) {
		if len(params.OpenIDs) == 0 && len(params.CloseIDs) == 0 {
			return nil, "", errors.New("开启/关闭自动运力门店ID不可都为空")
		} else {
			openIDs := make([]int64, 0)
			closeIDs := make([]int64, 0)
			openIDs = cms.String2ArrayInt64(params.OpenIDs)
			closeIDs = cms.String2ArrayInt64(params.CloseIDs)
			retVal, err = cms.SetStoreAutoCallRider(params.VendorOrgCode, openIDs, closeIDs)
			return retVal, "", err
		}
	})
}

// @Title 批量获取抖音门店自动呼叫运力设置
// @Description 批量获取抖音门店自动呼叫运力设置
// @Param	token			header		string	    true	"认证token"
// @Param	vendorOrgCode 	query		string		true	"抖音门店总账号"
// @Param	storeIDs 		query		string		true	"抖音门店IDs"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStoreAutoCallRiderInfo [get]
func (c *StoreController) GetStoreAutoCallRiderInfo() {
	c.callGetStoreAutoCallRiderInfo(func(params *tStoreGetStoreAutoCallRiderInfoParams) (retVal interface{}, errCode string, err error) {
		storeIDs := make([]int64, 0)
		storeIDs = cms.String2ArrayInt64(params.StoreIDs)
		retVal, err = tiktok_store.GetStoreAutoCallRiderInfo(params.VendorOrgCode, storeIDs)
		return retVal, "", err
	})
}

// @Title 创建绑定抖音区域仓
// @Description 创建绑定抖音区域仓
// @Param	token			header		string	    true	"认证token"
// @Param	vendorOrgCode 	formData	string		true	"抖音门店总账号"
// @Param	vendorStoreID 	formData	int64		true	"抖音门店id"
// @Param	storeID 		formData	int64		true	"京西门店ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /CreateDDWarehouse [post]
func (c *StoreController) CreateDDWarehouse() {
	c.callCreateDDWarehouse(func(params *tStoreCreateDDWarehouseParams) (interface{}, string, error) {
		err := cms.CreateDDWarehouse(params.VendorOrgCode, int64(params.VendorStoreID), int64(params.StoreID))
		return nil, "", err
	})
}

// @Title 打印机获取授权账号再京西菜市的绑定关系(其实就是根据平台门店id获取绑定门店id)
// @Description 打印机获取授权账号再京西菜市的绑定关系
// @Param	token			header		string	true	"认证token"
// @Param	vendorStoreId 	formData	string 	true	"平台账号id"
// @Param	vendorId	 	formData	int 	true	"平台id"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /PrintCheckAccountAuthorization [post]
func (c *StoreController) PrintCheckAccountAuthorization() {
	c.callPrintCheckAccountAuthorization(func(params *tStorePrintCheckAccountAuthorizationParams) (interface{}, string, error) {
		retVal, err := cms.GetVendorStoreBind(params.VendorStoreId, params.VendorId)
		return retVal, "", err
	})
}

// @Title 门店存在时,绑定打印机账号信息
// @Description 门店存在时,绑定打印机账号信息
// @Param	token			header		string	true	"认证token"
// @Param	storeId		 	formData	int64 	true	"京西门店id"
// @Param	printSn		 	formData	string 	true	"打印机编号"
// @Param	printKey		formData	string 	true	"打印机秘钥"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /BindJxPrinter [post]
func (c *StoreController) BindJxPrinter() {
	c.callBindJxPrinter(func(params *tStoreBindJxPrinterParams) (interface{}, string, error) {
		err := cms.BindJxPrintToStore(int64(params.StoreId), params.PrintSn, params.PrintKey)
		return nil, "", err
	})

}

// @Title 批量获取美团门店logo图片
// @Description 批量获取美团门店logo图片
// @Param	token			header		string	    true	"认证token"
// @Param	vendorOrgCode 	query		string		true	"美团平台账号"
// @Param	storeIDs 		query		string		true	"美团门店IDs"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /BatchGetMTStoreLogos [get]
func (c *StoreController) BatchGetMTStoreLogos() {
	c.callBatchGetMTStoreLogos(func(params *tStoreBatchGetMTStoreLogosParams) (interface{}, string, error) {
		mtStoreIDs := cms.String2ArrayString(params.StoreIDs)
		retVal := cms.BatchGetMTStoreLogos(params.VendorOrgCode, mtStoreIDs)
		return retVal, "", nil
	})
}

// @Title 批量修改美团门店logo图片
// @Description 批量修改美团门店logo图片
// @Param	token			header		string	    true	"认证token"
// @Param	vendorOrgCode 	query		int 		true	"美团平台账号"
// @Param	relInfos        query		string		true	"美团门店与logo链接的map"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /BatchUpdateMTStoreLogos [post]
func (c *StoreController) BatchUpdateMTStoreLogos() {
	c.callBatchUpdateMTStoreLogos(func(params *tStoreBatchUpdateMTStoreLogosParams) (retVal interface{}, hint string, err error) {
		mtRelInfos := make([]cms.MtRelInfo, 0)
		b := bytes.NewBufferString(params.RelInfos)
		decoder := json.NewDecoder(b)
		if err = decoder.Decode(&mtRelInfos); err == nil {
			hint = cms.BatchUpdateMTStoreLogos(utils.Int2Str(params.VendorOrgCode), mtRelInfos)
		}
		return nil, hint, nil
	})
}

// @Title 批量绑定淘鲜达门店
// @Description 批量绑定淘鲜达门店
// @Param	token			header		string	    true	"认证token"
// @Param	vendorOrgCode   formData	string		true	"账号id"
// @Param	bindInfos       formData	string		true	"TaoBindInfo"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /SingleBindTaoVegetable [post]
func (c *StoreController) SingleBindTaoVegetable() {
	c.callSingleBindTaoVegetable(func(params *tStoreSingleBindTaoVegetableParams) (retVal interface{}, hint string, err error) {
		taoBindInfo := make([]cms.TaoBindInfo, 0)
		b := bytes.NewBufferString(params.BindInfos)
		decoder := json.NewDecoder(b)
		if err = decoder.Decode(&taoBindInfo); err == nil {
			err, hint = cms.SingleBindTaoVegetable(params.Ctx, taoBindInfo, params.VendorOrgCode)
		}
		return nil, hint, err
	})
}

// @Title 更新淘鲜达门店信息
// @Description 更新淘鲜达门店信息
// @Param	token			header		string	    true	"认证token"
// @Param	vendorOrgCode	formData	string	    true	"平台账号"
// @Param	txdStores       formData	string		true	"TxdStore"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateTxdStore [post]
func (c *StoreController) UpdateTxdStore() {
	c.callUpdateTxdStore(func(params *tStoreUpdateTxdStoreParams) (retVal interface{}, errMsg string, err error) {
		taoStore := tao_vegetable.TxdStore{}
		b := bytes.NewBufferString(params.TxdStores)
		decoder := json.NewDecoder(b)
		if err = decoder.Decode(&taoStore); err == nil {
			err = tao_vegetable.UpdateTxdStore(taoStore, params.VendorOrgCode)
		}
		return nil, "", err
	})
}

// @Title 查询美团门店logo审核状态
// @Description 远查询美团门店logo审核状态
// @Param	token			header		string	true	"认证token"
// @Param	appPoiCodes	    query		string	true	"门店ID列表"
// @Param	vendorOrgCode	query		string	true	"厂商内组织代码"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetMtAuditList [get]
func (c *StoreController) GetMtAuditList() {
	c.callGetMtAuditList(func(params *tStoreGetMtAuditListParams) (interface{}, string, error) {
		if len(params.AppPoiCodes) > 0 && len(params.VendorOrgCode) > 0 {
			retVal, err := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, params.VendorOrgCode).(*mtwmapi.API).GetSettleAuditList(params.AppPoiCodes)
			return retVal, "", err
		}
		return nil, "", nil
	})
}

// @Title 测试操作freight_template
// @Description 测试操作freight_template
// @Param	token			header		string	    true	"认证token"
// @Param	storeID	        formData	int 	    true	"京西门店id"
// @Param	vendorStoreID	formData	string	    false	"抖音平台id"
// @Param	templateID		formData	int 	    false	"运费模板id"
// @Param	warehouseID		formData	int 	    false	"仓库id"
// @Param	fenceID 		formData	string	    false	"电子围栏id"
// @Param	tradeLimitID	formData	int 	    false	"限售模板id"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /ReplaceInsertFreight [post]
func (c *StoreController) ReplaceInsertFreight() {
	c.callReplaceInsertFreight(func(params *tStoreReplaceInsertFreightParams) (interface{}, string, error) {
		err := cms.ReplaceInsertFreight(params.StoreID, params.TemplateID, params.WarehouseID, params.TradeLimitID, params.VendorStoreID, params.FenceID)
		return nil, "", err
	})
}
