http://bbs.51aspx.com/showtopic-30029.html#230540
A moment ago want to do a buy navigation site, see some buy navigation station has a forum, oneself also want to add one, studied the next discuz! NT, found API interface, suddenly thought of using discuz! NT to integrate the site, it is not very convenient, members that part of the need to develop their own.
Just do it, come down. API Examples and development package study a bit, looked again is still confused, do not know whether oneself is too stupid. And found that the API has errors, to the official forum for help seems to have not been answered, it seems to be only on their own AH. Read N times finally understand that the whole API is familiar with the use of the method, found that the API is convenient but a lot of problems, where the user login after jump behavior (stop jumping to jump, efficiency is too low, the impact of search engine included) there is "code:103, Message: The current session submitted by the CALL_ID is not greater than the previous call_id "error, but let me thoroughly to the API without words depressed, finally had to use the second set of methods to download the source of their own integration +discuz! NT API.
Okay, discuz!. NT is open source program, otherwise I really give up using, say My site Xuzhou 86516 buy navigation http:/www.86516tuan.com, you can see I mainly integrate the user's login status and access to login information (login and registration are completed in the forum), login and exit, the user's comments, Automatic post and system backstage planning tasks, and so on, the following describes in the integration method, need discuz! NT DLL, I am putting all the DLLs into the bin directory of my website, with the code attached.
1, the user's login status and access to login information
- Using Discuz.forum;
- Using Discuz.entity;
- String discuzname = String. Empty;
- if (request.cookies["dnt"]! = NULL)
- {
- Already logged in
- int uid = Convert.ToInt32 (request.cookies["dnt" ["userid"]);
- Get Login User Information
- UserInfo info = users.getuserinfo (UID);
- if (info! = null)
- {
- Discuzname = info. Username;
- }
- Else
- {
- Discuzsession ds = Discuzsessionhelper.getsession ();
- Ds. Logout (String. Empty);
- }
- }
- Else
- {
- Not logged in
- }
Copy Code
2, login and exit, need API Discuztoolkit development Package DLL, is: http://nt.discuz.net/showtopic-81187.html
- Using Discuz.toolkit;
- Discuzsession ds = Discuzsessionhelper.getsession ();
- Ds. Logout (String. Empty);
Copy Code
3, automatic posting, I collect a purchase data will give discuz! NT Forum sends a post, and both sides use the ID corresponding to the
For example: Http://www.86516tuan.com/goods/787.html and Http://www.86516tuan.com/bbs/showtopic-817.aspx
Automatically create the theme is also the API, the method is as follows, the specific parameters please refer to the Official API development Guide
- Discuzsession ds = Discuzsessionhelper.getsession ();
- Topiccreateresponse TCR = ds. Createtopic (UID, title, FID, message,tags,type_id);
Copy Code
4. Get user comments and use the official API
- Discuzsession ds = Discuzsessionhelper.getsession ();
- Topicgetrencentrepliesresponse TRR = ds. Getrecentreplies (FID, Tid, page_size, Page_index);
Copy Code
5, published a new comment, here is not the main reason for the initial adoption of the API, the API needs to jump to verify the user. After studying the source code, write their own comment function, the main call the official stored procedure "Dnt_createpost1", because of too many parameters, here do not write code, the main parameter assignment, user data can be based on the method to obtain user information to obtain, in addition to the official download data dictionary, To determine the parameter function.
Asp. NET Integration discuz! NT3.5 instance description (including user login, comments, etc.)