discuz


discuz —— , , ( )

The need for:
? ? ? discuz ? ?? Ucenter??? api?????

discuz, Thinkphp32。 Ucenter , 。

discuz :
discuz ( ) :( )
1、 pre_forum_thread: tid ID
2、post pre_forum_post_tableid: pid
3、 pre_forum_post : pid、fid、tid、title、content
4、 pre_forum_forum: 、
5、 pre_forum_thread_moderate: ,
6、 pre_common_member_count:
6 , 5 。

discuz :

Warning! You are not allowed to view this text.


: pre_forum_thread ID、 ID、 、 、 。
: pre_forum_thread ID, ID, tid
: post pre_forum_post_tableid , pid
: pre_forum_post_tableid ID, pid
Part 5: Insert the post -related information in the post pre_FORUM_POST. It should be noted here: PID is PID value in the fourth part, TID is the TID value of the second step in the second step
: pre_forum_forum 、
: pre_common_member_count
:discuz 7 , discuz , 。 , , 。


1. UcApi.class.php
Thinkphp Ucenter

 

/**
           * [SendForumpost One -click Automatic Release Interface Theme]
           * @param [type] $ title [post title]
           * @param [type] $ content [post content]
     * @return [type]       [description]
     */
    public function sendForumPost($title,$content){
                 $ aposematic = 1; / / Public Information, big identifier
                 $ ++ = 112; / / identifier thematic tabs / 112 = notification and notification
        $result = send_forum_post($uid,$title,$content,$forumId);
        return $result;
    }



UcApi.class.php , uc_client client.php

2. Ucenter uc_client client.php
。 UcApi.class.php sendForumPost send_forum_post()。

 
function send_forum_post($uid,$title,$content,$forumId){
	$return = call_user_func(UC_API_FUNC, 'user', 'send_forum', array('title'=>$title,'content'=>$content,'forumId'=>$forumId, 'uid'=>$uid));
	return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return);
}


call_user_func 。

: 。mysql , :uc_api_mysql 、uc_api_post。

: , user.php

: 。 on

Parameter 4: The parameter data passed in the method is an array that needs to be used.

3. Change the UC_CLIENT controller file of the UCENTER client.

function onsend_forum(){
    $this->init_input();
    $title = $this->input('title');
    $content = htmlspecialchars($this->input('content'));
	$forumId = $this->input('forumId');
	$uid = $this->input('uid');
	$time = time();
// start warehouse operation
	 // First step: Insert the section ID, user ID, user name, publication title, publication time, and other information into the pre_forum_thread topic form.
    $this->db->query("INSERT INTO `".UC_DBNAME."`.pre_forum_thread SET fid='$forumId', authorid='$uid', author='admin', subject='$title', dateline='$time', lastpost='$time', lastposter='admin'");  
         // Step 2: Get the data ID of the first PRE_FORUM_THREAD insertion table as the topic ID, i.e. TID
	$tid = $this->db->insert_id();
	 // Step 3: Paste the data into the Post Table Pre_forum_post_tableId. In this table there is only one pid for an independent field.
    $this->db->query("INSERT INTO `".UC_DBNAME."`.pre_forum_post_tableid SET pid=''");
         // Step 4: Get the data ID of the third step in the pre_forum_post_tabled stub-in-table as a PID
	$pid = $this->db->insert_id();
	 // Part 5: Insert the information related to the message in the POST pre_forum_post. This should be noted here: PID is the value of the PID of the fourth part, and TID is the value of the TID of the second step.
    $this->db->query("INSERT INTO `".UC_DBNAME."`.pre_forum_post SET pid='$pid', fid='$forumId', tid='$tid', author='admin', authorid='$uid', subject='$title', dateline='$time', message='$content'");
         // Part 6: pre_forum_forum updates section, related topics, number of posts
	$this->db->query("UPDATE `".UC_DBNAME."`.pre_forum_forum SET posts=posts+1,threads=threads+1 WHERE fid='$forumId'");
         Step 7: Update the user pre_common_member_count
	$this->db->query("UPDATE `".UC_DBNAME."`.pre_common_member_count SET posts=posts+1,threads=threads+1 WHERE uid='$uid'");
    
	return $tid;
 
	// --------------------- 
	 // author: blockchain attack City Lion 
	 // Source: CSDN
// Original: https://blog.csdn.net/weixin_427992222/article/details/908993699 
	 // Copyright Statement: This article is an original article by bloggers. Please attach a link to the blog post for reissue!
}

The database operation of the "Main Job" operation is the seven steps mentioned earlier. If you can't use it directly, you can refer to the link. If you have any questions or where you don't explain, you can comment on the post.

Can be paid for support:

Discuz Forum Server Construction

Other forum content makes data import to the Discuz forum

Discuz Plug -In Development


Go back
16-11-2022, 13:04