76 lines
2.1 KiB
PHP
76 lines
2.1 KiB
PHP
<?php
|
||
|
||
namespace App\Jobs;
|
||
|
||
use App\Services\YunXinMessageCallBack\Person;
|
||
use App\Services\YunXinMessageCallBack\Team;
|
||
use Illuminate\Bus\Queueable;
|
||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||
use Illuminate\Foundation\Bus\Dispatchable;
|
||
use Illuminate\Queue\InteractsWithQueue;
|
||
use Illuminate\Queue\SerializesModels;
|
||
use Log;
|
||
|
||
class SyncMessage implements ShouldQueue
|
||
{
|
||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||
|
||
protected $data;
|
||
/**
|
||
* Create a new job instance.
|
||
*
|
||
* @return void
|
||
*/
|
||
public function __construct($data)
|
||
{
|
||
$this->data = $data;
|
||
}
|
||
|
||
/**
|
||
* Execute the job.
|
||
*
|
||
* @return void
|
||
*/
|
||
public function handle()
|
||
{
|
||
$params = $this->data;
|
||
Log::info("抄送消息");
|
||
Log::info($params);
|
||
//消息的类型
|
||
switch($params['eventType']) {
|
||
case 1: // 会话类型
|
||
if ($params['convType'] == 'TEAM') { // 群聊抄送
|
||
$team = new Team();
|
||
$team->handle($params);
|
||
} elseif ($params["convType"] == "PERSON") { // 单聊抄送
|
||
$person = new Person();
|
||
$person->handle(params: $params);
|
||
}
|
||
break;
|
||
case 7: // 单聊消息撤回
|
||
$person = new Person();
|
||
$person->recall($params);
|
||
break;
|
||
case 8: // 群聊消息撤回
|
||
$team = new Team();
|
||
$team->recall($params);
|
||
break;
|
||
|
||
case 30: //点对点消息已读回执抄送
|
||
$person = new Person();
|
||
$person->receiveMsg($params);
|
||
break;
|
||
|
||
case 85: //会话已读回执
|
||
if ($params["msgType"] == 0) {// 0:单聊,
|
||
|
||
} elseif($params["msgType"] == 1) {// 1:群聊
|
||
$team = new Team();
|
||
$team->readMsg($params);
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|