mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-24 04:01:31 +08:00
50 lines
1010 B
PHP
50 lines
1010 B
PHP
<?php
|
|
|
|
namespace App\Http\Home\Services;
|
|
|
|
use App\Models\Category as CategoryModel;
|
|
use App\Models\Question as QuestionModel;
|
|
use App\Repos\Category as CategoryRepo;
|
|
use App\Services\Logic\Question\XmTagList as XmTagListService;
|
|
use App\Services\Logic\QuestionTrait;
|
|
use App\Services\Logic\Service as LogicService;
|
|
|
|
class Question extends LogicService
|
|
{
|
|
|
|
use QuestionTrait;
|
|
|
|
public function getQuestionModel()
|
|
{
|
|
$question = new QuestionModel();
|
|
|
|
$question->afterFetch();
|
|
|
|
return $question;
|
|
}
|
|
|
|
public function getCategories()
|
|
{
|
|
$categoryRepo = new CategoryRepo();
|
|
|
|
return $categoryRepo->findAll([
|
|
'type' => CategoryModel::TYPE_ARTICLE,
|
|
'level' => 1,
|
|
'published' => 1,
|
|
]);
|
|
}
|
|
|
|
public function getXmTags($id)
|
|
{
|
|
$service = new XmTagListService();
|
|
|
|
return $service->handle($id);
|
|
}
|
|
|
|
public function getQuestion($id)
|
|
{
|
|
return $this->checkQuestion($id);
|
|
}
|
|
|
|
}
|