织梦dede整合discuz后会员注册后不用激活实现方法(3)

function gettag($get, $post)
{
   $name = $get['id'];
   if(!API_GETTAG)
   {
    return API_RETURN_FORBIDDEN;
   }

   //note 获取标签 API 接口

   $name = trim($name);
   if(empty($name) || !preg_match('/^([\x7f-\xff_-]|\w|\s)+$/', $name) || strlen($name) > 20)
   {
    return API_RETURN_FAILED;
   }

   $row = $this->db->GetOne("SELECT `total`,`id` FROM `dede_tagindex` WHERE `tag`='$name'");
   if(!is_array($row))
   {
    return API_RETURN_FAILED;
   }
  
   $tpp = $row['total'] > 10 ? 10 : $row['total'];  
  
   $ids = array();
  
   $this->db->SetQuery("SELECT aid FROM `dede_taglist` WHERE `tid`='$row[id]' AND arcrank>-1");
   $this->db->Execute();
   while($row = $this->db->GetArray())
   {
    $ids[] = $row['aid'];   
   }
  
   if(empty($ids))
   {
    return API_RETURN_FAILED;
   }
  
   $aids = implode(",", $ids);
  
   include_once DEDEINC.'/channelunit.func.php';
  
   $archives_list = array();  
   $this->db->SetQuery("SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
FROM `dede_archives` arc LEFT JOIN `dede_arctype` tp ON arc.typeid=tp.id WHERE arc.id IN($aids) ORDER BY id DESC LIMIT $tpp");
   $this->db->Execute();
   while($row = $this->db->GetArray())
   {
    $row['url'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],$row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/c8d5d8fa55c6b5c32a897c09ccd717cf.html