Exemplo n.º 1
0
 function _get_data()
 {
     $this->options = stripslashes_deep($this->options);
     $today = local_date('Y-m-d');
     $this->options['is_valid'] = (empty($this->options['start_date']) || $this->options['start_date'] <= $today) && (empty($this->options['end_date']) || $this->options['end_date'] >= $today);
     return $this->options;
 }
Exemplo n.º 2
0
          messages.id="' . $id . '" and
          messages_to.person="' . $_SESSION['userid'] . '"
         ';
     $db->select($query);
     if ($db->num_rows == 1) {
         $this->data = $db->data[0];
     }
 }
 function load_to()
 {
     global $db;
     $query = 'person.id, 
          person.first_name, 
          person.last_name
         from messages_to
         left join person on
          messages_to.person=person.id
         where messages_to.message="' . $this->data['id'] . '"';
     $db->select($query);
     $this->to = $db->data;
 }
 function format()
 {
     $fdata = $this->data;
     $fdata['text_html'] = html_br($fdata['text']);
     $fdata['created_html'] = local_date($fdata['created'], 'ymdHi');
     $fdata['author_first_name_html'] = mask_html($fdata['author_first_name']);
     $fdata['author_last_name_html'] = mask_html($fdata['author_last_name']);
     $to_list = array();
     $seperator = array();
     foreach ($this->to as $i => $to) {
         $to['first_name'] = mask_html($to['first_name']);
         $to['last_name'] = mask_html($to['last_name']);
         $to['seperator'] = $seperator;
         $seperator = array(array());
Exemplo n.º 3
0
 /**
  * 取得当前活动信息
  *
  * @access  public
  *
  * @return 活动名称
  */
 function get_snatch($id)
 {
     $sql = "SELECT g.goods_id, g.goods_sn, g.is_real, g.goods_name, g.extension_code, g.market_price, g.shop_price AS org_price, product_id, " . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "g.promote_price, g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb,g.goods_img, " . "ga.act_name AS snatch_name, ga.start_time, ga.end_time, ga.ext_info, ga.act_desc AS `desc` " . "FROM " . $this->pre . "goods_activity AS ga " . "LEFT JOIN " . $this->pre . "goods AS g " . "ON g.goods_id = ga.goods_id " . "LEFT JOIN " . $this->pre . "member_price AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE ga.act_id = '{$id}' AND g.is_delete = 0";
     $goods = $this->row($sql);
     if ($goods) {
         $promote_price = bargain_price($goods['promote_price'], $goods['promote_start_date'], $goods['promote_end_date']);
         $goods['formated_market_price'] = price_format($goods['market_price']);
         $goods['formated_shop_price'] = price_format($goods['shop_price']);
         $goods['formated_promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
         $goods['goods_thumb'] = get_image_path($goods['goods_id'], $goods['goods_thumb'], true);
         $goods['goods_img'] = get_image_path($goods['goods_id'], $goods['goods_img'], true);
         $goods['url'] = url('goods/index', array('id' => $goods['goods_id']));
         $goods['start_time'] = local_date(C('time_format'), $goods['start_time']);
         $info = unserialize($goods['ext_info']);
         if ($info) {
             foreach ($info as $key => $val) {
                 $goods[$key] = $val;
             }
             $goods['is_end'] = gmtime() > $goods['end_time'];
             $goods['formated_start_price'] = price_format($goods['start_price']);
             $goods['formated_end_price'] = price_format($goods['end_price']);
             $goods['formated_max_price'] = price_format($goods['max_price']);
         }
         /* 将结束日期格式化为格林威治标准时间时间戳 */
         $goods['gmt_end_time'] = $goods['end_time'];
         $goods['end_time'] = local_date(C('time_format'), $goods['end_time']);
         $goods['snatch_time'] = sprintf(L('snatch_start_time'), $goods['start_time'], $goods['end_time']);
         return $goods;
     } else {
         return false;
     }
 }
Exemplo n.º 4
0
function check_order($con, $goods)
{
    $msg = '';
    $btime = "";
    $ntimestamp = gmtime() + 32 * 3600;
    //24小时后时间戳
    $now = gmtime();
    $tmd = date('Y-m-d', $now + 32 * 3600);
    if (empty($con)) {
        $msg .= '请您填写收货信息|';
    } else {
        $btime = $con['best_time'];
    }
    $btimestamp = strtotime($btime);
    if (empty($goods)) {
        $msg .= '购物车没有商品|';
    }
    if (empty($btime) || strlen($btime) < 19) {
        $msg .= '请填写送货时间|';
    }
    if ($btimestamp < gmtime() + 13.25 * 3600) {
        $msg .= '送货时间不足5小时,重新填写送货时间';
    }
    if (local_date('H', $now) > 21 && substr($btime, 0, 13) < $tmd . ' 14' && $con['country'] == '441') {
        $msg .= '请注意,此时订货最早14点送货,请修改送货时间 ';
    }
    if (local_date('H', $now) < 10 && substr($btime, 0, 13) < date('Y-m-d', $now + 8 * 3600) . ' 14' && $con['country'] == '441') {
        $msg .= '请注意,此时订货最早14点送货,请修改送货时间 ';
    }
    return $msg;
}
Exemplo n.º 5
0
/**
 *  获取用户指定范围的订单列表
 *
 * @access  public
 * @param   int         $user_id        用户ID号
 * @param   int         $num            列表最大数量
 * @param   int         $start          列表起始位置
 * @return  array       $order_list     订单列表
 */
function get_user_orders_1($user_id, $num = 10, $start = 0, $where = '')
{
    /* 取得订单列表 */
    $arr = array();
    $sql = "SELECT o.*, ifnull(ssc.value,'网站自营') as shopname, " . "(goods_amount + shipping_fee + insure_fee + pay_fee + pack_fee + card_fee + tax - discount) AS total_fee " . " FROM " . $GLOBALS['ecs']->table('order_info') . ' as o ' . " LEFT JOIN " . $GLOBALS['ecs']->table('supplier_shop_config') . 'as ssc ' . " ON o.supplier_id=ssc.supplier_id AND ssc.code='shop_name' " . " WHERE user_id = '{$user_id}' {$where} ORDER BY add_time DESC";
    $res = $GLOBALS['db']->SelectLimit($sql, $num, $start);
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        if ($row['order_status'] == OS_UNCONFIRMED) {
            $row['handler'] = "<a href=\"user.php?act=cancel_order&order_id=" . $row['order_id'] . "\" onclick=\"if (!confirm('" . $GLOBALS['_LANG']['confirm_cancel'] . "')) return false;\">" . $GLOBALS['_LANG']['cancel'] . "</a>";
        } else {
            if ($row['order_status'] == OS_SPLITED) {
                /* 对配送状态的处理 */
                if ($row['shipping_status'] == SS_SHIPPED) {
                    $back_num = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('back_order') . " WHERE order_id = " . $row['order_id'] . " AND status_back < 6 AND status_back != 3");
                    if ($back_num > 0) {
                        $back_info = "此单存在正在退货商品,确认收货退货申请将取消。";
                    } else {
                        $back_info = "";
                    }
                    @($okgoods_time = $GLOBALS['db']->getOne("select value from " . $GLOBALS['ecs']->table('shop_config') . " where code='okgoods_time'"));
                    @($row_time = $okgoods_time - (local_date('d', gmtime()) - local_date('d', $row['shipping_time'])));
                    @($row['handler'] = "<strong><img src='themesmobile/" . $GLOBALS['_CFG']['template'] . "/images/time.png' height='30px' style='vertical-align:middle;'/>还剩" . $row_time . "天自动收货</strong><a href=\"user.php?act=affirm_received&order_id=" . $row['order_id'] . "\" onclick=\"if (!confirm('" . $back_info . $GLOBALS['_LANG']['confirm_received'] . "')) return false;\" style='display:inline-block; margin-top:12px; width:80px; height:25px; font-size:14px; line-height:25px; border:1px solid #F60; color:#fff; text-align:center;border-radius:5px; background:#F60 '>" . $GLOBALS['_LANG']['received'] . "</a>");
                } elseif ($row['shipping_status'] == SS_RECEIVED) {
                    @($row['handler'] = '<span style="color:red">' . $GLOBALS['_LANG']['ss_received'] . '</span>');
                } else {
                    if ($row['pay_status'] == PS_UNPAYED) {
                        @($row['handler'] = "<a href=\"user.php?act=order_detail&order_id=" . $row['order_id'] . '">' . $GLOBALS['_LANG']['pay_money'] . '</a>');
                    } else {
                        @($row['handler'] = "<a href=\"user.php?act=order_detail&order_id=" . $row['order_id'] . '">' . $GLOBALS['_LANG']['view_order'] . '</a>');
                    }
                }
            } else {
                $row['handler'] = '<span style="color:red">' . $GLOBALS['_LANG']['os'][$row['order_status']] . '</span>';
            }
        }
        $row['shipping_status'] = $row['shipping_status'] == SS_SHIPPED_ING ? SS_PREPARING : $row['shipping_status'];
        $row['order_status1'] = $row['order_status'];
        $row['order_status'] = $GLOBALS['_LANG']['os'][$row['order_status']] . ',' . $GLOBALS['_LANG']['ps'][$row['pay_status']] . ',' . $GLOBALS['_LANG']['ss'][$row['shipping_status']];
        $cod_code = $GLOBALS['db']->getOne("select pay_code from " . $GLOBALS['ecs']->table('payment') . " where pay_id=" . $row['pay_id']);
        $weixiu_time = $GLOBALS['db']->getOne("select value from " . $GLOBALS['ecs']->table('ecsmart_shop_config') . " where code='weixiu_time'");
        $row['weixiu_time'] = $weixiu_time - (local_date('d', gmtime()) - local_date('d', $order['shipping_time_end'])) <= 0 ? 0 : 1;
        $back_can_a = 1;
        $comment_s = 0;
        $shaidan_s = 0;
        $goods_list_r = get_order_goods($row);
        foreach ($goods_list_r as $g_val) {
            if ($g_val['back_can'] == 0) {
                $back_can_a = 0;
            }
            if ($g_val['comment_state'] == 0 && $g_val['is_back'] == 0 && $comment_s == 0) {
                $comment_s = $g_val['rec_id'];
            }
            if ($g_val['shaidan_state'] == 0 && $g_val['is_back'] == 0 && $shaidan_s == 0) {
                $shaidan_s = $g_val['rec_id'];
            }
        }
        $arr[$row['order_id']] = array('order_id' => $row['order_id'], 'order_sn' => $row['order_sn'], 'shopname' => $row['shopname'], 'order_time' => local_date($GLOBALS['_CFG']['time_format'], $row['add_time']), 'order_status' => str_replace(',', ' ', $row['order_status']), 'order_status1' => $row['order_status1'], 'back_can_a' => $back_can_a, 'comment_s' => $comment_s, 'shaidan_s' => $shaidan_s, 'total_fee' => price_format($row['total_fee'], false), 'goods_list' => $goods_list_r, 'pay_online' => $row['pay_online'], 'is_suborder' => $row['parent_order_id'] ? "(子订单)" : "", 'pay_status' => $row['pay_status'], 'handler' => $row['handler'], 'shipping_id' => $row['shipping_id'], 'shipping_name' => $row['shipping_name'], 'shipping_status' => $row['shipping_status'], 'pay_id' => $cod_code == 'cod' ? '' : $row['pay_id'], 'invoice_no' => $row['invoice_no'], 'weixiu_time' => $row['weixiu_time'], 'supplier_id' => $row['supplier_id'], 'count' => count($goods_list_r));
    }
    return $arr;
}
Exemplo n.º 6
0
 function index_comments($num)
 {
     /*$sql = 'SELECT a.*,b.goods_id,b.goods_thumb,b.goods_name FROM '. $GLOBALS['ecs']->table('comment') .
       ' AS a,'. $GLOBALS['ecs']->table('goods') .'AS b WHERE a.status = 1 AND a.parent_id = 0 and a.comment_type=0 and a.id_value=b.goods_id'.
       ' GROUP BY a.id_value ORDER by a.comment_id DESC';*/
     $sql = 'SELECT DISTINCT a.id_value,b.goods_id,b.goods_thumb,b.goods_name,b.shop_price FROM ' . $GLOBALS['ecs']->table('comment') . ' AS a,' . $GLOBALS['ecs']->table('goods') . 'AS b WHERE a.status = 1 AND a.parent_id = 0 and a.comment_type=0 and a.id_value=b.goods_id' . ' ORDER by a.comment_id DESC';
     if ($num > 0) {
         $sql .= ' LIMIT ' . $num;
     }
     $res = $GLOBALS['db']->getAll($sql);
     $comments = array();
     foreach ($res as $idx => $row) {
         $comments[$idx]['id_value'] = $row['id_value'];
         $sqli = 'SELECT add_time,content,user_name FROM ' . $GLOBALS['ecs']->table('comment') . ' where id_value=' . $row['id_value'] . ' and status = 1 AND parent_id = 0 and comment_type=0 ORDER by add_time desc';
         $resi = $GLOBALS['db']->getRow($sqli);
         $result = mysql_query($sqli);
         $getall = $GLOBALS['db']->num_rows($result);
         $comments[$idx]['number'] = $getall;
         //条数
         $comments[$idx]['add_time'] = local_date('Y-m-d', $resi['add_time']);
         $comments[$idx]['content'] = $resi['content'];
         $comments[$idx]['user_name'] = $resi['user_name'];
         $comments[$idx]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
         $comments[$idx]['goods_name'] = $row['goods_name'];
         $comments[$idx]['shop_price'] = $row['shop_price'];
         $comments[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
     }
     return $comments;
 }
 /**
  * 查询评论内容
  *
  * @access  public
  * @params  integer     $id
  * @params  integer     $type
  * @params  integer     $page
  * @return  array
  */
 function assign_comment($id, $type, $rank = 0, $page = 1) {
     $rank_info = '';
     if ($rank == '1') {
         $rank_info = ' AND (comment_rank= 5 OR comment_rank = 4)';
     }
     if ($rank == '2') {
         $rank_info = ' AND (comment_rank= 2 OR comment_rank = 3)';
     }
     if ($rank == '3') {
         $rank_info = ' AND comment_rank= 1 ';
     }
     /* 取得评论列表 */
     $res = $this->row('SELECT COUNT(*) as count FROM ' . $this->pre .
             "comment WHERE id_value = '$id' AND comment_type = '$type' AND status = 1 AND parent_id = 0" . $rank_info);
     $count = $res['count'];
     $size = C('comments_number') > 0 ? C('comments_number') : 5;
     $page_count = ($count > 0) ? intval(ceil($count / $size)) : 1;
     $start = ($page - 1) * $size;
     $sql = 'SELECT * FROM ' . $this->pre .
             "comment WHERE id_value = '$id' AND comment_type = '$type' AND status = 1 AND parent_id = 0" . $rank_info .
             " ORDER BY comment_id DESC LIMIT $start , $size";
     $res = $this->query($sql);
     $arr = array();
     $ids = '';
     foreach ($res as $key => $row) {
         $ids .= $ids ? ",$row[comment_id]" : $row['comment_id'];
         $arr[$row['comment_id']]['id'] = $row['comment_id'];
         $arr[$row['comment_id']]['email'] = $row['email'];
         $arr[$row['comment_id']]['username'] = $row['user_name'];
         $arr[$row['comment_id']]['content'] = str_replace('\r\n', '<br />', htmlspecialchars($row['content']));
         $arr[$row['comment_id']]['content'] = nl2br(str_replace('\n', '<br />', $arr[$row['comment_id']]['content']));
         $arr[$row['comment_id']]['rank'] = $row['comment_rank'];
         $arr[$row['comment_id']]['add_time'] = local_date(C('time_format'), $row['add_time']);
     }
     /* 取得已有回复的评论 */
     if ($ids) {
         $sql = 'SELECT * FROM ' . $this->pre .
                 "comment WHERE parent_id IN( $ids )";
         $res = $this->query($sql);
         foreach ($res as $row) {
             $arr[$row['parent_id']]['re_content'] = nl2br(str_replace('\n', '<br />', htmlspecialchars($row['content'])));
             $arr[$row['parent_id']]['re_add_time'] = local_date(C('time_format'), $row['add_time']);
             $arr[$row['parent_id']]['re_email'] = $row['email'];
             $arr[$row['parent_id']]['re_username'] = $row['user_name'];
         }
     }
     /* 分页样式 */
     //$pager['styleid'] = isset(C('page_style'))? intval(C('page_style')) : 0;
     $pager['page'] = $page;
     $pager['size'] = $size;
     $pager['record_count'] = $count;
     $pager['page_count'] = $page_count;
     $pager['page_first'] = "javascript:gotoPage(1,$id,$type,$rank)";
     $pager['page_prev'] = $page > 1 ? "javascript:gotoPage(" . ($page - 1) . ",$id,$type,$rank)" : 'javascript:;';
     $pager['page_next'] = $page < $page_count ? 'javascript:gotoPage(' . ($page + 1) . ",$id,$type,$rank)" : 'javascript:;';
     $pager['page_last'] = $page < $page_count ? 'javascript:gotoPage(' . $page_count . ",$id,$type,$rank)" : 'javascript:;';
     $cmt = array('comments' => $arr, 'pager' => $pager);
     return $cmt;
 }
Exemplo n.º 8
0
 /**
  * 支付提交方法
  * @param array $data 支付相关参数
  */
 public function PaySubmit($data = array())
 {
     /**************************请求参数**************************/
     //商户用户唯一编号
     $user_id = $data['user_id'];
     //支付类型
     $busi_partner = 101001;
     //商户订单号
     $no_order = $data['TransID'];
     //商户网站订单系统中唯一订单号,必填
     //付款金额
     $money_order = $data['OrderMoney'];
     //必填
     //商品名称
     $name_goods = '用户充值';
     //订单地址
     $url_order = '';
     //订单描述
     $info_order = '';
     //银行网银编码
     $bank_code = '';
     //支付方式
     $pay_type = 'D';
     //卡号
     $card_no = '';
     //银行账号姓名
     $acct_name = $data['acct_name'];
     //身份证号
     $id_no = $data['id_no'];
     //协议号
     $no_agree = '';
     //修改标记
     $flag_modify = '';
     //风险控制参数
     $risk_item = $data['risk_item'];
     //分账信息数据
     $shareing_data = '';
     //返回修改信息地址
     $back_url = '';
     //订单有效期
     $valid_order = $this->llpay_config['valid_order'];
     //服务器异步通知页面路径
     $notify_url = $data['ReturnUrl'];
     //需http://格式的完整路径,不能加?id=123这类自定义参数
     //页面跳转同步通知页面路径
     $return_url = $data['PageUrl'];
     //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/
     /************************************************************/
     date_default_timezone_set('PRC');
     //构造要请求的参数数组,无需改动
     $parameter = array("version" => trim($this->llpay_config['version']), "oid_partner" => trim($this->llpay_config['oid_partner']), "sign_type" => trim($this->llpay_config['sign_type']), "userreq_ip" => trim($this->llpay_config['userreq_ip']), "id_type" => trim($this->llpay_config['id_type']), "valid_order" => trim($this->llpay_config['valid_order']), "user_id" => $user_id, "timestamp" => local_date('YmdHis', time()), "busi_partner" => $busi_partner, "no_order" => $no_order, "dt_order" => local_date('YmdHis', $data['dt_order']), "name_goods" => $name_goods, "info_order" => $info_order, "money_order" => $money_order, "notify_url" => $notify_url, "url_return" => $return_url, "url_order" => $url_order, "bank_code" => $bank_code, "pay_type" => $pay_type, "no_agree" => $no_agree, "shareing_data" => $shareing_data, "risk_item" => $risk_item, "id_no" => $id_no, "acct_name" => $acct_name, "flag_modify" => $flag_modify, "card_no" => $card_no, "back_url" => $back_url);
     //建立请求
     $llpaySubmit = new LLpaySubmit($this->llpay_config);
     $html_text = $llpaySubmit->buildRequestForm($parameter, "post", "确认");
     echo $html_text;
     exit;
 }
Exemplo n.º 9
0
/**
 * 返回尾文件
 *
 * @return  string
 */
function get_footer()
{
    if (substr($_SERVER['SCRIPT_NAME'], strrpos($_SERVER['SCRIPT_NAME'], '/')) == '/index.php') {
        $footer = "<br/>Powered by ECShop[" . local_date('H:i') . "]";
    } else {
        $footer = "<br/><select><option onpick='index.php'>快速通道</option><option onpick='goods_list.php?type=best'>精品推荐</option><option onpick='goods_list.php?type=promote'>商家促销</option><option onpick='goods_list.php?type=hot'>热门商品</option><option onpick='goods_list.php?type=new'>最新产品</option></select>";
    }
    return $footer;
}
Exemplo n.º 10
0
/**
 * 返回尾文件
 *
 * @return  string
 */
function get_footer()
{
    if (substr($_SERVER['SCRIPT_NAME'], strrpos($_SERVER['SCRIPT_NAME'], '/')) == '/index.php') {
        $footer = "<br/>Phát triển bởi ECMS.ASIA [" . local_date('H:i') . "]";
    } else {
        $footer = "<br/><select><option onpick='index.php'>Chuyển nhanh</option><option onpick='goods_list.php?type=best'>Sản phẩm tốt nhất</option><option onpick='goods_list.php?type=promote'>Sản phẩm k.mại</option><option onpick='goods_list.php?type=hot'>Sản phẩm hot</option><option onpick='goods_list.php?type=new'>Sản phẩm mới</option></select>";
    }
    return $footer;
}
Exemplo n.º 11
0
 /**
  * 生成支付代码
  * @param   array   $order      订单信息
  * @param   array   $payment    支付方式信息
  */
 function get_code($order, $payment)
 {
     $c_mid = trim($payment['c_mid']);
     //商户编号,在申请商户成功后即可获得,可以在申请商户成功的邮件中获取该编号
     $c_order = $order['order_sn'];
     //商户网站依照订单号规则生成的订单号,不能重复
     $c_name = "";
     //商户订单中的收货人姓名
     $c_address = "";
     //商户订单中的收货人地址
     $c_tel = "";
     //商户订单中的收货人电话
     $c_post = "";
     //商户订单中的收货人邮编
     $c_email = "";
     //商户订单中的收货人Email
     $c_orderamount = $order['order_amount'];
     //商户订单总金额
     if (!empty($order['add_time'])) {
         $c_ymd = local_date('Ymd', $order['add_time']);
     } else {
         $c_ymd = local_date('Ymd', gmtime());
     }
     //$c_ymd      = substr($order['order_sn'], 0, 8); //商户订单的产生日期,格式为"yyyymmdd",如20050102
     $c_moneytype = $payment['c_moneytype'];
     //支付币种,0为人民币
     $c_retflag = "1";
     //商户订单支付成功后是否需要返回商户指定的文件,0:不用返回 1:需要返回
     $c_paygate = empty($payment['c_paygate']) ? '' : trim($payment['c_paygate']);
     //如果在商户网站选择银行则设置该值,具体值可参见《云网支付@网技术接口手册》附录一;如果来云网支付@网选择银行此项为空值。
     $c_returl = return_url(basename(__FILE__, '.php'));
     //如果c_retflag为1时,该地址代表商户接收云网支付结果通知的页面,请提交完整文件名(对应范例文件:GetPayNotify.php)
     $c_memo1 = abs(crc32(trim($payment['c_memo1'])));
     //商户需要在支付结果通知中转发的商户参数一
     if (empty($order['order_id'])) {
         $c_memo2 = "voucher";
         //商户需要在支付结果通知中转发的商户参数二
     } else {
         $c_memo2 = '';
     }
     $c_pass = trim($payment['c_pass']);
     //支付密钥,请登录商户管理后台,在帐户信息-基本信息-安全信息中的支付密钥项
     $notifytype = "0";
     //0普通通知方式/1服务器通知方式,空值为普通通知方式
     $c_language = trim($payment['c_language']);
     //对启用了国际卡支付时,可使用该值定义消费者在银行支付时的页面语种,值为:0银行页面显示为中文/1银行页面显示为英文
     $srcStr = $c_mid . $c_order . $c_orderamount . $c_ymd . $c_moneytype . $c_retflag . $c_returl . $c_paygate . $c_memo1 . $c_memo2 . $notifytype . $c_language . $c_pass;
     //说明:如果您想指定支付方式(c_paygate)的值时,需要先让用户选择支付方式,然后再根据用户选择的结果在这里进行MD5加密,也就是说,此时,本页面应该拆分为两个页面,分为两个步骤完成。
     //--对订单信息进行MD5加密
     //商户对订单信息进行MD5签名后的字符串
     $c_signstr = md5($srcStr);
     $def_url = '<form name="payForm1" action="https://www.cncard.net/purchase/getorder.asp" method="POST" target="_blank">' . "<input type=\"hidden\" name=\"c_mid\" value=\"{$c_mid}\" />" . "<input type=\"hidden\" name=\"c_order\" value=\"{$c_order}\" />" . "<input type=\"hidden\" name=\"c_name\" value=\"{$c_name}\" />" . "<input type=\"hidden\" name=\"c_address\" value=\"{$c_address}\" />" . "<input type=\"hidden\" name=\"c_tel\" value=\"{$c_tel}\" />" . "<input type=\"hidden\" name=\"c_post\" value=\"{$c_post}\" />" . "<input type=\"hidden\" name=\"c_email\" value=\"{$c_email}\" />" . "<input type=\"hidden\" name=\"c_orderamount\" value=\"{$c_orderamount}\" />" . "<input type=\"hidden\" name=\"c_ymd\" value=\"{$c_ymd}\" />" . "<input type=\"hidden\" name=\"c_moneytype\" value=\"{$c_moneytype}\" />" . "<input type=\"hidden\" name=\"c_retflag\" value=\"{$c_retflag}\" />" . "<input type=\"hidden\" name=\"c_paygate\" value=\"{$c_paygate}\" />" . "<input type=\"hidden\" name=\"c_returl\" value=\"{$c_returl}\" />" . "<input type=\"hidden\" name=\"c_memo1\" value=\"{$c_memo1}\" />" . "<input type=\"hidden\" name=\"c_memo2\" value=\"{$c_memo2}\" />" . "<input type=\"hidden\" name=\"c_language\" value=\"{$c_language}\" />" . "<input type=\"hidden\" name=\"notifytype\" value=\"{$notifytype}\" />" . "<input type=\"hidden\" name=\"c_signstr\" value=\"{$c_signstr}\" />" . "<input type=\"submit\" name=\"submit\" value=\"" . $GLOBALS['_LANG']['cncard_button'] . "\" />" . "</form>";
     return $def_url;
 }
Exemplo n.º 12
0
 private function favourable_list($offset = '0, 12')
 {
     /* 查询 */
     $sql = "SELECT * " . "FROM " . $this->model->pre . "favourable_activity WHERE 1" . " ORDER BY act_id  DESC  LIMIT {$offset}";
     $res = $this->model->query($sql);
     $list = array();
     foreach ($res as $row) {
         $row['start_time'] = local_date('Y-m-d H:i', $row['start_time']);
         $row['end_time'] = local_date('Y-m-d H:i', $row['end_time']);
         $list[] = $row;
     }
     return $list;
 }
Exemplo n.º 13
0
function get_article_info($article_id)
{
    $sql = "SELECT a.*, IFNULL(AVG(r.comment_rank), 0) AS comment_rank " . "FROM " . $GLOBALS['ecs']->table('article') . " AS a " . "LEFT JOIN " . $GLOBALS['ecs']->table('comment') . " AS r ON r.id_value = a.article_id AND comment_type = 1 " . "WHERE a.is_open = 1 AND a.article_id = '{$article_id}' GROUP BY a.article_id";
    $row = $GLOBALS['db']->getRow($sql);
    if ($row !== false) {
        $row['comment_rank'] = ceil($row['comment_rank']);
        $row['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']);
        if (empty($row['author']) || $row['author'] == '_SHOPHELP') {
            $row['author'] = $GLOBALS['_CFG']['shop_name'];
        }
    }
    return $row;
}
Exemplo n.º 14
0
function get_deposit_by_user_id($user_id, $page, $size)
{
    $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('deposit') . " WHERE user_id = '{$user_id}'";
    $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size);
    $arr = array();
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $arr[$row['id']]['id'] = $row['id'];
        $arr[$row['id']]['add_time'] = local_date('Y-m-d', $row['add_time']);
        $arr[$row['id']]['deposit_money'] = price_format($row['deposit_money']);
        $arr[$row['id']]['status'] = $row['status'];
    }
    return $arr;
}
Exemplo n.º 15
0
 /**
  * 获取指定id package 的信息
  *
  * @access  public
  * @param   int         $id         package_id
  *
  * @return array       array(package_id, package_name, goods_id,start_time, end_time, min_price, integral)
  */
 function get_package_info($id)
 {
     global $ecs, $db, $_CFG;
     $id = is_numeric($id) ? intval($id) : 0;
     $now = gmtime();
     $sql = "SELECT act_id AS id,  act_name AS package_name, goods_id , goods_name, start_time, end_time, act_desc, ext_info" . " FROM " . $this->pre . "goods_activity WHERE act_id='{$id}' AND act_type = " . GAT_PACKAGE;
     $package = $this->row($sql);
     /* 将时间转成可阅读格式 */
     if ($package['start_time'] <= $now && $package['end_time'] >= $now) {
         $package['is_on_sale'] = "1";
     } else {
         $package['is_on_sale'] = "0";
     }
     $package['start_time'] = local_date('Y-m-d H:i', $package['start_time']);
     $package['end_time'] = local_date('Y-m-d H:i', $package['end_time']);
     $row = unserialize($package['ext_info']);
     unset($package['ext_info']);
     if ($row) {
         foreach ($row as $key => $val) {
             $package[$key] = $val;
         }
     }
     $sql = "SELECT pg.package_id, pg.goods_id, pg.goods_number, pg.admin_id, " . " g.goods_sn, g.goods_name, g.market_price, g.goods_thumb, g.is_real, " . " IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS rank_price " . " FROM " . $this->pre . "package_goods AS pg " . "   LEFT JOIN " . $this->pre . "goods AS g " . "   ON g.goods_id = pg.goods_id " . " LEFT JOIN " . $this->pre . "member_price AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . " WHERE pg.package_id = " . $id . " " . " ORDER BY pg.package_id, pg.goods_id";
     $goods_res = $this->query($sql);
     $market_price = 0;
     $real_goods_count = 0;
     $virtual_goods_count = 0;
     foreach ($goods_res as $key => $val) {
         $goods_res[$key]['goods_thumb'] = get_image_path($val['goods_id'], $val['goods_thumb'], true);
         $goods_res[$key]['market_price_format'] = price_format($val['market_price']);
         $goods_res[$key]['rank_price_format'] = price_format($val['rank_price']);
         $market_price += $val['market_price'] * $val['goods_number'];
         /* 统计实体商品和虚拟商品的个数 */
         if ($val['is_real']) {
             $real_goods_count++;
         } else {
             $virtual_goods_count++;
         }
     }
     if ($real_goods_count > 0) {
         $package['is_real'] = 1;
     } else {
         $package['is_real'] = 0;
     }
     $package['goods_list'] = $goods_res;
     $package['market_package'] = $market_price;
     $package['market_package_format'] = price_format($market_price);
     $package['package_price_format'] = price_format($package['package_price']);
     return $package;
 }
 /**
  * 获取优惠活动的信息和活动banner
  * @param unknown $size
  * @param unknown $page
  * @return Ambigous <multitype:, type, string, unknown>
  */
 function get_activity_info($size, $page) {
     $start = ($page - 1) * $size;
     $sql = 'SELECT f.* , a.act_banner' . ' FROM ' . $this->pre . 'favourable_activity f LEFT JOIN ' . $this->pre . 'touch_activity a on a.act_id = f.act_id ' . " ORDER BY f.sort_order ASC, f.end_time DESC LIMIT $start , $size";
     $res = $this->query($sql);
     $arr = array();
     foreach ($res as $row) {
         $arr[$row['act_id']]['start_time'] = local_date('Y-m-d H:i', $row['start_time']);
         $arr[$row['act_id']]['end_time'] = local_date('Y-m-d H:i', $row['end_time']);
         $arr[$row['act_id']]['url'] = url('activity/goods_list', array('id' => $row['act_id']));
         $arr[$row['act_id']]['act_name'] = $row['act_name'];
         $arr[$row['act_id']]['act_id'] = $row['act_id'];
         $arr[$row['act_id']]['act_banner'] = get_banner_path($row['act_banner']);
     }
     return $arr;
 }
    /**
     * 团购列表
     */
    public function index() {
        $condition['act_type'] = GAT_GROUP_BUY;
        $res = $this->model->table('goods_activity')->field('act_id , act_name, goods_name, end_time ,ext_info')->where($condition)->order('act_id DESC')->select();
        foreach ($res as $row) {
            $ext_info = unserialize($row['ext_info']);
            $stat = model('GroupBuyBase')->group_buy_stat($row['act_id'], $ext_info['deposit']);
            $arr = array_merge($row, $stat, $ext_info);

            /* 处理价格阶梯 */
            $price_ladder = $arr['price_ladder'];
            if (!is_array($price_ladder) || empty($price_ladder)) {
                $price_ladder = array(array('amount' => 0, 'price' => 0));
            } else {
                foreach ($price_ladder AS $key => $amount_price) {
                    $price_ladder[$key]['formated_price'] = price_format($amount_price['price']);
                }
            }

            /* 计算当前价 */
            $cur_price = $price_ladder[0]['price'];    // 初始化
            $cur_amount = $stat['valid_goods'];         // 当前数量
            foreach ($price_ladder AS $amount_price) {
                if ($cur_amount >= $amount_price['amount']) {
                    $cur_price = $amount_price['price'];
                } else {
                    break;
                }
            }

            $arr['cur_price'] = $cur_price;

            $status = model('GroupBuyBase')->group_buy_status($arr);

            $arr['start_time'] = local_date('Y-m-d H:i', $arr['start_time']);
            $arr['end_time'] = local_date('Y-m-d H:i', $arr['end_time']);
            $arr['cur_status'] = L('gbs.' . $status);

            $list[] = $arr;
        }
        /* 模板赋值 */
        $filter['page'] = '{page}';
        $offset = $this->pageLimit(url('index', $filter), 12);
        $total = $this->model->table('goods_activity')->where($condition)->count();
        $this->assign('page', $this->pageShow($total));
        $this->assign('list', $list);
        $this->assign('ur_here', L('group_buy_list'));
        $this->display();
    }
