1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-21 11:18:10 +08:00
This commit is contained in:
koogua 2021-03-20 15:59:24 +08:00
parent 88bdab6936
commit 47e03cd82b
62 changed files with 553 additions and 312 deletions

View File

@ -60,11 +60,11 @@ class CourseIndexTask extends Task
$index = $handler->getXS()->getIndex(); $index = $handler->getXS()->getIndex();
echo 'start clean course index' . PHP_EOL; echo '------ start clean course index ------' . PHP_EOL;
$index->clean(); $index->clean();
echo 'end clean course index' . PHP_EOL; echo '------ end clean course index ------' . PHP_EOL;
} }
/** /**
@ -82,7 +82,7 @@ class CourseIndexTask extends Task
$index = $handler->getXS()->getIndex(); $index = $handler->getXS()->getIndex();
echo 'start rebuild course index' . PHP_EOL; echo '------ start rebuild course index ------' . PHP_EOL;
$index->beginRebuild(); $index->beginRebuild();
@ -93,7 +93,7 @@ class CourseIndexTask extends Task
$index->endRebuild(); $index->endRebuild();
echo 'end rebuild course index' . PHP_EOL; echo '------ end rebuild course index ------' . PHP_EOL;
} }
/** /**

View File

@ -60,11 +60,11 @@ class GroupIndexTask extends Task
$index = $handler->getXS()->getIndex(); $index = $handler->getXS()->getIndex();
echo 'start clean group index' . PHP_EOL; echo '------ start clean group index ------' . PHP_EOL;
$index->clean(); $index->clean();
echo 'end clean group index' . PHP_EOL; echo '------ end clean group index ------' . PHP_EOL;
} }
/** /**
@ -82,7 +82,7 @@ class GroupIndexTask extends Task
$index = $handler->getXS()->getIndex(); $index = $handler->getXS()->getIndex();
echo 'start rebuild group index' . PHP_EOL; echo '------ start rebuild group index ------' . PHP_EOL;
$index->beginRebuild(); $index->beginRebuild();
@ -93,7 +93,7 @@ class GroupIndexTask extends Task
$index->endRebuild(); $index->endRebuild();
echo 'end rebuild group index' . PHP_EOL; echo '------ end rebuild group index ------' . PHP_EOL;
} }
/** /**

View File

@ -26,7 +26,7 @@ class OptimizeTableTask extends Task
$tableName = $sessionModel->getSource(); $tableName = $sessionModel->getSource();
$this->db->delete($tableName, "expire_time < :expire_time", [ $this->db->delete($tableName, 'expire_time < :expire_time', [
'expire_time' => strtotime('-3 days'), 'expire_time' => strtotime('-3 days'),
]); ]);
@ -39,7 +39,7 @@ class OptimizeTableTask extends Task
$tableName = $tokenModel->getSource(); $tableName = $tokenModel->getSource();
$this->db->delete($tableName, "expire_time < :expire_time", [ $this->db->delete($tableName, 'expire_time < :expire_time', [
'expire_time' => strtotime('-3 days'), 'expire_time' => strtotime('-3 days'),
]); ]);
@ -56,7 +56,7 @@ class OptimizeTableTask extends Task
$tableName = $messageModel->getSource(); $tableName = $messageModel->getSource();
$this->db->delete($tableName, "create_time < :create_time", [ $this->db->delete($tableName, 'create_time < :create_time', [
'create_time' => strtotime('-6 months'), 'create_time' => strtotime('-6 months'),
]); ]);
@ -73,7 +73,7 @@ class OptimizeTableTask extends Task
$tableName = $learningModel->getSource(); $tableName = $learningModel->getSource();
$this->db->delete($tableName, "create_time < :create_time", [ $this->db->delete($tableName, 'create_time < :create_time', [
'create_time' => strtotime('-6 months'), 'create_time' => strtotime('-6 months'),
]); ]);
@ -90,7 +90,7 @@ class OptimizeTableTask extends Task
$tableName = $taskModel->getSource(); $tableName = $taskModel->getSource();
$this->db->delete($tableName, "create_time < :create_time AND status > :status", [ $this->db->delete($tableName, 'create_time < :create_time AND status > :status', [
'create_time' => strtotime('-6 months'), 'create_time' => strtotime('-6 months'),
'status' => TaskModel::STATUS_PENDING, 'status' => TaskModel::STATUS_PENDING,
]); ]);

View File

@ -23,7 +23,7 @@ class UpgradeTask extends Task
*/ */
public function resetSettingAction() public function resetSettingAction()
{ {
echo "start reset setting..." . PHP_EOL; echo '------ start reset setting ------' . PHP_EOL;
$rows = SettingModel::query()->columns('section')->distinct(true)->execute(); $rows = SettingModel::query()->columns('section')->distinct(true)->execute();
@ -32,7 +32,7 @@ class UpgradeTask extends Task
$cache->rebuild($row->section); $cache->rebuild($row->section);
} }
echo "end reset setting..." . PHP_EOL; echo '------ end reset setting ------' . PHP_EOL;
} }
/** /**
@ -48,7 +48,7 @@ class UpgradeTask extends Task
$keys = $redis->sMembers($statsKey); $keys = $redis->sMembers($statsKey);
echo "start reset annotation..." . PHP_EOL; echo '------ start reset annotation ------' . PHP_EOL;
if (count($keys) > 0) { if (count($keys) > 0) {
$keys = $this->handlePhKeys($keys); $keys = $this->handlePhKeys($keys);
@ -56,7 +56,7 @@ class UpgradeTask extends Task
$redis->del($statsKey); $redis->del($statsKey);
} }
echo "end reset annotation..." . PHP_EOL; echo '------ end reset annotation ------' . PHP_EOL;
} }
/** /**
@ -72,7 +72,7 @@ class UpgradeTask extends Task
$keys = $redis->sMembers($statsKey); $keys = $redis->sMembers($statsKey);
echo "start reset metadata..." . PHP_EOL; echo '------ start reset metadata ------' . PHP_EOL;
if (count($keys) > 0) { if (count($keys) > 0) {
$keys = $this->handlePhKeys($keys); $keys = $this->handlePhKeys($keys);
@ -90,7 +90,7 @@ class UpgradeTask extends Task
*/ */
public function resetVoltAction() public function resetVoltAction()
{ {
echo "start reset volt..." . PHP_EOL; echo '------ start reset volt ------' . PHP_EOL;
$dir = cache_path('volt'); $dir = cache_path('volt');
@ -100,7 +100,7 @@ class UpgradeTask extends Task
} }
} }
echo "end reset volt..." . PHP_EOL; echo '------ end reset volt ------' . PHP_EOL;
} }
protected function handlePhKeys($keys) protected function handlePhKeys($keys)

View File

