Esempio n. 1
0
 /**
  * 图片裁剪
  *
  */
 public function pic_cutOp()
 {
     uk86_import('function.thumb');
     if (uk86_chksubmit()) {
         $thumb_width = $_POST['x'];
         $x1 = $_POST["x1"];
         $y1 = $_POST["y1"];
         $x2 = $_POST["x2"];
         $y2 = $_POST["y2"];
         $w = $_POST["w"];
         $h = $_POST["h"];
         $scale = $thumb_width / $w;
         $src = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['url']);
         if (strpos($src, '..') !== false || strpos($src, BASE_UPLOAD_PATH) !== 0) {
             exit;
         }
         $save_file2 = str_replace('_small.', '_sm.', $src);
         $cropped = uk86_resize_thumb($save_file2, $src, $w, $h, $x1, $y1, $scale);
         @unlink($src);
         $pathinfo = pathinfo($save_file2);
         exit($pathinfo['basename']);
     } else {
         Uk86Language::uk86_read('cut');
         $lang = Uk86Language::uk86_getLangContent();
     }
     $save_file = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_GET['url']);
     $_GET['x'] = intval($_GET['x']) > 50 && $_GET['x'] < 400 ? $_GET['x'] : 200;
     $_GET['y'] = intval($_GET['y']) > 50 && $_GET['y'] < 400 ? $_GET['y'] : 200;
     $_GET['resize'] = $_GET['resize'] == '0' ? '0' : '1';
     Tpl::output('height', uk86_get_height($save_file));
     Tpl::output('width', uk86_get_width($save_file));
     Tpl::showpage('cut', 'null_layout');
 }
 public function __construct()
 {
     parent::__construct();
     Uk86Language::uk86_read('member_store_statistics');
     uk86_import('function.statistics');
     uk86_import('function.datehelper');
     $model = Model('stat');
     //存储参数
     $this->search_arr = $_REQUEST;
     //处理搜索时间
     $this->search_arr = $model->dealwithSearchTime($this->search_arr);
     //获得系统年份
     $year_arr = uk86_getSystemYearArr();
     //获得系统月份
     $month_arr = uk86_getSystemMonthArr();
     //获得本月的周时间段
     $week_arr = uk86_getMonthWeekArr($this->search_arr['week']['current_year'], $this->search_arr['week']['current_month']);
     Tpl::output('year_arr', $year_arr);
     Tpl::output('month_arr', $month_arr);
     Tpl::output('week_arr', $week_arr);
     Tpl::output('search_arr', $this->search_arr);
     /**
      * 处理商品分类
      */
     $this->choose_gcid = ($t = intval($_REQUEST['choose_gcid'])) > 0 ? $t : 0;
     $gccache_arr = Model('goods_class')->getGoodsclassCache($this->choose_gcid, 3);
     $this->gc_arr = $gccache_arr['showclass'];
     Tpl::output('gc_json', json_encode($gccache_arr['showclass']));
     Tpl::output('gc_choose_json', json_encode($gccache_arr['choose_gcid']));
 }
Esempio n. 3
0
function uk86_ftpcmd($cmd, $arg1 = '')
{
    uk86_import('libraries.ftp');
    static $ftp;
    $ftpon = C('ftp_open');
    if (!$ftpon) {
        return $cmd == 'error' ? -101 : 0;
    } elseif ($ftp == null) {
        $ftp =& Uk86NcFtp::uk86_instance();
    }
    if (!$ftp->enabled) {
        return $ftp->error();
    } elseif ($ftp->enabled && !$ftp->connectid) {
        $ftp->connect();
    }
    switch ($cmd) {
        case 'upload':
            return $ftp->upload(BASE_PATH . '/' . $arg1, $arg1);
            break;
        case 'delete':
            return $ftp->ftp_delete($arg1);
            break;
        case 'close':
            return $ftp->ftp_close();
            break;
        case 'error':
            return $ftp->error();
            break;
        case 'object':
            return $ftp;
            break;
        default:
            return false;
    }
}
Esempio n. 4
0
 /**
  * 查询每月的周数组
  */
 public function getweekofmonthOp()
 {
     uk86_import('function.datehelper');
     $year = $_GET['y'];
     $month = $_GET['m'];
     $week_arr = uk86_getMonthWeekArr($year, $month);
     echo json_encode($week_arr);
     die;
 }
Esempio n. 5
0
 /**
  * 实例化缓存驱动
  *
  * @param unknown_type $type
  * @param unknown_type $args
  * @return unknown
  */
 public function connect($type, $args = array())
 {
     if (empty($type)) {
         $type = C('cache_open') ? 'redis' : 'file';
     }
     $type = strtolower($type);
     $class = 'Cache' . ucwords($type);
     if (!class_exists($class)) {
         uk86_import('cache.cache#' . $type);
     }
     return new $class($args);
 }
Esempio n. 6
0
 /**
  * 异步调用广告
  *
  */
 public function get_adv_listOp()
 {
     $ap_ids = $_GET['ap_ids'];
     $list = array();
     if (!empty($ap_ids) && is_array($ap_ids)) {
         uk86_import('function.adv');
         foreach ($ap_ids as $key => $value) {
             $ap_id = intval($value);
             //广告位编号
             $adv_info = uk86_advshow($ap_id, 'array');
             if (!empty($adv_info) && is_array($adv_info)) {
                 $list[$ap_id] = $adv_info;
             }
         }
     }
     echo $_GET['callback'] . '(' . json_encode($list) . ')';
     exit;
 }
