diff --git a/app/Builders/CourseCatalog.php b/app/Builders/CourseChapterList.php similarity index 98% rename from app/Builders/CourseCatalog.php rename to app/Builders/CourseChapterList.php index 5415dae2..bd544a4b 100644 --- a/app/Builders/CourseCatalog.php +++ b/app/Builders/CourseChapterList.php @@ -7,7 +7,7 @@ use App\Models\Course as CourseModel; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; -class CourseCatalog extends Builder +class CourseChapterList extends Builder { /** diff --git a/app/Caches/CourseCatalog.php b/app/Caches/CourseChapterList.php similarity index 62% rename from app/Caches/CourseCatalog.php rename to app/Caches/CourseChapterList.php index 687a50ab..512dec28 100644 --- a/app/Caches/CourseCatalog.php +++ b/app/Caches/CourseChapterList.php @@ -2,9 +2,9 @@ namespace App\Caches; -use App\Builders\CourseCatalog as CourseCatalogBuilder; +use App\Builders\CourseChapterList as CourseChapterListBuilder; -class CourseCatalog extends Cache +class CourseChapterList extends Cache { protected $lifetime = 7 * 86400; @@ -16,12 +16,12 @@ class CourseCatalog extends Cache public function getKey($id = null) { - return "course_catalog:{$id}"; + return "course_chapter_list:{$id}"; } public function getContent($id = null) { - $builder = new CourseCatalogBuilder(); + $builder = new CourseChapterListBuilder(); $list = $builder->handle($id); diff --git a/app/Http/Admin/Controllers/ChapterController.php b/app/Http/Admin/Controllers/ChapterController.php index bbef2879..43418d73 100644 --- a/app/Http/Admin/Controllers/ChapterController.php +++ b/app/Http/Admin/Controllers/ChapterController.php @@ -35,9 +35,9 @@ class ChapterController extends Controller */ public function addAction() { - $courseId = $this->request->getQuery('course_id'); - $parentId = $this->request->getQuery('parent_id'); - $type = $this->request->getQuery('type'); + $courseId = $this->request->getQuery('course_id', 'int'); + $parentId = $this->request->getQuery('parent_id', 'int'); + $type = $this->request->getQuery('type', 'string', 'chapter'); $courseService = new CourseService(); diff --git a/app/Http/Admin/Controllers/PublicController.php b/app/Http/Admin/Controllers/PublicController.php index 5e0a1ab4..e5b84bbc 100644 --- a/app/Http/Admin/Controllers/PublicController.php +++ b/app/Http/Admin/Controllers/PublicController.php @@ -43,7 +43,7 @@ class PublicController extends \Phalcon\Mvc\Controller */ public function ip2regionAction() { - $ip = $this->request->getQuery('ip', 'trim'); + $ip = $this->request->getQuery('ip', 'string'); $region = kg_ip2region($ip); diff --git a/app/Http/Admin/Controllers/SettingController.php b/app/Http/Admin/Controllers/SettingController.php index 1531065b..e3dfc8f3 100644 --- a/app/Http/Admin/Controllers/SettingController.php +++ b/app/Http/Admin/Controllers/SettingController.php @@ -121,7 +121,7 @@ class SettingController extends Controller if ($this->request->isPost()) { - $section = $this->request->getPost('section'); + $section = $this->request->getPost('section', 'string'); $data = $this->request->getPost(); @@ -150,7 +150,7 @@ class SettingController extends Controller if ($this->request->isPost()) { - $section = $this->request->getPost('section'); + $section = $this->request->getPost('section', 'string'); $data = $this->request->getPost(); @@ -257,7 +257,7 @@ class SettingController extends Controller if ($this->request->isPost()) { - $data = $this->request->getPost('vip'); + $data = $this->request->getPost('vip', 'string'); $settingService->updateVipSettings($data); @@ -280,7 +280,7 @@ class SettingController extends Controller if ($this->request->isPost()) { - $section = $this->request->getPost('section'); + $section = $this->request->getPost('section', 'string'); $data = $this->request->getPost(); diff --git a/app/Http/Admin/Controllers/StudentController.php b/app/Http/Admin/Controllers/StudentController.php index 5ef6e5d2..9b2707fb 100644 --- a/app/Http/Admin/Controllers/StudentController.php +++ b/app/Http/Admin/Controllers/StudentController.php @@ -84,7 +84,7 @@ class StudentController extends Controller */ public function editAction() { - $relationId = $this->request->getQuery('relation_id'); + $relationId = $this->request->getQuery('relation_id', 'int'); $studentService = new StudentService(); diff --git a/app/Http/Admin/Controllers/TestController.php b/app/Http/Admin/Controllers/TestController.php index fa017431..61f56222 100644 --- a/app/Http/Admin/Controllers/TestController.php +++ b/app/Http/Admin/Controllers/TestController.php @@ -60,7 +60,7 @@ class TestController extends Controller */ public function livePushAction() { - $streamName = $this->request->getQuery('stream'); + $streamName = $this->request->getQuery('stream', 'string'); $liveService = new LiveService(); @@ -102,7 +102,7 @@ class TestController extends Controller */ public function smserAction() { - $phone = $this->request->getPost('phone'); + $phone = $this->request->getPost('phone', 'string'); $smserService = new TestSmserService(); @@ -120,7 +120,7 @@ class TestController extends Controller */ public function mailerAction() { - $email = $this->request->getPost('email'); + $email = $this->request->getPost('email', 'string'); $mailerService = new TestMailerService(); @@ -166,7 +166,7 @@ class TestController extends Controller $this->db->begin(); - $order = $alipayTestService->createOrder(); + $order = $alipayTestService->createAlipayOrder(); $trade = $alipayTestService->createTrade($order); $qrcode = $alipayTestService->scan($trade); @@ -190,7 +190,7 @@ class TestController extends Controller $this->db->begin(); - $order = $wxpayTestService->createOrder(); + $order = $wxpayTestService->createWxpayOrder(); $trade = $wxpayTestService->createTrade($order); $qrcode = $wxpayTestService->scan($trade); @@ -210,7 +210,7 @@ class TestController extends Controller */ public function alipayStatusAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $alipayTestService = new AlipayTestService(); @@ -224,7 +224,7 @@ class TestController extends Controller */ public function wxpayStatusAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $wxpayTestService = new WxpayTestService(); diff --git a/app/Http/Admin/Controllers/VodController.php b/app/Http/Admin/Controllers/VodController.php index 72f4c35f..f319a578 100644 --- a/app/Http/Admin/Controllers/VodController.php +++ b/app/Http/Admin/Controllers/VodController.php @@ -28,8 +28,8 @@ class VodController extends Controller */ public function playerAction() { - $chapterId = $this->request->getQuery('chapter_id'); - $playUrl = $this->request->getQuery('play_url'); + $chapterId = $this->request->getQuery('chapter_id', 'int'); + $playUrl = $this->request->getQuery('play_url', 'string'); $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); $this->view->pick('public/vod_player'); diff --git a/app/Http/Admin/Services/Chapter.php b/app/Http/Admin/Services/Chapter.php index 6071a2f4..11d94fb6 100644 --- a/app/Http/Admin/Services/Chapter.php +++ b/app/Http/Admin/Services/Chapter.php @@ -3,7 +3,7 @@ namespace App\Http\Admin\Services; use App\Caches\Chapter as ChapterCache; -use App\Caches\CourseCatalog as CourseCatalogCache; +use App\Caches\CourseChapterList as CourseCatalogCache; use App\Models\Chapter as ChapterModel; use App\Models\ChapterLive as ChapterLiveModel; use App\Models\ChapterRead as ChapterReadModel; diff --git a/app/Http/Admin/Services/PayTest.php b/app/Http/Admin/Services/PayTest.php index 6aa3134d..ea563b0c 100644 --- a/app/Http/Admin/Services/PayTest.php +++ b/app/Http/Admin/Services/PayTest.php @@ -15,11 +15,11 @@ abstract class PayTest extends Service protected $channel; /** - * 创建订单 + * 创建支付宝订单 * * @return OrderModel */ - public function createOrder() + public function createAlipayOrder() { /** * @var AdminAuth $auth @@ -30,8 +30,45 @@ abstract class PayTest extends Service $order = new OrderModel(); - $order->subject = '测试 - 支付测试0.01元'; - $order->amount = 0.01; + $order->subject = '测试 - 支付测试3.01元'; + $order->amount = 3.01; + $order->owner_id = $authUser['id']; + $order->item_type = OrderModel::ITEM_TEST; + + $order->create(); + + return $order; + } + + /** + * 创建微信订单 + * + * @return OrderModel + */ + public function createWxpayOrder() + { + /** + * @var AdminAuth $auth + */ + $auth = $this->getDI()->get('auth'); + + $authUser = $auth->getAuthInfo(); + + $config = $this->getConfig(); + + $order = new OrderModel(); + + /** + * 微信沙箱环境金额不能自定义,只能是测试用例值(沙吊的不行) + */ + if ($config->get('env') == ENV_DEV) { + $order->subject = '测试 - 支付测试3.01元'; + $order->amount = 3.01; + } else { + $order->subject = '测试 - 支付测试0.01元'; + $order->amount = 0.01; + } + $order->owner_id = $authUser['id']; $order->item_type = OrderModel::ITEM_TEST; diff --git a/app/Http/Admin/Views/setting/pay_wxpay.volt b/app/Http/Admin/Views/setting/pay_wxpay.volt index 3cea4cdd..aec88276 100644 --- a/app/Http/Admin/Views/setting/pay_wxpay.volt +++ b/app/Http/Admin/Views/setting/pay_wxpay.volt @@ -9,17 +9,17 @@
- +
- +
- +
@@ -40,6 +40,9 @@
+{% set subject = config.get('env') == 'dev' ? '支付测试3.01元' : '支付测试0.01元' %} +{% set total_amount = config.get('env') == 'dev' ? 3.01 : 0.01 %} +
支付测试 @@ -47,13 +50,13 @@
- +
- +
diff --git a/app/Http/Desktop/Controllers/AccountController.php b/app/Http/Desktop/Controllers/AccountController.php index 65790af7..7b0749b9 100644 --- a/app/Http/Desktop/Controllers/AccountController.php +++ b/app/Http/Desktop/Controllers/AccountController.php @@ -43,7 +43,7 @@ class AccountController extends Controller $service->register(); - $returnUrl = $this->request->getPost('return_url'); + $returnUrl = $this->request->getPost('return_url', 'string'); $content = [ 'location' => $returnUrl ?: '/', @@ -81,7 +81,7 @@ class AccountController extends Controller $service->loginByPassword(); - $returnUrl = $this->request->getPost('return_url'); + $returnUrl = $this->request->getPost('return_url', 'string'); $location = $returnUrl ?: $this->url->get(['for' => 'desktop.index']); @@ -99,7 +99,7 @@ class AccountController extends Controller $service->loginByVerify(); - $returnUrl = $this->request->getPost('return_url'); + $returnUrl = $this->request->getPost('return_url', 'string'); $location = $returnUrl ?: $this->url->get(['for' => 'desktop.index']); diff --git a/app/Http/Desktop/Controllers/ChapterController.php b/app/Http/Desktop/Controllers/ChapterController.php index 03fbe309..3438fa7b 100644 --- a/app/Http/Desktop/Controllers/ChapterController.php +++ b/app/Http/Desktop/Controllers/ChapterController.php @@ -8,7 +8,7 @@ use App\Services\Frontend\Chapter\ChapterInfo as ChapterInfoService; use App\Services\Frontend\Chapter\ChapterLike as ChapterLikeService; use App\Services\Frontend\Chapter\DanmuList as ChapterDanmuListService; use App\Services\Frontend\Chapter\Learning as ChapterLearningService; -use App\Services\Frontend\Course\ChapterList as CourseCatalogService; +use App\Services\Frontend\Course\ChapterList as CourseChapterListService; /** * @RoutePrefix("/chapter") @@ -34,7 +34,7 @@ class ChapterController extends Controller ]); } - $service = new CourseCatalogService(); + $service = new CourseChapterListService(); $catalog = $service->handle($chapter['course']['id']); @@ -46,6 +46,8 @@ class ChapterController extends Controller if ($chapter['model'] == CourseModel::MODEL_VOD) { $this->view->pick('chapter/vod'); + } elseif ($chapter['model'] == CourseModel::MODEL_READ) { + $this->view->pick('chapter/read'); } elseif ($chapter['model'] == CourseModel::MODEL_LIVE) { if ($chapter['status'] == LiveModel::STATUS_ACTIVE) { $this->view->pick('chapter/live_active'); @@ -54,8 +56,6 @@ class ChapterController extends Controller } elseif ($chapter['status'] == LiveModel::STATUS_FORBID) { $this->view->pick('chapter/live_forbid'); } - } elseif ($chapter['model'] == CourseModel::MODEL_READ) { - $this->view->pick('chapter/read'); } $this->view->setVar('chapter', $chapter); diff --git a/app/Http/Desktop/Controllers/CourseController.php b/app/Http/Desktop/Controllers/CourseController.php index 06019814..6639b18f 100644 --- a/app/Http/Desktop/Controllers/CourseController.php +++ b/app/Http/Desktop/Controllers/CourseController.php @@ -3,7 +3,7 @@ namespace App\Http\Desktop\Controllers; use App\Http\Desktop\Services\CourseQuery as CourseQueryService; -use App\Services\Frontend\Course\ChapterList as CourseCatalogService; +use App\Services\Frontend\Course\ChapterList as CourseChapterListService; use App\Services\Frontend\Course\ConsultList as CourseConsultListService; use App\Services\Frontend\Course\CourseInfo as CourseInfoService; use App\Services\Frontend\Course\CourseList as CourseListService; @@ -72,7 +72,7 @@ class CourseController extends Controller $course = $service->handle($id); - $service = new CourseCatalogService(); + $service = new CourseChapterListService(); $chapters = $service->handle($id); diff --git a/app/Http/Desktop/Controllers/ImController.php b/app/Http/Desktop/Controllers/ImController.php index fe1b27c0..90d4f2bb 100644 --- a/app/Http/Desktop/Controllers/ImController.php +++ b/app/Http/Desktop/Controllers/ImController.php @@ -113,7 +113,7 @@ class ImController extends Controller { $service = new ImService(); - $id = $this->request->getQuery('id'); + $id = $this->request->getQuery('id', 'int'); $service->pullUnreadFriendMessages($id); @@ -197,8 +197,8 @@ class ImController extends Controller */ public function sendChatMessageAction() { - $from = $this->request->getPost('from'); - $to = $this->request->getPost('to'); + $from = $this->request->getPost('from', 'string'); + $to = $this->request->getPost('to', 'string'); $service = new ImService(); @@ -212,8 +212,8 @@ class ImController extends Controller */ public function sendCsMessageAction() { - $from = $this->request->getPost('from'); - $to = $this->request->getPost('to'); + $from = $this->request->getPost('from', 'string'); + $to = $this->request->getPost('to', 'string'); $service = new ImService(); diff --git a/app/Http/Desktop/Controllers/LiveController.php b/app/Http/Desktop/Controllers/LiveController.php index 9ba31814..0a1625c7 100644 --- a/app/Http/Desktop/Controllers/LiveController.php +++ b/app/Http/Desktop/Controllers/LiveController.php @@ -14,20 +14,6 @@ class LiveController extends Controller use ResponseTrait; - /** - * @Get("/{id:[0-9]+}/preview", name="desktop.live.preview") - */ - public function previewAction($id) - { - $service = new LiveService(); - - $stats = $service->getStats($id); - - $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->pick('chapter/live_stats'); - $this->view->setVar('stats', $stats); - } - /** * @Get("/{id:[0-9]+}/chats", name="desktop.live.chats") */ diff --git a/app/Http/Desktop/Controllers/MyController.php b/app/Http/Desktop/Controllers/MyController.php index 8334d646..b89579ff 100644 --- a/app/Http/Desktop/Controllers/MyController.php +++ b/app/Http/Desktop/Controllers/MyController.php @@ -151,7 +151,7 @@ class MyController extends Controller */ public function groupsAction() { - $scope = $this->request->getQuery('scope', 'trim', 'joined'); + $scope = $this->request->getQuery('scope', 'string', 'joined'); $service = new MyGroupListService(); diff --git a/app/Http/Desktop/Controllers/OrderController.php b/app/Http/Desktop/Controllers/OrderController.php index 8e2c066d..2ffb375c 100644 --- a/app/Http/Desktop/Controllers/OrderController.php +++ b/app/Http/Desktop/Controllers/OrderController.php @@ -20,7 +20,7 @@ class OrderController extends Controller */ public function infoAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $service = new OrderInfoService(); @@ -35,8 +35,8 @@ class OrderController extends Controller */ public function confirmAction() { - $itemId = $this->request->getQuery('item_id'); - $itemType = $this->request->getQuery('item_type'); + $itemId = $this->request->getQuery('item_id', 'int'); + $itemType = $this->request->getQuery('item_type', 'int'); $service = new OrderConfirmService(); @@ -64,7 +64,7 @@ class OrderController extends Controller */ public function payAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $service = new OrderInfoService(); @@ -82,7 +82,7 @@ class OrderController extends Controller */ public function cancelAction() { - $sn = $this->request->getPost('sn'); + $sn = $this->request->getPost('sn', 'string'); $service = new OrderCancelService(); diff --git a/app/Http/Desktop/Controllers/PublicController.php b/app/Http/Desktop/Controllers/PublicController.php index b838cc5b..a56a8db7 100644 --- a/app/Http/Desktop/Controllers/PublicController.php +++ b/app/Http/Desktop/Controllers/PublicController.php @@ -49,7 +49,7 @@ class PublicController extends \Phalcon\Mvc\Controller */ public function qrcodeAction() { - $text = $this->request->getQuery('text'); + $text = $this->request->getQuery('text', 'string'); $level = $this->request->getQuery('level', 'int', 0); $size = $this->request->getQuery('size', 'int', 5); diff --git a/app/Http/Desktop/Controllers/RefundController.php b/app/Http/Desktop/Controllers/RefundController.php index cec1661e..adcca003 100644 --- a/app/Http/Desktop/Controllers/RefundController.php +++ b/app/Http/Desktop/Controllers/RefundController.php @@ -20,7 +20,7 @@ class RefundController extends Controller */ public function confirmAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $service = new OrderInfoService(); @@ -57,7 +57,7 @@ class RefundController extends Controller */ public function infoAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $service = new RefundInfoService(); @@ -72,7 +72,7 @@ class RefundController extends Controller */ public function cancelAction() { - $sn = $this->request->getPost('sn'); + $sn = $this->request->getPost('sn', 'string'); $service = new RefundCancelService(); diff --git a/app/Http/Desktop/Controllers/TradeController.php b/app/Http/Desktop/Controllers/TradeController.php index 29af171c..046c87f6 100644 --- a/app/Http/Desktop/Controllers/TradeController.php +++ b/app/Http/Desktop/Controllers/TradeController.php @@ -28,7 +28,7 @@ class TradeController extends Controller */ public function statusAction() { - $sn = $this->request->getQuery('sn'); + $sn = $this->request->getQuery('sn', 'string'); $service = new TradeInfoService(); diff --git a/app/Http/Desktop/Controllers/VipController.php b/app/Http/Desktop/Controllers/VipController.php index 9b991744..78ad9028 100644 --- a/app/Http/Desktop/Controllers/VipController.php +++ b/app/Http/Desktop/Controllers/VipController.php @@ -32,7 +32,7 @@ class VipController extends Controller */ public function coursesAction() { - $type = $this->request->getQuery('type', 'trim', 'discount'); + $type = $this->request->getQuery('type', 'string', 'discount'); $service = new VipCourseListService(); diff --git a/app/Http/Desktop/Services/Im.php b/app/Http/Desktop/Services/Im.php index 04a1caf7..c1aed7df 100644 --- a/app/Http/Desktop/Services/Im.php +++ b/app/Http/Desktop/Services/Im.php @@ -45,7 +45,7 @@ class Im extends Service public function getGroupUsers() { - $id = $this->request->getQuery('id'); + $id = $this->request->getQuery('id', 'int'); $validator = new ImGroupValidator(); @@ -82,7 +82,7 @@ class Im extends Service public function getFriendStatus() { - $id = $this->request->getQuery('id'); + $id = $this->request->getQuery('id', 'int'); $validator = new ImUserValidator(); @@ -106,7 +106,7 @@ class Im extends Service $user = $this->getImUser($loginUser->id); - $clientId = $this->request->getPost('client_id'); + $clientId = $this->request->getPost('client_id', 'string'); Gateway::$registerAddress = $this->getRegisterAddress(); @@ -131,7 +131,7 @@ class Im extends Service $user = $this->getImUser($loginUser->id); - $status = $this->request->getPost('status'); + $status = $this->request->getPost('status', 'string'); $validator = new ImUserValidator(); @@ -148,7 +148,7 @@ class Im extends Service $user = $this->getImUser($loginUser->id); - $sign = $this->request->getPost('sign'); + $sign = $this->request->getPost('sign', 'string'); $validator = new ImUserValidator(); @@ -165,7 +165,7 @@ class Im extends Service $user = $this->getImUser($loginUser->id); - $skin = $this->request->getPost('skin'); + $skin = $this->request->getPost('skin', 'string'); $validator = new ImUserValidator(); diff --git a/app/Http/Desktop/Services/ImGroupTrait.php b/app/Http/Desktop/Services/ImGroupTrait.php index 60cdd3c9..c4439b64 100644 --- a/app/Http/Desktop/Services/ImGroupTrait.php +++ b/app/Http/Desktop/Services/ImGroupTrait.php @@ -41,7 +41,7 @@ Trait ImGroupTrait $user = $this->getImUser($loginUser->id); - $noticeId = $this->request->getPost('notice_id'); + $noticeId = $this->request->getPost('notice_id', 'int'); $validator = new ImNoticeValidator(); @@ -96,7 +96,7 @@ Trait ImGroupTrait $user = $this->getImUser($loginUser->id); - $noticeId = $this->request->getPost('notice_id'); + $noticeId = $this->request->getPost('notice_id', 'int'); $validator = new ImNoticeValidator(); diff --git a/app/Http/Desktop/Services/Live.php b/app/Http/Desktop/Services/Live.php index c6c7a1b7..ed4ecb97 100644 --- a/app/Http/Desktop/Services/Live.php +++ b/app/Http/Desktop/Services/Live.php @@ -59,7 +59,7 @@ class Live extends Service public function bindUser($id) { - $clientId = $this->request->getPost('client_id'); + $clientId = $this->request->getPost('client_id', 'string'); $chapter = $this->checkChapter($id); diff --git a/app/Http/Desktop/Views/chapter/live_inactive.volt b/app/Http/Desktop/Views/chapter/live_inactive.volt index 9b02f73b..18de57bf 100644 --- a/app/Http/Desktop/Views/chapter/live_inactive.volt +++ b/app/Http/Desktop/Views/chapter/live_inactive.volt @@ -2,27 +2,23 @@ {% block content %} - {% set course_url = url({'for':'desktop.course.show','id':chapter.course.id}) %} {% set live_status_url = url({'for':'desktop.live.status','id':chapter.id}) %} - {% set show_countdown = time() < chapter.start_time ? 1 : 0 %} - - - {% if show_countdown == 1 %} + {% if time() < chapter.start_time %}
-
开播倒计时开始啦,敬请关注!
+
直播倒计时开始啦,敬请关注!
+
+ {% elseif chapter.start_time < time() and chapter.end_time > time() %} +
+
+
+
直播时间到了,主播去哪了?
{% else %}
-
+
直播已结束,谢谢关注!
{% endif %} diff --git a/app/Listeners/Pay.php b/app/Listeners/Pay.php index 4c1d7fd3..2ee624a8 100644 --- a/app/Listeners/Pay.php +++ b/app/Listeners/Pay.php @@ -69,7 +69,6 @@ class Pay extends Listener $this->db->rollback(); $this->logger->error('After Pay Event Error ' . kg_json_encode([ - 'line' => $e->getLine(), 'code' => $e->getCode(), 'message' => $e->getMessage(), ])); diff --git a/app/Models/ChapterLive.php b/app/Models/ChapterLive.php index 50823c39..d7c587d1 100644 --- a/app/Models/ChapterLive.php +++ b/app/Models/ChapterLive.php @@ -9,7 +9,7 @@ class ChapterLive extends Model * 状态类型 */ const STATUS_ACTIVE = 1; // 活跃 - const STATUS_INACTIVE = 2; // 非活跃 + const STATUS_INACTIVE = 2; // 静默 const STATUS_FORBID = 3; // 禁播 /** @@ -82,6 +82,8 @@ class ChapterLive extends Model public function beforeCreate() { + $this->status = self::STATUS_INACTIVE; + $this->create_time = time(); } diff --git a/app/Services/Frontend/Course/ChapterList.php b/app/Services/Frontend/Course/ChapterList.php index b4eaa074..bc6c15dc 100644 --- a/app/Services/Frontend/Course/ChapterList.php +++ b/app/Services/Frontend/Course/ChapterList.php @@ -2,7 +2,7 @@ namespace App\Services\Frontend\Course; -use App\Caches\CourseCatalog as CourseCatalogCache; +use App\Caches\CourseChapterList as CourseChapterListCache; use App\Models\Course as CourseModel; use App\Models\User as UserModel; use App\Repos\Course as CourseRepo; @@ -27,7 +27,7 @@ class ChapterList extends FrontendService protected function getChapters(CourseModel $course, UserModel $user) { - $cache = new CourseCatalogCache(); + $cache = new CourseChapterListCache(); $chapters = $cache->get($course->id); diff --git a/app/Services/Frontend/Teaching/LivePushUrl.php b/app/Services/Frontend/Teaching/LivePushUrl.php index 4407941b..ba615992 100644 --- a/app/Services/Frontend/Teaching/LivePushUrl.php +++ b/app/Services/Frontend/Teaching/LivePushUrl.php @@ -15,7 +15,7 @@ class LivePushUrl extends FrontendService public function handle() { - $chapterId = $this->request->getQuery('chapter_id'); + $chapterId = $this->request->getQuery('chapter_id', 'int'); $chapter = $this->checkChapter($chapterId); diff --git a/app/Services/LiveNotify.php b/app/Services/LiveNotify.php index 924c7136..2501cdc4 100644 --- a/app/Services/LiveNotify.php +++ b/app/Services/LiveNotify.php @@ -11,9 +11,9 @@ class LiveNotify extends Service public function handle() { - $time = $this->request->getPost('t'); - $sign = $this->request->getPost('sign'); - $action = $this->request->getQuery('action'); + $time = $this->request->getPost('t', 'int'); + $sign = $this->request->getPost('sign', 'string'); + $action = $this->request->getQuery('action', 'string'); if (!$this->checkSign($sign, $time)) { return false; @@ -57,7 +57,7 @@ class LiveNotify extends Service */ protected function handleStreamBegin() { - $streamId = $this->request->getPost('stream_id'); + $streamId = $this->request->getPost('stream_id', 'string'); $chapter = $this->getChapter($streamId); @@ -83,7 +83,7 @@ class LiveNotify extends Service */ protected function handleStreamEnd() { - $streamId = $this->request->getPost('stream_id'); + $streamId = $this->request->getPost('stream_id', 'string'); $chapter = $this->getChapter($streamId); diff --git a/app/Services/Pay/Alipay.php b/app/Services/Pay/Alipay.php index f9dd7145..23194ad5 100644 --- a/app/Services/Pay/Alipay.php +++ b/app/Services/Pay/Alipay.php @@ -129,7 +129,13 @@ class Alipay extends PayService $this->eventsManager->fire('pay:afterPay', $this, $trade); - return $this->gateway->success(); + $trade = $tradeRepo->findById($trade->id); + + if ($trade->status == TradeModel::STATUS_FINISHED) { + return $this->gateway->success(); + } + + return false; } /** diff --git a/app/Services/Pay/Wxpay.php b/app/Services/Pay/Wxpay.php index 45f76307..157dc656 100644 --- a/app/Services/Pay/Wxpay.php +++ b/app/Services/Pay/Wxpay.php @@ -131,7 +131,13 @@ class Wxpay extends PayService $this->eventsManager->fire('pay:afterPay', $this, $trade); - return $this->gateway->success(); + $trade = $tradeRepo->findById($trade->id); + + if ($trade->status == TradeModel::STATUS_FINISHED) { + return $this->gateway->success(); + } + + return false; } /** diff --git a/app/Services/Pay/WxpayGateway.php b/app/Services/Pay/WxpayGateway.php index cad58752..17aa8fe8 100644 --- a/app/Services/Pay/WxpayGateway.php +++ b/app/Services/Pay/WxpayGateway.php @@ -47,8 +47,8 @@ class WxpayGateway extends Service 'mch_id' => $this->settings['mch_id'], 'key' => $this->settings['key'], 'notify_url' => $this->settings['notify_url'], - 'cert_client' => config_path('wxpay/client_cert.pem'), - 'cert_key' => config_path('wxpay/client_key.pem'), + 'cert_client' => config_path('wxpay/apiclient_cert.pem'), + 'cert_key' => config_path('wxpay/apiclient_key.pem'), 'log' => [ 'file' => log_path('wxpay.log'), 'level' => $level, diff --git a/public/static/desktop/css/common.css b/public/static/desktop/css/common.css index a73789de..b8a830d6 100644 --- a/public/static/desktop/css/common.css +++ b/public/static/desktop/css/common.css @@ -911,7 +911,7 @@ body { .countdown { color: #666; - margin-top: 50px; + margin-top: 30px; text-align: center; } @@ -924,7 +924,7 @@ body { } .countdown .tips { - font-size: 18px; + font-size: 16px; margin: 20px 0; } @@ -934,6 +934,7 @@ body { .countdown .timer span { color: green; + font-size: 36px; padding: 10px; }