@ -60,11 +60,11 @@ class UserIndexTask extends Task
$index = $handler->getXS()->getIndex(); $index = $handler->getXS()->getIndex();
echo 'start clean user index' . PHP_EOL; echo '------ start clean user index ------' . PHP_EOL;
$index->clean(); $index->clean();
echo 'end clean user index' . PHP_EOL; echo '------ end clean user index ------' . PHP_EOL;
} }
/** /**
@ -82,7 +82,7 @@ class UserIndexTask extends Task
$index = $handler->getXS()->getIndex(); $index = $handler->getXS()->getIndex();
echo 'start rebuild user index' . PHP_EOL; echo '------ start rebuild user index ------' . PHP_EOL;
$index->beginRebuild(); $index->beginRebuild();
@ -93,7 +93,7 @@ class UserIndexTask extends Task
$index->endRebuild(); $index->endRebuild();
echo 'end rebuild user index' . PHP_EOL; echo '------ end rebuild user index ------' . PHP_EOL;
} }
/** /**

View File

@ -27,18 +27,13 @@ class TestController extends Controller
{ {
$storageService = new StorageService(); $storageService = new StorageService();
$items = []; $result = $storageService->uploadTestFile();
$items['hello'] = $storageService->uploadTestFile(); if ($result) {
$items['avatar'] = $storageService->uploadDefaultAvatar(); return $this->jsonSuccess(['msg' => '上传文件成功']);
$items['cover'] = $storageService->uploadDefaultCover(); } else {
$items['vip_cover'] = $storageService->uploadDefaultVipCover(); return $this->jsonError(['msg' => '上传文件失败,请检查相关配置']);
foreach ($items as $item) {
if (!$item) return $this->jsonError(['msg' => '上传文件失败,请检查相关配置']);
} }
return $this->jsonSuccess(['msg' => '上传文件成功,请到控制台确认']);
} }
/** /**

View File

@ -10,6 +10,48 @@ use App\Services\MyStorage as StorageService;
class UploadController extends Controller class UploadController extends Controller
{ {
/**
* @Post("/site/logo", name="admin.upload.site_logo")
*/
public function uploadSiteLogoAction()
{
$service = new StorageService();
$file = $service->uploadSiteLogo();
if (!$file) {
return $this->jsonError(['msg' => '上传文件失败']);
}
$data = [
'src' => $service->getImageUrl($file->path),
'title' => $file->name,
];
return $this->jsonSuccess(['data' => $data]);
}
/**
* @Post("/site/favicon", name="admin.upload.site_favicon")
*/
public function uploadSiteFaviconAction()
{
$service = new StorageService();
$file = $service->uploadSiteFavicon();
if (!$file) {
return $this->jsonError(['msg' => '上传文件失败']);
}
$data = [
'src' => $service->getImageUrl($file->path),
'title' => $file->name,
];
return $this->jsonSuccess(['data' => $data]);
}
/** /**
* @Post("/cover/img", name="admin.upload.cover_img") * @Post("/cover/img", name="admin.upload.cover_img")
*/ */
@ -73,6 +115,28 @@ class UploadController extends Controller
return $this->jsonSuccess(['data' => $data]); return $this->jsonSuccess(['data' => $data]);
} }
/**
* @Post("/default/img", name="admin.upload.default_img")
*/
public function uploadDefaultImageAction()
{
$service = new StorageService();
$items = [];
$items['user_avatar'] = $service->uploadDefaultUserAvatar();
$items['group_avatar'] = $service->uploadDefaultGroupAvatar();
$items['course_cover'] = $service->uploadDefaultCourseCover();
$items['group_cover'] = $service->uploadDefaultPackageCover();
$items['vip_cover'] = $service->uploadDefaultVipCover();
foreach ($items as $item) {
if (!$item) return $this->jsonError(['msg' => '上传文件失败']);
}
return $this->jsonSuccess(['msg' => '上传文件成功']);
}
/** /**
* @Get("/sign", name="admin.upload.sign") * @Get("/sign", name="admin.upload.sign")
*/ */

View File

@ -58,8 +58,8 @@
{% else %} {% else %}
<td><a href="{{ edit_url }}">{{ item.name }}</a></td> <td><a href="{{ edit_url }}">{{ item.name }}</a></td>
{% endif %} {% endif %}
<td><span class="layui-badge layui-bg-gray">{{ item.level }}</span></td> <td>{{ item.level }}</td>
<td><span class="layui-badge layui-bg-gray">{{ item.child_count }}</span></td> <td>{{ item.child_count }}</td>
<td><input class="layui-input kg-priority" type="text" name="priority" title="数值越小排序越靠前" value="{{ item.priority }}" data-url="{{ update_url }}"></td> <td><input class="layui-input kg-priority" type="text" name="priority" title="数值越小排序越靠前" value="{{ item.priority }}" data-url="{{ update_url }}"></td>
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td> <td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
<td class="center"> <td class="center">

View File

@ -63,7 +63,14 @@
<p>昵称:<a href="{{ list_by_user_url }}">{{ item.owner.name }}</a></p> <p>昵称:<a href="{{ list_by_user_url }}">{{ item.owner.name }}</a></p>
<p>编号:{{ item.owner.id }}</p> <p>编号:{{ item.owner.id }}</p>
</td> </td>
<td>{{ date('Y-m-d H:i:s',item.create_time) }}</td> <td>
<p>提问:{{ date('Y-m-d H:i:s',item.create_time) }}</p>
{% if item.reply_time > 0 %}
<p>回复:{{ date('Y-m-d H:i:s',item.reply_time) }}</p>
{% else %}
<p>回复N/A</p>
{% endif %}
</td>
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td> <td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
<td class="center"> <td class="center">
<div class="layui-dropdown"> <div class="layui-dropdown">

View File

@ -29,17 +29,17 @@
<col> <col>
<col> <col>
<col> <col>
<col> <col width="15%">
<col> <col>
<col width="12%"> <col width="12%">
</group> </group>
<thead> <thead>
<tr> <tr>
<th>商品信息</th> <th>商品信息</th>
<th>秒杀时间</th>
<th>参与场次</th>
<th>秒杀价格</th> <th>秒杀价格</th>
<th>秒杀库存</th> <th>秒杀库存</th>
<th>秒杀时间</th>
<th>参与场次</th>
<th>发布</th> <th>发布</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
@ -52,13 +52,13 @@
{% set restore_url = url({'for':'admin.flash_sale.restore','id':item.id}) %} {% set restore_url = url({'for':'admin.flash_sale.restore','id':item.id}) %}
<tr> <tr>
<td>{{ item_full_info(item.item_type,item.item_info) }}</td> <td>{{ item_full_info(item.item_type,item.item_info) }}</td>
<td>{{ '¥%0.2f'|format(item.price) }}</td>
<td>{{ item.stock }}</td>
<td> <td>
<p>开始:{{ date('Y-m-d H:i:s',item.start_time) }}</p> <p>开始:{{ date('Y-m-d H:i:s',item.start_time) }}</p>
<p>结束:{{ date('Y-m-d H:i:s',item.end_time) }}</p> <p>结束:{{ date('Y-m-d H:i:s',item.end_time) }}</p>
</td> </td>
<td>{{ schedules_info(item.schedules) }}</td> <td>{{ schedules_info(item.schedules) }}</td>
<td>{{ '¥%0.2f'|format(item.price) }}</td>
<td>{{ item.stock }}</td>
<td><input type="checkbox" name="published" value="1" lay-filter="published" lay-skin="switch" lay-text="是|否" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td> <td><input type="checkbox" name="published" value="1" lay-filter="published" lay-skin="switch" lay-text="是|否" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>
<td class="center"> <td class="center">
<div class="layui-dropdown"> <div class="layui-dropdown">

View File

@ -4,13 +4,13 @@
{%- macro type_info(value) %} {%- macro type_info(value) %}
{% if value == 1 %} {% if value == 1 %}
<span class="layui-badge layui-bg-green">课程</span> 课程
{% elseif value == 2 %} {% elseif value == 2 %}
<span class="layui-badge layui-bg-blue">聊天</span> 水吧
{% elseif value == 3 %} {% elseif value == 3 %}
<span class="layui-badge layui-bg-red">职工</span> 职工
{% else %} {% else %}
<span class="layui-badge layui-bg-gray">未知</span> 未知
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
@ -56,7 +56,7 @@
<tr> <tr>
<th>编号</th> <th>编号</th>
<th>名称</th> <th>名称</th>
<th>名称</th> <th>类型</th>
<th>群主</th> <th>群主</th>
<th>成员</th> <th>成员</th>
<th>发布</th> <th>发布</th>

View File