Esempio n. 7
0
 public function __construct()
 {
     parent::__construct();
     Uk86Language::uk86_read('stat');
     uk86_import('function.statistics');
     uk86_import('function.datehelper');
     $model = Model('stat');
     //存储参数
     $this->search_arr = $_REQUEST;
     //处理搜索时间
     $this->search_arr = $model->dealwithSearchTime($this->search_arr);
     //获得系统年份
     $year_arr = uk86_getSystemYearArr();
     //获得系统月份
     $month_arr = uk86_getSystemMonthArr();
     //获得本月的周时间段
     $week_arr = uk86_getMonthWeekArr($this->search_arr['week']['current_year'], $this->search_arr['week']['current_month']);
     Tpl::output('year_arr', $year_arr);
     Tpl::output('month_arr', $month_arr);
     Tpl::output('week_arr', $week_arr);
     Tpl::output('search_arr', $this->search_arr);
 }
Esempio n. 8
0
 public function __construct()
 {
     parent::__construct();
     Uk86Language::uk86_read('stat');
     uk86_import('function.statistics');
 }
Esempio n. 9
0
 /**
  * 裁剪
  *
  */
 public function cutOp()
 {
     if (uk86_chksubmit()) {
         $thumb_width = 120;
         $x1 = $_POST["x1"];
         $y1 = $_POST["y1"];
         $x2 = $_POST["x2"];
         $y2 = $_POST["y2"];
         $w = $_POST["w"];
         $h = $_POST["h"];
         $scale = $thumb_width / $w;
         $_POST['newfile'] = str_replace('..', '', $_POST['newfile']);
         if (strpos($_POST['newfile'], "avatar_{$_SESSION['member_id']}_new.") !== 0) {
             uk86_redirect('index.php?act=member_information&op=avatar');
         }
         $src = BASE_UPLOAD_PATH . DS . ATTACH_AVATAR . DS . $_POST['newfile'];
         $avatarfile = BASE_UPLOAD_PATH . DS . ATTACH_AVATAR . DS . "avatar_{$_SESSION['member_id']}.jpg";
         uk86_import('function.thumb');
         $cropped = uk86_resize_thumb($avatarfile, $src, $w, $h, $x1, $y1, $scale);
         @unlink($src);
         Model('member')->editMember(array('member_id' => $_SESSION['member_id']), array('member_avatar' => 'avatar_' . $_SESSION['member_id'] . '.jpg'));
         $_SESSION['avatar'] = 'avatar_' . $_SESSION['member_id'] . '.jpg';
         uk86_redirect('index.php?act=member_information&op=avatar');
     }
 }
Esempio n. 10
0
 /**
  * 订单列表
  */
 public function salelistOp()
 {
     $model = Model('stat');
     $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
     foreach ((array) $searchtime_arr_tmp as $k => $v) {
         $searchtime_arr[] = intval($v);
     }
     $where = array();
     $where['store_id'] = $_SESSION['store_id'];
     $where['order_add_time'] = array('between', $searchtime_arr);
     if (trim($_GET['order_type']) != '') {
         $where['order_state'] = trim($_GET['order_type']);
     }
     if ($_GET['exporttype'] == 'excel') {
         $order_list = $model->statByStatorder($where, '', 0, 0, 'order_id desc');
     } else {
         $order_list = $model->statByStatorder($where, '', 10, 0, 'order_id desc');
     }
     //统计数据标题
     $statlist = array();
     $statheader = array();
     $statheader[] = array('text' => '订单编号', 'key' => 'order_sn');
     $statheader[] = array('text' => '买家', 'key' => 'buyer_name');
     $statheader[] = array('text' => '下单时间', 'key' => 'order_add_time');
     $statheader[] = array('text' => '订单总额', 'key' => 'order_amount');
     $statheader[] = array('text' => '订单状态', 'key' => 'order_statetext');
     foreach ((array) $order_list as $k => $v) {
         $v['order_add_time'] = @date('Y-m-d H:i:s', $v['order_add_time']);
         switch ($v['order_state']) {
             case ORDER_STATE_CANCEL:
                 $v['order_statetext'] = '已取消';
                 break;
             case ORDER_STATE_NEW:
                 $v['order_statetext'] = '待付款';
                 break;
             case ORDER_STATE_PAY:
                 $v['order_statetext'] = '待发货';
                 break;
             case ORDER_STATE_SEND:
                 $v['order_statetext'] = '待收货';
                 break;
             case ORDER_STATE_SUCCESS:
                 $v['order_statetext'] = '交易完成';
                 break;
         }
         $statlist[$k] = $v;
     }
     //导出Excel
     if ($this->search_arr['exporttype'] == 'excel') {
         //导出Excel
         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
         foreach ($statheader as $k => $v) {
             $excel_data[0][] = array('styleid' => 's_title', 'data' => $v['text']);
         }
         //data
         foreach ($statlist as $k => $v) {
             foreach ($statheader as $h_k => $h_v) {
                 $excel_data[$k + 1][] = array('data' => $v[$h_v['key']]);
             }
         }
         $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) . date('Y-m-d-H', time()));
         exit;
     }
     Tpl::output('statheader', $statheader);
     Tpl::output('statlist', $statlist);
     Tpl::output('show_page', $model->showpage(2));
     Tpl::output('actionurl', "index.php?act={$this->search_arr['act']}&op={$this->search_arr['op']}&order_type={$this->search_arr['order_type']}&t={$this->search_arr['t']}");
     Tpl::showpage('stat.listandorder', 'null_layout');
 }
