mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-23 20:00:27 +08:00
Merge branch 'koogua/hotfix-1.3.4' into koogua/v1.3.5
This commit is contained in:
commit
d9c4ffa7d7
@ -24,10 +24,14 @@ class ModerationStat extends Cache
|
|||||||
$statRepo = new StatRepo();
|
$statRepo = new StatRepo();
|
||||||
|
|
||||||
$articleCount = $statRepo->countPendingArticles();
|
$articleCount = $statRepo->countPendingArticles();
|
||||||
|
$questionCount = $statRepo->countPendingQuestions();
|
||||||
|
$answerCount = $statRepo->countPendingAnswers();
|
||||||
$commentCount = $statRepo->countPendingComments();
|
$commentCount = $statRepo->countPendingComments();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'article_count' => $articleCount,
|
'article_count' => $articleCount,
|
||||||
|
'question_count' => $questionCount,
|
||||||
|
'answer_count' => $answerCount,
|
||||||
'comment_count' => $commentCount,
|
'comment_count' => $commentCount,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -127,14 +127,12 @@ class Article extends Service
|
|||||||
|
|
||||||
$validator = new ArticleValidator();
|
$validator = new ArticleValidator();
|
||||||
|
|
||||||
$category = $validator->checkCategory($post['category_id']);
|
|
||||||
$title = $validator->checkTitle($post['title']);
|
$title = $validator->checkTitle($post['title']);
|
||||||
|
|
||||||
$article = new ArticleModel();
|
$article = new ArticleModel();
|
||||||
|
|
||||||
$article->published = ArticleModel::PUBLISH_APPROVED;
|
$article->published = ArticleModel::PUBLISH_APPROVED;
|
||||||
$article->owner_id = $user->id;
|
$article->owner_id = $user->id;
|
||||||
$article->category_id = $category->id;
|
|
||||||
$article->title = $title;
|
$article->title = $title;
|
||||||
|
|
||||||
$article->create();
|
$article->create();
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Http\Admin\Services;
|
namespace App\Http\Admin\Services;
|
||||||
|
|
||||||
use App\Caches\ModerationStat;
|
|
||||||
use App\Caches\SiteGlobalStat;
|
use App\Caches\SiteGlobalStat;
|
||||||
use App\Caches\SiteTodayStat;
|
use App\Caches\SiteTodayStat;
|
||||||
use App\Library\AppInfo;
|
use App\Library\AppInfo;
|
||||||
use App\Library\Utils\ServerInfo;
|
use App\Library\Utils\ServerInfo;
|
||||||
|
use App\Repos\Stat as StatRepo;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
|
|
||||||
class Index extends Service
|
class Index extends Service
|
||||||
@ -56,9 +56,19 @@ class Index extends Service
|
|||||||
|
|
||||||
public function getModerationStat()
|
public function getModerationStat()
|
||||||
{
|
{
|
||||||
$cache = new ModerationStat();
|
$statRepo = new StatRepo();
|
||||||
|
|
||||||
return $cache->get();
|
$articleCount = $statRepo->countPendingArticles();
|
||||||
|
$questionCount = $statRepo->countPendingQuestions();
|
||||||
|
$answerCount = $statRepo->countPendingAnswers();
|
||||||
|
$commentCount = $statRepo->countPendingComments();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'article_count' => $articleCount,
|
||||||
|
'question_count' => $questionCount,
|
||||||
|
'answer_count' => $answerCount,
|
||||||
|
'comment_count' => $commentCount,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getReleases()
|
public function getReleases()
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<div class="kg-stat-card">
|
<div class="kg-stat-card">
|
||||||
<div class="name">提问</div>
|
<div class="name">提问</div>
|
||||||
<div class="count">
|
<div class="count">
|
||||||
<a href="javascript:">0</a>
|
<a href="{{ url({'for':'admin.mod.questions'}) }}">{{ mod_stat.question_count }}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -22,7 +22,7 @@
|
|||||||
<div class="kg-stat-card">
|
<div class="kg-stat-card">
|
||||||
<div class="name">回答</div>
|
<div class="name">回答</div>
|
||||||
<div class="count">
|
<div class="count">
|
||||||
<a href="javascript:">0</a>
|
<a href="{{ url({'for':'admin.mod.answers'}) }}">{{ mod_stat.answer_count }}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -64,10 +64,13 @@ class ArticleController extends Controller
|
|||||||
|
|
||||||
$this->seo->prependTitle('写文章');
|
$this->seo->prependTitle('写文章');
|
||||||
|
|
||||||
|
$referer = $this->request->getHTTPReferer();
|
||||||
|
|
||||||
$this->view->pick('article/edit');
|
$this->view->pick('article/edit');
|
||||||
$this->view->setVar('source_types', $sourceTypes);
|
$this->view->setVar('source_types', $sourceTypes);
|
||||||
$this->view->setVar('article', $article);
|
|
||||||
$this->view->setVar('xm_tags', $xmTags);
|
$this->view->setVar('xm_tags', $xmTags);
|
||||||
|
$this->view->setVar('article', $article);
|
||||||
|
$this->view->setVar('referer', $referer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Repos;
|
namespace App\Repos;
|
||||||
|
|
||||||
|
use App\Models\Answer as AnswerModel;
|
||||||
use App\Models\Article as ArticleModel;
|
use App\Models\Article as ArticleModel;
|
||||||
use App\Models\Comment as CommentModel;
|
use App\Models\Comment as CommentModel;
|
||||||
use App\Models\Online as OnlineModel;
|
use App\Models\Online as OnlineModel;
|
||||||
use App\Models\Order as OrderModel;
|
use App\Models\Order as OrderModel;
|
||||||
use App\Models\OrderStatus as OrderStatusModel;
|
use App\Models\OrderStatus as OrderStatusModel;
|
||||||
use App\Models\PointRedeem as PointRedeemModel;
|
use App\Models\PointRedeem as PointRedeemModel;
|
||||||
|
use App\Models\Question as QuestionModel;
|
||||||
use App\Models\Refund as RefundModel;
|
use App\Models\Refund as RefundModel;
|
||||||
use App\Models\User as UserModel;
|
use App\Models\User as UserModel;
|
||||||
use Phalcon\Mvc\Model\Resultset;
|
use Phalcon\Mvc\Model\Resultset;
|
||||||
@ -24,6 +26,22 @@ class Stat extends Repository
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countPendingQuestions()
|
||||||
|
{
|
||||||
|
return (int)ArticleModel::count([
|
||||||
|
'conditions' => 'published = :published: AND deleted = 0',
|
||||||
|
'bind' => ['published' => QuestionModel::PUBLISH_PENDING],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countPendingAnswers()
|
||||||
|
{
|
||||||
|
return (int)AnswerModel::count([
|
||||||
|
'conditions' => 'published = :published: AND deleted = 0',
|
||||||
|
'bind' => ['published' => AnswerModel::PUBLISH_PENDING],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function countPendingComments()
|
public function countPendingComments()
|
||||||
{
|
{
|
||||||
return (int)CommentModel::count([
|
return (int)CommentModel::count([
|
||||||
|
Loading…
x
Reference in New Issue
Block a user