chengkun
2025-05-26 8f3df543230cd4403368b39b9bbe5726d11a0284
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
 
class invoice_controller extends adminCommon{
    //设置高级搜索功能
    function set_search(){
        $search_list[]    =    array("param"=>"status","name"=>'发票状态',"value"=>array("0"=>"未审核","1"=>"已审核","2"=>"未通过","3"=>"已打印","4"=>"已邮寄"));
        
        $lo_time        =    array('1'=>'今天','3'=>'最近三天','7'=>'最近七天','15'=>'最近半月','30'=>'最近一个月');
        $search_list[]    =    array("param"=>"time","name"=>'申请时间',"value"=>$lo_time);
        
        $this -> yunset("search_list",$search_list);
    }
    function index_action(){
        $this -> set_search();
        
        $InvoiceM                    =    $this -> MODEL('invoice');
        
        $where                         =   array();
        $urlarr                        =   $_GET;
        $keywordStr                       =   trim($_GET['keyword']);
        
        if (!empty($keywordStr)) {
            $where['order_id']        =    array('like', $keywordStr);
            $urlarr['keyword']        =    $keywordStr;
        }
        if($_GET['status']!=""){
            $where['status']        =    $_GET['status'];
 
            $urlarr['status']        =    $_GET['status'];
        }
        if($_GET['time']){
            if($_GET['time'] == 1){
                $where['addtime']    =    array('>=',strtotime(date("Y-m-d 00:00:00")));
            }else{
                $where['addtime']    =    array('>=',strtotime('-'.intval($_GET['time']).' day'));
            }
            $urlarr['time']            =    $_GET['time'];
        }
        $urlarr['page']                =    "{{page}}";
        
        $pageurl                    =    Url($_GET['m'],$urlarr,'admin');
        
        $pageM                        =    $this  -> MODEL('page');
        
        $pages                        =    $pageM -> pageList('invoice_record',$where,$pageurl,$_GET['page']);
 
        if($pages['total'] > 0){
            //limit order 只有在列表查询时才需要
            if($_GET['order']){
                $where['orderby']    =    $_GET['t'].','.$_GET['order'];
 
                $urlarr['order']    =    $_GET['order'];
                $urlarr['t']        =    $_GET['t'];
            }else{
                $where['orderby']    =    array('status,asc');
            }
            $where['limit']            =    $pages['limit'];
 
            $rows                    =   $InvoiceM -> getRecordList($where,array('utype'=>'admin','field'=>'id,oid,price,addtime,title,style,uid,link_moblie,email,status'));
        }
        $this -> yunset("rows",$rows);
        $this -> yuntpl(array('admin/admin_invoice'));
    }
    function status_action(){
        $InvoiceM    =    $this -> MODEL('invoice');
 
        $post        =    array(
                'status'     =>  intval($_POST['status']),
                'statusbody' =>  trim($_POST['statusbody'])
        );
        
        $return    =  $InvoiceM -> setStatus(array('id' => array('in',$_POST['pid'])),array('post'=>$post));
 
        $this -> ACT_layer_msg($return['msg'],$return['errcode'],$_SERVER['HTTP_REFERER'],2,1);
    }
    function statusbody_action(){
        $id            =   intval($_POST['id']);
        $InvoiceM    =    $this -> MODEL('invoice');
        $row        =   $InvoiceM -> getRecordInfo($_POST['id'],array('field'=>'statusbody'));
        echo $row['statusbody'];die;
    }
    function show_action(){
        $id            =    intval($_GET['id']);
        $InvoiceM    =    $this -> MODEL('invoice');
        $row        =    $InvoiceM ->getRecordInfo($id);
        $this -> yunset("invoice",$row);
        $this -> yuntpl(array('admin/admin_invoice_show'));
    }
    function del_action(){
        $this -> check_token();
        $InvoiceM    =    $this -> MODEL('invoice');
        $delID        =    is_array($_GET['del']) ? $_GET['del'] : $_GET['id'];
        $return        =    $InvoiceM -> del($delID);
        $this -> layer_msg($return['msg'],$return['errcode'],$return['layertype'],$_SERVER['HTTP_REFERER']);
    }
}
?>