示例#1
0
func (this *confManagerImpl) loadGlobSaleConf(dst *merchant.SaleConf) error {
	cfg := this._valRep.GetGlobMchSaleConf()
	// 是否启用分销
	if cfg.FxSalesEnabled {
		dst.FxSalesEnabled = 1
	} else {
		dst.FxSalesEnabled = 0
	}
	// 返现比例,0则不返现
	dst.CashBackPercent = cfg.CashBackPercent
	// 一级比例
	dst.CashBackTg1Percent = cfg.CashBackTg1Percent
	// 二级比例
	dst.CashBackTg2Percent = cfg.CashBackTg2Percent
	// 会员比例
	dst.CashBackMemberPercent = cfg.CashBackMemberPercent
	// 自动设置订单
	dst.AutoSetupOrder = cfg.AutoSetupOrder
	// 订单超时分钟数
	dst.OrderTimeOutMinute = cfg.OrderTimeOutMinute
	// 订单自动确认时间
	dst.OrderConfirmAfterMinute = cfg.OrderConfirmAfterMinute
	// 订单超时自动收货
	dst.OrderTimeOutReceiveHour = cfg.OrderTimeOutReceiveHour
	return nil
}
示例#2
0
// 验证销售设置
func (this *confManagerImpl) verifySaleConf(v *merchant.SaleConf) error {
	cfg := this._valRep.GetGlobMchSaleConf()
	if !cfg.FxSalesEnabled && v.FxSalesEnabled == 1 {
		return merchant.ErrEnabledFxSales
	}
	if v.OrderTimeOutMinute <= 0 {
		v.OrderTimeOutMinute = cfg.OrderTimeOutMinute
	}
	if v.OrderConfirmAfterMinute <= 0 {
		v.OrderConfirmAfterMinute = cfg.OrderConfirmAfterMinute
	}
	if v.OrderTimeOutReceiveHour <= 0 {
		v.OrderTimeOutReceiveHour = cfg.OrderTimeOutReceiveHour
	}
	if v.CashBackPercent >= 1 || (v.CashBackTg1Percent+
		v.CashBackTg2Percent+v.CashBackMemberPercent) > 1 {
		v.FxSalesEnabled = 0 //自动关闭分销
	}
	return nil
}