示例#1
0
 public static function activedecre($actparam)
 {
     $organID = Yii::app()->user->getOrganID();
     //判断当前机构是否在活动参与对象范围内
     $data = self::activeorgan();
     //如果在
     if (in_array($organID, $data)) {
         //获取开启的优惠活动
         $act = self::active();
         $params = array();
         $act_arr = array();
         $payment = !empty($actparam['payment']) ? $actparam['payment'] + 1 : '2';
         //            $in_day=OrderService::is_inday($act['LastTime']);
         $in_day = OrderService::is_inday(time());
         //判断日期是否为当天 支付方式哪一种 则为参与活动
         if (!empty($act) && is_array($act) && ($act['Payment'] == $payment || $act['Payment'] == 1) && $in_day == 1) {
             $params['PromoID'] = intval($act['ID']);
             $params['TotalAmount'] = $actparam['total'];
             $params['CouponAmount'] = $actparam['coupon'];
             $params['Type'] = $act['Type'];
             switch ($act['Type']) {
                 case 1:
                     //满减送
                     $act = self::decre($params);
                     break;
                 case 2:
                     //每满减
                     $act = self::pperdecre($params);
                     break;
                 case 3:
                     //满送优惠券
                     $act = self::coupondecre($params);
                     break;
             }
         } else {
             $act = array();
         }
     }
     return $act;
 }
示例#2
0
文件: delivery.php 项目: zwq/unpei
 $res = BuyGoodsService::mycoupon();
 $coupon = $res->getData();
 if (in_array($organID, $data)) {
     $act = BuyGoodsService::active();
     if (!empty($act) && is_array($act)) {
         //判断当前日期是否在当天
         //$in_day=OrderService::is_inday($act['LastTime']);
         $current_date = OrderService::is_current_date();
         if ($current_date) {
             $curret_time = $current_date['LastTime'];
             $num = $current_date['Num'] + 1;
         } else {
             $curret_time = time();
             $num = 1;
         }
         $in_day = OrderService::is_inday($curret_time);
         //判断当前日期是否在当天 支付方式是哪一种则参与活动
         if (($act['Payment'] == $payment || $act['Payment'] == 1) && $in_day == 1) {
             $params['PromoID'] = intval($act['ID']);
             $params['TotalAmount'] = $counts;
             switch ($act['Type']) {
                 case 1:
                     //满多少减多少
                     $act_res = BuyGoodsService::decre($params);
                     if (!empty($act_res) && is_array($act_res)) {
                         if (!empty($act_res['DecrAmount'])) {
                             echo "<span style='color:#e97816'>参与促销优惠活动:-¥" . $act_res['DecrAmount'] . "<br>(单笔订单满 ¥" . $act_res['MinAmount'] . " 减¥" . $act_res['DecrAmount'] . ")</span>";
                         }
                     }
                     $order_decr = $act_res['DecrAmount'];
                     break;