123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- namespace app\api\controller;
- use app\admin\model\cms\Archives;
- use app\admin\model\cms\AuthorManuscript;
- use app\admin\model\cms\Channel;
- use app\admin\model\cms\Conference;
- use app\common\controller\Api;
- use app\common\library\Ems as Emslib;
- use app\common\model\User;
- use think\Hook;
- /**
- * cms系统
- */
- class Cms extends Api
- {
- protected $noNeedLogin = '*';
- protected $noNeedRight = '*';
- public function _initialize()
- {
- parent::_initialize();
- }
- /**
- * 获取期刊的录取率
- *
- * @return void
- * @throws \think\Exception
- */
- public function getChannelCycle()
- {
- $params = $this->request->param();
- if ($params['channel_id']) {
- // 获取当前期刊下所有手稿数量
- $manuscript_count = AuthorManuscript::where(['journal' => $params['channel_id']])->count();
- // 获取录用状态下的期刊数量
- $correct_manuscript_status = config('site.correct_manuscript_status');
- $correct_manuscript_count = 0;
- foreach ($correct_manuscript_status as $correct_status) {
- $correct_manuscript_count += AuthorManuscript::where(['journal' => $params['channel_id'], 'status' => $correct_status])->count();
- }
- }
- if ($correct_manuscript_count > 0) {
- $channel_rate = $correct_manuscript_count / $manuscript_count * 100;
- }
- $this->success('', round($channel_rate, 2) ?? 0);
- }
- public function getChannelDiyname()
- {
- $params = $this->request->param();
- if ($params['channel_id']) {
- $channel = Channel::where(['id' => $params['channel_id']])->find();
- }
- $this->success('', $channel);
- }
- /**
- * 根据时间获取对应会议列表
- *
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- */
- public function getConference()
- {
- $params = $this->request->param();
- $year = $params['year'];
- $month = $params['month'];
- if (empty($year)) {
- $year = date('Y', time());
- }
- if (empty($month)) {
- $month = date('m', time());
- }
- $start_time = $year . '-' . $month;
- $end_time = date('Y-m-d', strtotime("$start_time +1 month -1 day"));
- $conferences = Conference::whereTime('createtime', 'between', [$start_time, $end_time])->select();
- $this->success('', $conferences);
- }
- /**
- * 获取对应期刊文章信息
- *
- * @return void
- */
- public function getArticle()
- {
- $channel_id = $this->request->get('channel_id');
- $archives = Archives::where(['p_channel_id' => $channel_id, 'channel_id' => 34])->order('weigh', 'DESC')->limit(4)->select();
- $this->success('', $archives);
- }
- }
|