大更新,1投稿系统参考文献的类型增加功能,,,2官网数据库功能

This commit is contained in:
wangjinlei
2026-07-08 11:15:44 +08:00
parent 186126a726
commit 05af67bc1a
22 changed files with 1634 additions and 81 deletions

View File

@@ -0,0 +1,53 @@
<?php
namespace app\master\service\push;
use think\Db;
/**
* 推送器基类:提供数据表句柄、凭证读取等公共能力
*/
abstract class AbstractPusher implements PusherInterface
{
protected $journal_obj;
protected $journal_stage_obj;
protected $article_obj;
protected $article_author_obj;
public function __construct()
{
$this->journal_obj = Db::name('journal');
$this->journal_stage_obj = Db::name('journal_stage');
$this->article_obj = Db::name('article');
$this->article_author_obj = Db::name('article_author');
}
/**
* 读取某个数据库的凭证配置
* @param string $key credentials.<key>
* @return array
*/
protected function cred($key)
{
$all = config('dbpush.credentials');
return isset($all[$key]) ? $all[$key] : [];
}
/**
* 读取顶层 dbpush 配置项
*/
protected function conf($key, $default = null)
{
$val = config('dbpush.' . $key);
return $val === null ? $default : $val;
}
/**
* 组合文章作者名(逗号分隔)
*/
protected function getAuthorNames($articleId)
{
$list = $this->article_author_obj->where('article_id', $articleId)->where('state', 0)->column('author_name');
return implode(', ', $list);
}
}