diff --git a/src/dede/makehtml_taglist_action.php b/src/dede/makehtml_taglist_action.php index 808b5494..e08dbb7b 100644 --- a/src/dede/makehtml_taglist_action.php +++ b/src/dede/makehtml_taglist_action.php @@ -76,8 +76,12 @@ if (is_array($tag) && count($tag) > 0) { } else { $query = "UPDATE `#@__tagindex` SET mktime=uptime WHERE id='$ctagid' "; $dsql->ExecuteNoneQuery($query); - - $reurl .= GetPinyin($tag['tag']); + + if (empty($tag['tag_pinyin'])) { + $tag = $dsql->GetOne("SELECT * FROM `#@__tagindex` WHERE id='$ctagid' LIMIT 0,1;"); + } + + $reurl .= $tag['tag_pinyin']; ShowMsg("完成TAG更新:[" . $tag['tag'] . "]!浏览TAG首页", "javascript:;"); } exit(); diff --git a/src/dede/tags_main.php b/src/dede/tags_main.php index b35e5508..7353f26f 100755 --- a/src/dede/tags_main.php +++ b/src/dede/tags_main.php @@ -1,4 +1,5 @@ SetParameter("orderway", $orderway); $dlist->SetParameter("orderby", $orderby); $dlist->pageSize = 20; - $dlist->SetTemplet(DEDEADMIN."/templets/tags_main.htm"); + $dlist->SetTemplet(DEDEADMIN . "/templets/tags_main.htm"); $dlist->SetSource($query); $dlist->Display(); exit(); } /* function update() -*/ -else if($action == 'update') -{ - $tid = (empty($tid) ? 0 : intval($tid) ); - $count = (empty($count) ? 0 : intval($count) ); - if(empty($tid)) - { - ShowMsg('没有选择要删除的tag!','-1'); +*/ else if ($action == 'update') { + $tid = (empty($tid) ? 0 : intval($tid)); + $count = (empty($count) ? 0 : intval($count)); + if (empty($tid)) { + ShowMsg('没有选择要删除的tag!', '-1'); exit(); } $query = "UPDATE `#@__tagindex` SET `count`='$count' WHERE id='$tid' "; @@ -53,101 +50,85 @@ else if($action == 'update') } /* function delete() -*/ -else if($action == 'delete') -{ - if(@is_array($ids)) - { +*/ else if ($action == 'delete') { + if (@is_array($ids)) { $stringids = implode(',', $ids); - } - else if(!empty($ids)) - { + } else if (!empty($ids)) { $stringids = $ids; - } - else - { - ShowMsg('没有选择要删除的tag','-1'); + } else { + ShowMsg('没有选择要删除的tag', '-1'); exit(); } $query = "DELETE FROM `#@__tagindex` WHERE id IN ($stringids)"; - if($dsql->ExecuteNoneQuery($query)) - { + if ($dsql->ExecuteNoneQuery($query)) { $query = "DELETE FROM `#@__taglist` WHERE tid IN ($stringids)"; $dsql->ExecuteNoneQuery($query); ShowMsg("删除tags[ $stringids ]成功", 'tags_main.php'); - } - else - { + } else { ShowMsg("删除tags[ $stringids ]失败", 'tags_main.php'); } exit(); +} else if ($action == 'get_one') { + $tid = (empty($tid) ? 0 : intval($tid)); + $row = $dsql->GetOne("SELECT * FROM `#@__tagindex` WHERE id = $tid"); + echo json_encode($row); + exit; +} else if ($action == 'set_one') { + $tid = (empty($tid) ? 0 : intval($tid)); + $title = empty($title) ? "" : HtmlReplace($title, 0); + $kw = empty($kw) ? "" : HtmlReplace($kw, 0); + $des = empty($des) ? "" : HtmlReplace($des, 0); + $dsql->ExecuteNoneQuery("UPDATE `#@__tagindex` SET title='{$title}',keywords='{$kw}',`description`='{$des}' WHERE id = {$tid}"); + echo json_encode(array('code' => 200, 'result' => true)); } /* function fetch() -*/ -else if($action == 'fetch') -{ +*/ else if ($action == 'fetch') { $wheresql = ''; $start = isset($start) && is_numeric($start) ? $start : 0; $where = array(); - if(isset($startaid) && is_numeric($startaid) && $startaid > 0) - { + if (isset($startaid) && is_numeric($startaid) && $startaid > 0) { $where[] = " id>=$startaid "; - } - else - { + } else { $startaid = 0; } - if(isset($endaid) && is_numeric($endaid) && $endaid > 0) - { + if (isset($endaid) && is_numeric($endaid) && $endaid > 0) { $where[] = " id<=$endaid "; - } - else - { + } else { $endaid = 0; } - if(!empty($where)) - { - $wheresql = " WHERE arcrank>-1 AND ".implode(' AND ', $where); + if (!empty($where)) { + $wheresql = " WHERE arcrank>-1 AND " . implode(' AND ', $where); } $query = "SELECT id as aid,arcrank,typeid,keywords FROM `#@__archives` $wheresql LIMIT $start, 100"; $dsql->SetQuery($query); $dsql->Execute(); $complete = true; $now = time(); - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $aid = $row['aid']; $typeid = $row['typeid']; $arcrank = $row['arcrank']; $row['keywords'] = trim($row['keywords']); - if($row['keywords']!='' && !preg_match("#,#", $row['keywords'])) - { + if ($row['keywords'] != '' && !preg_match("#,#", $row['keywords'])) { $keyarr = explode(' ', $row['keywords']); - } - else - { + } else { $keyarr = explode(',', $row['keywords']); } - foreach($keyarr as $keyword) - { + foreach ($keyarr as $keyword) { $keyword = trim($keyword); - if($keyword != '' && strlen($keyword)<13 ) - { + if ($keyword != '' && strlen($keyword) < 13) { $keyword = addslashes($keyword); $row = $dsql->GetOne("SELECT id,total FROM `#@__tagindex` WHERE tag LIKE '$keyword'"); - if(is_array($row)) - { + if (is_array($row)) { $tid = $row['id']; $trow = $dsql->GetOne("SELECT COUNT(*) as dd FROM `#@__taglist` WHERE tag LIKE '$keyword'"); - if (intval($trow['dd']) != $row['total'] ) { - - $query = "UPDATE `#@__tagindex` SET `total`=".$trow['dd'].",uptime=$now WHERE id='$tid' "; + if (intval($trow['dd']) != $row['total']) { + + $query = "UPDATE `#@__tagindex` SET `total`=" . $trow['dd'] . ",uptime=$now WHERE id='$tid' "; $dsql->ExecuteNoneQuery($query); } - } - else - { + } else { $query = " INSERT INTO `#@__tagindex`(`tag`,`count`,`total`,`weekcc`,`monthcc`,`weekup`,`monthup`,`addtime`,`uptime`) VALUES('$keyword','0','1','0','0','$timestamp','$timestamp','$timestamp','$now');"; $dsql->ExecuteNoneQuery($query); $tid = $dsql->GetLastID(); @@ -158,8 +139,7 @@ else if($action == 'fetch') } $complete = FALSE; } - if($complete) - { + if ($complete) { ShowMsg("tags获取完成", 'tags_main.php'); exit(); } @@ -167,4 +147,4 @@ else if($action == 'fetch') $goto = "tags_main.php?action=fetch&startaid=$startaid&endaid=$endaid&start=$start"; ShowMsg('继续获取tags ...', $goto, 0, 500); exit(); -} \ No newline at end of file +} diff --git a/src/dede/templets/makehtml_taglist.htm b/src/dede/templets/makehtml_taglist.htm index ca80620e..8adf0fa6 100644 --- a/src/dede/templets/makehtml_taglist.htm +++ b/src/dede/templets/makehtml_taglist.htm @@ -9,7 +9,8 @@ - +
@@ -28,6 +29,7 @@ GetOne("SELECT ROUND(AVG(total)) as tt FROM `#@__tagindex`"); // 取一个平均 + $dd['tt'] = ($dd['tt'] > 5)? $dd['tt'] : 0; $sql="select * from #@__tagindex where total > {$dd['tt']} order by tag asc"; $dsql->Execute('al',$sql); echo " +
@@ -52,11 +122,12 @@
提取Tag
- +
- +
@@ -64,7 +135,8 @@ 搜索: -   更新Tag HTML +   更新Tag HTML @@ -118,10 +190,14 @@ {/dede:datalist} diff --git a/src/favicon.ico b/src/favicon.ico old mode 100755 new mode 100644 index e0f2b78f..c20184e2 Binary files a/src/favicon.ico and b/src/favicon.ico differ diff --git a/src/include/arc.taglist.class.php b/src/include/arc.taglist.class.php index 7e7f8de8..2382d05e 100755 --- a/src/include/arc.taglist.class.php +++ b/src/include/arc.taglist.class.php @@ -78,6 +78,15 @@ class TagList ShowMsg($msg, "-1"); exit(); } + // 确定是否存在tag_pinyin + if (empty($this->TagInfos['tag_pinyin'])) { + $this->TagInfos['tag_pinyin'] = $this->TagPinyinExists($this->Tag) ? GetPinyin($this->Tag) . $this->TagInfos['id'] : GetPinyin($this->Tag); + $this->dsql->ExecNoneQuery("UPDATE `#@__tagindex` SET tag_pinyin = '{$this->TagInfos['tag_pinyin']}' WHERE tag LIKE '{$this->Tag}'"); + } + + $this->Fields['title'] = empty($this->TagInfos['title']) ? $this->Fields['title'] : $this->TagInfos['title']; + $this->Fields['keywords'] = empty($this->TagInfos['keywords']) ? $this->Fields['keywords'] : $this->TagInfos['keywords']; + $this->Fields['description'] = empty($this->TagInfos['description']) ? $this->Fields['description'] : $this->TagInfos['description']; } //初始化模板 @@ -90,6 +99,13 @@ class TagList $this->TempletsFile = preg_replace("#^" . $GLOBALS['cfg_basedir'] . "#", '', $tempfile); } + function TagPinyinExists($tag) + { + $tag_py = GetPinyin($tag); + $row = $this->dsql->GetOne("Select count(*) as dd From `#@__tagindex` where tag_pinyin like '{$tag_py}' "); + return $row['dd'] > 0; + } + //php4构造函数 function TagList($keyword, $templet) { @@ -627,7 +643,8 @@ class TagList if ($endpage == 1) { $endpage = 2; } - $makeDir = $this->GetTruePath() . "/a/tags/" . GetPinyin($this->Tag) . "/"; + + $makeDir = $this->GetTruePath() . "/a/tags/" . $this->TagInfos['tag_pinyin'] . "/"; MkdirAll($makeDir, $cfg_dir_purview); for ($this->PageNo = $startpage; $this->PageNo < $endpage; $this->PageNo++) { $this->ParseDMFields($this->PageNo, 1); diff --git a/src/include/common.func.php b/src/include/common.func.php index cb318677..829b4260 100755 --- a/src/include/common.func.php +++ b/src/include/common.func.php @@ -209,7 +209,7 @@ function ShowMsg($msg, $gourl, $onlymsg = 0, $limittime = 0) global $cfg_soft_lang, $cfg_cmsurl; if (empty($GLOBALS['cfg_plus_dir'])) $GLOBALS['cfg_plus_dir'] = '..'; - $htmlhead = "\r\n\r\nDedeCMS提示信息\r\n\r\n"; + $htmlhead = "\r\n\r\nDedeBIZ提示信息\r\n\r\n"; $htmlhead .= ""; $htmlhead .= "\r\n" . (isset($GLOBALS['ucsynlogin']) ? $GLOBALS['ucsynlogin'] : '') . "\r\n
\r\n\r\n
\r\n\r\n\r\n"; @@ -238,7 +238,7 @@ function ShowMsg($msg, $gourl, $onlymsg = 0, $limittime = 0) }\r\n"; $rmsg = $func; $rmsg .= "document.write(\"
Tag维护
- );' class="btn btn-secondary btn-sm">更新 - - ' class="btn btn-secondary btn-sm">生成HTML - );' class="btn btn-secondary btn-sm">删 + , "");' + class="btn btn-secondary btn-sm">关键词描述 + );' + class="btn btn-secondary btn-sm">更新 + ' + class="btn btn-secondary btn-sm">生成HTML + );' + class="btn btn-secondary btn-sm">删