Files
OMS/app/crm/lib/gift/orderamount.php
2025-12-28 23:13:25 +08:00

55 lines
1.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Copyright © ShopeX http://www.shopex.cn. All rights reserved.
* See LICENSE file for license details.
*/
/**
* Created by PhpStorm.
* User: yaokangming
* Date: 2019/3/19
* Time: 18:04
*/
class crm_gift_orderamount
{
/**
* 处理
* @param mixed $ruleBase ruleBase
* @param mixed $sdf sdf
* @return mixed 返回值
*/
public function process($ruleBase, $sdf) {
$payed = floatval($sdf['payed']);
$total_amount = floatval($sdf['total_amount']);
#按付款总额判断
if($ruleBase['filter_arr']['order_amount']['type'] == 1){
if($ruleBase['filter_arr']['order_amount']['sign']=='bthan'){
if($payed<$ruleBase['filter_arr']['order_amount']['max_num']){
$reason = '不满足最低付款';
return array(false, $reason);
}
}else{
if($payed<$ruleBase['filter_arr']['order_amount']['min_num'] or $payed>=$ruleBase['filter_arr']['order_amount']['max_num']){
$reason = '不满足付款区间';
return array(false, $reason);
}
}
}
#按订单总额判断
if($ruleBase['filter_arr']['order_amount']['type'] == 2){
if($ruleBase['filter_arr']['order_amount']['sign']=='bthan'){
if($total_amount<$ruleBase['filter_arr']['order_amount']['max_num']){
$reason = '订单总额不满足最低付款';
return array(false, $reason);
}
}else{
if($total_amount<$ruleBase['filter_arr']['order_amount']['min_num'] or $total_amount>=$ruleBase['filter_arr']['order_amount']['max_num']){
$reason = '订单总额不满足付款区间';
return array(false, $reason);
}
}
}
return array(true);
}
}