当前位置: 首页>>代码示例>>PHP>>正文


PHP coupon::SignatureCard方法代码示例

本文整理汇总了PHP中coupon::SignatureCard方法的典型用法代码示例。如果您正苦于以下问题:PHP coupon::SignatureCard方法的具体用法?PHP coupon::SignatureCard怎么用?PHP coupon::SignatureCard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在coupon的用法示例。


在下文中一共展示了coupon::SignatureCard方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pay


//.........这里部分代码省略.........
     }
     $you = 0;
     if ($pay['card']['switch'] == 2) {
         if ($_W['card_permission'] == 1 && !empty($params['module'])) {
             $cards = pdo_fetchall('SELECT a.id,a.card_id,a.cid,b.type,b.title,b.extra,b.is_display,b.status,b.date_info FROM ' . tablename('coupon_modules') . ' AS a LEFT JOIN ' . tablename('coupon') . ' AS b ON a.cid = b.id WHERE a.acid = :acid AND a.module = :modu AND b.is_display = 1 AND b.status = 3 ORDER BY a.id DESC', array(':acid' => $_W['acid'], ':modu' => $params['module']));
             $flag = 0;
             if (!empty($cards)) {
                 foreach ($cards as $temp) {
                     $temp['date_info'] = iunserializer($temp['date_info']);
                     if ($temp['date_info']['time_type'] == 1) {
                         $starttime = strtotime($temp['date_info']['time_limit_start']);
                         $endtime = strtotime($temp['date_info']['time_limit_end']);
                         if (TIMESTAMP < $starttime || TIMESTAMP > $endtime) {
                             continue;
                         } else {
                             $param = array(':acid' => $_W['acid'], ':openid' => $_W['openid'], ':card_id' => $temp['card_id']);
                             $num = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('coupon_record') . ' WHERE acid = :acid AND openid = :openid AND card_id = :card_id AND status = 1', $param);
                             if ($num <= 0) {
                                 continue;
                             } else {
                                 $flag = 1;
                                 $card = $temp;
                                 break;
                             }
                         }
                     } else {
                         $deadline = intval($temp['date_info']['deadline']);
                         $limit = intval($temp['date_info']['limit']);
                         $param = array(':acid' => $_W['acid'], ':openid' => $_W['openid'], ':card_id' => $temp['card_id']);
                         $record = pdo_fetchall('SELECT addtime,id,code FROM ' . tablename('coupon_record') . ' WHERE acid = :acid AND openid = :openid AND card_id = :card_id AND status = 1', $param);
                         if (!empty($record)) {
                             foreach ($record as $li) {
                                 $time = strtotime(date('Y-m-d', $li['addtime']));
                                 $starttime = $time + $deadline * 86400;
                                 $endtime = $time + $deadline * 86400 + $limit * 86400;
                                 if (TIMESTAMP < $starttime || TIMESTAMP > $endtime) {
                                     continue;
                                 } else {
                                     $flag = 1;
                                     $card = $temp;
                                     break;
                                 }
                             }
                         }
                         if ($flag) {
                             break;
                         }
                     }
                 }
             }
             if ($flag) {
                 if ($card['type'] == 'discount') {
                     $you = 1;
                     $card['fee'] = sprintf("%.2f", $params['fee'] * ($card['extra'] / 100));
                 } elseif ($card['type'] == 'cash') {
                     $cash = iunserializer($card['extra']);
                     if ($params['fee'] >= $cash['least_cost']) {
                         $you = 1;
                         $card['fee'] = sprintf("%.2f", $params['fee'] - $cash['reduce_cost']);
                     }
                 }
                 load()->classs('coupon');
                 $acc = new coupon($_W['acid']);
                 $card_id = $card['card_id'];
                 $time = TIMESTAMP;
                 $randstr = random(8);
                 $sign = array($card_id, $time, $randstr, $acc->account['key']);
                 $signature = $acc->SignatureCard($sign);
                 if (is_error($signature)) {
                     $you = 0;
                 }
             }
         }
     }
     $we_you = 0;
     if ($pay['card']['switch'] == 3) {
         if (!empty($params['module'])) {
             $cards = pdo_fetchall('SELECT a.id,a.couponid,b.type,b.title,b.discount,b.condition,b.starttime,b.endtime FROM ' . tablename('activity_coupon_modules') . ' AS a LEFT JOIN ' . tablename('activity_coupon') . ' AS b ON a.couponid = b.couponid WHERE a.uniacid = :uniacid AND a.module = :modu AND b.starttime <= :time AND b.endtime >= :time  ORDER BY a.id DESC', array(':uniacid' => $_W['uniacid'], ':modu' => $params['module'], ':time' => TIMESTAMP));
             if (!empty($cards) && $_W['member']['uid']) {
                 foreach ($cards as $card) {
                     $has = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('activity_coupon_record') . ' WHERE uid = :uid AND uniacid = :aid AND couponid = :cid AND status = 1', array(':uid' => $_W['member']['uid'], ':aid' => $_W['uniacid'], ':cid' => $card['couponid']));
                     if ($has > 0) {
                         if ($card['type'] == '1') {
                             $we_you = 1;
                             $card['fee'] = sprintf("%.2f", $params['fee'] * $card['discount']);
                             break;
                         } elseif ($card['type'] == '2') {
                             if ($params['fee'] >= $cash['condition']) {
                                 $we_you = 1;
                                 $card['fee'] = sprintf("%.2f", $params['fee'] - $card['discount']);
                                 break;
                             }
                         }
                     }
                 }
             }
         }
     }
     include $this->template('common/paycenter');
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:101,代码来源:account.class.php


注:本文中的coupon::SignatureCard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。