diff --git a/app/common/utils/FeishuMessage.php b/app/common/utils/FeishuMessage.php index e08d8e4..4783a9c 100644 --- a/app/common/utils/FeishuMessage.php +++ b/app/common/utils/FeishuMessage.php @@ -9,11 +9,21 @@ class FeishuMessage protected $app_id = 'cli_a6183b882cb8500d'; protected $app_secret = 'VqYib48u4EtDIa6nG9qH3f0fYCA1bCvs'; + protected $state = 'hesu'; protected $class = null; - public function __construct() + public function __construct($options = []) { - $this->class = new Feishu($this->app_id, $this->app_secret); + if (isset($options['app_id']) && $options['app_id']) { + $this->app_id = $options['app_id']; + } + if (isset($options['app_secret']) && $options['app_secret']) { + $this->app_secret = $options['app_secret']; + } + if (isset($options['state']) && $options['state']) { + $this->state = $options['state']; + } + $this->class = new Feishu($this->app_id, $this->app_secret, $this->state); } /** diff --git a/app/queue/redis/FeishuMessage.php b/app/queue/redis/FeishuMessage.php index 6bb774e..7aa510c 100644 --- a/app/queue/redis/FeishuMessage.php +++ b/app/queue/redis/FeishuMessage.php @@ -49,6 +49,7 @@ class FeishuMessage implements Consumer 'app_id' => $feishuAppInfo->app_id, 'app_secret' => $feishuAppInfo->app_secret, + 'state' => $feishuAppInfo->state, 'msg_type' => 'interactive', 'receive_id_type' => 'open_id', 'receive_id' => $reInfo->open_id @@ -64,6 +65,7 @@ class FeishuMessage implements Consumer if ($data['receive_type'] == 'group') { $appId = 'cli_a6183b882cb8500d'; $appSecret = 'VqYib48u4EtDIa6nG9qH3f0fYCA1bCvs'; + $state = 'hesu'; $receiveId = 'oc_a52d9f89ad76735279088c78beade8dc'; $receiveIdType = 'chat_id'; } else { @@ -75,6 +77,7 @@ class FeishuMessage implements Consumer // 推送信息 $appId = $feishuAppInfo->app_id; $appSecret = $feishuAppInfo->app_secret; + $state = $feishuAppInfo->state; $receiveId = $reInfo->open_id; $receiveIdType = 'open_id'; } @@ -91,13 +94,14 @@ class FeishuMessage implements Consumer 'app_id' => $appId, 'app_secret' => $appSecret, + 'state' => $state, 'msg_type' => 'interactive', 'receive_id_type' => $receiveIdType, 'receive_id' => $receiveId ]; } - - $feishuMsg = new FeishuMsg(); + + $feishuMsg = new FeishuMsg($options); $feishuMsg->messageSend($data['scene'], $options); } catch (\Throwable $th) { throw $th; diff --git a/app/queue/redis/InquiryToCrm.php b/app/queue/redis/InquiryToCrm.php index ecac73e..ac27813 100644 --- a/app/queue/redis/InquiryToCrm.php +++ b/app/queue/redis/InquiryToCrm.php @@ -24,6 +24,7 @@ class InquiryToCrm implements Consumer try { // 获取询盘信息 $info = InquiryLog::with(['channelInfo', 'countryInfo', 'enter'])->where('id', $data['id'])->where('sync_crm', 0)->first(); + if ($info) { // 获取用户信息 $recipient = 0;