|
Server : nginx/1.18.0 System : Linux iZrj9edhd5u5pfsek09o1jZ 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 User : www ( 1000) PHP Version : 5.6.40 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv Directory : /mnt/web/www.neatabattery.com/core/library/think/template/taglib/eyou/ |
<?php
/**
* 易优CMS
* ============================================================================
* 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
* 网站地址: http://www.eyoucms.com
* ----------------------------------------------------------------------------
* 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
* ============================================================================
* Author: 小虎哥 <1105415366@qq.com>
* Date: 2018-4-3
*/
namespace think\template\taglib\eyou;
use app\home\logic\FieldLogic;
/**
* 文档基本信息
*/
class TagArcview extends Base
{
public $aid = '';
public $fieldLogic;
//初始化
protected function _initialize()
{
parent::_initialize();
$this->fieldLogic = new FieldLogic();
/*应用于文档列表*/
$this->aid = I('param.aid/d', 0);
/*--end*/
}
/**
* 获取栏目基本信息
* @author wengxianhu by 2018-4-20
*/
public function getArcview($aid = '', $addfields = '', $joinaid = '')
{
$aid = !empty($aid) ? $aid : $this->aid;
$joinaid !== '' && $aid = $joinaid;
if (empty($aid)) {
return false;
}
/*文档信息*/
$result = M("archives")->field('b.*, a.*')
->alias('a')
->join('__ARCTYPE__ b', 'b.id = a.typeid', 'LEFT')
->where('a.lang', $this->home_lang)
->find($aid);
if (empty($result)) {
echo '标签arcview报错:该文档ID('.$aid.')不存在。';
return false;
}
/*--end*/
$result['litpic'] = get_default_pic($result['litpic']); // 默认封面图
// 获取查询的控制器名
$channelInfo = model('Channeltype')->getInfo($result['channel']);
$controller_name = $channelInfo['ctl_name'];
$channeltype_table = $channelInfo['table'];
/*栏目链接*/
if ($result['is_part'] == 1) {
$result['typeurl'] = $result['typelink'];
} else {
$result['typeurl'] = typeurl('home/'.$controller_name."/lists", $result);
}
/*--end*/
/*文档链接*/
if ($result['is_jump'] == 1) {
$result['arcurl'] = $result['jumplinks'];
} else {
$result['arcurl'] = arcurl('home/'.$controller_name.'/view', $result);
}
/*--end*/
/*附加表*/
if (!empty($addfields)) {
$addfields = str_replace(',', ',', $addfields); // 替换中文逗号
$addfields = trim($addfields, ',');
} else {
$addfields = '*';
}
$tableContent = $channeltype_table.'_content';
$row = M($tableContent)->field($addfields)->where('aid',$aid)->find();
if (is_array($row)) {
$result = array_merge($result, $row);
} else {
$saveData = [
'aid' => $aid,
'add_time' => getTime(),
'update_time' => getTime(),
];
M($tableContent)->save($saveData);
}
$result = $this->fieldLogic->getChannelFieldList($result, $result['channel']); // 自定义字段的数据格式处理
/*--end*/
$result = view_logic($aid, $result['channel'], $result, true);
return $result;
}
}