コード例 #1
0
 /**
  * 得到虚拟商品购买数据(商品、店铺、会员)
  * @param int $goods_id 商品ID
  * @param int $quantity 购买数量
  * @param int $member_id 会员ID
  * @return array
  */
 public function getBuyStepData($goods_id, $quantity, $member_id)
 {
     $goods_info = Model('goods')->getVirtualGoodsOnlineInfoByID($goods_id);
     if (empty($goods_info)) {
         return uk86_callback(false, '该商品不符合购买条件,可能的原因有:下架、不存在、过期等');
     }
     if ($goods_info['virtual_limit'] > $goods_info['goods_storage']) {
         $goods_info['virtual_limit'] = $goods_info['goods_storage'];
     }
     //取得抢购信息
     $goods_info = $this->_getGroupbuyInfo($goods_info);
     $quantity = abs(intval($quantity));
     $quantity = $quantity == 0 ? 1 : $quantity;
     $quantity = $quantity > $goods_info['virtual_limit'] ? $goods_info['virtual_limit'] : $quantity;
     if ($quantity > $goods_info['goods_storage']) {
         return uk86_callback(false, '该商品库存不足');
     }
     $goods_info['quantity'] = $quantity;
     $goods_info['goods_total'] = uk86_ncPriceFormat($goods_info['goods_price'] * $goods_info['quantity']);
     $goods_info['goods_image_url'] = uk86_cthumb($goods_info['goods_image'], 240, $goods_info['store_id']);
     $return = array();
     $return['goods_info'] = $goods_info;
     $return['store_info'] = Model('store')->getStoreOnlineInfoByID($goods_info['store_id'], 'store_name,store_id,member_id');
     $return['member_info'] = Model('member')->getMemberInfoByID($member_id);
     //        $model_payment = Model('payment');
     //        $pd_payment_info = Model('payment')->getPaymentOpenInfo(array('payment_code'=>'predeposit'));
     //        if (empty($pd_payment_info)) {
     //            $return['member_info']['available_predeposit'] = 0;
     //            $return['member_info']['available_rc_balance'] = 0;
     //        }
     return uk86_callback(true, '', $return);
 }
コード例 #2
0
ファイル: wap_cart.php プロジェクト: wangjiang988/ukshop
 public function indexOp()
 {
     $model_cart = Model('cart');
     $logic_buy_1 = uk86_logic('buy_1');
     //购物车列表
     $cart_list = $model_cart->listCart('db', array('buyer_id' => $_SESSION['member_id']));
     //购物车列表 [得到最新商品属性及促销信息]
     $cart_list = $logic_buy_1->getGoodsCartList($cart_list);
     //购物车商品以店铺ID分组显示,并计算商品小计,店铺小计与总价由JS计算得出
     $store_cart_list = array();
     foreach ($cart_list as $cart) {
         $cart['goods_total'] = uk86_ncPriceFormat($cart['goods_price'] * $cart['goods_num']);
         $store_cart_list[$cart['store_id']][] = $cart;
     }
     Tpl::output('store_cart_list', $store_cart_list);
     //店铺信息
     $store_list = Model('store')->getStoreMemberIDList(array_keys($store_cart_list));
     Tpl::output('store_list', $store_list);
     //取得店铺级活动 - 可用的满即送活动
     $mansong_rule_list = $logic_buy_1->getMansongRuleList(array_keys($store_cart_list));
     Tpl::output('mansong_rule_list', $mansong_rule_list);
     //取得哪些店铺有满免运费活动
     $free_freight_list = $logic_buy_1->getFreeFreightActiveList(array_keys($store_cart_list));
     Tpl::output('free_freight_list', $free_freight_list);
     Tpl::showpage('cart.index');
 }
コード例 #3
0
 /**
  * 添加兑换码退款
  *
  */
 public function add_refundOp()
 {
     $model_vr_refund = Model('vr_refund');
     $order_id = intval($_GET['order_id']);
     if ($order_id < 1) {
         //参数验证
         showDialog(Uk86Language::uk86_get('wrong_argument'), 'index.php?act=member_vr_refund&op=index', 'error');
     }
     $condition = array();
     $condition['buyer_id'] = $_SESSION['member_id'];
     $condition['order_id'] = $order_id;
     $order = $model_vr_refund->getRightOrderList($condition);
     $order_id = $order['order_id'];
     if (!$order['if_refund']) {
         //检查状态,防止页面刷新不及时造成数据错误
         showDialog(Uk86Language::uk86_get('wrong_argument'), 'index.php?act=member_vr_order&op=index', 'error');
     }
     if (uk86_chksubmit() && $order['if_refund']) {
         $code_list = $order['code_list'];
         $refund_array = array();
         $goods_num = 0;
         //兑换码数量
         $refund_amount = 0;
         //退款金额
         $code_sn = '';
         $rec_id_array = $_POST['rec_id'];
         if (!empty($rec_id_array) && is_array($rec_id_array)) {
             //选择退款的兑换码
             foreach ($rec_id_array as $key => $value) {
                 $code = $code_list[$value];
                 if (!empty($code)) {
                     $goods_num += 1;
                     $refund_amount += $code['pay_price'];
                     //实际支付金额
                     $code_sn .= $code['vr_code'] . ',';
                     //兑换码编号
                 }
             }
         }
         if ($goods_num < 1) {
             showDialog(Uk86Language::uk86_get('wrong_argument'), 'reload', 'error');
         }
         $refund_array['code_sn'] = rtrim($code_sn, ',');
         $refund_array['admin_state'] = '1';
         //状态:1为待审核,2为同意,3为不同意
         $refund_array['refund_amount'] = uk86_ncPriceFormat($refund_amount);
         $refund_array['goods_num'] = $goods_num;
         $refund_array['buyer_message'] = $_POST['buyer_message'];
         $refund_array['add_time'] = time();
         $state = $model_vr_refund->addRefund($refund_array, $order);
         if ($state) {
             showDialog(Uk86Language::uk86_get('nc_common_save_succ'), 'index.php?act=member_vr_refund&op=index', 'succ');
         } else {
             showDialog(Uk86Language::uk86_get('nc_common_save_fail'), 'reload', 'error');
         }
     }
     Tpl::showpage('member_vr_refund_add');
 }
コード例 #4
0
}
?>
  </div>
  <div class="item-order">
    <dl>
      <dt>运&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;费:</dt>
      <dd><?php 
echo $output['order']['shipping_fee'] > 0 ? uk86_ncPriceFormat($output['order']['shipping_fee']) : $lang['nc_common_shipping_free'];
?>
</dd>
    </dl>
    <dl>
      <dt>订单总额:</dt>
      <dd><strong><?php 
echo $lang['currency'];
echo uk86_ncPriceFormat($output['order']['order_amount']);
?>
        <?php 
if ($output['order']['refund_amount'] > 0) {
    ?>
        (<?php 
    echo $lang['refund_add'] . $lang['nc_colon'] . $lang['currency'] . $output['order']['refund_amount'];
    ?>
)
        <?php 
}
?>
        </strong> </dd>
    </dl>
    <dl class="line">
      <dt>订单编号:</dt>
コード例 #5
0
ファイル: store_bill.php プロジェクト: wangjiang988/ukshop
 /**
  * 导出结算退单明细CSV
  *
  */
 public function export_refund_orderOp()
 {
     if (!preg_match('/^20\\d{5,12}$/', $_GET['ob_no'])) {
         uk86_showMessage('参数错误', '', 'html', 'error');
     }
     if (substr($_GET['ob_no'], 6) != $_SESSION['store_id']) {
         uk86_showMessage('参数错误', '', 'html', 'error');
     }
     $model_bill = Model('bill');
     $bill_info = $model_bill->getOrderBillInfo(array('ob_no' => $_GET['ob_no']));
     if (!$bill_info) {
         uk86_showMessage('参数错误', '', 'html', 'error');
     }
     $model_refund = Model('refund_return');
     $condition = array();
     $condition['seller_state'] = 2;
     $condition['store_id'] = $_SESSION['store_id'];
     $condition['goods_id'] = array('gt', 0);
     $if_start_date = preg_match('/^20\\d{2}-\\d{2}-\\d{2}$/', $_GET['query_start_date']);
     $if_end_date = preg_match('/^20\\d{2}-\\d{2}-\\d{2}$/', $_GET['query_end_date']);
     $start_unixtime = $if_start_date ? strtotime($_GET['query_start_date']) : null;
     $end_unixtime = $if_end_date ? strtotime($_GET['query_end_date']) : null;
     if ($if_start_date || $if_end_date) {
         $condition['admin_time'] = array('time', array($start_unixtime, $end_unixtime));
     } else {
         $condition['admin_time'] = array('between', "{$bill_info['ob_start_date']},{$bill_info['ob_end_date']}");
     }
     if (!is_numeric($_GET['curpage'])) {
         $count = $model_refund->getRefundReturn($condition);
         $array = array();
         if ($count > self::EXPORT_SIZE) {
             //显示下载链接
             $page = ceil($count / self::EXPORT_SIZE);
             for ($i = 1; $i <= $page; $i++) {
                 $limit1 = ($i - 1) * self::EXPORT_SIZE + 1;
                 $limit2 = $i * self::EXPORT_SIZE > $count ? $count : $i * self::EXPORT_SIZE;
                 $array[$i] = $limit1 . ' ~ ' . $limit2;
             }
             Tpl::output('list', $array);
             Tpl::output('murl', 'index.php?act=store_bill&op=show_bill&query_type=refund&ob_no=' . $_GET['ob_no']);
             Tpl::showpage('store_export.excel');
             exit;
         } else {
             //如果数量小,直接下载
             $data = $model_refund->getRefundReturnList($condition, '', '*,ROUND(refund_amount*commis_rate/100,2) as commis_amount', self::EXPORT_SIZE);
         }
     } else {
         //下载
         $limit1 = ($_GET['curpage'] - 1) * self::EXPORT_SIZE;
         $limit2 = self::EXPORT_SIZE;
         $data = $model_refund->getRefundReturnList(condition, '', '*,ROUND(refund_amount*commis_rate/100,2) as commis_amount', "{$limit1},{$limit2}");
     }
     if (is_array($data) && count($data) == 1 && $data[0]['refund_id'] == '') {
         $refund_list = array();
     }
     $export_data = array();
     $export_data[0] = array('退单编号', '订单编号', '退单金额', '退单佣金', '类型', '退款日期', '买家', '买家编号');
     $refund_amount = 0;
     $commis_totals = 0;
     $k = 0;
     foreach ($data as $v) {
         $export_data[$k + 1][] = 'NC' . $v['refund_sn'];
         $export_data[$k + 1][] = 'NC' . $v['order_sn'];
         $refund_amount += $export_data[$k + 1][] = $v['refund_amount'];
         $commis_totals += $export_data[$k + 1][] = uk86_ncPriceFormat($v['commis_amount']);
         $export_data[$k + 1][] = str_replace(array(1, 2), array('退款', '退货'), $v['refund_type']);
         $export_data[$k + 1][] = date('Y-m-d', $v['admin_time']);
         $export_data[$k + 1][] = $v['buyer_name'];
         $export_data[$k + 1][] = $v['buyer_id'];
         $k++;
     }
     $count = count($export_data);
     $export_data[$count][] = '';
     $export_data[$count][] = '合计';
     $export_data[$count][] = $refund_amount;
     $export_data[$count][] = $commis_totals;
     $csv = new Uk86Csv();
     $export_data = $csv->uk86_charset($export_data, CHARSET, 'gbk');
     $csv->filename = $csv->uk86_charset('退单明细-', CHARSET) . $_GET['ob_no'];
     $csv->uk86_export($export_data);
 }
