chengkun
2025-04-29 a34a90f03cecc7658231547270f8036bb5affe4a
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<?php
class Smarty_Internal_Compile_Partlist extends Smarty_Internal_CompileBase{
    public $required_attributes = array('item');
    public $optional_attributes = array('name', 'key', 'limit','ispage','provinceid','cityid','three_cityid','type','keyword','order','noid','cycle','salary','namelen','rec','keyword');
    public $shorttag_order = array('from', 'item', 'key', 'name');
    public function compile($args, $compiler, $parameter){
        $_attr = $this->getAttributes($compiler, $args);
 
        $from = $_attr['from'];
        $item = $_attr['item'];
        $name = $_attr['item'];
        $name=str_replace('\'','',$name);
        $name=$name?$name:'list';$name='$'.$name;
        if (!strncmp("\$_smarty_tpl->tpl_vars[$item]", $from, strlen($item) + 24)) {
            $compiler->trigger_template_error("item variable {$item} may not be the same variable as at 'from'", $compiler->lex->taglineno);
        }
 
        //自定义标签 START
        $OutputStr='global $db,$db_config,$config;
        $time = time();
 
 
        //可以做缓存
        $paramer='.ArrayToString($_attr,true).';
        $ParamerArr = GetSmarty($paramer,$_GET,$_smarty_tpl);
        $paramer = $ParamerArr[arr];
        $Purl =  $ParamerArr[purl];
        global $ModuleName;
        if(!$Purl["m"]){
            $Purl["m"]=$ModuleName;
        }
 
        if($config[sy_web_site]=="1"){
            if($config[province]>0 && $config[province]!=""){
                $paramer[provinceid] = $config[province];
            }
            if($config[cityid]>0 && $config[cityid]!=""){
                $paramer[cityid] = $config[cityid];
            }
            if($config[three_cityid]>0 && $config[three_cityid]!=""){
                $paramer[three_cityid] = $config[three_cityid];
            }
        }
 
   
      $where = "(`edate`>\'$time\' or `edate`=0) and `state`=1 and `r_status`<>2";
        
      if($paramer[noid]){
        $where.=" and `id`<>\'".$paramer[\'noid\']."\'";
      }
      
      //关键字
      if($paramer[keyword]){
        $where .= " AND `name` LIKE \'%".$paramer[keyword]."%\'";
      }
      //城市大类
      if($paramer[provinceid]){
        $where .= " AND `provinceid` = $paramer[provinceid]";
      }
      //城市子类
      if($paramer[\'cityid\']){
        $where .= " AND (`provinceid`=$paramer[cityid] or `cityid`=$paramer[cityid] or `three_cityid`=$paramer[cityid])";
      }
      //城市三级子类
      if($paramer[\'three_cityid\']){
        $where .= " AND (`three_cityid` IN ($paramer[three_cityid]))";
      }
      if($paramer[\'cityin\']){
        $where .= " AND `three_cityid` IN ($paramer[cityin])";
      }
      //推荐兼职
      if($paramer[rec]){
        $where.=" AND `rec_time`>".time();
      }
      //工作类型
      if($paramer[type]){
        $where .= " AND `type` = $paramer[type]";
      }
      //结算周期
      if($paramer[cycle]){
        $where .= " AND `billing_cycle` = $paramer[cycle]";
      }
      //按照职位名称匹配
      /*if($paramer[keyword]){
        $where1[]="`name` LIKE \'%".$paramer[keyword]."%\'";
        include PLUS_PATH."/city.cache.php";
        foreach($city_name as $k=>$v){
          if(strpos($v,$paramer[keyword])!==false){
            $cityid[]=$k;
          }
        }
        if(is_array($cityid)){
          foreach($cityid as $value){
            $class[]= "(provinceid = \'".$value."\' or cityid = \'".$value."\')";
          }
          $where1[]=@implode(" or ",$class);
        }
        $where.=" AND (".@implode(" or ",$where1).")";
      }*/
       //数据周期 
      if($config[sy_datacycle]>0){
           // 后台-页面设置-数据周期
           $uptime = strtotime(\'-\'.$config[sy_datacycle].\' day\');
           $where.=" AND `lastupdate`>$uptime";
       }
 
      //查询条数
      if($paramer[limit]){
        $limit = " limit ".$paramer[limit];
      }
      if($paramer[ispage]){
        $limit = PageNav($paramer,$_GET,"partjob",$where,$Purl,"",$paramer[limit]?$paramer[limit]:"6",$_smarty_tpl);
      }
      //排序字段默认为更新时间
      if($paramer[order] && $paramer[order]!="lastdate"){
        $order = " ORDER BY ".str_replace("\'","",$paramer[order])."  ";
      }else{
        $order = " ORDER BY `lastupdate` ";
      }
      //排序规则 默认为倒序
      if($paramer[sort]){
        $sort = $paramer[sort];
      }else{
        $sort = " DESC";
      }
      $where.=$order.$sort;
  
        
        '.$name.' = $db->select_all("partjob",$where.$limit);
        if(is_array('.$name.')){
            foreach('.$name.' as $v){
                $comuids[]=$v[\'uid\'];
            }
            $comlist=$db->select_all("company","`uid` in(".@implode(\',\',$comuids).")","`uid`,`shortname`");
            foreach('.$name.' as $key=>$value){
                '.$name.'[$key] = $db->part_array_action($value,$cache_array);
                '.$name.'[$key][stime] = date("Y-m-d",$value[sdate]);
                '.$name.'[$key][etime] = date("Y-m-d",$value[edate]);
                '.$name.'[$key][lastupdate] = date("Y-m-d",$value[lastupdate]);
                $time=$value[\'lastupdate\'];
                //今天开始时间戳
                $beginToday=mktime(0,0,0,date(\'m\'),date(\'d\'),date(\'Y\'));
                //昨天开始时间戳
                $beginYesterday=mktime(0,0,0,date(\'m\'),date(\'d\')-1,date(\'Y\'));
                if($time>$beginYesterday && $time<$beginToday){
                    '.$name.'[$key][\'time\'] = "昨天";
                }elseif($time>$beginToday){
                    '.$name.'[$key][\'time\'] = "今天";
                }else{
                    '.$name.'[$key][\'time\'] = date("Y-m-d",$value[\'lastupdate\']);
                }
                foreach($comlist as $v){
                    if($value[uid]==$v[uid]&&$v[shortname]){
                        '.$name.'[$key][\'com_name\'] = $v[shortname];
                    }
                }
                //截取职位名称
                if($paramer[namelen]){
                    '.$name.'[$key][name_n] = mb_substr($value[\'name\'],0,$paramer[namelen],"utf-8");
                }
                //构建职位伪静态URL
                '.$name.'[$key][job_url] = Url("part",array("c"=>"show","id"=>$value[id]),"1");
                if($paramer[keyword]){
                    '.$name.'[$key][name]=str_replace($paramer[keyword],"<font color=#FF6600 >".$paramer[keyword]."</font>",$value[name]);
                    '.$name.'[$key][name_n]=str_replace($paramer[keyword],"<font color=#FF6600 >".$paramer[keyword]."</font>",'.$name.'[$key][name_n]);
                    '.$name.'[$key][job_city_one]=str_replace($paramer[keyword],"<font color=#FF6600 >".$paramer[keyword]."</font>",$city_name[$value[provinceid]]);
                    /*'.$name.'[$key][job_city_two]=str_replace($paramer[keyword],"<font color=#FF6600 >".$paramer[keyword]."</font>",$city_name[$value[cityid]]);*/
                }
            }
            if(is_array('.$name.')){
                if($paramer[keyword]!=""&&!empty('.$name.')){
                    addkeywords(\'2\',$paramer[keyword]);
                }
            }
        }';
       // global $DiyTagOutputStr;
       // $DiyTagOutputStr[]=$OutputStr;
        return SmartyOutputStr($this,$compiler,$_attr,'partlist',$name,$OutputStr,$name);
    }
}
class Smarty_Internal_Compile_Partlistelse extends Smarty_Internal_CompileBase{
    public function compile($args, $compiler, $parameter){
        $_attr = $this->getAttributes($compiler, $args);
 
        list($openTag, $nocache, $item, $key) = $this->closeTag($compiler, array('partlist'));
        $this->openTag($compiler, 'partlistelse', array('partlistelse', $nocache, $item, $key));
 
        return "<?php }\nif (!\$_smarty_tpl->tpl_vars[$item]->_loop) {\n?>";
    }
}
class Smarty_Internal_Compile_Partlistclose extends Smarty_Internal_CompileBase{
    public function compile($args, $compiler, $parameter){
        $_attr = $this->getAttributes($compiler, $args);
        if ($compiler->nocache) {
            $compiler->tag_nocache = true;
        }
 
        list($openTag, $compiler->nocache, $item, $key) = $this->closeTag($compiler, array('partlist', 'partlistelse'));
 
        return "<?php } ?>";
    }
}