コード例 #1
0
ファイル: userinfo.cls.php プロジェクト: polarlight1989/08cms
 function gt_discount($dcmode = 1)
 {
     global $grouptypes;
     if (empty($this->info['mid']) || empty($dcmode)) {
         return 0;
     }
     $dcarr = array();
     foreach ($grouptypes as $gtid => $grouptype) {
         if (!$grouptype['forbidden'] && !empty($this->info['grouptype' . $gtid])) {
             $usergroup = read_cache('usergroup', $gtid, $this->info['grouptype' . $gtid]);
             !empty($usergroup['discount']) && ($dcarr[] = $usergroup['discount']);
         }
     }
     $discount = caldiscount($dcarr, $dcmode);
     return $discount;
 }
コード例 #2
0
ファイル: archive.fun.php プロジェクト: polarlight1989/08cms
function cn_discount(&$item, $dcmode = 1)
{
    global $catalogs, $cotypes;
    if (empty($item['aid']) || !$dcmode) {
        return 0;
    }
    $dcarr = array();
    if (!empty($item['caid'])) {
        $catalog = read_cache('catalog', $item['caid'], '', $item['sid']);
        !empty($catalog['discount']) && ($dcarr[] = $catalog['discount']);
    }
    foreach ($cotypes as $coid => $cotype) {
        //折扣取多选第一个id
        if ($ccid = cnoneid(@$item["ccid{$coid}"])) {
            $coclass = read_cache('coclass', $coid, $ccid);
            !empty($coclass['discount']) && ($dcarr[] = $coclass['discount']);
        }
    }
    $discount = caldiscount($dcarr, $dcmode);
    return $discount;
}