コード例 #6
0
if (is_array($output['cost_list']) && !empty($output['cost_list'])) {
    ?>
      <?php 
    foreach ($output['cost_list'] as $cost_info) {
        ?>
      <tr class="hover">
        <td class="align-center"><?php 
        echo $output['store_info']['store_name'];
        ?>
</td>
        <td class="align-center"><?php 
        echo $cost_info['cost_remark'];
        ?>
</td>
        <td class="align-center"><?php 
        echo uk86_ncPriceFormat($cost_info['cost_price']);
        ?>
</td>
        <td class="align-center"><?php 
        echo date('Y-m-d', $cost_info['cost_time']);
        ?>
</td>
      </tr>
      <?php 
    }
    ?>
      <?php 
} else {
    ?>
      <tr class="no_data">
        <td colspan="15"><?php 
コード例 #7
0
 /**
  * 变更预存款
  * @param unknown $change_type
  * @param unknown $data
  * @throws Exception
  * @return unknown
  */
 public function changePa($change_type, $data = array(), $refund = array())
 {
     $data_log = array();
     $data_pd = array();
     $data_msg = array();
     $data_log['lg_member_id'] = $data['member_id'];
     $data_log['lg_member_name'] = $data['member_name'];
     $data_log['lg_add_time'] = TIMESTAMP;
     $data_log['lg_type'] = $change_type;
     $data_msg['time'] = date('Y-m-d H:i:s');
     $data_msg['pd_url'] = uk86_urlShop('predeposit', 'pd_log_list');
     switch ($change_type) {
         case 'refund':
             $data_log['lg_av_amount'] = $data['amount'];
             $data_log['lg_desc'] = '确认退款,订单号: ' . $data['order_sn'];
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit+' . $data['amount']);
             $data_msg['av_amount'] = $data['amount'];
             $data_msg['freeze_amount'] = 0;
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         case 'vr_refund':
             $data_log['lg_av_amount'] = $data['amount'];
             $data_log['lg_desc'] = '虚拟兑码退款成功,订单号: ' . $data['order_sn'];
             $data_pd['available_predeposit'] = array('exp', 'available_predeposit+' . $data['amount']);
             $data_msg['av_amount'] = $data['amount'];
             $data_msg['freeze_amount'] = 0;
             $data_msg['desc'] = $data_log['lg_desc'];
             break;
         default:
             throw new Exception('参数错误');
             break;
     }
     //转到第三方退款api
     $update = $this->_api_refund($data['payment_code'], $refund);
     if (!$update) {
         throw new Exception('操作失败');
     }
     $insert = $this->table('pd_log')->insert($data_log);
     if (!$insert) {
         throw new Exception('操作失败');
     }
     $param = array();
     $param['code'] = 'predeposit_change';
     $param['member_id'] = $data['member_id'];
     $data_msg['av_amount'] = uk86_ncPriceFormat($data_msg['av_amount']);
     $data_msg['freeze_amount'] = uk86_ncPriceFormat($data_msg['freeze_amount']);
     $param['param'] = $data_msg;
     Uk86QueueClient::push('sendMemberMsg', $param);
     return $insert;
 }
コード例 #8
0
ファイル: stat_general.php プロジェクト: wangjiang988/ukshop
 /**
  * 促销分析
  */
 public function generalOp()
 {
     $model = Model('stat');
     //统计的日期0点
     $stat_time = strtotime(date('Y-m-d', time())) - 86400;
     /*
      * 昨日最新情报
      */
     $stime = $stat_time;
     $etime = $stat_time + 86400 - 1;
     $statnew_arr = array();
     //查询订单表下单量、下单金额、下单客户数、平均客单价
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' COUNT(*) as ordernum, SUM(order_amount) as orderamount, COUNT(DISTINCT buyer_id) as ordermembernum, AVG(order_amount) as orderavg ';
     $stat_order = $model->getoneByStatorder($where, $field);
     $statnew_arr['ordernum'] = ($t = $stat_order['ordernum']) ? $t : 0;
     $statnew_arr['orderamount'] = uk86_ncPriceFormat(($t = $stat_order['orderamount']) ? $t : 0);
     $statnew_arr['ordermembernum'] = ($t = $stat_order['ordermembernum']) ? $t : 0;
     $statnew_arr['orderavg'] = uk86_ncPriceFormat(($t = $stat_order['orderavg']) ? $t : 0);
     unset($stat_order);
     //查询订单商品表下单商品数
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' SUM(goods_num) as ordergoodsnum,AVG(goods_pay_price/goods_num) as priceavg ';
     $stat_ordergoods = $model->getoneByStatordergoods($where, $field);
     $statnew_arr['ordergoodsnum'] = ($t = $stat_ordergoods['ordergoodsnum']) ? $t : 0;
     $statnew_arr['priceavg'] = uk86_ncPriceFormat(($t = $stat_ordergoods['priceavg']) ? $t : 0);
     unset($stat_ordergoods);
     //新增会员数
     $where = array();
     $where['member_time'] = array('between', array($stime, $etime));
     $field = ' COUNT(*) as newmember ';
     $stat_member = $model->getoneByMember($where, $field);
     $statnew_arr['newmember'] = ($t = $stat_member['newmember']) ? $t : 0;
     unset($stat_member);
     //会员总数
     $where = array();
     $field = ' COUNT(*) as membernum ';
     $stat_member = $model->getoneByMember($where, $field);
     $statnew_arr['membernum'] = ($t = $stat_member['membernum']) ? $t : 0;
     unset($stat_member);
     //新增店铺
     $where = array();
     $where['store_time'] = array('between', array($stime, $etime));
     $field = ' COUNT(*) as newstore ';
     $stat_store = $model->getoneByStore($where, $field);
     $statnew_arr['newstore'] = ($t = $stat_store['newstore']) ? $t : 0;
     unset($stat_store);
     //店铺总数
     $where = array();
     $field = ' COUNT(*) as storenum ';
     $stat_store = $model->getoneByStore($where, $field);
     $statnew_arr['storenum'] = ($t = $stat_store['storenum']) ? $t : 0;
     unset($stat_store);
     //新增商品,商品总数
     $goods_list = $model->statByGoods(array('is_virtual' => 0), "COUNT(*) as goodsnum, SUM(IF(goods_addtime>={$stime} and goods_addtime<={$etime},1,0)) as newgoods");
     $statnew_arr['goodsnum'] = ($t = $goods_list[0]['goodsnum']) > 0 ? $t : 0;
     $statnew_arr['newgoods'] = ($t = $goods_list[0]['newgoods']) > 0 ? $t : 0;
     /*
      * 昨日销售走势
      */
     //构造横轴数据
     for ($i = 0; $i < 24; $i++) {
         //统计图数据
         $curr_arr[$i] = 0;
         //今天
         $up_arr[$i] = 0;
         //昨天
         //横轴
         $stat_arr['xAxis']['categories'][] = "{$i}";
     }
     $stime = $stat_time - 86400;
     //昨天0点
     $etime = $stat_time + 86400 - 1;
     //今天24点
     $yesterday_day = @date('d', $stime);
     //昨天日期
     $today_day = @date('d', $etime);
     //今天日期
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' SUM(order_amount) as orderamount,DAY(FROM_UNIXTIME(order_add_time)) as dayval,HOUR(FROM_UNIXTIME(order_add_time)) as hourval ';
     $stat_order = $model->statByStatorder($where, $field, 0, 0, '', 'dayval,hourval');
     if ($stat_order) {
         foreach ($stat_order as $k => $v) {
             if ($today_day == $v['dayval']) {
                 $curr_arr[$v['hourval']] = intval($v['orderamount']);
             }
             if ($yesterday_day == $v['dayval']) {
                 $up_arr[$v['hourval']] = intval($v['orderamount']);
             }
         }
     }
     $stat_arr['series'][0]['name'] = '昨天';
     $stat_arr['series'][0]['data'] = array_values($up_arr);
     $stat_arr['series'][1]['name'] = '今天';
     $stat_arr['series'][1]['data'] = array_values($curr_arr);
     //得到统计图数据
     $stat_arr['title'] = date('Y-m-d', $stat_time) . '销售走势';
     $stat_arr['yAxis'] = '销售额';
     $stattoday_json = uk86_getStatData_LineLabels($stat_arr);
     unset($stat_arr);
     /*
      * 7日内店铺销售TOP30
      */
     $stime = $stat_time - 86400 * 6;
     //7天前0点
     $etime = $stat_time + 86400 - 1;
     //今天24点
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' SUM(order_amount) as orderamount, store_id, store_name ';
     $storetop30_arr = $model->statByStatorder($where, $field, 0, 0, 'orderamount desc', 'store_id');
     /*
      * 7日内商品销售TOP30
      */
     $stime = $stat_time - 86400 * 6;
     //7天前0点
     $etime = $stat_time + 86400 - 1;
     //今天24点
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' sum(goods_num) as ordergoodsnum, goods_id, goods_name ';
     $goodstop30_arr = $model->statByStatordergoods($where, $field, 0, 30, 'ordergoodsnum desc', 'goods_id');
     Tpl::output('goodstop30_arr', $goodstop30_arr);
     Tpl::output('storetop30_arr', $storetop30_arr);
     Tpl::output('stattoday_json', $stattoday_json);
     Tpl::output('statnew_arr', $statnew_arr);
     Tpl::output('stat_time', $stat_time);
     Tpl::output('top_link', $this->sublink($this->links, 'general'));
     Tpl::showpage('stat.general.index');
 }
コード例 #9
0
ファイル: complain.php プロジェクト: wangjiang988/ukshop
 public function complain_closeOp()
 {
     //获取输入的数据
     $complain_id = intval($_POST['complain_id']);
     $final_handle_message = trim($_POST['final_handle_message']);
     //验证输入的数据
     $obj_validate = new Uk86Validate();
     $obj_validate->validateparam = array(array("input" => $final_handle_message, "require" => "true", "validator" => "Length", "min" => "1", "max" => "255", "message" => Uk86Language::uk86_get('final_handle_message_error')));
     $error = $obj_validate->uk86_validate();
     if ($error != '') {
         uk86_showMessage($error);
     }
     $complain_info = $this->get_complain_info($complain_id);
     $current_state = intval($complain_info['complain_state']);
     if ($current_state !== self::STATE_FINISH) {
         $model_complain = Model('complain');
         $update_array = array();
         $update_array['complain_state'] = self::STATE_FINISH;
         $update_array['final_handle_message'] = $final_handle_message;
         $update_array['final_handle_datetime'] = time();
         $update_array['final_handle_member_id'] = $this->get_admin_id();
         $where_array = array();
         $where_array['complain_id'] = $complain_id;
         if ($model_complain->updateComplain($update_array, $where_array)) {
             if (intval($complain_info['complain_subject_id']) == 1) {
                 //退款信息
                 $order = $this->get_order_info($complain_info['order_id']);
                 $model_refund = Model('refund_return');
                 $list = $model_refund->getComplainRefundList($order, $complain_info['order_goods_id']);
                 $refund_goods = $list['goods'];
                 //可退商品
                 if (!empty($refund_goods) && is_array($refund_goods)) {
                     $checked_goods = $_POST['checked_goods'];
                     foreach ($refund_goods as $key => $value) {
                         $goods_id = $value['rec_id'];
                         //订单商品表编号
                         if (!empty($checked_goods) && array_key_exists($goods_id, $checked_goods)) {
                             //验证提交的商品属于订单
                             $refund_array = array();
                             $refund_array['refund_type'] = '1';
                             //类型:1为退款,2为退货
                             $refund_array['seller_state'] = '2';
                             //卖家处理状态:1为待审核,2为同意,3为不同意
                             $refund_array['refund_state'] = '2';
                             //状态:1为处理中,2为待管理员处理,3为已完成
                             $refund_array['order_lock'] = '1';
                             //锁定类型:1为不用锁定,2为需要锁定
                             $refund_array['refund_amount'] = uk86_ncPriceFormat($value['goods_refund']);
                             $refund_array['reason_id'] = '0';
                             $refund_array['reason_info'] = '投诉成功';
                             $refund_array['buyer_message'] = '投诉成功,待管理员确认退款';
                             $refund_array['seller_message'] = '投诉成功,待管理员确认退款';
                             $refund_array['add_time'] = time();
                             $refund_array['seller_time'] = time();
                             $model_refund->addRefundReturn($refund_array, $order, $value);
                         }
                     }
                 }
             }
             $this->log(L('complain_close_success') . '[' . $complain_id . ']', 1);
             uk86_showMessage(Uk86Language::uk86_get('complain_close_success'), $this->get_complain_state_link($current_state));
         } else {
             uk86_showMessage(Uk86Language::uk86_get('complain_close_fail'), $this->get_complain_state_link($current_state));
         }
     } else {
         uk86_showMessage(Uk86Language::uk86_get('param_error'), '');
     }
 }
コード例 #10
0
 /**
  * 根据商品id查询套餐数据
  * @param unknown $goods_id
  */
 public function getBundlingCacheByGoodsId($goods_id)
 {
     $array = $this->_rGoodsBundlingCache($goods_id);
     if (empty($array)) {
         $bundling_array = array();
         $b_goods_array = array();
         // 根据商品id查询bl_id
         $b_g_list = $this->getBundlingGoodsList(array('goods_id' => $goods_id, 'bl_appoint' => 1), 'bl_id');
         if (!empty($b_g_list)) {
             $b_id_array = array();
             foreach ($b_g_list as $val) {
                 $b_id_array[] = $val['bl_id'];
             }
             // 查询套餐列表
             $bundling_list = $this->getBundlingOpenList(array('bl_id' => array('in', $b_id_array)));
             // 整理
             if (!empty($bundling_list)) {
                 foreach ($bundling_list as $val) {
                     $bundling_array[$val['bl_id']]['id'] = $val['bl_id'];
                     $bundling_array[$val['bl_id']]['name'] = $val['bl_name'];
                     $bundling_array[$val['bl_id']]['cost_price'] = 0;
                     $bundling_array[$val['bl_id']]['price'] = $val['bl_discount_price'];
                     $bundling_array[$val['bl_id']]['freight'] = $val['bl_freight'];
                 }
                 $blid_array = array_keys($bundling_array);
                 $b_goods_list = $this->getBundlingGoodsList(array('bl_id' => array('in', $blid_array)));
                 if (!empty($b_goods_list) && count($b_goods_list) > 1) {
                     $goodsid_array = array();
                     foreach ($b_goods_list as $val) {
                         $goodsid_array[] = $val['goods_id'];
                     }
                     $goods_list = Model('goods')->getGoodsList(array('goods_id' => array('in', $goodsid_array)), 'goods_id,goods_name,goods_price,goods_image');
                     $goods_list = uk86_array_under_reset($goods_list, 'goods_id');
                     foreach ($b_goods_list as $val) {
                         if (isset($goods_list[$val['goods_id']])) {
                             $k = intval($val['goods_id']) == $goods_id ? 0 : $val['goods_id'];
                             // 排序当前商品放到最前面
                             $b_goods_array[$val['bl_id']][$k]['id'] = $val['goods_id'];
                             $b_goods_array[$val['bl_id']][$k]['image'] = uk86_thumb($goods_list[$val['goods_id']], 240);
                             $b_goods_array[$val['bl_id']][$k]['name'] = $goods_list[$val['goods_id']]['goods_name'];
                             $b_goods_array[$val['bl_id']][$k]['shop_price'] = uk86_ncPriceFormat($goods_list[$val['goods_id']]['goods_price']);
                             $b_goods_array[$val['bl_id']][$k]['price'] = uk86_ncPriceFormat($val['bl_goods_price']);
                             $bundling_array[$val['bl_id']]['cost_price'] += $goods_list[$val['goods_id']]['goods_price'];
                         }
                     }
                 }
             }
         }
         $array = array('bundling_array' => serialize($bundling_array), 'b_goods_array' => serialize($b_goods_array));
         $this->_wGoodsBundlingCache($goods_id, $array);
     }
     return $array;
 }
コード例 #11
0
ファイル: stat_store.php プロジェクト: wangjiang988/ukshop
 /**
  * 热卖排行列表
  */
 public function hotrank_listOp()
 {
     $datanum = 30;
     $model = Model('stat');
     switch ($_GET['type']) {
         case 'ordernum':
             $sort_text = '下单量';
             break;
         default:
             $_GET['type'] = 'orderamount';
             $sort_text = '下单金额';
             break;
     }
     $where = array();
     $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
     foreach ((array) $searchtime_arr_tmp as $k => $v) {
         $searchtime_arr[] = intval($v);
     }
     //店铺分类
     $search_sclass = intval($_REQUEST['search_sclass']);
     if ($search_sclass) {
         $where['sc_id'] = $search_sclass;
     }
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', $searchtime_arr);
     //查询统计数据
     $field = ' store_id,store_name ';
     switch ($_GET['type']) {
         case 'ordernum':
             $field .= ' ,COUNT(*) as ordernum ';
             $orderby = 'ordernum desc';
             break;
         default:
             $_GET['type'] = 'orderamount';
             $field .= ' ,SUM(order_amount) as orderamount ';
             $orderby = 'orderamount desc';
             break;
     }
     $orderby .= ',store_id';
     $statlist = $model->statByStatorder($where, $field, 0, $datanum, $orderby, 'store_id');
     foreach ((array) $statlist as $k => $v) {
         $statlist[$k]['sort'] = $k + 1;
     }
     /**
      * 飙升榜
      */
     $soaring_statlist = array();
     //飙升榜数组
     //查询期间产生订单的店铺数
     $where = array();
     //店铺分类
     $search_sclass = intval($_REQUEST['search_sclass']);
     if ($search_sclass) {
         $where['sc_id'] = $search_sclass;
     }
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', $searchtime_arr);
     $field = 'COUNT(*) as countnum';
     $countnum = $model->getoneByStatorder($where, $field);
     $countnum = $countnum['countnum'];
     if ($countnum > 0) {
         $store_arr = array();
         $field = 'store_id,store_name,order_amount';
         for ($i = 0; $i < $countnum; $i += 1000) {
             //由于数据库底层的限制,所以每次查询1000条
             $order_list = array();
             $order_list = $model->statByStatorder($where, $field, 0, $i . ',1000', 'order_id');
             foreach ((array) $order_list as $k => $v) {
                 $store_arr[$v['store_id']]['orderamount'] = $store_arr[$v['store_id']]['orderamount'] + $v['order_amount'];
                 $store_arr[$v['store_id']]['ordernum'] = intval($store_arr[$v['store_id']]['ordernum']) + 1;
                 $store_arr[$v['store_id']]['store_name'] = $v['store_name'];
                 $store_arr[$v['store_id']]['store_id'] = $v['store_id'];
             }
         }
         //查询同一时间周期相比的环比数值
         $where = array();
         $stime = $searchtime_arr[0] - ($searchtime_arr[1] - $searchtime_arr[0]) - 1;
         $etime = $searchtime_arr[0] - 1;
         //店铺分类
         $search_sclass = intval($_REQUEST['search_sclass']);
         if ($search_sclass) {
             $where['sc_id'] = $search_sclass;
         }
         $where['order_isvalid'] = 1;
         //计入统计的有效订单
         $where['order_add_time'] = array('between', array($stime, $etime));
         $field = 'COUNT(*) as up_countnum';
         $up_countnum = $model->getoneByStatorder($where, $field);
         $up_countnum = $up_countnum['up_countnum'];
         $up_store_arr = array();
         if ($up_countnum > 0) {
             $field = 'store_id,store_name,order_amount';
             for ($i = 0; $i < $up_countnum; $i += 1000) {
                 //由于数据库底层的限制,所以每次查询1000条
                 $order_list = array();
                 $order_list = $model->statByStatorder($where, $field, 0, $i . ',1000', 'store_id');
                 foreach ((array) $order_list as $k => $v) {
                     $up_store_arr[$v['store_id']]['orderamount'] = $up_store_arr[$v['store_id']]['orderamount'] + $v['order_amount'];
                     $up_store_arr[$v['store_id']]['ordernum'] = intval($up_store_arr[$v['store_id']]['ordernum']) + 1;
                 }
             }
         }
         //计算环比飙升数值
         $soaring_arr = array();
         foreach ((array) $store_arr as $k => $v) {
             if ($up_store_arr[$k][$_GET['type']] > 0) {
                 //上期数值大于0,则计算飙升值,否则不计入统计
                 $soaring_arr[$k] = round(($v[$_GET['type']] - $up_store_arr[$k][$_GET['type']]) / $up_store_arr[$k][$_GET['type']] * 100, 2);
             }
         }
         arsort($soaring_arr);
         //降序排列数组
         $i = 1;
         //取出前10名飙升店铺
         foreach ((array) $soaring_arr as $k => $v) {
             if ($i <= $datanum) {
                 $tmp = array();
                 $tmp['sort'] = $i;
                 $tmp['store_name'] = $store_arr[$k]['store_name'];
                 $tmp['store_id'] = $store_arr[$k]['store_id'];
                 $tmp['hb'] = $v;
                 switch ($_GET['type']) {
                     case 'ordernum':
                         $tmp['ordernum'] = $store_arr[$k]['ordernum'];
                         break;
                     case 'orderamount':
                         $tmp['orderamount'] = uk86_ncPriceFormat($store_arr[$k]['orderamount']);
                         break;
                 }
                 $soaring_statlist[] = $tmp;
                 $i++;
             } else {
                 break;
             }
         }
     }
     Tpl::output('soaring_statlist', $soaring_statlist);
     Tpl::output('statlist', $statlist);
     Tpl::output('sort_text', $sort_text);
     Tpl::output('stat_field', $_GET['type']);
     Tpl::showpage('stat.store.hotrank.list', 'null_layout');
 }
コード例 #12
0
ファイル: member_refund.php プロジェクト: wangjiang988/ukshop
 /**
  * 添加全部退款即取消订单
  *
  */
 public function add_refund_allOp()
 {
     $model_order = Model('order');
     $model_trade = Model('trade');
     $model_refund = Model('refund_return');
     $order_id = intval($_GET['order_id']);
     $condition = array();
     $condition['buyer_id'] = $_SESSION['member_id'];
     $condition['order_id'] = $order_id;
     $order = $model_refund->getRightOrderList($condition);
     Tpl::output('order', $order);
     $order_amount = $order['order_amount'];
     //订单金额
     $condition = array();
     $condition['buyer_id'] = $order['buyer_id'];
     $condition['order_id'] = $order['order_id'];
     $condition['goods_id'] = '0';
     $condition['seller_state'] = array('lt', '3');
     $refund_list = $model_refund->getRefundReturnList($condition);
     $refund = array();
     if (!empty($refund_list) && is_array($refund_list)) {
         $refund = $refund_list[0];
     }
     $order_paid = $model_trade->getOrderState('order_paid');
     //订单状态20:已付款
     $payment_code = $order['payment_code'];
     //支付方式
     if ($refund['refund_id'] > 0 || $order['order_state'] != $order_paid || $payment_code == 'offline') {
         //检查订单状态,防止页面刷新不及时造成数据错误
         showDialog(Uk86Language::uk86_get('wrong_argument'), 'index.php?act=member_order&op=index', 'error');
     }
     if (uk86_chksubmit()) {
         $refund_array = array();
         $refund_array['refund_type'] = '1';
         //类型:1为退款,2为退货
         $refund_array['seller_state'] = '1';
         //状态:1为待审核,2为同意,3为不同意
         $refund_array['order_lock'] = '2';
         //锁定类型:1为不用锁定,2为需要锁定
         $refund_array['goods_id'] = '0';
         $refund_array['order_goods_id'] = '0';
         $refund_array['reason_id'] = '0';
         $refund_array['reason_info'] = '取消订单,全部退款';
         $refund_array['goods_name'] = '订单商品全部退款';
         $refund_array['refund_amount'] = uk86_ncPriceFormat($order_amount);
         $refund_array['buyer_message'] = $_POST['buyer_message'];
         $refund_array['add_time'] = time();
         $pic_array = array();
         $pic_array['buyer'] = $this->upload_pic();
         //上传凭证
         $info = serialize($pic_array);
         $refund_array['pic_info'] = $info;
         $state = $model_refund->addRefundReturn($refund_array, $order);
         if ($state) {
             $model_refund->editOrderLock($order_id);
             showDialog(Uk86Language::uk86_get('nc_common_save_succ'), 'index.php?act=member_refund&op=index', 'succ');
         } else {
             showDialog(Uk86Language::uk86_get('nc_common_save_fail'), 'reload', 'error');
         }
     }
     Tpl::showpage('member_refund_all');
 }
コード例 #13
0
 /**
  * 获取限时折扣商品扩展信息
  * @param array $xianshi_info
  * @return array 扩展限时折扣信息
  *
  */
 public function getXianshiGoodsExtendInfo($xianshi_info)
 {
     $xianshi_info['goods_url'] = uk86_urlShop('goods', 'index', array('goods_id' => $xianshi_info['goods_id']));
     $xianshi_info['image_url'] = uk86_cthumb($xianshi_info['goods_image'], 60, $xianshi_info['store_id']);
     $xianshi_info['xianshi_price'] = uk86_ncPriceFormat($xianshi_info['xianshi_price']);
     $xianshi_info['xianshi_discount'] = number_format($xianshi_info['xianshi_price'] / $xianshi_info['goods_price'] * 10, 1) . '折';
     return $xianshi_info;
 }
コード例 #14
0
        ?>
/images/loading.gif" data-src="<?php 
        echo $image_url;
        ?>
" title="<?php 
        echo $value['commend_goods_name'];
        ?>
" alt="<?php 
        echo $value['commend_goods_name'];
        ?>
" /> </a>
            <div class="price"> <?php 
        echo $lang['currency'];
        ?>
<strong><?php 
        echo uk86_ncPriceFormat($value['commend_goods_price']);
        ?>
</strong></div>
            
        </div>
        <div class="handle">
            <span class="like-btn"><a nc_type="microshop_like" like_id="<?php 
        echo $value['commend_id'];
        ?>
" href="javascript:void(0)"><i class="pngFix"></i><span><?php 
        echo $lang['microshop_text_like'];
        ?>
</span><em><?php 
        echo $value['like_count'] <= 999 ? $value['like_count'] : '999+';
        ?>
</em></a></span>
コード例 #15
0
        }
        ?>
        <td><?php 
        echo $output['order_list'][$code_info['order_id']]['buyer_name'];
        ?>
