Esempio n. 1
0
 }
 if ($_SESSION['tyuser']) {
     //企业只能看自己的
     if ($userRow['type'] == 2 && $userRow['id'] != 1) {
         $typeWhere = ' and t.uid=' . $userRow['id'];
     } else {
         $typeWhere = '';
     }
 }
 //10000号可以看到审核未通过的
 if ($_SESSION['tyuser'] && $userRow['id'] == 1) {
     $shWhere = 't.id > 0';
 } else {
     $shWhere = 't.sh_status=1';
 }
 $listArr = $model->fetchAll("SELECT t.*,left(t.addtime,10) as new_addtime,CASE WHEN COUNT( s.tid ) < t.num THEN 0 ELSE 1 END AS man_status,CASE WHEN t.jiezhi_time < unix_timestamp(now()) THEN 1 ELSE 0 END AS gq_status FROM `sub_task` AS t LEFT JOIN `sub_sign` AS s ON t.id = s.tid AND s.is_valid !=2 where {$shWhere} {$didWhere} {$typeWhere} GROUP BY IFNULL( s.tid, UUID() ) ORDER BY t.is_recommend DESC, new_addtime desc ,gq_status ASC, t.is_shut ASC,man_status ASC, t.id DESC LIMIT {$limitStr}");
 $signModel = D('sub_sign');
 $current_time = time();
 //当前时间戳
 foreach ($listArr as $key => $value) {
     $listArr[$key]['title'] = cut_str(deletehtml($value['title']), 10);
     $drow = $dmodel->where("DistrictId='" . $value['did'] . "'")->dataRow();
     $listArr[$key]['addr'] = $drow['DistrictName'];
     //所属公司
     if ($value['company_name']) {
         //平台代发布
         $listArr[$key]['nickname'] = $value['company_name'];
     } else {
         $urow = $userModel->find($value['uid']);
         $listArr[$key]['nickname'] = $urow['nickname'];
     }