chengkun
2025-05-20 f6f7bd25619ad0c0dfb5e609332e9fa1db419386
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
<?php
 
class index_controller extends wxapp_controller{
    /**
     * 首页
     */
    function index_action()
    {
        $time       = time();
        $firstHome  = $_POST['firstHome'];
        $data       = array();
        $navurl     = array();
        $navsort    = array();
        $gy         = array();
 
        if ($firstHome == 1){
            //首页自定义设置
            include(DATA_PATH.'api/wxapp/tplapp.cache.php');
            include(DATA_PATH.'api/wxapp/tplappmodel.cache.php');
 
            foreach($tplappmodel as $uk=>$uv){
                $navurl[$uv['id']] = $uv['url'];
            }
            //导航
            include_once(CONFIG_PATH.'db.data.php');
            $zphnet_web   =  isset($arr_data['modelconfig']['zphnet']) && isset($this->config['sy_zphnet_web']) ? $this->config['sy_zphnet_web'] : 2;
            $spview_web   =  isset($arr_data['modelconfig']['spview']) && isset($this->config['sy_spview_web']) ? $this->config['sy_spview_web'] : 2;
            if ($this->platform == 'ios' && $_POST['provider'] == 'app'){
                // IOS APP 不支持视频面试
                $spview_web = 2;
            }
            $xjhlive_web  =  isset($arr_data['modelconfig']['xjhlive']) && isset($this->config['sy_xjhlive_web']) ? $this->config['sy_xjhlive_web'] : 2;
            // 是否是小程序端
            if ($_POST['provider'] == 'weixin' || $_POST['provider'] == 'baidu' || $_POST['provider'] == 'toutiao'){
                $is_mini = true;
            }else{
                $is_mini = false;
            }
            foreach ($nav as $nk => $nv) {
                if ($this->config['sy_iospay'] == 2 && ($nv['url']=='14'||$nv['url']=='8')){
                    unset($nav[$nk]);
                }elseif ($is_mini && ($nv['url']=='8' || $nv['url']=='14')){
                    // 小程序内屏蔽赏金职位、红包职位
                    unset($nav[$nk]);
                }elseif ($zphnet_web == 2 && $nv['url']=='18'){
                    // 网络招聘会模块未开启,需屏蔽
                    unset($nav[$nk]);
                }elseif (($xjhlive_web == 2 || $_POST['provider'] == 'baidu' || $_POST['provider'] == 'toutiao') && $nv['url']=='19'){
                    // 直播宣讲会模块未开启,需屏蔽。百度小程序、头条小程序不支持观看直播
                    unset($nav[$nk]);
                }elseif (($spview_web == 2 || $_POST['provider'] == 'baidu' || $_POST['provider'] == 'toutiao') && $nv['url']=='20'){
                    // 视频面试模块未开启,需屏蔽。百度小程序、头条小程序不支持视频面试
                    unset($nav[$nk]);
                }else{
                    if($nv['display']!=1){
                        unset($nav[$nk]);
                    }else{
                        $nav[$nk]['url']     =    $navurl[$nv['url']];
                        $nav[$nk]['pic']     =    checkpic($nv['pic']);
                        $navsort[]  =  $nv['navsort'];
                    }
                }
            }
 
            array_multisort($navsort,SORT_ASC,SORT_NUMERIC,$nav);
            $navarr             =    array_chunk($nav,4);
            $data['navArr']     =    $navarr;
            if (!empty($navarr)){
                $tplapp['nav']  =  '1';
            }else{
                $tplapp['nav']  =  '2';
            }
            $data['tplapp']          =    $tplapp;
 
            $data['diysort']     =    @explode(',',$tplapp['sort']);
 
            $data['contact'] = 0;
            if ($tplapp['cshow'] == '1'){
                $data['contact'] = 1;
            }
            //首页自定义关于我们等
            if ($tplapp['private'] == '1'){
                $gy[] = array('name'=>$tplappgy[1]['name'],'url'=>$tplappgy[1]['url']);
            }
            if ($tplapp['advice'] == '1'){
                $gy[] = array('name'=>$tplappgy[2]['name'],'url'=>$tplappgy[2]['url']);
            }
            if ($tplapp['advice'] == '1'){
                $gy[] = array('name'=>$tplappgy[3]['name'],'url'=>$tplappgy[3]['url']);
            }
            $data['gy']  =  $gy;
 
            $data['webname']  =  $this->config['sy_webname'];
            if (!empty($this->config['sy_wapdomain'])){
                $data['wapurl']  =  $this->config['sy_wapdomain'];
            }
            // 根据职位是否为最后一项,判断是否可以上拉加载
            $data['joblast'] = $this->isJobShowLast($tplapp);
        }
        // 默认分站
        $data['indexcity']  =  $this->config['sy_web_site'] == 1 ? $this->config['sy_indexcity'] : '';
        // 小程序用seo
        if (isset($_POST['provider'])){
            if ($_POST['provider'] == 'baidu' || $_POST['provider'] == 'weixin' || $_POST['provider'] == 'toutiao'){
                $seo            =  $this->seo('index','','','',false, true);
                $data['seo']    =  $seo;
            }
        }
        $this->render_json(0,'ok',$data);
    }
    // 首页其他内容处理
    function homeOther_action()
    {
        include(DATA_PATH.'api/wxapp/tplapp.cache.php');
        // 处理分站查询条件
        if (!empty($_POST['did'])){
 
            $domain  =  $this->getDomain($_POST['did']);
        }
 
        $time  =  time();
        include_once(PLUS_PATH.'pimg_cache.php');
        // 广告
        if($tplapp['membershow']=='1'){
            $adid   = $tplapp['hdid'] ? $tplapp['hdid'] : 50;
            $did    = isset($_POST['did']) ? $_POST['did'] : 0;
            $adpics = $this->getPimg($ad_label[$adid], $did, $_POST);
            $data['ad']  =  $adpics;
        }
        // 广告
        if($tplapp['adshow']=='1'){
            $classId = !empty($tplapp['adhdid']) ? $tplapp['adhdid'] : 503;
            $did     = isset($_POST['did']) ? $_POST['did'] : 0;
            $banner = $this->getPimg($ad_label[$classId], $did, $_POST);
 
            $random = isset($_POST['random']) ? $_POST['random'] : 0; // 判断是否取随机条数
            if ($random && count($banner) > $random) {
                if ($adpics && $random) {
                    $banner = $this->randomArr($banner, $random);
                }
            }
 
            $data['adBanner']  =  $banner;
        }
 
        // 小程序首页弹出广告
        $ejectid   = isset($_POST['eject_id']) ? $_POST['eject_id'] : 502;
        $did       = isset($_POST['did']) ? $_POST['did'] : 0;
 
        $ejectBanner = $this->getPimg($ad_label[$ejectid], $did, $_POST);
        $data['ejectBanner']  =  $ejectBanner;
 
        // 搜索关键字
        $key_name  = array();
        if ($tplapp['searchshow'] == 1){
 
            $hotKeyM  =  $this->MODEL('hotkey');
            $rows = $hotKeyM->getList(array('type'=>3,'limit'=>20,'orderby'=>'num'),array('field'=>'`key_name`'));
 
            foreach($rows as $k=>$v) {
                $key_name[]  =  $v['key_name'];
            }
        }
        $data['hotkey'] = $key_name;
        // 公告
        $ggList  = array();
        if ($tplapp['notice'] == 1){
 
            $ggM    =  $this->MODEL('announcement');
 
            if (!empty($_POST['did'])){
                $gwhere['did']  =  $_POST['did'];
            }
            //公告开始时间
            $gwhere['PHPYUNBTWSTART_A'] = array();
            $gwhere['startime'][]  =  array('<=',$time,'OR');
            $gwhere['startime'][]  =  array('=',0,'OR');
            $gwhere['startime'][]  =  array('isnull','','OR');
            $gwhere['PHPYUNBTWEND_A'] = array();
 
            $gwhere['PHPYUNBTWSTART_B'] = array();
            $gwhere['endtime'][]  =  array('>',$time,'AND');
            $gwhere['endtime'][]  =  array('=',0,'OR');
            $gwhere['endtime'][]  =  array('isnull','','OR');
            $gwhere['PHPYUNBTWEND_B'] = array();
 
            $gwhere['limit']    =  5;
            $gwhere['orderby']  =  'startime,desc';
 
            $gg  =  $ggM->getList($gwhere,array('field'=>'`id`,`title`,`startime`,`datetime`','utype'=>'wxapp'));
 
            if (!empty($gg['list'])){
                $ggList =   $gg['list'];
            }
        }
        $data['ggList'] =   $ggList;
        //首页名企
        if ($tplapp['hotcom'] == '1') {
 
            $companyM   =   $this->MODEL('company');
 
            if (!empty($_POST['did'])) {
 
                if (isset($domain['provinceid']) && !empty($domain['provinceid'])) {
                    $hotcomwhere['provinceid']  =   $domain['provinceid'];
                }
                if (isset($domain['cityid']) && !empty($domain['cityid'])) {
                    $hotcomwhere['cityid']      =   $domain['cityid'];
                }
                if (isset($domain['three_cityid']) && !empty($domain['three_cityid'])) {
                    $hotcomwhere['three_cityid']=   $domain['three_cityid'];
                }
                if (isset($domain['hyclass']) && !empty($domain['hyclass'])) {
                    $hotcomwhere['hy']          =   $domain['hyclass'];
                }
            }
 
            $hotcomwhere['hottime']     =   array('>', $time);
            $hotcomwhere['r_status']    =   1;
 
            $hcom                       =   $companyM->getChCompanyList($hotcomwhere, array('field' => '`uid`'));
 
            if (!empty($hcom)) {
                foreach ($hcom as $v) {
                    $hcuid[]    =   $v['uid'];
                }
                $hcwhere['uid'] =   array('in', pylode(',', $hcuid));
                $hcwhere['time_start']  =   array('<', $time);
                $hcwhere['time_end']    =   array('>', $time);
                $hcwhere['orderby']     =   'sort';
                $hcwhere['limit']       =   $tplapp['hotcomnum'] ? $tplapp['hotcomnum'] : 10;
 
                $hotcom = $companyM->getHotJobList($hcwhere, array('utype' => 'wxapp', 'field' => '`uid`,`hot_pic`'));
            }else{
                $hotcom = array();
            }
        }
 
        $data['comlist']    =  count($hotcom) > 0 ? $hotcom : array();
        //首页自定义招聘会
        if($tplapp['zphshow']=='1'){
 
            $zphM   =  $this->MODEL('zph');
            $zphone =  $zphM->getInfo(array('unix_timestamp(`endtime`)'=>array('>',$time)),array('field'=>'`id`'));
 
            $field  =  '`id`,`title`,`starttime`,`endtime`,`address`';
 
            $zwhere =   array();
 
            if (!empty($zphone)){
                $field  .=  ',CASE WHEN unix_timestamp(`endtime`)>'.$time.' THEN unix_timestamp(`starttime`)';
                $field  .=  ' WHEN unix_timestamp(`endtime`)<'.$time.' THEN -1*unix_timestamp(`starttime`) END AS `zph_px`';
 
                $zwhere['orderby'] .=  ' CASE WHEN unix_timestamp(`starttime`)<"'.$time.'" AND unix_timestamp(`endtime`)>"'.$time.'" THEN 0';
                $zwhere['orderby'] .=  ' WHEN unix_timestamp(`starttime`)>"'.$time.'" THEN 1';
                $zwhere['orderby'] .=  ' WHEN unix_timestamp(`endtime`)<"'.$time.'" THEN 2';
                $zwhere['orderby'] .=  ' END,`zph_px` ASC';
            }else{
 
                $zwhere['orderby'] .=  'unix_timestamp(`starttime`)';
            }
            if (!empty($_POST['did'])){
                $zwhere['did']  =  $_POST['did'];
            }
            $zwhere['is_open'] = 1;
            $zwhere['limit']     =  $tplapp['zphnum'] ? $tplapp['zphnum']:5;
 
            $zphrows        =  $zphM -> getList($zwhere, array('field'=>$field));
        }
        $data['zphlist']    =  count($zphrows)>0 ? $zphrows : array();
        //首页自定义资讯
        if($tplapp['articleshow']=='1'){
 
            if ($tplapp['articletype']=='1' || $tplapp['articletype']=='2') {//app首页自定义-咨询类型如果是图文则只查询有图的
                $awhere['newsphoto']   =  array('<>','');
            }
 
            if (!empty($_POST['did'])){
                $awhere['did']  =  $_POST['did'];
            }
            //新闻资讯开始时间
            $awhere['PHPYUNBTWSTART_A'] = array();
            $awhere['starttime'][]  =  array('<=',$time,'OR');
            $awhere['starttime'][]  =  array('=',0,'OR');
            $awhere['starttime'][]  =  array('isnull','','OR');
            $awhere['PHPYUNBTWEND_A'] = array();
            //结束时间
            $awhere['PHPYUNBTWSTART_B'] = array();
            $awhere['endtime'][]  =  array('>',$time,'AND');
            $awhere['endtime'][]  =  array('=',0,'OR');
            $awhere['endtime'][]  =  array('isnull','','OR');
            $awhere['PHPYUNBTWEND_B'] = array();
 
            $awhere['orderby']  =  'starttime,desc';
 
            $awhere['limit']  =  $tplapp['articlenum'] ? $tplapp['articlenum']:5;
 
            $articleM     =  $this->MODEL('article');
            $articlerows  =  $articleM->getList($awhere,array('field'=>'`id`,`title`,`newsphoto`,`description`'));
        }
        $data['articlelist']    =  count($articlerows['list'])>0 ? $articlerows['list'] :array();
 
        $data['qqdt']     =  !empty($this->config['sy_qqdt']) ? $this->config['sy_qqdt'] : 2;
        $data['wxlogin']  =  !empty($this->config['sy_app_wxlogin']) ? $this->config['sy_app_wxlogin'] : 2;
        $data['qqlogin']  =  !empty($this->config['sy_app_qqlogin']) ? $this->config['sy_app_qqlogin'] : 2;
        $data['kfurl']    =  $tplapp['kfurl'] ? $tplapp['kfurl'] :  '';
        $data['kfcomid']  =  $tplapp['kfcomid'] ? $tplapp['kfcomid'] :  '';
        $data['app_wxkf'] =  !empty($this->config['sy_app_wxkf']) ? $this->config['sy_app_wxkf'] : 2;
        // 微信小程序视频号id
        if ($_POST['provider'] == 'weixin'){
            include(DATA_PATH.'api/wxpay/wxpay_data.php');
            if (!empty($wxpaydata['sy_sphid'])){
                $data['sphid'] = $wxpaydata['sy_sphid'];
            }
        }
 
        $this->render_json(0,'ok',$data);
    }
 