Esempio n. 11
0
 /**
  * 生成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()));
 }
Esempio n. 12
0
 /**
  * 下载F码
  */
 public function download_f_code_excelOp()
 {
     $common_id = $_GET['commonid'];
     if ($common_id <= 0) {
         uk86_showMessage(L('wrong_argument'), '', '', 'error');
     }
     $common_info = Model('goods')->getGoodeCommonInfoByID($common_id);
     if (empty($common_info) || $common_info['store_id'] != $_SESSION['store_id']) {
         uk86_showMessage(L('wrong_argument'), '', '', 'error');
     }
     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' => '使用状态');
     $data = Model('goods_fcode')->getGoodsFCodeList(array('goods_commonid' => $common_id));
     foreach ($data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['fc_code']);
         $tmp[] = array('data' => $v['fc_state'] ? '已使用' : '未使用');
         $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($common_info['goods_name'], CHARSET));
     $excel_obj->uk86_generateXML($excel_obj->uk86_charset($common_info['goods_name'], CHARSET) . '-' . date('Y-m-d-H', time()));
 }
Esempio n. 13
0
 /**
  * 生成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_pi_member'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pi_system'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pi_point'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pi_time'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pi_jd'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_pi_ms'));
     $state_cn = array(Uk86Language::uk86_get('admin_points_stage_regist'), Uk86Language::uk86_get('admin_points_stage_login'), Uk86Language::uk86_get('admin_points_stage_comments'), Uk86Language::uk86_get('admin_points_stage_order'), Uk86Language::uk86_get('admin_points_stage_system'), Uk86Language::uk86_get('admin_points_stage_pointorder'), Uk86Language::uk86_get('admin_points_stage_app'));
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['pl_membername']);
         $tmp[] = array('data' => $v['pl_adminname']);
         $tmp[] = array('format' => 'Number', 'data' => uk86_ncPriceFormat($v['pl_points']));
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['pl_addtime']));
         $tmp[] = array('data' => str_replace(array('regist', 'login', 'comments', 'order', 'system', 'pointorder', 'app'), $state_cn, $v['pl_stage']));
         $tmp[] = array('data' => $v['pl_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(L('exp_pi_jfmx'), CHARSET));
     $excel_obj->uk86_generateXML($excel_obj->uk86_charset(L('exp_pi_jfmx'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
Esempio n. 14
0
 /**
  * 生成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()));
 }
Esempio n. 15
0
 /**
  * 从第三方取快递信息
  */
 public function ajax_get_expressOp()
 {
     $url = 'http://www.kuaidi100.com/query?type=' . $_GET['e_code'] . '&postid=' . $_GET['shipping_code'] . '&id=1&valicode=&temp=' . uk86_random(4) . '&sessionid=&tmp=' . uk86_random(4);
     uk86_import('function.ftp');
     $content = uk86_dfsockopen($url);
     $content = json_decode($content, true);
     if ($content['status'] != 200) {
         exit(json_encode(false));
     }
     $content['data'] = array_reverse($content['data']);
     $output = array();
     if (is_array($content['data'])) {
         foreach ($content['data'] as $k => $v) {
             if ($v['time'] == '') {
                 continue;
             }
             $output[] = $v['time'] . '&nbsp;&nbsp;' . $v['context'];
         }
     }
     if (empty($output)) {
         exit(json_encode(false));
     }
     echo json_encode($output);
 }
Esempio n. 16
0
 /**
  * 生成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' => '充值卡卡号');
     $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' => '领取人');
     //data
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => "\t" . $v['sn']);
         $tmp[] = array('data' => "\t" . $v['batchflag']);
         $tmp[] = array('data' => "\t" . $v['denomination']);
         $tmp[] = array('data' => "\t" . $v['admin_name']);
         $tmp[] = array('data' => "\t" . date('Y-m-d H:i:s', $v['tscreated']));
         if ($v['state'] == 1 && $v['member_id'] > 0 && $v['tsused'] > 0) {
             $tmp[] = array('data' => "\t" . $v['member_name']);
         } else {
             $tmp[] = array('data' => "\t-");
         }
         $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()));
 }
Esempio n. 17
0
 /**
  * 添加水印
  */
 public function album_pic_watermarkOp()
 {
     if (empty($_POST['id']) && !is_array($_POST['id'])) {
         showDialog(Uk86Language::uk86_get('album_parameter_error'));
     }
     $id = trim(implode(',', $_POST['id']), ',');
     /**
      * 实例化图片模型
      */
     $model_album = Model('album');
     $param['in_apic_id'] = $id;
     $param['store_id'] = $_SESSION['store_id'];
     $wm_list = $model_album->getPicList($param);
     $model_store_wm = Model('store_watermark');
     $store_wm_info = $model_store_wm->getOneStoreWMByStoreId($_SESSION['store_id']);
     if ($store_wm_info['wm_image_name'] == '' && $store_wm_info['wm_text'] == '') {
         showDialog(Uk86Language::uk86_get('album_class_setting_wm'), "index.php?act=store_album&op=store_watermark", 'error', 'CUR_DIALOG.close();');
         //"请先设置水印"
     }
     uk86_import('libraries.uk86gdimage');
     $gd_image = new Uk86GdImage();
     $gd_image->uk86_setWatermark($store_wm_info);
     foreach ($wm_list as $v) {
         $gd_image->uk86_create(BASE_UPLOAD_PATH . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . str_ireplace('.', '_1280.', $v['apic_cover']));
         //生成有水印的大图
     }
     showDialog(Uk86Language::uk86_get('album_pic_plus_wm_succeed'), 'reload', 'succ');
 }
