<?php<liu21st@gmail.com>function getCategory($id = '0')
{
$category = new \app\system\model\Category;
$list = $category
->where('pid','in',$id)
->where('status',1)
->field('id,title')
->select();
return $list;
}
function getCategoryTitle($id)
{
$category = new \app\system\model\Category;
$value = $category
->where('id',$id)
->vlaue('title');
return $value;
}
function nianjiList()
{
$jiedian = strtotime(date('Y').'-8-1');
$time = new think\helper\Time();
$thisday = $time->today();
if($thisday[0]<=$jiedian)
{
$str = 1;
}else{
$str = 0;
}
$nian = date('Y') - $str;
$njlist = array();
$njlist[$nian]='一年级';
$njlist[$nian-1]='二年级';
$njlist[$nian-2]='三年级';
$njlist[$nian-3]='四年级';
$njlist[$nian-4]='五年级';
$njlist[$nian-5]='六年级';
return $njlist;
}
function banjinamelist()
{
$bjarr = array(
'1'=>'一班',
'2'=>'二班',
'3'=>'三班',
'4'=>'四班',
'5'=>'五班',
'6'=>'六班',
'7'=>'七班',
'8'=>'八班',
'9'=>'九班',
'10'=>'十班',
'11'=>'十一班',
'12'=>'十二班',
'13'=>'十三班',
'14'=>'十四班',
'15'=>'十五班',
);
return $bjarr;
}
function getAgeByBirth($date,$type = 1){
$nowYear = date("Y",time());
$nowMonth = date("m",time());
$nowDay = date("d",time());
$birthYear = date("Y",$date);
$birthMonth = date("m",$date);
$birthDay = date("d",$date);
if($type == 1){
$age = $nowYear - ($birthYear - 1);
}elseif($type == 2){
if($nowMonth<$birthMonth){
$age = $nowYear - $birthYear - 1;
}elseif($nowMonth==$birthMonth){
if($nowDay<$birthDay){
$age = $nowYear - $birthYear - 1;
}else{
$age = $nowYear - $birthYear;
}
}else{
$age = $nowYear - $birthYear;
}
}
return $age;
}
function excelLieming()
{
$liemingarr = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
return $liemingarr;
}
function schlist($low='班级',$high='其它级')
{
$sch = new \app\system\model\School;
$cat = new \app\system\model\Category;
$catlist = $cat->where('pid',102)->column('title,id');
$schlist = $sch->where('jibie','between',[$catlist[$low],$catlist[$high]])
->order(['paixu'])
->column('id,title,jiancheng');
return $schlist;
}