mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-28 05:11:39 +08:00
优化代码,测试微信支付
This commit is contained in:
parent
d9016669e3
commit
502fbe9583
@ -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
|
||||
{
|
||||
|
||||
/**
|
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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');
|
||||
|
@ -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;
|
||||
|
@ -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 = '测试 - 支付测试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;
|
||||
|
||||
|
@ -9,17 +9,17 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">公众号ID</label>
|
||||
<div class="layui-input-block">
|
||||
<input class="layui-input" type="text" name="app_id" value="{{ wxpay.mp_app_id }}" lay-verify="required">
|
||||
<input class="layui-input" type="text" name="mp_app_id" value="{{ wxpay.mp_app_id }}" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商户ID</label>
|
||||
<label class="layui-form-label">商户号ID</label>
|
||||
<div class="layui-input-block">
|
||||
<input class="layui-input" type="text" name="mch_id" value="{{ wxpay.mch_id }}" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付Key</label>
|
||||
<label class="layui-form-label">API密钥</label>
|
||||
<div class="layui-input-block">
|
||||
<input class="layui-input" type="text" name="key" value="{{ wxpay.key }}" lay-verify="required">
|
||||
</div>
|
||||
@ -40,6 +40,9 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% set subject = config.get('env') == 'dev' ? '支付测试3.01元' : '支付测试0.01元' %}
|
||||
{% set total_amount = config.get('env') == 'dev' ? 3.01 : 0.01 %}
|
||||
|
||||
<form class="layui-form kg-form">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>支付测试</legend>
|
||||
@ -47,13 +50,13 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付项目</label>
|
||||
<div class="layui-input-block">
|
||||
<input class="layui-input" type="text" name="subject" value="支付测试0.01元" readonly="readonly">
|
||||
<input class="layui-input" type="text" name="subject" value="{{ subject }}" readonly="readonly">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付金额</label>
|
||||
<div class="layui-input-block">
|
||||
<input class="layui-input" type="text" name="total_amount" value="0.01" readonly="readonly">
|
||||
<input class="layui-input" type="text" name="total_amount" value="{{ total_amount }}" readonly="readonly">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
|
@ -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']);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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")
|
||||
*/
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 %}
|
||||
|
||||
<div class="breadcrumb">
|
||||
<span class="layui-breadcrumb">
|
||||
<a href="{{ course_url }}"><i class="layui-icon layui-icon-return"></i> 返回课程</a>
|
||||
<a><cite>{{ chapter.course.title }}</cite></a>
|
||||
<a><cite>{{ chapter.title }}</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{% if show_countdown == 1 %}
|
||||
{% if time() < chapter.start_time %}
|
||||
<div class="countdown">
|
||||
<div class="icon"><i class="layui-icon layui-icon-time"></i></div>
|
||||
<div class="timer"></div>
|
||||
<div class="tips">开播倒计时开始啦,敬请关注!</div>
|
||||
<div class="tips">直播倒计时开始啦,敬请关注!</div>
|
||||
</div>
|
||||
{% elseif chapter.start_time < time() and chapter.end_time > time() %}
|
||||
<div class="countdown">
|
||||
<div class="icon"><i class="layui-icon layui-icon-face-surprised"></i></div>
|
||||
<div class="timer"></div>
|
||||
<div class="tips">直播时间到了,主播去哪了?</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="countdown">
|
||||
<div class="icon"><i class="layui-icon layui-icon-face-surprised"></i></div>
|
||||
<div class="icon"><i class="layui-icon layui-icon-tree"></i></div>
|
||||
<div class="tips">直播已结束,谢谢关注!</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -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(),
|
||||
]));
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -129,9 +129,15 @@ class Alipay extends PayService
|
||||
|
||||
$this->eventsManager->fire('pay:afterPay', $this, $trade);
|
||||
|
||||
$trade = $tradeRepo->findById($trade->id);
|
||||
|
||||
if ($trade->status == TradeModel::STATUS_FINISHED) {
|
||||
return $this->gateway->success();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询交易(扫码生成订单后可执行)
|
||||
*
|
||||
|
@ -131,9 +131,15 @@ class Wxpay extends PayService
|
||||
|
||||
$this->eventsManager->fire('pay:afterPay', $this, $trade);
|
||||
|
||||
$trade = $tradeRepo->findById($trade->id);
|
||||
|
||||
if ($trade->status == TradeModel::STATUS_FINISHED) {
|
||||
return $this->gateway->success();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询交易(扫码生成订单后可执行)
|
||||
*
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user