@ -1,10 +1,10 @@
{%- macro item_type_info(value) %} {%- macro item_type_info(value) %}
{% if value == 1 %} {% if value == 1 %}
<span class="layui-badge layui-bg-green">课程</span> 课程
{% elseif value == 2 %} {% elseif value == 2 %}
<span class="layui-badge layui-bg-blue">套餐</span> 套餐
{% elseif value == 3 %} {% elseif value == 3 %}
<span class="layui-badge layui-bg-orange">会员</span> 会员
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}

View File

@ -1,20 +1,20 @@
{%- macro redeem_status_info(value) %} {%- macro redeem_status_info(value) %}
{% if value == 1 %} {% if value == 1 %}
<span class="status">处理中</span> 处理中
{% elseif value == 2 %} {% elseif value == 2 %}
<span class="status">已完成</span> 已完成
{% elseif value == 3 %} {% elseif value == 3 %}
<span class="status">已失败</span> 已失败
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
{%- macro gift_type_info(value) %} {%- macro gift_type_info(value) %}
{% if value == 1 %} {% if value == 1 %}
<span class="layui-badge layui-bg-green type">课程</span> 课程
{% elseif value == 2 %} {% elseif value == 2 %}
<span class="layui-badge layui-bg-blue type">商品</span> 商品
{% elseif value == 3 %} {% elseif value == 3 %}
<span class="layui-badge layui-bg-cyan type">现金</span> 现金
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
@ -28,21 +28,21 @@
{%- macro event_type_info(value) %} {%- macro event_type_info(value) %}
{% if value == 1 %} {% if value == 1 %}
<span class="type">订单消费</span> 订单消费
{% elseif value == 2 %} {% elseif value == 2 %}
<span class="type">积分兑换</span> 积分兑换
{% elseif value == 3 %} {% elseif value == 3 %}
<span class="type">积分退款</span> 积分退款
{% elseif value == 4 %} {% elseif value == 4 %}
<span class="type">帐号注册</span> 帐号注册
{% elseif value == 5 %} {% elseif value == 5 %}
<span class="type">站点访问</span> 站点访问
{% elseif value == 6 %} {% elseif value == 6 %}
<span class="type">课时学习</span> 课时学习
{% elseif value == 7 %} {% elseif value == 7 %}
<span class="type">课程评价</span> 课程评价
{% elseif value == 8 %} {% elseif value == 8 %}
<span class="type">微聊讨论</span> 微聊讨论
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}

View File

@ -1,10 +1,10 @@
{%- macro target_info(value) %} {%- macro target_info(value) %}
{% if value == 1 %} {% if value == 1 %}
<span class="layui-badge layui-bg-green">课程</span> 课程
{% elseif value == 2 %} {% elseif value == 2 %}
<span class="layui-badge layui-bg-blue">单页</span> 单页
{% elseif value == 3 %} {% elseif value == 3 %}
<span class="layui-badge layui-bg-red">链接</span> 链接
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}

View File

@ -77,8 +77,8 @@
{% else %} {% else %}
<td><a href="{{ edit_url }}">{{ item.name }}</a></td> <td><a href="{{ edit_url }}">{{ item.name }}</a></td>
{% endif %} {% endif %}
<td><span class="layui-badge layui-bg-gray">{{ item.level }}</span></td> <td>{{ item.level }}</td>
<td><span class="layui-badge layui-bg-gray">{{ item.child_count }}</span></td> <td>{{ item.child_count }}</td>
<td>{{ position_info(item.position) }}</td> <td>{{ position_info(item.position) }}</td>
<td>{{ target_info(item.target) }}</td> <td>{{ target_info(item.target) }}</td>
<td><input class="layui-input kg-priority" type="text" name="priority" title="数值越小排序越靠前" value="{{ item.priority }}" data-url="{{ update_url }}"></td> <td><input class="layui-input kg-priority" type="text" name="priority" title="数值越小排序越靠前" value="{{ item.priority }}" data-url="{{ update_url }}"></td>

View File

@ -68,8 +68,8 @@
{% if value == 0 %} {% if value == 0 %}
N/A N/A
{% elseif value == 1 %} {% elseif value == 1 %}
限时秒杀 秒杀
{% elseif value == 2 %} {% elseif value == 2 %}
限时折扣 折扣
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}

View File

@ -51,7 +51,7 @@
<tr> <tr>
<td>{{ item.id }}</td> <td>{{ item.id }}</td>
<td><a href="{{ edit_url }}">{{ item.title }}</a></td> <td><a href="{{ edit_url }}">{{ item.title }}</a></td>
<td><span class="layui-badge layui-bg-gray">{{ item.course_count }}</span></td> <td>{{ item.course_count }}</td>
<td>{{ '¥%0.2f'|format(item.market_price) }}</td> <td>{{ '¥%0.2f'|format(item.market_price) }}</td>
<td>{{ '¥%0.2f'|format(item.vip_price) }}</td> <td>{{ '¥%0.2f'|format(item.vip_price) }}</td>
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td> <td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>

View File

