1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace app\api\controller;
- use app\admin\model\cms\AuthorManuscript;
- use app\admin\model\cms\Channel;
- 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();
- }
- 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('', $channel_rate ?? 0);
- }
- public function getChannelDiyname()
- {
- $params = $this->request->param();
- if ($params['channel_id']) {
- $channel = Channel::where(['id' => $params['channel_id']])->find();
- }
- $this->success('', $channel);
- }
- }
|