123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
-
-
- namespace app\home\controller;
-
- use think\Cache;
-
- class Guestbook extends Base
- {
-
- public $nid = 'guestbook';
-
- public $channeltype = '';
-
- public function _initialize() {
- parent::_initialize();
- $channeltype_list = config('global.channeltype_list');
- $this->channeltype = $channeltype_list[$this->nid];
- }
-
- public function lists($tid)
- {
- $tid_tmp = $tid;
- $seo_pseudo = config('ey_config.seo_pseudo');
- if (empty($tid)) {
- $map = array(
- 'channeltype' => $this->channeltype,
- 'parent_id' => 0,
- 'is_hidden' => 0,
- 'status' => 1,
- );
- } else {
- if (3 == $seo_pseudo) {
- $map = array('dirname'=>$tid);
- } else {
- if (!is_numeric($tid) || strval(intval($tid)) !== strval($tid)) {
- to_index();
- }
- $map = array('id'=>$tid);
- }
- }
- $map['lang'] = $this->home_lang;
- $row = M('arctype')->field('id,dirname')->where($map)->order('sort_order asc')->limit(1)->find();
- $tid = !empty($row['id']) ? intval($row['id']) : 0;
- $dirname = !empty($row['dirname']) ? $row['dirname'] : '';
-
-
- $this->jumpRewriteFormat($tid, $dirname, 'lists');
-
-
- if (3 == $seo_pseudo) {
- $tid = $dirname;
- } else {
- $tid = $tid_tmp;
- }
-
- $bookList = $this->getList();
- $this->assign('bookList', $bookList);
-
- return action('home/Lists/index', $tid);
- }
-
- private function getList($limit = 20) {
- $data = [];
- $lst = M('guestbook')->field('aid')->where("typeid", 1)->where('is_star','=',1)
-
- ->order('aid desc')->limit($limit)->select();
- if ($lst) {
- foreach ($lst as $v) {
- $v_lst = M('guestbook_attr')->where("aid", $v['aid'])->select();
- if ($v_lst) {
- $tmp = [];
- foreach ($v_lst as $val2) {
- if ($val2['attr_id'] == 32) {
- $tmp["xueli"] = $val2['attr_value'];
- } elseif ($val2['attr_id'] == 33) {
- $tmp["age"] = $val2['attr_value'];
- } elseif ($val2['attr_id'] == 34) {
- $tmp["city"] = $val2['attr_value'];
- } elseif ($val2['attr_id'] == 35) {
- $tmp["zy"] = $val2['attr_value'];
- } elseif ($val2['attr_id'] == 36) {
- $tmp["zc"] = $val2['attr_value'];
- } elseif ($val2['attr_id'] == 37) {
- $tmp["true_name"] = $val2['attr_value'];
- } elseif ($val2['attr_id'] == 38) {
- $tmp["phone"] = $val2['attr_value'];
- $tmp["phone"] = substr($tmp["phone"], 0, 3) . str_repeat("*", 4) . substr($tmp["phone"], -4);
- }
- }
-
- array_push($data, $tmp);
- }
- }
- }
-
- return $data;
- }
- }
|