Esempio n. 18
0
 /**
  * 订单统计
  */
 public function saleOp()
 {
     $model = Model('stat');
     //存储参数
     $this->search_arr = $_REQUEST;
     //处理搜索时间
     $this->search_arr = $model->dealwithSearchTime($this->search_arr);
     //获得系统年份
     $year_arr = uk86_getSystemYearArr();
     //获得系统月份
     $month_arr = uk86_getSystemMonthArr();
     //获得本月的周时间段
     $week_arr = uk86_getMonthWeekArr($this->search_arr['week']['current_year'], $this->search_arr['week']['current_month']);
     Tpl::output('year_arr', $year_arr);
     Tpl::output('month_arr', $month_arr);
     Tpl::output('week_arr', $week_arr);
     Tpl::output('search_arr', $this->search_arr);
     //默认统计当前数据
     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['order_add_time'] = array('between', array($curr_stime, $etime));
     if (trim($_GET['order_type']) != '') {
         $where['order_state'] = trim($_GET['order_type']);
     }
     if (trim($_GET['store_name']) != '') {
         $where['store_name'] = array('like', '%' . trim($_GET['store_name']) . '%');
     }
     if ($_GET['exporttype'] == 'excel') {
         $order_list = $model->statByStatorder($where, '', 0, 0, 'order_id desc', '');
     } else {
         $order_list = $model->statByStatorder($where, '', 10, 0, 'order_id desc', '');
     }
     //统计数据标题
     $statlist = array();
     $statlist['headertitle'] = array('订单号', '买家', '店铺名称', '下单时间', '订单总额', '订单状态');
     foreach ((array) $order_list as $k => $v) {
         switch ($v['order_state']) {
             case ORDER_STATE_CANCEL:
                 $v['order_statetext'] = '已取消';
                 break;
             case ORDER_STATE_NEW:
                 $v['order_statetext'] = '待付款';
                 break;
             case ORDER_STATE_PAY:
                 $v['order_statetext'] = '待发货';
                 break;
             case ORDER_STATE_SEND:
                 $v['order_statetext'] = '待收货';
                 break;
             case ORDER_STATE_SUCCESS:
                 $v['order_statetext'] = '交易完成';
                 break;
         }
         $statlist['data'][$k] = $v;
     }
     //导出Excel
     if ($_GET['exporttype'] == 'excel') {
         //导出Excel
         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
         foreach ($statlist['headertitle'] as $v) {
             $excel_data[0][] = array('styleid' => 's_title', 'data' => $v);
         }
         //data
         foreach ((array) $statlist['data'] as $k => $v) {
             $excel_data[$k + 1][] = array('data' => $v['order_sn']);
             $excel_data[$k + 1][] = array('data' => $v['buyer_name']);
             $excel_data[$k + 1][] = array('data' => $v['store_name']);
             $excel_data[$k + 1][] = array('data' => date('Y-m-d H:i:s', $v['order_add_time']));
             $excel_data[$k + 1][] = array('data' => number_format($v['order_amount'], 2));
             $excel_data[$k + 1][] = array('data' => $v['order_statetext']);
         }
         $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) . date('Y-m-d-H', time()));
         exit;
     } else {
         //总数统计
         $statcount_arr = $model->getoneByStatorder($where, ' COUNT(*) as ordernum, SUM(order_amount) as orderamount');
         Tpl::output('statcount_arr', $statcount_arr);
         Tpl::output('searchtime', implode('|', array($stime, $etime)));
         Tpl::output('statlist', $statlist);
         Tpl::output('show_page', $model->showpage());
         Tpl::output('top_link', $this->sublink($this->links, 'sale'));
         Tpl::showpage('stat.sale');
     }
 }
