Public Function trace () {
$page = I (' GET.P ');
$page = $page? $page: 1;
$start = ($page-1) * 10;
$where [' a.uid '] = session (' IP ');
if (I (' Get. ')) {
$data = I (' Get. ');
$this->assign (' Get ', $data);
if (Empty ($data [' starttime ']) ^ empty ($data [' Endtime '])) {
$this->success (' time cannot be empty alone ', ' trance '); exit;
}
if ($data [' StartTime '] > $data [' endtime ']) {
$this->success (' Time selection error ', ' trance '); exit;
}
Where Condition for assembly time
if (!empty ($data [' StartTime '])) {
$starttime = Strtotime ($data [' starttime ']);
$endtime = Strtotime ($data [' endtime ']);
$where [' b.lastupdate '] = Array (' Between ', $starttime. "," . $endtime);
}
Judging condition of assembling work order state
Switch ($data [' status ']) {
Case 1:
# code ...
$where [' e.ostatus '] = 1;
Break
Case 2:
# code ...
$where [' e.ostatus '] = 2;
Break
Default
Break
}
Query results
$count = M (' Phpyun_expect_order a ')
->field (' Count (*) as Count ')
->join ("left join Phpyun_resume_expect as B on (A.eid = b.id) ' Left join ' Phpyun_job_class c on (b.job_classid = c.id) lef T join Phpyun_resume D on (b.uid = d.uid) left join Phpyun_member e on (e.uid = A.memberid) left join Phpyun_channels F on (E.otro=f.num) ")
->where ($where)
->find ();
$list = M (' Phpyun_expect_order a ')
->field (' A.eid,a.memberid,a.count,b.integrity,b.name as ename,c.name as Jobname,b.lastupdate,d.name,d.telphone, E.otro,e.mstatus,e.ostatus as order_status,f.name as qrname,h.name as username ')
->join ("left join Phpyun_resume_expect as B on (A.eid = b.id) ' Left join ' Phpyun_job_class c on (b.job_classid = c.id) lef T join Phpyun_resume D on (A.memberid = d.uid) left join Phpyun_member e on (e.uid = A.memberid) LEFT join Phpyun_channels F on (E.otro=f.num) left join Data_users h on (a.uid=h.id) ")
->where ($where)
->group (' A.memberid ')
->order (' b.integrity desc ')
->limit ($start. ", 10")
->select ();
} else {
$count = M (' Phpyun_expect_order a ')->field ("Count (*) as Count")->where ($where)->find ();
$list = M (' Phpyun_expect_order a ')->field (' A.eid,a.memberid,a.count,b.integrity,b.name as ename,c.name as JobName, B.lastupdate,d.name,d.telphone,e.otro,e.mstatus,e.ostatus as order_status,f.name as qrname,h.name as username ') Join ("LEFT join Phpyun_resume_expect as B in (A.eid = b.id) left joins Phpyun_job_class c on (b.job_classid = c.id) left Joi n Phpyun_resume d on (A.memberid = d.uid) left join Phpyun_member e in (e.uid = A.memberid) left join Phpyun_channels F on (E.otro=f.num) LEFT join Data_users h on (a.uid=h.id) ")->order (' b.integrity desc ')->where ($where)->group (' A.memberid ')->limit ($start. ",")->select ();
}
$this->assign (' data ', $list);
$Page = new \think\page ($count [' count '], 10); Instantiate the number of incoming total records in a paging class and the number of records displayed per page
if ($where) {
foreach ($where as $k = = $v) {
$Page->parameter[$k] = UrlEncode ($v);
}
}
$show = $Page->show (); Pagination Display output
$this->assign (' page ', $show);
$this->assign (' count ', $count [' count ']);
$this->assign (' Nowpage ', $page);
$this->display ();
}
Federated Query thinkphp