    function getPimg($adArr = array(), $did = 0, $post = []){
 
        $time  =  time();
        $adpics =   array();
 
        if (!empty($adArr)){
            foreach ($adArr as $v){
                // 图片广告、没过期、全站使用或者与分站对应
                if($v['type']=='pic' && $v['start']<$time && $v['end']>$time && ($v['did'] == -1 || $v['did'] == $did)){
                    if (isset($post['appad'])){
                        $appad['src']  =  $v['pic'];
                        if (!empty($v['appurl'])){
                            // 处理跳转链接路径,开头没有/的,加上/
                            $appad['appurl']  =  stripos($v['appurl'],'/') == 0 ? $v['appurl'] : '/'.$v['appurl'];
                        }else{
                            $appad['appurl']  =  '';
                        }
                    }else{
                        $appad = $v['pic'];
                    }
                    $adpics[]  =  $appad;
                }
            }
        }
 
        return $adpics;
    }
    // 底部导航查询
    function getFoot_action()
    {
        include(DATA_PATH.'api/wxapp/tplapp.cache.php');
        // 消息
        if (!empty($_POST['uid']) && !empty($_POST['token'])){
 
            $member   =  $this->yzToken($_POST['uid'], $_POST['token']);
            $msgNumM  =  $this->MODEL('msgNum');
            $msg      =  $msgNumM->getmsgNum($member['uid'],$member['usertype'],array('from' => 'wxapp'));
            $sysnum   =  $msg['msgNum'];
 
            if($member['usertype']==2 && $_POST['couponOT']){//查询即将过期的优惠券
                $couponM        =   $this -> MODEL('coupon');
                $couponNum      =   $couponM->getCouponNum(
                    array(
                        'uid'       => $member['uid'],
                        'status'    => 1,
                        'validity'  => array(array('>', time(),'AND'),array('<', strtotime('+ '.$this->config['sy_couponday'].' days'),'AND'))
                    )
                );
            }
            if (isset($this -> config['sy_chat_open'])){
                if ($this -> config['sy_chat_open'] == 1){
 
                    $chatM  =  $this->MODEL('chat');
                    $chat   =  $chatM->userinfo(array('uid'=>$member['uid'],'usertype'=>$member['usertype']));
 
                    $data['mine']      =  $chat['mine'];
                    $data['yuntoken']  =  $chatM->chatToken($member['uid']);
                }
            }
            if($this -> config['sy_iospay']=='2'){
                $sysnum -=$msg['jobpackNum'];
            }
 
        }else{
            $sysnum   =  0;
        }
        if($_POST['firstFoot']=='1'){
            foreach ($footnav as $k=>$v){
                $arr = explode(',', $v['pic']);
                $footnav[$k]['pic'] = checkpic($arr[0]);
                if (count($arr) > 1){
                    $footnav[$k]['curpic'] = checkpic($arr[1]);
                }
            }
            $footnav = count($footnav) ? $footnav : array();
 
            $data['footnav']  =  $footnav;
        }
        $data['iosfk']    =  isset($this->config['sy_iospay']) ? $this->config['sy_iospay'] : 2;
        $data['fkstr']    =  array('fkal'=>'支付宝','fkwx'=>'微信支付');
        $data['sysnum']   =  $sysnum;
        $data['couponNum']=  $couponNum ? $couponNum : 0;
        $this->render_json(0,'',$data);
    }
    /**
     * 身份切换申请相关数据获取和校验
     */
    function applytype_action(){
        $user           =   $this->yzToken((int)$_POST['uid'],$_POST['token']);
        $memberM        =   $this -> MODEL('userinfo');
        $uid            =   $user['uid'];
        $usertype       =   $user['usertype'];
 
        $applyusertype  =   $usertype==1 ? 2 : 1;
 
        $applyContent   =   trim($_POST['applyContent']) ? trim($_POST['applyContent']) : '';
 
        $res            =   $memberM->checkChangeApply($uid,$applyusertype,$applyContent);
 
        $wxqcode        =   checkpic($this->config['sy_wx_qcode']);
 
        if($res['errcode']==6){
 
            $res['errcode']  =   2;
 
        }
 
        $data           =   array(
            'msg'       =>  $res['msg'],
            'errcode'   =>  $res['errcode'],
            'user'      =>  !empty($res['user']) ? $res['user'] :array(),
            'wxqcode'   =>  $wxqcode,
            'webtel'    =>  $this->config['sy_freewebtel']
        );
 
        $this           ->  render_json(0,'',$data);
    }
 
