您的位置:首页 > 编程语言 > PHP开发

TP3.2.3 求出每年每月详细数据

2016-07-07 19:38 399 查看
//咨询业绩数据源 uid 客服人员ID
public function RatingData($uid)
{
//取出每年12个月

//一月
$January = strtotime( date('Y-01',strtotime(date('Y-m-d'))) );

//二月
$February = date('Y-02',strtotime(date('Y-m-d')));

//三月
$March = date('Y-03',strtotime(date('Y-m-d')));

//四月
$April = date('Y-04',strtotime(date('Y-m-d')));

//五月
$May = date('Y-05',strtotime(date('Y-m-d')));

//六月
$June = date('Y-06',strtotime(date('Y-m-d')));

//七月
$July = strtotime( date('Y-07',strtotime(date('Y-m-d'))) );

//八月
$August = date('Y-08',strtotime(date('Y-m-d')));

//九月
$September = date('Y-09',strtotime(date('Y-m-d')));

//十月
$October = date('Y-10',strtotime(date('Y-m-d')));

//十一月
$November = date('Y-11',strtotime(date('Y-m-d')));

//十二月
$December = date('Y-12',strtotime(date('Y-m-d')));

//咨询每月到院数据查询
$Model = M('order');
$where1['isct'] = 1;
$where1['uid'] = $uid;
$where1['today_m'] = $January;

$where2['isct'] = 1;
$where2['uid'] = $uid;
$where2['today_m'] = $February;

$where3['isct'] = 1;
$where3['uid'] = $uid;
$where3['today_m'] = $March;

$where4['isct'] = 1;
$where4['uid'] = $uid;
$where4['today_m'] = $April;

$where5['isct'] = 1;
$where5['uid'] = $uid;
$where5['today_m'] = $May;

d43e
$where6['isct'] = 1;
$where6['uid'] = $uid;
$where6['today_m'] = $June;

$where7['isct'] = 1;
$where7['uid'] = $uid;
$where7['today_m'] = $July;

$where8['isct'] = 1;
$where8['uid'] = $uid;
$where8['today_m'] = $August;

$where9['isct'] = 1;
$where9['uid'] = $uid;
$where9['today_m'] = $September;

$where10['isct'] = 1;
$where10['uid'] = $uid;
$where10['today_m'] = $October;

$where11['isct'] = 1;
$where11['uid'] = $uid;
$where11['today_m'] = $November;

$where12['isct'] = 1;
$where12['uid'] = $uid;
$where12['today_m'] = $December;

$Januarys = $Model->join('t_user U ON t_order.uids = U.uid')
->field('t_order.today_m, t_order.isct, t_order.uids, U.fullname')
->where($where1)
->count();

$Februarys = $Model->join('t_user U ON t_order.uids = U.uid')
->field('t_order.today_m, t_order.isct, t_order.uids, U.fullname')
->where($where2)
->count();

$Marchs = $Model->join('t_user U ON t_order.uids = U.uid')
->field('t_order.today_m, t_order.isct, t_order.uids, U.fullname')
->where($where3)
->count();

$Aprils = $Model->join('t_user U ON t_order.uids = U.uid')
->field('t_order.today_m, t_order.isct, t_order.uids, U.fullname')
->where($where4)
->count();

$Mays = $Model->join('t_user U ON t_order.uids = U.uid')
->field('t_order.today_m, t_order.isct, t_order.uids, U.fullname')
->where($where5)
->count();

$Junes = $Model->join('t_user U ON t_order.uids = U.uid')
->field('t_order.today_m, t_order.isct, t_order.uids, U.fullname')
->where($where6)
->count();

$Julys = $Model->join('t_user U ON t_order.uids = U.uid')
->field('t_order.today_m, t_order.isct, t_order.uids, U.fullname')
->where($where7)
->count();

$Augusts = $Model->join('t_user U ON t_order.uids = U.uid')
->field('t_order.today_m, t_order.isct, t_order.uids, U.fullname')
->where($where8)
->count();

$Septembers = $Model->join('t_user U ON t_order.uids = U.uid')
->field('t_order.today_m, t_order.isct, t_order.uids, U.fullname')
->where($where9)
->count();

$Octobers = $Model->join('t_user U ON t_order.uids = U.uid')
->field('t_order.today_m, t_order.isct, t_order.uids, U.fullname')
->where($where10)
->count();

$Novembers = $Model->join('t_user U ON t_order.uids = U.uid')
->field('t_order.today_m, t_order.isct, t_order.uids, U.fullname')
->where($where11)
->count();

$Decembers = $Model->join('t_user U ON t_order.uids = U.uid')
->field('t_order.today_m, t_order.isct, t_order.uids, U.fullname')
->where($where12)
->count();

return array(
'0'=>$Januarys, //一月
'1'=>$Februarys,
'2'=>$Marchs,
'3'=>$Aprils,
'4'=>$Mays,
'5'=>$Junes,
'6'=>$Julys,
'7'=>$Augusts,
'8'=>$Septembers,
'9'=>$Octobers,
'10'=>$Novembers,
'11'=>$Decembers
);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: