1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-26 04:21:27 +08:00

调整markdown安全级别

This commit is contained in:
koogua 2021-09-17 10:21:46 +08:00
commit e9a6373a55
13 changed files with 192 additions and 33 deletions

View File

@ -1,3 +1,30 @@
### [v1.4.4](https://gitee.com/koogua/course-tencent-cloud/releases/v1.4.4)(2021-09-17)
- 后台增加邮件手机登录选择配置
- 增加移动端支付选项配置
- 首页增加秒杀,直播,提问,文章接口
- 增加秒杀列表列表接口
- 调整markdown解析安全级别
- 精简取消点赞以及取消收藏逻辑
- 修复浮点转整型精度丢失造成的支付回调失败
- 修复竖屏直播时造成的位置错乱
- 修复视频清晰度配置序列化问题
- 修复评论取消点赞数量不变问题
- 修复章节资源数量问题
- 修复删除课程后引发的用户课程列表错误问题
- 修正课程咨询列表查询条件
- 修正回答,兑换礼品说明重复转译的问题
- 资源下载查询主键由md5改为加密的ID
- 去除上传文件md5唯一索引
- 去除课程发布对章节的要求
- 去除点播回调中的处理数量限制
- 优化文章,课程,提问,群组全文搜索
- 优化直播列表数据结构
- 优化章节目录交互呈现
- 优化后台添加学员重复检查
- 优化订单发货逻辑
- 优化公众号订阅逻辑
### [v1.4.3](https://gitee.com/koogua/course-tencent-cloud/releases/v1.4.3)(2021-08-23)
- 优化邮件验证码

View File

@ -350,10 +350,12 @@ class SettingController extends Controller
$qqAuth = $settingService->getQQAuthSettings();
$weixinAuth = $settingService->getWeixinAuthSettings();
$weiboAuth = $settingService->getWeiboAuthSettings();
$localAuth = $settingService->getLocalAuthSettings();
$this->view->setVar('qq_auth', $qqAuth);
$this->view->setVar('weixin_auth', $weixinAuth);
$this->view->setVar('weibo_auth', $weiboAuth);
$this->view->setVar('local_auth', $localAuth);
}
}

View File

@ -1205,7 +1205,7 @@ class AuthNode extends Service
],
[
'id' => '5-1-12',
'title' => '开放登录',
'title' => '登录设置',
'type' => 'menu',
'route' => 'admin.setting.oauth',
],

View File

@ -15,6 +15,11 @@ use App\Services\WeChat as WeChatService;
class Setting extends Service
{
public function getLocalAuthSettings()
{
return $this->getSettings('oauth.local');
}
public function getQQAuthSettings()
{
$oauth = $this->getSettings('oauth.qq');

View File

@ -4,12 +4,16 @@
<div class="layui-tab layui-tab-brief">
<ul class="layui-tab-title kg-tab-title">
<li class="layui-this">QQ登录</li>
<li class="layui-this">本地登录</li>
<li>QQ登录</li>
<li>微信登录</li>
<li>新浪微博</li>
<li>微博登录</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
{{ partial('setting/oauth_local') }}
</div>
<div class="layui-tab-item">
{{ partial('setting/oauth_qq') }}
</div>
<div class="layui-tab-item">

View File

@ -0,0 +1,24 @@
<form class="layui-form kg-form" method="POST" action="{{ url({'for':'admin.setting.oauth'}) }}">
<div class="layui-form-item">
<label class="layui-form-label">开启手机登录</label>
<div class="layui-input-block">
<input type="radio" name="login_with_phone" value="1" title="是" {% if local_auth.login_with_phone == "1" %}checked="checked"{% endif %}>
<input type="radio" name="login_with_phone" value="0" title="否" {% if local_auth.login_with_phone == "0" %}checked="checked"{% endif %}>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">开启邮箱登录</label>
<div class="layui-input-block">
<input type="radio" name="login_with_email" value="1" title="是" {% if local_auth.login_with_email == "1" %}checked="checked"{% endif %}>
<input type="radio" name="login_with_email" value="0" title="否" {% if local_auth.login_with_email == "0" %}checked="checked"{% endif %}>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"></label>
<div class="layui-input-block">
<button class="layui-btn" lay-submit="true" lay-filter="go">提交</button>
<button type="button" class="kg-back layui-btn layui-btn-primary">返回</button>
<input type="hidden" name="section" value="oauth.local">
</div>
</div>
</form>

View File

@ -86,6 +86,24 @@ class PublicController extends Controller
return $this->jsonSuccess(['captcha' => $captcha]);
}
/**
* @Get("/payment/info", name="api.public.payment_info")
*/
public function paymentInfoAction()
{
$service = new AppService();
$alipay = $service->getSettings('pay.alipay');
$wxpay = $service->getSettings('pay.wxpay');
$content = [
'alipay' => ['enabled' => $alipay['enabled']],
'wxpay' => ['enabled' => $wxpay['enabled']],
];
return $this->jsonSuccess($content);
}
/**
* @Get("/reward/options", name="api.public.reward_options")
*/

View File

@ -90,6 +90,18 @@ class WeChatOfficialAccount extends Service
protected function handleSubscribeEvent($message)
{
$openId = $message['FromUserName'] ?? '';
$eventKey = $message['EventKey'] ?? '';
/**
* 带场景值的关注事件
*/
$userId = str_replace('qrscene_', '', $eventKey);
if ($userId && $openId) {
$this->saveWechatSubscribe($userId, $openId);
}
return new TextMessage('开心呀,我们又多了一个小伙伴!');
}
@ -115,26 +127,8 @@ class WeChatOfficialAccount extends Service
$userId = str_replace('qrscene_', '', $eventKey);
$userRepo = new UserRepo();
$user = $userRepo->findById($userId);
if (!$user) return $this->emptyReply();
$subscribeRepo = new WeChatSubscribeRepo();
$subscribe = $subscribeRepo->findByOpenId($openId);
if ($subscribe) {
if ($subscribe->user_id != $userId) {
$subscribe->user_id = $userId;
}
$subscribe->update();
} else {
$subscribe = new WeChatSubscribeModel();
$subscribe->user_id = $userId;
$subscribe->open_id = $openId;
$subscribe->create();
if ($userId && $openId) {
$this->saveWechatSubscribe($userId, $openId);
}
return $this->emptyReply();
@ -200,4 +194,31 @@ class WeChatOfficialAccount extends Service
return new TextMessage('没有匹配的服务哦!');
}
protected function saveWechatSubscribe($userId, $openId)
{
if (!$userId || !$openId) return;
$userRepo = new UserRepo();
$user = $userRepo->findById($userId);
if (!$user) return;
$subscribeRepo = new WeChatSubscribeRepo();
$subscribe = $subscribeRepo->findByOpenId($openId);
if ($subscribe) {
if ($subscribe->user_id != $userId) {
$subscribe->user_id = $userId;
$subscribe->update();
}
} else {
$subscribe = new WeChatSubscribeModel();
$subscribe->user_id = $userId;
$subscribe->open_id = $openId;
$subscribe->create();
}
}
}