Esempio n. 19
0
 /**
  * 导出预存款明细excel
  *
  * @param array $data
  */
 private function createmxExcel($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_mx_member'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_ctime'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_av_money'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_freeze_money'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_system'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('exp_mx_mshu'));
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['lg_member_name']);
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['lg_add_time']));
         if (floatval($v['lg_av_amount']) == 0) {
             $tmp[] = array('data' => '');
         } else {
             $tmp[] = array('format' => 'Number', 'data' => uk86_ncPriceFormat($v['lg_av_amount']));
         }
         if (floatval($v['lg_freeze_amount']) == 0) {
             $tmp[] = array('data' => '');
         } else {
             $tmp[] = array('format' => 'Number', 'data' => uk86_ncPriceFormat($v['lg_freeze_amount']));
         }
         $tmp[] = array('data' => $v['lg_admin_name']);
         $tmp[] = array('data' => $v['lg_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(L('exp_mx_rz'), CHARSET));
     $excel_obj->uk86_generateXML($excel_obj->uk86_charset(L('exp_mx_rz'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
Esempio n. 20
0
 /**
  * 生成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('admin_log_man'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('admin_log_do'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => L('admin_log_dotime'));
     $excel_data[0][] = array('styleid' => 's_title', 'data' => 'IP');
     foreach ((array) $data as $k => $v) {
         $tmp = array();
         $tmp[] = array('data' => $v['admin_name']);
         $tmp[] = array('data' => $v['content']);
         $tmp[] = array('data' => date('Y-m-d H:i:s', $v['createtime']));
         $tmp[] = array('data' => $v['ip']);
         $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('nc_admin_log'), CHARSET));
     $excel_obj->uk86_generateXML($excel_obj->uk86_charset(L('nc_admin_log'), CHARSET) . $_GET['curpage'] . '-' . date('Y-m-d-H', time()));
 }
Esempio n. 21
0
 /**
  * 店铺动态评分统计
  */
 public function evalstoreOp()
 {
     //店铺分类
     Tpl::output('class_list', uk86_rkcache('store_class', true));
     $model = Model('stat');
     $where = array();
     if (intval($_GET['store_class']) > 0) {
         $where['sc_id'] = intval($_GET['store_class']);
     }
     if (trim($this->search_arr['storename'])) {
         $where['seval_storename'] = array('like', "%" . trim($this->search_arr['storename']) . "%");
     }
     $field = ' seval_storeid, seval_storename';
     $field .= ' ,(SUM(seval_desccredit)/COUNT(*)) as avgdesccredit';
     $field .= ' ,(SUM(seval_servicecredit)/COUNT(*)) as avgservicecredit';
     $field .= ' ,(SUM(seval_deliverycredit)/COUNT(*)) as avgdeliverycredit';
     $orderby_arr = array('avgdesccredit asc', 'avgdesccredit desc', 'avgservicecredit asc', 'avgservicecredit desc', 'avgdeliverycredit asc', 'avgdeliverycredit desc');
     if (!in_array(trim($this->search_arr['orderby']), $orderby_arr)) {
         $this->search_arr['orderby'] = 'avgdesccredit desc';
     }
     $orderby = trim($this->search_arr['orderby']) . ',seval_storeid';
     //查询评论的店铺总数
     $count_arr = $model->statByStoreAndEvaluatestore($where, 'count(DISTINCT evaluate_store.seval_storeid) as countnum');
     $countnum = intval($count_arr[0]['countnum']);
     if ($this->search_arr['exporttype'] == 'excel') {
         $statlist_tmp = $model->statByStoreAndEvaluatestore($where, $field, 0, 0, $orderby, 'seval_storeid');
     } else {
         $statlist_tmp = $model->statByStoreAndEvaluatestore($where, $field, array(10, $countnum), 0, $orderby, 'seval_storeid');
     }
     foreach ((array) $statlist_tmp as $k => $v) {
         $tmp = $v;
         $tmp['avgdesccredit'] = round($v['avgdesccredit'], 2);
         $tmp['avgservicecredit'] = round($v['avgservicecredit'], 2);
         $tmp['avgdeliverycredit'] = round($v['avgdeliverycredit'], 2);
         $statlist[] = $tmp;
     }
     //导出Excel
     if ($this->search_arr['exporttype'] == 'excel') {
         //导出Excel
         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' => '发货速度');
         //data
         foreach ((array) $statlist as $k => $v) {
             $excel_data[$k + 1][] = array('data' => $v['seval_storename']);
             $excel_data[$k + 1][] = array('data' => $v['avgdesccredit']);
             $excel_data[$k + 1][] = array('data' => $v['avgservicecredit']);
             $excel_data[$k + 1][] = array('data' => $v['avgdeliverycredit']);
         }
         $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) . date('Y-m-d-H', time()));
         exit;
     }
     Tpl::output('statlist', $statlist);
     Tpl::output('orderby', $this->search_arr['orderby']);
     Tpl::output('show_page', $model->showpage(2));
     Tpl::output('top_link', $this->sublink($this->links, 'evalstore'));
     Tpl::showpage('stat.aftersale.evalstore');
 }
Esempio n. 22
0
 /**
  * 区域分析之详细列表
  */
 public function area_listOp()
 {
     $model = Model('stat');
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
     foreach ((array) $searchtime_arr_tmp as $k => $v) {
         $searchtime_arr[] = intval($v);
     }
     $where['order_add_time'] = array('between', $searchtime_arr);
     $field = ' reciver_province_id, COUNT(*) as ordernum,SUM(order_amount) as orderamount, COUNT(DISTINCT buyer_id) as membernum ';
     $orderby_arr = array('membernum asc', 'membernum desc', 'orderamount asc', 'orderamount desc', 'ordernum asc', 'ordernum desc');
     if (!in_array(trim($this->search_arr['orderby']), $orderby_arr)) {
         $this->search_arr['orderby'] = 'membernum desc';
     }
     $orderby = trim($this->search_arr['orderby']) . ',reciver_province_id';
     $count_arr = $model->getoneByStatorder($where, 'COUNT(DISTINCT reciver_province_id) as countnum');
     $countnum = intval($count_arr['countnum']);
     if ($this->search_arr['exporttype'] == 'excel') {
         $statlist_tmp = $model->statByStatorder($where, $field, 0, 0, $orderby, 'reciver_province_id');
     } else {
         $statlist_tmp = $model->statByStatorder($where, $field, array(10, $countnum), 0, $orderby, 'reciver_province_id');
     }
     // 地区
     $province_array = Model('area')->getTopLevelAreas();
     $statheader = array();
     $statheader[] = array('text' => '省份', 'key' => 'provincename');
     $statheader[] = array('text' => '下单会员数', 'key' => 'membernum', 'isorder' => 1);
     $statheader[] = array('text' => '下单金额', 'key' => 'orderamount', 'isorder' => 1);
     $statheader[] = array('text' => '下单量', 'key' => 'ordernum', 'isorder' => 1);
     $statlist = array();
     foreach ((array) $statlist_tmp as $k => $v) {
         $province_id = intval($v['reciver_province_id']);
         $tmp = array();
         $tmp['provincename'] = ($t = $province_array[$province_id]) ? $t : '其他';
         $tmp['membernum'] = $v['membernum'];
         $tmp['orderamount'] = $v['orderamount'];
         $tmp['ordernum'] = $v['ordernum'];
         $statlist[] = $tmp;
     }
     //导出Excel
     if ($this->search_arr['exporttype'] == 'excel') {
         //导出Excel
         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
         foreach ($statheader as $k => $v) {
             $excel_data[0][] = array('styleid' => 's_title', 'data' => $v['text']);
         }
         //data
         foreach ($statlist as $k => $v) {
             foreach ($statheader as $h_k => $h_v) {
                 $excel_data[$k + 1][] = array('data' => $v[$h_v['key']]);
             }
         }
         $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) . date('Y-m-d-H', time()));
         exit;
     }
     Tpl::output('statlist', $statlist);
     Tpl::output('statheader', $statheader);
     Tpl::output('orderby', $this->search_arr['orderby']);
     Tpl::output('actionurl', "index.php?act={$this->search_arr['act']}&op={$this->search_arr['op']}&t={$this->search_arr['t']}");
     Tpl::output('show_page', $model->showpage(2));
     Tpl::output('top_link', $this->sublink($this->links, 'area'));
     Tpl::showpage('stat.listandorder', 'null_layout');
 }
Esempio n. 23
0
 /**
  * 商品销售明细
  */
 public function goods_saleOp()
 {
     if (!$this->search_arr['search_type']) {
         $this->search_arr['search_type'] = 'day';
     }
     $model = Model('stat');
     //获得搜索的开始时间和结束时间
     $searchtime_arr = $model->getStarttimeAndEndtime($this->search_arr);
     //获取相关数据
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', $searchtime_arr);
     //品牌
     $brand_id = intval($_REQUEST['b_id']);
     if ($brand_id > 0) {
         $where['brand_id'] = $brand_id;
     }
     //商品分类
     if ($this->choose_gcid > 0) {
         //获得分类深度
         $depth = $this->gc_arr[$this->choose_gcid]['depth'];
         $where['gc_parentid_' . $depth] = $this->choose_gcid;
     }
     if (trim($_GET['goods_name'])) {
         $where['goods_name'] = array('like', '%' . trim($_GET['goods_name']) . '%');
     }
     if (trim($_GET['store_name'])) {
         $where['store_name'] = array('like', '%' . trim($_GET['store_name']) . '%');
     }
     $field = 'goods_id,goods_name,store_id,store_name,goods_commonid,SUM(goods_num) as goodsnum,COUNT(DISTINCT order_id) as ordernum,SUM(goods_pay_price) as goodsamount';
     //排序
     $orderby_arr = array('goodsnum asc', 'goodsnum desc', 'ordernum asc', 'ordernum desc', 'goodsamount asc', 'goodsamount desc');
     if (!in_array(trim($this->search_arr['orderby']), $orderby_arr)) {
         $this->search_arr['orderby'] = 'goodsnum desc';
     }
     $orderby = trim($this->search_arr['orderby']) . ',goods_id asc';
     //查询记录总条数
     $count_arr = $model->getoneByStatordergoods($where, 'COUNT(DISTINCT goods_id) as countnum');
     $countnum = intval($count_arr['countnum']);
     if ($_GET['exporttype'] == 'excel') {
         $goods_list = $model->statByStatordergoods($where, $field, 0, 0, $orderby, 'goods_id');
     } else {
         $goods_list = $model->statByStatordergoods($where, $field, array(10, $countnum), 0, $orderby, 'goods_id');
     }
     //导出Excel
     if ($_GET['exporttype'] == 'excel') {
         //导出Excel
         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' => '下单单量');
         $excel_data[0][] = array('styleid' => 's_title', 'data' => '下单金额');
         //data
         foreach ($goods_list as $k => $v) {
             $excel_data[$k + 1][] = array('data' => $v['goods_name']);
             $excel_data[$k + 1][] = array('data' => $v['goods_commonid']);
             $excel_data[$k + 1][] = array('data' => $v['store_name']);
             $excel_data[$k + 1][] = array('data' => $v['goodsnum']);
             $excel_data[$k + 1][] = array('data' => $v['ordernum']);
             $excel_data[$k + 1][] = array('data' => $v['goodsamount']);
         }
         $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) . date('Y-m-d-H', time()));
         exit;
     } else {
         //查询品牌
         $brand_list = Model('brand')->getBrandList(array('brand_apply' => 1));
         Tpl::output('brand_list', $brand_list);
         Tpl::output('goods_list', $goods_list);
         Tpl::output('show_page', $model->showpage(2));
         Tpl::output('orderby', $this->search_arr['orderby']);
         Tpl::output('top_link', $this->sublink($this->links, 'goods_sale'));
         Tpl::showpage('stat.goodssale');
     }
 }
