22
This commit is contained in:
@@ -20,20 +20,8 @@ class HookController{
|
|||||||
$userID= Input('userID');
|
$userID= Input('userID');
|
||||||
$nickname= Input('nickname');
|
$nickname= Input('nickname');
|
||||||
$users = Input('users');
|
$users = Input('users');
|
||||||
$im = new \support\OpenImSdk\Client([
|
|
||||||
'host' => config('openim.server'), // OpenIM API地址
|
|
||||||
'secret' => config('openim.secret'), // OpenIM密钥
|
|
||||||
]);
|
|
||||||
foreach($users as $k=>$v){
|
foreach($users as $k=>$v){
|
||||||
|
$this->getSdk()->message->sendBusinessNotification('SystemOfficialTeam',$v['userID'],[
|
||||||
// 'userID' => '0EO9K107ON',
|
|
||||||
// 'nickname' => '坏蛋',
|
|
||||||
// 'faceURL' => '/static/img/avatar.png',
|
|
||||||
// 'ex' => '',
|
|
||||||
// 'createTime' => 0,
|
|
||||||
// 'appMangerLevel' => 0,
|
|
||||||
// 'globalRecvMsgOpt' => 0,
|
|
||||||
$im->message->sendBusinessNotification('official_team',$v['userID'],[
|
|
||||||
'contentType' => 101,
|
'contentType' => 101,
|
||||||
'textElem' => [
|
'textElem' => [
|
||||||
'content' => '欢迎使用'.Config('site.name')
|
'content' => '欢迎使用'.Config('site.name')
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Message
|
|||||||
{
|
{
|
||||||
$data['recvID'] = $recvID;
|
$data['recvID'] = $recvID;
|
||||||
$data['groupID'] = '';
|
$data['groupID'] = '';
|
||||||
$data['sessionType'] = 2;
|
$data['sessionType'] = 1;
|
||||||
return $this->sendMessage($sendID,$data);
|
return $this->sendMessage($sendID,$data);
|
||||||
}
|
}
|
||||||
public function sendGroupMessage(string $sendID, string $groupID = '', array $data=[]): array
|
public function sendGroupMessage(string $sendID, string $groupID = '', array $data=[]): array
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ class Utils
|
|||||||
public static function send(string $path, array $data): array|bool
|
public static function send(string $path, array $data): array|bool
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$token = '';
|
||||||
if($path != Url::$getAdminToken){
|
if($path != Url::$getAdminToken){
|
||||||
$token = Utils::getAdminToken();
|
$token = Utils::getAdminToken();
|
||||||
}
|
}
|
||||||
@@ -92,11 +93,11 @@ class Utils
|
|||||||
$res = self::request($url, $data, $token);
|
$res = self::request($url, $data, $token);
|
||||||
$res = json_decode($res, true);
|
$res = json_decode($res, true);
|
||||||
if($res['errCode'] !==0 ){
|
if($res['errCode'] !==0 ){
|
||||||
cp('=============================调试信息=====================================');
|
\support\Log::error('=============================调试信息=====================================');
|
||||||
cp($url);
|
\support\Log::error($url);
|
||||||
cp(json_encode($data));
|
\support\Log::error($data);
|
||||||
cp($res);
|
\support\Log::error($res);
|
||||||
cp('=============================end=====================================');
|
\support\Log::error('=============================end=====================================');
|
||||||
|
|
||||||
throw new \Exception($res['errMsg'],$res['errCode']);
|
throw new \Exception($res['errMsg'],$res['errCode']);
|
||||||
//throw new \Exception($res['errDlt'],$res['errCode']);
|
//throw new \Exception($res['errDlt'],$res['errCode']);
|
||||||
|
|||||||
Reference in New Issue
Block a user