Example #1
0
 function joblist_action()
 {
     $this->get_moblie();
     $CompanyM = $this->MODEL('company');
     $JobM = $this->MODEL('job');
     $page = $_POST['page'];
     $pagesize = 10;
     if ($_POST['keyword']) {
         $Where[] = '`name` like \'%' . $_POST['keyword'] . '%\'';
     }
     $xy = getAround($_POST[x], $_POST[y], $_POST[r]);
     if ($xy[0]) {
         $Where[] = "`x`>='" . $xy[0] . "' AND `x`<='" . $xy[1] . "' AND `y`>='" . $xy[3] . "' AND `y`<='" . $xy[2] . "'";
     }
     $CompanyNum = $CompanyM->GetComNum($Where);
     if (!$page || $page <= 1) {
         $pagelimit = 10;
     } else {
         if ($page <= $CompanyNum / $pagesize) {
             $pagelimit = $pagesize * $page . ',' . $pagesize;
         } else {
             $pagelimit = $CompanyNum / $pagesize * $page . ',' . $pagesize;
         }
     }
     $CompanyList = $CompanyM->GetComList($Where, array('limit' => $pagelimit));
     foreach ($CompanyList as $k => $v) {
         $UIDList[] = $v['uid'];
     }
     $JobList = $JobM->GetComjobList(array('`uid` in (' . implode(',', $UIDList) . ')'));
     foreach ($CompanyList as $k1 => $v1) {
         foreach ($JobList as $k2 => $v2) {
             if ($v1['uid'] == $v2['uid']) {
                 $CompanyList[$k1]['joblist'][] = $v2;
             }
         }
     }
     $json_list = array();
     foreach ($CompanyList as $k1 => $v1) {
         $json_list[$k1]['name'] = yun_iconv('gbk', 'utf-8', $v1['name']);
         $json_list[$k1]['x'] = yun_iconv('gbk', 'utf-8', $v1['x']);
         $json_list[$k1]['y'] = yun_iconv('gbk', 'utf-8', $v1['y']);
         $json_list[$k1]['address'] = yun_iconv('gbk', 'utf-8', $v1['address']);
         $json_list[$k1]['com_url'] = Url('wap', array('c' => 'company', 'a' => 'show', 'id' => $v1['uid']));
         foreach ($CompanyList[$k1]['joblist'] as $k2 => $v2) {
             $json_list[$k1]['joblist'][] = array('name' => yun_iconv('gbk', 'utf-8', $v2['name']), 'job_url' => Url('wap', array('c' => 'job', 'a' => 'view', 'id' => $v2['id'])));
         }
     }
     echo json_encode(array('list' => $json_list, 'pagecount' => $CompanyNum / $pagesize + 1));
     die;
 }
