


Tencent RTX API development, open a skylight for RTX, rtx_PHP tutorial
Tencent RTX’s API development opens a skylight for RTX, rtx
Many people may not have heard of the RTX software. Here I will briefly explain that this software is developed by Tencent. An internal chat software developed by an enterprise. The server is not hosted by Tencent. Instead, the enterprise needs to install it on its own internal server for internal employees to communicate and use. Its functions are similar to QQ, but a little weaker than QQ.
Strictly speaking, RTX actually provides an API interface, but it is not very good. Recently, the company has a need for this, so I rewrote this API. In addition, the main reason for rewriting is that RTX comes with it. The API will be garbled when encountered in Chinese, and there are many miscellaneous problems. An Internet search found that there are very few discussion topics about RTX API. It is probably because people don’t pay much attention to this software.
Just imagine, when interacting with the website, in addition to using the website to send emails or mobile phone text messages, we can also send instant messages to RTX, so that employees within the company can understand the needs of website visitors in a timely manner. In order to achieve this purpose, so I rewrote the RTX API within our company. The rewritten API can add RTX users, modify user information, delete users, obtain all user lists, obtain certain users based on status, and obtain internal information within the company. Organizational structure, send instant notifications to certain users, send instant messages to certain users, etc. I will directly enter the code below:
<?PHP require('_class.php'); //驗證使用這個API的用戶身份是否合法? $K='twboss_rtx'; //d6904e27b5c274b1d6acaadda88ec131 $key=Fun::toGet('key'); if($key!=md5($K)){ exit('Error:'.__LINE__.', 您無權使用該API!'); }unset($key,$K); $action=Fun::toGet('action'); switch(strtolower($action)){ case 'add': //新增RTX用戶 _Add(); break; case 'mdy': //修改某人的RTX登入密碼 _Mdy(); break; case 'del': //刪除某人 _Del(); break; case 'setdept': //修改用戶所屬部門 _Setdept(); break; case 'userlist': //獲取RTX用戶列表 _Userlist(); break; case 'deptlist': //獲取組織架構列表 _Deptlist(); break; case 'getstatus': //獲取用戶在線狀態 _Getstatus(); break; case 'getuserbystatus': //提取某種類型的用戶列表 _Getuserbystatus(); break; case 'sendtz': //發通知給某人或某幾個人 _Sendtz(); break; case 'sendim': //發送消息給某人 _Sendim(); break; default: break; } /** 交流: QQ群:223494678 參數: key:必填,API密鈅 action:必填,操作指令 user:必填,只能由英文和數字組成,長度不能小於3 pass:必填,只能由英文,數字和底線組成,長度不能小於3 title是用戶真實姓名,可以用中文 用法: $a=file_get_contents('http://10.20.30.40:8012/_api.php?key=d6904e27b5c274b1d6acaadda88ec131&action=add&user=7di&pass=123123&title='.iconv('UTF-8','big5','馮健')); echo '<pre class="brush:php;toolbar:false">',var_dump($a),''; /**/ function _Add(){ $user=Fun::toGet('user'); //登入名 $pass=Fun::toGet('pass'); //登入密碼 $title=Fun::toGet('title'); //真實姓名 if($user=='' or $pass==''){exit('Error:'.__LINE__.', 登入名或密碼不能為空!');} $title=($title=='') ? $user : $title; if(!Fun::Preg("^[a-zA-Z0-9]{3,16}$",'chk',$user)){exit('Error:'.__LINE__.', 登入名稱只能有英文和數字組成,並且長度範圍是3~16');} if(!Fun::Preg("^[a-zA-Z0-9._]{3,16}$",'chk',$pass)){exit('Error:'.__LINE__.', 登入密碼只能有英文,數字和底線組成,並且長度範圍是3~16');} try{ $RootObj= new COM('RTXSAPIRootObj.RTXSAPIRootObj'); $RootObj -> ServerIP= '127.0.0.1'; $RootObj -> ServerPort= '8006'; $UserManagerObj=$RootObj -> UserManager; if(($UserManagerObj -> IsUserExist($user))===FALSE){ $UserManagerObj -> AddUser($user,0); //添加用户 $UserManagerObj -> SetUserPwd($user,$pass); $UserManagerObj -> SetUserBasicInfo($user,$title,0,'','','',0); echo '200 ok'; }else{ exit('Error:'.__LINE__.',用戶已存在!'); } }catch(Exception $e){ echo '
',Var_Dump($e->getMessage()),''; } die(); } /** 交流: QQ群:223494678 參數: key:必填,API密鈅 action:必填,操作指令 user:必填,只能由英文和數字組成,長度不能小於3 pass:必填,只能由英文,數字和底線組成,長度不能小於3 title:選填,用戶真實姓名,可以用中文 用法: $a=file_get_contents('http://10.20.30.40:8012/_api.php?key=d6904e27b5c274b1d6acaadda88ec131&action=mdy&user=7di&pass=123123&title='.iconv('UTF-8','big5','馮健')); echo '
',var_dump($a),''; /**/ function _Mdy(){ $user=Fun::toGet('user'); //登入名 $pass=Fun::toGet('pass'); //登入密碼 $title=Fun::toGet('title'); //真實姓名 if($user=='' or $pass==''){exit('Error:'.__LINE__.', 登入名或密碼不能為空!');} $title=($title=='') ? $user : $title; if(!Fun::Preg("^[a-zA-Z0-9]{3,16}$",'chk',$user)){exit('Error:'.__LINE__.', 登入名稱只能有英文和數字組成,並且長度範圍是3~16');} if(!Fun::Preg("^[a-zA-Z0-9._]{3,16}$",'chk',$pass)){exit('Error:'.__LINE__.', 登入密碼只能有英文,數字和底線組成,並且長度範圍是3~16');} try{ $RootObj= new COM('RTXSAPIRootObj.RTXSAPIRootObj'); $RootObj -> ServerIP= '127.0.0.1'; $RootObj -> ServerPort= '8006'; $UserManagerObj= $RootObj -> UserManager; if(($UserManagerObj -> IsUserExist($user))===TRUE){ $UserManagerObj -> SetUserPwd($user,$pass); //设置用户密码 $UserManagerObj -> SetUserBasicInfo($user,$title,0,'','','',0); echo '200 ok'; }else{ exit('Error:'.__LINE__.',用戶不存在!'); } }catch(Exception $e){ echo '
',Var_Dump($e->getMessage()),''; Die(); } } /** 交流: QQ群:223494678 參數: key:必填,API密鈅 action:必填,操作指令 user:必填,只能由英文和數字組成,長度不能小於3 pass:必填,只能由英文,數字和底線組成,長度不能小於3 title:選填,用戶真實姓名,可以用中文 用法: $a=file_get_contents('http://10.20.30.40:8012/_api.php?key=d6904e27b5c274b1d6acaadda88ec131&action=del&user=xxx'); echo '
',var_dump($a),''; /**/ function _Del(){ $user=Fun::toGet('user'); //登入名 $pass=Fun::toGet('pass'); //登入密碼 $title=Fun::toGet('title'); //真實姓名 if($user=='' or $pass==''){exit('Error:'.__LINE__.', 登入名或密碼不能為空!');} $title=($title=='') ? $user : $title; if(!Fun::Preg("^[a-zA-Z0-9]{3,16}$",'chk',$user)){exit('Error:'.__LINE__.', 登入名稱只能有英文和數字組成,並且長度範圍是3~16');} if(!Fun::Preg("^[a-zA-Z0-9._]{3,16}$",'chk',$pass)){exit('Error:'.__LINE__.', 登入密碼只能有英文,數字和底線組成,並且長度範圍是3~16');} try{ $RootObj= new COM('RTXSAPIRootObj.RTXSAPIRootObj'); $RootObj -> ServerIP= '127.0.0.1'; $RootObj -> ServerPort= '8006'; $UserManagerObj= $RootObj -> UserManager; if(($UserManagerObj -> IsUserExist($user))===TRUE){ $UserManagerObj -> DeleteUser($user); echo '200 ok'; }else{ exit('Error:'.__LINE__.',用戶不存在!'); } }catch(Exception $e){ echo '
',Var_Dump($e->getMessage()),''; Die(); } } /** 交流: QQ群:223494678 參數: key:必填,API密鈅 action:必填,操作指令 uid:必填,RTX號碼,不可以是登入名 did:必填,所屬部門的id 用法: $a=file_get_contents('http://10.20.30.40:8012/_api.php?key=d6904e27b5c274b1d6acaadda88ec131&action=setdept&uid=9534&did=18'); echo '
',var_dump($a),''; /**/ function _Setdept(){ $uid=Fun::toGet('uid'); //RTX號碼 $did=Fun::toGet('did'); //所屬部門的id if(!is_numeric($uid) or $uidnum_rows("update RTX_DeptUser set DeptID = {$did} where UserID={$uid}"); echo '200 ok'; die(); } /** 交流: QQ群:223494678 參數: key:必填,API密鈅 action:必填,操作指令 用法: $a=file_get_contents('http://10.20.30.40:8012/_api.php?key=d6904e27b5c274b1d6acaadda88ec131&action=userlist'); echo '
',var_dump(json_decode($a,TRUE)),''; die(); /**/ function _Userlist(){ $ACC=new Access('../db/rtxdb.mdb','',''); $a=$ACC->getlist("SELECT a.ID,a.UserName,a.Name,a.Gender,a.Mobile,a.Email,a.Phone,a.UserVersion,b.DeptID FROM `SYS_User` AS a,RTX_DeptUser AS b WHERE (a.AccountState=0 OR a.AccountState IS NULL) AND b.UserId=a.ID ORDER BY a.ID DESC"); foreach($a as $k=>$v){ if(!isset($a[$k]['Name']) or $a[$k]['Name']==''){continue;} $a[$k]['Name']=iconv('big5','UTF-8',$a[$k]['Name']); }unset($k,$v); header('Content-type: application/json; charset=UTF-8'); echo json_encode($a); die(); } /** 交流: QQ群:223494678 參數: key:必填,API密鈅 action:必填,操作指令 用法: $a=file_get_contents('http://10.20.30.40:8012/_api.php?key=d6904e27b5c274b1d6acaadda88ec131&action=deptlist'); echo '
',var_dump(json_decode($a,TRUE)),''; die(); /**/ function _Deptlist(){ $ACC=new Access('../db/rtxdb.mdb','',''); $a=$ACC->getlist("SELECT DeptID,PDeptID,DeptName,SortID FROM `RTX_Dept` ORDER BY PDeptID ASC,SortID ASC"); foreach($a as $k=>$v){ if(!isset($a[$k]['DeptName']) or $a[$k]['DeptName']==''){continue;} $a[$k]['DeptName']=iconv('big5','UTF-8',$a[$k]['DeptName']); }unset($k,$v); header('Content-type: application/json; charset=UTF-8'); echo json_encode($a); die(); } /** 交流: QQ群:223494678 參數: key:必填,API密鈅 action:必填,操作指令 user:必填,某人的登入名 用法: $a=file_get_contents('http://10.20.30.40:8012/_api.php?key=d6904e27b5c274b1d6acaadda88ec131&action=getstatus&user=7di'); echo $a; die(); /**/ function _Getstatus(){ $user = Fun::toGet('user'); $ObjApi= new COM('Rtxserver.rtxobj'); $objProp= new COM('Rtxserver.collection'); $ObjApi->Name = 'SysTools'; $objProp->Add('Username',$user); $r = @$ObjApi->Call2(0x2001,$objProp); echo($r); unset($user,$r,$objProp,$ObjApi); die(); } /** 交流: QQ群:223494678 參數: key:必填,API密鈅 action:必填,操作指令 status:必填,狀態值['offline','online','away'] 用法: $a=file_get_contents('http://10.20.30.40:8012/_api.php?key=d6904e27b5c274b1d6acaadda88ec131&action=getuserbystatus&status=away'); echo $a; die(); /**/ function _Getuserbystatus(){ $status=Fun::toGet('status'); $status=($status=='') ? 'online' : strtolower(trim($status)); if(!in_array($status,array('offline','online','away'))){ exit('Error:'.__LINE__.', status is not in offline online away!'); } $RootObj= new COM("RTXSAPIRootObj.RTXSAPIRootObj"); $RootObj -> ServerIP= '127.0.0.1'; $RootObj -> ServerPort= '8006'; $r = $RootObj->QueryUsersByState($status); echo ($r); unset($status,$r,$RootObj); die(); } /** 交流: QQ群:223494678 參數: key:必填,API密鈅 action:必填,操作指令 to:必填,誰要接收(多個人名之間要用分號分隔) tit:必填,通知的標題 msg:必填,通知的正文 tim:必填,通知顯示多久 用法: $msg=(iconv('UTF-8','big5','這是測息,正文!')); $tit=iconv('UTF-8','big5','這是標題!'); $a=file_get_contents('http://10.20.30.40:8012/_api.php?key=d6904e27b5c274b1d6acaadda88ec131&action=sendtz&tit='.$tit.'&msg='.$msg.'&to=7di;benhuang'); echo $a; die(); /**/ function _Sendtz(){ $to=Fun::toGet('to'); //誰要接收 $tit=Fun::toGet('tit'); //通知的標題 $msg=Fun::toGet('msg'); //通知的正文 $tim=Fun::toGet('tim'); //通知顯示多久 $tim = (strlen($tim) == 0 or !is_numeric($tim)) ? 100000 : $tim; if($to=='' or $msg=='' or $tit==''){ exit('Error:'.__LINE__.', 通知標題,正文,接收者均不可為空!'); } $RootObj= new COM("RTXSAPIRootObj.RTXSAPIRootObj"); $RootObj -> ServerIP= '127.0.0.1'; $RootObj -> ServerPort= '8006'; $RootObj->SendNotify($to,$tit,$tim,$msg); //txtReceivers.Text, txtTitle.Text, CInt(txtTime.Text), txtContent.Text unset($RootObj,$to,$tit,$msg,$tim); echo '200 ok'; die(); } /** 交流: QQ群:223494678 參數: key:必填,API密鈅 action:必填,操作指令 user:必填,發送者登入名 pass:必填,發送者登入密碼 to:必填,誰要接收(多個人名之間要用分號分隔) msg:必填,通知的正文 用法: $msg=(iconv('UTF-8','big5','這是測息,正文!')); $a=file_get_contents('http://10.20.30.40:8012/_api.php?key=d6904e27b5c274b1d6acaadda88ec131&action=sendim&user=admin&pass=bossadm.com.tw&to=7di;benhuang&msg='.$msg); echo $a; die(); /**/ function _Sendim(){ $user=Fun::toGet('user'); $pass=Fun::toGet('pass'); $to=Fun::toGet('to'); $msg=Fun::toGet('msg'); if($to=='' or $msg=='' or $user=='' or $pass==''){ exit('Error:'.__LINE__.', 每個參數均不可為空!'); } if(!Fun::Preg("^[a-zA-Z0-9]{3,16}$",'chk',$user)){exit('Error:'.__LINE__.', 登入名稱只能有英文和數字組成,並且長度範圍是3~16');} if(!Fun::Preg("^[a-zA-Z0-9._]{3,16}$",'chk',$pass)){exit('Error:'.__LINE__.', 登入密碼只能有英文,數字和底線組成,並且長度範圍是3~16');} $RootObj= new COM('RTXSAPIRootObj.RTXSAPIRootObj'); $RootObj -> ServerIP= '127.0.0.1'; $RootObj -> ServerPort= '8006'; $sid=Fun::guid(); $RootObj->SendIM($user,$pass,$to,$msg,$sid); echo '200 ok'; unset($user,$pass,$to,$msg,$sid,$RootObj); die(); }
Friends who are interested in RTX can join my QQ group to discuss together. The QQ group number is 223494678
The RTX API interface is suitable for any development language and platform that supports COM standards on the Windows platform (VB, VC++, ASP, JAVA, C#, PB, Delphi, LotusScript, etc.).
Reference: rtx.qq.com/...ok.CHM
Does the rtx client receive it?

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download
The most popular open source editor