lizhen_gitee vor 2 Monaten
Ursprung
Commit
df52e452f9

+ 0 - 1
application/api/controller/Active.php

@@ -3,7 +3,6 @@
 namespace app\api\controller;
 
 use app\common\controller\Api;
-use app\common\library\Tenim;
 use think\Db;
 /**
  * 活动

+ 3 - 2
application/api/controller/Demo.php

@@ -16,7 +16,7 @@ class Demo extends Api
     //如果接口已经设置无需登录,那也就无需鉴权了
     //
     // 无需登录的接口,*表示全部
-    protected $noNeedLogin = ['test', 'test1'];
+    protected $noNeedLogin = ['*'];
     // 无需鉴权的接口,*表示全部
     protected $noNeedRight = ['test2'];
 
@@ -70,7 +70,8 @@ class Demo extends Api
      */
     public function test2()
     {
-        $this->success('返回成功', ['action' => 'test2']);
+        $tenim = new \app\api\controller\Tenim;
+        $tenim->sendMessageToUser(1, 11, '测试一下', 1);
     }
 
     /**

+ 14 - 11
application/api/controller/Tenim.php

@@ -5,8 +5,8 @@ namespace app\api\controller;
 use app\common\controller\Api;
 use app\utils\RedisUtil;
 use think\Request;
-use getusersig\Getusersig;
-use tencentim\Tencentim;
+use getusersig\getusersig;
+use tencentim\tencentim;
 use think\Db;
 
 /**
@@ -14,9 +14,12 @@ use think\Db;
  */
 class Tenim extends Api
 {
-    protected $noNeedLogin = ['trtc_callback','callback','test','createIMGroup','updateRoomInfo','setImManage','sendMessageToUser','outMemberFromRoom','selectstatus','loginoutim', 'tencentcall'];
+
+    protected $noNeedLogin = ['*'];
     protected $noNeedRight = ['*'];
 
+    protected $prefix = 'xl';
+
 
     public function test() {
         $groupinfo = $this->getGroupInfo("112");
@@ -954,8 +957,8 @@ exit;
      * type:0普通消息 1自定义消息
      */
     public function sendMessageToUser($from_user,$to_user,$message, $type = 0) {
-//        $from_user = 54;
-//        $to_user = 6;
+        $from_user = $this->prefix . (string)$from_user;
+        $to_user = $this->prefix . (string)$to_user;
 //        $message = "sdsd";
         $random = rand(10000000,99999999);
         $usersig = $this->usersig("administrator");
@@ -971,8 +974,8 @@ exit;
 
         $data = [];
         $data["SyncOtherMachine"] = 1;
-        $data["From_Account"] = (string)$from_user;
-        $data["To_Account"] = (string)$to_user;
+        $data["From_Account"] = $from_user;
+        $data["To_Account"] = $to_user;
         $data["MsgRandom"] = rand(1000000,9999999);
         $data["MsgTimeStamp"] = time();
 
@@ -1092,8 +1095,8 @@ exit;
 
     //拉黑
     public function black_one($from_user = '',$to_user = '') {
-        $from_user = (string)$from_user;
-        $to_user = (string)$to_user;
+        $from_user = $this->prefix . (string)$from_user;
+        $to_user = $this->prefix . (string)$to_user;
         $random = rand(10000000,99999999);
         $usersig = $this->usersig("administrator");
         // 获取配置信息
@@ -1116,8 +1119,8 @@ exit;
 
     //取消拉黑
     public function un_black_one($from_user = '',$to_user = '') {
-        $from_user = (string)$from_user;
-        $to_user = (string)$to_user;
+        $from_user = $this->prefix . (string)$from_user;
+        $to_user = $this->prefix . (string)$to_user;
         $random = rand(10000000,99999999);
         $usersig = $this->usersig("administrator");
         // 获取配置信息

+ 6 - 6
application/api/controller/Usercenter.php

@@ -593,10 +593,10 @@ $resArray['money'] = $money;  //返回给前端的计算结果
         Db::commit();
 
         //发送消息
-        /*if (isset($user_intimacy_rs) && $user_intimacy_rs['level_remark']) {
+        if (isset($user_intimacy_rs) && $user_intimacy_rs['level_remark']) {
             $tenim = new \app\api\controller\Tenim;
             $tenim->sendMessageToUser($this->auth->id, $to_user_id, $user_intimacy_rs['level_remark'], 1);
-        }*/
+        }
 
         $this->success('success',$resArray);
     }
@@ -745,10 +745,10 @@ $resArray['money'] = $money;  //返回给前端的计算结果
         }
 
         //发送消息
-        /*if (isset($user_intimacy_rs) && $user_intimacy_rs['level_remark']) {
+        if (isset($user_intimacy_rs) && $user_intimacy_rs['level_remark']) {
             $tenim = new \app\api\controller\Tenim;
             $tenim->sendMessageToUser($this->auth->id, $to_user_id, $user_intimacy_rs['level_remark'], 1);
-        }*/
+        }
 
         Db::commit();
 
@@ -922,10 +922,10 @@ $resArray['money'] = $money;  //返回给前端的计算结果
         Db::commit();
 
         //发送消息
-        /*if (isset($user_intimacy_rs) && $user_intimacy_rs['level_remark']) {
+        if (isset($user_intimacy_rs) && $user_intimacy_rs['level_remark']) {
             $tenim = new \app\api\controller\Tenim;
             $tenim->sendMessageToUser($this->auth->id, $to_user_id, $user_intimacy_rs['level_remark'], 1);
-        }*/
+        }
 
         $rs = [
             'money' => $data['money'],