Exemplo n.º 18
0
function get_article_info($article_id)
{
    /* 获得文章的信息 */
    $sql = 'SELECT a.*, IFNULL(AVG(r.comment_rank), 0) AS comment_rank ' . 'FROM ' . $GLOBALS['ecs']->table('article') . ' AS a ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('comment') . ' AS r ON r.id_value = a.article_id AND comment_type = 1 ' . "WHERE a.is_open = 1 AND a.article_id = '{$article_id}' GROUP BY a.article_id";
    $row = $GLOBALS['db']->getRow($sql);
    if ($row !== false) {
        $row['comment_rank'] = ceil($row['comment_rank']);
        // 用户评论级别取整
        $row['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']);
        // 修正添加时间显示
        /* 作者信息如果为空,则用网站名称替换 */
        if (empty($row['author']) || $row['author'] == '_SHOPHELP') {
            $row['author'] = $GLOBALS['_CFG']['shop_name'];
        }
    }
    return $row;
}
Exemplo n.º 19
0
function queryListByCatId($cat_id)
{
    $sql = 'SELECT a.article_id, a.title, ac.cat_name, a.add_time, a.file_url, a.open_type, ac.cat_id, ac.cat_name, a.content ' . ' FROM ' . $GLOBALS['ecs']->table('article') . ' AS a, ' . $GLOBALS['ecs']->table('article_cat') . ' AS ac' . " WHERE a.is_open = 1 AND a.cat_id = ac.cat_id AND ac.cat_id = {$cat_id}" . ' ORDER BY a.article_type DESC, a.add_time DESC LIMIT 2';
    $res = $GLOBALS['db']->getAll($sql);
    $arr = array();
    foreach ($res as $idx => $row) {
        $arr[$idx]['id'] = $row['article_id'];
        $arr[$idx]['title'] = $row['title'];
        $arr[$idx]['short_title'] = $GLOBALS['_CFG']['article_title_length'] > 0 ? sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title'];
        $arr[$idx]['cat_name'] = $row['cat_name'];
        $arr[$idx]['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']);
        $arr[$idx]['url'] = $row['open_type'] != 1 ? build_uri('article', array('aid' => $row['article_id']), $row['title']) : trim($row['file_url']);
        $arr[$idx]['cat_url'] = build_uri('article_cat', array('acid' => $row['cat_id']), $row['cat_name']);
        $arr[$idx]['content'] = strip_tags($row['content']);
        $arr[$idx]['file_url'] = $row['file_url'];
    }
    return $arr;
}
Exemplo n.º 20
0
 /**
  * 支付提交方法
  * @param array $data 支付相关参数
  */
 public function PaySubmit($data = array())
 {
     //商户用户唯一编号
     $user_id = $data['user_id'];
     //支付类型
     $busi_partner = 101001;
     //商户订单号
     $no_order = $data['TransID'];
     //商户网站订单系统中唯一订单号,必填
     //付款金额
     $money_order = $data['OrderMoney'];
     //必填
     //商品名称
     $name_goods = '用户充值';
     //订单描述
     $info_order = '';
     //卡号
     $card_no = isset($data['card_no']) ? $data['card_no'] : '';
     //姓名
     $acct_name = $data['acct_name'];
     //身份证号
     $id_no = $data['id_no'];
     //协议号
     $no_agree = '';
     //风险控制参数
     $risk_item = $data['risk_item'];
     //订单有效期
     $valid_order = $this->llpay_config['valid_order'];
     //服务器异步通知页面路径
     $notify_url = $data['ReturnUrl'];
     //需http://格式的完整路径,不能加?id=123这类自定义参数
     //页面跳转同步通知页面路径
     $return_url = $data['PageUrl'];
     //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/
     /************************************************************/
     //构造要请求的参数数组,无需改动
     $parameter = array("oid_partner" => trim($this->llpay_config['oid_partner']), "app_request" => trim($this->llpay_config['app_request']), "sign_type" => trim($this->llpay_config['sign_type']), "valid_order" => trim($this->llpay_config['valid_order']), "user_id" => $user_id, "busi_partner" => $busi_partner, "no_order" => $no_order, "dt_order" => local_date('YmdHis', $data['dt_order']), "name_goods" => $name_goods, "info_order" => $info_order, "money_order" => $money_order, "notify_url" => $notify_url, "url_return" => $return_url, "card_no" => $card_no, "acct_name" => $acct_name, "id_no" => $id_no, "no_agree" => $no_agree, "risk_item" => $risk_item, "valid_order" => $valid_order);
     //建立请求
     $llpaySubmit = new LLpaySubmit($this->llpay_config);
     $html_text = $llpaySubmit->buildRequestForm($parameter, "post", "确认");
     echo $html_text;
     exit;
 }