@ -172,7 +172,7 @@
upload.render({ upload.render({
elem: '#upload-logo', elem: '#upload-logo',
url: '/admin/upload/content/img', url: '/admin/upload/site/logo',
exts: 'gif|jpg|png', exts: 'gif|jpg|png',
before: function () { before: function () {
layer.load(); layer.load();
@ -188,7 +188,7 @@
upload.render({ upload.render({
elem: '#upload-favicon', elem: '#upload-favicon',
url: '/admin/upload/content/img', url: '/admin/upload/site/favicon',
exts: 'gif|jpg|png|ico', exts: 'gif|jpg|png|ico',
before: function () { before: function () {
layer.load(); layer.load();

View File

@ -2,96 +2,160 @@
{% block content %} {% block content %}
<form class="layui-form kg-form" method="POST" action="{{ url({'for':'admin.setting.storage'}) }}"> <div class="layui-tab layui-tab-brief">
<fieldset class="layui-elem-field layui-field-title"> <ul class="layui-tab-title kg-tab-title">
<legend>存储桶配置</legend> <li class="layui-this">基本配置</li>
</fieldset> <li>图片样式</li>
<div class="layui-form-item"> <li>默认图片</li>
<label class="layui-form-label">空间名称</label> </ul>
<div class="layui-input-block"> <div class="layui-tab-content">
<input class="layui-input" type="text" name="bucket" value="{{ cos.bucket }}" lay-verify="required"> <div class="layui-tab-item layui-show">
<form class="layui-form kg-form" method="POST" action="{{ url({'for':'admin.setting.storage'}) }}">
<fieldset class="layui-elem-field layui-field-title">
<legend>存储桶配置</legend>
</fieldset>
<div class="layui-form-item">
<label class="layui-form-label">空间名称</label>
<div class="layui-input-block">
<input class="layui-input" type="text" name="bucket" value="{{ cos.bucket }}" lay-verify="required">
</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="region" value="{{ cos.region }}" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">访问协议</label>
<div class="layui-input-block">
<input type="radio" name="protocol" value="http" title="HTTP" {% if cos.protocol == "http" %}checked="checked"{% endif %}>
<input type="radio" name="protocol" value="https" title="HTTPS" {% if cos.protocol == "https" %}checked="checked"{% endif %}>
</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="domain" value="{{ cos.domain }}" lay-verify="required">
</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>
</div>
</div>
</form>
<form class="layui-form kg-form" method="POST" action="{{ url({'for':'admin.test.storage'}) }}">
<fieldset class="layui-elem-field layui-field-title">
<legend>上传测试</legend>
</fieldset>
<div class="layui-form-item">
<label class="layui-form-label">测试文件</label>
<div class="layui-input-block">
<input class="layui-input" type="text" name="file" value="hello_world.txt" readonly="readonly">
</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>
</div>
</div>
</form>
</div>
<div class="layui-tab-item">
<table class="layui-table" lay-size="lg" style="width:80%;">
<colgroup>
<col>
<col>
</colgroup>
<thead>
<tr>
<th>样式名称</th>
<th>样式描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>avatar_160</td>
<td>imageMogr2/thumbnail/160x/interlace/0</td>
</tr>
<tr>
<td>cover_270</td>
<td>mageMogr2/thumbnail/270x/interlace/0</td>
</tr>
<tr>
<td>content_800</td>
<td>mageMogr2/thumbnail/800x/interlace/0</td>
</tr>
<tr>
<td>slide_1100</td>
<td>imageMogr2/thumbnail/1100x/interlace/0</td>
</tr>
</tbody>
</table>
</div>
<div class="layui-tab-item">
<form class="layui-form kg-form" method="POST" action="{{ url({'for':'admin.upload.default_img'}) }}">
<div class="layui-form-item">
<table class="layui-table" lay-size="lg" style="width:80%;">
<colgroup>
<col>
<col>
</colgroup>
<thead>
<tr>
<th>文件名称</th>
<th>文件位置</th>
</tr>
</thead>
<tbody>
<tr>
<td>用户头像</td>
<td>public/static/admin/img/default/user_cover.png</td>
</tr>
<tr>
<td>群组头像</td>
<td>public/static/admin/img/default/group_cover.png</td>
</tr>
<tr>
<td>课程封面</td>
<td>public/static/admin/img/default/course_cover.png</td>
</tr>
<tr>
<td>套餐封面</td>
<td>public/static/admin/img/default/package_cover.png</td>
</tr>
<tr>
<td>会员封面</td>
<td>public/static/admin/img/default/vip_cover.png</td>
</tr>
<tr>
<td>礼品封面</td>
<td>public/static/admin/img/default/gift_cover.png</td>
</tr>
</tbody>
</table>
</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>
</div>
</div>
</form>
</div> </div>
</div> </div>
<div class="layui-form-item"> </div>
<label class="layui-form-label">所在区域</label>
<div class="layui-input-block">
<input class="layui-input" type="text" name="region" value="{{ cos.region }}" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">访问协议</label>
<div class="layui-input-block">
<input type="radio" name="protocol" value="http" title="HTTP" {% if cos.protocol == "http" %}checked="checked"{% endif %}>
<input type="radio" name="protocol" value="https" title="HTTPS" {% if cos.protocol == "https" %}checked="checked"{% endif %}>
</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="domain" value="{{ cos.domain }}" lay-verify="required">
</div>
</div>
<fieldset class="layui-elem-field layui-field-title">
<legend>图片处理样式</legend>
</fieldset>
<div class="layui-form-item">
<table class="layui-table" lay-size="lg">
<colgroup>
<col>
<col>
</colgroup>
<thead>
<tr>
<th>样式名称</th>
<th>样式描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>avatar_160</td>
<td>imageMogr2/thumbnail/160x/interlace/0</td>
</tr>
<tr>
<td>cover_270</td>
<td>mageMogr2/thumbnail/270x/interlace/0</td>
</tr>
<tr>
<td>content_800</td>
<td>mageMogr2/thumbnail/800x/interlace/0</td>
</tr>
<tr>
<td>slide_1100</td>
<td>imageMogr2/thumbnail/1100x/interlace/0</td>
</tr>
</tbody>
</table>
</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>
</div>
</div>
</form>
<form class="layui-form kg-form" method="POST" action="{{ url({'for':'admin.test.storage'}) }}">
<fieldset class="layui-elem-field layui-field-title">
<legend>上传测试</legend>
</fieldset>
<div class="layui-form-item">
<label class="layui-form-label">测试文件</label>
<div class="layui-input-block">
<input class="layui-input" type="text" name="file" value="hello_world.txt" readonly="readonly">
</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>
</div>
</div>
</form>
{% endblock %} {% endblock %}

View File

@ -52,7 +52,7 @@
<tr> <tr>
<td>{{ item.id }}</td> <td>{{ item.id }}</td>
<td><a href="{{ edit_url }}">{{ item.title }}</a></td> <td><a href="{{ edit_url }}">{{ item.title }}</a></td>
<td><span class="layui-badge layui-bg-gray">{{ item.course_count }}</span></td> <td>{{ item.course_count }}</td>
<td>{{ date('Y-m-d H:i',item.create_time) }}</td> <td>{{ date('Y-m-d H:i',item.create_time) }}</td>
<td>{{ date('Y-m-d H:i',item.update_time) }}</td> <td>{{ date('Y-m-d H:i',item.update_time) }}</td>
<td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td> <td><input type="checkbox" name="published" value="1" lay-skin="switch" lay-text="是|否" lay-filter="published" data-url="{{ update_url }}" {% if item.published == 1 %}checked="checked"{% endif %}></td>

View File

@ -12,17 +12,17 @@
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
{%- macro edu_role_info(user) %} {%- macro edu_role_info(role) %}
{% if user.edu_role.id == 1 %} {% if role.id == 1 %}
学员 学员
{% elseif user.edu_role.id == 2 %} {% elseif role.id == 2 %}
<a href="{{ url({'for':'admin.user.list'},{'edu_role':user.edu_role.id}) }}">讲师</a> 讲师
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
{%- macro admin_role_info(user) %} {%- macro admin_role_info(role) %}
{% if user.admin_role.id > 0 %} {% if role.id > 0 %}
<a href="{{ url({'for':'admin.user.list'},{'admin_role':user.admin_role.id}) }}">{{ user.admin_role.name }}</a> {{ role.name }}
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
@ -85,8 +85,8 @@
<td>{{ item.id }}</td> <td>{{ item.id }}</td>
<td><a href="{{ edit_url }}" title="{{ item.about }}">{{ item.name }}</a>{{ status_info(item) }}</td> <td><a href="{{ edit_url }}" title="{{ item.about }}">{{ item.name }}</a>{{ status_info(item) }}</td>
<td>{{ gender_info(item.gender) }}</td> <td>{{ gender_info(item.gender) }}</td>
<td>{{ edu_role_info(item) }}</td> <td>{{ edu_role_info(item.edu_role) }}</td>
<td>{{ admin_role_info(item) }}</td> <td>{{ admin_role_info(item.admin_role) }}</td>
<td>{{ date('Y-m-d H:i:s',item.active_time) }}</td> <td>{{ date('Y-m-d H:i:s',item.active_time) }}</td>
<td>{{ date('Y-m-d H:i:s',item.create_time) }}</td> <td>{{ date('Y-m-d H:i:s',item.create_time) }}</td>
<td class="center"> <td class="center">

View File

@ -29,6 +29,8 @@ class FlashSaleController extends Controller
*/ */
public function indexAction() public function indexAction()
{ {
$this->seo->prependTitle('秒杀');
$service = new SaleListService(); $service = new SaleListService();
$sales = $service->handle(); $sales = $service->handle();

View File

@ -98,6 +98,11 @@
</div> </div>
{% endmacro %} {% endmacro %}
<div class="layui-breadcrumb breadcrumb">
<a href="/">首页</a>
<a><cite>秒杀</cite></a>
</div>
{% for date_sale in sales %} {% for date_sale in sales %}
<div class="index-wrap wrap"> <div class="index-wrap wrap">
<div class="header">{{ date_sale.date }}</div> <div class="header">{{ date_sale.date }}</div>
@ -106,8 +111,7 @@
<ul class="layui-tab-title"> <ul class="layui-tab-title">
{% for item in date_sale.items %} {% for item in date_sale.items %}
{% set class = item.selected == 1 ? 'layui-this' : 'none' %} {% set class = item.selected == 1 ? 'layui-this' : 'none' %}
{% set style = item.status == 'finished' ? 'pointer-events:none;' : '' %} <li class="{{ class }}">{{ item.hour }}{{ sale_status(item.status) }}</li>
<li class="{{ class }}" style="{{ style }}">{{ item.hour }}{{ sale_status(item.status) }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
<div class="layui-tab-content"> <div class="layui-tab-content">

View File

@ -2,30 +2,31 @@
{% block content %} {% block content %}
<div class="bg-wrap"> {% if pager.total_items > 0 %}
<div class="im-user-list clearfix"> <div class="bg-wrap">
<div class="layui-row layui-col-space20"> <div class="im-user-list clearfix">
{% for item in pager.items %} <div class="layui-row layui-col-space20">
{% set delete_url = url({'for':'home.igm.delete_user','gid':group.id,'uid':item.id}) %} {% for item in pager.items %}
<div class="layui-col-md2"> {% set delete_url = url({'for':'home.igm.delete_user','gid':group.id,'uid':item.id}) %}
<div class="user-card"> <div class="layui-col-md2">
{% if item.vip == 1 %} <div class="user-card">
<span class="vip">会员</span> <div class="avatar">
{% endif %} <a href="javascript:" title="{{ item.about }}">
<div class="avatar"> <img src="{{ item.avatar }}" alt="{{ item.name }}">
<a href="javascript:" title="{{ item.about }}"><img src="{{ item.avatar }}" alt="{{ item.name }}"></a> </a>
</div> </div>
<div class="name layui-elip" title="{{ item.name }}">{{ item.name }}</div> <div class="name layui-elip" title="{{ item.name }}">{{ item.name }}</div>
<div class="action"> <div class="action">
<button class="layui-btn kg-delete" data-tips="你确定要移除该用户吗?" data-url="{{ delete_url }}">移除</button> <button class="layui-btn kg-delete" data-tips="你确定要移除该用户吗?" data-url="{{ delete_url }}">移除</button>
</div>
</div> </div>
</div> </div>
</div> {% endfor %}
{% endfor %} </div>
</div> </div>
{{ partial('partials/pager') }}
</div> </div>
{{ partial('partials/pager') }} {% endif %}
</div>
{% endblock %} {% endblock %}

View File

@ -8,7 +8,7 @@
{% set item.about = item.about ? item.about : '这家伙真懒,什么都没留下!' %} {% set item.about = item.about ? item.about : '这家伙真懒,什么都没留下!' %}
<div class="layui-col-md3"> <div class="layui-col-md3">
<div class="user-card"> <div class="user-card">
{{ type_info(item.type) }} <span class="type layui-badge layui-bg-green">{{ type_info(item.type) }}</span>
<div class="avatar"> <div class="avatar">
<a href="{{ group_url }}" title="{{ item.about }}"> <a href="{{ group_url }}" title="{{ item.about }}">
<img src="{{ item.avatar }}!avatar_160" alt="{{ item.name }}"> <img src="{{ item.avatar }}!avatar_160" alt="{{ item.name }}">

View File

@ -3,12 +3,10 @@
{% for item in pager.items %} {% for item in pager.items %}
{% set user_url = url({'for':'home.user.show','id':item.id}) %} {% set user_url = url({'for':'home.user.show','id':item.id}) %}
{% set item.title = item.title ? item.title : '暂露头角' %} {% set item.title = item.title ? item.title : '暂露头角' %}
{% set avatar_class = item.vip == 1 ? 'avatar vip' : 'avatar' %}
<div class="layui-col-md3"> <div class="layui-col-md3">
<div class="user-card"> <div class="user-card">
{% if item.vip == 1 %} <div class="{{ avatar_class }}">
<span class="layui-badge layui-bg-orange vip">宾</span>
{% endif %}
<div class="avatar">
<a href="{{ user_url }}" title="{{ item.about }}"> <a href="{{ user_url }}" title="{{ item.about }}">
<img src="{{ item.avatar }}" alt="{{ item.name }}"> <img src="{{ item.avatar }}" alt="{{ item.name }}">
</a> </a>

View File

@ -5,7 +5,7 @@
{% set group.about = group.about ? group.about : '这家伙真懒,什么都没留下!' %} {% set group.about = group.about ? group.about : '这家伙真懒,什么都没留下!' %}
<div class="layui-col-md3"> <div class="layui-col-md3">
<div class="user-card"> <div class="user-card">
{{ type_info(group.type) }} <span class="type layui-badge layui-bg-green">{{ type_info(group.type) }}</span>
<div class="avatar"> <div class="avatar">
<a href="{{ group_url }}" title="{{ group.about }}" target="group"> <a href="{{ group_url }}" title="{{ group.about }}" target="group">
<img src="{{ group.avatar }}!avatar_160" alt="{{ group.name }}"> <img src="{{ group.avatar }}!avatar_160" alt="{{ group.name }}">

View File

@ -4,10 +4,10 @@
{% set user.title = user.title ? user.title : '暂露头角' %} {% set user.title = user.title ? user.title : '暂露头角' %}
{% set user.about = user.about ? user.about : '这个人很懒,什么都没留下' %} {% set user.about = user.about ? user.about : '这个人很懒,什么都没留下' %}
{% set user_url = url({'for':'home.user.show','id':user.id}) %} {% set user_url = url({'for':'home.user.show','id':user.id}) %}
<div class="layui-col-md2"> {% set avatar_class = user.vip == 1 ? 'avatar vip' : 'avatar' %}
<div class="layui-col-md3">
<div class="user-card"> <div class="user-card">
{{ vip_info(user.vip) }} <div class="{{ avatar_class }}">
<div class="avatar">
<a href="{{ user_url }}" title="{{ user.about }}" target="user"> <a href="{{ user_url }}" title="{{ user.about }}" target="user">
<img src="{{ user.avatar }}!avatar_160" alt="{{ user.name }}"> <img src="{{ user.avatar }}!avatar_160" alt="{{ user.name }}">
</a> </a>

View File

@ -1,10 +1,10 @@
{%- macro model_info(value) %} {%- macro model_info(value) %}
{% if value == '1' %} {% if value == '1' %}
<span class="layui-badge layui-bg-green">点播</span> 点播
{% elseif value == '2' %} {% elseif value == '2' %}
<span class="layui-badge layui-bg-blue">直播</span> 直播
{% elseif value == '3' %} {% elseif value == '3' %}
<span class="layui-badge layui-bg-black">专栏</span> 专栏
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
@ -30,6 +30,7 @@
{%- macro course_card(course) %} {%- macro course_card(course) %}
{% set course_url = url({'for':'home.course.show','id':course.id}) %} {% set course_url = url({'for':'home.course.show','id':course.id}) %}
<div class="course-card"> <div class="course-card">
<span class="model layui-badge layui-bg-green">{{ model_info(course.model) }}</span>
<div class="cover"> <div class="cover">
<a href="{{ course_url }}"> <a href="{{ course_url }}">
<img src="{{ course.cover }}!cover_270" alt="{{ course.title }}" title="{{ course.title }}"> <img src="{{ course.cover }}!cover_270" alt="{{ course.title }}" title="{{ course.title }}">

View File

@ -1,9 +1,9 @@
{%- macro type_info(value) %} {%- macro type_info(value) %}
{% if value == 1 %} {% if value == 1 %}
<span class="layui-badge layui-bg-green type" title="课程交流">课程</span> 课程
{% elseif value == 2 %} {% elseif value == 2 %}
<span class="layui-badge layui-bg-blue type" title="课外畅聊">水吧</span> 水吧
{% elseif value == 3 %} {% elseif value == 3 %}
<span class="layui-badge layui-bg-cyan type" title="职工交流">职工</span> 职工
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}

View File

@ -70,8 +70,8 @@
{% if value == 0 %} {% if value == 0 %}
N/A N/A
{% elseif value == 1 %} {% elseif value == 1 %}
限时秒杀 秒杀
{% elseif value == 2 %} {% elseif value == 2 %}
限时折扣 折扣
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}

View File

@ -1,9 +1,3 @@
{%- macro vip_info(value) %}
{% if value == 1 %}
<span class="layui-badge layui-bg-orange vip">宾</span>
{% endif %}
{%- endmacro %}
{%- macro gender_icon(value) %} {%- macro gender_icon(value) %}
{% if value == 1 %} {% if value == 1 %}
<i class="layui-icon layui-icon-male"></i> <i class="layui-icon layui-icon-male"></i>

View File

@ -15,7 +15,6 @@
{% if pager.total_pages > 0 %} {% if pager.total_pages > 0 %}
<table class="layui-table"> <table class="layui-table">
<colgroup> <colgroup>
<col>
<col> <col>
<col> <col>
<col width="12%"> <col width="12%">
@ -23,7 +22,6 @@
<thead> <thead>
<tr> <tr>
<th>课程</th> <th>课程</th>
<th>类型</th>
<th>进度</th> <th>进度</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
@ -37,13 +35,13 @@
<td> <td>
<p>标题:<a href="{{ course_url }}">{{ item.course.title }}</a></p> <p>标题:<a href="{{ course_url }}">{{ item.course.title }}</a></p>
<p class="meta"> <p class="meta">
<span>来源:{{ source_type_info(item.source_type) }}</span> 类型:<span class="layui-badge layui-bg-gray">{{ model_info(item.course.model) }}</span>
来源:<span class="layui-badge layui-bg-gray">{{ source_type_info(item.source_type) }}</span>
{% if item.expiry_time > 0 %} {% if item.expiry_time > 0 %}
<span>期限:{{ date('Y-m-d',item.expiry_time) }}</span> 期限:{{ date('Y-m-d',item.expiry_time) }}
{% endif %} {% endif %}
</p> </p>
</td> </td>
<td>{{ model_info(item.course.model) }}</td>
<td> <td>
<p>用时:{{ item.duration|duration }}</p> <p>用时:{{ item.duration|duration }}</p>
<p>进度:{{ item.progress }}%</p> <p>进度:{{ item.progress }}%</p>

View File

@ -32,7 +32,10 @@
{% set course_url = url({'for':'home.course.show','id':item.id}) %} {% set course_url = url({'for':'home.course.show','id':item.id}) %}
{% set favorite_url = url({'for':'home.course.favorite','id':item.id}) %} {% set favorite_url = url({'for':'home.course.favorite','id':item.id}) %}
<tr> <tr>
<td><a href="{{ course_url }}">{{ item.title }}</a> {{ model_info(item.model) }}</td> <td>
<a href="{{ course_url }}">{{ item.title }}</a>
<span class="layui-badge layui-bg-gray">{{ model_info(item.model) }}</span>
</td>
<td>{{ item.user_count }}</td> <td>{{ item.user_count }}</td>
<td>{{ "%0.1f"|format(item.rating) }}</td> <td>{{ "%0.1f"|format(item.rating) }}</td>
<td class="center"> <td class="center">

View File

@ -28,7 +28,7 @@
<span>编号:{{ item.sn }}</span> <span>编号:{{ item.sn }}</span>
<span>时间:{{ date('Y-m-d H:i:s',item.create_time) }}</span> <span>时间:{{ date('Y-m-d H:i:s',item.create_time) }}</span>
{% if item.promotion_type > 0 %} {% if item.promotion_type > 0 %}
<span class="layui-badge layui-bg-blue">{{ promotion_type(item.promotion_type) }}</span> 促销:<span class="layui-badge layui-bg-blue">{{ promotion_type(item.promotion_type) }}</span>
{% endif %} {% endif %}
</div> </div>
<div class="body clearfix"> <div class="body clearfix">

View File

@ -9,6 +9,7 @@
{% set qrcode_url = url({'for':'home.qrcode'},{'text':full_user_url}) %} {% set qrcode_url = url({'for':'home.qrcode'},{'text':full_user_url}) %}
{% set user.area = user.area ? user.area : '火星' %} {% set user.area = user.area ? user.area : '火星' %}
{% set user.about = user.about ? user.about : '这个家伙很懒,什么都没留下!' %} {% set user.about = user.about ? user.about : '这个家伙很懒,什么都没留下!' %}
{% set avatar_class = user.vip == 1 ? 'avatar vip' : 'avatar' %}
<div class="breadcrumb"> <div class="breadcrumb">
<span class="layui-breadcrumb"> <span class="layui-breadcrumb">
@ -25,8 +26,7 @@
</div> </div>
<div class="user-profile wrap clearfix"> <div class="user-profile wrap clearfix">
{{ vip_info(user.vip) }} <div class="{{ avatar_class }}">
<div class="avatar">
<img src="{{ user.avatar }}!avatar_160" alt="{{ user.name }}"> <img src="{{ user.avatar }}!avatar_160" alt="{{ user.name }}">
</div> </div>
<div class="info"> <div class="info">

View File

@ -184,23 +184,23 @@ function kg_config($path, $defaultValue = null)
} }
/** /**
* 获取默认头像路径 * 获取默认用户头像路径
* *
* @return string * @return string
*/ */
function kg_default_avatar_path() function kg_default_user_avatar_path()
{ {
return '/img/default/avatar.png'; return '/img/default/user_avatar.png';
} }
/** /**
* 获取默认封面路径 * 获取默认群组头像路径
* *
* @return string * @return string
*/ */
function kg_default_cover_path() function kg_default_group_avatar_path()
{ {
return '/img/default/cover.png'; return '/img/default/group_avatar.png';
} }
/** /**
@ -213,6 +213,16 @@ function kg_default_course_cover_path()
return '/img/default/course_cover.png'; return '/img/default/course_cover.png';
} }
/**
* 获取默认课程封面路径
*
* @return string
*/
function kg_default_package_cover_path()
{
return '/img/default/package_cover.png';
}
/** /**
* 获取默认会员封面路径 * 获取默认会员封面路径
* *
@ -223,6 +233,16 @@ function kg_default_vip_cover_path()
return '/img/default/vip_cover.png'; return '/img/default/vip_cover.png';
} }
/**
* 获取默认礼品封面路径
*
* @return string
*/
function kg_default_gift_cover_path()
{
return '/img/default/gift_cover.png';
}
/** /**
* 获取存储基准URL * 获取存储基准URL
* *
@ -256,29 +276,29 @@ function kg_cos_img_url($path, $style = null)
} }
/** /**
* 获取头像URL * 获取用户头像URL
* *
* @param string $path * @param string $path
* @param string $style * @param string $style
* @return string * @return string
*/ */
function kg_cos_avatar_url($path, $style = null) function kg_cos_user_avatar_url($path, $style = null)
{ {
$path = $path ?: kg_default_avatar_path(); $path = $path ?: kg_default_user_avatar_path();
return kg_cos_img_url($path, $style); return kg_cos_img_url($path, $style);
} }
/** /**
* 获取封面URL * 获取群组头像URL
* *
* @param string $path * @param string $path
* @param string $style * @param string $style
* @return string * @return string
*/ */
function kg_cos_cover_url($path, $style = null) function kg_cos_group_avatar_url($path, $style = null)
{ {
$path = $path ?: kg_default_cover_path(); $path = $path ?: kg_default_group_avatar_path();
return kg_cos_img_url($path, $style); return kg_cos_img_url($path, $style);
} }
@ -297,6 +317,20 @@ function kg_cos_course_cover_url($path, $style = null)
return kg_cos_img_url($path, $style); return kg_cos_img_url($path, $style);
} }
/**
* 获取套餐封面URL
*
* @param string $path
* @param string $style
* @return string
*/
function kg_cos_package_cover_url($path, $style = null)
{
$path = $path ?: kg_default_package_cover_path();
return kg_cos_img_url($path, $style);
}
/** /**
* 获取会员封面URL * 获取会员封面URL
* *
@ -311,6 +345,20 @@ function kg_cos_vip_cover_url($path, $style = null)
return kg_cos_img_url($path, $style); return kg_cos_img_url($path, $style);
} }
/**
* 获取礼品封面URL
*
* @param string $path
* @param string $style
* @return string
*/
function kg_cos_gift_cover_url($path, $style = null)
{
$path = $path ?: kg_default_gift_cover_path();
return kg_cos_img_url($path, $style);
}
/** /**
* 获取轮播封面URL * 获取轮播封面URL
* *

View File

@ -346,7 +346,7 @@ class Course extends Model
$this->score = (float)$this->score; $this->score = (float)$this->score;
if (!Text::startsWith($this->cover, 'http')) { if (!Text::startsWith($this->cover, 'http')) {
$this->cover = kg_cos_cover_url($this->cover); $this->cover = kg_cos_course_cover_url($this->cover);
} }
if (is_string($this->attrs)) { if (is_string($this->attrs)) {

View File

@ -164,7 +164,7 @@ class ImGroup extends Model
public function afterFetch() public function afterFetch()
{ {
if (!Text::startsWith($this->avatar, 'http')) { if (!Text::startsWith($this->avatar, 'http')) {
$this->avatar = kg_cos_avatar_url($this->avatar); $this->avatar = kg_cos_group_avatar_url($this->avatar);
} }
} }

View File

@ -133,7 +133,7 @@ class ImUser extends Model
public function afterFetch() public function afterFetch()
{ {
if (!Text::startsWith($this->avatar, 'http')) { if (!Text::startsWith($this->avatar, 'http')) {
$this->avatar = kg_cos_avatar_url($this->avatar); $this->avatar = kg_cos_user_avatar_url($this->avatar);
} }
} }

View File

@ -137,7 +137,7 @@ class Package extends Model
public function afterFetch() public function afterFetch()
{ {
if (!Text::startsWith($this->cover, 'http')) { if (!Text::startsWith($this->cover, 'http')) {
$this->cover = kg_cos_cover_url($this->cover); $this->cover = kg_cos_package_cover_url($this->cover);
} }
$this->market_price = (float)$this->market_price; $this->market_price = (float)$this->market_price;

View File

@ -202,7 +202,7 @@ class PointGift extends Model
public function afterFetch() public function afterFetch()
{ {
if (!Text::startsWith($this->cover, 'http')) { if (!Text::startsWith($this->cover, 'http')) {
$this->cover = kg_cos_cover_url($this->cover); $this->cover = kg_cos_gift_cover_url($this->cover);
} }
if (is_string($this->attrs)) { if (is_string($this->attrs)) {

View File

@ -17,6 +17,7 @@ class Upload extends Model
const TYPE_RESOURCE = 4; // 课件资源 const TYPE_RESOURCE = 4; // 课件资源
const TYPE_IM_IMG = 5; // IM图片 const TYPE_IM_IMG = 5; // IM图片
const TYPE_IM_FILE = 6; // IM文件 const TYPE_IM_FILE = 6; // IM文件
const TYPE_DEFAULT_IMG = 99; // 默认图片
/** /**
* 主键编号 * 主键编号

View File

@ -226,7 +226,7 @@ class User extends Model
public function afterFetch() public function afterFetch()
{ {
if (!Text::startsWith($this->avatar, 'http')) { if (!Text::startsWith($this->avatar, 'http')) {
$this->avatar = kg_cos_avatar_url($this->avatar); $this->avatar = kg_cos_user_avatar_url($this->avatar);
} }
} }

View File

@ -56,8 +56,6 @@ class OrderCreate extends \App\Services\Logic\Order\OrderCreate
$validator->checkIfBoughtCourse($user->id, $course->id); $validator->checkIfBoughtCourse($user->id, $course->id);
$this->handleCoursePromotion();
$order = $this->createCourseOrder($course, $user); $order = $this->createCourseOrder($course, $user);
} elseif ($sale->item_type == FlashSaleModel::ITEM_PACKAGE) { } elseif ($sale->item_type == FlashSaleModel::ITEM_PACKAGE) {
@ -89,24 +87,15 @@ class OrderCreate extends \App\Services\Logic\Order\OrderCreate
} }
} }
protected function handleCoursePromotion()
{
}
protected function handlePackagePromotion()
{
}
protected function handleVipPromotion()
{
}
protected function decrFlashSaleStock(FlashSaleModel $sale) protected function decrFlashSaleStock(FlashSaleModel $sale)
{ {
if ($sale->stock > 1) { if ($sale->stock < 1) return;
$sale->stock -= 1;
$sale->update(); if ($sale->stock == 1) $sale->published = 0;
}
$sale->stock -= 1;
$sale->update();
} }
protected function saveUserOrderCache($userId, $saleId) protected function saveUserOrderCache($userId, $saleId)

View File

@ -39,7 +39,7 @@ class SaleList extends Service
foreach ($dates as $date) { foreach ($dates as $date) {
$result[] = [ $result[] = [
'date' => date('m-d', strtotime($date)), 'date' => date('m / d', strtotime($date)),
'items' => $this->getDateSales($sales, $date), 'items' => $this->getDateSales($sales, $date),
]; ];
} }

View File

@ -96,7 +96,7 @@ class OrderInfo extends Service
protected function handleCourseInfo($itemInfo) protected function handleCourseInfo($itemInfo)
{ {
$itemInfo['course']['cover'] = kg_cos_cover_url($itemInfo['course']['cover']); $itemInfo['course']['cover'] = kg_cos_course_cover_url($itemInfo['course']['cover']);
return $itemInfo; return $itemInfo;
} }

View File

@ -17,7 +17,7 @@ class ProfileInfo extends Service
protected function handleUser(UserModel $user) protected function handleUser(UserModel $user)
{ {
$user->avatar = kg_cos_avatar_url($user->avatar); $user->avatar = kg_cos_user_avatar_url($user->avatar);
$user->area = $this->handleArea($user->area); $user->area = $this->handleArea($user->area);

View File

@ -17,6 +17,11 @@ class MyStorage extends Storage
const MIME_AUDIO = 'audio'; const MIME_AUDIO = 'audio';
const MIME_FILE = 'file'; const MIME_FILE = 'file';
/**
* 上传测试文件
*
* @return bool|string
*/
public function uploadTestFile() public function uploadTestFile()
{ {
$key = 'hello_world.txt'; $key = 'hello_world.txt';
@ -25,33 +30,110 @@ class MyStorage extends Storage
return $this->putString($key, $value); return $this->putString($key, $value);
} }
public function uploadDefaultAvatar() /**
* 上传默认用户头像
*
* @return false|mixed|string
*/
public function uploadDefaultUserAvatar()
{ {
$filename = static_path('admin/img/default_avatar.png'); $filename = static_path('admin/img/default/user_avatar.png');
$key = '/img/default/avatar.png'; $key = '/img/default/user_avatar.png';
return $this->putFile($key, $filename); return $this->putFile($key, $filename);
} }
public function uploadDefaultCover() /**
* 上传默认群组头像
*
* @return false|mixed|string
*/
public function uploadDefaultGroupAvatar()
{ {
$filename = static_path('admin/img/default_cover.png'); $filename = static_path('admin/img/default/group_avatar.png');
$key = '/img/default/cover.png'; $key = '/img/default/group_avatar.png';
return $this->putFile($key, $filename); return $this->putFile($key, $filename);
} }
/**
* 上传默认课程封面
*
* @return false|mixed|string
*/
public function uploadDefaultCourseCover()
{
$filename = static_path('admin/img/default/course_cover.png');
$key = '/img/default/course_cover.png';
return $this->putFile($key, $filename);
}
/**
* 上传默认套餐封面
*
* @return false|mixed|string
*/
public function uploadDefaultPackageCover()
{
$filename = static_path('admin/img/default/package_cover.png');
$key = '/img/default/package_cover.png';
return $this->putFile($key, $filename);
}
/**
* 上传默认会员封面
*
* @return false|mixed|string
*/
public function uploadDefaultVipCover() public function uploadDefaultVipCover()
{ {
$filename = static_path('admin/img/default_vip_cover.png'); $filename = static_path('admin/img/default/vip_cover.png');
$key = '/img/default/vip_cover.png'; $key = '/img/default/vip_cover.png';
return $this->putFile($key, $filename); return $this->putFile($key, $filename);
} }
/**
* 上传默认礼品封面
*
* @return false|mixed|string
*/
public function uploadDefaultGiftCover()
{
$filename = static_path('admin/img/default/gift_cover.png');
$key = '/img/default/gift_cover.png';
return $this->putFile($key, $filename);
}
/**
* 上传站点LOGO
*
* @return UploadModel|bool
*/
public function uploadSiteLogo()
{
return $this->upload('/img/default/', self::MIME_IMAGE, UploadModel::TYPE_DEFAULT_IMG, 'logo.png');
}
/**
* 上传站点ICON
*
* @return UploadModel|bool
*/
public function uploadSiteFavicon()
{
return $this->upload('/img/default/', self::MIME_IMAGE, UploadModel::TYPE_DEFAULT_IMG, 'favicon.ico');
}
/** /**
* 上传封面图片 * 上传封面图片
* *
@ -116,9 +198,10 @@ class MyStorage extends Storage
* @param string $prefix * @param string $prefix
* @param string $mimeType * @param string $mimeType
* @param int $uploadType * @param int $uploadType
* @param string $fileName
* @return UploadModel|bool * @return UploadModel|bool
*/ */
protected function upload($prefix, $mimeType, $uploadType) protected function upload($prefix, $mimeType, $uploadType, $fileName = null)
{ {
$list = []; $list = [];
@ -143,7 +226,13 @@ class MyStorage extends Storage
$name = $this->filter->sanitize($file->getName(), ['trim', 'string']); $name = $this->filter->sanitize($file->getName(), ['trim', 'string']);
$extension = $this->getFileExtension($file->getName()); $extension = $this->getFileExtension($file->getName());
$keyName = $this->generateFileName($extension, $prefix);
if (empty($fileName)) {
$keyName = $this->generateFileName($extension, $prefix);
} else {
$keyName = $prefix . $fileName;
}
$path = $this->putFile($keyName, $file->getTempName()); $path = $this->putFile($keyName, $file->getTempName());
$upload = new UploadModel(); $upload = new UploadModel();

View File

@ -46,7 +46,7 @@ class Refund extends Service
{ {
$itemInfo = $order->item_info; $itemInfo = $order->item_info;
$itemInfo['course']['cover'] = kg_cos_cover_url($itemInfo['course']['cover']); $itemInfo['course']['cover'] = kg_cos_course_cover_url($itemInfo['course']['cover']);
$serviceFee = $this->getServiceFee($order); $serviceFee = $this->getServiceFee($order);
$serviceRate = $this->getServiceRate($order); $serviceRate = $this->getServiceRate($order);
@ -91,7 +91,7 @@ class Refund extends Service
*/ */
foreach ($itemInfo['courses'] as &$course) { foreach ($itemInfo['courses'] as &$course) {
$course['cover'] = kg_cos_cover_url($course['cover']); $course['cover'] = kg_cos_course_cover_url($course['cover']);
$refundPercent = 0.00; $refundPercent = 0.00;
$refundAmount = 0.00; $refundAmount = 0.00;

View File

@ -248,9 +248,10 @@ class Storage extends Service
*/ */
protected function generateFileName($extension = '', $prefix = '') protected function generateFileName($extension = '', $prefix = '')
{ {
$randDir = date('Y') . '/' . date('m') . '/';
$randName = date('YmdHis') . rand(100, 999) . rand(100, 999); $randName = date('YmdHis') . rand(100, 999) . rand(100, 999);
return $prefix . $randName . '.' . $extension; return $prefix . $randDir . $randName . '.' . $extension;
} }
/** /**

View File

@ -234,6 +234,7 @@ class Schema202103141300 extends Phinx\Migration\AbstractMigration
->save(); ->save();
$nav = $this->getQueryBuilder() $nav = $this->getQueryBuilder()
->select('*')
->from('kg_nav') ->from('kg_nav')
->orderDesc('id') ->orderDesc('id')
->execute()->fetch('assoc'); ->execute()->fetch('assoc');

View File

@ -2,6 +2,10 @@
margin-right: 10px; margin-right: 10px;
} }
.layui-table .layui-badge {
margin-bottom: 3px;
}
.layui-badge, .layui-badge-rim { .layui-badge, .layui-badge-rim {
padding-bottom: 1px; padding-bottom: 1px;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -58,6 +58,10 @@
margin-right: 10px; margin-right: 10px;
} }
.vip img {
border: 3px solid orange;
}
.qrcode img { .qrcode img {
width: 160px; width: 160px;
height: 160px; height: 160px;
@ -392,11 +396,18 @@
float: left; float: left;
width: 100%; width: 100%;
height: 230px; height: 230px;
position: relative;
background-color: #fff; background-color: #fff;
border-radius: 2px; border-radius: 2px;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
} }
.course-card .model {
position: absolute;
top: 15px;
right: 15px;
}
.course-card .cover { .course-card .cover {
overflow: hidden; overflow: hidden;
} }
@ -1295,15 +1306,6 @@
border-radius: 100px; border-radius: 100px;
} }
.user-profile .vip {
position: absolute;
top: 10px;
left: 10px;
height: 16px;
padding: 0 3px;
font-size: 10px;
}
.user-profile .info { .user-profile .info {
float: left; float: left;
padding-top: 10px; padding-top: 10px;
@ -1433,16 +1435,6 @@
font-size: 12px; font-size: 12px;
} }
.user-card .vip {
position: absolute;
top: 10px;
right: 10px;
height: 16px;
line-height: 16px;
padding: 0 3px;
font-size: 10px;
}
.user-card .type { .user-card .type {
position: absolute; position: absolute;
top: 18px; top: 18px;
@ -1466,10 +1458,6 @@
height: 220px; height: 220px;
} }
.group-user-list .user-card .avatar {
margin-top: 10px;
}
.group-list { .group-list {
margin-bottom: 20px; margin-bottom: 20px;
} }
@ -1502,6 +1490,7 @@
} }
.my-profile-card { .my-profile-card {
margin-bottom: 15px;
text-align: center; text-align: center;
} }
@ -1509,10 +1498,6 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
.my-profile-card .name {
margin-bottom: 10px;
}
.my-menu li { .my-menu li {
line-height: 30px; line-height: 30px;
padding-left: 30px; padding-left: 30px;
@ -1776,14 +1761,6 @@
padding: 0 5px; padding: 0 5px;
} }
.im-user-list .vip {
top: 8px;
right: 8px;
height: 14px;
line-height: 14px;
font-size: 10px;
}
.layim-msgbox { .layim-msgbox {
margin: 15px; margin: 15px;
} }