mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-28 05:11:39 +08:00
parent
46d1c35d21
commit
6679214808
@ -29,7 +29,7 @@
|
||||
|
||||
#### 使用协议
|
||||
|
||||
虽然尝试了解过开源协议,但是理解的模棱两可,干脆用自己的协议吧,算不算开源我也不很清楚。
|
||||
虽然尝试了解过开源协议,但是理解的模棱两可,干脆用自己的协议吧。
|
||||
|
||||
1. 本系统属于强业务类型,非通用类库框架,不适合再次衍生发布。
|
||||
2. 在保留我们版权标识的前提下,用户可以修改以满足自己的需求,可以用于商业用途。
|
||||
@ -74,7 +74,7 @@
|
||||
|
||||
#### 有商业服务吗?
|
||||
|
||||
生存是一个问题,生存才能发展,我们为用户提供的服务包括:
|
||||
生存才能发展,我们目前提供的服务包括:
|
||||
|
||||
- 系统安装
|
||||
- 系统定制
|
||||
|
@ -12,8 +12,6 @@ class SyncCourseIndexTask extends Task
|
||||
|
||||
public function mainAction()
|
||||
{
|
||||
$cache = $this->getCache();
|
||||
|
||||
$redis = $this->getRedis();
|
||||
|
||||
$key = $this->getSyncKey();
|
||||
|
@ -12,8 +12,6 @@ class SyncGroupIndexTask extends Task
|
||||
|
||||
public function mainAction()
|
||||
{
|
||||
$cache = $this->getCache();
|
||||
|
||||
$redis = $this->getRedis();
|
||||
|
||||
$key = $this->getSyncKey();
|
||||
|
@ -16,8 +16,6 @@ class SyncLearningTask extends Task
|
||||
|
||||
public function mainAction()
|
||||
{
|
||||
$cache = $this->getCache();
|
||||
|
||||
$redis = $this->getRedis();
|
||||
|
||||
$sync = new LearningSync();
|
||||
|
@ -12,8 +12,6 @@ class SyncUserIndexTask extends Task
|
||||
|
||||
public function mainAction()
|
||||
{
|
||||
$cache = $this->getCache();
|
||||
|
||||
$redis = $this->getRedis();
|
||||
|
||||
$key = $this->getSyncKey();
|
||||
|
@ -43,7 +43,7 @@ class UpgradeTask extends Task
|
||||
public function resetAnnotationAction()
|
||||
{
|
||||
$config = $this->getConfig();
|
||||
$cache = $this->getCache();
|
||||
|
||||
$redis = $this->getRedis();
|
||||
|
||||
$dbIndex = $config->path('annotation.db');
|
||||
@ -74,7 +74,7 @@ class UpgradeTask extends Task
|
||||
public function resetMetadataAction()
|
||||
{
|
||||
$config = $this->getConfig();
|
||||
$cache = $this->getCache();
|
||||
|
||||
$redis = $this->getRedis();
|
||||
|
||||
$dbIndex = $config->path('metadata.db');
|
||||
|
@ -14,9 +14,18 @@ class WxpayTest extends PayTest
|
||||
{
|
||||
$wxpayService = new WxpayService();
|
||||
|
||||
$qrcode = $wxpayService->scan($trade);
|
||||
$code = $wxpayService->scan($trade);
|
||||
|
||||
return $qrcode ?: false;
|
||||
$codeUrl = null;
|
||||
|
||||
if ($code) {
|
||||
$codeUrl = $this->url->get(
|
||||
['for' => 'home.qrcode'],
|
||||
['text' => urlencode($code)]
|
||||
);
|
||||
}
|
||||
|
||||
return $codeUrl ?: false;
|
||||
}
|
||||
|
||||
public function status($tradeNo)
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="model" value="1" title="点播" lay-filter="model" checked="checked">
|
||||
<input type="radio" name="model" value="2" title="直播" lay-filter="model">
|
||||
<input type="radio" name="model" value="3" title="图文" lay-filter="model">
|
||||
<input type="radio" name="model" value="3" title="专栏" lay-filter="model">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
|
@ -8,7 +8,7 @@
|
||||
{% elseif value == 2 %}
|
||||
<span class="layui-badge layui-bg-blue">直播</span>
|
||||
{% elseif value == 3 %}
|
||||
<span class="layui-badge layui-bg-black">图文</span>
|
||||
<span class="layui-badge layui-bg-black">专栏</span>
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="model" value="1" title="点播">
|
||||
<input type="radio" name="model" value="2" title="直播">
|
||||
<input type="radio" name="model" value="3" title="图文">
|
||||
<input type="radio" name="model" value="3" title="专栏">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
|
@ -19,7 +19,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">API密钥</label>
|
||||
<label class="layui-form-label">API Key</label>
|
||||
<div class="layui-input-block">
|
||||
<input class="layui-input" type="text" name="key" value="{{ wxpay.key }}" lay-verify="required">
|
||||
</div>
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Http\Home\Controllers;
|
||||
|
||||
use App\Caches\NavTreeList as NavCache;
|
||||
use App\Caches\Setting as SettingCache;
|
||||
use App\Library\AppInfo as AppInfo;
|
||||
use App\Library\Seo as Seo;
|
||||
use App\Models\User as UserModel;
|
||||
@ -116,9 +115,7 @@ class Controller extends \Phalcon\Mvc\Controller
|
||||
|
||||
protected function getSiteInfo()
|
||||
{
|
||||
$appService = new AppService();
|
||||
|
||||
return $appService->getSettings('site');
|
||||
return $this->getSettings('site');
|
||||
}
|
||||
|
||||
protected function getAppInfo()
|
||||
@ -128,8 +125,6 @@ class Controller extends \Phalcon\Mvc\Controller
|
||||
|
||||
protected function getImInfo()
|
||||
{
|
||||
$cache = new SettingCache();
|
||||
|
||||
$websocket = $this->getConfig()->get('websocket');
|
||||
|
||||
/**
|
||||
@ -142,8 +137,8 @@ class Controller extends \Phalcon\Mvc\Controller
|
||||
}
|
||||
|
||||
return [
|
||||
'main' => $cache->get('im.main'),
|
||||
'cs' => $cache->get('im.cs'),
|
||||
'main' => $this->getSettings('im.main'),
|
||||
'cs' => $this->getSettings('im.cs'),
|
||||
'ws' => $websocket,
|
||||
];
|
||||
}
|
||||
@ -155,4 +150,11 @@ class Controller extends \Phalcon\Mvc\Controller
|
||||
return $appService->getConfig();
|
||||
}
|
||||
|
||||
protected function getSettings($section)
|
||||
{
|
||||
$appService = new AppService();
|
||||
|
||||
return $appService->getSettings($section);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -67,7 +67,10 @@ class OrderController extends Controller
|
||||
|
||||
$order = $service->handle();
|
||||
|
||||
$location = $this->url->get(['for' => 'home.order.pay'], ['sn' => $order->sn]);
|
||||
$location = $this->url->get(
|
||||
['for' => 'home.order.pay'],
|
||||
['sn' => $order->sn]
|
||||
);
|
||||
|
||||
return $this->jsonSuccess(['location' => $location]);
|
||||
}
|
||||
|
@ -72,9 +72,20 @@ class Trade extends Service
|
||||
|
||||
protected function getWxpayQrCode(TradeModel $trade)
|
||||
{
|
||||
$qrCode = null;
|
||||
|
||||
$service = new WxpayService();
|
||||
|
||||
return $service->scan($trade);
|
||||
$text = $service->scan($trade);
|
||||
|
||||
if ($text) {
|
||||
$qrCode = $this->url->get(
|
||||
['for' => 'home.qrcode'],
|
||||
['text' => urlencode($text)]
|
||||
);
|
||||
}
|
||||
|
||||
return $qrCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,10 +21,10 @@
|
||||
</table>
|
||||
<br>
|
||||
<div class="center">
|
||||
{% if order.status == 'pending' %}
|
||||
{% if order.status == 1 %}
|
||||
<a class="layui-btn layui-bg-blue" href="{{ order_pay_url }}" target="_top">立即支付</a>
|
||||
{% endif %}
|
||||
{% if (order.item_type in ['course','package']) and (order.status == 'finished') %}
|
||||
{% if (order.item_type in [1,2]) and (order.status == 3) %}
|
||||
<a class="layui-btn layui-bg-blue" href="{{ refund_confirm_url }}">申请退款</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% set create_url = url({'for':'home.trade.create'}) %}
|
||||
{% set status_url = url({'for':'home.trade.status'}) %}
|
||||
|
||||
<div class="layui-breadcrumb breadcrumb">
|
||||
<a href="/">首页</a>
|
||||
<a><cite>支付订单</cite></a>
|
||||
@ -14,10 +17,8 @@
|
||||
支付金额:<span class="amount">{{ '¥%0.2f'|format(order.amount) }}</span>
|
||||
</div>
|
||||
<div class="channel">
|
||||
{% set create_url = url({'for':'home.trade.create'}) %}
|
||||
{% set status_url = url({'for':'home.trade.status'}) %}
|
||||
<a class="alipay btn-pay" href="javascript:" data-channel="1"></a>
|
||||
<a class="wxpay btn-pay" href="javascript:" data-channel="2"></a>
|
||||
<a class="alipay btn-pay" href="javascript:" data-channel="alipay">{{ image('home/img/alipay.png') }}</a>
|
||||
<a class="wxpay btn-pay" href="javascript:" data-channel="wxpay">{{ image('home/img/wxpay.png') }}</a>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<span class="tips">友情提示:请在12小时内完成支付,有问题请联系客服</span>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<a href="javascript:" class="nav-search" data-type="{{ s_type }}" data-query="{{ s_query }}" data-url="{{ s_url }}"><i class="layui-icon layui-icon-search"></i> 搜索</a>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<a href="{{ url({'for':'home.vip.index'}) }}" class="nav-vip" target="vip"><i class="layui-icon layui-icon-diamond"></i> 会员</a>
|
||||
<a href="{{ url({'for':'home.vip.index'}) }}" class="nav-vip"><i class="layui-icon layui-icon-diamond"></i> 会员</a>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<a href="{{ url({'for':'home.im.index'}) }}" class="nav-im" target="im"><i class="layui-icon layui-icon-chat"></i> 微聊</a>
|
||||
|
@ -7,7 +7,7 @@
|
||||
{% set status_types = {'all':'全部','pending':'待回复','replied':'已回复'} %}
|
||||
{% set status = request.get('status','trim','all') %}
|
||||
|
||||
<div class="layout-main">
|
||||
<div class="layout-main clearfix">
|
||||
<div class="my-sidebar">{{ partial('teacher/console/menu') }}</div>
|
||||
<div class="my-content">
|
||||
<div class="wrap">
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
{{ partial('macros/course') }}
|
||||
|
||||
<div class="layout-main">
|
||||
<div class="layout-main clearfix">
|
||||
<div class="my-sidebar">{{ partial('teacher/console/menu') }}</div>
|
||||
<div class="my-content">
|
||||
<div class="wrap">
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
{{ partial('macros/course') }}
|
||||
|
||||
<div class="layout-main">
|
||||
<div class="layout-main clearfix">
|
||||
<div class="my-sidebar">{{ partial('teacher/console/menu') }}</div>
|
||||
<div class="my-content">
|
||||
<div class="wrap">
|
||||
|
@ -6,7 +6,7 @@
|
||||
{% set edit_phone_url = url({'for':'home.account.edit_phone'}) %}
|
||||
{% set edit_email_url = url({'for':'home.account.edit_email'}) %}
|
||||
|
||||
<div class="layout-main">
|
||||
<div class="layout-main clearfix">
|
||||
<div class="my-sidebar">{{ partial('user/console/menu') }}</div>
|
||||
<div class="my-content">
|
||||
<div class="wrap">
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
{{ partial('macros/course') }}
|
||||
|
||||
<div class="layout-main">
|
||||
<div class="layout-main clearfix">
|
||||
<div class="my-sidebar">{{ partial('user/console/menu') }}</div>
|
||||
<div class="my-content">
|
||||
<div class="wrap">
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
{{ partial('macros/course') }}
|
||||
|
||||
<div class="layout-main">
|
||||
<div class="layout-main clearfix">
|
||||
<div class="my-sidebar">{{ partial('user/console/menu') }}</div>
|
||||
<div class="my-content">
|
||||
<div class="wrap">
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
{{ partial('macros/course') }}
|
||||
|
||||
<div class="layout-main">
|
||||
<div class="layout-main clearfix">
|
||||
<div class="my-sidebar">{{ partial('user/console/menu') }}</div>
|
||||
<div class="my-content">
|
||||
<div class="wrap">
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
{{ partial('macros/user') }}
|
||||
|
||||
<div class="layout-main">
|
||||
<div class="layout-main clearfix">
|
||||
<div class="my-sidebar">{{ partial('user/console/menu') }}</div>
|
||||
<div class="my-content">
|
||||
<div class="wrap">
|
||||
|
@ -9,7 +9,7 @@
|
||||
{% set joined_class = scope == 'joined' ? 'layui-btn layui-btn-xs' : 'none' %}
|
||||
{% set owned_class = scope == 'owned' ? 'layui-btn layui-btn-xs' : 'none' %}
|
||||
|
||||
<div class="layout-main">
|
||||
<div class="layout-main clearfix">
|
||||
<div class="my-sidebar">{{ partial('user/console/menu') }}</div>
|
||||
<div class="my-content">
|
||||
<div class="my-nav">
|
||||
|
@ -7,7 +7,7 @@
|
||||
{% set status_types = {'0':'全部','1':'待支付','3':'已完成','4':'已关闭','5':'已退款'} %}
|
||||
{% set status = request.get('status','trim','0') %}
|
||||
|
||||
<div class="layout-main">
|
||||
<div class="layout-main clearfix">
|
||||
<div class="my-sidebar">{{ partial('user/console/menu') }}</div>
|
||||
<div class="my-content">
|
||||
<div class="my-nav">
|
||||
|
@ -7,7 +7,7 @@
|
||||
{% set gender_female_checked = user.gender == 2 ? 'checked' : '' %}
|
||||
{% set gender_none_checked = user.gender == 3 ? 'checked' : '' %}
|
||||
|
||||
<div class="layout-main">
|
||||
<div class="layout-main clearfix">
|
||||
<div class="my-sidebar">{{ partial('user/console/menu') }}</div>
|
||||
<div class="my-content">
|
||||
<div class="wrap">
|
||||
|
@ -7,7 +7,7 @@
|
||||
{% set status_types = {'0':'全部','1':'待处理','2':'已取消','3':'退款中','5':'已完成'} %}
|
||||
{% set status = request.get('status','int','0') %}
|
||||
|
||||
<div class="layout-main">
|
||||
<div class="layout-main clearfix">
|
||||
<div class="my-sidebar">{{ partial('user/console/menu') }}</div>
|
||||
<div class="my-content">
|
||||
<div class="my-nav">
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
{{ partial('macros/course') }}
|
||||
|
||||
<div class="layout-main">
|
||||
<div class="layout-main clearfix">
|
||||
<div class="my-sidebar">{{ partial('user/console/menu') }}</div>
|
||||
<div class="my-content">
|
||||
<div class="wrap">
|
||||
|
@ -71,6 +71,11 @@ class Audit extends Model
|
||||
$this->create_time = time();
|
||||
|
||||
if (is_array($this->req_data) && !empty($this->req_data)) {
|
||||
foreach ($this->req_data as $key => $value) {
|
||||
if (kg_strlen($value) > 255) {
|
||||
$this->req_data[$key] = kg_substr($value, 0, 255);
|
||||
}
|
||||
}
|
||||
$this->req_data = kg_json_encode($this->req_data);
|
||||
} else {
|
||||
$this->req_data = '';
|
||||
|
@ -367,7 +367,7 @@ class Course extends Model
|
||||
return [
|
||||
self::MODEL_VOD => '点播',
|
||||
self::MODEL_LIVE => '直播',
|
||||
self::MODEL_READ => '图文',
|
||||
self::MODEL_READ => '专栏',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Phalcon\Http\Response\Cookies as PhCookies;
|
||||
|
||||
class Cookie extends Provider
|
||||
{
|
||||
|
||||
@ -11,6 +13,11 @@ class Cookie extends Provider
|
||||
{
|
||||
$this->di->setShared($this->serviceName, function () {
|
||||
|
||||
$cookies = new PhCookies();
|
||||
|
||||
$cookies->useEncryption(true);
|
||||
|
||||
return $cookies;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Phalcon\Escaper as PhalconEscaper;
|
||||
use Phalcon\Escaper as PhEscaper;
|
||||
|
||||
class Escaper extends Provider
|
||||
{
|
||||
@ -11,7 +11,7 @@ class Escaper extends Provider
|
||||
|
||||
public function register()
|
||||
{
|
||||
$this->di->setShared($this->serviceName, PhalconEscaper::class);
|
||||
$this->di->setShared($this->serviceName, PhEscaper::class);
|
||||
}
|
||||
|
||||
}
|
@ -87,6 +87,7 @@ class Alipay extends PayService
|
||||
|
||||
/**
|
||||
* 异步通知
|
||||
*
|
||||
* @return Response|bool
|
||||
*/
|
||||
public function notify()
|
||||
|
@ -18,18 +18,7 @@ class Category extends Validator
|
||||
*/
|
||||
public function checkCategoryCache($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxCategoryIdCache = new MaxCategoryIdCache();
|
||||
|
||||
$maxCategoryId = $maxCategoryIdCache->get();
|
||||
|
||||
/**
|
||||
* 防止缓存穿透
|
||||
*/
|
||||
if ($id < 1 || $id > $maxCategoryId) {
|
||||
throw new BadRequestException('category.not_found');
|
||||
}
|
||||
$this->checkId($id);
|
||||
|
||||
$categoryCache = new CategoryCache();
|
||||
|
||||
@ -44,6 +33,8 @@ class Category extends Validator
|
||||
|
||||
public function checkCategory($id)
|
||||
{
|
||||
$this->checkId($id);
|
||||
|
||||
$categoryRepo = new CategoryRepo();
|
||||
|
||||
$category = $categoryRepo->findById($id);
|
||||
@ -55,6 +46,19 @@ class Category extends Validator
|
||||
return $category;
|
||||
}
|
||||
|
||||
public function checkId($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxIdCache = new MaxCategoryIdCache();
|
||||
|
||||
$maxId = $maxIdCache->get();
|
||||
|
||||
if ($id < 1 || $id > $maxId) {
|
||||
throw new BadRequestException('category.not_found');
|
||||
}
|
||||
}
|
||||
|
||||
public function checkParent($id)
|
||||
{
|
||||
$categoryRepo = new CategoryRepo();
|
||||
|
@ -19,18 +19,7 @@ class Chapter extends Validator
|
||||
*/
|
||||
public function checkChapterCache($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxChapterIdCache = new MaxChapterIdCache();
|
||||
|
||||
$maxChapterId = $maxChapterIdCache->get();
|
||||
|
||||
/**
|
||||
* 防止缓存穿透
|
||||
*/
|
||||
if ($id < 1 || $id > $maxChapterId) {
|
||||
throw new BadRequestException('chapter.not_found');
|
||||
}
|
||||
$this->checkId($id);
|
||||
|
||||
$chapterCache = new ChapterCache();
|
||||
|
||||
@ -45,6 +34,8 @@ class Chapter extends Validator
|
||||
|
||||
public function checkChapterVod($id)
|
||||
{
|
||||
$this->checkId($id);
|
||||
|
||||
$chapterRepo = new ChapterRepo();
|
||||
|
||||
$chapterVod = $chapterRepo->findChapterVod($id);
|
||||
@ -58,6 +49,8 @@ class Chapter extends Validator
|
||||
|
||||
public function checkChapterLive($id)
|
||||
{
|
||||
$this->checkId($id);
|
||||
|
||||
$chapterRepo = new ChapterRepo();
|
||||
|
||||
$chapterLive = $chapterRepo->findChapterLive($id);
|
||||
@ -71,6 +64,8 @@ class Chapter extends Validator
|
||||
|
||||
public function checkChapterRead($id)
|
||||
{
|
||||
$this->checkId($id);
|
||||
|
||||
$chapterRepo = new ChapterRepo();
|
||||
|
||||
$chapterRead = $chapterRepo->findChapterRead($id);
|
||||
@ -84,6 +79,8 @@ class Chapter extends Validator
|
||||
|
||||
public function checkChapter($id)
|
||||
{
|
||||
$this->checkId($id);
|
||||
|
||||
$chapterRepo = new ChapterRepo();
|
||||
|
||||
$chapter = $chapterRepo->findById($id);
|
||||
@ -95,6 +92,19 @@ class Chapter extends Validator
|
||||
return $chapter;
|
||||
}
|
||||
|
||||
public function checkId($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxIdCache = new MaxChapterIdCache();
|
||||
|
||||
$maxId = $maxIdCache->get();
|
||||
|
||||
if ($id < 1 || $id > $maxId) {
|
||||
throw new BadRequestException('chapter.not_found');
|
||||
}
|
||||
}
|
||||
|
||||
public function checkCourse($id)
|
||||
{
|
||||
$validator = new Course();
|
||||
|
@ -19,18 +19,7 @@ class Course extends Validator
|
||||
*/
|
||||
public function checkCourseCache($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxCache = new MaxCourseIdCache();
|
||||
|
||||
$maxId = $maxCache->get();
|
||||
|
||||
/**
|
||||
* 防止缓存穿透
|
||||
*/
|
||||
if ($id < 1 || $id > $maxId) {
|
||||
throw new BadRequestException('course.not_found');
|
||||
}
|
||||
$this->checkId($id);
|
||||
|
||||
$courseCache = new CourseCache();
|
||||
|
||||
@ -45,6 +34,8 @@ class Course extends Validator
|
||||
|
||||
public function checkCourse($id)
|
||||
{
|
||||
$this->checkId($id);
|
||||
|
||||
$courseRepo = new CourseRepo();
|
||||
|
||||
$course = $courseRepo->findById($id);
|
||||
@ -56,6 +47,19 @@ class Course extends Validator
|
||||
return $course;
|
||||
}
|
||||
|
||||
public function checkId($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxIdCache = new MaxCourseIdCache();
|
||||
|
||||
$maxId = $maxIdCache->get();
|
||||
|
||||
if ($id < 1 || $id > $maxId) {
|
||||
throw new BadRequestException('course.not_found');
|
||||
}
|
||||
}
|
||||
|
||||
public function checkModel($model)
|
||||
{
|
||||
$list = CourseModel::modelTypes();
|
||||
|
@ -18,18 +18,7 @@ class Help extends Validator
|
||||
*/
|
||||
public function checkHelpCache($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxHelpIdCache = new MaxHelpIdCache();
|
||||
|
||||
$maxHelpId = $maxHelpIdCache->get();
|
||||
|
||||
/**
|
||||
* 防止缓存穿透
|
||||
*/
|
||||
if ($id < 1 || $id > $maxHelpId) {
|
||||
throw new BadRequestException('help.not_found');
|
||||
}
|
||||
$this->checkId($id);
|
||||
|
||||
$helpCache = new HelpCache();
|
||||
|
||||
@ -55,6 +44,19 @@ class Help extends Validator
|
||||
return $help;
|
||||
}
|
||||
|
||||
public function checkId($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxIdCache = new MaxHelpIdCache();
|
||||
|
||||
$maxId = $maxIdCache->get();
|
||||
|
||||
if ($id < 1 || $id > $maxId) {
|
||||
throw new BadRequestException('help.not_found');
|
||||
}
|
||||
}
|
||||
|
||||
public function checkCategory($id)
|
||||
{
|
||||
$validator = new Category();
|
||||
|
@ -19,18 +19,7 @@ class ImGroup extends Validator
|
||||
*/
|
||||
public function checkGroupCache($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxGroupIdCache = new MaxImGroupIdCache();
|
||||
|
||||
$maxGroupId = $maxGroupIdCache->get();
|
||||
|
||||
/**
|
||||
* 防止缓存穿透
|
||||
*/
|
||||
if ($id < 1 || $id > $maxGroupId) {
|
||||
throw new BadRequestException('im_group.not_found');
|
||||
}
|
||||
$this->checkId($id);
|
||||
|
||||
$groupCache = new ImGroupCache();
|
||||
|
||||
@ -45,6 +34,8 @@ class ImGroup extends Validator
|
||||
|
||||
public function checkGroup($id)
|
||||
{
|
||||
$this->checkId($id);
|
||||
|
||||
$groupRepo = new ImGroupRepo();
|
||||
|
||||
$group = $groupRepo->findById($id);
|
||||
@ -56,6 +47,19 @@ class ImGroup extends Validator
|
||||
return $group;
|
||||
}
|
||||
|
||||
public function checkId($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxGroupIdCache = new MaxImGroupIdCache();
|
||||
|
||||
$maxId = $maxGroupIdCache->get();
|
||||
|
||||
if ($id < 1 || $id > $maxId) {
|
||||
throw new BadRequestException('im_group.not_found');
|
||||
}
|
||||
}
|
||||
|
||||
public function checkName($name)
|
||||
{
|
||||
$value = $this->filter->sanitize($name, ['trim', 'string']);
|
||||
|
@ -18,18 +18,7 @@ class Package extends Validator
|
||||
*/
|
||||
public function checkPackageCache($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxPackageIdCache = new MaxPackageIdCache();
|
||||
|
||||
$maxPackageId = $maxPackageIdCache->get();
|
||||
|
||||
/**
|
||||
* 防止缓存穿透
|
||||
*/
|
||||
if ($id < 1 || $id > $maxPackageId) {
|
||||
throw new BadRequestException('package.not_found');
|
||||
}
|
||||
$this->checkId($id);
|
||||
|
||||
$packageCache = new PackageCache();
|
||||
|
||||
@ -44,6 +33,8 @@ class Package extends Validator
|
||||
|
||||
public function checkPackage($id)
|
||||
{
|
||||
$this->checkId($id);
|
||||
|
||||
$packageRepo = new PackageRepo();
|
||||
|
||||
$package = $packageRepo->findById($id);
|
||||
@ -55,6 +46,19 @@ class Package extends Validator
|
||||
return $package;
|
||||
}
|
||||
|
||||
public function checkId($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxIdCache = new MaxPackageIdCache();
|
||||
|
||||
$maxId = $maxIdCache->get();
|
||||
|
||||
if ($id < 1 || $id > $maxId) {
|
||||
throw new BadRequestException('package.not_found');
|
||||
}
|
||||
}
|
||||
|
||||
public function checkTitle($title)
|
||||
{
|
||||
$value = $this->filter->sanitize($title, ['trim', 'string']);
|
||||
|
@ -18,18 +18,7 @@ class Page extends Validator
|
||||
*/
|
||||
public function checkPageCache($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxPageIdCache = new MaxPageIdCache();
|
||||
|
||||
$maxPageId = $maxPageIdCache->get();
|
||||
|
||||
/**
|
||||
* 防止缓存穿透
|
||||
*/
|
||||
if ($id < 1 || $id > $maxPageId) {
|
||||
throw new BadRequestException('page.not_found');
|
||||
}
|
||||
$this->checkId($id);
|
||||
|
||||
$pageCache = new PageCache();
|
||||
|
||||
@ -44,6 +33,8 @@ class Page extends Validator
|
||||
|
||||
public function checkPage($id)
|
||||
{
|
||||
$this->checkId($id);
|
||||
|
||||
$pageRepo = new PageRepo();
|
||||
|
||||
$page = $pageRepo->findById($id);
|
||||
@ -55,6 +46,19 @@ class Page extends Validator
|
||||
return $page;
|
||||
}
|
||||
|
||||
public function checkId($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxIdCache = new MaxPageIdCache();
|
||||
|
||||
$maxId = $maxIdCache->get();
|
||||
|
||||
if ($id < 1 || $id > $maxId) {
|
||||
throw new BadRequestException('page.not_found');
|
||||
}
|
||||
}
|
||||
|
||||
public function checkTitle($title)
|
||||
{
|
||||
$value = $this->filter->sanitize($title, ['trim', 'string']);
|
||||
|
@ -18,18 +18,7 @@ class Topic extends Validator
|
||||
*/
|
||||
public function checkTopicCache($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxTopicIdCache = new MaxTopicIdCache();
|
||||
|
||||
$maxTopicId = $maxTopicIdCache->get();
|
||||
|
||||
/**
|
||||
* 防止缓存穿透
|
||||
*/
|
||||
if ($id < 1 || $id > $maxTopicId) {
|
||||
throw new BadRequestException('topic.not_found');
|
||||
}
|
||||
$this->checkId($id);
|
||||
|
||||
$topicCache = new TopicCache();
|
||||
|
||||
@ -44,6 +33,8 @@ class Topic extends Validator
|
||||
|
||||
public function checkTopic($id)
|
||||
{
|
||||
$this->checkId($id);
|
||||
|
||||
$topicRepo = new TopicRepo();
|
||||
|
||||
$topic = $topicRepo->findById($id);
|
||||
@ -55,6 +46,19 @@ class Topic extends Validator
|
||||
return $topic;
|
||||
}
|
||||
|
||||
public function checkId($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxIdCache = new MaxTopicIdCache();
|
||||
|
||||
$maxId = $maxIdCache->get();
|
||||
|
||||
if ($id < 1 || $id > $maxId) {
|
||||
throw new BadRequestException('topic.not_found');
|
||||
}
|
||||
}
|
||||
|
||||
public function checkTitle($title)
|
||||
{
|
||||
$value = $this->filter->sanitize($title, ['trim', 'string']);
|
||||
|
@ -21,18 +21,7 @@ class User extends Validator
|
||||
*/
|
||||
public function checkUserCache($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxUserIdCache = new MaxUserIdCache();
|
||||
|
||||
$maxUserId = $maxUserIdCache->get();
|
||||
|
||||
/**
|
||||
* 防止缓存穿透
|
||||
*/
|
||||
if ($id < 1 || $id > $maxUserId) {
|
||||
throw new BadRequestException('user.not_found');
|
||||
}
|
||||
$this->checkId($id);
|
||||
|
||||
$userCache = new UserCache();
|
||||
|
||||
@ -47,6 +36,8 @@ class User extends Validator
|
||||
|
||||
public function checkUser($id)
|
||||
{
|
||||
$this->checkId($id);
|
||||
|
||||
$userRepo = new UserRepo();
|
||||
|
||||
$user = $userRepo->findById($id);
|
||||
@ -58,6 +49,19 @@ class User extends Validator
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function checkId($id)
|
||||
{
|
||||
$id = intval($id);
|
||||
|
||||
$maxUserIdCache = new MaxUserIdCache();
|
||||
|
||||
$maxUserId = $maxUserIdCache->get();
|
||||
|
||||
if ($id < 1 || $id > $maxUserId) {
|
||||
throw new BadRequestException('user.not_found');
|
||||
}
|
||||
}
|
||||
|
||||
public function checkName($name)
|
||||
{
|
||||
$value = $this->filter->sanitize($name, ['trim', 'string']);
|
||||
|
@ -104,12 +104,6 @@
|
||||
list-style: decimal;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
#header {
|
||||
left: 0;
|
||||
top: 0;
|
||||
@ -122,7 +116,7 @@ body {
|
||||
#main {
|
||||
margin-top: 80px;
|
||||
margin-bottom: 30px;
|
||||
flex: 1;
|
||||
min-height: 560px;
|
||||
}
|
||||
|
||||
#footer {
|
||||
@ -1119,26 +1113,15 @@ body {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.channel .alipay, .channel .wxpay {
|
||||
.channel .btn-pay {
|
||||
width: 200px;
|
||||
height: 80px;
|
||||
display: inline-block;
|
||||
line-height: 80px;
|
||||
margin-right: 15px;
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.channel .alipay {
|
||||
background-image: url("/static/web/img/alipay.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
||||
|
||||
.channel .wxpay {
|
||||
background-image: url("/static/web/img/wxpay.png");
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
||||
|
||||
.payment .footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -16,7 +16,10 @@ layui.use(['jquery', 'layer'], function () {
|
||||
var qrHtml = $qrBlock.html();
|
||||
|
||||
if (qrHtml.length === 0) {
|
||||
var postData = {order_sn: orderSn, channel: channel};
|
||||
var postData = {
|
||||
order_sn: orderSn,
|
||||
channel: channel === 'alipay' ? 1 : 2
|
||||
};
|
||||
$.post(createUrl, postData, function (res) {
|
||||
qrHtml = '<div class="qrcode"><img src="' + res.qrcode + '" alt="支付二维码"></div>';
|
||||
showQrLayer(qrTitle, qrHtml);
|
||||
|
Loading…
x
Reference in New Issue
Block a user