瀏覽代碼

Merge branch 'master' of http://git.huxiukeji.com/zhangxiaobin/ggyuyin

lizhen_gitee 1 年之前
父節點
當前提交
8ff70e1e30

+ 32 - 5
application/api/controller/Money.php

@@ -24,7 +24,7 @@ use app\common\library\Sms as Smslib;
  */
 class Money extends Common
 {
-    protected $noNeedLogin = ['getRecharConfig', 'getRateMoney', 'getExchangeConfig', 'getExchsoundConfig', 'rebateDuty', 'kjRecharge', 'changeWithDrawStatus'];
+    protected $noNeedLogin = ['getRecharConfig', 'getRateMoney', 'getExchangeConfig', 'getExchsoundConfig', 'rebateDuty', 'kjRecharge', 'changeWithDrawStatus','moneyConfig'];
     protected $noNeedRight = '*';
 
     public function _initialize()
@@ -49,7 +49,7 @@ class Money extends Common
         $type = $this->request->request("type", "wechat");// 充值类型:wechat:微信支付,alipay:支付宝支付
         $method = $this->request->request("method", "miniapp");// 支付方式:app:app支付,miniapp:小程序支付
         $openid = $this->request->request("openid", "");// 非小程序支付无需传值
-        $params_from = $this->request->request("params_from");// 平台参数
+        $params_from = $this->request->request("params_from",1);// 平台参数充值平台:1=安卓,2=ios
         $amounts = $this->request->request("amounts",0);// 自定义金额
         if (!$rechar_id && empty($amounts)) {
             $this->error(__('Invalid parameters'));
@@ -1813,7 +1813,8 @@ class Money extends Common
     public function withdrawTransfer() {
         $info = [
             'money' => 0.10,
-            'alipay_account' => '13651955934'
+            'alipay_account' => '13651955934',
+            'name' => '张效彬',
         ];
         $data['out_biz_no'] = getMillisecond() . mt_rand(1, 1000); //商户订单号
         $data['trans_amount'] = $info['money']; //订单总金额,单位为元,精确到小数点后两位
@@ -1832,8 +1833,8 @@ class Money extends Common
             $data['payee_info']['name'] = '';
         }*/
         //支付宝id
-        $data['payee_info']['identity_type'] = 'ALIPAY_USER_ID';
-        $data['payee_info']['name'] = '';
+        $data['payee_info']['identity_type'] = 'ALIPAY_LOGON_ID';
+        $data['payee_info']['name'] = $info['name'];
 
         //转账备注(支持200个英文/100个汉字)。当付款方为企业账户,且转账金额达到(大于等于)50000元,remark不能为空。收款方可见,会展示在收款用户的收支详情中。
         $data['remark'] = 'GG语音提现';
@@ -1842,4 +1843,30 @@ class Money extends Common
         $result =$alipay->AliPayWithdraw($data);
         return $result;
     }
+
+    /**
+     * 获取余额相关比例
+     * @return void
+     */
+    public function moneyConfig()
+    {
+        try {
+            $field = 'name,title,value';
+            $where['name'] = ['in', ['money_to_jewel','withdrawRate']];
+            $intField = ['money_to_jewel','withdrawRate'];
+            $config = Db::name('config')->field($field)->where($where)->select();
+            $result = [];
+            if (!empty($config)) {
+                foreach ($config as $key => $value) {
+                    if (in_array($value['name'],$intField)) {
+                        $value['value'] = (int)$value['value'];
+                    }
+                    $result[$value['name']] = $value;
+                }
+            }
+            $this->success('获取成功',$result);
+        } catch (Exception $e) {
+            $this->error($e->getMessage());
+        }
+    }
 }

+ 55 - 5
application/api/controller/Notify.php

