src/Biz/CloudPlatform/Service/Impl/PushServiceImpl.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\CloudPlatform\Service\Impl;
use Biz\BaseService;
use Biz\CloudPlatform\IMAPIFactory;
use Biz\CloudPlatform\Service\PushService;
use Biz\System\Service\SettingService;
use Codeages\Biz\Framework\Context\Biz;
class PushServiceImpl extends BaseService implements PushService
{
protected $imApi;
public function __construct(Biz $biz)
{
parent::__construct($biz);
$this->imApi = IMAPIFactory::create();
}
public function push($from, $to, $body)
{
$setting = $this->getSettingService()->get('app_im', array());
if (empty($setting['enabled'])) {
return;
}
$params = array(
'fromId' => 0,
'fromName' => '系统消息',
'toName' => '全部',
'body' => array(
'v' => 1,
't' => 'push',
'b' => $body,
's' => $from,
'd' => $to,
),
'convNo' => empty($to['convNo']) ? '' : $to['convNo'],
);
if ('user' == $to['type']) {
$params['toId'] = $to['id'];
}
if (empty($params['convNo'])) {
return;
}
$biz = $this->biz;
$type = empty($body['type']) ? 'DEFAULT' : $body['type'];
$biz['logger']->info("MESSAGE PUSH: {$type}", $params);
try {
$api = $this->imApi;
$result = $api->post('/push', $params);
$setting = $this->getSettingService()->get('developer', array());
if (!empty($setting['debug'])) {
IMAPIFactory::getLogger()->debug('API RESULT', !is_array($result) ? array() : $result);
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。