Esempio n. 24
0
 /**
  * 抢购商品统计
  */
 public function groupgoodsOp()
 {
     $model = Model('stat');
     $where = array();
     $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
     foreach ((array) $searchtime_arr_tmp as $k => $v) {
         $searchtime_arr[] = intval($v);
     }
     $where['order_add_time'] = array('between', $searchtime_arr);
     $where['goods_type'] = 2;
     //抢购
     $field = " goods_id,goods_name";
     $field .= " ,SUM(goods_num) as goodsnum";
     $field .= " ,SUM(goods_pay_price) as goodsamount";
     $field .= " ,SUM(IF(order_state='" . ORDER_STATE_CANCEL . "',goods_num,0)) as cancelgoodsnum";
     $field .= " ,SUM(IF(order_state='" . ORDER_STATE_CANCEL . "',goods_pay_price,0)) as cancelgoodsamount";
     $field .= " ,SUM(IF(order_state<>'" . ORDER_STATE_CANCEL . "' and order_state<>'" . ORDER_STATE_NEW . "',goods_num,0)) as finishgoodsnum";
     $field .= " ,SUM(IF(order_state<>'" . ORDER_STATE_CANCEL . "' and order_state<>'" . ORDER_STATE_NEW . "',goods_pay_price,0)) as finishgoodsamount";
     $orderby_arr = array('goodsnum asc', 'goodsnum desc', 'goodsamount asc', 'goodsamount desc', 'cancelgoodsnum asc', 'cancelgoodsnum desc', 'cancelgoodsamount asc', 'cancelgoodsamount desc', 'finishgoodsnum asc', 'finishgoodsnum desc', 'finishgoodsamount asc', 'finishgoodsamount desc');
     if (!in_array(trim($this->search_arr['orderby']), $orderby_arr)) {
         $this->search_arr['orderby'] = 'goodsnum desc';
     }
     $orderby = trim($this->search_arr['orderby']) . ',goods_id desc';
     //统计记录总条数
     $count_arr = $model->getoneByStatordergoods($where, 'count(DISTINCT goods_id) as countnum');
     $countnum = intval($count_arr['countnum']);
     if ($this->search_arr['exporttype'] == 'excel') {
         $statlist_tmp = $model->statByStatordergoods($where, $field, 0, 0, $orderby, 'goods_id');
     } else {
         $statlist_tmp = $model->statByStatordergoods($where, $field, array(10, $countnum), 0, $orderby, 'goods_id');
     }
     $statheader = array();
     $statheader[] = array('text' => '商品名称', 'key' => 'goods_name', 'class' => 'alignleft');
     $statheader[] = array('text' => '下单商品数', 'key' => 'goodsnum', 'isorder' => 1);
     $statheader[] = array('text' => '下单金额', 'key' => 'goodsamount', 'isorder' => 1);
     $statheader[] = array('text' => '取消商品数', 'key' => 'cancelgoodsnum', 'isorder' => 1);
     $statheader[] = array('text' => '取消金额', 'key' => 'cancelgoodsamount', 'isorder' => 1);
     $statheader[] = array('text' => '完成商品数', 'key' => 'finishgoodsnum', 'isorder' => 1);
     $statheader[] = array('text' => '完成金额', 'key' => 'finishgoodsamount', 'isorder' => 1);
     foreach ((array) $statlist_tmp as $k => $v) {
         $tmp = $v;
         foreach ($statheader as $h_k => $h_v) {
             $tmp[$h_v['key']] = $v[$h_v['key']];
             if ($h_v['key'] == 'goods_name') {
                 $tmp[$h_v['key']] = '<a href="' . uk86_urlShop('goods', 'index', array('goods_id' => $v['goods_id'])) . '" target="_blank">' . $v['goods_name'] . '</a>';
             }
         }
         $statlist[] = $tmp;
     }
     if ($this->search_arr['exporttype'] == 'excel') {
         //导出Excel
         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
         foreach ($statheader as $k => $v) {
             $excel_data[0][] = array('styleid' => 's_title', 'data' => $v['text']);
         }
         //data
         foreach ((array) $statlist as $k => $v) {
             foreach ($statheader as $h_k => $h_v) {
                 $excel_data[$k + 1][] = array('data' => $v[$h_v['key']]);
             }
         }
         $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) . date('Y-m-d-H', time()));
         exit;
     } else {
         Tpl::output('statheader', $statheader);
         Tpl::output('statlist', $statlist);
         Tpl::output('show_page', $model->showpage(2));
         Tpl::output('searchtime', $_GET['t']);
         Tpl::output('orderby', $this->search_arr['orderby']);
         Tpl::output('actionurl', "index.php?act={$this->search_arr['act']}&op={$this->search_arr['op']}&t={$this->search_arr['t']}");
         Tpl::showpage('stat.listandorder', 'null_layout');
     }
 }