</td>
        <td><?php 
        echo $output['order_list'][$code_info['order_id']]['order_sn'];
        ?>
</td>
        <td><?php 
        echo $code_info['pay_price'];
        ?>
</td>
        <td><?php 
        echo uk86_ncPriceFormat($code_info['pay_price'] * $code_info['commis_rate'] / 100);
        ?>
</td>
        <td>
       	<a target="_blank" href="index.php?act=store_vr_order&op=show_order&order_id=<?php 
        echo $code_info['order_id'];
        ?>
"><?php 
        echo $lang['nc_view'];
        ?>
</a>
        </td>
      </tr>
      <?php 
    }
    ?>
コード例 #16
0
    </tbody>
  </table>
  
  <div class="stat-info"> <span>下单量:
    <strong><?php 
echo intval($output['statcount']['ordernum']);
?>
</strong>
    </span><span>下单商品数:
    <strong><?php 
echo intval($output['statcount']['goodsnum']);
?>
</strong>
    </span><span>下单金额:
    <strong><?php 
echo uk86_ncPriceFormat($output['statcount']['orderamount']);
?>
</strong>
    元 </span></div>
  <div id="stat_tabs" class="w100pre close_float ui-tabs">
    <div class="close_float tabmenu">
      <ul class="tab pngFix">
        <li><a href="#ordernum_div" nc_type="showlinelabels" data-param='{"type":"ordernum"}'>下单量</a></li>
        <li><a href="#goodsnum_div" nc_type="showlinelabels" data-param='{"type":"goodsnum"}'>下单商品数</a></li>
        <li><a href="#orderamount_div" nc_type="showlinelabels" data-param='{"type":"orderamount"}'>下单金额</a></li>
      </ul>
    </div>
    <!-- 下单量 -->
    <div id="ordernum_div" class="close_float"></div>
    <!-- 下单商品件数 -->
    <div id="goodsnum_div"></div>