View File

@ -2,6 +2,9 @@
{% block content %}
{% set login_with_phone = oauth_provider.local.login_with_phone == 1 %}
{% set login_with_email = oauth_provider.local.login_with_email == 1 %}
<div class="layui-breadcrumb breadcrumb">
<a href="/">首页</a>
<a><cite>登录</cite></a>

View File

@ -1,8 +1,20 @@
<form class="layui-form account-form" method="POST" action="{{ url({'for':'home.account.pwd_login'}) }}">
<div class="layui-form-item">
<label class="layui-icon layui-icon-username"></label>
<input class="layui-input" type="text" name="account" value="100015@163.com" autocomplete="off" placeholder="手机 / 邮箱" lay-verify="required">
</div>
{% if login_with_phone and login_with_email %}
<div class="layui-form-item">
<label class="layui-icon layui-icon-username"></label>
<input class="layui-input" type="text" name="account" value="100015@163.com" autocomplete="off" placeholder="手机 / 邮箱" lay-verify="required">
</div>
{% elseif login_with_email %}
<div class="layui-form-item">
<label class="layui-icon layui-icon-email"></label>
<input class="layui-input" type="text" name="account" value="100015@163.com" autocomplete="off" placeholder="邮箱" lay-verify="email">
</div>
{% else %}
<div class="layui-form-item">
<label class="layui-icon layui-icon-cellphone"></label>
<input class="layui-input" type="text" name="account" value="13507083515" autocomplete="off" placeholder="手机" lay-verify="phone">
</div>
{% endif %}
<div class="layui-form-item">
<label class="layui-icon layui-icon-password"></label>
<input class="layui-input" type="password" name="password" value="123456" autocomplete="off" placeholder="密码" lay-verify="required">

View File

@ -413,7 +413,7 @@ function kg_cos_icon_url($path, $style = null)
/**
* 清除存储图片处理样式
*
* @param $path
* @param string $path
* @return string
*/
function kg_cos_img_style_trim($path)
@ -424,16 +424,18 @@ function kg_cos_img_style_trim($path)
/**
* 解析markdown内容
*
* @param $content
* @param string $content
* @param string $htmlInput (escape|strip)
* @param bool $allowUnsafeLinks
* @return string
*/
function kg_parse_markdown($content)
function kg_parse_markdown($content, $htmlInput = 'escape', $allowUnsafeLinks = false)
{
$content = str_replace('!content_800', '', $content);
$parser = new League\CommonMark\GithubFlavoredMarkdownConverter([
'html_input' => 'strip',
'allow_unsafe_links' => false,
'html_input' => $htmlInput,
'allow_unsafe_links' => $allowUnsafeLinks,
]);
return $parser->convertToHtml($content);
@ -442,7 +444,7 @@ function kg_parse_markdown($content)
/**
* 解析内容摘要
*
* @param $content
* @param string $content
* @param int $length
* @return string
*/

View File

@ -14,11 +14,16 @@ class OAuthProvider extends LogicService
public function handle()
{
$local = $this->getSettings('oauth.local');
$weixin = $this->getSettings('oauth.weixin');
$weibo = $this->getSettings('oauth.weibo');
$qq = $this->getSettings('oauth.qq');
return [
'local' => [
'login_with_phone' => $local['login_with_phone'],
'login_with_email' => $local['login_with_email'],
],
'weixin' => ['enabled' => $weixin['enabled']],
'weibo' => ['enabled' => $weibo['enabled']],
'qq' => ['enabled' => $qq['enabled']],

View File

@ -0,0 +1,36 @@
<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
use Phinx\Migration\AbstractMigration;
final class V20210916072842 extends AbstractMigration
{
public function up()
{
$this->handleLocalAuthSetting();
}
protected function handleLocalAuthSetting()
{
$rows = [
[
'section' => 'oauth.local',
'item_key' => 'login_with_phone',
'item_value' => '1',
],
[
'section' => 'oauth.local',
'item_key' => 'login_with_email',
'item_value' => '1',
]
];
$this->table('kg_setting')->insert($rows)->save();
}
}