/** * @brief 处理条件 * @param IQuery $db 数据库IQuery对象 * @param string $timeCols 时间字段名称 * @param string $start 开始日期 Y-m-d * @param string $end 结束日期 Y-m-d */ private static function ParseCondition($db, $timeCols = 'time', $start = '', $end = '') { $result = array(); //获取时间段 $date = self::dateParse($start, $end); $startArray = explode('-', $date[0]); $endArray = explode('-', $date[1]); $diffSec = ITime::getDiffSec($date[0], $date[1]); switch (self::groupByCondition($diffSec)) { //按照年 case "y": $startCondition = $startArray[0]; $endCondition = $endArray[0] + 1; $db->fields .= ',DATE_FORMAT(`' . $timeCols . '`,"%Y") as xValue'; $db->group = "DATE_FORMAT(`" . $timeCols . "`,'%Y') having `" . $timeCols . "` >= '{$startCondition}' and `" . $timeCols . "` < '{$endCondition}'"; break; //按照月 //按照月 case "m": $startCondition = $startArray[0] . '-' . $startArray[1]; $endCondition = $endArray[0] . '-' . ($endArray[1] + 1); $db->fields .= ',DATE_FORMAT(`' . $timeCols . '`,"%Y-%m") as xValue'; $db->group = "DATE_FORMAT(`" . $timeCols . "`,'%Y-%m') having `" . $timeCols . "` >= '{$startCondition}' and `" . $timeCols . "` < '{$endCondition}'"; break; //按照日 //按照日 case "d": $startCondition = $startArray[0] . '-' . $startArray[1] . '-' . $startArray[2]; $endCondition = $endArray[0] . '-' . $endArray[1] . '-' . ($endArray[2] + 1); $db->fields .= ',DATE_FORMAT(`' . $timeCols . '`,"%m-%d") as xValue'; $db->group = "DATE_FORMAT(`" . $timeCols . "`,'Y-%m-%d') having `" . $timeCols . "` >= '{$startCondition}' and `" . $timeCols . "` < '{$endCondition}'"; break; } $data = $db->find(); foreach ($data as $key => $val) { $result[$val['xValue']] = intval($val['yValue']); } return $result; }
if ($promo == 'groupon') { ?> <?php if (isset($regiment)) { ?> <!--团购正常--> <li class="current"> <span class="bold red2">团购价:</span><b class="price red2"><span class="f30">¥</span><?php echo isset($regiment['regiment_price']) ? $regiment['regiment_price'] : ""; ?> </b> <?php $item = Api::run('getRegimentRowById', array('#id#', $active_id)); ?> <?php $free_time = ITime::getDiffSec($item['end_time']); ?> <span class="time" id="promotionb">还剩 <i class="bold red2" id='cd_hour_promotionb'><?php echo floor($free_time / 3600); ?> </i>小时<i class="bold red2" id='cd_minute_promotionb'><?php echo floor($free_time % 3600 / 60); ?> </i>分<i class="bold red2" id='cd_second_promotionb'><?php echo $free_time % 60; ?> </i>秒结束</span> </li> <li> 销售价:<span class="price light_gray"><s class="f30">¥<label id="data_sellPrice"><?php echo isset($sell_price) ? $sell_price : "";
/** * @brief 获取订单中的支付信息 * @payment_id 支付方式信息 * @type 信息获取方式 order:订单支付;recharge:在线充值; * @argument 参数 * @return array 支付提交信息 * R表示店铺 ; P表示用户; */ public function getPaymentInfo($payment_id, $type, $argument) { if ($type == 'order') { $order_id = $argument; //获取订单信息 $orderObj = new IModel('order'); $orderRow = $orderObj->getObj('id = ' . $order_id . ' and status = 1'); if (empty($orderRow)) { IError::show(403, '订单信息不正确,不能进行支付'); } //团购 if ($orderRow['type'] == 1) { $regimentRelationObj = new IModel('regiment_user_relation'); $relationRow = $regimentRelationObj->getObj('order_no = "' . $orderRow['order_no'] . '"'); if (empty($relationRow)) { IError::show(403, '团购订单已经失效'); exit; } else { if (abs(ITime::getDiffSec($relationRow['join_time'])) > regiment::time_limit() * 60) { IError::show(403, '支付时间已经过期'); exit; } } } $payment['M_Remark'] = $orderRow['postscript']; $payment['M_OrderId'] = $orderRow['id']; $payment['M_OrderNO'] = $orderRow['order_no']; $payment['M_Amount'] = $orderRow['order_amount']; //用户信息 $payment['P_Mobile'] = $orderRow['mobile']; $payment['P_Name'] = $orderRow['accept_name']; $payment['P_PostCode'] = $orderRow['postcode']; $payment['P_Telephone'] = $orderRow['telphone']; $payment['P_Address'] = $orderRow['address']; $payment['P_Email'] = ''; } else { if ($type == 'recharge') { if (ISafe::get('user_id') == null) { IError::show(403, '请登录系统'); } if (!isset($argument['account']) || $argument['account'] <= 0) { IError::show(403, '请填入正确的充值金额'); } $rechargeObj = new IModel('online_recharge'); $reData = array('user_id' => ISafe::get('user_id'), 'recharge_no' => Block::createOrderNum(), 'account' => $argument['account'], 'time' => ITime::getDateTime(), 'payment_name' => $argument['payment_type'], 'status' => 0); $rechargeObj->setData($reData); $r_id = $rechargeObj->add(); //充值时用户id跟随交易号一起发送,以"_"分割 $payment['M_OrderNO'] = 'recharge_' . $reData['recharge_no']; $payment['M_OrderId'] = $r_id; $payment['M_Amount'] = $reData['account']; } } $siteConfigObj = new Config("site_config"); $site_config = $siteConfigObj->getInfo(); //交易信息 $payment['M_Def_Amount'] = 0.01; $payment['M_Time'] = time(); $payment['M_Goods'] = ''; $payment['M_Language'] = "zh_CN"; $payment['M_Paymentid'] = $payment_id; //店铺信息 $payment['R_Address'] = isset($site_config['address']) ? $site_config['address'] : ''; $payment['R_Name'] = isset($site_config['name']) ? $site_config['name'] : ''; $payment['R_Mobile'] = isset($site_config['mobile']) ? $site_config['mobile'] : ''; $payment['R_Telephone'] = isset($site_config['phone']) ? $site_config['phone'] : ''; $payment['R_Postcode'] = ''; $payment['R_Email'] = ''; return $payment; }