コード例 #17
0
ファイル: goods.model.php プロジェクト: wangjiang988/ukshop
 /**
  * 获取单条商品信息
  *
  * @param int $goods_id
  * @return array
  */
 public function getGoodsDetail($goods_id)
 {
     if ($goods_id <= 0) {
         return null;
     }
     $result1 = $this->getGoodsInfoAndPromotionById($goods_id);
     if (empty($result1)) {
         return null;
     }
     $result2 = $this->getGoodeCommonInfoByID($result1['goods_commonid']);
     $goods_info = array_merge($result2, $result1);
     $goods_info['spec_value'] = unserialize($goods_info['spec_value']);
     $goods_info['spec_name'] = unserialize($goods_info['spec_name']);
     $goods_info['goods_spec'] = unserialize($goods_info['goods_spec']);
     $goods_info['goods_attr'] = unserialize($goods_info['goods_attr']);
     // 手机商品描述
     if ($goods_info['mobile_body'] != '') {
         $mobile_body_array = unserialize($goods_info['mobile_body']);
         if (is_array($mobile_body_array)) {
             $mobile_body = '';
             foreach ($mobile_body_array as $val) {
                 switch ($val['type']) {
                     case 'text':
                         $mobile_body .= '<div>' . $val['value'] . '</div>';
                         break;
                     case 'image':
                         $mobile_body .= '<img src="' . $val['value'] . '">';
                         break;
                 }
             }
             $goods_info['mobile_body'] = $mobile_body;
         }
     }
     // 查询所有规格商品
     $spec_array = $this->getGoodsSpecListByCommonId($goods_info['goods_commonid']);
     $spec_list = array();
     // 各规格商品地址,js使用
     $spec_list_mobile = array();
     // 各规格商品地址,js使用
     $spec_image = array();
     // 各规格商品主图,规格颜色图片使用
     foreach ($spec_array as $key => $value) {
         $s_array = unserialize($value['goods_spec']);
         $tmp_array = array();
         if (!empty($s_array) && is_array($s_array)) {
             foreach ($s_array as $k => $v) {
                 $tmp_array[] = $k;
             }
         }
         sort($tmp_array);
         $spec_sign = implode('|', $tmp_array);
         $tpl_spec = array();
         $tpl_spec['sign'] = $spec_sign;
         $tpl_spec['url'] = uk86_urlShop('goods', 'index', array('goods_id' => $value['goods_id']));
         $spec_list[] = $tpl_spec;
         $spec_list_mobile[$spec_sign] = $value['goods_id'];
         $spec_image[$value['color_id']] = uk86_thumb($value, 60);
     }
     $spec_list = json_encode($spec_list);
     // 商品多图
     $image_more = $this->getGoodsImageByKey($goods_info['goods_commonid'] . '|' . $goods_info['color_id']);
     $goods_image = array();
     $goods_image_mobile = array();
     if (!empty($image_more)) {
         foreach ($image_more as $val) {
             $goods_image[] = "{ title : '', levelA : '" . uk86_cthumb($val['goods_image'], 60, $goods_info['store_id']) . "', levelB : '" . uk86_cthumb($val['goods_image'], 360, $goods_info['store_id']) . "', levelC : '" . uk86_cthumb($val['goods_image'], 360, $goods_info['store_id']) . "', levelD : '" . uk86_cthumb($val['goods_image'], 1280, $goods_info['store_id']) . "'}";
             $goods_image_mobile[] = uk86_cthumb($val['goods_image'], 360, $goods_info['store_id']);
         }
     } else {
         $goods_image[] = "{ title : '', levelA : '" . uk86_thumb($goods_info, 60) . "', levelB : '" . uk86_thumb($goods_info, 360) . "', levelC : '" . uk86_thumb($goods_info, 360) . "', levelD : '" . uk86_thumb($goods_info, 1280) . "'}";
         $goods_image_mobile[] = uk86_thumb($goods_info, 360);
     }
     //抢购
     if (!empty($goods_info['groupbuy_info'])) {
         $goods_info['promotion_type'] = 'groupbuy';
         $goods_info['title'] = '抢购';
         $goods_info['groupbuy_start_time'] = $goods_info['groupbuy_info']['start_time'];
         $goods_info['groupbuy_end_time'] = $goods_info['groupbuy_info']['end_time'];
         $goods_info['remark'] = $goods_info['groupbuy_info']['remark'];
         $goods_info['promotion_price'] = $goods_info['groupbuy_info']['groupbuy_price'];
         $goods_info['down_price'] = uk86_ncPriceFormat($goods_info['goods_price'] - $goods_info['groupbuy_info']['groupbuy_price']);
         $goods_info['upper_limit'] = $goods_info['groupbuy_info']['upper_limit'];
         unset($goods_info['groupbuy_info']);
     }
     //限时折扣
     if (!empty($goods_info['xianshi_info'])) {
         $goods_info['promotion_type'] = 'xianshi';
         $goods_info['title'] = $goods_info['xianshi_info']['xianshi_title'];
         $goods_info['remark'] = $goods_info['xianshi_info']['xianshi_title'];
         $goods_info['promotion_price'] = $goods_info['xianshi_info']['xianshi_price'];
         $goods_info['down_price'] = uk86_ncPriceFormat($goods_info['goods_price'] - $goods_info['xianshi_info']['xianshi_price']);
         $goods_info['lower_limit'] = $goods_info['xianshi_info']['lower_limit'];
         $goods_info['explain'] = $goods_info['xianshi_info']['xianshi_explain'];
         unset($goods_info['xianshi_info']);
     }
     // 验证是否允许送赠品
     if ($this->checkGoodsIfAllowGift($goods_info)) {
         $gift_array = Model('goods_gift')->getGoodsGiftListByGoodsId($goods_id);
         if (!empty($gift_array)) {
             $goods_info['have_gift'] = 'gift';
         }
     }
     // 加入购物车按钮
     $goods_info['cart'] = true;
     //虚拟、F码、预售不显示加入购物车
     if ($goods_info['is_virtual'] == 1 || $goods_info['is_fcode'] == 1 || $goods_info['is_presell'] == 1) {
         $goods_info['cart'] = false;
     }
     // 立即购买文字显示
     $goods_info['buynow_text'] = '立即购买';
     if ($goods_info['is_presell'] == 1) {
         $goods_info['buynow_text'] = '预售购买';
     } elseif ($goods_info['is_fcode'] == 1) {
         $goods_info['buynow_text'] = 'F码购买';
     }
     //满即送
     $mansong_info = $goods_info['is_virtual'] == 1 ? array() : Model('p_mansong')->getMansongInfoByStoreID($goods_info['store_id']);
     // 商品受关注次数加1
     $goods_info['goods_click'] = intval($goods_info['goods_click']) + 1;
     if (C('cache_open')) {
         $this->_wGoodsCache($goods_id, array('goods_click' => $goods_info['goods_click']));
         uk86_wcache('updateRedisDate', array($goods_id => $goods_info['goods_click']), 'goodsClick');
     } else {
         $this->editGoodsById(array('goods_click' => array('exp', 'goods_click + 1')), $goods_id);
     }
     $result = array();
     $result['goods_info'] = $goods_info;
     $result['spec_list'] = $spec_list;
     $result['spec_list_mobile'] = $spec_list_mobile;
     $result['spec_image'] = $spec_image;
     $result['goods_image'] = $goods_image;
     $result['goods_image_mobile'] = $goods_image_mobile;
     $result['mansong_info'] = $mansong_info;
     $result['gift_array'] = $gift_array;
     return $result;
 }
