src/Biz/User/Job/UpdateStatusIndexJob.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\User\Job;
use Codeages\Biz\Framework\Scheduler\AbstractJob;
/**
* Class UpdateStatusIndexJob
*/
class UpdateStatusIndexJob extends AbstractJob
{
const TABLE = 'status';
public function execute()
{
$this->createClassroomIdIndex();
}
protected function createClassroomIdIndex()
{
$this->createIndex(self::TABLE, 'classroomId', 'classroomId');
}
protected function getConnection()
{
$biz = $this->getBiz();
return $biz['db'];
}
protected function isIndexExist($table, $filedName, $indexName)
{
$sql = "show index from `{$table}` where column_name = '{$filedName}' and Key_name = '{$indexName}';";
$result = $this->getConnection()->fetchAssoc($sql);
return empty($result) ? false : true;
}
protected function createIndex($table, $index, $column)
{
if (!$this->isIndexExist($table, $column, $index)) {
$this->getConnection()->exec("ALTER TABLE {$table} ADD INDEX {$index} ({$column})");
}
}
protected function getBiz()
{
return $this->biz;
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。