Esempio n. 25
0
 /**
  * 全文搜索
  *
  */
 private function full_search($search_txt)
 {
     $conf = C('fullindexer');
     uk86_import('libraries.sphinx');
     $cl = new SphinxClient();
     $cl->SetServer($conf['host'], $conf['port']);
     $cl->SetConnectTimeout(1);
     $cl->SetArrayResult(true);
     $cl->SetRankingMode($conf['rankingmode'] ? $conf['rankingmode'] : 0);
     $cl->setLimits(0, $conf['querylimit']);
     $matchmode = $conf['matchmode'];
     $cl->setMatchMode($matchmode);
     //可以使用全文搜索进行状态筛选及排序,但需要经常重新生成索引,否则结果不太准,所以暂不使用。使用数据库,速度会慢些
     //		$cl->SetFilter('store_state',array(1),false);
     //		if ($_GET['key'] == 'store_credit'){
     //			$order = $_GET['order'] == 'desc' ? SPH_SORT_ATTR_DESC : SPH_SORT_ATTR_ASC;
     //			$cl->SetSortMode($order,'store_sort');
     //		}
     $res = $cl->Query($search_txt, $conf['index_shop']);
     if ($res) {
         if (is_array($res['matches'])) {
             foreach ($res['matches'] as $value) {
                 $matchs_id[] = $value['id'];
             }
         }
     }
     if ($search_txt != '') {
         $condition['store.store_id'] = array('in', $matchs_id);
     }
     return $condition;
 }