コード例 #18
0
              <div class="favorite-goods-info">
                <dl>
                  <dt>
                    <input type="checkbox" class="checkitem" value="<?php 
        echo $favorites['goods']['goods_id'];
        ?>
"/>
                    <a href="index.php?act=goods&goods_id=<?php 
        echo $favorites['goods']['goods_id'];
        ?>
" target="_blank"><?php 
        echo $favorites['goods']['goods_name'];
        ?>
</a></dt>
                  <dd><span><strong><?php 
        echo uk86_ncPriceFormat($favorites['goods']['goods_price']);
        ?>
</strong><?php 
        echo $lang['currency_zh'];
        ?>
</span><a href="javascript:void(0)"  nc_type="sharegoods" data-param='{"gid":"<?php 
        echo $favorites['goods']['goods_id'];
        ?>
"}' class="sns-share" title="<?php 
        echo $lang['favorite_snsshare_goods'];
        ?>
"><i class="icon-share"></i><?php 
        echo $lang['nc_snsshare'];
        ?>
</a></dd>
                  <dd><span><?php 
コード例 #19
0
 /**
  * 促销分析
  */
 public function generalOp()
 {
     $model = Model('stat');
     //统计的日期0点
     $stat_time = strtotime(date('Y-m-d', time())) - 86400;
     /*
      * 近30天
      */
     $stime = $stat_time - 86400 * 29;
     //30天前
     $etime = $stat_time + 86400 - 1;
     //昨天23:59
     $statnew_arr = array();
     //查询订单表下单量、下单金额、下单客户数
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['store_id'] = $_SESSION['store_id'];
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' COUNT(*) as ordernum, SUM(order_amount) as orderamount, COUNT(DISTINCT buyer_id) as ordermembernum, AVG(order_amount) as avgorderamount ';
     $stat_order = $model->getoneByStatorder($where, $field);
     $statnew_arr['ordernum'] = ($t = $stat_order['ordernum']) ? $t : 0;
     $statnew_arr['orderamount'] = uk86_ncPriceFormat(($t = $stat_order['orderamount']) ? $t : 0);
     $statnew_arr['ordermembernum'] = ($t = $stat_order['ordermembernum']) > 0 ? $t : 0;
     $statnew_arr['avgorderamount'] = uk86_ncPriceFormat(($t = $stat_order['avgorderamount']) ? $t : 0);
     unset($stat_order);
     //下单高峰期
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['store_id'] = $_SESSION['store_id'];
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' HOUR(FROM_UNIXTIME(order_add_time)) as hourval,COUNT(*) as ordernum ';
     $orderlist = $model->statByStatorder($where, $field, 0, 0, 'ordernum desc,hourval asc', 'hourval');
     foreach ((array) $orderlist as $k => $v) {
         if ($k < 2) {
             //取前两个订单量高的时间段
             if (!$statnew_arr['hothour']) {
                 $statnew_arr['hothour'] = $v['hourval'] . ":00~" . ($v['hourval'] + 1) . ":00";
             } else {
                 $statnew_arr['hothour'] .= "," . ($v['hourval'] . ":00~" . ($v['hourval'] + 1) . ":00");
             }
         }
     }
     unset($orderlist);
     //查询订单商品表下单商品数
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['store_id'] = $_SESSION['store_id'];
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' SUM(goods_num) as ordergoodsnum, AVG(goods_pay_price/goods_num) as avggoodsprice ';
     $stat_ordergoods = $model->getoneByStatordergoods($where, $field);
     $statnew_arr['ordergoodsnum'] = ($t = $stat_ordergoods['ordergoodsnum']) ? $t : 0;
     $statnew_arr['avggoodsprice'] = uk86_ncPriceFormat(($t = $stat_ordergoods['avggoodsprice']) ? $t : 0);
     unset($stat_ordergoods);
     //商品总数、收藏量
     $goods_list = $model->statByGoods(array('store_id' => $_SESSION['store_id'], 'is_virtual' => 0), 'COUNT(*) as goodsnum, SUM(goods_collect) as gcollectnum');
     $statnew_arr['goodsnum'] = ($t = $goods_list[0]['goodsnum']) > 0 ? $t : 0;
     $statnew_arr['gcollectnum'] = ($t = $goods_list[0]['gcollectnum']) > 0 ? $t : 0;
     //店铺收藏量
     $store_list = $model->getoneByStore(array('store_id' => $_SESSION['store_id']), 'store_collect');
     $statnew_arr['store_collect'] = ($t = $store_list['store_collect']) > 0 ? $t : 0;
     /*
      * 销售走势
      */
     //构造横轴数据
     for ($i = $stime; $i < $etime; $i += 86400) {
         //当前数据的时间
         $timetext = date('n', $i) . '-' . date('j', $i);
         //统计图数据
         $stat_list[$timetext] = 0;
         //横轴
         $stat_arr['xAxis']['categories'][] = $timetext;
     }
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['store_id'] = $_SESSION['store_id'];
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' order_add_time,SUM(order_amount) as orderamount,MONTH(FROM_UNIXTIME(order_add_time)) as monthval,DAY(FROM_UNIXTIME(order_add_time)) as dayval ';
     $stat_order = $model->statByStatorder($where, $field, 0, 0, '', 'monthval,dayval');
     if ($stat_order) {
         foreach ($stat_order as $k => $v) {
             $stat_list[$v['monthval'] . '-' . $v['dayval']] = floatval($v['orderamount']);
         }
     }
     $stat_arr['legend']['enabled'] = false;
     $stat_arr['series'][0]['name'] = '下单金额';
     $stat_arr['series'][0]['data'] = array_values($stat_list);
     //得到统计图数据
     $stat_arr['title'] = '最近30天销售走势';
     $stat_arr['yAxis'] = '下单金额';
     $stattoday_json = uk86_getStatData_LineLabels($stat_arr);
     unset($stat_arr);
     /*
      * 7日内商品销售TOP30
      */
     $stime = $stat_time - 86400 * 6;
     //7天前0点
     $etime = $stat_time + 86400 - 1;
     //今天24点
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['store_id'] = $_SESSION['store_id'];
     $where['order_add_time'] = array('between', array($stime, $etime));
     $field = ' sum(goods_num) as ordergoodsnum, goods_id, goods_name ';
     $goodstop30_arr = $model->statByStatordergoods($where, $field, 0, 30, 'ordergoodsnum desc', 'goods_id');
     /**
      * 7日内同行热卖商品
      */
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', array($stime, $etime));
     $where['store_id'] = array('neq', $_SESSION['store_id']);
     if (!uk86_checkPlatformStore()) {
         //如果不是平台店铺,则查询店铺经营类目的同行数据
         //查询店铺经营类目
         $store_bindclass = Model('store_bind_class')->getStoreBindClassList(array('store_id' => $_SESSION['store_id']));
         $goodsclassid_arr = array();
         foreach ((array) $store_bindclass as $k => $v) {
             if (intval($v['class_3']) > 0) {
                 $goodsclassid_arr[3][] = intval($v['class_3']);
             } elseif (intval($v['class_2']) > 0) {
                 $goodsclassid_arr[2][] = intval($v['class_2']);
             } elseif (intval($v['class_1']) > 0) {
                 $goodsclassid_arr[1][] = intval($v['class_1']);
             }
         }
         //拼接商品分类条件
         if ($goodsclassid_arr) {
             ksort($goodsclassid_arr);
             $gc_parentidwhere_keyarr = array();
             $gc_parentidwhere_arr = array();
             foreach ((array) $goodsclassid_arr as $k => $v) {
                 $gc_parentidwhere_keyarr[] = 'gc_parentid_' . $k;
                 $gc_parentidwhere_arr[] = array('in', $goodsclassid_arr[$k]);
             }
             if (count($gc_parentidwhere_keyarr) == 1) {
                 $where[$gc_parentidwhere_keyarr[0]] = $gc_parentidwhere_arr[0];
             } else {
                 $gc_parentidwhere_arr['_multi'] = '1';
                 $where[implode('|', $gc_parentidwhere_keyarr)] = $gc_parentidwhere_arr;
             }
         }
     }
     $field = ' sum(goods_num) as ordergoodsnum, goods_id, goods_name ';
     $othergoodstop30_arr = $model->statByStatordergoods($where, $field, 0, 30, 'ordergoodsnum desc', 'goods_id');
     Tpl::output('goodstop30_arr', $goodstop30_arr);
     Tpl::output('othergoodstop30_arr', $othergoodstop30_arr);
     Tpl::output('stattoday_json', $stattoday_json);
     Tpl::output('statnew_arr', $statnew_arr);
     Tpl::output('stat_time', $stat_time);
     Tpl::showpage('stat.general.index');
 }
