src/Biz/Distributor/Job/DistributorSyncJob.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\Distributor\Job;
use Codeages\Biz\Framework\Scheduler\AbstractJob;
use Biz\Distributor\Util\DistributorJobStatus;
class DistributorSyncJob extends AbstractJob
{
private $distributorServices = array();
private $mockedSendTypes = null;
public function execute()
{
$drpService = $this->getDrpService();
if (!empty($drpService)) {
$distributorServices = $this->getDistributorServiceList();
foreach ($distributorServices as $service) {
$this->sendData($drpService, $service);
}
}
}
protected function getDrpService()
{
$distributorServices = $this->getDistributorServiceList();
return $distributorServices[0]->getDrpService();
}
private function sendData($drpService, $service)
{
$jobData = $service->findJobData();
$status = DistributorJobStatus::ERROR;
$resultJson = null;
if (!empty($jobData)) {
try {
$typeOrders = array();
$sendedData = array();
foreach ($jobData as $data) {
$sendType = $service->getSendType($data['data']);
if (empty($typeOrders[$sendType])) {
$typeOrders[$sendType] = array();
}
$typeOrders[$sendType][] = $data['data'];
}
foreach ($typeOrders as $sendType => $sendedData) {
$resultJson = $drpService->postData($sendType, $sendedData);
if ($resultJson['success']) {
$status = DistributorJobStatus::FINISHED;
}
$this->biz['logger']->info(
'distributor send job DistributorSyncJob::execute ',
array('jobData' => $jobData, 'result' => $resultJson)
);
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。