Esempio n. 26
0
 /**
  * 从第三方取快递信息
  *
  */
 public function get_expressOp()
 {
     $url = 'http://www.kuaidi100.com/query?type=' . $_GET['e_code'] . '&postid=' . $_GET['shipping_code'] . '&id=1&valicode=&temp=' . uk86_random(4) . '&sessionid=&tmp=' . uk86_random(4);
     uk86_import('function.ftp');
     $content = uk86_dfsockopen($url);
     $content = json_decode($content, true);
     if ($content['status'] != 200) {
         exit(json_encode(false));
     }
     $content['data'] = array_reverse($content['data']);
     $output = '';
     if (is_array($content['data'])) {
         foreach ($content['data'] as $k => $v) {
             if ($v['time'] == '') {
                 continue;
             }
             $output .= '<li>' . $v['time'] . '&nbsp;&nbsp;' . $v['context'] . '</li>';
         }
     }
     if ($output == '') {
         exit(json_encode(false));
     }
     if (strtoupper(CHARSET) == 'GBK') {
         $output = Uk86Language::uk86_getUTF8($output);
         //网站GBK使用编码时,转换为UTF-8,防止json输出汉字问题
     }
     echo json_encode($output);
 }
Esempio n. 27
0
/**
 * 输出聊天信息
 *
 * @return string
 */
function uk86_getChat($layout)
{
    if (!C('node_chat') || !file_exists(BASE_CORE_PATH . '/framework/libraries/uk86chat.php')) {
        return 'error';
    }
    if (!class_exists('Uk86Chat')) {
        uk86_import('libraries.chat');
    }
    return Uk86Chat::uk86_getChatHtml($layout);
}
Esempio n. 28
0
 /**
  * 店铺销售统计列表
  */
 public function storesales_listOp()
 {
     $model = Model('stat');
     $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
     foreach ((array) $searchtime_arr_tmp as $k => $v) {
         $searchtime_arr[] = intval($v);
     }
     $where = array();
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', $searchtime_arr);
     //店铺分类
     $search_sclass = intval($_REQUEST['search_sclass']);
     if ($search_sclass) {
         $where['sc_id'] = $search_sclass;
     }
     //店铺名称
     $where['store_name'] = array('like', "%{$_GET['search_sname']}%");
     //查询总条数
     $count_arr = $model->getoneByStatorder($where, 'COUNT(DISTINCT store_id) as countnum');
     $countnum = intval($count_arr['countnum']);
     //列表字段
     $field = " store_id,store_name,SUM(order_amount) as orderamount, COUNT(*) as ordernum, COUNT(DISTINCT buyer_id) as membernum";
     //排序
     $orderby_arr = array('membernum asc', 'membernum desc', 'ordernum asc', 'ordernum desc', 'orderamount asc', 'orderamount desc');
     if (!in_array(trim($this->search_arr['orderby']), $orderby_arr)) {
         $this->search_arr['orderby'] = 'membernum desc';
     }
     $orderby = trim($this->search_arr['orderby']) . ',store_id asc';
     if ($this->search_arr['exporttype'] == 'excel') {
         $statlist = $model->statByStatorder($where, $field, 0, 0, $orderby, 'store_id');
     } else {
         $statlist = $model->statByStatorder($where, $field, array(20, $countnum), 0, $orderby, 'store_id');
         foreach ((array) $statlist as $k => $v) {
             $v['view'] = "<a href='javascript:void(0);' nc_type='showtrends' data-param='{\"storeid\":\"{$v['store_id']}\"}'>走势图</a>";
             $statlist[$k] = $v;
         }
     }
     //列表header
     $statheader = array();
     $statheader[] = array('text' => '店铺名称', 'key' => 'store_name');
     $statheader[] = array('text' => '下单会员数', 'key' => 'membernum', 'isorder' => 1);
     $statheader[] = array('text' => '下单量', 'key' => 'ordernum', 'isorder' => 1);
     $statheader[] = array('text' => '下单金额', 'key' => 'orderamount', 'isorder' => 1);
     //导出Excel
     if ($this->search_arr['exporttype'] == 'excel') {
         //导出Excel
         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
         foreach ($statheader as $k => $v) {
             $excel_data[0][] = array('styleid' => 's_title', 'data' => $v['text']);
         }
         //data
         foreach ($statlist as $k => $v) {
             foreach ($statheader as $h_k => $h_v) {
                 $excel_data[$k + 1][] = array('data' => $v[$h_v['key']]);
             }
         }
         $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) . date('Y-m-d-H', time()));
         exit;
     }
     Tpl::output('statlist', $statlist);
     Tpl::output('statheader', $statheader);
     Tpl::output('orderby', $this->search_arr['orderby']);
     Tpl::output('actionurl', "index.php?act={$this->search_arr['act']}&op={$this->search_arr['op']}&t={$this->search_arr['t']}&search_sclass={$search_sclass}&search_sname={$_GET['search_sname']}");
     Tpl::output('show_page', $model->showpage(2));
     Tpl::showpage('stat.listandorder', 'null_layout');
 }