コード例 #20
0
        }
        ?>
        <dl class="goods-info">
          <dt><a href="<?php 
        echo uk86_urlShop('goods', 'index', array('goods_id' => $v['goods_id']));
        ?>
" title="<?php 
        echo $v['goods_name'];
        ?>
" target="_blank"><?php 
        echo $v['goods_name'];
        ?>
</a></dt>
          <dd>
            <div>¥<em><?php 
        echo uk86_ncPriceFormat($v['goods_promotion_price']);
        ?>
</em></div>
          </dd>
        </dl>
      </li>
      <?php 
    }
    ?>
    </ul>
    <?php 
} else {
    ?>
    <div class="noguess">暂无商品向您推荐</div>
    <?php 
}
コード例 #21
0
ファイル: buy_1.logic.php プロジェクト: wangjiang988/ukshop
 /**
  * 取得购买车内组合销售信息以及包含的商品及有效状态
  * @param array $cart_list
  */
 private function _getBundlingCartList(&$cart_list)
 {
     if (!C('promotion_allow') || empty($cart_list)) {
         return;
     }
     $model_bl = Model('p_bundling');
     $model_goods = Model('goods');
     foreach ($cart_list as $key => $cart_info) {
         if (!intval($cart_info['bl_id'])) {
             continue;
         }
         $cart_list[$key]['state'] = true;
         $cart_list[$key]['storage_state'] = true;
         $bl_info = $model_bl->getBundlingInfo(array('bl_id' => $cart_info['bl_id']));
         //标志优惠套装是否处于有效状态
         if (empty($bl_info) || !intval($bl_info['bl_state'])) {
             $cart_list[$key]['state'] = false;
         }
         //取得优惠套装商品列表
         $cart_list[$key]['bl_goods_list'] = $model_bl->getBundlingGoodsList(array('bl_id' => $cart_info['bl_id']));
         //取最新在售商品信息
         $goods_id_array = array();
         foreach ($cart_list[$key]['bl_goods_list'] as $goods_info) {
             $goods_id_array[] = $goods_info['goods_id'];
         }
         $goods_list = $model_goods->getGoodsOnlineListAndPromotionByIdArray($goods_id_array);
         $goods_online_list = array();
         foreach ($goods_list as $goods_info) {
             $goods_online_list[$goods_info['goods_id']] = $goods_info;
         }
         unset($goods_list);
         //使用最新的商品名称、图片,如果一旦有商品下架,则整个套装置置为无效状态
         $total_down_price = 0;
         foreach ($cart_list[$key]['bl_goods_list'] as $k => $goods_info) {
             if (array_key_exists($goods_info['goods_id'], $goods_online_list)) {
                 $goods_online_info = $goods_online_list[$goods_info['goods_id']];
                 //如果库存不足,标识false
                 if ($cart_info['goods_num'] > $goods_online_info['goods_storage']) {
                     $cart_list[$key]['storage_state'] = false;
                 }
                 $cart_list[$key]['bl_goods_list'][$k]['goods_id'] = $goods_online_info['goods_id'];
                 $cart_list[$key]['bl_goods_list'][$k]['goods_commonid'] = $goods_online_info['goods_commonid'];
                 $cart_list[$key]['bl_goods_list'][$k]['store_id'] = $goods_online_info['store_id'];
                 $cart_list[$key]['bl_goods_list'][$k]['goods_name'] = $goods_online_info['goods_name'];
                 $cart_list[$key]['bl_goods_list'][$k]['goods_image'] = $goods_online_info['goods_image'];
                 $cart_list[$key]['bl_goods_list'][$k]['goods_storage'] = $goods_online_info['goods_storage'];
                 $cart_list[$key]['bl_goods_list'][$k]['goods_storage_alarm'] = $goods_online_info['goods_storage_alarm'];
                 $cart_list[$key]['bl_goods_list'][$k]['gc_id'] = $goods_online_info['gc_id'];
                 //每个商品直降多少
                 $total_down_price += $cart_list[$key]['bl_goods_list'][$k]['down_price'] = uk86_ncPriceFormat($goods_online_info['goods_price'] - $goods_info['bl_goods_price']);
             } else {
                 //商品已经下架
                 $cart_list[$key]['state'] = false;
                 $cart_list[$key]['storage_state'] = false;
             }
         }
         $cart_list[$key]['down_price'] = uk86_ncPriceFormat($total_down_price);
     }
 }
コード例 #22
0
 /**
  * 平台确认退款处理
  *
  * @param
  * @return bool
  */
 public function editOrderRefund($refund)
 {
     $refund_id = intval($refund['refund_id']);
     if ($refund_id > 0) {
         Uk86Language::uk86_read('model_lang_index');
         $order_id = $refund['order_id'];
         //订单编号
         $field = 'order_id,buyer_id,buyer_name,store_id,order_sn,order_amount,payment_code,order_state,refund_amount,rcb_amount';
         $model_order = Model('order');
         $order = $model_order->getOrderInfo(array('order_id' => $order_id), array(), $field);
         $model_predeposit = Model('predeposit');
         try {
             $this->beginTransaction();
             $order_amount = $order['order_amount'];
             //订单金额
             $rcb_amount = $order['rcb_amount'];
             //充值卡支付金额
             $predeposit_amount = $order_amount - $order['refund_amount'] - $rcb_amount;
             //可退预存款金额
             if ($rcb_amount > 0 && $refund['refund_amount'] > $predeposit_amount) {
                 //退充值卡
                 $log_array = array();
                 $log_array['member_id'] = $order['buyer_id'];
                 $log_array['member_name'] = $order['buyer_name'];
                 $log_array['order_sn'] = $order['order_sn'];
                 $log_array['amount'] = $refund['refund_amount'];
                 if ($predeposit_amount > 0) {
                     $log_array['amount'] = $refund['refund_amount'] - $predeposit_amount;
                 }
                 $state = $model_predeposit->changeRcb('refund', $log_array);
                 //增加买家可用充值卡金额
             }
             if ($predeposit_amount > 0) {
                 //退预存款
                 //
                 $log_array = array();
                 $log_array['member_id'] = $order['buyer_id'];
                 $log_array['member_name'] = $order['buyer_name'];
                 $log_array['order_sn'] = $order['order_sn'];
                 $log_array['amount'] = $refund['refund_amount'];
                 //退预存款金额
                 if ($refund['refund_amount'] > $predeposit_amount) {
                     $log_array['amount'] = $predeposit_amount;
                 }
                 $state = $model_predeposit->changePd('refund', $log_array);
                 //增加买家可用预存款金额
             }
             $order_state = $order['order_state'];
             $model_trade = Model('trade');
             $order_paid = $model_trade->getOrderState('order_paid');
             //订单状态20:已付款
             if ($state && $order_state == $order_paid) {
                 uk86_Logic('order')->changeOrderStateCancel($order, 'system', '系统', '商品全部退款完成取消订单', false);
             }
             if ($state) {
                 $order_array = array();
                 $order_amount = $order['order_amount'];
                 //订单金额
                 $refund_amount = $order['refund_amount'] + $refund['refund_amount'];
                 //退款金额
                 $order_array['refund_state'] = $order_amount - $refund_amount > 0 ? 1 : 2;
                 $order_array['refund_amount'] = uk86_ncPriceFormat($refund_amount);
                 $order_array['delay_time'] = time();
                 $state = $model_order->editOrder($order_array, array('order_id' => $order_id));
                 //更新订单退款
             }
             if ($state && $refund['order_lock'] == '2') {
                 $state = $this->editOrderUnlock($order_id);
                 //订单解锁
             }
             $this->commit();
             return $state;
         } catch (Exception $e) {
             $this->rollback();
             return false;
         }
     }
     return false;
 }
コード例 #23
0
        echo uk86_orderGoodsType($val['goods_type']);
        ?>
</span></dd>
    </dl>
    <?php 
    }
    ?>
    <?php 
}
?>
  </div>
  <div class="item-order">
    <dl>
      <dt>运&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;费:</dt>
      <dd><?php 
echo $output['order']['shipping_fee'] > 0 ? uk86_ncPriceFormat($output['order']['shipping_fee']) : $lang['nc_common_shipping_free'];
?>
</dd>
    </dl>
    <dl>
      <dt><?php 
echo $lang['order_price'] . $lang['nc_colon'];
?>
</dt>
      <dd><strong><?php 
