Index.php
2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
namespace app\home\controller;
use clt\Lunar;
class Index extends Common{
public function initialize(){
parent::initialize();
}
public function index(){
return redirect('http://xt03.colorcun.com/user');
$order = input('order','createtime');
$time = time();
$list=db('article')->alias('a')
->join(config('database.prefix').'category c','a.catid = c.id','left')
->field('a.id,c.catdir,c.catname')
->order($order.' desc')
->where('createtime', '>', $time)
->limit('15')
->select();
foreach ($list as $k=>$v){
$list[$k]['time'] = toDate($v['createtime']);
$list[$k]['url'] = url('home/'.$v['catdir'].'/info',array('id'=>$v['id'],'catId'=>$v['catid']));
}
$this->assign('list', $list);
if(!isMobile()){
$m= $thisDate = date("m");
$d= $thisDate = date("d");
$y= $thisDate = date("Y");
$Lunar=new Lunar();
//获取农历日期
$nonliData = $Lunar->convertSolarToLunar($y,$m,$d);
$nonliData = $nonliData[1].'-'.$nonliData[2];
$feastId = db('feast')->where(array('feast_date'=>$nonliData,'type'=>2))->value('id');
$style='';
$js='';
if($feastId){
$element = db('feast_element')->where('pid',$feastId)->select();
$style = '<style>';
$js = '';
foreach ($element as $k=>$v){
$style .= $v['css'];
$js .= $v['js'];
}
$style .= '</style>';
}else{
$feastId = db('feast')->where(array('feast_date'=>$m.'-'.$d,'type'=>1))->value('id');
if($feastId){
$element = db('feast_element')->where('pid',$feastId)->select();
$style = '<style>';
$js = '';
foreach ($element as $k=>$v){
$style .= $v['css'];
$js .= $v['js'];
}
$style .= '</style>';
}
}
$this->assign('style', $style);
$this->assign('js', $js);
}
return $this->fetch();
}
public function senmsg(){
$data = input('post.');
$data['addtime'] = time();
$data['ip'] = getIp();
db('message')->insert($data);
$result['status'] = 1;
return $result;
}
}