diff --git a/app/Caches/SectionConfig.php b/app/Caches/Setting.php similarity index 70% rename from app/Caches/SectionConfig.php rename to app/Caches/Setting.php index 8a158f77..36363487 100644 --- a/app/Caches/SectionConfig.php +++ b/app/Caches/Setting.php @@ -2,9 +2,9 @@ namespace App\Caches; -use App\Repos\Config as ConfigRepo; +use App\Repos\Setting as SettingRepo; -class SectionConfig extends Cache +class Setting extends Cache { protected $lifetime = 365 * 86400; @@ -16,14 +16,14 @@ class SectionConfig extends Cache public function getKey($id = null) { - return "section_config:{$id}"; + return "setting:{$id}"; } public function getContent($id = null) { - $configRepo = new ConfigRepo(); + $settingRepo = new SettingRepo(); - $items = $configRepo->findAll(['section' => $id]); + $items = $settingRepo->findAll(['section' => $id]); if ($items->count() == 0) { return []; diff --git a/app/Http/Admin/Controllers/ChapterController.php b/app/Http/Admin/Controllers/ChapterController.php index 57638299..755c9ba1 100644 --- a/app/Http/Admin/Controllers/ChapterController.php +++ b/app/Http/Admin/Controllers/ChapterController.php @@ -4,8 +4,8 @@ namespace App\Http\Admin\Controllers; use App\Http\Admin\Services\Chapter as ChapterService; use App\Http\Admin\Services\ChapterContent as ChapterContentService; -use App\Http\Admin\Services\Config as ConfigService; use App\Http\Admin\Services\Course as CourseService; +use App\Http\Admin\Services\Setting as SettingService; use App\Models\Course as CourseModel; /** @@ -86,11 +86,11 @@ class ChapterController extends Controller $contentService = new ChapterContentService(); $chapterService = new ChapterService(); $courseService = new CourseService(); - $configService = new ConfigService(); + $settingService = new SettingService(); $chapter = $chapterService->getChapter($id); $course = $courseService->getCourse($chapter->course_id); - $storage = $configService->getSectionConfig('storage'); + $storage = $settingService->getSectionSettings('storage'); $this->view->setVar('storage', $storage); $this->view->setVar('chapter', $chapter); diff --git a/app/Http/Admin/Controllers/Controller.php b/app/Http/Admin/Controllers/Controller.php index a391bc86..393f7b0b 100644 --- a/app/Http/Admin/Controllers/Controller.php +++ b/app/Http/Admin/Controllers/Controller.php @@ -48,7 +48,7 @@ class Controller extends \Phalcon\Mvc\Controller /** * 管理员忽略权限检查 */ - if ($this->authUser['root'] == 1) { + if ($this->authUser->root) { return true; } @@ -77,7 +77,7 @@ class Controller extends \Phalcon\Mvc\Controller /** * 执行路由权限检查 */ - if (!in_array($route->getName(), $this->authUser['routes'])) { + if (!in_array($route->getName(), $this->authUser->routes)) { $dispatcher->forward([ 'controller' => 'public', 'action' => 'forbidden', @@ -99,8 +99,8 @@ class Controller extends \Phalcon\Mvc\Controller $audit = new AuditModel(); - $audit->user_id = $this->authUser['id']; - $audit->user_name = $this->authUser['name']; + $audit->user_id = $this->authUser->id; + $audit->user_name = $this->authUser->name; $audit->user_ip = $this->request->getClientAddress(); $audit->req_route = $this->router->getMatchedRoute()->getName(); $audit->req_path = $this->request->getServer('REQUEST_URI'); diff --git a/app/Http/Admin/Controllers/SessionController.php b/app/Http/Admin/Controllers/SessionController.php index 734af793..97536ff0 100644 --- a/app/Http/Admin/Controllers/SessionController.php +++ b/app/Http/Admin/Controllers/SessionController.php @@ -2,8 +2,8 @@ namespace App\Http\Admin\Controllers; -use App\Http\Admin\Services\Config as ConfigService; use App\Http\Admin\Services\Session as SessionService; +use App\Http\Admin\Services\Setting as SettingService; use App\Traits\Response as ResponseTrait; use App\Traits\Security as SecurityTrait; @@ -40,9 +40,9 @@ class SessionController extends \Phalcon\Mvc\Controller return $this->jsonSuccess(['location' => $location]); } - $configService = new ConfigService(); + $settingService = new SettingService(); - $captcha = $configService->getSectionConfig('captcha'); + $captcha = $settingService->getSectionSettings('captcha'); $this->view->pick('public/login'); diff --git a/app/Http/Admin/Controllers/ConfigController.php b/app/Http/Admin/Controllers/SettingController.php similarity index 60% rename from app/Http/Admin/Controllers/ConfigController.php rename to app/Http/Admin/Controllers/SettingController.php index 4de95123..2bb95dfa 100644 --- a/app/Http/Admin/Controllers/ConfigController.php +++ b/app/Http/Admin/Controllers/SettingController.php @@ -2,134 +2,134 @@ namespace App\Http\Admin\Controllers; -use App\Http\Admin\Services\Config as ConfigService; +use App\Http\Admin\Services\Setting as SettingService; /** - * @RoutePrefix("/admin/config") + * @RoutePrefix("/admin/setting") */ -class ConfigController extends Controller +class SettingController extends Controller { /** - * @Route("/site", name="admin.config.site") + * @Route("/site", name="admin.setting.site") */ public function siteAction() { $section = 'site'; - $configService = new ConfigService(); + $settingService = new SettingService(); if ($this->request->isPost()) { $data = $this->request->getPost(); - $configService->updateSectionConfig($section, $data); + $settingService->updateSectionSettings($section, $data); return $this->jsonSuccess(['msg' => '更新配置成功']); } else { - $site = $configService->getSectionConfig($section); + $site = $settingService->getSectionSettings($section); $this->view->setVar('site', $site); } } /** - * @Route("/secret", name="admin.config.secret") + * @Route("/secret", name="admin.setting.secret") */ public function secretAction() { $section = 'secret'; - $configService = new ConfigService(); + $settingService = new SettingService(); if ($this->request->isPost()) { $data = $this->request->getPost(); - $configService->updateStorageConfig($section, $data); + $settingService->updateStorageSettings($section, $data); return $this->jsonSuccess(['msg' => '更新配置成功']); } else { - $secret = $configService->getSectionConfig($section); + $secret = $settingService->getSectionSettings($section); $this->view->setVar('secret', $secret); } } /** - * @Route("/storage", name="admin.config.storage") + * @Route("/storage", name="admin.setting.storage") */ public function storageAction() { $section = 'storage'; - $configService = new ConfigService(); + $settingService = new SettingService(); if ($this->request->isPost()) { $data = $this->request->getPost(); - $configService->updateStorageConfig($section, $data); + $settingService->updateStorageSettings($section, $data); return $this->jsonSuccess(['msg' => '更新配置成功']); } else { - $storage = $configService->getSectionConfig($section); + $storage = $settingService->getSectionSettings($section); $this->view->setVar('storage', $storage); } } /** - * @Route("/vod", name="admin.config.vod") + * @Route("/vod", name="admin.setting.vod") */ public function vodAction() { $section = 'vod'; - $configService = new ConfigService(); + $settingService = new SettingService(); if ($this->request->isPost()) { $data = $this->request->getPost(); - $configService->updateVodConfig($section, $data); + $settingService->updateVodSettings($section, $data); return $this->jsonSuccess(['msg' => '更新配置成功']); } else { - $vod = $configService->getSectionConfig($section); + $vod = $settingService->getSectionSettings($section); $this->view->setVar('vod', $vod); } } /** - * @Route("/live", name="admin.config.live") + * @Route("/live", name="admin.setting.live") */ public function liveAction() { $section = 'live'; - $configService = new ConfigService(); + $settingService = new SettingService(); if ($this->request->isPost()) { $data = $this->request->getPost(); - $configService->updateLiveConfig($section, $data); + $settingService->updateLiveSettings($section, $data); return $this->jsonSuccess(['msg' => '更新配置成功']); } else { - $live = $configService->getSectionConfig($section); + $live = $settingService->getSectionSettings($section); $ptt = json_decode($live->pull_trans_template); @@ -139,11 +139,11 @@ class ConfigController extends Controller } /** - * @Route("/payment", name="admin.config.payment") + * @Route("/payment", name="admin.setting.payment") */ public function paymentAction() { - $configService = new ConfigService(); + $settingService = new SettingService(); if ($this->request->isPost()) { @@ -151,14 +151,14 @@ class ConfigController extends Controller $data = $this->request->getPost(); - $configService->updateSectionConfig($section, $data); + $settingService->updateSectionSettings($section, $data); return $this->jsonSuccess(['msg' => '更新配置成功']); } else { - $alipay = $configService->getSectionConfig('payment.alipay'); - $wxpay = $configService->getSectionConfig('payment.wxpay'); + $alipay = $settingService->getSectionSettings('payment.alipay'); + $wxpay = $settingService->getSectionSettings('payment.wxpay'); $this->view->setVar('alipay', $alipay); $this->view->setVar('wxpay', $wxpay); @@ -166,25 +166,25 @@ class ConfigController extends Controller } /** - * @Route("/smser", name="admin.config.smser") + * @Route("/smser", name="admin.setting.smser") */ public function smserAction() { $section = 'smser'; - $configService = new ConfigService(); + $settingService = new SettingService(); if ($this->request->isPost()) { $data = $this->request->getPost(); - $configService->updateSmserConfig($section, $data); + $settingService->updateSmserSettings($section, $data); return $this->jsonSuccess(['msg' => '更新配置成功']); } else { - $smser = $configService->getSectionConfig($section); + $smser = $settingService->getSectionSettings($section); $template = json_decode($smser->template); @@ -194,44 +194,44 @@ class ConfigController extends Controller } /** - * @Route("/mailer", name="admin.config.mailer") + * @Route("/mailer", name="admin.setting.mailer") */ public function mailerAction() { $section = 'mailer'; - $configService = new ConfigService(); + $settingService = new SettingService(); if ($this->request->isPost()) { $data = $this->request->getPost(); - $configService->updateSectionConfig($section, $data); + $settingService->updateSectionSettings($section, $data); return $this->jsonSuccess(['msg' => '更新配置成功']); } else { - $mailer = $configService->getSectionConfig($section); + $mailer = $settingService->getSectionSettings($section); $this->view->setVar('mailer', $mailer); } } /** - * @Route("/captcha", name="admin.config.captcha") + * @Route("/captcha", name="admin.setting.captcha") */ public function captchaAction() { $section = 'captcha'; - $configService = new ConfigService(); + $settingService = new SettingService(); if ($this->request->isPost()) { $data = $this->request->getPost(); - $configService->updateSectionConfig($section, $data); + $settingService->updateSectionSettings($section, $data); $content = [ 'location' => $this->request->getHTTPReferer(), @@ -242,30 +242,30 @@ class ConfigController extends Controller } else { - $captcha = $configService->getSectionConfig($section); + $captcha = $settingService->getSectionSettings($section); $this->view->setVar('captcha', $captcha); } } /** - * @Route("/vip", name="admin.config.vip") + * @Route("/vip", name="admin.setting.vip") */ public function vipAction() { - $configService = new ConfigService(); + $settingService = new SettingService(); if ($this->request->isPost()) { $data = $this->request->getPost('vip'); - $configService->updateVipConfig($data); + $settingService->updateVipSettings($data); return $this->jsonSuccess(['msg' => '更新配置成功']); } else { - $vips = $configService->getVipConfig(); + $vips = $settingService->getVipSettings(); $this->view->setVar('vips', $vips); } diff --git a/app/Http/Admin/Controllers/TestController.php b/app/Http/Admin/Controllers/TestController.php index 118c78c6..7ecd361b 100644 --- a/app/Http/Admin/Controllers/TestController.php +++ b/app/Http/Admin/Controllers/TestController.php @@ -3,7 +3,7 @@ namespace App\Http\Admin\Controllers; use App\Http\Admin\Services\AlipayTest as AlipayTestService; -use App\Http\Admin\Services\Config as ConfigService; +use App\Http\Admin\Services\Setting as SettingService; use App\Http\Admin\Services\WxpayTest as WxpayTestService; use App\Services\Captcha as CaptchaService; use App\Services\Live as LiveService; @@ -71,7 +71,7 @@ class TestController extends Controller $obs->fms_url = substr($pushUrl, 0, $position + 1); $obs->stream_code = substr($pushUrl, $position + 1); - $this->view->pick('config/live_push_test'); + $this->view->pick('setting/live_push_test'); $this->view->setVar('code_url', $codeUrl); $this->view->setVar('obs', $obs); @@ -144,9 +144,9 @@ class TestController extends Controller if ($result) { - $configService = new ConfigService(); + $settingService = new SettingService(); - $configService->updateSectionConfig('captcha', ['enabled' => 1]); + $settingService->updateSectionSettings('captcha', ['enabled' => 1]); return $this->jsonSuccess(['msg' => '后台验证成功']); @@ -183,7 +183,7 @@ class TestController extends Controller ); } - $this->view->pick('config/payment_alipay_test'); + $this->view->pick('setting/payment_alipay_test'); $this->view->setVar('trade_sn', $trade->sn); $this->view->setVar('code_url', $codeUrl); @@ -236,7 +236,7 @@ class TestController extends Controller $this->db->rollback(); } - $this->view->pick('config/payment_wxpay_test'); + $this->view->pick('setting/payment_wxpay_test'); $this->view->setVar('trade_sn', $trade->sn); $this->view->setVar('code_url', $codeUrl); diff --git a/app/Http/Admin/Services/AuthMenu.php b/app/Http/Admin/Services/AuthMenu.php index f5458fda..17b739d0 100644 --- a/app/Http/Admin/Services/AuthMenu.php +++ b/app/Http/Admin/Services/AuthMenu.php @@ -8,7 +8,7 @@ use Phalcon\Mvc\User\Component; class AuthMenu extends Component { - protected $authUser = []; + protected $authUser; protected $authNodes = []; protected $ownedRoutes = []; protected $owned1stLevelIds = []; @@ -27,7 +27,7 @@ class AuthMenu extends Component $menus = []; foreach ($this->authNodes as $node) { - if ($this->authUser['root'] || in_array($node['id'], $this->owned1stLevelIds)) { + if ($this->authUser->id || in_array($node['id'], $this->owned1stLevelIds)) { $menus[] = [ 'id' => $node['id'], 'label' => $node['label'], @@ -45,7 +45,7 @@ class AuthMenu extends Component foreach ($this->authNodes as $key => $level) { foreach ($level['child'] as $key2 => $level2) { foreach ($level2['child'] as $key3 => $level3) { - $hasRight = $this->authUser['root'] || in_array($level3['id'], $this->owned3rdLevelIds); + $hasRight = $this->authUser->root || in_array($level3['id'], $this->owned3rdLevelIds); if ($level3['type'] == 'menu' && $hasRight) { $menus[$key]['id'] = $level['id']; $menus[$key]['label'] = $level['label']; @@ -76,7 +76,7 @@ class AuthMenu extends Component foreach ($routeIdMapping as $key => $value) { $ids = explode('-', $value); - if (in_array($key, $this->authUser['routes'])) { + if (in_array($key, $this->authUser->routes)) { $owned1stLevelIds[] = $ids[0]; $owned2ndLevelIds[] = $ids[0] . '-' . $ids[1]; $owned3rdLevelIds[] = $value; diff --git a/app/Http/Admin/Services/AuthNode.php b/app/Http/Admin/Services/AuthNode.php index d7757568..d6d5a126 100644 --- a/app/Http/Admin/Services/AuthNode.php +++ b/app/Http/Admin/Services/AuthNode.php @@ -13,14 +13,14 @@ class AuthNode extends Service $nodes[] = $this->getOperationNodes(); $nodes[] = $this->getFinanceNodes(); $nodes[] = $this->getUserNodes(); - $nodes[] = $this->getConfigNodes(); + $nodes[] = $this->getSettingNodes(); return $nodes; } protected function getContentNodes() { - $nodes = [ + return [ 'id' => '1', 'label' => '内容管理', 'child' => [ @@ -218,13 +218,11 @@ class AuthNode extends Service ], ], ]; - - return $nodes; } protected function getOperationNodes() { - $nodes = [ + return [ 'id' => '2', 'label' => '运营管理', 'child' => [ @@ -416,13 +414,11 @@ class AuthNode extends Service ], ], ]; - - return $nodes; } protected function getFinanceNodes() { - $nodes = [ + return [ 'id' => '3', 'label' => '财务管理', 'child' => [ @@ -521,13 +517,11 @@ class AuthNode extends Service ], ], ]; - - return $nodes; } protected function getUserNodes() { - $nodes = [ + return [ 'id' => '4', 'label' => '用户管理', 'child' => [ @@ -620,13 +614,11 @@ class AuthNode extends Service ], ], ]; - - return $nodes; } - protected function getConfigNodes() + protected function getSettingNodes() { - $nodes = [ + return [ 'id' => '5', 'label' => '系统配置', 'child' => [ @@ -639,68 +631,66 @@ class AuthNode extends Service 'id' => '5-1-1', 'label' => '网站设置', 'type' => 'menu', - 'route' => 'admin.config.site', + 'route' => 'admin.setting.site', ], [ 'id' => '5-1-2', 'label' => '密钥设置', 'type' => 'menu', - 'route' => 'admin.config.secret', + 'route' => 'admin.setting.secret', ], [ 'id' => '5-1-3', 'label' => '存储设置', 'type' => 'menu', - 'route' => 'admin.config.storage', + 'route' => 'admin.setting.storage', ], [ 'id' => '5-1-4', 'label' => '点播设置', 'type' => 'menu', - 'route' => 'admin.config.vod', + 'route' => 'admin.setting.vod', ], [ 'id' => '5-1-5', 'label' => '直播设置', 'type' => 'menu', - 'route' => 'admin.config.live', + 'route' => 'admin.setting.live', ], [ 'id' => '5-1-6', 'label' => '短信设置', 'type' => 'menu', - 'route' => 'admin.config.smser', + 'route' => 'admin.setting.smser', ], [ 'id' => '5-1-7', 'label' => '邮件设置', 'type' => 'menu', - 'route' => 'admin.config.mailer', + 'route' => 'admin.setting.mailer', ], [ 'id' => '5-1-8', 'label' => '验证码设置', 'type' => 'menu', - 'route' => 'admin.config.captcha', + 'route' => 'admin.setting.captcha', ], [ 'id' => '5-1-9', 'label' => '支付设置', 'type' => 'menu', - 'route' => 'admin.config.payment', + 'route' => 'admin.setting.payment', ], [ 'id' => '5-1-10', 'label' => '会员设置', 'type' => 'menu', - 'route' => 'admin.config.vip', + 'route' => 'admin.setting.vip', ] ], ], ], ]; - - return $nodes; } } diff --git a/app/Http/Admin/Services/Config.php b/app/Http/Admin/Services/Config.php deleted file mode 100644 index c2f5a59e..00000000 --- a/app/Http/Admin/Services/Config.php +++ /dev/null @@ -1,137 +0,0 @@ -findBySection($section); - - $result = new \stdClass(); - - if ($items->count() > 0) { - foreach ($items as $item) { - $result->{$item->item_key} = $item->item_value; - } - } - - return $result; - } - - public function updateSectionConfig($section, $config) - { - $configRepo = new ConfigRepo(); - - foreach ($config as $key => $value) { - $item = $configRepo->findItem($section, $key); - if ($item) { - $item->item_value = trim($value); - $item->update(); - } - } - - $cache = new SectionConfigCache(); - - $cache->rebuild($section); - } - - public function updateStorageConfig($section, $config) - { - $protocol = ['http://', 'https://']; - - if (isset($config['bucket_domain'])) { - $config['bucket_domain'] = str_replace($protocol, '', $config['bucket_domain']); - } - - if (isset($config['ci_domain'])) { - $config['ci_domain'] = str_replace($protocol, '', $config['ci_domain']); - } - - $this->updateSectionConfig($section, $config); - } - - public function updateVodConfig($section, $config) - { - $this->updateSectionConfig($section, $config); - } - - public function updateLiveConfig($section, $config) - { - $protocol = ['http://', 'https://']; - - if (isset($config['push_domain'])) { - $config['push_domain'] = str_replace($protocol, '', $config['push_domain']); - } - - if (isset($config['pull_domain'])) { - $config['pull_domain'] = str_replace($protocol, '', $config['pull_domain']); - } - - if (isset($config['ptt'])) { - - $ptt = $config['ptt']; - $keys = array_keys($ptt['id']); - $myPtt = []; - - foreach ($keys as $key) { - $myPtt[$key] = [ - 'id' => $ptt['id'][$key], - 'bit_rate' => $ptt['bit_rate'][$key], - 'summary' => $ptt['summary'][$key], - 'height' => $ptt['height'][$key], - ]; - } - - $config['pull_trans_template'] = kg_json_encode($myPtt); - } - - $this->updateSectionConfig($section, $config); - } - - public function updateSmserConfig($section, $config) - { - $template = $config['template']; - $keys = array_keys($template['id']); - $myTemplate = []; - - foreach ($keys as $key) { - $myTemplate[$key] = [ - 'id' => $template['id'][$key], - 'content' => $template['content'][$key], - ]; - } - - $config['template'] = kg_json_encode($myTemplate); - - $this->updateSectionConfig($section, $config); - } - - public function getVipConfig() - { - $vipRepo = new VipRepo(); - - $config = $vipRepo->findAll(['deleted' => 0]); - - return $config; - } - - public function updateVipConfig($items) - { - $vipRepo = new VipRepo(); - - foreach ($items as $id => $price) { - $vip = $vipRepo->findById($id); - $vip->price = $price; - $vip->update(); - } - } - -} diff --git a/app/Http/Admin/Services/Session.php b/app/Http/Admin/Services/Session.php index 04917606..64f0c4ff 100644 --- a/app/Http/Admin/Services/Session.php +++ b/app/Http/Admin/Services/Session.php @@ -27,9 +27,9 @@ class Session extends Service $user = $accountValidator->checkAdminLogin($post['account'], $post['password']); - $config = new Config(); + $setting = new Setting(); - $captcha = $config->getSectionConfig('captcha'); + $captcha = $setting->getSectionSettings('captcha'); $securityValidator = new SecurityValidator(); diff --git a/app/Http/Admin/Services/Setting.php b/app/Http/Admin/Services/Setting.php new file mode 100644 index 00000000..d742f256 --- /dev/null +++ b/app/Http/Admin/Services/Setting.php @@ -0,0 +1,135 @@ +findBySection($section); + + $result = new \stdClass(); + + if ($items->count() > 0) { + foreach ($items as $item) { + $result->{$item->item_key} = $item->item_value; + } + } + + return $result; + } + + public function updateSectionSettings($section, $settings) + { + $settingsRepo = new SettingRepo(); + + foreach ($settings as $key => $value) { + $item = $settingsRepo->findItem($section, $key); + if ($item) { + $item->item_value = trim($value); + $item->update(); + } + } + + $cache = new SettingCache(); + + $cache->rebuild($section); + } + + public function updateStorageSettings($section, $settings) + { + $protocol = ['http://', 'https://']; + + if (isset($settings['bucket_domain'])) { + $settings['bucket_domain'] = str_replace($protocol, '', $settings['bucket_domain']); + } + + if (isset($settings['ci_domain'])) { + $settings['ci_domain'] = str_replace($protocol, '', $settings['ci_domain']); + } + + $this->updateSectionSettings($section, $settings); + } + + public function updateVodSettings($section, $settings) + { + $this->updateSectionSettings($section, $settings); + } + + public function updateLiveSettings($section, $settings) + { + $protocol = ['http://', 'https://']; + + if (isset($settings['push_domain'])) { + $settings['push_domain'] = str_replace($protocol, '', $settings['push_domain']); + } + + if (isset($settings['pull_domain'])) { + $settings['pull_domain'] = str_replace($protocol, '', $settings['pull_domain']); + } + + if (isset($settings['ptt'])) { + + $ptt = $settings['ptt']; + $keys = array_keys($ptt['id']); + $myPtt = []; + + foreach ($keys as $key) { + $myPtt[$key] = [ + 'id' => $ptt['id'][$key], + 'bit_rate' => $ptt['bit_rate'][$key], + 'summary' => $ptt['summary'][$key], + 'height' => $ptt['height'][$key], + ]; + } + + $settings['pull_trans_template'] = kg_json_encode($myPtt); + } + + $this->updateSectionSettings($section, $settings); + } + + public function updateSmserSettings($section, $settings) + { + $template = $settings['template']; + $keys = array_keys($template['id']); + $myTemplate = []; + + foreach ($keys as $key) { + $myTemplate[$key] = [ + 'id' => $template['id'][$key], + 'content' => $template['content'][$key], + ]; + } + + $settings['template'] = kg_json_encode($myTemplate); + + $this->updateSectionSettings($section, $settings); + } + + public function getVipSettings() + { + $vipRepo = new VipRepo(); + + return $vipRepo->findAll(['deleted' => 0]); + } + + public function updateVipSettings($items) + { + $vipRepo = new VipRepo(); + + foreach ($items as $id => $price) { + $vip = $vipRepo->findById($id); + $vip->price = $price; + $vip->update(); + } + } + +} diff --git a/app/Http/Admin/Views/config/captcha.volt b/app/Http/Admin/Views/setting/captcha.volt similarity index 98% rename from app/Http/Admin/Views/config/captcha.volt rename to app/Http/Admin/Views/setting/captcha.volt index 5e1d8675..5f5bcfb5 100644 --- a/app/Http/Admin/Views/config/captcha.volt +++ b/app/Http/Admin/Views/setting/captcha.volt @@ -1,4 +1,4 @@ -
+
验证码配置 diff --git a/app/Http/Admin/Views/config/live.volt b/app/Http/Admin/Views/setting/live.volt similarity index 77% rename from app/Http/Admin/Views/config/live.volt rename to app/Http/Admin/Views/setting/live.volt index 5b8c1a00..2595d08b 100644 --- a/app/Http/Admin/Views/config/live.volt +++ b/app/Http/Admin/Views/setting/live.volt @@ -5,10 +5,10 @@
- {{ partial('config/live_push') }} + {{ partial('setting/live_push') }}
- {{ partial('config/live_pull') }} + {{ partial('setting/live_pull') }}
\ No newline at end of file diff --git a/app/Http/Admin/Views/config/live_pull.volt b/app/Http/Admin/Views/setting/live_pull.volt similarity index 99% rename from app/Http/Admin/Views/config/live_pull.volt rename to app/Http/Admin/Views/setting/live_pull.volt index 1070fa4f..88ddcaed 100644 --- a/app/Http/Admin/Views/config/live_pull.volt +++ b/app/Http/Admin/Views/setting/live_pull.volt @@ -1,4 +1,4 @@ - +
基础配置 diff --git a/app/Http/Admin/Views/config/live_pull_test.volt b/app/Http/Admin/Views/setting/live_pull_test.volt similarity index 100% rename from app/Http/Admin/Views/config/live_pull_test.volt rename to app/Http/Admin/Views/setting/live_pull_test.volt diff --git a/app/Http/Admin/Views/config/live_push.volt b/app/Http/Admin/Views/setting/live_push.volt similarity index 98% rename from app/Http/Admin/Views/config/live_push.volt rename to app/Http/Admin/Views/setting/live_push.volt index 5dddb607..bd4be6fc 100644 --- a/app/Http/Admin/Views/config/live_push.volt +++ b/app/Http/Admin/Views/setting/live_push.volt @@ -1,4 +1,4 @@ - +
基础配置 diff --git a/app/Http/Admin/Views/config/live_push_test.volt b/app/Http/Admin/Views/setting/live_push_test.volt similarity index 100% rename from app/Http/Admin/Views/config/live_push_test.volt rename to app/Http/Admin/Views/setting/live_push_test.volt diff --git a/app/Http/Admin/Views/config/mailer.volt b/app/Http/Admin/Views/setting/mailer.volt similarity index 99% rename from app/Http/Admin/Views/config/mailer.volt rename to app/Http/Admin/Views/setting/mailer.volt index 8f137664..75ba0318 100644 --- a/app/Http/Admin/Views/config/mailer.volt +++ b/app/Http/Admin/Views/setting/mailer.volt @@ -1,4 +1,4 @@ - +
邮件配置 diff --git a/app/Http/Admin/Views/config/payment.volt b/app/Http/Admin/Views/setting/payment.volt similarity index 75% rename from app/Http/Admin/Views/config/payment.volt rename to app/Http/Admin/Views/setting/payment.volt index 5a40fa92..39c6ba99 100644 --- a/app/Http/Admin/Views/config/payment.volt +++ b/app/Http/Admin/Views/setting/payment.volt @@ -5,10 +5,10 @@
- {{ partial('config/payment_alipay') }} + {{ partial('setting/payment_alipay') }}
- {{ partial('config/payment_wxpay') }} + {{ partial('setting/payment_wxpay') }}
\ No newline at end of file diff --git a/app/Http/Admin/Views/config/payment_alipay.volt b/app/Http/Admin/Views/setting/payment_alipay.volt similarity index 98% rename from app/Http/Admin/Views/config/payment_alipay.volt rename to app/Http/Admin/Views/setting/payment_alipay.volt index d7ab9705..c91a8de3 100644 --- a/app/Http/Admin/Views/config/payment_alipay.volt +++ b/app/Http/Admin/Views/setting/payment_alipay.volt @@ -1,4 +1,4 @@ - +
diff --git a/app/Http/Admin/Views/config/payment_alipay_test.volt b/app/Http/Admin/Views/setting/payment_alipay_test.volt similarity index 100% rename from app/Http/Admin/Views/config/payment_alipay_test.volt rename to app/Http/Admin/Views/setting/payment_alipay_test.volt diff --git a/app/Http/Admin/Views/config/payment_wxpay.volt b/app/Http/Admin/Views/setting/payment_wxpay.volt similarity index 98% rename from app/Http/Admin/Views/config/payment_wxpay.volt rename to app/Http/Admin/Views/setting/payment_wxpay.volt index 1da1fc3d..5cc76cca 100644 --- a/app/Http/Admin/Views/config/payment_wxpay.volt +++ b/app/Http/Admin/Views/setting/payment_wxpay.volt @@ -1,4 +1,4 @@ - +
diff --git a/app/Http/Admin/Views/config/payment_wxpay_test.volt b/app/Http/Admin/Views/setting/payment_wxpay_test.volt similarity index 100% rename from app/Http/Admin/Views/config/payment_wxpay_test.volt rename to app/Http/Admin/Views/setting/payment_wxpay_test.volt diff --git a/app/Http/Admin/Views/config/secret.volt b/app/Http/Admin/Views/setting/secret.volt similarity index 96% rename from app/Http/Admin/Views/config/secret.volt rename to app/Http/Admin/Views/setting/secret.volt index bd154a6c..57976e73 100644 --- a/app/Http/Admin/Views/config/secret.volt +++ b/app/Http/Admin/Views/setting/secret.volt @@ -1,4 +1,4 @@ - +
密钥配置 diff --git a/app/Http/Admin/Views/config/site.volt b/app/Http/Admin/Views/setting/site.volt similarity index 98% rename from app/Http/Admin/Views/config/site.volt rename to app/Http/Admin/Views/setting/site.volt index dabcae6c..a390eb79 100644 --- a/app/Http/Admin/Views/config/site.volt +++ b/app/Http/Admin/Views/setting/site.volt @@ -1,4 +1,4 @@ - +
站点配置 diff --git a/app/Http/Admin/Views/config/smser.volt b/app/Http/Admin/Views/setting/smser.volt similarity index 98% rename from app/Http/Admin/Views/config/smser.volt rename to app/Http/Admin/Views/setting/smser.volt index 524cf4c5..415bf4ec 100644 --- a/app/Http/Admin/Views/config/smser.volt +++ b/app/Http/Admin/Views/setting/smser.volt @@ -1,4 +1,4 @@ - +
基础配置 diff --git a/app/Http/Admin/Views/config/storage.volt b/app/Http/Admin/Views/setting/storage.volt similarity index 98% rename from app/Http/Admin/Views/config/storage.volt rename to app/Http/Admin/Views/setting/storage.volt index 296a858d..98cdb728 100644 --- a/app/Http/Admin/Views/config/storage.volt +++ b/app/Http/Admin/Views/setting/storage.volt @@ -1,4 +1,4 @@ - +
存储桶配置 diff --git a/app/Http/Admin/Views/config/vip.volt b/app/Http/Admin/Views/setting/vip.volt similarity index 95% rename from app/Http/Admin/Views/config/vip.volt rename to app/Http/Admin/Views/setting/vip.volt index 59da0590..c065fbd9 100644 --- a/app/Http/Admin/Views/config/vip.volt +++ b/app/Http/Admin/Views/setting/vip.volt @@ -1,4 +1,4 @@ - +
会员设置 diff --git a/app/Http/Admin/Views/config/vod.volt b/app/Http/Admin/Views/setting/vod.volt similarity index 99% rename from app/Http/Admin/Views/config/vod.volt rename to app/Http/Admin/Views/setting/vod.volt index 46ad41b5..85080108 100644 --- a/app/Http/Admin/Views/config/vod.volt +++ b/app/Http/Admin/Views/setting/vod.volt @@ -1,4 +1,4 @@ - +
存储配置 diff --git a/app/Http/Api/Controllers/IndexController.php b/app/Http/Api/Controllers/IndexController.php index aae9808f..b7c9f968 100644 --- a/app/Http/Api/Controllers/IndexController.php +++ b/app/Http/Api/Controllers/IndexController.php @@ -13,7 +13,7 @@ class IndexController extends Controller */ public function indexAction() { - + return $this->jsonSuccess(['data' => 'ok']); } /** diff --git a/app/Http/Web/Controllers/Controller.php b/app/Http/Web/Controllers/Controller.php index f8af2b2e..1fee24b3 100644 --- a/app/Http/Web/Controllers/Controller.php +++ b/app/Http/Web/Controllers/Controller.php @@ -3,7 +3,7 @@ namespace App\Http\Web\Controllers; use App\Caches\NavTreeList as NavTreeListCache; -use App\Caches\SectionConfig as SectionConfigCache; +use App\Caches\Setting as SettingCache; use App\Services\Auth\Web as WebAuth; use App\Traits\Response as ResponseTrait; use App\Traits\Security as SecurityTrait; @@ -12,7 +12,7 @@ use Phalcon\Mvc\Dispatcher; class Controller extends \Phalcon\Mvc\Controller { - protected $siteConfig; + protected $siteSettings; protected $navList; protected $authUser; @@ -38,7 +38,7 @@ class Controller extends \Phalcon\Mvc\Controller } } - $this->siteConfig = $this->getSiteConfig(); + $this->siteSettings = $this->getSiteSettings(); $this->navList = $this->getNavList(); $this->authUser = $this->getAuthUser(); @@ -48,7 +48,7 @@ class Controller extends \Phalcon\Mvc\Controller public function initialize() { $this->view->setVar('auth_user', $this->authUser); - $this->view->setVar('site_config', $this->siteConfig); + $this->view->setVar('site_settings', $this->siteSettings); $this->view->setVar('top_nav_list', $this->navList['top']); $this->view->setVar('btm_nav_list', $this->navList['bottom']); } @@ -70,11 +70,11 @@ class Controller extends \Phalcon\Mvc\Controller return $treeListCache->get(); } - protected function getSiteConfig() + protected function getSiteSettings() { - $sectionCache = new SectionConfigCache(); + $settingCache = new SettingCache(); - return $sectionCache->get('site'); + return $settingCache->get('site'); } } diff --git a/app/Listeners/Listener.php b/app/Listeners/Listener.php index dfbb0b19..79691cbb 100644 --- a/app/Listeners/Listener.php +++ b/app/Listeners/Listener.php @@ -2,7 +2,7 @@ namespace App\Listeners; -use App\Caches\SectionConfig as SectionConfigCache; +use App\Caches\Setting as SectionConfigCache; use App\Library\Logger as AppLogger; use Phalcon\Logger\Adapter\File as FileLogger; use Phalcon\Mvc\User\Plugin as UserPlugin; @@ -31,7 +31,7 @@ class Listener extends UserPlugin * @param string $section * @return array */ - public function getSectionConfig($section) + public function getSectionSettings($section) { $cache = new SectionConfigCache(); diff --git a/app/Models/Config.php b/app/Models/Setting.php similarity index 87% rename from app/Models/Config.php rename to app/Models/Setting.php index 777f4af2..327ce3e9 100644 --- a/app/Models/Config.php +++ b/app/Models/Setting.php @@ -2,7 +2,7 @@ namespace App\Models; -class Config extends Model +class Setting extends Model { /** @@ -35,7 +35,7 @@ class Config extends Model public function getSource() { - return 'kg_config'; + return 'kg_setting'; } } diff --git a/app/Repos/Config.php b/app/Repos/Setting.php similarity index 72% rename from app/Repos/Config.php rename to app/Repos/Setting.php index 7319f236..04a6bc0f 100644 --- a/app/Repos/Config.php +++ b/app/Repos/Setting.php @@ -2,21 +2,21 @@ namespace App\Repos; -use App\Models\Config as ConfigModel; +use App\Models\Setting as SettingModel; use Phalcon\Mvc\Model; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; -class Config extends Repository +class Setting extends Repository { /** * @param array $where - * @return Resultset|ResultsetInterface|ConfigModel[] + * @return ResultsetInterface|Resultset|SettingModel[] */ public function findAll($where = []) { - $query = ConfigModel::query(); + $query = SettingModel::query(); $query->where('1 = 1'); @@ -30,11 +30,11 @@ class Config extends Repository /** * @param string $section * @param string $itemKey - * @return ConfigModel|Model|bool + * @return SettingModel|Model|bool */ public function findItem($section, $itemKey) { - return ConfigModel::findFirst([ + return SettingModel::findFirst([ 'conditions' => 'section = :section: AND item_key = :item_key:', 'bind' => ['section' => $section, 'item_key' => $itemKey], ]); @@ -42,11 +42,11 @@ class Config extends Repository /** * @param string $section - * @return Resultset|ResultsetInterface|ConfigModel[] + * @return ResultsetInterface|Resultset|SettingModel[] */ public function findBySection($section) { - $query = ConfigModel::query(); + $query = SettingModel::query(); $query->where('section = :section:', ['section' => $section]); diff --git a/app/Services/Captcha.php b/app/Services/Captcha.php index 489be400..26278718 100644 --- a/app/Services/Captcha.php +++ b/app/Services/Captcha.php @@ -18,7 +18,7 @@ class Captcha extends Service /** * @var array */ - protected $config; + protected $settings; /** * @var FileLogger @@ -32,7 +32,7 @@ class Captcha extends Service public function __construct() { - $this->config = $this->getSectionConfig('captcha'); + $this->settings = $this->getSectionSettings('captcha'); $this->logger = $this->getLogger('captcha'); @@ -50,8 +50,8 @@ class Captcha extends Service { $userIp = $this->request->getClientAddress(); - $appId = $this->config['app_id']; - $secretKey = $this->config['secret_key']; + $appId = $this->settings['app_id']; + $secretKey = $this->settings['secret_key']; $captchaType = 9; try { @@ -103,12 +103,12 @@ class Captcha extends Service */ public function getCaptchaClient() { - $secret = $this->getSectionConfig('secret'); + $secret = $this->getSectionSettings('secret'); $secretId = $secret['secret_id']; $secretKey = $secret['secret_key']; - $region = $this->config['region'] ?? 'ap-guangzhou'; + $region = $this->settings['region'] ?? 'ap-guangzhou'; $credential = new Credential($secretId, $secretKey); diff --git a/app/Services/Live.php b/app/Services/Live.php index 911783e9..14390814 100644 --- a/app/Services/Live.php +++ b/app/Services/Live.php @@ -8,11 +8,11 @@ class Live extends Service /** * @var array */ - protected $config; + protected $settings; public function __construct() { - $this->config = $this->getSectionConfig('live'); + $this->settings = $this->getSectionSettings('live'); } /** @@ -23,10 +23,10 @@ class Live extends Service */ function getPushUrl($streamName) { - $authEnabled = $this->config['push_auth_enabled']; - $authKey = $this->config['push_auth_key']; - $expireTime = $this->config['push_auth_delta'] + time(); - $domain = $this->config['push_domain']; + $authEnabled = $this->settings['push_auth_enabled']; + $authKey = $this->settings['push_auth_key']; + $expireTime = $this->settings['push_auth_delta'] + time(); + $domain = $this->settings['push_domain']; $appName = 'live'; $authParams = $this->getAuthParams($streamName, $authKey, $expireTime); @@ -56,12 +56,12 @@ class Live extends Service $appName = 'live'; - $protocol = $this->config['pull_protocol']; - $domain = $this->config['pull_domain']; - $authEnabled = $this->config['pull_auth_enabled']; - $transEnabled = $this->config['pull_trans_enabled']; - $authKey = $this->config['pull_auth_key']; - $expireTime = $this->config['pull_auth_delta'] + time(); + $protocol = $this->settings['pull_protocol']; + $domain = $this->settings['pull_domain']; + $authEnabled = $this->settings['pull_auth_enabled']; + $transEnabled = $this->settings['pull_trans_enabled']; + $authKey = $this->settings['pull_auth_key']; + $expireTime = $this->settings['pull_auth_delta'] + time(); $urls = []; diff --git a/app/Services/Mailer.php b/app/Services/Mailer.php index 14ff760a..1356a61e 100644 --- a/app/Services/Mailer.php +++ b/app/Services/Mailer.php @@ -30,7 +30,7 @@ abstract class Mailer extends Service */ protected function getManager() { - $opt = $this->getSectionConfig('mailer'); + $opt = $this->getSectionSettings('mailer'); $config = [ 'driver' => 'smtp', diff --git a/app/Services/Payment/Alipay.php b/app/Services/Payment/Alipay.php index 0a35fa86..39ea4647 100644 --- a/app/Services/Payment/Alipay.php +++ b/app/Services/Payment/Alipay.php @@ -16,7 +16,7 @@ class Alipay extends Payment /** * @var array */ - protected $config; + protected $settings; /** * @var \Yansongda\Pay\Gateways\Alipay @@ -25,7 +25,7 @@ class Alipay extends Payment public function __construct() { - $this->config = $this->getSectionConfig('payment.alipay'); + $this->settings = $this->getSectionSettings('payment.alipay'); $this->gateway = $this->getGateway(); } @@ -86,7 +86,7 @@ class Alipay extends Payment return false; } - if ($data->app_id != $this->config['app_id']) { + if ($data->app_id != $this->settings['app_id']) { return false; } @@ -245,10 +245,10 @@ class Alipay extends Payment $level = $config->env == ENV_DEV ? 'debug' : 'info'; $payConfig = [ - 'app_id' => $this->config['app_id'], - 'ali_public_key' => $this->config['public_key'], - 'private_key' => $this->config['private_key'], - 'notify_url' => $this->config['notify_url'], + 'app_id' => $this->settings['app_id'], + 'ali_public_key' => $this->settings['public_key'], + 'private_key' => $this->settings['private_key'], + 'notify_url' => $this->settings['notify_url'], 'log' => [ 'file' => log_path('alipay.log'), 'level' => $level, diff --git a/app/Services/Payment/Wxpay.php b/app/Services/Payment/Wxpay.php index 30a5e33f..1bb2272d 100644 --- a/app/Services/Payment/Wxpay.php +++ b/app/Services/Payment/Wxpay.php @@ -17,7 +17,7 @@ class Wxpay extends Payment /** * @var array */ - protected $config; + protected $settings; /** * @var Wechat @@ -26,7 +26,7 @@ class Wxpay extends Payment public function __construct() { - $this->config = $this->getSectionConfig('payment.wxpay'); + $this->settings = $this->getSectionSettings('payment.wxpay'); $this->gateway = $this->getGateway(); } @@ -87,7 +87,7 @@ class Wxpay extends Payment return false; } - if ($data->mch_id != $this->config['mch_id']) { + if ($data->mch_id != $this->settings['mch_id']) { return false; } @@ -227,10 +227,10 @@ class Wxpay extends Payment $level = $config->env == ENV_DEV ? 'debug' : 'info'; $payConfig = [ - 'app_id' => $this->config['app_id'], - 'mch_id' => $this->config['mch_id'], - 'key' => $this->config['key'], - 'notify_url' => $this->config['notify_url'], + 'app_id' => $this->settings['app_id'], + 'mch_id' => $this->settings['mch_id'], + 'key' => $this->settings['key'], + 'notify_url' => $this->settings['notify_url'], 'log' => [ 'file' => log_path('wxpay.log'), 'level' => $level, diff --git a/app/Services/Service.php b/app/Services/Service.php index 6a999a7f..0db74d39 100644 --- a/app/Services/Service.php +++ b/app/Services/Service.php @@ -2,7 +2,7 @@ namespace App\Services; -use App\Caches\SectionConfig as SectionConfigCache; +use App\Caches\Setting as SettingCache; use App\Library\Logger as AppLogger; use App\Traits\Auth as AuthTrait; use Phalcon\Logger\Adapter\File as FileLogger; @@ -34,11 +34,11 @@ class Service extends Component * @param string $section * @return array */ - public function getSectionConfig($section) + public function getSectionSettings($section) { - $cache = new SectionConfigCache(); + $settingCache = new SettingCache(); - return $cache->get($section); + return $settingCache->get($section); } } diff --git a/app/Services/Smser.php b/app/Services/Smser.php index e94a9d8a..0f3bfb58 100644 --- a/app/Services/Smser.php +++ b/app/Services/Smser.php @@ -11,7 +11,7 @@ Abstract class Smser extends Service /** * @var array */ - protected $config; + protected $settings; /** * @var FileLogger @@ -20,7 +20,7 @@ Abstract class Smser extends Service public function __construct() { - $this->config = $this->getSectionConfig('smser'); + $this->settings = $this->getSectionSettings('smser'); $this->logger = $this->getLogger('smser'); } @@ -64,19 +64,19 @@ Abstract class Smser extends Service protected function createSingleSender() { - return new SmsSingleSender($this->config['app_id'], $this->config['app_key']); + return new SmsSingleSender($this->settings['app_id'], $this->settings['app_key']); } protected function getTemplateId($code) { - $template = json_decode($this->config['template'], true); + $template = json_decode($this->settings['template'], true); return $template[$code]['id'] ?? null; } protected function getSignature() { - return $this->config['signature']; + return $this->settings['signature']; } } diff --git a/app/Services/Storage.php b/app/Services/Storage.php index f257e889..15143f5c 100644 --- a/app/Services/Storage.php +++ b/app/Services/Storage.php @@ -12,7 +12,7 @@ class Storage extends Service /** * @var array */ - protected $config; + protected $settings; /** * @var FileLogger @@ -26,7 +26,7 @@ class Storage extends Service public function __construct() { - $this->config = $this->getSectionConfig('storage'); + $this->settings = $this->getSectionSettings('storage'); $this->logger = $this->getLogger('storage'); @@ -125,7 +125,7 @@ class Storage extends Service */ public function putString($key, $body) { - $bucket = $this->config['bucket_name']; + $bucket = $this->settings['bucket_name']; try { @@ -155,7 +155,7 @@ class Storage extends Service */ public function putFile($key, $fileName) { - $bucket = $this->config['bucket_name']; + $bucket = $this->settings['bucket_name']; try { @@ -208,8 +208,8 @@ class Storage extends Service */ public function getBucketBaseUrl() { - $protocol = $this->config['bucket_protocol']; - $domain = $this->config['bucket_domain']; + $protocol = $this->settings['bucket_protocol']; + $domain = $this->settings['bucket_domain']; return $protocol . '://' . $domain; } @@ -221,8 +221,8 @@ class Storage extends Service */ public function getCiBaseUrl() { - $protocol = $this->config['ci_protocol']; - $domain = $this->config['ci_domain']; + $protocol = $this->settings['ci_protocol']; + $domain = $this->settings['ci_domain']; return $protocol . '://' . $domain; } @@ -261,11 +261,11 @@ class Storage extends Service */ public function getCosClient() { - $secret = $this->getSectionConfig('secret'); + $secret = $this->getSectionSettings('secret'); return new CosClient([ - 'region' => $this->config['bucket_region'], - 'schema' => $this->config['bucket_protocol'], + 'region' => $this->settings['bucket_region'], + 'schema' => $this->settings['bucket_protocol'], 'credentials' => [ 'secretId' => $secret['secret_id'], 'secretKey' => $secret['secret_key'], diff --git a/app/Services/Vod.php b/app/Services/Vod.php index 34bfdc4e..d4f653de 100644 --- a/app/Services/Vod.php +++ b/app/Services/Vod.php @@ -23,7 +23,7 @@ class Vod extends Service /** * @var array */ - protected $config; + protected $settings; /** * @var VodClient @@ -37,7 +37,7 @@ class Vod extends Service public function __construct() { - $this->config = $this->getSectionConfig('vod'); + $this->settings = $this->getSectionSettings('vod'); $this->logger = $this->getLogger('vod'); @@ -86,7 +86,7 @@ class Vod extends Service */ public function getUploadSignature() { - $secret = $this->getSectionConfig('secret'); + $secret = $this->getSectionSettings('secret'); $secretId = $secret['secret_id']; $secretKey = $secret['secret_key']; @@ -152,12 +152,12 @@ class Vod extends Service */ public function getPlayUrl($url) { - if ($this->config['key_anti_enabled'] == 0) { + if ($this->settings['key_anti_enabled'] == 0) { return $url; } - $key = $this->config['key_anti_key']; - $expiry = $this->config['key_anti_expiry'] ?: 10800; + $key = $this->settings['key_anti_key']; + $expiry = $this->settings['key_anti_expiry'] ?: 10800; $path = parse_url($url, PHP_URL_PATH); $pos = strrpos($path, '/'); @@ -574,8 +574,8 @@ class Vod extends Service { $result = null; - if ($this->config['watermark_enabled'] && $this->config['watermark_template'] > 0) { - $result = (int)$this->config['watermark_template']; + if ($this->settings['watermark_enabled'] && $this->settings['watermark_template'] > 0) { + $result = (int)$this->settings['watermark_template']; } return $result; @@ -600,7 +600,7 @@ class Vod extends Service 30 => ['width' => 1280, 'bit_rate' => 1024, 'frame_rate' => 25], ]; - $format = $this->config['video_format']; + $format = $this->settings['video_format']; return $format == 'hls' ? $hls : $mp4; } @@ -621,7 +621,7 @@ class Vod extends Service 1010 => ['bit_rate' => 128, 'sample_rate' => 44100], ]; - return $this->config['audio_format'] == 'm4a' ? $m4a : $mp3; + return $this->settings['audio_format'] == 'm4a' ? $m4a : $mp3; } /** @@ -631,12 +631,12 @@ class Vod extends Service */ public function getVodClient() { - $secret = $this->getSectionConfig('secret'); + $secret = $this->getSectionSettings('secret'); $secretId = $secret['secret_id']; $secretKey = $secret['secret_key']; - $region = $this->config['storage_type'] == 'fixed' ? $this->config['storage_region'] : ''; + $region = $this->settings['storage_type'] == 'fixed' ? $this->settings['storage_region'] : ''; $credential = new Credential($secretId, $secretKey);