diff --git a/app/Caches/IndexLiveCourseList.php b/app/Caches/IndexLiveList.php similarity index 97% rename from app/Caches/IndexLiveCourseList.php rename to app/Caches/IndexLiveList.php index da6e38d6..26bc5c30 100644 --- a/app/Caches/IndexLiveCourseList.php +++ b/app/Caches/IndexLiveList.php @@ -11,10 +11,10 @@ use Phalcon\Mvc\Model\Resultset; /** * 直播课程 * - * Class IndexLiveCourseList + * Class IndexLiveList * @package App\Caches */ -class IndexLiveCourseList extends Cache +class IndexLiveList extends Cache { protected $lifetime = 1 * 86400; @@ -26,7 +26,7 @@ class IndexLiveCourseList extends Cache public function getKey($id = null) { - return 'index_live_course_list'; + return 'index_live_list'; } public function getContent($id = null) diff --git a/app/Http/Admin/Services/ChapterContent.php b/app/Http/Admin/Services/ChapterContent.php index 5c23820c..548f337e 100644 --- a/app/Http/Admin/Services/ChapterContent.php +++ b/app/Http/Admin/Services/ChapterContent.php @@ -2,7 +2,7 @@ namespace App\Http\Admin\Services; -use App\Library\Util\Word as WordUtil; +use App\Library\Utils\Word as WordUtil; use App\Models\Chapter as ChapterModel; use App\Models\Course as CourseModel; use App\Repos\Chapter as ChapterRepo; diff --git a/app/Http/Admin/Services/Session.php b/app/Http/Admin/Services/Session.php index 90268ad1..2394908f 100644 --- a/app/Http/Admin/Services/Session.php +++ b/app/Http/Admin/Services/Session.php @@ -21,22 +21,27 @@ class Session extends Service public function login() { + $currentUser = $this->getCurrentUser(); + + if ($currentUser->id > 0) { + $this->response->redirect(['for' => 'web.index']); + } + $post = $this->request->getPost(); $accountValidator = new AccountValidator(); $user = $accountValidator->checkAdminLogin($post['account'], $post['password']); - $setting = new Setting(); - - $captcha = $setting->getSectionSettings('captcha'); - - $captchaValidator = new CaptchaValidator(); + $captchaSettings = $this->getSectionSettings('captcha'); /** * 验证码是一次性的,放到最后检查,减少第三方调用 */ - if ($captcha->enabled) { + if ($captchaSettings['enabled'] == 1) { + + $captchaValidator = new CaptchaValidator(); + $captchaValidator->checkCode($post['ticket'], $post['rand']); } diff --git a/app/Http/Admin/Views/public/live_player.volt b/app/Http/Admin/Views/public/live_player.volt index cbd37f4f..aad6007c 100644 --- a/app/Http/Admin/Views/public/live_player.volt +++ b/app/Http/Admin/Views/public/live_player.volt @@ -1,5 +1,5 @@ - + diff --git a/app/Http/Web/Controllers/AccountController.php b/app/Http/Web/Controllers/AccountController.php index bfd536e5..50776a8a 100644 --- a/app/Http/Web/Controllers/AccountController.php +++ b/app/Http/Web/Controllers/AccountController.php @@ -3,6 +3,10 @@ namespace App\Http\Web\Controllers; use App\Http\Web\Services\Account as AccountService; +use App\Services\Frontend\Account\EmailUpdate as EmailUpdateService; +use App\Services\Frontend\Account\PasswordReset as PasswordResetService; +use App\Services\Frontend\Account\PasswordUpdate as PasswordUpdateService; +use App\Services\Frontend\Account\PhoneUpdate as PhoneUpdateService; /** * @RoutePrefix("/account") @@ -11,17 +15,52 @@ class AccountController extends Controller { /** - * @Post("/register", name="web.account.register") + * @Route("/login", name="web.account.login") */ - public function registerAction() + public function loginAction() + { + if ($this->request->isPost()) { + + $service = new AccountService(); + + $service->login(); + + $location = $this->request->getHTTPReferer(); + + return $this->jsonSuccess(['location' => $location]); + } + } + + /** + * @Route("/logout", name="web.account.logout") + */ + public function logoutAction() { $service = new AccountService(); - $service->signup(); + $service->logout(); - $location = $this->request->getHTTPReferer(); + $this->response->redirect(['for' => 'web.index']); + } - $this->response->redirect($location); + /** + * @Route("/register", name="web.account.register") + */ + public function registerAction() + { + if ($this->request->isPost()) { + + $service = new AccountService(); + + $service->register(); + + $location = $this->request->getHTTPReferer(); + + return $this->jsonSuccess([ + 'location' => $location, + 'msg' => '注册账户成功', + ]); + } } /** @@ -29,47 +68,59 @@ class AccountController extends Controller */ public function resetPasswordAction() { - $service = new AccountService(); + if ($this->request->isPost()) { - $service->resetPassword(); + $service = new PasswordResetService(); - return $this->jsonSuccess(); + $service->handle(); + + return $this->jsonSuccess(['msg' => '重置密码成功']); + } } /** - * @Post("/phone/update", name="web.account.update_phone") + * @Route("/phone/update", name="web.account.update_phone") */ public function updatePhoneAction() { - $service = new AccountService(); + if ($this->request->isPost()) { - $service->updateMobile(); + $service = new PhoneUpdateService(); - return $this->jsonSuccess(); + $service->handle(); + + return $this->jsonSuccess(['msg' => '更新手机成功']); + } } /** - * @Post("/email/update", name="web.account.update_email") + * @Route("/email/update", name="web.account.update_email") */ public function updateEmailAction() { - $service = new AccountService(); + if ($this->request->isPost()) { - $service->updateMobile(); + $service = new EmailUpdateService(); - return $this->jsonSuccess(); + $service->handle(); + + return $this->jsonSuccess(['msg' => '更新邮箱成功']); + } } /** - * @Post("/password/update", name="web.account.update_password") + * @Route("/password/update", name="web.account.update_password") */ public function updatePasswordAction() { - $service = new AccountService(); + if ($this->request->isPost()) { - $service->updatePassword(); + $service = new PasswordUpdateService(); - return $this->jsonSuccess(); + $service->handle(); + + return $this->jsonSuccess(['msg' => '更新密码成功']); + } } } diff --git a/app/Http/Web/Controllers/CourseController.php b/app/Http/Web/Controllers/CourseController.php index ebbaeb61..80f88380 100644 --- a/app/Http/Web/Controllers/CourseController.php +++ b/app/Http/Web/Controllers/CourseController.php @@ -2,11 +2,13 @@ namespace App\Http\Web\Controllers; -use App\Services\Frontend\Course as CourseService; -use App\Services\Frontend\CourseList as CourseListService; -use App\Services\Frontend\CourseRelated as CourseRelatedService; -use App\Services\Frontend\Favorite as CourseFavoriteService; -use App\Services\Frontend\ReviewCreate as CourseReviewService; +use App\Http\Web\Services\Course as CourseService; +use App\Services\Frontend\Course\ConsultList as CourseConsultListService; +use App\Services\Frontend\Course\CourseFavorite as CourseFavoriteService; +use App\Services\Frontend\Course\CourseInfo as CourseInfoService; +use App\Services\Frontend\Course\CourseList as CourseListService; +use App\Services\Frontend\Course\CourseRelated as CourseRelatedService; +use App\Services\Frontend\Course\ReviewList as CourseReviewListService; /** * @RoutePrefix("/course") @@ -21,10 +23,19 @@ class CourseController extends Controller { $courseListService = new CourseListService(); - $pager = $courseListService->getCourses(); + $pager = $courseListService->handle(); - return $this->jsonSuccess(['pager' => $pager]); + $courseService = new CourseService(); + $topCategories = $courseService->handleTopCategories(); + $subCategories = $courseService->handleSubCategories(); + $levels = $courseService->handleLevels(); + + dd($topCategories, $subCategories, $levels); + + $this->view->setVar('top_categories', $topCategories); + $this->view->setVar('sub_categories', $subCategories); + $this->view->setVar('levels', $levels); $this->view->setVar('pager', $pager); } @@ -33,27 +44,28 @@ class CourseController extends Controller */ public function showAction($id) { - $courseService = new CourseService(); + $courseInfoService = new CourseInfoService(); - $course = $courseService->getCourse($id); + $courseInfo = $courseInfoService->handle($id); - return $this->jsonSuccess(['course' => $course]); + $courseRelatedService = new CourseRelatedService(); - $this->view->setVar('course', $course); + $relatedCourses = $courseRelatedService->handle($id); + + $this->view->setVar('course_info', $courseInfo); + $this->view->setVar('related_courses', $relatedCourses); } /** - * @Get("/{id:[0-9]+}/related", name="web.course.related") + * @Get("/{id:[0-9]+}/consults", name="web.course.consults") */ - public function relatedAction($id) + public function consultsAction($id) { - $relatedService = new CourseRelatedService(); + $consultListService = new CourseConsultListService(); - $courses = $relatedService->getRelated($id); + $pager = $consultListService->handle($id); - return $this->jsonSuccess(['courses' => $courses]); - - $this->view->setVar('course', $course); + $this->view->setVar('pager', $pager); } /** @@ -61,11 +73,9 @@ class CourseController extends Controller */ public function reviewsAction($id) { - $reviewService = new CourseReviewService(); + $reviewListService = new CourseReviewListService(); - $pager = $reviewService->getReviews($id); - - return $this->jsonSuccess(['pager' => $pager]); + $pager = $reviewListService->handle($id); $this->view->setVar('pager', $pager); } @@ -77,9 +87,9 @@ class CourseController extends Controller { $favoriteService = new CourseFavoriteService(); - $favoriteService->saveFavorite($id); + $favoriteService->handle($id); - return $this->response->ajaxSuccess(); + return $this->jsonSuccess(['msg' => '收藏课程成功']); } } diff --git a/app/Http/Web/Controllers/IndexController.php b/app/Http/Web/Controllers/IndexController.php index 3a1453a5..cdf6a988 100644 --- a/app/Http/Web/Controllers/IndexController.php +++ b/app/Http/Web/Controllers/IndexController.php @@ -2,6 +2,8 @@ namespace App\Http\Web\Controllers; +use App\Http\Web\Services\Index as IndexService; + class IndexController extends Controller { @@ -12,6 +14,14 @@ class IndexController extends Controller { $this->siteSeo->setKeywords($this->siteSettings['keywords']); $this->siteSeo->setDescription($this->siteSettings['description']); + + $indexService = new IndexService(); + + $this->view->setVar('slide_list', $indexService->getSlideList()); + $this->view->setVar('live_list', $indexService->getLiveList()); + $this->view->setVar('new_course_list', $indexService->getNewCourseList()); + $this->view->setVar('free_course_list', $indexService->getFreeCourseList()); + $this->view->setVar('vip_course_list', $indexService->getVipCourseList()); } } diff --git a/app/Http/Web/Controllers/SessionController.php b/app/Http/Web/Controllers/SessionController.php deleted file mode 100644 index 92f7ee53..00000000 --- a/app/Http/Web/Controllers/SessionController.php +++ /dev/null @@ -1,39 +0,0 @@ -login(); - - $location = $this->request->getHTTPReferer(); - - $this->response->redirect($location); - } - - /** - * @Get("/logout", name="web.account.logout") - */ - public function logoutAction() - { - $service = new AccountService(); - - $service->logout(); - - $this->response->redirect(['for' => 'web.index']); - } - -} diff --git a/app/Http/Web/Services/Account.php b/app/Http/Web/Services/Account.php new file mode 100644 index 00000000..f9f6d174 --- /dev/null +++ b/app/Http/Web/Services/Account.php @@ -0,0 +1,60 @@ +auth = $this->getDI()->get('auth'); + } + + public function login() + { + $post = $this->request->getPost(); + + $accountValidator = new AccountValidator(); + + $user = $accountValidator->checkUserLogin($post['account'], $post['password']); + + $captchaSettings = $this->getSectionSettings('captcha'); + + /** + * 验证码是一次性的,放到最后检查,减少第三方调用 + */ + if ($captchaSettings['enabled'] == 1) { + + $captchaValidator = new CaptchaValidator(); + + $captchaValidator->checkCode($post['ticket'], $post['rand']); + } + + $this->auth->saveAuthInfo($user); + } + + public function logout() + { + $this->auth->clearAuthInfo(); + } + + public function register() + { + $service = new RegisterService(); + + $user = $service->handle(); + + $this->auth->saveAuthInfo($user); + } + +} diff --git a/app/Http/Web/Services/Course.php b/app/Http/Web/Services/Course.php new file mode 100644 index 00000000..f6b43d8e --- /dev/null +++ b/app/Http/Web/Services/Course.php @@ -0,0 +1,161 @@ +getQueryParams(); + + if (isset($params['tc'])) { + unset($params['tc']); + } + + if (isset($params['sc'])) { + unset($params['sc']); + } + + $baseUrl = $this->url->get(['for' => 'web.course.list']); + + $defaultItem = [ + 'id' => 0, + 'name' => '全部', + 'href' => $baseUrl . $this->buildQueryParams($params), + ]; + + $result = []; + + $result[] = $defaultItem; + + $categoryService = new CategoryService(); + + $topCategories = $categoryService->getChildCategories(0); + + foreach ($topCategories as $key => $category) { + $params['tc'] = $category['id']; + $result[] = [ + 'id' => $category['id'], + 'name' => $category['name'], + 'href' => $baseUrl . $this->buildQueryParams($params), + ]; + } + + return $result; + } + + public function handleSubCategories() + { + $params = $this->getQueryParams(); + + if (empty($params['tc'])) { + return []; + } + + $categoryService = new CategoryService(); + + $subCategories = $categoryService->getChildCategories($params['tc']); + + if (empty($subCategories)) { + return []; + } + + if (isset($params['sc'])) { + unset($params['sc']); + } + + $baseUrl = $this->url->get(['for' => 'web.course.list']); + + $defaultItem = [ + 'id' => 0, + 'name' => '全部', + 'href' => $baseUrl . $this->buildQueryParams($params), + ]; + + $result = []; + + $result[] = $defaultItem; + + foreach ($subCategories as $key => $category) { + $params['sc'] = $category['id']; + $result[] = [ + 'id' => $category['id'], + 'name' => $category['name'], + 'href' => $baseUrl . $this->buildQueryParams($params), + ]; + } + + return $result; + } + + public function handleLevels() + { + $params = $this->getQueryParams(); + + $defaultParams = $params; + + if (isset($defaultParams['level'])) { + unset($defaultParams['level']); + } + + $baseUrl = $this->url->get(['for' => 'web.course.list']); + + $defaultItem = [ + 'id' => 0, + 'name' => '全部', + 'href' => $baseUrl . $this->buildQueryParams($defaultParams), + ]; + + $result = []; + + $result[] = $defaultItem; + + $levels = CourseModel::levelTypes(); + + foreach ($levels as $key => $value) { + $params['sc'] = $key; + $result[] = [ + 'id' => $key, + 'name' => $value, + 'href' => $baseUrl . $this->buildQueryParams($params), + ]; + } + + return $result; + } + + public function handleSorts() + { + } + + protected function getQueryParams() + { + $query = $this->request->getQuery(); + + $params = []; + + if (!empty($query['tc'])) { + $params['tc'] = $query['tc']; + } + + if (!empty($query['sc'])) { + $params['sc'] = $query['sc']; + } + + if (!empty($query['level'])) { + $params['level'] = $query['level']; + } + + return $params; + } + + protected function buildQueryParams($params) + { + return $params ? '?' . http_build_query($params) : ''; + } + +} diff --git a/app/Http/Web/Services/Index.php b/app/Http/Web/Services/Index.php new file mode 100644 index 00000000..2c72da6a --- /dev/null +++ b/app/Http/Web/Services/Index.php @@ -0,0 +1,49 @@ +get(); + } + + public function getLiveList() + { + $cache = new IndexLiveList(); + + return $cache->get(); + } + + public function getNewCourseList() + { + $cache = new IndexNewCourseList(); + + return $cache->get(); + } + + public function getFreeCourseList() + { + $cache = new IndexFreeCourseList(); + + return $cache->get(); + } + + public function getVipCourseList() + { + $cache = new IndexVipCourseList(); + + return $cache->get(); + } + +} diff --git a/app/Http/Web/Views/course/list.volt b/app/Http/Web/Views/course/list.volt new file mode 100644 index 00000000..36b2f5b6 --- /dev/null +++ b/app/Http/Web/Views/course/list.volt @@ -0,0 +1 @@ +{% extends 'templates/base.volt' %} \ No newline at end of file diff --git a/app/Http/Web/Views/index/index.volt b/app/Http/Web/Views/index/index.volt index 61999092..d44e0272 100644 --- a/app/Http/Web/Views/index/index.volt +++ b/app/Http/Web/Views/index/index.volt @@ -2,6 +2,18 @@ {% block content %} - + {%- macro model_info(value) %} + {% if value == 'vod' %} + 点播{{ request.get('id') }} + {% elseif value == 'live' %} + 直播 + {% elseif value == 'read' %} + 图文 + {% endif %} + {%- endmacro %} + +
{{ model_info('vod') }}
+