    /**
     * 意见反馈
     */
    function advice_action(){
 
        $data       =   array(
            'webtel'  =>  $this->config['sy_freewebtel'],
 
        );
 
        $user           =   $this->yzToken((int)$_POST['uid'],$_POST['token']);
        if($user['uid']){
            $userinfoM  = $this->MODEL('userinfo');
            $meminfo    = $userinfoM->getUserInfo(array('uid'=>$user['uid']),array('usertype'=>$user['usertype']));
            $username = $mobile = '';
            if($user['usertype']==1){
                $username = $meminfo['name'];
                $mobile = $meminfo['telphone'];
            }else if($user['usertype']==2){
                $username = $meminfo['name'];
                $mobile = $meminfo['linktel'];
            }else if($user['usertype']==3){
                $username = $meminfo['realname'];
                $mobile = $meminfo['moblie'];
            }else if($user['usertype']==4){
                $username = $meminfo['name'];
                $mobile = $meminfo['linktel'];
            }
            $data['advice_name'] = $username;
            $data['advice_mobile'] = $mobile;
        }
 
        $data['sy_advice_mobilecode'] = $this->config['sy_advice_mobilecode'];
        $data['sy_msg_isopen'] = $this->config['sy_msg_isopen'];
        $data['sy_msg_cert'] = $this->config['sy_msg_cert'];
 
        $this->render_json(1,'',$data);
    }
 
