本文整理汇总了PHP中getMonthWeekArr函数的典型用法代码示例。如果您正苦于以下问题:PHP getMonthWeekArr函数的具体用法?PHP getMonthWeekArr怎么用?PHP getMonthWeekArr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getMonthWeekArr函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(){
parent::__construct();
Language::read('member_store_statistics');
import('function.statistics');
import('function.datehelper');
$model = Model('stat');
//存储参数
$this->search_arr = $_REQUEST;
//处理搜索时间
if (in_array($this->search_arr['op'],array('price','hotgoods'))){
$this->search_arr = $model->dealwithSearchTime($this->search_arr);
//获得系统年份
$year_arr = getSystemYearArr();
//获得系统月份
$month_arr = getSystemMonthArr();
//获得本月的周时间段
$week_arr = 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']));
}
示例2: __construct
public function __construct()
{
parent::__construct();
Language::read('stat');
import('function.statistics');
import('function.datehelper');
$model = Model('stat');
//存储参数
$this->search_arr = $_REQUEST;
//处理搜索时间
if (in_array($_REQUEST['op'], array('list'))) {
$this->search_arr = $model->dealwithSearchTime($this->search_arr);
//获得系统年份
$year_arr = getSystemYearArr();
//获得系统月份
$month_arr = getSystemMonthArr();
//获得本月的周时间段
$week_arr = 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);
}
$conn = (require BASE_DATA_PATH . '/../core/framework/db/mssqlpdo.php');
$stmt = $conn->query(' select distinct orgid from map_org_wechat order by orgid ');
$this->orgidarray = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
array_push($this->orgidarray, $row[0]);
}
$this->getTreeData();
Tpl::output('search_arr', $this->search_arr);
}
示例3: __construct
public function __construct()
{
parent::__construct();
Language::read('stat');
import('function.statistics');
import('function.datehelper');
$model = Model('stat');
//存储参数
$this->search_arr = $_REQUEST;
//处理搜索时间
if (in_array($_REQUEST['op'], array('list'))) {
$this->search_arr = $model->dealwithSearchTime($this->search_arr);
//获得系统年份
$year_arr = getSystemYearArr();
//获得系统月份
$month_arr = getSystemMonthArr();
//获得本月的周时间段
$week_arr = 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);
$conn = (require BASE_DATA_PATH . '/../core/framework/db/mssqlpdo.php');
$treesql = 'select b.id , b.name,b.districtnumber,b.parentid pId from map_org_wechat a, Organization b where a.orgid = b.id ';
$treestmt = $conn->query($treesql);
$this->treedata_list = array();
while ($row = $treestmt->fetch(PDO::FETCH_OBJ)) {
array_push($this->treedata_list, $row);
}
Tpl::output('treelist', $this->treedata_list);
}
示例4: getweekofmonthOp
/**
* 查询每月的周数组
*/
public function getweekofmonthOp()
{
import('function.datehelper');
$year = $_GET['y'];
$month = $_GET['m'];
$week_arr = getMonthWeekArr($year, $month);
echo json_encode($week_arr);
die;
}
示例5: __construct
public function __construct(){
parent::__construct();
Language::read('stat');
import('function.statistics');
import('function.datehelper');
$model = Model('stat');
//存储参数
$this->search_arr = $_REQUEST;
//处理搜索时间
$this->search_arr = $model->dealwithSearchTime($this->search_arr);
//获得系统年份
$year_arr = getSystemYearArr();
//获得系统月份
$month_arr = getSystemMonthArr();
//获得本月的周时间段
$week_arr = 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);
}
示例6: saleOp
/**
* 订单统计
*/
public function saleOp()
{
$where = array();
if (trim($_GET['order_type']) != '') {
$where['order_state'] = trim($_GET['order_type']);
}
if (trim($_GET['stat_type']) == 'sale') {
$field = ' sum(order_amount) as allnum ';
} else {
$field = ' count(*) as allnum ';
}
if (!$_REQUEST['search_type']) {
$_REQUEST['search_type'] = 'day';
}
if (trim($_GET['store_name']) != '') {
$where['store_name'] = trim($_GET['store_name']);
$store_name = trim($_GET['store_name']);
}
//初始化时间
//天
if (!$_REQUEST['search_time']) {
$_REQUEST['search_time'] = date('Y-m-d', time());
}
$search_time = strtotime($_REQUEST['search_time']);
//搜索的时间
Tpl::output('search_time', $_REQUEST['search_time']);
//周
if (!$_REQUEST['search_time_year']) {
$_REQUEST['search_time_year'] = date('Y', time());
}
if (!$_REQUEST['search_time_month']) {
$_REQUEST['search_time_month'] = date('m', time());
}
if (!$_REQUEST['search_time_week']) {
$_REQUEST['search_time_week'] = implode('|', getWeek_SdateAndEdate(time()));
}
$current_year = $_REQUEST['search_time_year'];
$current_month = $_REQUEST['search_time_month'];
$current_week = $_REQUEST['search_time_week'];
$year_arr = getSystemYearArr();
$month_arr = getSystemMonthArr();
$week_arr = getMonthWeekArr($current_year, $current_month);
Tpl::output('current_year', $current_year);
Tpl::output('current_month', $current_month);
Tpl::output('current_week', $current_week);
Tpl::output('year_arr', $year_arr);
Tpl::output('month_arr', $month_arr);
Tpl::output('week_arr', $week_arr);
$model = Model('stat');
$statlist = array();
//统计数据列表
$sum_num = 0;
//总数统计
if ($_REQUEST['search_type'] == 'day') {
//构造横轴数据
for ($i = 0; $i < 24; $i++) {
//统计图数据
$curr_arr[$i] = 0;
//今天
$up_arr[$i] = 0;
//昨天
//统计表数据
$uplist_arr[$i]['timetext'] = $i;
$currlist_arr[$i]['timetext'] = $i;
$uplist_arr[$i]['val'] = 0;
$currlist_arr[$i]['val'] = 0;
//横轴
$stat_arr['xAxis']['categories'][] = "{$i}";
}
$stime = $search_time - 86400;
//昨天0点
$etime = $search_time + 86400 - 1;
//今天24点
$today_day = @date('d', $search_time);
//今天日期
$yesterday_day = @date('d', $stime);
//昨天日期
$where['add_time'] = array('between', array($stime, $etime));
$field .= ' ,DAY(FROM_UNIXTIME(add_time)) as dayval,HOUR(FROM_UNIXTIME(add_time)) as hourval ';
$memberlist = $model->getStoreSaleStatList($where, $field, 0, '', 0, 'dayval,hourval');
if ($memberlist) {
foreach ($memberlist as $k => $v) {
if ($today_day == $v['dayval']) {
$curr_arr[$v['hourval']] = intval($v['allnum']);
$currlist_arr[$v['hourval']]['val'] = intval($v['allnum']);
}
if ($yesterday_day == $v['dayval']) {
$up_arr[$v['hourval']] = intval($v['allnum']);
$uplist_arr[$v['hourval']]['val'] = intval($v['allnum']);
}
}
} elseif (trim($_GET['store_name']) != '') {
Tpl::output('data_null', 'yes');
}
$stat_arr['series'][0]['name'] = '昨天';
$stat_arr['series'][0]['data'] = array_values($up_arr);
$stat_arr['series'][1]['name'] = '今天';
//.........这里部分代码省略.........
示例7: newstoreOp
/**
* 新增店铺
*/
public function newstoreOp()
{
//导出excel连接地址
$actionurl = 'index.php?act=stat_store&op=newstore';
$where = array();
//所属店铺分类
$search_sclass = intval($_REQUEST['search_sclass']);
if ($search_sclass > 0) {
$where['sc_id'] = $search_sclass;
$actionurl .= "&search_sclass={$search_sclass}";
}
$field = ' count(*) as allnum ';
if (!$_REQUEST['search_type']) {
$_REQUEST['search_type'] = 'day';
}
//初始化时间
//天
if (!$_REQUEST['search_time']) {
$_REQUEST['search_time'] = date('Y-m-d', time() - 86400);
}
$search_time = strtotime($_REQUEST['search_time']);
//搜索的时间
Tpl::output('search_time', $_REQUEST['search_time']);
//周
if (!$_REQUEST['search_time_year']) {
$_REQUEST['search_time_year'] = date('Y', time());
}
if (!$_REQUEST['search_time_month']) {
$_REQUEST['search_time_month'] = date('m', time());
}
if (!$_REQUEST['search_time_week']) {
$_REQUEST['search_time_week'] = implode('|', getWeek_SdateAndEdate(time()));
}
$current_year = $_REQUEST['search_time_year'];
$current_month = $_REQUEST['search_time_month'];
$current_week = $_REQUEST['search_time_week'];
$year_arr = getSystemYearArr();
$month_arr = getSystemMonthArr();
$week_arr = getMonthWeekArr($current_year, $current_month);
Tpl::output('current_year', $current_year);
Tpl::output('current_month', $current_month);
Tpl::output('current_week', $current_week);
Tpl::output('year_arr', $year_arr);
Tpl::output('month_arr', $month_arr);
Tpl::output('week_arr', $week_arr);
$model = Model('stat');
$statlist = array();
//统计数据列表
if ($_REQUEST['search_type'] == 'day') {
//构造横轴数据
for ($i = 0; $i < 24; $i++) {
//统计图数据
$curr_arr[$i] = 0;
//今天
$up_arr[$i] = 0;
//昨天
//统计表数据
$uplist_arr[$i]['timetext'] = $i;
$currlist_arr[$i]['timetext'] = $i;
//方便搜索会员列表,计算开始时间和结束时间
$currlist_arr[$i]['stime'] = $search_time + $i * 3600;
$currlist_arr[$i]['etime'] = $currlist_arr[$i]['stime'] + 3600;
$uplist_arr[$i]['val'] = 0;
$currlist_arr[$i]['val'] = 0;
//横轴
$stat_arr['xAxis']['categories'][] = "{$i}";
}
$stime = $search_time - 86400;
//昨天0点
$etime = $search_time + 86400 - 1;
//今天24点
$today_day = @date('d', $search_time);
//今天日期
$yesterday_day = @date('d', $stime);
//昨天日期
$where['store_time'] = array('between', array($stime, $etime));
$field .= ' ,DAY(FROM_UNIXTIME(store_time)) as dayval,HOUR(FROM_UNIXTIME(store_time)) as hourval ';
$memberlist = $model->getNewStoreStatList($where, $field, 0, '', 0, 'dayval,hourval');
if ($memberlist) {
foreach ($memberlist as $k => $v) {
if ($today_day == $v['dayval']) {
$curr_arr[$v['hourval']] = intval($v['allnum']);
$currlist_arr[$v['hourval']]['val'] = intval($v['allnum']);
}
if ($yesterday_day == $v['dayval']) {
$up_arr[$v['hourval']] = intval($v['allnum']);
$uplist_arr[$v['hourval']]['val'] = intval($v['allnum']);
}
}
}
$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);
//统计数据标题
$statlist['headertitle'] = array('小时', '昨天', '今天', '同比');
Tpl::output('actionurl', $actionurl . '&search_type=day&search_time=' . date('Y-m-d', $search_time));
//.........这里部分代码省略.........
示例8: saleOp
/**
* 订单统计
*/
public function saleOp()
{
$model = Model('stat');
//存储参数
$this->search_arr = $_REQUEST;
//处理搜索时间
$this->search_arr = $model->dealwithSearchTime($this->search_arr);
//获得系统年份
$year_arr = getSystemYearArr();
//获得系统月份
$month_arr = getSystemMonthArr();
//获得本月的周时间段
$week_arr = 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 = 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
import('libraries.excel');
$excel_obj = new Excel();
$excel_data = array();
//设置样式
$excel_obj->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']);
//.........这里部分代码省略.........
示例9: rankOp
/**
* 店铺排行
*/
public function rankOp()
{
$where = array();
if (trim($_GET['order_type']) != '') {
$where['order_state'] = trim($_GET['order_type']);
}
if (!$_REQUEST['search_type']) {
$_REQUEST['search_type'] = 'day';
}
if (trim($_GET['store_name']) != '') {
$where['store_name'] = trim($_GET['store_name']);
}
//初始化时间
//天
if (!$_REQUEST['search_time']) {
$_REQUEST['search_time'] = date('Y-m-d', time());
}
$search_time = strtotime($_REQUEST['search_time']);
//搜索的时间
Tpl::output('search_time', $_REQUEST['search_time']);
//周
if (!$_REQUEST['search_time_year']) {
$_REQUEST['search_time_year'] = date('Y', time());
}
if (!$_REQUEST['search_time_month']) {
$_REQUEST['search_time_month'] = date('m', time());
}
if (!$_REQUEST['search_time_week']) {
$_REQUEST['search_time_week'] = implode('|', getWeek_SdateAndEdate(time()));
}
$current_year = $_REQUEST['search_time_year'];
$current_month = $_REQUEST['search_time_month'];
$current_week = $_REQUEST['search_time_week'];
$year_arr = getSystemYearArr();
$month_arr = getSystemMonthArr();
$week_arr = getMonthWeekArr($current_year, $current_month);
Tpl::output('current_year', $current_year);
Tpl::output('current_month', $current_month);
Tpl::output('current_week', $current_week);
Tpl::output('year_arr', $year_arr);
Tpl::output('month_arr', $month_arr);
Tpl::output('week_arr', $week_arr);
$model = Model('stat');
if ($_REQUEST['search_type'] == 'day') {
$stime = $search_time;
//昨天0点
$etime = $search_time + 86400 - 1;
//今天24点
Tpl::output('actionurl', 'index.php?act=stat_store&op=rank&search_type=day&search_time=' . date('Y-m-d', $search_time));
}
if ($_REQUEST['search_type'] == 'week') {
$current_weekarr = explode('|', $current_week);
$stime = strtotime($current_weekarr[0]) - 86400 * 7;
$etime = strtotime($current_weekarr[1]) + 86400 - 1;
Tpl::output('actionurl', 'index.php?act=stat_store&op=rank&search_type=week&search_time_year=' . $current_year . '&search_time_month=' . $current_month . '&search_time_week=' . $current_week);
}
if ($_REQUEST['search_type'] == 'month') {
$stime = strtotime($current_year . '-' . $current_month . "-01 0 month");
$etime = getMonthLastDay($current_year, $current_month) + 86400 - 1;
Tpl::output('actionurl', 'index.php?act=stat_store&op=rank&search_type=month&search_time_year=' . $current_year . '&search_time_month=' . $current_month);
}
$where['add_time'] = array('between', array($stime, $etime));
$where['order_state'] = array('neq', ORDER_STATE_NEW);
//去除未支付订单
$where['refund_state'] = array('exp', "!(order_state = '" . ORDER_STATE_CANCEL . "' and refund_state = 0)");
//没有参与退款的取消订单,不记录到统计中
$where['payment_code'] = array('exp', "!(payment_code='offline' and order_state <> '" . ORDER_STATE_SUCCESS . "')");
//货到付款订单,订单成功之后才计入统计
//得到统计图数据
if (trim($_GET['stat_type']) == 'sale') {
$store_list = $model->getStoreSaleRank($where, 'sale_amount');
$statlist['headertitle'] = array('排名', '店铺名称', '销售额');
$stat_arr['title'] = '店铺销售额排行Top15';
$stat_arr['yAxis'] = '销售额';
$stat_arr['series'][0]['name'] = '销售额';
} else {
$store_list = $model->getStoreSaleRank($where, 'sale_num');
$statlist['headertitle'] = array('排名', '店铺名称', '订单量');
$stat_arr['title'] = '店铺订单量排行Top15';
$stat_arr['yAxis'] = '订单量';
$stat_arr['series'][0]['name'] = '订单量';
}
//导出Excel
if ($_GET['exporttype'] == 'excel') {
//导出Excel
import('libraries.excel');
$excel_obj = new Excel();
$excel_data = array();
//设置样式
$excel_obj->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 ($store_list as $k => $v) {
$excel_data[$k + 1][] = array('data' => $k + 1);
//.........这里部分代码省略.........