I am body

+

ID:{{ request.get('id') }}

{% endblock %} \ No newline at end of file diff --git a/app/Http/Web/Views/layouts/error.volt b/app/Http/Web/Views/layouts/error.volt index 5868a3ab..a53da4b2 100644 --- a/app/Http/Web/Views/layouts/error.volt +++ b/app/Http/Web/Views/layouts/error.volt @@ -1,5 +1,5 @@ - + diff --git a/app/Library/Util/Password.php b/app/Library/Utils/Password.php similarity index 93% rename from app/Library/Util/Password.php rename to app/Library/Utils/Password.php index 75e343d1..e573a919 100644 --- a/app/Library/Util/Password.php +++ b/app/Library/Utils/Password.php @@ -1,6 +1,6 @@ calcIdCardCode($idCardBody) != $idCardCode) { return false; diff --git a/app/Models/Account.php b/app/Models/Account.php index 472c0370..8c7a8a3c 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -2,7 +2,7 @@ namespace App\Models; -use App\Library\Util\Password; +use App\Library\Utils\Password; use Phalcon\Mvc\Model\Behavior\SoftDelete; class Account extends Model diff --git a/app/Services/Category.php b/app/Services/Category.php index 9078863c..4eea404a 100644 --- a/app/Services/Category.php +++ b/app/Services/Category.php @@ -47,6 +47,29 @@ class Category extends Service ]; } + /** + * 获取子节点 + * + * @param int $id + * @return array + */ + public function getChildCategories($id = 0) + { + $categoryListCache = new CategoryListCache(); + + $categories = $categoryListCache->get(); + + $result = []; + + foreach ($categories as $category) { + if ($category['parent_id'] == $id) { + $result[] = $category; + } + } + + return $result; + } + /** * 获取子节点ID * @@ -71,15 +94,15 @@ class Category extends Service $categories = $categoryListCache->get(); - $nodeIds = []; + $result = []; foreach ($categories as $category) { if ($category['parent_id'] == $id) { - $nodeIds[] = $category['id']; + $result[] = $category['id']; } } - return $nodeIds; + return $result; } } diff --git a/app/Services/Frontend/Account/EmailUpdate.php b/app/Services/Frontend/Account/EmailUpdate.php index 0cc89f96..01fa1534 100644 --- a/app/Services/Frontend/Account/EmailUpdate.php +++ b/app/Services/Frontend/Account/EmailUpdate.php @@ -32,7 +32,7 @@ class EmailUpdate extends Service $verifyValidator = new VerifyValidator(); - $verifyValidator->checkEmailCode($post['email'], $post['verify_code']); + $verifyValidator->checkCode($post['email'], $post['verify_code']); $account->email = $email; diff --git a/app/Services/Frontend/Account/PasswordReset.php b/app/Services/Frontend/Account/PasswordReset.php index 9048808b..307dd839 100644 --- a/app/Services/Frontend/Account/PasswordReset.php +++ b/app/Services/Frontend/Account/PasswordReset.php @@ -15,13 +15,13 @@ class PasswordReset extends Service $accountValidator = new AccountValidator(); - $account = $accountValidator->checkLoginName($post['login_name']); + $account = $accountValidator->checkLoginName($post['account']); $accountValidator->checkPassword($post['new_password']); $verifyValidator = new VerifyValidator(); - $verifyValidator->checkCode($post['login_name'], $post['verify_code']); + $verifyValidator->checkCode($post['account'], $post['verify_code']); $account->password = $post['new_password']; diff --git a/app/Services/Frontend/Account/PhoneUpdate.php b/app/Services/Frontend/Account/PhoneUpdate.php index b5e38635..9e69ef96 100644 --- a/app/Services/Frontend/Account/PhoneUpdate.php +++ b/app/Services/Frontend/Account/PhoneUpdate.php @@ -32,7 +32,7 @@ class PhoneUpdate extends Service $verifyValidator = new VerifyValidator(); - $verifyValidator->checkSmsCode($post['phone'], $post['verify_code']); + $verifyValidator->checkCode($post['phone'], $post['verify_code']); $account->phone = $phone; diff --git a/app/Services/Frontend/Account/Register.php b/app/Services/Frontend/Account/Register.php new file mode 100644 index 00000000..7d3d83d2 --- /dev/null +++ b/app/Services/Frontend/Account/Register.php @@ -0,0 +1,51 @@ +request->getPost(); + + $verifyValidator = new VerifyValidator(); + + $verifyValidator->checkCode($post['account'], $post['verify_code']); + + $accountValidator = new AccountValidator(); + + $data = []; + + if (CommonValidator::email($post['account'])) { + + $data['email'] = $accountValidator->checkEmail($post['account']); + + $accountValidator->checkIfEmailTaken($post['account']); + + } elseif (CommonValidator::phone($post['account'])) { + + $data['phone'] = $accountValidator->checkPhone($post['account']); + + $accountValidator->checkIfPhoneTaken($post['account']); + } + + $data['password'] = $accountValidator->checkPassword($post['password']); + + $account = new AccountModel(); + + $account->create($data); + + $userRepo = new UserRepo(); + + return $userRepo->findById($account->id); + } + +} diff --git a/app/Services/Frontend/Account/RegisterByEmail.php b/app/Services/Frontend/Account/RegisterByEmail.php deleted file mode 100644 index 4e20893c..00000000 --- a/app/Services/Frontend/Account/RegisterByEmail.php +++ /dev/null @@ -1,37 +0,0 @@ -request->getPost(); - - $verifyValidator = new VerifyValidator(); - - $verifyValidator->checkEmailCode($post['email'], $post['verify_code']); - - $accountValidator = new AccountValidator(); - - $data = []; - - $data['email'] = $accountValidator->checkEmail($post['email']); - $data['password'] = $accountValidator->checkPassword($post['password']); - - $accountValidator->checkIfEmailTaken($post['email']); - - $account = new AccountModel(); - - $account->create($data); - - return $account; - } - -} diff --git a/app/Services/Frontend/Account/RegisterByPhone.php b/app/Services/Frontend/Account/RegisterByPhone.php deleted file mode 100644 index 50f51abe..00000000 --- a/app/Services/Frontend/Account/RegisterByPhone.php +++ /dev/null @@ -1,37 +0,0 @@ -request->getPost(); - - $verifyValidator = new VerifyValidator(); - - $verifyValidator->checkSmsCode($post['phone'], $post['verify_code']); - - $accountValidator = new AccountValidator(); - - $data = []; - - $data['phone'] = $accountValidator->checkPhone($post['phone']); - $data['password'] = $accountValidator->checkPassword($post['password']); - - $accountValidator->checkIfPhoneTaken($post['phone']); - - $account = new AccountModel(); - - $account->create($data); - - return $account; - } - -} diff --git a/app/Services/Frontend/Course/CourseList.php b/app/Services/Frontend/Course/CourseList.php index 54ff96a0..827a0f73 100644 --- a/app/Services/Frontend/Course/CourseList.php +++ b/app/Services/Frontend/Course/CourseList.php @@ -16,13 +16,21 @@ class CourseList extends Service $params = $pagerQuery->getParams(); - if (!empty($params['category_id'])) { + /** + * tc => top_category + * sc => sub_category + */ + if (!empty($params['sc'])) { + + $params['category_id'] = $params['sc']; + + } elseif (!empty($params['tc'])) { $categoryService = new CategoryService(); - $childNodeIds = $categoryService->getChildCategoryIds($params['category_id']); + $childCategoryIds = $categoryService->getChildCategoryIds($params['tc']); - $params['category_id'] = $childNodeIds; + $params['category_id'] = $childCategoryIds; } $params['published'] = 1; diff --git a/app/Services/Service.php b/app/Services/Service.php index 0db74d39..8604bbe5 100644 --- a/app/Services/Service.php +++ b/app/Services/Service.php @@ -36,9 +36,9 @@ class Service extends Component */ public function getSectionSettings($section) { - $settingCache = new SettingCache(); + $cache = new SettingCache(); - return $settingCache->get($section); + return $cache->get($section); } } diff --git a/app/Validators/Account.php b/app/Validators/Account.php index 65a51b44..8ed23fe4 100644 --- a/app/Validators/Account.php +++ b/app/Validators/Account.php @@ -4,8 +4,8 @@ namespace App\Validators; use App\Exceptions\BadRequest as BadRequestException; use App\Exceptions\Forbidden as ForbiddenException; -use App\Library\Util\Password as PasswordUtil; -use App\Library\Validator\Common as CommonValidator; +use App\Library\Utils\Password as PasswordUtil; +use App\Library\Validators\Common as CommonValidator; use App\Models\Account as AccountModel; use App\Repos\Account as AccountRepo; use App\Repos\User as UserRepo; diff --git a/app/Validators/ChapterLive.php b/app/Validators/ChapterLive.php index 5ee226c1..3c272fd8 100644 --- a/app/Validators/ChapterLive.php +++ b/app/Validators/ChapterLive.php @@ -3,7 +3,7 @@ namespace App\Validators; use App\Exceptions\BadRequest as BadRequestException; -use App\Library\Validator\Common as CommonValidator; +use App\Library\Validators\Common as CommonValidator; class ChapterLive extends Validator { diff --git a/app/Validators/ChapterVod.php b/app/Validators/ChapterVod.php index becf93b9..81a06a63 100644 --- a/app/Validators/ChapterVod.php +++ b/app/Validators/ChapterVod.php @@ -3,7 +3,7 @@ namespace App\Validators; use App\Exceptions\BadRequest as BadRequestException; -use App\Library\Validator\Common as CommonValidator; +use App\Library\Validators\Common as CommonValidator; class ChapterVod extends Validator { diff --git a/app/Validators/Course.php b/app/Validators/Course.php index 97a122c5..d2db0325 100644 --- a/app/Validators/Course.php +++ b/app/Validators/Course.php @@ -5,7 +5,7 @@ namespace App\Validators; use App\Caches\Course as CourseCache; use App\Caches\MaxCourseId as MaxCourseIdCache; use App\Exceptions\BadRequest as BadRequestException; -use App\Library\Validator\Common as CommonValidator; +use App\Library\Validators\Common as CommonValidator; use App\Models\Course as CourseModel; use App\Repos\Course as CourseRepo; diff --git a/app/Validators/CourseUser.php b/app/Validators/CourseUser.php index 7fba9247..b92071d1 100644 --- a/app/Validators/CourseUser.php +++ b/app/Validators/CourseUser.php @@ -3,7 +3,7 @@ namespace App\Validators; use App\Exceptions\BadRequest as BadRequestException; -use App\Library\Validator\Common as CommonValidator; +use App\Library\Validators\Common as CommonValidator; use App\Repos\Course as CourseRepo; use App\Repos\CourseUser as CourseUserRepo; use App\Repos\User as UserRepo; diff --git a/app/Validators/Nav.php b/app/Validators/Nav.php index 1b0fad00..579b1269 100644 --- a/app/Validators/Nav.php +++ b/app/Validators/Nav.php @@ -3,7 +3,7 @@ namespace App\Validators; use App\Exceptions\BadRequest as BadRequestException; -use App\Library\Validator\Common as CommonValidator; +use App\Library\Validators\Common as CommonValidator; use App\Models\Nav as NavModel; use App\Repos\Nav as NavRepo; use Phalcon\Text; diff --git a/app/Validators/Slide.php b/app/Validators/Slide.php index 66aa24ed..bef60e75 100644 --- a/app/Validators/Slide.php +++ b/app/Validators/Slide.php @@ -3,7 +3,7 @@ namespace App\Validators; use App\Exceptions\BadRequest as BadRequestException; -use App\Library\Validator\Common as CommonValidator; +use App\Library\Validators\Common as CommonValidator; use App\Models\Course as CourseModel; use App\Models\Page as PageModel; use App\Models\Slide as SlideModel; diff --git a/app/Validators/User.php b/app/Validators/User.php index f503b92d..3daa4392 100644 --- a/app/Validators/User.php +++ b/app/Validators/User.php @@ -5,7 +5,7 @@ namespace App\Validators; use App\Caches\MaxUserId as MaxUserIdCache; use App\Caches\User as UserCache; use App\Exceptions\BadRequest as BadRequestException; -use App\Library\Validator\Common as CommonValidator; +use App\Library\Validators\Common as CommonValidator; use App\Models\User as UserModel; use App\Repos\Role as RoleRepo; use App\Repos\User as UserRepo; diff --git a/app/Validators/Verify.php b/app/Validators/Verify.php index 4732e7f1..e7f94323 100644 --- a/app/Validators/Verify.php +++ b/app/Validators/Verify.php @@ -3,7 +3,7 @@ namespace App\Validators; use App\Exceptions\BadRequest as BadRequestException; -use App\Library\Validator\Common as CommonValidator; +use App\Library\Validators\Common as CommonValidator; use App\Services\Verification as VerifyService; class Verify extends Validator @@ -27,28 +27,6 @@ class Verify extends Validator return $email; } - public function checkSmsCode($phone, $code) - { - $service = new VerifyService(); - - $result = $service->checkSmsCode($phone, $code); - - if (!$result) { - throw new BadRequestException('verify.invalid_code'); - } - } - - public function checkEmailCode($email, $code) - { - $service = new VerifyService(); - - $result = $service->checkEmailCode($email, $code); - - if (!$result) { - throw new BadRequestException('verify.invalid_code'); - } - } - public function checkCode($key, $code) { $service = new VerifyService();