    /**
     * 意见反馈-发送动态码
     */
    function sendAdviceMsg_action()
    {
        $moblie            =        $_POST['moblie'];
 
        $this->checkMcsdk($moblie);
 
        $noticeM        =       $this->MODEL('notice');
 
        $port   =   $this->plat == 'mini' ? '3' : '4';  // 短信发送端口$port : 3-小程序  4-APP
        $result =   $noticeM->sendCode($moblie, 'cert', $port,array(), 6, 90, 'msg');
        if($result['error']==1){
            $errcode    =   1;
        }else{
            $errcode    =   2;
            $msg        =   $result['msg'];
        }
        $this->render_json($errcode,$msg);
    }
    /**
     * 意见反馈-保存
     */
    function saveadvice_action()
    {
        $data        =    array(
            'username'    =>    $_POST['username'],
            'infotype'    =>    $_POST['infotype'],
            'content'    =>    $_POST['content'],
            'mobile'    =>    $_POST['mobile'],
            'advice_code'=> $_POST['code'],
            'utype'        =>    'wxapp'
        );
        $adviceM    =    $this->MODEL('advice');
        $return        =    $adviceM->addInfo($data);
        if($return['errcode'] == 9){
            $errcode    =    1;
        }else{
            $errcode    =    2;
        }
        $this->render_json($errcode,$return['msg']);
    }
    /**
     * 首页首次进入app提示
     */
    function getXybox_action()
    {
        include(DATA_PATH.'api/wxapp/app.config.php');
 
        $data['title']    =  $appconfig['xyboxtitle'];
        $data['content']  =  $appconfig['xyboxcontent'];
 
        $this->render_json(0, 'ok', $data);
    }
    /**
     * app退出登录,清除推送标识
     */
    public function tc_action(){
        $userInfoM  =  $this->MODEL('userinfo');
        $userInfoM -> upInfo(array('uid'=>intval($_POST['uid'])), array('clientid'=>'','deviceToken'=>''));
        $this->render_json(0, 'ok');
    }
 
