本代碼不影響后期更新,不屬于二開范圍!請大家放心使用!
注:代碼只適合投稿欄目,不支持后臺文章發(fā)布投稿欄目!
由于官方數(shù)據(jù)庫users_id管理員在后臺發(fā)布的時(shí)候顯示是空,所以無法實(shí)現(xiàn),但管理員在前臺發(fā)布投稿可以顯示!管理員在前臺發(fā)布投稿的users_id為1
內(nèi)容頁調(diào)用該投稿會員信息代碼:
{eyou:memberinfos mid='$eyou.field.users_id' id='users'}
會員昵稱:{$users.nickname}
會員頭像:<img src="{$users.head_pic}" width='50' height='50' />
{$users.hidden}
{/eyou:memberinfos}
內(nèi)容頁調(diào)用會員投稿文章數(shù)量代碼:
會員投稿發(fā)布數(shù)量:{$eyou.field.users_id|diy_GetArcusercount=###}
會員投稿文章總閱讀量:{$eyou.field.users_id|diy_GetArcuserclick=###}
將以下代碼加進(jìn)根目錄下extend文件夾里面function.php文件的代碼如下:
/**
* 統(tǒng)計(jì)會員投稿的文章數(shù)
*/
function diy_GetArcusercount($users_id = 0)
{
if (empty($users_id)) {
return 0;
} else {
$row = model('Arctype')->getHasChildren($users_id);
if (empty($row)) return 0;
$users_ids = array_keys($row);
$condition = [
'users_id' => ['IN', $users_ids],
'arcrank' => ['gt', -1],
'status' => 1,
'is_del' => 0,
];
/*定時(shí)文檔顯示插件*/
if (is_dir('./weapp/TimingTask/')) {
$TimingTaskRow = model('Weapp')->getWeappList('TimingTask');
if (!empty($TimingTaskRow['status']) && 1 == $TimingTaskRow['status']) {
$condition['add_time'] = ['elt', getTime()]; // 只顯當(dāng)天或之前的文檔
}
}
/*end*/
$count = thinkDb::name('archives')->where($condition)->count('aid');
return intval($count);
}
}
function diy_GetArcuserclick($users_id = 0)
{
if (empty($users_id)) {
return 0;
} else {
$row = model('Arctype')->getHasChildren($users_id);
if (empty($row)) return 0;
$users_ids = array_keys($row);
$condition = [
'users_id' => ['IN', $users_ids],
'arcrank' => ['gt', -1],
'status' => 1,
'is_del' => 0,
];
/*定時(shí)文檔顯示插件*/
if (is_dir('./weapp/TimingTask/')) {
$TimingTaskRow = model('Weapp')->getWeappList('TimingTask');
if (!empty($TimingTaskRow['status']) && 1 == $TimingTaskRow['status']) {
$condition['add_time'] = ['elt', getTime()]; // 只顯當(dāng)天或之前的文檔
}
}
/*end*/
$userclick = thinkDb::name('archives')->where($condition)->sum('click');
$click = $userclick + 1;
return intval($click);
}
}
如下圖:
已經(jīng)有人分享了