echo $lang['currency'] . $output['order']['order_amount'];
?>
</strong></dd>
    </dl>
    <dl class="line">
      <dt><?php 
コード例 #24
0
ファイル: buy.php プロジェクト: wangjiang988/ukshop
 /**
  * 下单时支付页面
  */
 public function payOp()
 {
     $pay_sn = $_GET['pay_sn'];
     if (!preg_match('/^\\d{18}$/', $pay_sn)) {
         uk86_showMessage(Uk86Language::uk86_get('cart_order_pay_not_exists'), 'index.php?act=member_order', 'html', 'error');
     }
     //查询支付单信息
     $model_order = Model('order');
     $pay_info = $model_order->getOrderPayInfo(array('pay_sn' => $pay_sn, 'buyer_id' => $_SESSION['member_id']), true);
     if (empty($pay_info)) {
         uk86_showMessage(Uk86Language::uk86_get('cart_order_pay_not_exists'), 'index.php?act=member_order', 'html', 'error');
     }
     Tpl::output('pay_info', $pay_info);
     //取子订单列表
     $condition = array();
     $condition['pay_sn'] = $pay_sn;
     $condition['order_state'] = array('in', array(ORDER_STATE_NEW, ORDER_STATE_PAY));
     $order_list = $model_order->getOrderList($condition, '', 'order_id,order_state,payment_code,order_amount,rcb_amount,pd_amount,order_sn', '', '', array(), true);
     if (empty($order_list)) {
         uk86_showMessage('未找到需要支付的订单', 'index.php?act=member_order', 'html', 'error');
     }
     //重新计算在线支付金额
     $pay_amount_online = 0;
     $pay_amount_offline = 0;
     //订单总支付金额(不包含货到付款)
     $pay_amount = 0;
     foreach ($order_list as $key => $order_info) {
         $payed_amount = floatval($order_info['rcb_amount']) + floatval($order_info['pd_amount']);
         //计算相关支付金额
         if ($order_info['payment_code'] != 'offline') {
             if ($order_info['order_state'] == ORDER_STATE_NEW) {
                 $pay_amount_online += uk86_ncPriceFormat(floatval($order_info['order_amount']) - $payed_amount);
             }
             $pay_amount += floatval($order_info['order_amount']);
         } else {
             $pay_amount_offline += floatval($order_info['order_amount']);
         }
         //显示支付方式与支付结果
         if ($order_info['payment_code'] == 'offline') {
             $order_list[$key]['payment_state'] = '货到付款';
         } else {
             $order_list[$key]['payment_state'] = '在线支付';
             if ($payed_amount > 0) {
                 $payed_tips = '';
                 if (floatval($order_info['rcb_amount']) > 0) {
                     $payed_tips = '充值卡已支付:¥' . $order_info['rcb_amount'];
                 }
                 if (floatval($order_info['pd_amount']) > 0) {
                     $payed_tips .= ' 预存款已支付:¥' . $order_info['pd_amount'];
                 }
                 $order_list[$key]['order_amount'] .= " ( {$payed_tips} )";
             }
         }
     }
     Tpl::output('order_list', $order_list);
     //如果线上线下支付金额都为0,转到支付成功页
     if (empty($pay_amount_online) && empty($pay_amount_offline)) {
         uk86_redirect('index.php?act=buy&op=pay_ok&pay_sn=' . $pay_sn . '&pay_amount=' . uk86_ncPriceFormat($pay_amount));
     }
     //输出订单描述
     if (empty($pay_amount_online)) {
         $order_remind = '下单成功,我们会尽快为您发货,请保持电话畅通!';
     } elseif (empty($pay_amount_offline)) {
         $order_remind = '请您及时付款,以便订单尽快处理!';
     } else {
         $order_remind = '部分商品需要在线支付,请尽快付款!';
     }
     Tpl::output('order_remind', $order_remind);
     Tpl::output('pay_amount_online', uk86_ncPriceFormat($pay_amount_online));
     Tpl::output('pd_amount', uk86_ncPriceFormat($pd_amount));
     //显示支付接口列表
     if ($pay_amount_online > 0) {
         $model_payment = Model('payment');
         $condition = array();
         $payment_list = $model_payment->getPaymentOpenList($condition);
         if (!empty($payment_list)) {
             unset($payment_list['predeposit']);
             unset($payment_list['offline']);
         }
         if (empty($payment_list)) {
             uk86_showMessage('暂未找到合适的支付方式', 'index.php?act=member_order', 'html', 'error');
         }
         Tpl::output('payment_list', $payment_list);
     }
     //标识 购买流程执行第几步
     Tpl::output('buy_step', 'step3');
     Tpl::showpage('buy_step2');
 }
