diff --git a/app/Console/Tasks/MaintainTask.php b/app/Console/Tasks/MaintainTask.php
index ec641854..97ac7e1e 100644
--- a/app/Console/Tasks/MaintainTask.php
+++ b/app/Console/Tasks/MaintainTask.php
@@ -2,36 +2,127 @@
namespace App\Console\Tasks;
+use App\Library\Cache\Backend\Redis as RedisCache;
use Phalcon\Cli\Task;
+use Phalcon\Config;
class MaintainTask extends Task
{
public function mainAction()
{
-
+ $this->resetAnnotationAction();
+ $this->resetMetadataAction();
+ $this->resetVoltAction();
}
- public function resetAnnotationsAction()
+ /**
+ * 重置注解
+ *
+ * @command: php console.php maintain reset_annotation
+ */
+ public function resetAnnotationAction()
{
- $dir = cache_path('annotations');
+ $config = $this->getConfig();
+ $cache = $this->getCache();
+ $redis = $cache->getRedis();
+
+ $dbIndex = $config->path('annotation.db');
+ $statsKey = $config->path('annotation.statsKey');
+
+ $redis->select($dbIndex);
+
+ $keys = $redis->sMembers($statsKey);
+
+ echo "start reset annotation..." . PHP_EOL;
+
+ if (count($keys) > 0) {
+
+ $keys = $this->handleKeys($keys);
+
+ $redis->del(...$keys);
+ $redis->del($statsKey);
+ }
+
+ echo "end reset annotation..." . PHP_EOL;
+ }
+
+ /**
+ * 重置元数据
+ *
+ * @command: php console.php maintain reset_metadata
+ */
+ public function resetMetadataAction()
+ {
+ $config = $this->getConfig();
+ $cache = $this->getCache();
+ $redis = $cache->getRedis();
+
+ $dbIndex = $config->path('metadata.db');
+ $statsKey = $config->path('metadata.statsKey');
+
+ $redis->select($dbIndex);
+
+ $keys = $redis->sMembers($statsKey);
+
+ echo "start reset metadata..." . PHP_EOL;
+
+ if (count($keys) > 0) {
+
+ $keys = $this->handleKeys($keys);
+
+ $redis->del(...$keys);
+ $redis->del($statsKey);
+ }
+
+ echo "start reset metadata..." . PHP_EOL;
+ }
+
+ /**
+ * 重置模板
+ *
+ * @command: php console.php maintain reset_volt
+ */
+ public function resetVoltAction()
+ {
+ echo "start reset volt..." . PHP_EOL;
+
+ $dir = cache_path('volt');
foreach (scandir($dir) as $file) {
if (strpos($file, '.php')) {
unlink($dir . '/' . $file);
}
}
+
+ echo "end reset volt..." . PHP_EOL;
}
- public function resetModelsMetaDataAction()
+ protected function getConfig()
{
- $dir = cache_path('metadata');
+ /**
+ * @var Config $config
+ */
+ $config = $this->getDI()->get('config');
- foreach (scandir($dir) as $file) {
- if (strpos($file, '.php')) {
- unlink($dir . '/' . $file);
- }
- }
+ return $config;
+ }
+
+ protected function getCache()
+ {
+ /**
+ * @var RedisCache $cache
+ */
+ $cache = $this->getDI()->get('cache');
+
+ return $cache;
+ }
+
+ protected function handleKeys($keys)
+ {
+ return array_map(function ($key) {
+ return "_PHCR{$key}";
+ }, $keys);
}
}
diff --git a/app/Http/Desktop/Views/partials/header.volt b/app/Http/Desktop/Views/partials/header.volt
index bf694e0b..2f65030e 100644
--- a/app/Http/Desktop/Views/partials/header.volt
+++ b/app/Http/Desktop/Views/partials/header.volt
@@ -4,11 +4,11 @@
{% for nav in navs.top %}
-
- {{ nav.name }}
+ {{ nav.name }}
{% if nav.children %}
{% for child in nav.children %}
- - {{ child.name }}
+ - {{ child.name }}
{% endfor %}
{% endif %}
@@ -24,10 +24,13 @@
-
- 搜索
+ 搜索
-
- 微聊
+ 会员
+
+ -
+ 微聊
{% if auth_user.id > 0 %}
-
diff --git a/app/Providers/Annotation.php b/app/Providers/Annotation.php
index 77d7a6a9..9f06bdd1 100644
--- a/app/Providers/Annotation.php
+++ b/app/Providers/Annotation.php
@@ -2,8 +2,8 @@
namespace App\Providers;
-use Phalcon\Annotations\Adapter\Files as FileAnnotations;
use Phalcon\Annotations\Adapter\Memory as MemoryAnnotations;
+use Phalcon\Annotations\Adapter\Redis as RedisAnnotations;
class Annotation extends Provider
{
@@ -19,8 +19,13 @@ class Annotation extends Provider
if ($config->env == ENV_DEV) {
$annotations = new MemoryAnnotations();
} else {
- $annotations = new FileAnnotations([
- 'annotationsDir' => cache_path() . '/annotations/',
+ $annotations = new RedisAnnotations([
+ 'host' => $config->redis->host,
+ 'port' => $config->redis->port,
+ 'auth' => $config->redis->auth,
+ 'index' => $config->annotation->db,
+ 'lifetime' => $config->annotation->lifetime,
+ 'statsKey' => $config->annotation->statsKey,
]);
}
diff --git a/app/Providers/Cache.php b/app/Providers/Cache.php
index d50e71ff..a28a0231 100644
--- a/app/Providers/Cache.php
+++ b/app/Providers/Cache.php
@@ -4,6 +4,7 @@ namespace App\Providers;
use App\Library\Cache\Backend\Redis as RedisBackend;
use Phalcon\Cache\Frontend\Igbinary as IgbinaryFrontend;
+use Phalcon\Config;
class Cache extends Provider
{
@@ -12,19 +13,22 @@ class Cache extends Provider
public function register()
{
- $this->di->setShared($this->serviceName, function () {
+ /**
+ * @var Config $config
+ */
+ $config = $this->di->getShared('config');
- $config = $this->getShared('config');
+ $this->di->setShared($this->serviceName, function () use ($config) {
$frontend = new IgbinaryFrontend([
- 'lifetime' => $config->cache->lifetime,
+ 'lifetime' => $config->path('cache.lifetime'),
]);
return new RedisBackend($frontend, [
- 'host' => $config->redis->host,
- 'port' => $config->redis->port,
- 'auth' => $config->redis->auth,
- 'index' => $config->cache->db,
+ 'host' => $config->path('redis.host'),
+ 'port' => $config->path('redis.port'),
+ 'auth' => $config->path('redis.auth'),
+ 'index' => $config->path('cache.db'),
]);
});
}
diff --git a/app/Providers/Crypt.php b/app/Providers/Crypt.php
index c07c50f4..85fbc0af 100644
--- a/app/Providers/Crypt.php
+++ b/app/Providers/Crypt.php
@@ -2,7 +2,8 @@
namespace App\Providers;
-use Phalcon\Crypt as PhalconCrypt;
+use Phalcon\Config;
+use Phalcon\Crypt as PhCrypt;
class Crypt extends Provider
{
@@ -11,13 +12,16 @@ class Crypt extends Provider
public function register()
{
- $this->di->setShared($this->serviceName, function () {
+ /**
+ * @var Config $config
+ */
+ $config = $this->di->getShared('config');
- $config = $this->getShared('config');
+ $this->di->setShared($this->serviceName, function () use ($config) {
- $crypt = new PhalconCrypt();
+ $crypt = new PhCrypt();
- $crypt->setKey($config->key);
+ $crypt->setKey($config->get('key'));
return $crypt;
});
diff --git a/app/Providers/Database.php b/app/Providers/Database.php
index d8f38396..d1a6705a 100644
--- a/app/Providers/Database.php
+++ b/app/Providers/Database.php
@@ -2,6 +2,7 @@
namespace App\Providers;
+use Phalcon\Config;
use Phalcon\Db\Adapter\Pdo\Mysql as MySqlAdapter;
class Database extends Provider
@@ -11,17 +12,20 @@ class Database extends Provider
public function register()
{
- $this->di->setShared($this->serviceName, function () {
+ /**
+ * @var Config $config
+ */
+ $config = $this->di->getShared('config');
- $config = $this->getShared('config');
+ $this->di->setShared($this->serviceName, function () use ($config) {
$options = [
- 'host' => $config->db->host,
- 'port' => $config->db->port,
- 'dbname' => $config->db->dbname,
- 'username' => $config->db->username,
- 'password' => $config->db->password,
- 'charset' => $config->db->charset,
+ 'host' => $config->path('db.host'),
+ 'port' => $config->path('db.port'),
+ 'dbname' => $config->path('db.dbname'),
+ 'username' => $config->path('db.username'),
+ 'password' => $config->path('db.password'),
+ 'charset' => $config->path('db.charset'),
'options' => [
\PDO::ATTR_EMULATE_PREPARES => false,
\PDO::ATTR_STRINGIFY_FETCHES => false,
@@ -30,7 +34,7 @@ class Database extends Provider
$connection = new MySqlAdapter($options);
- if ($config->env == ENV_DEV) {
+ if ($config->get('env') == ENV_DEV) {
$connection->setEventsManager($this->getEventsManager());
}
diff --git a/app/Providers/MetaData.php b/app/Providers/MetaData.php
index 2fd61d85..25a62363 100644
--- a/app/Providers/MetaData.php
+++ b/app/Providers/MetaData.php
@@ -2,8 +2,9 @@
namespace App\Providers;
-use Phalcon\Mvc\Model\MetaData\Files as FileMetaData;
+use Phalcon\Config;
use Phalcon\Mvc\Model\MetaData\Memory as MemoryMetaData;
+use Phalcon\Mvc\Model\MetaData\Redis as RedisMetaData;
class MetaData extends Provider
{
@@ -12,15 +13,23 @@ class MetaData extends Provider
public function register()
{
- $this->di->setShared($this->serviceName, function () {
+ /**
+ * @var Config $config
+ */
+ $config = $this->di->getShared('config');
- $config = $this->getShared('config');
+ $this->di->setShared($this->serviceName, function () use ($config) {
- if ($config->env == ENV_DEV) {
+ if ($config->get('env') == ENV_DEV) {
$metaData = new MemoryMetaData();
} else {
- $metaData = new FileMetaData([
- 'metaDataDir' => cache_path() . '/metadata/',
+ $metaData = new RedisMetaData([
+ 'host' => $config->path('redis.host'),
+ 'port' => $config->path('redis.port'),
+ 'auth' => $config->path('redis.auth'),
+ 'index' => $config->path('metadata.db'),
+ 'statsKey' => $config->path('metadata.statsKey'),
+ 'lifetime' => $config->path('metadata.lifetime'),
]);
}
diff --git a/app/Providers/Session.php b/app/Providers/Session.php
index 13f8162d..995717e0 100644
--- a/app/Providers/Session.php
+++ b/app/Providers/Session.php
@@ -2,6 +2,7 @@
namespace App\Providers;
+use Phalcon\Config;
use Phalcon\Session\Adapter\Redis as RedisSession;
class Session extends Provider
@@ -11,16 +12,19 @@ class Session extends Provider
public function register()
{
- $this->di->setShared($this->serviceName, function () {
+ /**
+ * @var Config $config
+ */
+ $config = $this->di->getShared('config');
- $config = $this->getShared('config');
+ $this->di->setShared($this->serviceName, function () use ($config) {
$session = new RedisSession([
- 'host' => $config->redis->host,
- 'port' => $config->redis->port,
- 'auth' => $config->redis->auth,
- 'index' => $config->session->db,
- 'lifetime' => $config->session->lifetime,
+ 'host' => $config->path('redis.host'),
+ 'port' => $config->path('redis.port'),
+ 'auth' => $config->path('redis.auth'),
+ 'index' => $config->path('session.db'),
+ 'lifetime' => $config->path('session.lifetime'),
]);
$session->start();
diff --git a/app/Providers/Url.php b/app/Providers/Url.php
index ff1e0a63..c7abcbda 100644
--- a/app/Providers/Url.php
+++ b/app/Providers/Url.php
@@ -2,7 +2,8 @@
namespace App\Providers;
-use Phalcon\Mvc\Url as UrlResolver;
+use Phalcon\Config;
+use Phalcon\Mvc\Url as PhUrl;
class Url extends Provider
{
@@ -11,14 +12,17 @@ class Url extends Provider
public function register()
{
- $this->di->setShared($this->serviceName, function() {
+ /**
+ * @var Config $config
+ */
+ $config = $this->di->getShared('config');
- $config = $this->getShared('config');
+ $this->di->setShared($this->serviceName, function () use ($config) {
- $url = new UrlResolver();
+ $url = new PhUrl();
- $url->setBaseUri($config->base_uri);
- $url->setStaticBaseUri($config->static_base_uri);
+ $url->setBaseUri($config->get('base_uri'));
+ $url->setStaticBaseUri($config->get('static_base_uri'));
return $url;
});
diff --git a/app/Providers/Volt.php b/app/Providers/Volt.php
index bb786e46..ac767758 100644
--- a/app/Providers/Volt.php
+++ b/app/Providers/Volt.php
@@ -2,7 +2,7 @@
namespace App\Providers;
-use Phalcon\Mvc\View\Engine\Volt as PhalconVolt;
+use Phalcon\Mvc\View\Engine\Volt as PhVolt;
class Volt extends Provider
{
@@ -13,7 +13,7 @@ class Volt extends Provider
{
$this->di->setShared('volt', function ($view, $di) {
- $volt = new PhalconVolt($view, $di);
+ $volt = new PhVolt($view, $di);
$volt->setOptions([
'compiledPath' => cache_path() . '/volt/',
diff --git a/bootstrap/ConsoleKernel.php b/bootstrap/ConsoleKernel.php
index 455afd28..b531a253 100644
--- a/bootstrap/ConsoleKernel.php
+++ b/bootstrap/ConsoleKernel.php
@@ -14,6 +14,7 @@ use App\Providers\Provider as AppProvider;
use Phalcon\Cli\Console;
use Phalcon\Di\FactoryDefault\Cli;
use Phalcon\Loader;
+use Phalcon\Text;
class ConsoleKernel extends Kernel
{
@@ -48,9 +49,9 @@ class ConsoleKernel extends Kernel
foreach ($_SERVER['argv'] as $k => $arg) {
if ($k == 1) {
- $options['task'] = $arg;
+ $options['task'] = $this->handleTaskName($arg);
} elseif ($k == 2) {
- $options['action'] = $arg;
+ $options['action'] = $this->handleActionName($arg);
} elseif ($k >= 3) {
$options['params'][] = $arg;
}
@@ -80,8 +81,8 @@ class ConsoleKernel extends Kernel
protected function registerServices()
{
$providers = [
- CacheProvider::class,
ConfigProvider::class,
+ CacheProvider::class,
CryptProvider::class,
DatabaseProvider::class,
EventsManagerProvider::class,
@@ -106,4 +107,16 @@ class ConsoleKernel extends Kernel
return new ConsoleErrorHandler();
}
+ protected function handleTaskName($name)
+ {
+ return Text::uncamelize($name);
+ }
+
+ protected function handleActionName($name)
+ {
+ $name = Text::uncamelize($name);
+
+ return lcfirst(Text::camelize($name));
+ }
+
}
\ No newline at end of file
diff --git a/bootstrap/HttpKernel.php b/bootstrap/HttpKernel.php
index d2e0cbbf..9de3f74c 100644
--- a/bootstrap/HttpKernel.php
+++ b/bootstrap/HttpKernel.php
@@ -67,10 +67,10 @@ class HttpKernel extends Kernel
protected function registerServices()
{
$providers = [
+ ConfigProvider::class,
AnnotationProvider::class,
CacheProvider::class,
CookieProvider::class,
- ConfigProvider::class,
CryptProvider::class,
CsrfTokenProvider::class,
DatabaseProvider::class,
diff --git a/config/config.default.php b/config/config.default.php
index 9fe99a0c..5c38e47e 100644
--- a/config/config.default.php
+++ b/config/config.default.php
@@ -8,7 +8,7 @@ $config = [];
$config['env'] = 'pro';
/**
- * 加解密钥
+ * 密钥
*/
$config['key'] = 'mlq7jQ1Py8kTdW9m';
@@ -83,27 +83,37 @@ $config['redis']['port'] = 6379;
$config['redis']['auth'] = '1qaz2wsx3edc';
/**
- * 缓存所用redis库编号
+ * redis库编号
*/
$config['cache']['db'] = 0;
/**
- * 缓存有效期(秒)
+ * 有效期(秒)
*/
$config['cache']['lifetime'] = 2 * 3600;
/**
- * 会话所用redis库编号
+ * redis库编号
*/
$config['session']['db'] = 0;
/**
- * 会话有效期(秒)
+ * 有效期(秒)
*/
$config['session']['lifetime'] = 24 * 3600;
/**
- * 加密密钥
+ * redis库编号
+ */
+$config['metadata']['db'] = 2;
+
+/**
+ * 有效期(秒)
+ */
+$config['metadata']['lifetime'] = 7 * 86400;
+
+/**
+ * 密钥
*/
$config['jwt']['key'] = 'fu6ckEc8pv8k5K7m';
@@ -123,7 +133,7 @@ $config['jwt']['leeway'] = 30;
$config['throttle']['enabled'] = true;
/**
- * 限流有效期(秒)
+ * 有效期(秒)
*/
$config['throttle']['lifetime'] = 60;
@@ -142,13 +152,4 @@ $config['websocket']['url'] = 'ws://127.0.0.1:8282';
*/
$config['websocket']['register_address'] = '127.0.0.1:1238';
-/**
- * 同步器设置
- */
-$config['syncer']['recount_course'] = false;
-$config['syncer']['recount_chapter'] = false;
-$config['syncer']['recount_consult'] = false;
-$config['syncer']['recount_review'] = false;
-$config['syncer']['recount_comment'] = false;
-
return $config;
diff --git a/db/migrations/20200827112717_insert_setting_data.php b/db/migrations/20200827112717_insert_setting_data.php
index 135cae78..66da71c1 100644
--- a/db/migrations/20200827112717_insert_setting_data.php
+++ b/db/migrations/20200827112717_insert_setting_data.php
@@ -9,518 +9,433 @@ final class InsertSettingData extends AbstractMigration
public function up()
{
- $rows = array(
- 0 =>
- array(
- 'section' => 'captcha',
- 'item_key' => 'app_id',
- 'item_value' => '',
- ),
- 1 =>
- array(
- 'section' => 'captcha',
- 'item_key' => 'secret_key',
- 'item_value' => '',
- ),
- 2 =>
- array(
- 'section' => 'captcha',
- 'item_key' => 'enabled',
- 'item_value' => '0',
- ),
- 3 =>
- array(
- 'section' => 'im.cs',
- 'item_key' => 'user1_id',
- 'item_value' => '',
- ),
- 4 =>
- array(
- 'section' => 'im.cs',
- 'item_key' => 'enabled',
- 'item_value' => '0',
- ),
- 5 =>
- array(
- 'section' => 'im.cs',
- 'item_key' => 'user3_id',
- 'item_value' => '',
- ),
- 6 =>
- array(
- 'section' => 'im.cs',
- 'item_key' => 'user2_id',
- 'item_value' => '',
- ),
- 7 =>
- array(
- 'section' => 'im.main',
- 'item_key' => 'msg_max_length',
- 'item_value' => '1000',
- ),
- 8 =>
- array(
- 'section' => 'im.main',
- 'item_key' => 'title',
- 'item_value' => '菜鸟驿站',
- ),
- 9 =>
- array(
- 'section' => 'im.main',
- 'item_key' => 'upload_img_enabled',
- 'item_value' => '0',
- ),
- 10 =>
- array(
- 'section' => 'im.main',
- 'item_key' => 'upload_file_enabled',
- 'item_value' => '0',
- ),
- 11 =>
- array(
- 'section' => 'im.main',
- 'item_key' => 'tool_audio_enabled',
- 'item_value' => '0',
- ),
- 12 =>
- array(
- 'section' => 'im.main',
- 'item_key' => 'tool_video_enabled',
- 'item_value' => '0',
- ),
- 13 =>
- array(
- 'section' => 'live',
- 'item_key' => 'push_domain',
- 'item_value' => 'push.abc.com',
- ),
- 14 =>
- array(
- 'section' => 'live',
- 'item_key' => 'pull_trans_template',
- 'item_value' => '{"fd":{"id":"fd","bit_rate":"500","summary":"流畅","height":"540"},"sd":{"id":"sd","bit_rate":"1000","summary":"标清","height":"720"},"hd":{"id":"hd","bit_rate":"2000","summary":"高清","height":"1080"}}',
- ),
- 15 =>
- array(
- 'section' => 'live',
- 'item_key' => 'pull_trans_enabled',
- 'item_value' => '1',
- ),
- 16 =>
- array(
- 'section' => 'live',
- 'item_key' => 'pull_auth_enabled',
- 'item_value' => '1',
- ),
- 17 =>
- array(
- 'section' => 'live',
- 'item_key' => 'push_auth_enabled',
- 'item_value' => '1',
- ),
- 18 =>
- array(
- 'section' => 'live',
- 'item_key' => 'pull_protocol',
- 'item_value' => 'http',
- ),
- 19 =>
- array(
- 'section' => 'live',
- 'item_key' => 'push_auth_delta',
- 'item_value' => '18000',
- ),
- 20 =>
- array(
- 'section' => 'live',
- 'item_key' => 'pull_auth_delta',
- 'item_value' => '18000',
- ),
- 21 =>
- array(
- 'section' => 'live',
- 'item_key' => 'pull_auth_key',
- 'item_value' => '',
- ),
- 22 =>
- array(
- 'section' => 'live',
- 'item_key' => 'pull_domain',
- 'item_value' => 'play.abc.com',
- ),
- 23 =>
- array(
- 'section' => 'live',
- 'item_key' => 'push_template',
- 'item_value' => '',
- ),
- 24 =>
- array(
- 'section' => 'live',
- 'item_key' => 'push_auth_key',
- 'item_value' => '',
- ),
- 25 =>
- array(
- 'section' => 'mailer',
- 'item_key' => 'smtp_host',
- 'item_value' => 'smtp.163.com',
- ),
- 26 =>
- array(
- 'section' => 'mailer',
- 'item_key' => 'smtp_port',
- 'item_value' => '465',
- ),
- 27 =>
- array(
- 'section' => 'mailer',
- 'item_key' => 'smtp_encryption',
- 'item_value' => 'ssl',
- ),
- 28 =>
- array(
- 'section' => 'mailer',
- 'item_key' => 'smtp_username',
- 'item_value' => 'abc@163.com',
- ),
- 29 =>
- array(
- 'section' => 'mailer',
- 'item_key' => 'smtp_password',
- 'item_value' => '888888',
- ),
- 30 =>
- array(
- 'section' => 'mailer',
- 'item_key' => 'smtp_from_email',
- 'item_value' => 'abc@163.com',
- ),
- 31 =>
- array(
- 'section' => 'mailer',
- 'item_key' => 'smtp_from_name',
- 'item_value' => 'ABC有限公司',
- ),
- 32 =>
- array(
- 'section' => 'mailer',
- 'item_key' => 'smtp_authentication',
- 'item_value' => '1',
- ),
- 33 =>
- array(
- 'section' => 'pay.alipay',
- 'item_key' => 'public_key',
- 'item_value' => '',
- ),
- 34 =>
- array(
- 'section' => 'pay.alipay',
- 'item_key' => 'private_key',
- 'item_value' => '',
- ),
- 35 =>
- array(
- 'section' => 'pay.alipay',
- 'item_key' => 'enabled',
- 'item_value' => '1',
- ),
- 36 =>
- array(
- 'section' => 'pay.alipay',
- 'item_key' => 'return_url',
- 'item_value' => '',
- ),
- 37 =>
- array(
- 'section' => 'pay.alipay',
- 'item_key' => 'notify_url',
- 'item_value' => '',
- ),
- 38 =>
- array(
- 'section' => 'pay.alipay',
- 'item_key' => 'app_id',
- 'item_value' => '',
- ),
- 39 =>
- array(
- 'section' => 'pay.wxpay',
- 'item_key' => 'notify_url',
- 'item_value' => '',
- ),
- 40 =>
- array(
- 'section' => 'pay.wxpay',
- 'item_key' => 'return_url',
- 'item_value' => '',
- ),
- 41 =>
- array(
- 'section' => 'pay.wxpay',
- 'item_key' => 'app_id',
- 'item_value' => '',
- ),
- 42 =>
- array(
- 'section' => 'pay.wxpay',
- 'item_key' => 'mch_id',
- 'item_value' => '',
- ),
- 43 =>
- array(
- 'section' => 'pay.wxpay',
- 'item_key' => 'key',
- 'item_value' => '',
- ),
- 44 =>
- array(
- 'section' => 'pay.wxpay',
- 'item_key' => 'enabled',
- 'item_value' => '1',
- ),
- 45 =>
- array(
- 'section' => 'secret',
- 'item_key' => 'secret_key',
- 'item_value' => '',
- ),
- 46 =>
- array(
- 'section' => 'secret',
- 'item_key' => 'secret_id',
- 'item_value' => '',
- ),
- 47 =>
- array(
- 'section' => 'secret',
- 'item_key' => 'app_id',
- 'item_value' => '',
- ),
- 48 =>
- array(
- 'section' => 'site',
- 'item_key' => 'keywords',
- 'item_value' => '开源网课系统,开源网校系统,开源网络教育平台,开源在线教育平台',
- ),
- 49 =>
- array(
- 'section' => 'site',
- 'item_key' => 'analytics',
- 'item_value' => '',
- ),
- 50 =>
- array(
- 'section' => 'site',
- 'item_key' => 'icp_sn',
- 'item_value' => '',
- ),
- 51 =>
- array(
- 'section' => 'site',
- 'item_key' => 'icp_link',
- 'item_value' => 'http://www.miitbeian.gov.cn',
- ),
- 52 =>
- array(
- 'section' => 'site',
- 'item_key' => 'police_sn',
- 'item_value' => '',
- ),
- 53 =>
- array(
- 'section' => 'site',
- 'item_key' => 'police_link',
- 'item_value' => 'http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=abc',
- ),
- 54 =>
- array(
- 'section' => 'site',
- 'item_key' => 'copyright',
- 'item_value' => '2016-2020 深圳市酷瓜软件有限公司',
- ),
- 55 =>
- array(
- 'section' => 'site',
- 'item_key' => 'base_url',
- 'item_value' => '',
- ),
- 56 =>
- array(
- 'section' => 'site',
- 'item_key' => 'enabled',
- 'item_value' => '1',
- ),
- 57 =>
- array(
- 'section' => 'site',
- 'item_key' => 'closed_tips',
- 'item_value' => '站点维护中,请稍后再访问。',
- ),
- 58 =>
- array(
- 'section' => 'site',
- 'item_key' => 'description',
- 'item_value' => '酷瓜云课堂,依托腾讯云基础服务,使用C扩展框架PHALCON开发',
- ),
- 59 =>
- array(
- 'section' => 'site',
- 'item_key' => 'title',
- 'item_value' => '酷瓜云课堂',
- ),
- 60 =>
- array(
- 'section' => 'smser',
- 'item_key' => 'app_id',
- 'item_value' => '',
- ),
- 61 =>
- array(
- 'section' => 'smser',
- 'item_key' => 'template',
- 'item_value' => '{"verify":{"id":"561282","content":"验证码:{1},{2} 分钟内有效,如非本人操作请忽略。"},"order":{"id":"561954","content":"下单成功,商品名称:{1},订单序号:{2},订单金额:¥{3}"},"refund":{"id":"561286","content":"退款成功,商品名称:{1},订单序号:{2},退款金额:¥{3}"},"live":{"id":"561288","content":"直播预告,课程名称:{1},章节名称:{2},开播时间:{3}"}}',
- ),
- 62 =>
- array(
- 'section' => 'smser',
- 'item_key' => 'signature',
- 'item_value' => 'abc',
- ),
- 63 =>
- array(
- 'section' => 'smser',
- 'item_key' => 'app_key',
- 'item_value' => '',
- ),
- 64 =>
- array(
- 'section' => 'storage',
- 'item_key' => 'ci_protocol',
- 'item_value' => 'https',
- ),
- 65 =>
- array(
- 'section' => 'storage',
- 'item_key' => 'bucket_name',
- 'item_value' => '',
- ),
- 66 =>
- array(
- 'section' => 'storage',
- 'item_key' => 'ci_domain',
- 'item_value' => '',
- ),
- 67 =>
- array(
- 'section' => 'storage',
- 'item_key' => 'bucket_region',
- 'item_value' => '',
- ),
- 68 =>
- array(
- 'section' => 'storage',
- 'item_key' => 'bucket_protocol',
- 'item_value' => 'https',
- ),
- 69 =>
- array(
- 'section' => 'storage',
- 'item_key' => 'bucket_domain',
- 'item_value' => '',
- ),
- 70 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'dist_protocol',
- 'item_value' => 'https',
- ),
- 71 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'watermark_enabled',
- 'item_value' => '1',
- ),
- 72 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'watermark_template',
- 'item_value' => '462027',
- ),
- 73 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'video_template',
- 'item_value' => '100210,100220,100230',
- ),
- 74 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'audio_format',
- 'item_value' => 'mp3',
- ),
- 75 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'video_format',
- 'item_value' => 'hls',
- ),
- 76 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'storage_type',
- 'item_value' => 'nearby',
- ),
- 77 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'storage_region',
- 'item_value' => '',
- ),
- 78 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'template',
- 'item_value' => '',
- ),
- 79 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'key_anti_ip_limit',
- 'item_value' => '',
- ),
- 80 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'dist_domain',
- 'item_value' => '',
- ),
- 81 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'audio_template',
- 'item_value' => '1110',
- ),
- 82 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'key_anti_key',
- 'item_value' => '',
- ),
- 83 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'key_anti_expiry',
- 'item_value' => '10800',
- ),
- 84 =>
- array(
- 'section' => 'vod',
- 'item_key' => 'key_anti_enabled',
- 'item_value' => '1',
- ),
- );
+ $rows = [
+ [
+ 'section' => 'captcha',
+ 'item_key' => 'app_id',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'captcha',
+ 'item_key' => 'secret_key',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'captcha',
+ 'item_key' => 'enabled',
+ 'item_value' => '0',
+ ],
+ [
+ 'section' => 'im.cs',
+ 'item_key' => 'user1_id',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'im.cs',
+ 'item_key' => 'enabled',
+ 'item_value' => '0',
+ ],
+ [
+ 'section' => 'im.cs',
+ 'item_key' => 'user3_id',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'im.cs',
+ 'item_key' => 'user2_id',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'im.main',
+ 'item_key' => 'msg_max_length',
+ 'item_value' => '1000',
+ ],
+ [
+ 'section' => 'im.main',
+ 'item_key' => 'title',
+ 'item_value' => '菜鸟驿站',
+ ],
+ [
+ 'section' => 'im.main',
+ 'item_key' => 'upload_img_enabled',
+ 'item_value' => '0',
+ ],
+ [
+ 'section' => 'im.main',
+ 'item_key' => 'upload_file_enabled',
+ 'item_value' => '0',
+ ],
+ [
+ 'section' => 'im.main',
+ 'item_key' => 'tool_audio_enabled',
+ 'item_value' => '0',
+ ],
+ [
+ 'section' => 'im.main',
+ 'item_key' => 'tool_video_enabled',
+ 'item_value' => '0',
+ ],
+ [
+ 'section' => 'live',
+ 'item_key' => 'push_domain',
+ 'item_value' => 'push.abc.com',
+ ],
+ [
+ 'section' => 'live',
+ 'item_key' => 'pull_trans_template',
+ 'item_value' => '{"fd":{"id":"fd","bit_rate":"500","summary":"流畅","height":"540"},"sd":{"id":"sd","bit_rate":"1000","summary":"标清","height":"720"},"hd":{"id":"hd","bit_rate":"2000","summary":"高清","height":"1080"}}',
+ ],
+ [
+ 'section' => 'live',
+ 'item_key' => 'pull_trans_enabled',
+ 'item_value' => '1',
+ ],
+ [
+ 'section' => 'live',
+ 'item_key' => 'pull_auth_enabled',
+ 'item_value' => '1',
+ ],
+ [
+ 'section' => 'live',
+ 'item_key' => 'push_auth_enabled',
+ 'item_value' => '1',
+ ],
+ [
+ 'section' => 'live',
+ 'item_key' => 'pull_protocol',
+ 'item_value' => 'http',
+ ],
+ [
+ 'section' => 'live',
+ 'item_key' => 'push_auth_delta',
+ 'item_value' => '18000',
+ ],
+ [
+ 'section' => 'live',
+ 'item_key' => 'pull_auth_delta',
+ 'item_value' => '18000',
+ ],
+ [
+ 'section' => 'live',
+ 'item_key' => 'pull_auth_key',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'live',
+ 'item_key' => 'pull_domain',
+ 'item_value' => 'play.abc.com',
+ ],
+ [
+ 'section' => 'live',
+ 'item_key' => 'push_template',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'live',
+ 'item_key' => 'push_auth_key',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'mailer',
+ 'item_key' => 'smtp_host',
+ 'item_value' => 'smtp.163.com',
+ ],
+ [
+ 'section' => 'mailer',
+ 'item_key' => 'smtp_port',
+ 'item_value' => '465',
+ ],
+ [
+ 'section' => 'mailer',
+ 'item_key' => 'smtp_encryption',
+ 'item_value' => 'ssl',
+ ],
+ [
+ 'section' => 'mailer',
+ 'item_key' => 'smtp_username',
+ 'item_value' => 'abc@163.com',
+ ],
+ [
+ 'section' => 'mailer',
+ 'item_key' => 'smtp_password',
+ 'item_value' => '888888',
+ ],
+ [
+ 'section' => 'mailer',
+ 'item_key' => 'smtp_from_email',
+ 'item_value' => 'abc@163.com',
+ ],
+ [
+ 'section' => 'mailer',
+ 'item_key' => 'smtp_from_name',
+ 'item_value' => 'ABC有限公司',
+ ],
+ [
+ 'section' => 'mailer',
+ 'item_key' => 'smtp_authentication',
+ 'item_value' => '1',
+ ],
+ [
+ 'section' => 'pay.alipay',
+ 'item_key' => 'public_key',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'pay.alipay',
+ 'item_key' => 'private_key',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'pay.alipay',
+ 'item_key' => 'enabled',
+ 'item_value' => '1',
+ ],
+ [
+ 'section' => 'pay.alipay',
+ 'item_key' => 'return_url',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'pay.alipay',
+ 'item_key' => 'notify_url',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'pay.alipay',
+ 'item_key' => 'app_id',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'pay.wxpay',
+ 'item_key' => 'notify_url',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'pay.wxpay',
+ 'item_key' => 'return_url',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'pay.wxpay',
+ 'item_key' => 'app_id',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'pay.wxpay',
+ 'item_key' => 'mch_id',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'pay.wxpay',
+ 'item_key' => 'key',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'pay.wxpay',
+ 'item_key' => 'enabled',
+ 'item_value' => '1',
+ ],
+ [
+ 'section' => 'secret',
+ 'item_key' => 'secret_key',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'secret',
+ 'item_key' => 'secret_id',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'secret',
+ 'item_key' => 'app_id',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'site',
+ 'item_key' => 'keywords',
+ 'item_value' => '开源网课系统,开源网校系统,开源网络教育平台,开源在线教育平台',
+ ],
+ [
+ 'section' => 'site',
+ 'item_key' => 'analytics',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'site',
+ 'item_key' => 'icp_sn',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'site',
+ 'item_key' => 'icp_link',
+ 'item_value' => 'http://www.miitbeian.gov.cn',
+ ],
+ [
+ 'section' => 'site',
+ 'item_key' => 'police_sn',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'site',
+ 'item_key' => 'police_link',
+ 'item_value' => 'http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=abc',
+ ],
+ [
+ 'section' => 'site',
+ 'item_key' => 'copyright',
+ 'item_value' => '2016-2020 深圳市酷瓜软件有限公司',
+ ],
+ [
+ 'section' => 'site',
+ 'item_key' => 'base_url',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'site',
+ 'item_key' => 'enabled',
+ 'item_value' => '1',
+ ],
+ [
+ 'section' => 'site',
+ 'item_key' => 'closed_tips',
+ 'item_value' => '站点维护中,请稍后再访问。',
+ ],
+ [
+ 'section' => 'site',
+ 'item_key' => 'description',
+ 'item_value' => '酷瓜云课堂,依托腾讯云基础服务,使用C扩展框架PHALCON开发',
+ ],
+ [
+ 'section' => 'site',
+ 'item_key' => 'title',
+ 'item_value' => '酷瓜云课堂',
+ ],
+ [
+ 'section' => 'smser',
+ 'item_key' => 'app_id',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'smser',
+ 'item_key' => 'template',
+ 'item_value' => '{"verify":{"id":"561282","content":"验证码:{1},{2} 分钟内有效,如非本人操作请忽略。"},"order":{"id":"561954","content":"下单成功,商品名称:{1},订单序号:{2},订单金额:¥{3}"},"refund":{"id":"561286","content":"退款成功,商品名称:{1},订单序号:{2},退款金额:¥{3}"},"live":{"id":"561288","content":"直播预告,课程名称:{1},章节名称:{2},开播时间:{3}"}}',
+ ],
+ [
+ 'section' => 'smser',
+ 'item_key' => 'signature',
+ 'item_value' => 'abc',
+ ],
+ [
+ 'section' => 'smser',
+ 'item_key' => 'app_key',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'storage',
+ 'item_key' => 'ci_protocol',
+ 'item_value' => 'https',
+ ],
+ [
+ 'section' => 'storage',
+ 'item_key' => 'bucket_name',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'storage',
+ 'item_key' => 'ci_domain',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'storage',
+ 'item_key' => 'bucket_region',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'storage',
+ 'item_key' => 'bucket_protocol',
+ 'item_value' => 'https',
+ ],
+ [
+ 'section' => 'storage',
+ 'item_key' => 'bucket_domain',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'dist_protocol',
+ 'item_value' => 'https',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'watermark_enabled',
+ 'item_value' => '1',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'watermark_template',
+ 'item_value' => '462027',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'video_template',
+ 'item_value' => '100210,100220,100230',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'audio_format',
+ 'item_value' => 'mp3',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'video_format',
+ 'item_value' => 'hls',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'storage_type',
+ 'item_value' => 'nearby',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'storage_region',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'template',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'key_anti_ip_limit',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'dist_domain',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'audio_template',
+ 'item_value' => '1110',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'key_anti_key',
+ 'item_value' => '',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'key_anti_expiry',
+ 'item_value' => '10800',
+ ],
+ [
+ 'section' => 'vod',
+ 'item_key' => 'key_anti_enabled',
+ 'item_value' => '1',
+ ],
+ ];
$this->table('kg_setting')->insert($rows)->save();
}
diff --git a/db/migrations/20200827113559_insert_user_data.php b/db/migrations/20200827113559_insert_user_data.php
index ac0e37e5..2eba915b 100644
--- a/db/migrations/20200827113559_insert_user_data.php
+++ b/db/migrations/20200827113559_insert_user_data.php
@@ -16,7 +16,7 @@ final class InsertUserData extends AbstractMigration
'salt' => 'MbZWxN3L',
];
- $this->table('kg_account')->insert($account)->save();
+ $this->table('kg_account')->insert($account)->saveData();
$user = [
'id' => $account['id'],
@@ -28,7 +28,7 @@ final class InsertUserData extends AbstractMigration
'edu_role' => 2,
];
- $this->table('kg_user')->insert($user)->save();
+ $this->table('kg_user')->insert($user)->saveData();
$imUser = [
'id' => $user['id'],
@@ -36,7 +36,7 @@ final class InsertUserData extends AbstractMigration
'avatar' => $user['avatar'],
];
- $this->table('kg_im_user')->insert($imUser)->save();
+ $this->table('kg_im_user')->insert($imUser)->saveData();
}
public function down()
diff --git a/db/migrations/20200827120717_insert_nav_data.php b/db/migrations/20200827120717_insert_nav_data.php
index 2baefdb9..45ee0b66 100644
--- a/db/migrations/20200827120717_insert_nav_data.php
+++ b/db/migrations/20200827120717_insert_nav_data.php
@@ -1,23 +1,155 @@
1,
+ 'parent_id' => 0,
+ 'level' => 1,
+ 'name' => '首页',
+ 'path' => ',1,',
+ 'position' => 'top',
+ 'target' => '_self',
+ 'url' => '/',
+ 'priority' => 1,
+ 'published' => 1,
+ ],
+ [
+ 'id' => 2,
+ 'parent_id' => 0,
+ 'level' => 1,
+ 'name' => '录播',
+ 'path' => ',2,',
+ 'position' => 'top',
+ 'target' => '_self',
+ 'url' => '/course/list?model=1',
+ 'priority' => 2,
+ 'published' => 1,
+ ],
+ [
+ 'id' => 3,
+ 'parent_id' => 0,
+ 'level' => 1,
+ 'name' => '直播',
+ 'path' => ',3,',
+ 'position' => 'top',
+ 'target' => '_self',
+ 'url' => '/course/list?model=2',
+ 'priority' => 3,
+ 'published' => 1,
+ ],
+ [
+ 'id' => 4,
+ 'parent_id' => 0,
+ 'level' => 1,
+ 'name' => '专栏',
+ 'path' => ',4,',
+ 'position' => 'top',
+ 'target' => '_self',
+ 'url' => '/course/list?model=3',
+ 'priority' => 4,
+ 'published' => 1,
+ ],
+ [
+ 'id' => 5,
+ 'parent_id' => 0,
+ 'level' => 1,
+ 'name' => '名师',
+ 'path' => ',5,',
+ 'position' => 'top',
+ 'target' => '_self',
+ 'url' => '/teacher/list',
+ 'priority' => 5,
+ 'published' => 1,
+ ],
+ [
+ 'id' => 6,
+ 'parent_id' => 0,
+ 'level' => 1,
+ 'name' => '群组',
+ 'path' => ',6,',
+ 'position' => 'top',
+ 'target' => '_self',
+ 'url' => '/im/group/list',
+ 'priority' => 6,
+ 'published' => 1,
+ ],
+ [
+ 'id' => 7,
+ 'parent_id' => 0,
+ 'level' => 1,
+ 'name' => '关于我们',
+ 'path' => ',7,',
+ 'position' => 'bottom',
+ 'target' => '_blank',
+ 'url' => '#',
+ 'priority' => 1,
+ 'published' => 1,
+ ],
+ [
+ 'id' => 8,
+ 'parent_id' => 0,
+ 'level' => 1,
+ 'name' => '联系我们',
+ 'path' => ',8,',
+ 'position' => 'bottom',
+ 'target' => '_blank',
+ 'url' => '#',
+ 'priority' => 2,
+ 'published' => 1,
+ ],
+ [
+ 'id' => 9,
+ 'parent_id' => 0,
+ 'level' => 1,
+ 'name' => '人才招聘',
+ 'path' => ',9,',
+ 'position' => 'bottom',
+ 'target' => '_blank',
+ 'url' => '#',
+ 'priority' => 3,
+ 'published' => 1,
+ ],
+ [
+ 'id' => 10,
+ 'parent_id' => 0,
+ 'level' => 1,
+ 'name' => '帮助中心',
+ 'path' => ',10,',
+ 'position' => 'bottom',
+ 'target' => '_blank',
+ 'url' => '/help',
+ 'priority' => 4,
+ 'published' => 1,
+ ],
+ [
+ 'id' => 11,
+ 'parent_id' => 0,
+ 'level' => 1,
+ 'name' => '友情链接',
+ 'path' => ',11,',
+ 'position' => 'bottom',
+ 'target' => '_blank',
+ 'url' => '#',
+ 'priority' => 5,
+ 'published' => 1,
+ ],
+ ];
+
+ $this->table('kg_nav')->insert($rows)->save();
}
+
+ public function down()
+ {
+ $this->execute('DELETE FROM kg_nav');
+ }
+
}
diff --git a/public/static/desktop/js/common.js b/public/static/desktop/js/common.js
index 0f7d1dee..0c14fed6 100644
--- a/public/static/desktop/js/common.js
+++ b/public/static/desktop/js/common.js
@@ -105,7 +105,11 @@ layui.use(['jquery', 'form', 'element', 'layer', 'helper'], function () {
});
});
- $('.kg-search').on('click', function () {
+ $('.kg-back').on('click', function () {
+ window.history.back();
+ });
+
+ $('.nav-search').on('click', function () {
var content = '