Exemplo n.º 21
0
/**
 * 获得商品的详细信息
 *
 * @access  public
 * @param   integer     $goods_id
 * @return  void
 */
function get_goods_info_detail($goods_id)
{
    $time = gmtime();
    $sql = 'SELECT g.*, c.measure_unit, b.brand_id, b.brand_name AS goods_brand, m.type_money AS bonus_money, ' . 'IFNULL(AVG(r.comment_rank), 0) AS comment_rank, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS rank_price " . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('category') . ' AS c ON g.cat_id = c.cat_id ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON g.brand_id = b.brand_id ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('comment') . ' AS r ' . 'ON r.id_value = g.goods_id AND comment_type = 0 AND r.parent_id = 0 AND r.status = 1 ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('bonus_type') . ' AS m ' . "ON g.bonus_type_id = m.type_id AND m.send_start_date <= '{$time}' AND m.send_end_date >= '{$time}'" . " LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE g.goods_id = '{$goods_id}' AND g.is_delete = 0 " . "GROUP BY g.goods_id";
    $row = $GLOBALS['db']->getRow($sql);
    if ($row !== false) {
        /* 用户评论级别取整 */
        $row['comment_rank'] = ceil($row['comment_rank']) == 0 ? 5 : ceil($row['comment_rank']);
        /* 获得商品的销售价格 */
        $row['market_price'] = price_format($row['market_price']);
        $row['shop_price_formated'] = price_format($row['shop_price']);
        /* 修正促销价格 */
        if ($row['promote_price'] > 0) {
            $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
        } else {
            $promote_price = 0;
        }
        $row['promote_price_org'] = $promote_price;
        $row['promote_price'] = price_format($promote_price);
        /* 修正重量显示 */
        $row['goods_weight'] = intval($row['goods_weight']) > 0 ? $row['goods_weight'] . $GLOBALS['_LANG']['kilogram'] : $row['goods_weight'] * 1000 . $GLOBALS['_LANG']['gram'];
        /* 修正上架时间显示 */
        $row['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']);
        /* 促销时间倒计时 */
        $time = gmtime();
        if ($time >= $row['promote_start_date'] && $time <= $row['promote_end_date']) {
            $row['gmt_end_time'] = $row['promote_end_date'];
        } else {
            $row['gmt_end_time'] = 0;
        }
        /* 是否显示商品库存数量 */
        $row['goods_number'] = $GLOBALS['_CFG']['use_storage'] == 1 ? $row['goods_number'] : '';
        /* 修正积分:转换为可使用多少积分(原来是可以使用多少钱的积分) */
        $row['integral'] = $GLOBALS['_CFG']['integral_scale'] ? round($row['integral'] * 100 / $GLOBALS['_CFG']['integral_scale']) : 0;
        /* 修正优惠券 */
        $row['bonus_money'] = $row['bonus_money'] == 0 ? 0 : price_format($row['bonus_money'], false);
        return $row;
    } else {
        return false;
    }
}
Exemplo n.º 22
0
function share_list()
{
    $result = false;
    if ($result === false) {
        //$filter['cat_id']           = empty($_REQUEST['cat_id']) ? 0 : intval($_REQUEST['cat_id']);
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $where = ' 1 ';
        /* 记录总数 */
        $sql = "SELECT COUNT(*) FROM " . $GLOBALS['hhs']->table('share_info') . " AS s WHERE  {$where}";
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        $sql = "SELECT s.*, u.user_name,u.openid,u.headimgurl " . " FROM " . $GLOBALS['hhs']->table('share_info') . " AS s left join " . $GLOBALS['hhs']->table('users') . " as u on s.user_id=u.user_id " . " WHERE  {$where}" . " ORDER BY {$filter['sort_by']} {$filter['sort_order']} " . " LIMIT " . $filter['start'] . ",{$filter['page_size']}";
    }
    $row = $GLOBALS['db']->getAll($sql);
    foreach ($row as $k => $v) {
        $row[$k]['add_time'] = local_date("Y-m-d H:i:s", $row[$k]['add_time']);
    }
    return array('row' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
Exemplo n.º 23
0
/**
 * 查询评论内容
 *
 * @access  public
 * @params  integer     $id
 * @params  integer     $type
 * @params  integer     $page
 * @return  array
 */
function assign_comment_wap($id, $type)
{
    /* 取得评论列表 */
    $count = $GLOBALS['db']->getOne('SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('comment') . " WHERE id_value = '{$id}' AND comment_type = '{$type}' AND status = 1 AND parent_id = 0");
    $size = !empty($GLOBALS['_CFG']['comments_number']) ? $GLOBALS['_CFG']['comments_number'] : 5;
    $page_count = $count > 0 ? intval(ceil($count / $size)) : 1;
    $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('comment') . " WHERE id_value = '{$id}' AND comment_type = '{$type}' AND status = 1 AND parent_id = 0" . ' ORDER BY comment_id DESC';
    $res = $GLOBALS['db']->query($sql);
    $arr = array();
    $ids = '';
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        $ids .= $ids ? ",{$row['comment_id']}" : $row['comment_id'];
        $arr[$row['comment_id']]['id'] = $row['comment_id'];
        $arr[$row['comment_id']]['email'] = $row['email'];
        $arr[$row['comment_id']]['username'] = $row['user_name'];
        $arr[$row['comment_id']]['content'] = str_replace('\\r\\n', '<br />', htmlspecialchars($row['content']));
        $arr[$row['comment_id']]['content'] = nl2br(str_replace('\\n', '<br />', $arr[$row['comment_id']]['content']));
        $arr[$row['comment_id']]['rank'] = $row['comment_rank'];
        $arr[$row['comment_id']]['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']);
    }
    /* 取得已有回复的评论 */
    if ($ids) {
        $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('comment') . " WHERE parent_id IN( {$ids} )";
        $res = $GLOBALS['db']->query($sql);
        while ($row = $GLOBALS['db']->fetch_array($res)) {
            $arr[$row['parent_id']]['re_content'] = nl2br(str_replace('\\n', '<br />', htmlspecialchars($row['content'])));
            $arr[$row['parent_id']]['re_add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']);
            $arr[$row['parent_id']]['re_email'] = $row['email'];
            $arr[$row['parent_id']]['re_username'] = $row['user_name'];
        }
    }
    /* 分页样式 */
    //$pager['styleid'] = isset($GLOBALS['_CFG']['page_style'])? intval($GLOBALS['_CFG']['page_style']) : 0;
    $pager['size'] = $size;
    $pager['record_count'] = $count;
    $pager['page_count'] = $page_count;
    $cmt = array('comments' => $arr, 'pager' => $pager);
    return $cmt;
}
Exemplo n.º 24
0
/**
 *
 *
 * @access  public
 * @param
 *
 * @return void
 */
