regionId(config('aliiot.region')) ->asDefaultClient(); try { AlibabaCloud::rpc() ->product('Iot') ->version('2018-01-20') ->action('Pub') ->method('POST') ->host(config('aliiot.host')) ->options([ 'query' => [ 'RegionId' => "cn-shanghai", 'TopicFullName' => "/".config('aliiot.prod_key')."/".$device_name."/user/get", 'MessageContent' => base64_encode($msg), 'ProductKey' => config('aliiot.prod_key'), 'IotInstanceId'=> config('aliiot.inst_id'), ], ]) ->request(); } catch (ClientException $e) { $this->log->event(LogLabel::DEVICE_SEND_LOG, ['msg' => 'ClientException发布失败:'.$e->getErrorMessage()]); return false; } catch (ServerException $e) { $this->log->event(LogLabel::DEVICE_SEND_LOG, ['msg' => 'ServerException发布失败:'.$e->getErrorMessage()]); return false; } return true; } }