src/Biz/Xapi/Service/Impl/XapiServiceImpl.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\Xapi\Service\Impl;
use AppBundle\Common\ArrayToolkit;
use Biz\BaseService;
use Biz\Task\Service\TaskService;
use Biz\User\UserException;
use Biz\Xapi\Dao\ActivityWatchLogDao;
use Biz\Xapi\Dao\StatementArchiveDao;
use Biz\Xapi\Dao\StatementDao;
use Biz\Xapi\Service\XapiService;
use Codeages\Biz\Framework\Dao\BatchCreateHelper;
use Codeages\Biz\Framework\Dao\BatchUpdateHelper;
class XapiServiceImpl extends BaseService implements XapiService
{
public function createStatement($statement)
{
if (empty($this->biz['user'])) {
$this->createNewException(UserException::UN_LOGIN());
}
$statement['version'] = $this->biz['xapi.options']['version'];
$statement['uuid'] = $this->generateUUID();
return $this->getStatementDao()->create($statement);
}
public function batchCreateStatements($statements)
{
if (empty($this->biz['user'])) {
$this->createNewException(UserException::UN_LOGIN());
}
$batchCreateHelper = new BatchCreateHelper($this->getStatementDao());
foreach ($statements as $statement) {
$statement['version'] = $this->biz['xapi.options']['version'];
$statement['uuid'] = $this->generateUUID();
$batchCreateHelper->add($statement);
}
$batchCreateHelper->flush();
}
public function getStatement($id)
{
return $this->getStatementDao()->get($id);
}
public function deleteStatement($id)
{
return $this->getStatementDao()->update($id, array('status' => 'deleted'));
}
protected function generateUUID()
{
$charid = strtoupper(md5(uniqid(rand(), true)));
$hyphen = chr(45);
$uuid = ''.substr($charid, 0, 8).$hyphen.substr($charid, 8, 4).$hyphen.substr($charid, 12, 4).$hyphen.substr($charid, 16, 4).$hyphen.substr($charid, 20, 12);
return $uuid;
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。