function msg_list($from, $table)
{
    /* 过滤条件 */
    $filter['keywords'] = empty($_REQUEST['search_keywords']) ? '' : trim($_REQUEST['search_keywords']);
    $filter['msg_type'] = isset($_REQUEST['msg_type']) ? intval($_REQUEST['msg_type']) : -1;
    if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
        $filter['keywords'] = json_str_iconv($filter['keywords']);
    }
    $filter['sort'] = empty($_REQUEST['sort']) || trim($_REQUEST['sort']) == 'msg_reply' ? 'msg_id' : trim($_REQUEST['sort']);
    $filter['order'] = empty($_REQUEST['order']) ? 'DESC' : trim($_REQUEST['order']);
    $filter['page'] = empty($_REQUEST['page']) ? '1' : trim($_REQUEST['page']);
    $filter['page_size'] = empty($_REQUEST['rows']) ? '25' : trim($_REQUEST['rows']);
    $where = " WHERE parent_id = '0' AND msg_from='" . $from . "' and user_id='" . $_SESSION["admin_id"] . "' ";
    $filter['from'] = $from;
    if ($filter['keywords']) {
        $where .= " AND (msg_title LIKE '%" . mysql_like_quote($filter['keywords']) . "%' ";
        $where .= " OR msg_content LIKE '%" . mysql_like_quote($filter['keywords']) . "%') ";
    }
    if ($filter['msg_type'] != -1) {
        $where .= " AND msg_type = '{$filter['msg_type']}' ";
    }
    $sql = "SELECT count(*) FROM " . $table . " AS f " . $where;
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    /* 分页大小 */
    $filter = page_and_size($filter);
    $sql = "SELECT * " . " FROM " . $table . $where . " ORDER by " . $filter['sort'] . ' ' . $filter['order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size'];
    $msg_list = $GLOBALS['db']->getAll($sql);
    foreach ($msg_list as $key => $value) {
        $reply = $GLOBALS['db']->getOne("select msg_content  from " . $table . " where parent_id=" . $value["msg_id"] . " limit 1");
        $msg_list[$key]['msg_status'] = $reply ? 1 : 0;
        $msg_list[$key]['msg_reply'] = $reply;
        $msg_list[$key]['msg_time'] = local_date($GLOBALS['_CFG']['time_format'], $value['msg_time']);
        $msg_list[$key]['msg_type'] = $GLOBALS['_LANG']['type'][$value['msg_type']];
    }
    $filter['keywords'] = stripslashes($filter['keywords']);
    $arr = array('rows' => $msg_list, 'filter' => $filter, 'page' => $filter['page_count'], 'total' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 25
0
function get_next_time($cron)
{
    $y = local_date('Y', $GLOBALS['timestamp']);
    $mo = local_date('n', $GLOBALS['timestamp']);
    $d = local_date('j', $GLOBALS['timestamp']);
    $w = local_date('w', $GLOBALS['timestamp']);
    $h = local_date('G', $GLOBALS['timestamp']);
    $sh = $sm = 0;
    $sy = $y;
    if ($cron['day']) {
        $sd = $cron['day'];
        $smo = $mo + 1;
    } else {
        $sd = $d;
        $smo = $mo;
        if ($cron['week'] != '') {
            $sd += $cron['week'] - $w + 7;
        }
    }
    if ($cron['hour']) {
        $sh = $cron['hour'];
        if (empty($cron['day']) && $cron['week'] == '') {
            $sd++;
        }
    }
    //$next = gmmktime($sh,$sm,0,$smo,$sd,$sy);
    $next = local_strtotime("{$sy}-{$smo}-{$sd} {$sh}:{$sm}:0");
    if ($next < $GLOBALS['timestamp']) {
        if ($cron['m']) {
            return $GLOBALS['timestamp'] + 60 - intval(local_date('s', $GLOBALS['timestamp']));
        } else {
            return $GLOBALS['timestamp'];
        }
    } else {
        return $next;
    }
}
Exemplo n.º 26
0
 /**
  * 获取指定 id snatch 活动的结果
  *
  * @access public
  * @param int $id
  *            snatch_id
  *            
  * @return array array(user_name, bie_price, bid_time, num)
  *         num通常为1,如果为2表示有2个用户取到最小值,但结果只返回最早出价用户。
  */
 function get_snatch_result($id)
 {
     $sql = 'SELECT u.user_id, u.user_name, u.email, lg.bid_price, lg.bid_time, count(*) as num' . ' FROM ' . $this->pre . 'snatch_log AS lg ' . ' LEFT JOIN ' . $this->pre . 'users AS u ON lg.user_id = u.user_id' . " WHERE lg.snatch_id = '{$id}'" . ' GROUP BY lg.bid_price' . ' ORDER BY num ASC, lg.bid_price ASC, lg.bid_time ASC LIMIT 1';
     $rec = $this->row($sql);
     if ($rec) {
         $rec['bid_time'] = local_date(C('time_format'), $rec['bid_time']);
         $rec['formated_bid_price'] = price_format($rec['bid_price'], false);
         /* 活动信息 */
         $sql = 'SELECT ext_info " .  " FROM ' . $this->pre . "goods_activity WHERE act_id= '{$id}' AND act_type=" . GAT_SNATCH . " LIMIT 1";
         $result = $this->row($sql);
         $row = $result['ext_info'];
         $info = unserialize($row);
         if (!empty($info['max_price'])) {
             $rec['buy_price'] = $rec['bid_price'] > $info['max_price'] ? $info['max_price'] : $rec['bid_price'];
         } else {
             $rec['buy_price'] = $rec['bid_price'];
         }
         /* 检查订单 */
         $sql = "SELECT COUNT(*) as count" . " FROM " . $this->pre . "order_info WHERE extension_code = 'snatch'" . " AND extension_id = '{$id}'" . " AND order_status " . db_create_in(array(OS_CONFIRMED, OS_UNCONFIRMED));
         $result = $this->row($sql);
         $rec['order_count'] = $result['count'];
     }
     return $rec;
 }
Exemplo n.º 27
0
function setSomeGoodsValue(&$goods, $dsct, $shangouActivty)
{
    $dsct['discountVal'] = convertStringToIntegerArr($dsct['discountVal']);
    foreach ($goods as $k => $v) {
        $goods[$k]['url'] = build_uri('goods', array('gid' => $goods[$k]['goods_id']), $goods[$k]['goods_name']);
        switch ($dsct['discountType']) {
            case 1:
                //现金减免
                $goods[$k]['discountPrice'] = $goods[$k]['market_price'] - $dsct['discountVal'][$k] > 0 ? $goods[$k]['market_price'] - $dsct['discountVal'][$k] : 0;
                break;
            case 2:
                //打折
                $goods[$k]['discountPrice'] = $goods[$k]['market_price'] * floatval($dsct['discountVal'][$k]) / 100.0;
                break;
        }
        $goods[$k]['market_price'] = price_format($goods[$k]['market_price']);
        $goods[$k]['shop_price'] = price_format($goods[$k]['shop_price']);
        $goods[$k]['discountPrice'] = price_format($goods[$k]['discountPrice']);
        $goods[$k]['discount'] = intval($dsct['discountVal'][$k] / 10);
        $goods[$k]['begin_date'] = local_date("m月d日 H : i", $shangouActivty['start_time']);
        $goods[$k]['start_time'] = $shangouActivty['start_time'];
        $goods[$k]['end_time'] = $shangouActivty['end_time'];
    }
}
Exemplo n.º 28
0
/**
 *
 * @access  public
 * @param   int         $user_id         用户ID
 * @param   int         $num             列表显示条数
 * @param   int         $start           显示起始位置
 *
 * @return  array       $arr             红保列表
 */
function get_user_bouns_list($user_id, $num = 10, $start = 0)
{
    $sql = "SELECT u.bonus_sn, u.order_id, b.type_name, b.type_money, b.min_goods_amount, b.use_start_date, b.use_end_date " . " FROM " . $GLOBALS['ecs']->table('user_bonus') . " AS u ," . $GLOBALS['ecs']->table('bonus_type') . " AS b" . " WHERE u.bonus_type_id = b.type_id AND u.user_id = '" . $user_id . "'";
    $res = $GLOBALS['db']->selectLimit($sql, $num, $start);
    $arr = array();
    $day = getdate();
    $cur_date = local_mktime(23, 59, 59, $day['mon'], $day['mday'], $day['year']);
    while ($row = $GLOBALS['db']->fetchRow($res)) {
        /* 先判断是否被使用,然后判断是否开始或过期 */
        if (empty($row['order_id'])) {
            /* 没有被使用 */
            if ($row['use_start_date'] > $cur_date) {
                $row['status'] = L('not_start');
            } else {
                if ($row['use_end_date'] < $cur_date) {
                    $row['status'] = L('overdue');
                } else {
                    $row['status'] = L('not_use');
                }
            }
        } else {
            $row['status'] = '<a href="user.php?act=order_detail&order_id=' . $row['order_id'] . '" >' . L('had_use') . '</a>';
        }
        $row['use_startdate'] = local_date(C('date_format'), $row['use_start_date']);
        $row['use_enddate'] = local_date(C('date_format'), $row['use_end_date']);
        $arr[] = $row;
    }
    return $arr;
}
Exemplo n.º 29
0
/**
 * 获取专题列表.
 */
function get_topic_list()
{
    $result = get_filter();
    if ($result === false) {
        /* 查询条件 */
        $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'topic_id' : trim($_REQUEST['sort_by']);
        $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
        $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('topic');
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter = page_and_size($filter);
        $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('topic') . " ORDER BY {$filter['sort_by']} {$filter['sort_order']}";
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $query = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    $res = array();
    while ($topic = $GLOBALS['db']->fetch_array($query)) {
        $topic['start_time'] = local_date('Y-m-d', $topic['start_time']);
        $topic['end_time'] = local_date('Y-m-d', $topic['end_time']);
        $topic['url'] = $GLOBALS['ecs']->url() . 'topic.php?topic_id=' . $topic['topic_id'];
        $res[] = $topic;
    }
    $arr = array('item' => $res, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    return $arr;
}
Exemplo n.º 30
0
     if ($row['invoice_no'] && $row['shipping_id'] > 0) {
         $sql = "SELECT shipping_code FROM " . $ecs->table('shipping') . " WHERE shipping_id = '{$row['shipping_id']}'";
         $shipping_code = $db->getOne($sql);
         $plugin = ROOT_PATH . 'includes/modules/shipping/' . $shipping_code . '.php';
         if (file_exists($plugin)) {
             include_once $plugin;
             $shipping = new $shipping_code();
             $order_query['invoice_no'] = $shipping->query((string) $row['invoice_no']);
         } else {
             $order_query['invoice_no'] = (string) $row['invoice_no'];
         }
     }
     $order_query['user_id'] = $row['user_id'];
     /* 如果是匿名用户显示发货时间 */
     if ($row['user_id'] == 0 && $row['shipping_time'] > 0) {
         $order_query['shipping_date'] = local_date($GLOBALS['_CFG']['date_format'], $row['shipping_time']);
     }
     $smarty->assign('order_query', $order_query);
     $result['content'] = $smarty->fetch('library/order_query.lbi');
     die($json->encode($result));
 } elseif ($action == 'transform_points') {
     $rule = array();
     if (!empty($_CFG['points_rule'])) {
         $rule = unserialize($_CFG['points_rule']);
     }
     $cfg = array();
     if (!empty($_CFG['integrate_config'])) {
         $cfg = unserialize($_CFG['integrate_config']);
         $_LANG['exchange_points'][0] = empty($cfg['uc_lang']['credits'][0][0]) ? $_LANG['exchange_points'][0] : $cfg['uc_lang']['credits'][0][0];
         $_LANG['exchange_points'][1] = empty($cfg['uc_lang']['credits'][1][0]) ? $_LANG['exchange_points'][1] : $cfg['uc_lang']['credits'][1][0];
     }