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;
}