huangdong 6 years ago
parent
commit
f1ffdbcb00
2 changed files with 16 additions and 7 deletions
  1. 10 3
      helper/room/base_room.php
  2. 6 4
      mobile/control/member_talk.php

+ 10 - 3
helper/room/base_room.php

@@ -60,9 +60,12 @@ abstract class base_room
                 $ret = ['room' => $this->mRoomid,'invitees' => $users,'newusers' => $newusers];
                 if(!empty($newusers)) {
                     $content = $this->format_invite($inviter,$newusers);
-                    $type = proto_type::to_msgtype(proto_type::msg_stype_plain);
-                    $msgid = $this->record_message(0,$type,$content);
-                    $this->relay_broadcast('message',['msgid' => $msgid,'type' => proto_type::msg_stype_plain,'content' => $content,'send_time' => time()]);
+                    if($content !== false)
+                    {
+                        $type = proto_type::to_msgtype(proto_type::msg_stype_plain);
+                        $msgid = $this->record_message(0,$type,$content);
+                        $this->relay_broadcast('message',['msgid' => $msgid,'type' => proto_type::msg_stype_plain,'content' => $content,'send_time' => time()]);
+                    }
                 }
             }
             return $ret;
@@ -130,6 +133,10 @@ abstract class base_room
         $invitees = $this->userinfos($invitees);
         $inviter  = $this->userinfos($inviter);
 
+        if( count($invitees)==1 && $invitees[0]['userid']==$inviter['userid']){
+            return false;
+        }
+
         $str = "<font color='#3c78d8'>{$inviter['nickname']}</font>邀请";
         $contents = [];
         foreach ($invitees as $user) {

+ 6 - 4
mobile/control/member_talk.php

@@ -1233,8 +1233,11 @@ class member_talkControl extends mbMemberControl
         if(!empty($items))
         {
             $uids = [];
-            foreach ($items as $item) {
-                $uids[] = $item['member_id'];
+            foreach ($items as $idx => $item) {
+                $orgmsg = json_decode($item['orgmsg'],true);
+                $items[$idx]['amount'] = $orgmsg['amount'];
+                $items[$idx]['member_id'] = $orgmsg['user'];
+                $uids[] = $orgmsg['user'];
             }
             $uids = array_unique($uids);
 
@@ -1250,8 +1253,7 @@ class member_talkControl extends mbMemberControl
                 $uid = $val['member_id'];
                 $val['avatar']  = $info[$uid]['avatar'];
                 $val['name']    = $info[$uid]['name'];
-                $msg = json_decode($val['orgmsg'],true);
-                $val['msg']     = $val['type'] == proto_type::msg_type_donate ? "+".$msg['amount'] : "-".$msg['amount'];
+                $val['msg']     = $val['type'] == proto_type::msg_type_donate ? "+".$val['amount'] : "-".$val['amount'];
                 $val['state']   = $val['type'] == proto_type::msg_type_donate ? 1:0;
                 $val['operate'] = $val['type'] == proto_type::msg_type_donate ? "贡献":"消费";
                 $list[] = $val;