    //小程序我的 查询广告位
    public function getAd_action()
    {
        $flag = isset($_POST['flag']) ? $_POST['flag'] : '';
        $flagArray = [
            'resume'      => 505,
            'job'         => 504,
            'user_center' => 500,
            'com_center'  => 501
        ];
        if ($flag && isset($flagArray[$flag])) {
            $adid = $flagArray[$flag];
        } else {
            $adid           =  (int)$_POST['class_id'];
        }
 
        include PLUS_PATH.'pimg_cache.php';
        $adpics =   array();
 
        $time  =  time();
        foreach ($ad_label[$adid] as $k=>$v){
            // 图片广告、没过期、全站使用或者与分站对应
            if($v['type']=='pic' && $v['start']<$time && $v['end']>$time){
                if (isset($_POST['appad'])){
                    $appad['pic_url']  =  $v['pic'];
                    if (!empty($v['appurl'])){
                        // 处理跳转链接路径,开头没有/的,加上/
                        $appad['appurl']  =  stripos($v['appurl'],'/') == 0 ? $v['appurl'] : '/'.$v['appurl'];
                    }else{
                        $appad['appurl']  =  '';
                    }
                }else{
                    $appad = $v['pic'];
                }
 
                $adpics[]  =  $appad;
            }
        }
 
        $random = isset($_POST['random']) ? $_POST['random'] : 0; // 判断是否取随机条数
        if ($adpics && $random) {
            $adpics = $this->randomArr($adpics, $random);
        }
        $data['list']  =  $adpics;
 
        $this -> render_json(0, 'ok', $data);
    }
    /**
     * 职位列表是否显示且在自定义排序最下方
     */
    function isJobShowLast($tplapp){
        $customizeSort = array();// 自定义模板排序
        if (isset($tplapp)) {
            $rt = 1;
            if ($tplapp['job'] != 1) {// 隐藏职位列表
                $rt = 0;
            } else {// 职位列表为显示状态
                if ($tplapp['sort']) {
                    $sort = explode(',', $tplapp['sort']);
                } else {
                    $sort = 'search,member,nav,notice,login,hotcom,ad,job,zph,article,connect,foot';
                    $sort = explode(',', $sort);
                }
                foreach ($sort as $v) {
                    in_array($v, ['hotcom', 'login', 'ad', 'job', 'zph', 'article']) && array_push($customizeSort, $v);
                }
                $jobIndex = array_search('job', $customizeSort);
                $showAble = array('hotcom' => 'hotcom', 'login' => 'login', 'ad' => 'adshow', 'job' => 'job', 'zph' => 'zphshow', 'article' => 'articleshow');
                if ($jobIndex < 5) {// 职位列表非最后一个
                    for($i = $jobIndex + 1; $i < count($customizeSort); $i++){
                        if ($tplapp[$showAble[$customizeSort[$i]]] == 1) {// 职位列表后有其他显示项
                            $rt = 0;
                            break;
                        }
                    }
                }
            }
        }
        return $rt;
    }
}
?>