diff --git a/application/adminapi/controller/User.php b/application/adminapi/controller/User.php index 231eeb9f..57569a69 100644 --- a/application/adminapi/controller/User.php +++ b/application/adminapi/controller/User.php @@ -278,7 +278,7 @@ class User extends adminApi 'Text' => $content ]; //谁发送给谁,什么消息,是否同步到发送者1是,2否,消息是否只下发给在线用户 1 是,0 否 - model('api/Tencent')->user_sendmsg("管理员",$user_id,json_encode($text)); + model('api/Tencent')->user_sendmsg("administrator",$user_id,json_encode($text),2,0,1); }else{ if($type ==1) { $res = model('User')->where('id', $user_id)->update(['status' => 1]); diff --git a/application/api/model/Tencent.php b/application/api/model/Tencent.php index bfd087ce..8e826aee 100644 --- a/application/api/model/Tencent.php +++ b/application/api/model/Tencent.php @@ -399,18 +399,22 @@ class Tencent extends Model } //指定用户发送消息给用户 - public function user_sendmsg($uid, $receive_uid, $message, $machine_type = 2, $OnlineOnlyFlag = 0){ + public function user_sendmsg($uid, $receive_uid, $message, $machine_type = 2, $OnlineOnlyFlag = 0,$is_admin=0){ $config = get_system_config(); $tencentyun_im_appid = $config['tencentyun_im_appid']; $im_admin = 'administrator'; $admin_sig = $this->tencent_user_sig_info($im_admin); $rand = rand(111111111,9999999999); - + if($is_admin == 1){ + $from_Account ="administrator"; + }else{ + $from_Account ="u".$uid; + } $postUrl = 'https://console.tim.qq.com/v4/openim/sendmsg?sdkappid='.$tencentyun_im_appid.'&identifier='.$im_admin.'&usersig='.$admin_sig.'&random='.$rand.'&contenttype=json'; $curlPost = array( 'SyncOtherMachine' => $machine_type, - 'From_Account' => strval('u'.$uid), + 'From_Account' => strval($from_Account), 'To_Account' => strval('u'.$receive_uid), 'MsgRandom' => time(), 'MsgBody' => array( @@ -429,7 +433,8 @@ class Tencent extends Model $curlPost = json_encode($curlPost); $reslut = $this->tencent_post_url($postUrl, $curlPost); - Log::record("xitong消息信息2:".$reslut,"info"); + print_r($reslut);die; +// Log::record("xitong消息信息2:".$reslut,"info"); return $reslut; }