コード例 #25
0
ファイル: exppoints.php プロジェクト: wangjiang988/ukshop
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     uk86_import('libraries.uk86excel');
     $excel_obj = new Uk86Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '会员名称');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '经验值');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '添加时间');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '操作阶段');
     $excel_data[0][] = array('styleid' => 's_title', 'data' => '描述');
     $stage_arr = Model('exppoints')->getStage();
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['exp_membername']);
         $tmp[] = array('format' => 'Number', 'data' => uk86_ncPriceFormat($v['exp_points']));
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['exp_addtime']));
         $tmp[] = array('data' => $stage_arr[$v['exp_stage']]);
         $tmp[] = array('data' => $v['exp_desc']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
     $excel_obj->uk86_addArray($excel_data);
     $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset('经验值明细', CHARSET));
     $excel_obj->uk86_generateXML($excel_obj->uk86_charset('经验值明细', CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #26
0
ファイル: publish_goods.php プロジェクト: wangjiang988/ukshop
        <div class="picture"><span class="thumb size210"><i></i><a href="<?php 
        echo urlShop('goods', 'index', array('goods_id' => $val['goods_id']));
        ?>
" target="_blank"> <img src="<?php 
        echo thumb($val, 240);
        ?>
" onload="javascript:DrawImage(this,210,210);" alt="<?php 
        echo $val['goods_name'];
        ?>
" title="<?php 
        echo $val['goods_name'];
        ?>
" /> </a></span></div>
        <dl>
          <dd class="fl"><?php 
        echo $lang['currency'] . uk86_ncPriceFormat($val['goods_price']);
        ?>
</dd>
        </dl>
        <div class="recommand-btn">
          <?php 
        if (in_array($val['goods_id'], $output['commend_goods_array'])) {
            ?>
          <a href="javascript:void(0)"><?php 
            echo $lang['microshop_goods_commend_already'];
            ?>
</a>
          <?php 
        } else {
            ?>
          <a href="javascript:void(0)" class="btn_commend_dialog" goods_id="<?php 
コード例 #27
0
      <tr class="bd-line">
        <td></td>
        <td><?php 
        echo $refund_info['refund_sn'];
        ?>
</td>
        <td><?php 
        echo $refund_info['order_sn'];
        ?>
</td>
        <td><?php 
        echo $refund_info['refund_amount'];
        ?>
</td>
        <td><?php 
        echo uk86_ncPriceFormat($refund_info['commis_amount']);
        ?>
</td>
        <td><?php 
        echo str_replace(array(1, 2), array('退款 ', '退货'), $refund_info['refund_type']);
        ?>
</td>
        <td><?php 
        echo date("Y-m-d", $refund_info['admin_time']);
        ?>
</td>
      </tr>
      <?php 
    }
    ?>
      <?php 
コード例 #28
0
ファイル: order.php プロジェクト: wangjiang988/ukshop
 /**
  * 生成excel
  *
  * @param array $data
  */
 private function createExcel($data = array())
 {
     Uk86Language::uk86_read('export');
     uk86_import('libraries.uk86excel');
     $excel_obj = new Uk86Excel();
     $excel_data = array();
     //设置样式
     $excel_obj->uk86_setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
     //header
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_no'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_store'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_buyer'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_xtimd'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_count'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_yfei'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_paytype'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_state'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_storeid'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_buyerid'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_od_bemail'));
     //data
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => 'NC' . $v['order_sn']);
         $tmp[] = array('data' => $v['store_name']);
         $tmp[] = array('data' => $v['buyer_name']);
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['add_time']));
         $tmp[] = array('format' => 'Number', 'data' => uk86_ncPriceFormat($v['order_amount']));
         $tmp[] = array('format' => 'Number', 'data' => uk86_ncPriceFormat($v['shipping_fee']));
         $tmp[] = array('data' => uk86_orderPaymentName($v['payment_code']));
         $tmp[] = array('data' => uk86_orderState($v));
         $tmp[] = array('data' => $v['store_id']);
         $tmp[] = array('data' => $v['buyer_id']);
         $tmp[] = array('data' => $v['buyer_email']);
         $excel_data[] = $tmp;
     }
     $excel_data = $excel_obj->uk86_charset($excel_data, CHARSET);
     $excel_obj->uk86_addArray($excel_data);
     $excel_obj->uk86_addWorksheet($excel_obj->uk86_charset(L('exp_od_order'), CHARSET));
     $excel_obj->uk86_generateXML($excel_obj->uk86_charset(L('exp_od_order'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
コード例 #29
0
ファイル: order.view.php プロジェクト: wangjiang988/ukshop
    ?>
</span></td>
                <td class="w96 align-center"><span class="red_common"><?php 
    echo $lang['currency'] . $goods['goods_pay_price'];
    ?>
</span></td>
                <td class="w96 align-center"><?php 
    echo $goods['goods_num'];
    ?>
</td>
                <td class="w96 align-center"><?php 
    echo $goods['commis_rate'] == 200 ? '' : $goods['commis_rate'] . '%';
    ?>
</td>
                <td class="w96 align-center"><?php 
    echo $goods['commis_rate'] == 200 ? '' : uk86_ncPriceFormat($goods['goods_pay_price'] * $goods['commis_rate'] / 100);
    ?>
</td>
              </tr>
              <?php 
}
?>
            </tbody>
          </table></td>
      </tr>
    <!-- S 促销信息 -->
      <?php 
if (!empty($output['order_info']['extend_order_common']['promotion_info']) && !empty($output['order_info']['extend_order_common']['voucher_code'])) {
    ?>
      <tr>
      	<th>其它信息</th>
コード例 #30
0
 /**
  * 销售统计
  */
 public function saleOp()
 {
     $model = Model('stat');
     //默认统计当前数据
     if (!$this->search_arr['search_type']) {
         $this->search_arr['search_type'] = 'day';
     }
     //计算昨天和今天时间
     if ($this->search_arr['search_type'] == 'day') {
         $stime = $this->search_arr['day']['search_time'] - 86400;
         //昨天0点
         $etime = $this->search_arr['day']['search_time'] + 86400 - 1;
         //今天24点
         $curr_stime = $this->search_arr['day']['search_time'];
         //今天0点
     } elseif ($this->search_arr['search_type'] == 'week') {
         $current_weekarr = explode('|', $this->search_arr['week']['current_week']);
         $stime = strtotime($current_weekarr[0]) - 86400 * 7;
         $etime = strtotime($current_weekarr[1]) + 86400 - 1;
         $curr_stime = strtotime($current_weekarr[0]);
         //本周0点
     } elseif ($this->search_arr['search_type'] == 'month') {
         $stime = strtotime($this->search_arr['month']['current_year'] . '-' . $this->search_arr['month']['current_month'] . "-01 -1 month");
         $etime = uk86_getMonthLastDay($this->search_arr['month']['current_year'], $this->search_arr['month']['current_month']) + 86400 - 1;
         $curr_stime = strtotime($this->search_arr['month']['current_year'] . '-' . $this->search_arr['month']['current_month'] . "-01");
         //本月0点
     }
     $where = array();
     $where['store_id'] = $_SESSION['store_id'];
     $where['order_add_time'] = array('between', array($stime, $etime));
     if (trim($_GET['order_type']) != '') {
         $where['order_state'] = trim($_GET['order_type']);
     }
     //走势图
     $field = ' COUNT(*) as ordernum,SUM(order_amount) as orderamount ';
     $stat_arr = array();
     //$searchtime_arr = array($stime,$etime);
     if ($this->search_arr['search_type'] == 'day') {
         //构造横轴数据
         for ($i = 0; $i < 24; $i++) {
             //统计图数据
             $curr_arr['orderamount'][$i] = 0;
             //今天
             $up_arr['orderamount'][$i] = 0;
             //昨天
             $curr_arr['ordernum'][$i] = 0;
             //今天
             $up_arr['ordernum'][$i] = 0;
             //昨天
             //统计表数据
             $currlist_arr[$i]['timetext'] = $i;
             $uplist_arr[$i]['val'] = 0;
             $currlist_arr[$i]['val'] = 0;
             //横轴
             $stat_arr['orderamount']['xAxis']['categories'][] = "{$i}";
             $stat_arr['ordernum']['xAxis']['categories'][] = "{$i}";
         }
         $today_day = @date('d', $etime);
         //今天日期
         $yesterday_day = @date('d', $stime);
         //昨天日期
         $field .= ' ,DAY(FROM_UNIXTIME(order_add_time)) as dayval,HOUR(FROM_UNIXTIME(order_add_time)) as hourval ';
         $orderlist = $model->statByStatorder($where, $field, 0, 0, '', 'dayval,hourval');
         foreach ((array) $orderlist as $k => $v) {
             if ($today_day == $v['dayval']) {
                 $curr_arr['ordernum'][$v['hourval']] = intval($v['ordernum']);
                 $curr_arr['orderamount'][$v['hourval']] = floatval($v['orderamount']);
                 $currlist_arr[$v['hourval']]['val'] = $v[$search_type];
             }
             if ($yesterday_day == $v['dayval']) {
                 $up_arr['ordernum'][$v['hourval']] = intval($v['ordernum']);
                 $up_arr['orderamount'][$v['hourval']] = floatval($v['orderamount']);
                 $uplist_arr[$v['hourval']]['val'] = $v[$search_type];
             }
         }
         $stat_arr['ordernum']['series'][0]['name'] = '昨天';
         $stat_arr['ordernum']['series'][0]['data'] = array_values($up_arr['ordernum']);
         $stat_arr['ordernum']['series'][1]['name'] = '今天';
         $stat_arr['ordernum']['series'][1]['data'] = array_values($curr_arr['ordernum']);
         $stat_arr['orderamount']['series'][0]['name'] = '昨天';
         $stat_arr['orderamount']['series'][0]['data'] = array_values($up_arr['orderamount']);
         $stat_arr['orderamount']['series'][1]['name'] = '今天';
         $stat_arr['orderamount']['series'][1]['data'] = array_values($curr_arr['orderamount']);
     }
     if ($this->search_arr['search_type'] == 'week') {
         $up_week = @date('W', $stime);
         //上周
         $curr_week = @date('W', $etime);
         //本周
         //构造横轴数据
         for ($i = 1; $i <= 7; $i++) {
             $tmp_weekarr = uk86_getSystemWeekArr();
             //统计图数据
             $up_arr['ordernum'][$i] = 0;
             $curr_arr['ordernum'][$i] = 0;
             $up_arr['orderamount'][$i] = 0;
             $curr_arr['orderamount'][$i] = 0;
             //横轴
             $stat_arr['ordernum']['xAxis']['categories'][] = $tmp_weekarr[$i];
             $stat_arr['orderamount']['xAxis']['categories'][] = $tmp_weekarr[$i];
             //统计表数据
             $uplist_arr[$i]['timetext'] = $tmp_weekarr[$i];
             $currlist_arr[$i]['timetext'] = $tmp_weekarr[$i];
             $uplist_arr[$i]['val'] = 0;
             $currlist_arr[$i]['val'] = 0;
             unset($tmp_weekarr);
         }
         $field .= ',WEEKOFYEAR(FROM_UNIXTIME(order_add_time)) as weekval,WEEKDAY(FROM_UNIXTIME(order_add_time))+1 as dayofweekval ';
         $orderlist = $model->statByStatorder($where, $field, 0, 0, '', 'weekval,dayofweekval');
         foreach ((array) $orderlist as $k => $v) {
             if ($up_week == $v['weekval']) {
                 $up_arr['ordernum'][$v['dayofweekval']] = intval($v['ordernum']);
                 $up_arr['orderamount'][$v['dayofweekval']] = intval($v['orderamount']);
                 $uplist_arr[$v['dayofweekval']]['val'] = intval($v[$search_type]);
             }
             if ($curr_week == $v['weekval']) {
                 $curr_arr['ordernum'][$v['dayofweekval']] = intval($v['ordernum']);
                 $curr_arr['orderamount'][$v['dayofweekval']] = intval($v['orderamount']);
                 $currlist_arr[$v['dayofweekval']]['val'] = intval($v[$search_type]);
             }
         }
         $stat_arr['ordernum']['series'][0]['name'] = '上周';
         $stat_arr['ordernum']['series'][0]['data'] = array_values($up_arr['ordernum']);
         $stat_arr['ordernum']['series'][1]['name'] = '本周';
         $stat_arr['ordernum']['series'][1]['data'] = array_values($curr_arr['ordernum']);
         $stat_arr['orderamount']['series'][0]['name'] = '上周';
         $stat_arr['orderamount']['series'][0]['data'] = array_values($up_arr['orderamount']);
         $stat_arr['orderamount']['series'][1]['name'] = '本周';
         $stat_arr['orderamount']['series'][1]['data'] = array_values($curr_arr['orderamount']);
     }
     if ($this->search_arr['search_type'] == 'month') {
         $up_month = date('m', $stime);
         $curr_month = date('m', $etime);
         //计算横轴的最大量(由于每个月的天数不同)
         $up_dayofmonth = date('t', $stime);
         $curr_dayofmonth = date('t', $etime);
         $x_max = $up_dayofmonth > $curr_dayofmonth ? $up_dayofmonth : $curr_dayofmonth;
         //构造横轴数据
         for ($i = 1; $i <= $x_max; $i++) {
             //统计图数据
             $up_arr['ordernum'][$i] = 0;
             $curr_arr['ordernum'][$i] = 0;
             $up_arr['orderamount'][$i] = 0;
             $curr_arr['orderamount'][$i] = 0;
             //横轴
             $stat_arr['ordernum']['xAxis']['categories'][] = $i;
             $stat_arr['orderamount']['xAxis']['categories'][] = $i;
             //统计表数据
             $currlist_arr[$i]['timetext'] = $i;
             $uplist_arr[$i]['val'] = 0;
             $currlist_arr[$i]['val'] = 0;
         }
         $field .= ',MONTH(FROM_UNIXTIME(order_add_time)) as monthval,day(FROM_UNIXTIME(order_add_time)) as dayval ';
         $orderlist = $model->statByStatorder($where, $field, 0, 0, '', 'monthval,dayval');
         foreach ($orderlist as $k => $v) {
             if ($up_month == $v['monthval']) {
                 $up_arr['ordernum'][$v['dayval']] = intval($v['ordernum']);
                 $up_arr['orderamount'][$v['dayval']] = floatval($v['orderamount']);
                 $uplist_arr[$v['dayval']]['val'] = intval($v[$search_type]);
             }
             if ($curr_month == $v['monthval']) {
                 $curr_arr['ordernum'][$v['dayval']] = intval($v['ordernum']);
                 $curr_arr['orderamount'][$v['dayval']] = intval($v['orderamount']);
                 $currlist_arr[$v['dayval']]['val'] = intval($v[$search_type]);
             }
         }
         $stat_arr['ordernum']['series'][0]['name'] = '上月';
         $stat_arr['ordernum']['series'][0]['data'] = array_values($up_arr['ordernum']);
         $stat_arr['ordernum']['series'][1]['name'] = '本月';
         $stat_arr['ordernum']['series'][1]['data'] = array_values($curr_arr['ordernum']);
         $stat_arr['orderamount']['series'][0]['name'] = '上月';
         $stat_arr['orderamount']['series'][0]['data'] = array_values($up_arr['orderamount']);
         $stat_arr['orderamount']['series'][1]['name'] = '本月';
         $stat_arr['orderamount']['series'][1]['data'] = array_values($curr_arr['orderamount']);
     }
     $stat_arr['ordernum']['title'] = '订单量统计';
     $stat_arr['ordernum']['yAxis'] = '订单量';
     $stat_arr['orderamount']['title'] = '下单金额统计';
     $stat_arr['orderamount']['yAxis'] = '下单金额';
     $stat_json['ordernum'] = uk86_getStatData_LineLabels($stat_arr['ordernum']);
     $stat_json['orderamount'] = uk86_getStatData_LineLabels($stat_arr['orderamount']);
     Tpl::output('stat_json', $stat_json);
     Tpl::output('stattype', $search_type);
     //总数统计
     $where['order_add_time'] = array('between', array($curr_stime, $etime));
     $statcount_arr = $model->getoneByStatorder($where, ' COUNT(*) as ordernum, SUM(order_amount) as orderamount');
     $statcount_arr['ordernum'] = ($t = intval($statcount_arr['ordernum'])) > 0 ? $t : 0;
     $statcount_arr['orderamount'] = uk86_ncPriceFormat(($t = floatval($statcount_arr['orderamount'])) > 0 ? $t : 0);
     Tpl::output('statcount_arr', $statcount_arr);
     Tpl::output('searchtime', implode('|', array($curr_stime, $etime)));
     Tpl::output('show_page', $model->showpage(2));
     self::profile_menu('sale');
     Tpl::showpage('stat.sale.index');
 }