Example #2
0
 function _complie_maplist_start($tag_args)
 {
     $paramer = $this->_parse_attrs($tag_args);
     $item = str_replace("'", "", $paramer[item]);
     global $db, $db_config, $config;
     if ($config[sy_web_site] == "1") {
         if ($_SESSION[cityid] > 0 && $_SESSION[cityid] != "") {
             $paramer[cityid] = $_SESSION[cityid];
         }
         if ($_SESSION[three_cityid] > 0 && $_SESSION[three_cityid] != "") {
             $paramer[three_cityid] = $_SESSION[three_cityid];
         }
         if ($_SESSION[hyclass] > 0 && $_SESSION[hyclass] != "") {
             $paramer[hy] = $_SESSION[hyclass];
         }
     }
     $time = time();
     $ParamerArr = $this->GetSmarty($paramer, $_GET);
     $paramer = $ParamerArr[arr];
     $Purl = $ParamerArr[purl];
     $where = 1;
     $xy = getAround($paramer[x], $paramer[y], $paramer[r]);
     if ($xy[0]) {
         $where .= " AND `x`>='" . $xy[0] . "' AND `x`<='" . $xy[1] . "' AND `y`>='" . $xy[3] . "' AND `y`<='" . $xy[2] . "'";
     }
     if ($paramer[keyword]) {
         $where .= " AND `name` LIKE '%" . $paramer[keyword] . "%'";
     }
     if ($paramer[hy]) {
         $where .= " AND `hy` = '" . $paramer[hy] . "'";
     }
     if ($paramer[pr]) {
         $where .= " AND `pr` = '" . $paramer[pr] . "'";
     }
     if ($paramer[mun]) {
         $where .= " AND `mun` = '" . $paramer[mun] . "'";
     }
     if ($paramer[provinceid]) {
         $where .= " AND `provinceid` = '" . $paramer[provinceid] . "'";
     }
     if ($paramer[cityid]) {
         $where .= " AND (`cityid` = '" . $paramer[cityid] . "' or `provinceid` = '" . $paramer[cityid] . "')";
     }
     if ($paramer[three_cityid]) {
         $where .= " AND `three_cityid` = '" . $paramer[three_cityid] . "'";
     }
     if ($paramer[linkman]) {
         $where .= " AND `linkman`<>''";
     }
     if ($paramer[linktel]) {
         $where .= " AND `linktel`<>''";
     }
     if ($paramer[linkmail]) {
         $where .= " AND `linkmail`<>''";
     }
     if ($paramer[logo]) {
         $where .= " AND `logo`<>''";
     }
     if ($paramer['lastupdate']) {
         $lastupdate = $time - $paramer['lastupdate'] * 86400;
         $where .= " AND `lastupdate`>'" . $lastupdate . "'";
     }
     if ($paramer['r_status']) {
         $where .= " AND `r_status`='" . $paramer['r_status'] . "'";
     } else {
         $where .= " AND `r_status`<>'2'";
     }
     if ($paramer['cert']) {
         $where .= " AND `yyzz_status`='1'";
     }
     if ($paramer[jobtime]) {
         $where .= " AND `jobtime`<>''";
     }
     $jobwhere = 1;
     if ($paramer[job1]) {
         $jobwhere .= " AND `job1`='{$paramer['job1']}'";
     }
     if ($paramer[job1_son]) {
         $jobwhere .= " AND `job1_son`='{$paramer['job1_son']}'";
     }
     if ($paramer[job_post]) {
         $jobwhere .= " AND `job_post`='{$paramer['job_post']}'";
     }
     $joball = $db->select_all("company_job", $jobwhere);
     if (is_array($joball)) {
         foreach ($joball as $v) {
             $uid[] = $v[uid];
         }
         $uid = @implode(",", $uid);
         $where .= " and `uid` in ({$uid})";
     }
     if ($paramer[order]) {
         $order = " ORDER BY `" . $paramer[order] . "`  ";
     } else {
         $order = " ORDER BY `jobtime` ";
     }
     if ($paramer[sort]) {
         $sort = $paramer[sort];
     } else {
         $sort = " DESC";
     }
     if ($paramer[limit]) {
         $limit .= " limit " . $paramer[limit];
     }
     $where .= $order . $sort;
     if ($paramer[where]) {
         $where = $paramer[where];
     }
     $cache_array = $db->cacheget();
     if ($paramer[ispage]) {
         $limit = $this->PageNav($paramer, $_GET, "company", "`x`<>'' and " . $where, $Purl);
     }
     $Query = $db->query("SELECT * FROM {$db_config['def']}company where x<>'' and " . $where . $limit);
     while ($rs = $db->fetch_array($Query)) {
         $ComList[] = $db->array_action($rs, $cache_array);
         $ListId[] = $rs[uid];
     }
     if ($paramer[isjob]) {
         $JobId = @implode(",", $ListId);
         $JobList = $db->select_only("(select * from `" . $db_config[def] . "company_job` order by `lastupdate` desc) `temp`", "`uid` IN ({$JobId}) and `edate`>'" . mktime() . "' and r_status<>'2' and status<>'1' and state=1 order by `lastupdate` desc");
         if (is_array($ListId) && is_array($JobList)) {
             foreach ($ComList as $key => $value) {
                 $ComList[$key][jobnum] = 0;
                 foreach ($JobList as $k => $v) {
                     if ($value[uid] == $v[uid]) {
                         $ComList[$key][newsjob] = $v[name];
                         $ComList[$key][newsjob_status] = $v[status];
                         $ComList[$key][r_status] = $v[r_status];
                         $ComList[$key][job_url] = $this->Url("index", "com", array("c" => "comapply", "id" => $v[id]), "1");
                         $jobv = $db->array_action($v, $cache_array);
                         $jobv['name'] = $ComList[$key][newsjob];
                         $jobv[job_url] = $this->Url("index", "com", array("c" => "comapply", "id" => $v[id]), "1");
                         $ComList[$key][joblist][] = $jobv;
                         $ComList[$key][jobnum] = $ComList[$key][jobnum] + 1;
                     }
                 }
             }
         }
     }
     if (is_array($ComList)) {
         $num = 0;
         foreach ($ComList as $key => $value) {
             $ComList[$key][com_url] = $this->Curl(array("url" => "id:" . $value[uid]));
             $ComList[$key][joball_url] = $this->Curl(array("url" => "id:" . $value[uid] . ",tp:post"));
             $ComList[$key]['orderid'] = $num;
             if (!$value[x] && !$value[y]) {
                 $address = $value[job_city_one] . $value[job_city_two] . $value[address];
                 $xydata = @file_get_contents("http://api.map.baidu.com/geocoder?address=" . $address . "&output=json&key=37492c0ee6f924cb5e934fa08c6b1676");
                 $name = json_decode($xydata);
                 $ComList[$key][x] = $name->result->location->lng;
                 $ComList[$key][y] = $name->result->location->lat;
             }
             $num++;
         }
         if ($paramer[keyword] != "" && !empty($ComList)) {
             $this->addkeywords('4', $paramer[keyword]);
         }
     }
     $this->_tpl_vars[$item] = $ComList;
     $tag_args = "from=\${$item} " . $tag_args;
     return $this->_compile_foreach_start($tag_args);
 }