藍天采集器discuz發帖分類怎么加,是添加什么代碼

2018-07-18 170 19 編輯:wx_IwrJW2g3 來源:藍天采集社區

<?php/** * 示例:discuz發帖 * 您可參考代碼自行開發discuz的更多功能 * 您可以使用 thinkphp3.2的函數 */namespace ReleaseCms;class DiscuzDemoSkycaijiCms extends BaseCms{ public $siteurl;//discuz網站網址 public function init_extend(){ $_g=array(); foreach ($GLOBALS as $k=>$v){ $_g[$k]=$v; } //調用discuz代碼 require $this->cmsPath.'/source/class/class_core.php'; require libfile('function/editor'); //獲取站點url $siteurl=$this->db()->table('__COMMON_SETTING__')->where("`skey`='siteurl'")->find(); $this->siteurl=rtrim($siteurl['svalue'],'\/').'/'; $GLOBALS=$_g;//防止全局變量被污染 } //參數 public $_params=array( 'forumid' => array ( 'name' => '版塊ID', 'tag' => 'select', 'option' => 'function:param_option_forumid', 'require'=>1 ), 'author' => array ( 'name' => '用戶名或ID', 'tag' => 'text', 'require'=>1 ), 'title' => array ( 'name' => '帖子標題', 'tag' => 'select', 'option' => 'function:param_option_fields', 'require'=>1 ), 'content' => array ( 'name' => '帖子內容', 'tag' => 'select', 'option' => 'function:param_option_fields', 'require'=>1 ), ); /* * 導入數據 * 必須以數組形式返回: * id(必填)表示入庫返回的自增id或狀態 * target(可選)記錄入庫的數據位置(發布的網址等) * desc(可選)記錄入庫的數據位置附加信息 * error(可選)記錄入庫失敗的錯誤信息 * 入庫的信息可在“已采集數據”中查看 * return array('id'=>0,'target'=>'','desc'=>'','error'=>''); */ public function runImport($params){ //判斷用戶存在 $userData=$this->db()->table('__COMMON_MEMBER__')->where(array( 'username'=>$params['author'], 'uid'=>$params['author'], '_logic' => 'or' ))->find(); if(empty($userData)){ return array('id'=>0,'error'=>$params['author'].'用戶不存在');//返回錯誤信息 } //添加新主題 $newThread=array( 'fid'=>$params['forumid'], 'author'=>$userData['username'], 'authorid'=>$userData['uid'], 'subject'=>$params['title'], 'dateline'=>time(), 'lastpost'=>time(), 'lastposter'=>$userData['username'], ); $target='';//目標網址 $error='';//錯誤信息 $threadId=$this->db()->table('__FORUM_THREAD__')->add($newThread);//返回的id if($threadId>0){ $postId=$this->db()->table('__FORUM_POST_TABLEID__')->add(array('pid'=>0));//獲取pid if($postId>0){ //添加帖子 $newPost=array( 'pid'=>$postId, 'fid'=>$params['forumid'], 'tid'=>$threadId, 'first'=>1, 'author'=>$userData['username'], 'authorid'=>$userData['uid'], 'subject'=>$params['title'], 'dateline'=>time(), 'message'=>html2bbcode($params['content']),//html轉成discuz格式 'position'=>1, ); $this->db()->table('__FORUM_POST__')->add($newPost); $target=$this->siteurl.'forum.php?mod=viewthread&tid='.$threadId; }else{ $error='添加帖子失敗'; } }else{ $error='添加主題失敗'; } return array('id'=>$threadId,'target'=>$target,'error'=>$error); } /* * 自定義方法:版塊選項 * 必須返回鍵值對形式的數組 */ public function param_option_forumid(){ $forumDb=$this->db()->table('__FORUM_FORUM__')->where("`status`=1 and `type`<>'group'")->select(); //讀取論壇版塊 $forumList=array(); foreach ($forumDb as $forum){ $forumList[$forum['fid']]=auto_convert2utf8($forum['name']);//自動轉碼 } return $forumList; }}?>
藍天采集器discuz發帖分類怎么加,是添加什么代碼

參數怎么設置添加分類,二級分類。
圖片里的只是添加html控件,還要寫代碼實現的

admin 發表于 2018-7-18 20:40
圖片里的只是添加html控件,還要寫代碼實現的

有時間能不能開發一下,肯定很多人都需要這個功能,一般都是采集到對應的分類下面。 人手不太夠,主要精力還是放在主程序上,有時間可以開發
像好多個性化需求官方很難都滿足的,你可以找開發者 http://www.skycaiji.com/Developer,或者發需求 http://www.skycaiji.com/Demand/index/create

相關知識點: 可選 錯誤信息 代碼
本站文章均為蜀戎網絡摘自權威資料,書籍,或網絡原創文章,如有版權糾紛或者違規問題,請即刻聯系我們刪除,未經允許禁止復制轉載!感謝...
更多人喜歡

在線
客服

在線客服服務時間:9:00-21:00

客服
熱線

13227777380
7*24小時客服服務熱線

客服
微信

掃一掃微信咨詢
頂部
最近2019年免费中文字幕电影,最近更新2018中文国语字幕,最近中文字幕2018高清一页,一二三四免费观看视频中文版在线