@@ -32,6 +32,7 @@ class Notify extends Api
         try {
             $payamount = $data['total_fee'] / 100;
             $out_trade_no = $data['out_trade_no'];
+            $transaction_id = $data['transaction_id'];
             Db::startTrans();
             try {
                 $orderModel = new \app\common\model\RecharOrder();
@@ -41,14 +42,23 @@ class Notify extends Api
                 $orderInfo = $orderModel->where(["order_no" => $out_trade_no])->find();
                 $userInfo = $userModel->where(["id" => $orderInfo["user_id"]])->find();
                 // 修改订单状态
-                $res1 = $orderModel->update(["status" => 1], ["order_no" => $out_trade_no]);
+                $res1 = $orderModel->update(["status" => 1,'transaction_id'=>$transaction_id], ["order_no" => $out_trade_no]);
                 // 修改用户钻石余额
                 $res2 = $userModel->where(["id" => $orderInfo["user_id"]])->setInc("jewel", $orderInfo["jewel"]);
+                //判断是否首充
+                $jewellogWhere['user_id'] = $orderInfo["user_id"];
+                $jewellogWhere['type'] = 1;
+                $userJewelLog = $jewellogModel->where($jewellogWhere)->find();
+                $isFirst = 1;
+                if (!empty($userJewelLog)) {
+                    $isFirst = 0;
+                }
+                $preUserId = $userInfo['pre_userid'];
                 // 添加钻石流水记录
                 $detail = "钻石充值";
                 $res3 = $jewellogModel->addUserJewelLog($userInfo["id"], $orderInfo["jewel"], "+", $userInfo["jewel"], $detail, 1);
                 // 添加充值记录
-                $res4 = $rechargelogModel->addRecord($userInfo["id"], $orderInfo["jewel"], $payamount, bcadd($userInfo["jewel"], $orderInfo["jewel"], 2), $userInfo["money"], $orderInfo["platform"], 1);
+                $res4 = $rechargelogModel->addRecord($userInfo["id"], $orderInfo["jewel"], $payamount, bcadd($userInfo["jewel"], $orderInfo["jewel"], 2), $userInfo["money"], $orderInfo["platform"], 1,$isFirst,$preUserId);
                 if ($res1 && $res2 && $res3 && $res4) {
                     // 添加统计
                     $userInfo->chargecount = $userInfo->chargecount + $payamount;
@@ -87,9 +97,40 @@ class Notify extends Api
             return;
         }
         $data = $pay->verify();
+        /*$dataStr = '{
+            "s": "\/api\/notify\/alipaynotify",
+            "gmt_create": "2023-07-12 09:37:14",
+            "charset": "utf-8",
+            "seller_email": "ixiaoqiuqiu@qq.com",
+            "subject": "充值钻石",
+            "sign": "SzP5OgA9Z+qD8mSzMbAbKFsYOyB6fiH\/8itILn6YqX0Aloa5FnOxUHXEKCFlv5k3ya+OORjZPDq5mt7eZ3FvwJUasSWnMgDlSa6zWLGhlkKE3HXVAe777tkM5UgnVw53uJEr\/Ur2UsLpI+qEcrZAXhNAhA2nNNWhwkvrA1Fyc3iZERnbtJ3XNT\/8nnxGMBjhS3TWlr3VDZ\/bb26fvC1qHQ9Y6GGz8gvj3z30Fo7\/DlLFvH2HFSi6wky+33vWEtgug+klsqh6ziOWaVJhJKvnt2H+ltINiKLCshYVhu8ZBc856sV8noEwMmxPoFTW4CoG7ut\/3PKLjglygSOZblyf4Q==",
+            "buyer_id": "2088702050034935",
+            "invoice_amount": "0.01",
+            "notify_id": "2023071201222093714034931493558779",
+            "fund_bill_list": "[{"amount":"0.01","fundChannel":"ALIPAYACCOUNT"}]",
+            "notify_type": "trade_status_sync",
+            "trade_status": "TRADE_SUCCESS",
+            "receipt_amount": "0.01",
+            "app_id": "2021004103620776",
+            "buyer_pay_amount": "0.01",
+            "sign_type": "RSA2",
+            "seller_id": "2088641467220712",
+            "gmt_payment": "2023-07-12 09:37:14",
+            "notify_time": "2023-07-12 09:37:14",
+            "version": "1.0",
+            "out_trade_no": "20230712093707239053",
+            "total_amount": "0.01",
+            "trade_no": "2023071222001434931415906799",
+            "auth_app_id": "2021004103620776",
+            "buyer_logon_id": "136****5934",
+            "point_amount": "0.00"
+        }';
+        $data = json_decode($dataStr,true);*/
+
         try {
-            $payamount = $data['total_fee'] / 100;
+            $payamount = $data['total_amount'];
             $out_trade_no = $data['out_trade_no'];
+            $trade_no = $data['trade_no'];
             Db::startTrans();
             try {
                 $orderModel = new \app\common\model\RecharOrder();
@@ -99,14 +140,23 @@ class Notify extends Api
                 $orderInfo = $orderModel->where(["order_no" => $out_trade_no])->find();
                 $userInfo = $userModel->where(["id" => $orderInfo["user_id"]])->find();
                 // 修改订单状态
-                $res1 = $orderModel->update(["status" => 1], ["order_no" => $out_trade_no]);
+                $res1 = $orderModel->update(["status" => 1,'transaction_id' => $trade_no], ["order_no" => $out_trade_no]);
                 // 修改用户钻石余额
                 $res2 = $userModel->where(["id" => $orderInfo["user_id"]])->setInc("jewel", $orderInfo["jewel"]);
+                //判断是否首充
+                $jewellogWhere['user_id'] = $orderInfo["user_id"];
+                $jewellogWhere['type'] = 1;
+                $userJewelLog = $jewellogModel->where($jewellogWhere)->find();
+                $isFirst = 1;
+                if (!empty($userJewelLog)) {
+                    $isFirst = 0;
+                }
+                $preUserId = $userInfo['pre_userid'];
                 // 添加钻石流水记录
                 $detail = "钻石充值";
                 $res3 = $jewellogModel->addUserJewelLog($userInfo["id"], $orderInfo["jewel"], "+", $userInfo["jewel"], $detail, 1);
                 // 添加充值记录
-                $res4 = $rechargelogModel->addRecord($userInfo["id"], $orderInfo["jewel"], $payamount, bcadd($userInfo["jewel"], $orderInfo["jewel"], 2), $userInfo["money"], $orderInfo["platform"], 1);
+                $res4 = $rechargelogModel->addRecord($userInfo["id"], $orderInfo["jewel"], $payamount, bcadd($userInfo["jewel"], $orderInfo["jewel"], 2), $userInfo["money"], $orderInfo["platform"], 1,$isFirst,$preUserId);
                 if ($res1 && $res2 && $res3 && $res4) {
                     // 添加统计
                     $userInfo->chargecount = $userInfo->chargecount + $payamount;

+ 2 - 2
application/api/controller/Party.php

@@ -1599,6 +1599,8 @@ class Party extends Common
 
         $backGiftId = 0;
         $boxgiftInfo = [];
+        // 不可以赠送给自己
+        if(in_array($userauthid,$user_id_arr)) $this->error("不可以赠送给自己!");
         if($is_back == 1) {
             // 获取背包礼物信息
             $giftInfo = \app\common\model\GiftBack::get($gift_id);
@@ -1622,8 +1624,6 @@ class Party extends Common
             $giftValue = $giftInfo["value"] * $number;
             $getValue  = $giftInfo["value"] * $number;
         } else {
-//        // 不可以赠送给自己
-//        if(in_array($userauthid,$user_id_arr)) $this->error("不可以赠送给自己!");
 
             // 获取礼物信息
             $giftModel = new \app\common\model\Gift();

+ 176 - 2
application/api/controller/Tenim.php

@@ -3,6 +3,7 @@
 namespace app\api\controller;
 
 use app\common\controller\Api;
+use app\common\service\TenimService;
 use think\Request;
 use getusersig\getusersig;
 use tencentim\tencentim;
@@ -14,7 +15,7 @@ use think\Db;
  */
 class Tenim extends Api
 {
-    protected $noNeedLogin = ["callback",'test','createIMGroup','updateRoomInfo','setImManage','sendMessageToUser','outMemberFromRoom',
+    protected $noNeedLogin = ['trtc_callback',"callback",'test','createIMGroup','updateRoomInfo','setImManage','sendMessageToUser','outMemberFromRoom',
         'autoUserLine','getRoomUser','getGroupList','getGroupInfo'];
     protected $noNeedRight = ['*'];
 
@@ -199,7 +200,7 @@ exit;
         $url .= "&contenttype=json";
         $tencentObj = new tencentim($url);
         $data = [];
-        $data["GroupIdList"] = [$party_id];
+        $data["GroupIdList"] = [(string)$party_id];
         $data["ResponseFilter"] = [
             "GroupBaseInfoFilter" => ["GroupId","Type","Name","FaceUrl","Owner_Account","MemberNum"],
             "MemberInfoFilter" => ["Account","Role"],
@@ -584,6 +585,151 @@ exit;
 
     }
 
+    public function trtc_callback(){
+
+        $input = file_get_contents("php://input");
+        //filePut('start:'.$input,'callback.txt');
+
+        /*$input = '{
+            "EventGroupId":	1,
+            "EventType":	104,
+            "CallbackTs":	1640331295244,
+            "EventInfo":	{
+                "RoomId":	140,
+                "EventTs":	1640331295,
+                "EventMsTs": 1640331295239,
+                "UserId":	"179",
+                "Role":	21,
+                "Reason":	5
+            }
+        }';*/
+        $input = json_decode($input,true);
+        $roomId = $input['EventInfo']['RoomId'];
+        //房间事件组
+        if($input['EventGroupId'] == 1){
+            if($input['EventType'] == 101){
+                //创建房间,第一个进来的
+            }elseif($input['EventType'] == 102){
+                //解散房间,最后一个走的
+                //没有UserId
+            }elseif($input['EventType'] == 103){
+                //进入房间,主播role=20 观众role=21
+                $redis = new Redis();
+                $redisconfig = config("redis");
+                $redis->connect($redisconfig["host"], $redisconfig["port"]);
+                if ($redisconfig['redis_pwd']) {
+                    $redis->auth($redisconfig['redis_pwd']);
+                }
+                if($redisconfig['redis_selectdb'] > 0){
+                    $redis->select($redisconfig['redis_selectdb']);
+                }
+                $userId = $input['EventInfo']['UserId'];
+                $redis->hSet("online_" . $roomId, $userId, $userId);
+                $redis->zAdd("party_user_".$roomId,$userId,0); //新加的
+                // 记录在线用户在房间情况
+                $redis->hSet("livingUser",$userId,$roomId);
+
+                // 更新房间在线状态
+                $partyInfo = $redis->get("party_" . $roomId);
+                if ($partyInfo) {
+                    $partyInfo = json_decode($partyInfo, true);
+                    if ($partyInfo["is_online"] != 1) {
+                        $partyInfo["is_online"] = 1;
+                        $redis->set("party_" . $roomId, json_encode($partyInfo));
+                        \app\common\model\Party::update(["is_online" => 1], ["id" => $roomId]);
+                    }
+                }
+
+                // 更新房间在线状态
+                $liveInfo = $redis->get("live_" . $roomId);
+                if ($liveInfo) {
+                    $liveInfo = json_decode($liveInfo, true);
+                    if ($input['EventInfo']['Role'] == 20) {
+                        $liveInfo["is_online"] = 1;
+                        $redis->set("live_" . $roomId, json_encode($liveInfo));
+                        \app\common\model\Party::update(["is_online" => 1], ["id" => $roomId]);
+                        $rs_user = Db::name('user')->where('id',$userId)->update(['is_live'=>1]);
+                    }
+                }
+
+            }elseif($input['EventType'] == 104){
+                //退出房间,主播role=20 观众role=21
+                $redis = new Redis();
+                $redisconfig = config("redis");
+                $redis->connect($redisconfig["host"], $redisconfig["port"]);
+                if ($redisconfig['redis_pwd']) {
+                    $redis->auth($redisconfig['redis_pwd']);
+                }
+                if($redisconfig['redis_selectdb'] > 0){
+                    $redis->select($redisconfig['redis_selectdb']);
+                }
+                $userId = $input['EventInfo']['UserId'];
+                $redis->HDel("online_" . $roomId, $userId);
+                $redis->zRem("party_user_".$roomId,$userId); //新加的
+                // 扣除在线用户在房间情况
+                $redis->hDel("livingUser",$userId);
+
+                // 更新房间在线状态
+                $partyInfo = $redis->get("party_" . $roomId);
+                if ($partyInfo) {
+                    $partyInfo = json_decode($partyInfo, true);
+                    $memCount = count($redis->hGetAll("online_" . $roomId));
+                    if ($memCount <= 0) {
+                        $partyInfo["is_online"] = 0;
+                        $redis->set("party_" . $roomId, json_encode($partyInfo));
+                        \app\common\model\Party::update(["is_online" => 0], ["id" => $roomId]);
+                    }
+                }
+                //
+                $liveInfo = $redis->get("live_" . $roomId);
+                if ($liveInfo) {
+                    $liveInfo = json_decode($liveInfo, true);
+                    if($input['EventInfo']['Role'] == 20){
+                        $liveInfo["is_online"] = 0;
+                        $redis->set("live_" . $roomId, json_encode($liveInfo));
+                        \app\common\model\Party::update(["is_online" => 0], ["id" => $roomId]);
+                        $rs_user = Db::name('user')->where('id',$userId)->update(['is_live'=>0]);
+                    }
+                }
+                //退出房间获取房间自定义属性
+                $tenimService = new TenimService();
+                $imParams = ['party_id' => (string)$roomId];
+                $imRes = $tenimService->getGroupAttr($imParams);
+                if ($imRes['status'] == 1) {
+                    if (isset($imRes['data']) && !empty($imRes['data'])) {
+                        $imFieldArr = ['seat0','seat1','seat2','seat3','seat4','seat5','seat6','seat7','seat8','seat9'];
+                        foreach ($imRes['data'] as $imKey => &$imVal) {
+                            if (in_array($imVal['key'],$imFieldArr)) {
+                                $tempData = json_decode($imVal['value'],true);
+                                if (isset($tempData['user'])) {
+                                    if ($tempData['user'] == $userId) {//找到用户清理麦序
+                                        $tempData['status'] = 0;
+                                        $tempData['user'] = "";
+                                    } else {
+                                        if (empty($tempData['user']) && $tempData['status'] == 1) {
+                                            $tempData['status'] = 0;
+                                        }
+                                    }
+                                }
+                                $imVal['value'] = json_encode($tempData);
+                            }
+                        }
+                        $imAttrParams = [
+                            'party_id' => $roomId,
+                            'party_attr' => $imRes['data'],
+                        ];
+                        $tenimService->getGroupAttrEdit($imAttrParams);
+                    }
+                }
+            }
+        }elseif($input['EventGroupId'] == 2){
+
+        }
+
+        //结束
+        echo json_encode(['code' => 0]);exit;
+    }
+
     /**
      * 回调
      */
@@ -1062,4 +1208,32 @@ exit;
         $result = $memberList;
         $this->success('操作成功',$result);
     }
+
+    /**
+     * 获取房间用户
+     */
+    public function getGroupAttr() {
+        $partyId = $this->request->param('party_id','');
+        if (!empty($partyIds)) {
+            $this->error('参数错误');
+        }
+        $random = rand(10000000,99999999);
+        $usersig = $this->usersig("administrator");
+        // 获取配置信息
+        $config = config("tencent_im");
+        $url = "https://console.tim.qq.com/v4/group_open_attr_http_svc/get_group_attr";
+        $url .= "?sdkappid=".$config["sdkappid"];
+        $url .= "&identifier=administrator";
+        $url .= "&usersig=".$usersig;
+        $url .= "&random=".$random;
+        $url .= "&contenttype=json";
+        $tencentObj = new tencentim($url);
+
+        $result = [];
+        if(!empty($partyId)) {
+            $data["GroupId"] = $partyId;
+            $result = $tencentObj->toSend($data);
+        }
+        $this->success('操作成功',$result);
+    }
 }

+ 3 - 0
application/api/controller/Topicdongtai.php

@@ -51,6 +51,9 @@ class Topicdongtai extends Api
     public function my_lists(){
 
         $uid = input('uid',$this->auth->id);
+        if (empty($uid)) {
+            $uid = $this->auth->id;
+        }
         $list = Db::name('topic_dongtai')->alias('dt')
             ->join('user','dt.user_id = user.id','LEFT')
             ->join('topic_hub topic','dt.topic_id = topic.id','LEFT')

+ 31 - 0
application/common.php

@@ -773,4 +773,35 @@ function ip_to_address(){
         }
     }
     return $ipaddress;
+}
+if(!function_exists('filePut')) {
+    /**
+     * 在线支付日志
+     */
+    function filePut($info, $text = 'notify.txt')
+    {
+        if (is_array($info)) {
+            $info = json_encode($info, JSON_UNESCAPED_UNICODE);
+        }
+        if (!file_exist(RUNTIME_PATH . 'paylog/')) {
+            mk_dir(RUNTIME_PATH . 'paylog/');
+        }
+        $file = RUNTIME_PATH . 'paylog/' . $text;
+        touch_file($file);
+        file_put_contents($file, "\r\n" . date('Y-m-d H:i:s') . ' ' . $info, FILE_APPEND);
+    }
+}
+if(!function_exists('touch_file')) {
+    /**
+     * 新建文件
+     */
+    function touch_file($file = '')
+    {
+        if($file) {
+            if(!file_exists($file)) {
+                @touch($file);
+                @chmod($file, 0770);
+            }
+        }
+    }
 }

+ 42 - 0
application/common/service/MoneyService.php

@@ -0,0 +1,42 @@
+<?php
+
+namespace app\common\service;
+
+class MoneyService
+{
+    private $model =  '';
+
+    /**
+     * 初始化方法
+     */
+    public function __construct()
+    {
+        $this->model = new \app\common\model\User();
+    }
+
+    //提现转账(新版2020-01-01)
+    public function withdrawTransfer() {
+        $info = [
+            'money' => 0.10,
+            'alipay_account' => '13651955934',
+            'name' => '张效彬',
+        ];
+        $data['out_biz_no'] = getMillisecond() . mt_rand(1, 1000); //商户订单号
+        $data['trans_amount'] = $info['money']; //订单总金额,单位为元,精确到小数点后两位
+        $data['product_code'] = 'TRANS_ACCOUNT_NO_PWD';//业务产品码,收发现金红包固定为:STD_RED_PACKET;单笔无密转账到支付宝账户固定为:TRANS_ACCOUNT_NO_PWD;单笔无密转账到银行卡固定为:TRANS_BANKCARD_NO_PWD
+        $data['biz_scene'] = 'DIRECT_TRANSFER'; //描述特定的业务场景,可传的参数如下:PERSONAL_COLLECTION:C2C现金红包-领红包;DIRECT_TRANSFER:B2C现金红包、单笔无密转账到支付宝/银行卡
+        $data['order_title'] = 'GG语音提现'; //转账业务的标题,用于在支付宝用户的账单里显示
+
+        $data['payee_info'] = [
+            'identity' => $info['alipay_account'],//收款方支付宝id或支付宝账户
+            'identity_type' => 'ALIPAY_LOGON_ID',//ALIPAY_USER_ID:支付宝会员的用户 ID,可通过 获取会员信息 能力获取。ALIPAY_LOGON_ID:支付宝登录号,支持邮箱和手机号格式。
+            'name' => $info['name'],//当 identity_type=ALIPAY_LOGON_ID 时,本字段必填。若传入该属性,则在支付宝回单中将会显示这个属性。
+        ];
+        //转账备注(支持200个英文/100个汉字)。当付款方为企业账户,且转账金额达到(大于等于)50000元,remark不能为空。收款方可见,会展示在收款用户的收支详情中。
+        $data['remark'] = 'GG语音提现';
+        require_once("../extend/AliPay/AliPay.php");
+        $alipay =new \AliPay();
+        $result =$alipay->AliPayWithdraw($data);
+        return $result;
+    }
+}

+ 63 - 0
application/common/service/TenimService.php

@@ -78,4 +78,67 @@ class TenimService
         }
         return $result;
     }
+
+    /**
+     * 获取房间自定义属性
+     */
+    public function getGroupAttr($params=[])
+    {
+        $result = [
+            'status' => 1,
+            'msg' => '获取成功',
+            'data' => [],
+        ];
+        try {
+            $partyId = isset($params['party_id']) ? $params['party_id'] : [];
+            $url = "https://console.tim.qq.com/v4/group_open_attr_http_svc/get_group_attr".$this->url;
+            $tencentObj = new tencentim($url);
+            $imResult = [];
+            if(!empty($partyId)) {
+                $data["GroupId"] = $partyId;
+                $imRes = $tencentObj->toSend($data);
+                if (isset($imRes['ActionStatus']) && $imRes['ActionStatus'] != 'OK') {
+                    $errorInfo = isset($imRes['ErrorInfo']) ? $imRes['ErrorInfo'] : [];
+                    throw new Exception(json_encode($errorInfo));
+                }
+                $imResult = isset($imRes['GroupAttrAry']) ? $imRes['GroupAttrAry'] : [];
+            }
+            $result['data'] = $imResult;
+        } catch (\Exception $e) {
+            $result['status'] = 0;
+            $result['msg'] = $e->getMessage();
+        }
+        return $result;
+    }
+
+    /**
+     * 更新房间属性
+     */
+    public function getGroupAttrEdit($params=[])
+    {
+        $result = [
+            'status' => 1,
+            'msg' => '获取成功',
+            'data' => [],
+        ];
+        try {
+            $partyId = isset($params['party_id']) ? $params['party_id'] : [];
+            $partyAttr = isset($params['party_attr']) ? $params['party_attr'] : [];
+            $url = "https://console.tim.qq.com/v4/group_open_http_svc/modify_group_attr".$this->url;
+            $tencentObj = new tencentim($url);
+            if(!empty($partyId)) {
+                $data["GroupId"] = (string)$partyId;
+                $data["GroupAttr"] = $partyAttr;
+                $imRes = $tencentObj->toSend($data);
+                if (isset($imRes['ActionStatus']) && $imRes['ActionStatus'] != 'OK') {
+                    $errorInfo = isset($imRes['ErrorInfo']) ? $imRes['ErrorInfo'] : [];
+                    throw new Exception(json_encode($errorInfo));
+                }
+            }
+        } catch (\Exception $e) {
+            $result['status'] = 0;
+            $result['msg'] = $e->getMessage();
+        }
+        return $result;
+    }
 }

+ 1 - 1
extend/AliPay/AliPay.php

@@ -263,7 +263,7 @@ class AliPay {
         $request->setBizContent($data);
         $responseResult = $alipayClient->execute($request);
         $responseApiName = str_replace(".","_",$request->getApiMethodName())."_response";
-        $responsecode = $responseResult->$responseApiName->code;echo '<pre>';var_dump($responseResult);exit;
+        $responsecode = $responseResult->$responseApiName->code;
         if(!empty($responsecode)&&$responsecode==10000){
 //            echo("调用成功");
             return true;