public function get_recommended_list() { $page = $_POST['page']; $size = $_POST['number']; $start = ($page - 1) * $size; $jobOb = new JobModel(); $userinfo = $_SESSION['userinfo']; $uid = $userinfo['userid']; $username = $userinfo['username']; $num = $jobOb->recommend_job_count(2, $uid); //得到列表总条数 //var_dump($num); $limit = "{$start},{$size}"; //每页的数据数和内容$limit $result = $jobOb->getRecommendJob(2, $limit, $uid); if (empty($result)) { $result = array(); } $data = array('count' => $num, 'result' => $result); echo json_encode($data); }
public function get_recommended_list() { $page = $_POST['page']; $size = $_POST['number']; $start = ($page - 1) * $size; $jobOb = new JobModel(); $userinfo = $_SESSION['userinfo']; $uid = $userinfo['userid']; $username = $userinfo['username']; $num = $jobOb->recommend_job_count(2, $uid); //得到列表总条数 $limit = "{$start},{$size}"; //每页的数据数和内容$limit $result = $jobOb->getRecommendJob(2, $limit, $uid); if (empty($result)) { $result = array(); } foreach ($result as $k => $v) { $arNotice = M("notice_log")->where("type=1 and bt_id=" . $v['bt_id'])->order("id desc")->select(); if (empty($arNotice)) { $arNotice = array(); } else { foreach ($arNotice as $k1 => $v1) { $arNotice[$k1]['posttime'] = date("Y-m-d H:i", $v1['created_at']); } } $result[$k]['notice_log'] = $arNotice; //查看改用户是否已经评论过该职位 $arEvaluate = M("evaluate")->where("uid=" . $uid . " and pid=" . $result[$k]['recordid'] . " and tag='record'")->find(); if (empty($arEvaluate)) { $result[$k]['is_evaluate'] = 1; } } $data = array('count' => $num, 'result' => $result); //echo "<pre>";var_dump($result);echo "</pre>";die; echo json_encode($data); }