mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-27 21:10:24 +08:00
整理代码
This commit is contained in:
parent
905aabae8c
commit
0e77c07f17
@ -28,7 +28,6 @@ class ChapterTreeList extends Builder
|
|||||||
$list[] = [
|
$list[] = [
|
||||||
'id' => $chapter->id,
|
'id' => $chapter->id,
|
||||||
'title' => $chapter->title,
|
'title' => $chapter->title,
|
||||||
'summary' => $chapter->summary,
|
|
||||||
'priority' => $chapter->priority,
|
'priority' => $chapter->priority,
|
||||||
'children' => $this->handleChildren($chapter),
|
'children' => $this->handleChildren($chapter),
|
||||||
];
|
];
|
||||||
@ -65,7 +64,6 @@ class ChapterTreeList extends Builder
|
|||||||
$list[] = [
|
$list[] = [
|
||||||
'id' => $lesson->id,
|
'id' => $lesson->id,
|
||||||
'title' => $lesson->title,
|
'title' => $lesson->title,
|
||||||
'summary' => $lesson->summary,
|
|
||||||
'free' => $lesson->free,
|
'free' => $lesson->free,
|
||||||
'attrs' => $attrs,
|
'attrs' => $attrs,
|
||||||
];
|
];
|
||||||
|
@ -47,6 +47,7 @@ class CourseTeacherList extends Cache
|
|||||||
'name' => $user->name,
|
'name' => $user->name,
|
||||||
'avatar' => $user->avatar,
|
'avatar' => $user->avatar,
|
||||||
'title' => $user->title,
|
'title' => $user->title,
|
||||||
|
'about' => $user->about,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,9 +10,6 @@ use Phalcon\Mvc\Model\ResultsetInterface;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 免费课程
|
* 免费课程
|
||||||
*
|
|
||||||
* Class IndexNewbieCourseList
|
|
||||||
* @package App\Caches
|
|
||||||
*/
|
*/
|
||||||
class IndexFreeCourseList extends Cache
|
class IndexFreeCourseList extends Cache
|
||||||
{
|
{
|
||||||
@ -88,7 +85,7 @@ class IndexFreeCourseList extends Cache
|
|||||||
protected function findCategories($limit = 5)
|
protected function findCategories($limit = 5)
|
||||||
{
|
{
|
||||||
return CategoryModel::query()
|
return CategoryModel::query()
|
||||||
->andWhere('published = 1')
|
->where('level = 1 AND published = 1')
|
||||||
->orderBy('priority ASC')
|
->orderBy('priority ASC')
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
->execute();
|
->execute();
|
||||||
|
@ -9,9 +9,6 @@ use Phalcon\Mvc\Model\Resultset;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 直播课程
|
* 直播课程
|
||||||
*
|
|
||||||
* Class IndexLiveList
|
|
||||||
* @package App\Caches
|
|
||||||
*/
|
*/
|
||||||
class IndexLiveList extends Cache
|
class IndexLiveList extends Cache
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,6 @@ use Phalcon\Mvc\Model\ResultsetInterface;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新上课程
|
* 新上课程
|
||||||
*
|
|
||||||
* Class IndexLatestCourseList
|
|
||||||
* @package App\Caches
|
|
||||||
*/
|
*/
|
||||||
class IndexNewCourseList extends Cache
|
class IndexNewCourseList extends Cache
|
||||||
{
|
{
|
||||||
@ -88,7 +85,7 @@ class IndexNewCourseList extends Cache
|
|||||||
protected function findCategories($limit = 5)
|
protected function findCategories($limit = 5)
|
||||||
{
|
{
|
||||||
return CategoryModel::query()
|
return CategoryModel::query()
|
||||||
->andWhere('published = 1')
|
->where('level = 1 AND published = 1')
|
||||||
->orderBy('priority ASC')
|
->orderBy('priority ASC')
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
->execute();
|
->execute();
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
namespace App\Caches;
|
namespace App\Caches;
|
||||||
|
|
||||||
use App\Models\Slide as SlideModel;
|
use App\Models\Slide as SlideModel;
|
||||||
use App\Repos\Slide as SlideRepo;
|
use Phalcon\Mvc\Model\Resultset;
|
||||||
|
use Phalcon\Mvc\Model\ResultsetInterface;
|
||||||
|
|
||||||
class IndexSlideList extends Cache
|
class IndexSlideList extends Cache
|
||||||
{
|
{
|
||||||
@ -24,9 +25,7 @@ class IndexSlideList extends Cache
|
|||||||
{
|
{
|
||||||
$limit = 5;
|
$limit = 5;
|
||||||
|
|
||||||
$slideRepo = new SlideRepo();
|
$slides = $this->findSlides($limit);
|
||||||
|
|
||||||
$slides = $slideRepo->findTopSlides($limit);
|
|
||||||
|
|
||||||
if ($slides->count() == 0) {
|
if ($slides->count() == 0) {
|
||||||
return [];
|
return [];
|
||||||
@ -56,4 +55,17 @@ class IndexSlideList extends Cache
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $limit
|
||||||
|
* @return ResultsetInterface|Resultset|SlideModel[]
|
||||||
|
*/
|
||||||
|
public function findSlides($limit = 5)
|
||||||
|
{
|
||||||
|
return SlideModel::query()
|
||||||
|
->where('published = 1 AND deleted = 0')
|
||||||
|
->orderBy('priority ASC')
|
||||||
|
->limit($limit)
|
||||||
|
->execute();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,6 @@ use Phalcon\Mvc\Model\ResultsetInterface;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员特价课程
|
* 会员特价课程
|
||||||
*
|
|
||||||
* Class IndexNewbieCourseList
|
|
||||||
* @package App\Caches
|
|
||||||
*/
|
*/
|
||||||
class IndexVipCourseList extends Cache
|
class IndexVipCourseList extends Cache
|
||||||
{
|
{
|
||||||
@ -88,7 +85,7 @@ class IndexVipCourseList extends Cache
|
|||||||
protected function findCategories($limit = 5)
|
protected function findCategories($limit = 5)
|
||||||
{
|
{
|
||||||
return CategoryModel::query()
|
return CategoryModel::query()
|
||||||
->andWhere('published = 1')
|
->where('level = 1 AND published = 1')
|
||||||
->orderBy('priority ASC')
|
->orderBy('priority ASC')
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
->execute();
|
->execute();
|
||||||
|
@ -122,6 +122,7 @@ class Course extends Service
|
|||||||
} else {
|
} else {
|
||||||
$data['market_price'] = $validator->checkMarketPrice($post['market_price']);
|
$data['market_price'] = $validator->checkMarketPrice($post['market_price']);
|
||||||
$data['vip_price'] = $validator->checkVipPrice($post['vip_price']);
|
$data['vip_price'] = $validator->checkVipPrice($post['vip_price']);
|
||||||
|
$validator->checkComparePrice($post['market_price'], $post['vip_price']);
|
||||||
$data['study_expiry'] = $validator->checkStudyExpiry($post['study_expiry']);
|
$data['study_expiry'] = $validator->checkStudyExpiry($post['study_expiry']);
|
||||||
$data['refund_expiry'] = $validator->checkRefundExpiry($post['refund_expiry']);
|
$data['refund_expiry'] = $validator->checkRefundExpiry($post['refund_expiry']);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Admin\Services;
|
namespace App\Http\Admin\Services;
|
||||||
|
|
||||||
use App\Caches\IndexSlideList as SlideListCache;
|
use App\Caches\IndexSlideList as IndexSlideListCache;
|
||||||
use App\Library\Paginator\Query as PagerQuery;
|
use App\Library\Paginator\Query as PagerQuery;
|
||||||
use App\Models\Slide as SlideModel;
|
use App\Models\Slide as SlideModel;
|
||||||
use App\Repos\Slide as SlideRepo;
|
use App\Repos\Slide as SlideRepo;
|
||||||
@ -142,7 +142,7 @@ class Slide extends Service
|
|||||||
|
|
||||||
protected function rebuildSlideCache()
|
protected function rebuildSlideCache()
|
||||||
{
|
{
|
||||||
$cache = new SlideListCache();
|
$cache = new IndexSlideListCache();
|
||||||
|
|
||||||
$cache->rebuild();
|
$cache->rebuild();
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,20 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{%- macro level_info(value) %}
|
||||||
|
难度:<span class="layui-badge layui-bg-gray">
|
||||||
|
{% if value == 'entry' %}
|
||||||
|
入门
|
||||||
|
{% elseif value == 'junior' %}
|
||||||
|
初级
|
||||||
|
{% elseif value == 'medium' %}
|
||||||
|
中级
|
||||||
|
{% elseif value == 'senior' %}
|
||||||
|
高级
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
{%- macro category_info(category) %}
|
{%- macro category_info(category) %}
|
||||||
{% if category %}
|
{% if category %}
|
||||||
分类:<a class="layui-badge layui-bg-gray" href="{{ url({'for':'admin.course.list'},{'category_id':category.id}) }}">{{ category.name }}</a>
|
分类:<a class="layui-badge layui-bg-gray" href="{{ url({'for':'admin.course.list'},{'category_id':category.id}) }}">{{ category.name }}</a>
|
||||||
@ -60,7 +74,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>标题:<a href="{{ url({'for':'admin.course.chapters','id':item.id}) }}">{{ item.title }}</a> {{ model_info(item.model) }}</p>
|
<p>标题:<a href="{{ url({'for':'admin.course.chapters','id':item.id}) }}">{{ item.title }}</a> {{ model_info(item.model) }}</p>
|
||||||
<p>{{ category_info(item.category) }} {{ teacher_info(item.teacher) }}</p>
|
<p>{{ category_info(item.category) }} {{ teacher_info(item.teacher) }} {{ level_info(item.level) }}</p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ url({'for':'admin.course.chapters','id':item.id}) }}">
|
<a href="{{ url({'for':'admin.course.chapters','id':item.id}) }}">
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Web\Controllers;
|
namespace App\Http\Web\Controllers;
|
||||||
|
|
||||||
use App\Http\Web\Services\Chapter as ChapterService;
|
use App\Services\Frontend\Chapter\AgreeVote as ChapterAgreeVoteService;
|
||||||
|
use App\Services\Frontend\Chapter\ChapterInfo as ChapterInfoService;
|
||||||
|
use App\Services\Frontend\Chapter\CommentList as ChapterCommentListService;
|
||||||
|
use App\Services\Frontend\Chapter\OpposeVote as ChapterOpposeVoteService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @RoutePrefix("/chapter")
|
* @RoutePrefix("/chapter")
|
||||||
@ -15,9 +18,9 @@ class ChapterController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function showAction($id)
|
public function showAction($id)
|
||||||
{
|
{
|
||||||
$service = new ChapterService();
|
$service = new ChapterInfoService();
|
||||||
|
|
||||||
$chapter = $service->getChapter($id);
|
$chapter = $service->handle($id);
|
||||||
|
|
||||||
$this->view->chapter = $chapter;
|
$this->view->chapter = $chapter;
|
||||||
}
|
}
|
||||||
@ -27,11 +30,11 @@ class ChapterController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function commentsAction($id)
|
public function commentsAction($id)
|
||||||
{
|
{
|
||||||
$service = new ChapterService();
|
$service = new ChapterCommentListService();
|
||||||
|
|
||||||
$comments = $service->getComments($id);
|
$comments = $service->handle($id);
|
||||||
|
|
||||||
$this->view->comments = $comments;
|
return $this->jsonSuccess(['comments' => $comments]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,11 +42,11 @@ class ChapterController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function agreeAction($id)
|
public function agreeAction($id)
|
||||||
{
|
{
|
||||||
$service = new ChapterService();
|
$service = new ChapterAgreeVoteService();
|
||||||
|
|
||||||
$service->agree($id);
|
$service->handle($id);
|
||||||
|
|
||||||
return $this->response->ajaxSuccess();
|
return $this->jsonSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,35 +54,11 @@ class ChapterController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function opposeAction($id)
|
public function opposeAction($id)
|
||||||
{
|
{
|
||||||
$service = new ChapterService();
|
$service = new ChapterOpposeVoteService();
|
||||||
|
|
||||||
$service->oppose($id);
|
$service->handle($id);
|
||||||
|
|
||||||
return $this->response->ajaxSuccess();
|
return $this->jsonSuccess();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Post("/{id:[0-9]+}/position", name="web.chapter.position")
|
|
||||||
*/
|
|
||||||
public function positionAction($id)
|
|
||||||
{
|
|
||||||
$service = new ChapterService();
|
|
||||||
|
|
||||||
$service->position($id);
|
|
||||||
|
|
||||||
return $this->response->ajaxSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Post("/{id:[0-9]+}/finish", name="web.chapter.finish")
|
|
||||||
*/
|
|
||||||
public function finishAction($id)
|
|
||||||
{
|
|
||||||
$service = new ChapterService();
|
|
||||||
|
|
||||||
$service->finish($id);
|
|
||||||
|
|
||||||
return $this->response->ajaxSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
94
app/Http/Web/Controllers/CommentController.php
Normal file
94
app/Http/Web/Controllers/CommentController.php
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Web\Controllers;
|
||||||
|
|
||||||
|
use App\Services\Frontend\Comment\AgreeVote as CommentAgreeVoteService;
|
||||||
|
use App\Services\Frontend\Comment\CommentCreate as CommentCreateService;
|
||||||
|
use App\Services\Frontend\Comment\CommentDelete as CommentDeleteService;
|
||||||
|
use App\Services\Frontend\Comment\CommentInfo as CommentInfoService;
|
||||||
|
use App\Services\Frontend\Comment\CommentUpdate as CommentUpdateService;
|
||||||
|
use App\Services\Frontend\Comment\OpposeVote as CommentOpposeVoteService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @RoutePrefix("/comment")
|
||||||
|
*/
|
||||||
|
class CommentController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Get("/{id:[0-9]+}/info", name="web.comment.info")
|
||||||
|
*/
|
||||||
|
public function infoAction($id)
|
||||||
|
{
|
||||||
|
$service = new CommentInfoService();
|
||||||
|
|
||||||
|
$comment = $service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess(['comment' => $comment]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Post("/create", name="web.comment.create")
|
||||||
|
*/
|
||||||
|
public function createAction()
|
||||||
|
{
|
||||||
|
$service = new CommentCreateService();
|
||||||
|
|
||||||
|
$comment = $service->handle();
|
||||||
|
|
||||||
|
$service = new CommentInfoService();
|
||||||
|
|
||||||
|
$comment = $service->handle($comment->id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess(['comment' => $comment]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Post("/{id:[0-9]+}/update", name="web.comment.update")
|
||||||
|
*/
|
||||||
|
public function updateAction($id)
|
||||||
|
{
|
||||||
|
$service = new CommentUpdateService();
|
||||||
|
|
||||||
|
$comment = $service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess(['comment' => $comment]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Post("/{id:[0-9]+}/delete", name="web.comment.delete")
|
||||||
|
*/
|
||||||
|
public function deleteAction($id)
|
||||||
|
{
|
||||||
|
$service = new CommentDeleteService();
|
||||||
|
|
||||||
|
$service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Post("/{id:[0-9]+}/agree", name="web.comment.agree")
|
||||||
|
*/
|
||||||
|
public function agreeAction($id)
|
||||||
|
{
|
||||||
|
$service = new CommentAgreeVoteService();
|
||||||
|
|
||||||
|
$service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Post("/{id:[0-9]+}/oppose", name="web.comment.oppose")
|
||||||
|
*/
|
||||||
|
public function opposeAction($id)
|
||||||
|
{
|
||||||
|
$service = new CommentOpposeVoteService();
|
||||||
|
|
||||||
|
$service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
94
app/Http/Web/Controllers/ConsultController.php
Normal file
94
app/Http/Web/Controllers/ConsultController.php
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Web\Controllers;
|
||||||
|
|
||||||
|
use App\Services\Frontend\Consult\AgreeVote as ConsultAgreeVoteService;
|
||||||
|
use App\Services\Frontend\Consult\ConsultCreate as ConsultCreateService;
|
||||||
|
use App\Services\Frontend\Consult\ConsultDelete as ConsultDeleteService;
|
||||||
|
use App\Services\Frontend\Consult\ConsultInfo as ConsultInfoService;
|
||||||
|
use App\Services\Frontend\Consult\ConsultUpdate as ConsultUpdateService;
|
||||||
|
use App\Services\Frontend\Consult\OpposeVote as ConsultOpposeVoteService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @RoutePrefix("/consult")
|
||||||
|
*/
|
||||||
|
class ConsultController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Get("/{id:[0-9]+}/info", name="web.consult.info")
|
||||||
|
*/
|
||||||
|
public function infoAction($id)
|
||||||
|
{
|
||||||
|
$service = new ConsultInfoService();
|
||||||
|
|
||||||
|
$consult = $service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess(['consult' => $consult]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Post("/create", name="web.consult.create")
|
||||||
|
*/
|
||||||
|
public function createAction()
|
||||||
|
{
|
||||||
|
$service = new ConsultCreateService();
|
||||||
|
|
||||||
|
$consult = $service->handle();
|
||||||
|
|
||||||
|
$service = new ConsultInfoService();
|
||||||
|
|
||||||
|
$consult = $service->handle($consult->id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess(['consult' => $consult]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Post("/{id:[0-9]+}/update", name="web.consult.update")
|
||||||
|
*/
|
||||||
|
public function updateAction($id)
|
||||||
|
{
|
||||||
|
$service = new ConsultUpdateService();
|
||||||
|
|
||||||
|
$consult = $service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess(['consult' => $consult]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Post("/{id:[0-9]+}/delete", name="web.consult.delete")
|
||||||
|
*/
|
||||||
|
public function deleteAction($id)
|
||||||
|
{
|
||||||
|
$service = new ConsultDeleteService();
|
||||||
|
|
||||||
|
$service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Post("/{id:[0-9]+}/agree", name="web.consult.agree")
|
||||||
|
*/
|
||||||
|
public function agreeAction($id)
|
||||||
|
{
|
||||||
|
$service = new ConsultAgreeVoteService();
|
||||||
|
|
||||||
|
$service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Post("/{id:[0-9]+}/oppose", name="web.consult.oppose")
|
||||||
|
*/
|
||||||
|
public function opposeAction($id)
|
||||||
|
{
|
||||||
|
$service = new ConsultOpposeVoteService();
|
||||||
|
|
||||||
|
$service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -139,7 +139,7 @@ class CourseController extends Controller
|
|||||||
|
|
||||||
$pager = $consultListService->handle($id);
|
$pager = $consultListService->handle($id);
|
||||||
|
|
||||||
$this->view->setVar('pager', $pager);
|
return $this->jsonPaginate($pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -151,7 +151,7 @@ class CourseController extends Controller
|
|||||||
|
|
||||||
$pager = $reviewListService->handle($id);
|
$pager = $reviewListService->handle($id);
|
||||||
|
|
||||||
$this->view->setVar('pager', $pager);
|
return $this->jsonPaginate($pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,12 @@
|
|||||||
|
|
||||||
namespace App\Http\Web\Controllers;
|
namespace App\Http\Web\Controllers;
|
||||||
|
|
||||||
use App\Http\Web\Services\My as MyService;
|
use App\Services\Frontend\My\ConsultList as MyConsultListService;
|
||||||
|
use App\Services\Frontend\My\CourseList as MyCourseListService;
|
||||||
|
use App\Services\Frontend\My\FavoriteList as MyFavoriteListService;
|
||||||
|
use App\Services\Frontend\My\OrderList as MyOrderListService;
|
||||||
|
use App\Services\Frontend\My\RefundList as MyRefundListService;
|
||||||
|
use App\Services\Frontend\My\ReviewList as MyReviewListService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @RoutePrefix("/my")
|
* @RoutePrefix("/my")
|
||||||
@ -15,13 +20,23 @@ class MyController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function coursesAction()
|
public function coursesAction()
|
||||||
{
|
{
|
||||||
$service = new MyService();
|
$service = new MyCourseListService();
|
||||||
|
|
||||||
$courses = $service->getCourses();
|
$pager = $service->handle();
|
||||||
|
|
||||||
var_dump($courses);exit;
|
|
||||||
|
|
||||||
$this->view->courses = $courses;
|
$this->view->setVar('pager', $pager);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Get("/favorites", name="web.my.favorites")
|
||||||
|
*/
|
||||||
|
public function favoritesAction()
|
||||||
|
{
|
||||||
|
$service = new MyFavoriteListService();
|
||||||
|
|
||||||
|
$pager = $service->handle();
|
||||||
|
|
||||||
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,11 +44,11 @@ class MyController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function consultsAction()
|
public function consultsAction()
|
||||||
{
|
{
|
||||||
$service = new MyService();
|
$service = new MyConsultListService();
|
||||||
|
|
||||||
$consults = $service->getConsults();
|
$pager = $service->handle();
|
||||||
|
|
||||||
$this->view->consults = $consults;
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,11 +56,11 @@ class MyController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function reviewsAction()
|
public function reviewsAction()
|
||||||
{
|
{
|
||||||
$service = new MyService();
|
$service = new MyReviewListService();
|
||||||
|
|
||||||
$reviews = $service->getReviews();
|
$pager = $service->handle();
|
||||||
|
|
||||||
$this->view->reviews = $reviews;
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,33 +68,23 @@ class MyController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function ordersAction()
|
public function ordersAction()
|
||||||
{
|
{
|
||||||
$service = new MyService();
|
$service = new MyOrderListService();
|
||||||
|
|
||||||
$orders = $service->getOrders();
|
$pager = $service->handle();
|
||||||
|
|
||||||
$this->view->orders = $orders;
|
$this->view->setVar('pager', $pager);
|
||||||
|
|
||||||
return $this->jsonSuccess($orders);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Get("/coupons", name="web.my.coupons")
|
* @Get("/refunds", name="web.my.refunds")
|
||||||
*/
|
*/
|
||||||
public function couponsAction()
|
public function refundsAction()
|
||||||
{
|
{
|
||||||
$service = new MyService();
|
$service = new MyRefundListService();
|
||||||
|
|
||||||
$coupons = $service->getCoupons();
|
$pager = $service->handle();
|
||||||
|
|
||||||
$this->view->coupons = $coupons;
|
$this->view->setVar('pager', $pager);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Get("/balance", name="web.my.balance")
|
|
||||||
*/
|
|
||||||
public function balanceAction()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Web\Controllers;
|
namespace App\Http\Web\Controllers;
|
||||||
|
|
||||||
use App\Models\Order as OrderModel;
|
|
||||||
use Home\Services\Order as OrderService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @RoutePrefix("/order")
|
* @RoutePrefix("/order")
|
||||||
*/
|
*/
|
||||||
@ -12,43 +9,11 @@ class OrderController extends Controller
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Post("/confirm", name="web.order.confirm")
|
* @Get("/confirm", name="web.order.confirm")
|
||||||
*/
|
*/
|
||||||
public function confirmAction()
|
public function confirmAction()
|
||||||
{
|
{
|
||||||
$itemType = $this->request->get('item_type');
|
|
||||||
$itemId = $this->request->get('item_id');
|
|
||||||
|
|
||||||
$service = new OrderService();
|
|
||||||
|
|
||||||
switch ($itemType) {
|
|
||||||
|
|
||||||
case OrderModel::ITEM_ITEM_COURSE:
|
|
||||||
|
|
||||||
$course = $service->getCourse($itemId);
|
|
||||||
|
|
||||||
$this->view->course = $course;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OrderModel::ITEM_ITEM_PACKAGE:
|
|
||||||
|
|
||||||
$package = $service->getPackage($itemId);
|
|
||||||
$courses = $service->getPackageCourses($itemId);
|
|
||||||
|
|
||||||
$this->view->package = $package;
|
|
||||||
$this->view->courses = $courses;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OrderModel::ITEM_ITEM_REWARD:
|
|
||||||
|
|
||||||
$course = $service->getCourse($itemId);
|
|
||||||
|
|
||||||
$this->view->course = $course;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,11 +21,7 @@ class OrderController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function createAction()
|
public function createAction()
|
||||||
{
|
{
|
||||||
$service = new OrderService();
|
|
||||||
|
|
||||||
$order = $service->create();
|
|
||||||
|
|
||||||
return $this->response->ajaxSuccess($order);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,17 +29,7 @@ class OrderController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function cashierAction()
|
public function cashierAction()
|
||||||
{
|
{
|
||||||
$service = new OrderService();
|
|
||||||
|
|
||||||
$tradeNo = $this->request->getQuery('trade_no');
|
|
||||||
|
|
||||||
$order = $service->getOrder($tradeNo);
|
|
||||||
$orderItems = $service->getOrderItems($order->id);
|
|
||||||
|
|
||||||
$this->view->order = $order;
|
|
||||||
$this->view->orderItems = $orderItems;
|
|
||||||
|
|
||||||
return $this->jsonSuccess($order->toArray());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,19 +37,7 @@ class OrderController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function payAction()
|
public function payAction()
|
||||||
{
|
{
|
||||||
$service = new OrderService();
|
|
||||||
|
|
||||||
$tradeNo = $this->request->getPost('trade_no');
|
|
||||||
$payChannel = $this->request->getPost('pay_channel');
|
|
||||||
|
|
||||||
$order = $service->getOrder($tradeNo);
|
|
||||||
|
|
||||||
$qrCodeText = $service->qrCode($tradeNo, $payChannel);
|
|
||||||
|
|
||||||
//$qrCodeUrl = "http://qr.liantu.com/api.php?text={$qrCodeText}";
|
|
||||||
|
|
||||||
$this->view->order = $order;
|
|
||||||
$this->view->qrCodeText = $qrCodeText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,9 +45,7 @@ class OrderController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function notifyAction($channel)
|
public function notifyAction($channel)
|
||||||
{
|
{
|
||||||
$service = new OrderService();
|
|
||||||
|
|
||||||
$service->notify($channel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -116,15 +53,7 @@ class OrderController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function statusAction()
|
public function statusAction()
|
||||||
{
|
{
|
||||||
$service = new OrderService();
|
|
||||||
|
|
||||||
$tradeNo = $this->request->getPost('trade_no');
|
|
||||||
|
|
||||||
$order = $service->getOrder($tradeNo);
|
|
||||||
|
|
||||||
$this->response->ajaxSuccess([
|
|
||||||
'status' => $order->status
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,11 +61,7 @@ class OrderController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function cancelAction()
|
public function cancelAction()
|
||||||
{
|
{
|
||||||
$service = new OrderService();
|
|
||||||
|
|
||||||
$order = $service->cancel();
|
|
||||||
|
|
||||||
return $this->jsonSuccess($order->toArray());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
38
app/Http/Web/Controllers/PackageController.php
Normal file
38
app/Http/Web/Controllers/PackageController.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Web\Controllers;
|
||||||
|
|
||||||
|
use App\Services\Frontend\Package\CourseList as PackageCourseListService;
|
||||||
|
use App\Services\Frontend\Package\PackageInfo as PackageInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @RoutePrefix("/package")
|
||||||
|
*/
|
||||||
|
class PackageController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Get("/{id:[0-9]+}/info", name="web.package.info")
|
||||||
|
*/
|
||||||
|
public function infoAction($id)
|
||||||
|
{
|
||||||
|
$service = new PackageInfoService();
|
||||||
|
|
||||||
|
$package = $service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess(['package' => $package]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Get("/{id:[0-9]+}/courses", name="web.package.courses")
|
||||||
|
*/
|
||||||
|
public function coursesAction($id)
|
||||||
|
{
|
||||||
|
$service = new PackageCourseListService();
|
||||||
|
|
||||||
|
$courses = $service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess(['courses' => $courses]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,7 +2,12 @@
|
|||||||
|
|
||||||
namespace App\Http\Web\Controllers;
|
namespace App\Http\Web\Controllers;
|
||||||
|
|
||||||
use App\Http\Web\Services\Review as ReviewService;
|
use App\Services\Frontend\Review\AgreeVote as ReviewAgreeVoteService;
|
||||||
|
use App\Services\Frontend\Review\OpposeVote as ReviewOpposeVoteService;
|
||||||
|
use App\Services\Frontend\Review\ReviewCreate as ReviewCreateService;
|
||||||
|
use App\Services\Frontend\Review\ReviewDelete as ReviewDeleteService;
|
||||||
|
use App\Services\Frontend\Review\ReviewInfo as ReviewInfoService;
|
||||||
|
use App\Services\Frontend\Review\ReviewUpdate as ReviewUpdateService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @RoutePrefix("/review")
|
* @RoutePrefix("/review")
|
||||||
@ -10,30 +15,32 @@ use App\Http\Web\Services\Review as ReviewService;
|
|||||||
class ReviewController extends Controller
|
class ReviewController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Get("/{id:[0-9]+}/info", name="web.review.info")
|
||||||
|
*/
|
||||||
|
public function infoAction($id)
|
||||||
|
{
|
||||||
|
$service = new ReviewInfoService();
|
||||||
|
|
||||||
|
$review = $service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess(['review' => $review]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Post("/create", name="web.review.create")
|
* @Post("/create", name="web.review.create")
|
||||||
*/
|
*/
|
||||||
public function createAction()
|
public function createAction()
|
||||||
{
|
{
|
||||||
$service = new ReviewService();
|
$service = new ReviewCreateService();
|
||||||
|
|
||||||
$review = $service->create();
|
$review = $service->handle();
|
||||||
|
|
||||||
$data = $service->getReview($review->id);
|
$service = new ReviewInfoService();
|
||||||
|
|
||||||
return $this->jsonSuccess($data);
|
$review = $service->handle($review->id);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
return $this->jsonSuccess(['review' => $review]);
|
||||||
* @Get("/{id:[0-9]+}", name="web.review.show")
|
|
||||||
*/
|
|
||||||
public function showAction($id)
|
|
||||||
{
|
|
||||||
$service = new ReviewService();
|
|
||||||
|
|
||||||
$review = $service->getReview($id);
|
|
||||||
|
|
||||||
return $this->response->ajaxSuccess($review);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,13 +48,11 @@ class ReviewController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function updateAction($id)
|
public function updateAction($id)
|
||||||
{
|
{
|
||||||
$service = new ReviewService();
|
$service = new ReviewUpdateService();
|
||||||
|
|
||||||
$review = $service->update($id);
|
$review = $service->handle($id);
|
||||||
|
|
||||||
$data = $service->getReview($review->id);
|
return $this->jsonSuccess(['review' => $review]);
|
||||||
|
|
||||||
return $this->response->ajaxSuccess($data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,11 +60,11 @@ class ReviewController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function deleteAction($id)
|
public function deleteAction($id)
|
||||||
{
|
{
|
||||||
$service = new ReviewService();
|
$service = new ReviewDeleteService();
|
||||||
|
|
||||||
$service->delete($id);
|
$service->handle($id);
|
||||||
|
|
||||||
return $this->response->ajaxSuccess();
|
return $this->jsonSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,11 +72,11 @@ class ReviewController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function agreeAction($id)
|
public function agreeAction($id)
|
||||||
{
|
{
|
||||||
$service = new ReviewService();
|
$service = new ReviewAgreeVoteService();
|
||||||
|
|
||||||
$service->agree($id);
|
$service->handle($id);
|
||||||
|
|
||||||
return $this->response->ajaxSuccess();
|
return $this->jsonSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,23 +84,11 @@ class ReviewController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function opposeAction($id)
|
public function opposeAction($id)
|
||||||
{
|
{
|
||||||
$service = new ReviewService();
|
$service = new ReviewOpposeVoteService();
|
||||||
|
|
||||||
$service->oppose($id);
|
$service->handle($id);
|
||||||
|
|
||||||
return $this->response->ajaxSuccess();
|
return $this->jsonSuccess();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Post("/{id:[0-9]+}/reply", name="web.review.reply")
|
|
||||||
*/
|
|
||||||
public function replyAction($id)
|
|
||||||
{
|
|
||||||
$service = new ReviewService();
|
|
||||||
|
|
||||||
$service->reply($id);
|
|
||||||
|
|
||||||
return $this->response->ajaxSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
38
app/Http/Web/Controllers/TopicController.php
Normal file
38
app/Http/Web/Controllers/TopicController.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Web\Controllers;
|
||||||
|
|
||||||
|
use App\Services\Frontend\Topic\CourseList as TopicCourseListService;
|
||||||
|
use App\Services\Frontend\Topic\TopicInfo as TopicInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @RoutePrefix("/topic")
|
||||||
|
*/
|
||||||
|
class TopicController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Get("/{id:[0-9]+}/info", name="web.topic.info")
|
||||||
|
*/
|
||||||
|
public function infoAction($id)
|
||||||
|
{
|
||||||
|
$service = new TopicInfoService();
|
||||||
|
|
||||||
|
$topic = $service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess(['topic' => $topic]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Get("/{id:[0-9]+}/courses", name="web.topic.courses")
|
||||||
|
*/
|
||||||
|
public function coursesAction($id)
|
||||||
|
{
|
||||||
|
$service = new TopicCourseListService();
|
||||||
|
|
||||||
|
$courses = $service->handle($id);
|
||||||
|
|
||||||
|
return $this->jsonSuccess(['courses' => $courses]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Http\Web\Controllers;
|
namespace App\Http\Web\Controllers;
|
||||||
|
|
||||||
|
use App\Services\Frontend\User\CourseList as UserCourseListService;
|
||||||
|
use App\Services\Frontend\User\UserInfo as UserInfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @RoutePrefix("/user")
|
* @RoutePrefix("/user")
|
||||||
*/
|
*/
|
||||||
@ -13,7 +16,11 @@ class UserController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function showAction($id)
|
public function showAction($id)
|
||||||
{
|
{
|
||||||
|
$service = new UserInfoService();
|
||||||
|
|
||||||
|
$user = $service->handle($id);
|
||||||
|
|
||||||
|
$this->view->setVar('user', $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,15 +28,11 @@ class UserController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function coursesAction($id)
|
public function coursesAction($id)
|
||||||
{
|
{
|
||||||
|
$service = new UserCourseListService();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$courses = $service->handle($id);
|
||||||
* @Post("/{id:[0-9]+}/message", name="web.user.message")
|
|
||||||
*/
|
return $this->jsonSuccess(['courses' => $courses]);
|
||||||
public function messageAction($id)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,9 @@ class Order extends Model
|
|||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->status = self::STATUS_PENDING;
|
$this->status = self::STATUS_PENDING;
|
||||||
|
|
||||||
$this->sn = date('YmdHis') . rand(1000, 9999);
|
$this->sn = date('YmdHis') . rand(1000, 9999);
|
||||||
|
|
||||||
$this->create_time = time();
|
$this->create_time = time();
|
||||||
|
|
||||||
if (is_array($this->item_info) && !empty($this->item_info)) {
|
if (is_array($this->item_info) && !empty($this->item_info)) {
|
||||||
|
@ -128,7 +128,9 @@ class Refund extends Model
|
|||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->status = self::STATUS_PENDING;
|
$this->status = self::STATUS_PENDING;
|
||||||
|
|
||||||
$this->sn = date('YmdHis') . rand(1000, 9999);
|
$this->sn = date('YmdHis') . rand(1000, 9999);
|
||||||
|
|
||||||
$this->create_time = time();
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,20 @@ class Review extends Model
|
|||||||
*/
|
*/
|
||||||
public $user_id;
|
public $user_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评价内容
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复内容
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $reply;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程评分
|
* 课程评分
|
||||||
*
|
*
|
||||||
@ -36,11 +50,18 @@ class Review extends Model
|
|||||||
public $rating;
|
public $rating;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 评价内容
|
* 赞同数量
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $content;
|
public $agree_count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 反对数量
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $oppose_count;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布标识
|
* 发布标识
|
||||||
|
@ -125,7 +125,9 @@ class Trade extends Model
|
|||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->status = self::STATUS_PENDING;
|
$this->status = self::STATUS_PENDING;
|
||||||
|
|
||||||
$this->sn = date('YmdHis') . rand(1000, 9999);
|
$this->sn = date('YmdHis') . rand(1000, 9999);
|
||||||
|
|
||||||
$this->create_time = time();
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ use App\Library\Http\Response as MyResponse;
|
|||||||
class Response extends Provider
|
class Response extends Provider
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $serviceName = 'view';
|
protected $serviceName = 'response';
|
||||||
|
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
|
@ -70,18 +70,4 @@ class Slide extends Repository
|
|||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $limit
|
|
||||||
* @return ResultsetInterface|Resultset|SlideModel[]
|
|
||||||
*/
|
|
||||||
public function findTopSlides($limit = 5)
|
|
||||||
{
|
|
||||||
return SlideModel::query()
|
|
||||||
->andWhere('published = :published:', ['published' => 1])
|
|
||||||
->andWhere('deleted = :deleted:', ['deleted' => 0])
|
|
||||||
->orderBy('priority ASC')
|
|
||||||
->limit($limit)
|
|
||||||
->execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,11 @@ class ChapterInfo extends Service
|
|||||||
$me['owned'] = $this->ownedChapter;
|
$me['owned'] = $this->ownedChapter;
|
||||||
|
|
||||||
if ($user->id > 0) {
|
if ($user->id > 0) {
|
||||||
|
|
||||||
$chapterVoteRepo = new ChapterVoteRepo();
|
$chapterVoteRepo = new ChapterVoteRepo();
|
||||||
|
|
||||||
$chapterVote = $chapterVoteRepo->findChapterVote($chapter->id, $user->id);
|
$chapterVote = $chapterVoteRepo->findChapterVote($chapter->id, $user->id);
|
||||||
|
|
||||||
if ($chapterVote) {
|
if ($chapterVote) {
|
||||||
$me['agreed'] = $chapterVote->type == ChapterVoteModel::TYPE_AGREE ? 1 : 0;
|
$me['agreed'] = $chapterVote->type == ChapterVoteModel::TYPE_AGREE ? 1 : 0;
|
||||||
$me['opposed'] = $chapterVote->type == ChapterVoteModel::TYPE_OPPOSE ? 1 : 0;
|
$me['opposed'] = $chapterVote->type == ChapterVoteModel::TYPE_OPPOSE ? 1 : 0;
|
||||||
@ -103,13 +106,10 @@ class ChapterInfo extends Service
|
|||||||
|
|
||||||
$playUrls = $chapterVodService->getPlayUrls($chapter->id);
|
$playUrls = $chapterVodService->getPlayUrls($chapter->id);
|
||||||
|
|
||||||
$course = $this->formatCourse($this->course);
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $chapter->id,
|
'id' => $chapter->id,
|
||||||
'title' => $chapter->title,
|
'title' => $chapter->title,
|
||||||
'summary' => $chapter->summary,
|
'summary' => $chapter->summary,
|
||||||
'course' => $course,
|
|
||||||
'play_urls' => $playUrls,
|
'play_urls' => $playUrls,
|
||||||
'user_count' => $chapter->user_count,
|
'user_count' => $chapter->user_count,
|
||||||
'agree_count' => $chapter->agree_count,
|
'agree_count' => $chapter->agree_count,
|
||||||
@ -132,8 +132,6 @@ class ChapterInfo extends Service
|
|||||||
|
|
||||||
$playUrls = $liveService->getPullUrls($stream, $format);
|
$playUrls = $liveService->getPullUrls($stream, $format);
|
||||||
|
|
||||||
$course = $this->formatCourse($this->course);
|
|
||||||
|
|
||||||
$chapterRepo = new ChapterRepo();
|
$chapterRepo = new ChapterRepo();
|
||||||
|
|
||||||
$live = $chapterRepo->findChapterLive($chapter->id);
|
$live = $chapterRepo->findChapterLive($chapter->id);
|
||||||
@ -142,7 +140,6 @@ class ChapterInfo extends Service
|
|||||||
'id' => $chapter->id,
|
'id' => $chapter->id,
|
||||||
'title' => $chapter->title,
|
'title' => $chapter->title,
|
||||||
'summary' => $chapter->summary,
|
'summary' => $chapter->summary,
|
||||||
'course' => $course,
|
|
||||||
'play_urls' => $playUrls,
|
'play_urls' => $playUrls,
|
||||||
'start_time' => $live->start_time,
|
'start_time' => $live->start_time,
|
||||||
'end_time' => $live->end_time,
|
'end_time' => $live->end_time,
|
||||||
@ -159,13 +156,10 @@ class ChapterInfo extends Service
|
|||||||
|
|
||||||
$read = $chapterRepo->findChapterRead($chapter->id);
|
$read = $chapterRepo->findChapterRead($chapter->id);
|
||||||
|
|
||||||
$course = $this->formatCourse($this->course);
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $chapter->id,
|
'id' => $chapter->id,
|
||||||
'title' => $chapter->title,
|
'title' => $chapter->title,
|
||||||
'summary' => $chapter->summary,
|
'summary' => $chapter->summary,
|
||||||
'course' => $course,
|
|
||||||
'content' => $read->content,
|
'content' => $read->content,
|
||||||
'user_count' => $chapter->user_count,
|
'user_count' => $chapter->user_count,
|
||||||
'agree_count' => $chapter->agree_count,
|
'agree_count' => $chapter->agree_count,
|
||||||
@ -174,17 +168,9 @@ class ChapterInfo extends Service
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function formatCourse(CourseModel $course)
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'id' => $course->id,
|
|
||||||
'title' => $course->title,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function handleCourseUser(CourseModel $course, UserModel $user)
|
protected function handleCourseUser(CourseModel $course, UserModel $user)
|
||||||
{
|
{
|
||||||
if ($user->id == 0) return;
|
if (empty($user->id)) return;
|
||||||
|
|
||||||
if ($this->joinedCourse) return;
|
if ($this->joinedCourse) return;
|
||||||
|
|
||||||
@ -205,7 +191,7 @@ class ChapterInfo extends Service
|
|||||||
|
|
||||||
protected function handleChapterUser(ChapterModel $chapter, UserModel $user)
|
protected function handleChapterUser(ChapterModel $chapter, UserModel $user)
|
||||||
{
|
{
|
||||||
if ($user->id == 0) return;
|
if (empty($user->id)) return;
|
||||||
|
|
||||||
if ($this->joinedChapter) return;
|
if ($this->joinedChapter) return;
|
||||||
|
|
||||||
|
@ -64,13 +64,13 @@ class CommentList extends Service
|
|||||||
|
|
||||||
$users = $builder->getUsers($comments);
|
$users = $builder->getUsers($comments);
|
||||||
|
|
||||||
$votes = $this->getCommentVotes($this->chapter->id, $this->user->id);
|
$votes = $this->getCommentVotes($this->chapter, $this->user);
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
||||||
foreach ($comments as $comment) {
|
foreach ($comments as $comment) {
|
||||||
|
|
||||||
$user = $users[$comment['user_id']] ?? [];
|
$user = $users[$comment['user_id']] ?? new \stdClass();
|
||||||
|
|
||||||
$comment['mentions'] = $comment['mentions'] ? json_decode($comment['mentions']) : [];
|
$comment['mentions'] = $comment['mentions'] ? json_decode($comment['mentions']) : [];
|
||||||
|
|
||||||
@ -97,15 +97,15 @@ class CommentList extends Service
|
|||||||
return $pager;
|
return $pager;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCommentVotes($chapterId, $userId)
|
protected function getCommentVotes(ChapterModel $chapter, UserModel $user)
|
||||||
{
|
{
|
||||||
if (!$chapterId || !$userId) {
|
if ($chapter->id == 0 || $user->id == 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$chapterRepo = new ChapterRepo();
|
$chapterRepo = new ChapterRepo();
|
||||||
|
|
||||||
$votes = $chapterRepo->findUserCommentVotes($chapterId, $userId);
|
$votes = $chapterRepo->findUserCommentVotes($chapter->id, $user->id);
|
||||||
|
|
||||||
if ($votes->count() == 0) {
|
if ($votes->count() == 0) {
|
||||||
return [];
|
return [];
|
||||||
|
@ -23,16 +23,16 @@ class CommentCreate extends Service
|
|||||||
|
|
||||||
$user = $this->getLoginUser();
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
|
$chapter = $this->checkChapter($post['chapter_id']);
|
||||||
|
|
||||||
|
$course = $this->checkCourse($chapter->course_id);
|
||||||
|
|
||||||
$validator = new UserDailyLimitValidator();
|
$validator = new UserDailyLimitValidator();
|
||||||
|
|
||||||
$validator->checkCommentLimit($user);
|
$validator->checkCommentLimit($user);
|
||||||
|
|
||||||
$validator = new CommentValidator();
|
$validator = new CommentValidator();
|
||||||
|
|
||||||
$chapter = $this->checkChapterCache($post['chapter_id']);
|
|
||||||
|
|
||||||
$course = $this->checkCourseCache($chapter->course_id);
|
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
$data['content'] = $validator->checkContent($post['content']);
|
$data['content'] = $validator->checkContent($post['content']);
|
||||||
@ -59,6 +59,8 @@ class CommentCreate extends Service
|
|||||||
$this->incrCourseCommentCount($course);
|
$this->incrCourseCommentCount($course);
|
||||||
|
|
||||||
$this->incrUserDailyCommentCount($user);
|
$this->incrUserDailyCommentCount($user);
|
||||||
|
|
||||||
|
return $comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function handleMentions($mentions)
|
protected function handleMentions($mentions)
|
||||||
|
@ -19,22 +19,20 @@ class CommentDelete extends Service
|
|||||||
{
|
{
|
||||||
$comment = $this->checkComment($id);
|
$comment = $this->checkComment($id);
|
||||||
|
|
||||||
|
$chapter = $this->checkChapter($comment->chapter_id);
|
||||||
|
|
||||||
|
$course = $this->checkCourse($comment->course_id);
|
||||||
|
|
||||||
$user = $this->getLoginUser();
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
$validator = new CommentValidator();
|
$validator = new CommentValidator();
|
||||||
|
|
||||||
$validator->checkOwner($user->id, $comment->user_id);
|
$validator->checkOwner($user->id, $comment->user_id);
|
||||||
|
|
||||||
$comment->deleted = 1;
|
$comment->delete();
|
||||||
|
|
||||||
$comment->update();
|
|
||||||
|
|
||||||
$chapter = $this->checkChapterCache($comment->chapter_id);
|
|
||||||
|
|
||||||
$this->decrChapterCommentCount($chapter);
|
$this->decrChapterCommentCount($chapter);
|
||||||
|
|
||||||
$course = $this->checkCourseCache($comment->course_id);
|
|
||||||
|
|
||||||
$this->decrCourseCommentCount($course);
|
$this->decrCourseCommentCount($course);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
71
app/Services/Frontend/Comment/CommentInfo.php
Normal file
71
app/Services/Frontend/Comment/CommentInfo.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Frontend\Comment;
|
||||||
|
|
||||||
|
use App\Models\Comment as CommentModel;
|
||||||
|
use App\Models\CommentVote as CommentVoteModel;
|
||||||
|
use App\Models\User as UserModel;
|
||||||
|
use App\Repos\CommentVote as CommentVoteRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
use App\Services\Frontend\CommentTrait;
|
||||||
|
use App\Services\Frontend\Service;
|
||||||
|
|
||||||
|
class CommentInfo extends Service
|
||||||
|
{
|
||||||
|
|
||||||
|
use CommentTrait;
|
||||||
|
|
||||||
|
public function handle($id)
|
||||||
|
{
|
||||||
|
$comment = $this->checkComment($id);
|
||||||
|
|
||||||
|
$user = $this->getCurrentUser();
|
||||||
|
|
||||||
|
return $this->handleComment($comment, $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function handleComment(CommentModel $comment, UserModel $user)
|
||||||
|
{
|
||||||
|
$result = [
|
||||||
|
'id' => $comment->id,
|
||||||
|
'content' => $comment->content,
|
||||||
|
'mentions' => $comment->mentions,
|
||||||
|
'agree_count' => $comment->agree_count,
|
||||||
|
'oppose_count' => $comment->oppose_count,
|
||||||
|
'create_time' => $comment->create_time,
|
||||||
|
'update_time' => $comment->update_time,
|
||||||
|
];
|
||||||
|
|
||||||
|
$me = [
|
||||||
|
'agreed' => 0,
|
||||||
|
'opposed' => 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($user->id > 0) {
|
||||||
|
|
||||||
|
$voteRepo = new CommentVoteRepo();
|
||||||
|
|
||||||
|
$vote = $voteRepo->findCommentVote($comment->id, $user->id);
|
||||||
|
|
||||||
|
if ($vote) {
|
||||||
|
$me['agreed'] = $vote->type == CommentVoteModel::TYPE_AGREE ? 1 : 0;
|
||||||
|
$me['opposed'] = $vote->type == CommentVoteModel::TYPE_OPPOSE ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$owner = $userRepo->findById($comment->user_id);
|
||||||
|
|
||||||
|
$result['owner'] = [
|
||||||
|
'id' => $owner->id,
|
||||||
|
'name' => $owner->name,
|
||||||
|
'avatar' => $owner->avatar,
|
||||||
|
];
|
||||||
|
|
||||||
|
$result['me'] = $me;
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
42
app/Services/Frontend/Comment/CommentUpdate.php
Normal file
42
app/Services/Frontend/Comment/CommentUpdate.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Frontend\Comment;
|
||||||
|
|
||||||
|
use App\Services\Frontend\CommentTrait;
|
||||||
|
use App\Services\Frontend\Service;
|
||||||
|
use App\Validators\Comment as CommentValidator;
|
||||||
|
|
||||||
|
class CommentUpdate extends Service
|
||||||
|
{
|
||||||
|
|
||||||
|
use CommentTrait;
|
||||||
|
|
||||||
|
public function handle($id)
|
||||||
|
{
|
||||||
|
$post = $this->request->getPost();
|
||||||
|
|
||||||
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
|
$comment = $this->checkComment($id);
|
||||||
|
|
||||||
|
$validator = new CommentValidator();
|
||||||
|
|
||||||
|
$validator->checkOwner($user->id, $comment->user_id);
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
$data['content'] = $validator->checkContent($post['content']);
|
||||||
|
|
||||||
|
if (isset($post['mentions'])) {
|
||||||
|
$data['mentions'] = $validator->checkMentions($post['mentions']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$comment->update($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function handleMentions($mentions)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -13,7 +13,7 @@ class AgreeVote extends Service
|
|||||||
|
|
||||||
use ConsultTrait, VoteTrait;
|
use ConsultTrait, VoteTrait;
|
||||||
|
|
||||||
public function handleAgreeVote($id)
|
public function handle($id)
|
||||||
{
|
{
|
||||||
$consult = $this->checkConsult($id);
|
$consult = $this->checkConsult($id);
|
||||||
|
|
||||||
|
38
app/Services/Frontend/Consult/ConsultDelete.php
Normal file
38
app/Services/Frontend/Consult/ConsultDelete.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Frontend\Consult;
|
||||||
|
|
||||||
|
use App\Models\Course as CourseModel;
|
||||||
|
use App\Services\Frontend\ConsultTrait;
|
||||||
|
use App\Services\Frontend\CourseTrait;
|
||||||
|
use App\Services\Frontend\Service;
|
||||||
|
use App\Validators\Consult as ConsultValidator;
|
||||||
|
|
||||||
|
class ConsultDelete extends Service
|
||||||
|
{
|
||||||
|
|
||||||
|
use CourseTrait, ConsultTrait;
|
||||||
|
|
||||||
|
public function handle($id)
|
||||||
|
{
|
||||||
|
$consult = $this->checkConsult($id);
|
||||||
|
|
||||||
|
$course = $this->checkCourse($consult->course_id);
|
||||||
|
|
||||||
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
|
$validator = new ConsultValidator();
|
||||||
|
|
||||||
|
$validator->checkOwner($user->id, $consult->user_id);
|
||||||
|
|
||||||
|
$consult->delete();
|
||||||
|
|
||||||
|
$this->decrCourseConsultCount($course);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function decrCourseConsultCount(CourseModel $course)
|
||||||
|
{
|
||||||
|
$this->eventsManager->fire('courseCounter:decrConsultCount', $this, $course);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
71
app/Services/Frontend/Consult/ConsultInfo.php
Normal file
71
app/Services/Frontend/Consult/ConsultInfo.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Frontend\Consult;
|
||||||
|
|
||||||
|
use App\Models\Consult as ConsultModel;
|
||||||
|
use App\Models\ConsultVote as ConsultVoteModel;
|
||||||
|
use App\Models\User as UserModel;
|
||||||
|
use App\Repos\ConsultVote as ConsultVoteRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
use App\Services\Frontend\ConsultTrait;
|
||||||
|
use App\Services\Frontend\Service;
|
||||||
|
|
||||||
|
class ConsultInfo extends Service
|
||||||
|
{
|
||||||
|
|
||||||
|
use ConsultTrait;
|
||||||
|
|
||||||
|
public function handle($id)
|
||||||
|
{
|
||||||
|
$consult = $this->checkConsult($id);
|
||||||
|
|
||||||
|
$user = $this->getCurrentUser();
|
||||||
|
|
||||||
|
return $this->handleConsult($consult, $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function handleConsult(ConsultModel $consult, UserModel $user)
|
||||||
|
{
|
||||||
|
$result = [
|
||||||
|
'id' => $consult->id,
|
||||||
|
'question' => $consult->question,
|
||||||
|
'answer' => $consult->answer,
|
||||||
|
'agree_count' => $consult->agree_count,
|
||||||
|
'oppose_count' => $consult->oppose_count,
|
||||||
|
'create_time' => $consult->create_time,
|
||||||
|
'update_time' => $consult->update_time,
|
||||||
|
];
|
||||||
|
|
||||||
|
$me = [
|
||||||
|
'agreed' => 0,
|
||||||
|
'opposed' => 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($user->id > 0) {
|
||||||
|
|
||||||
|
$voteRepo = new ConsultVoteRepo();
|
||||||
|
|
||||||
|
$vote = $voteRepo->findConsultVote($consult->id, $user->id);
|
||||||
|
|
||||||
|
if ($vote) {
|
||||||
|
$me['agreed'] = $vote->type == ConsultVoteModel::TYPE_AGREE ? 1 : 0;
|
||||||
|
$me['opposed'] = $vote->type == ConsultVoteModel::TYPE_OPPOSE ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$owner = $userRepo->findById($consult->user_id);
|
||||||
|
|
||||||
|
$result['owner'] = [
|
||||||
|
'id' => $owner->id,
|
||||||
|
'name' => $owner->name,
|
||||||
|
'avatar' => $owner->avatar,
|
||||||
|
];
|
||||||
|
|
||||||
|
$result['me'] = $me;
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
36
app/Services/Frontend/Consult/ConsultUpdate.php
Normal file
36
app/Services/Frontend/Consult/ConsultUpdate.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Frontend\Consult;
|
||||||
|
|
||||||
|
use App\Services\Frontend\ConsultTrait;
|
||||||
|
use App\Services\Frontend\CourseTrait;
|
||||||
|
use App\Services\Frontend\Service;
|
||||||
|
use App\Validators\Consult as ConsultValidator;
|
||||||
|
|
||||||
|
class ConsultUpdate extends Service
|
||||||
|
{
|
||||||
|
|
||||||
|
use CourseTrait, ConsultTrait;
|
||||||
|
|
||||||
|
public function handle($id)
|
||||||
|
{
|
||||||
|
$post = $this->request->getPost();
|
||||||
|
|
||||||
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
|
$consult = $this->checkConsult($id);
|
||||||
|
|
||||||
|
$validator = new ConsultValidator();
|
||||||
|
|
||||||
|
$validator->checkOwner($user->id, $consult->user_id);
|
||||||
|
|
||||||
|
$question = $validator->checkQuestion($post['question']);
|
||||||
|
|
||||||
|
$consult->question = $question;
|
||||||
|
|
||||||
|
$consult->update();
|
||||||
|
|
||||||
|
return $consult;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -45,12 +45,12 @@ class ChapterList extends Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$mapping = $this->getLearningMapping($course, $user);
|
$mappings = $this->getLearningMappings($course, $user);
|
||||||
foreach ($chapters as &$chapter) {
|
foreach ($chapters as &$chapter) {
|
||||||
foreach ($chapter['children'] as &$lesson) {
|
foreach ($chapter['children'] as &$lesson) {
|
||||||
$lesson['me'] = [
|
$lesson['me'] = [
|
||||||
'owned' => $this->ownedCourse || $lesson['free'] ? 1 : 0,
|
'owned' => $this->ownedCourse || $lesson['free'] ? 1 : 0,
|
||||||
'progress' => $mapping[$lesson['id']]['progress'] ?? 0,
|
'progress' => $mappings[$lesson['id']]['progress'] ?? 0,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ class ChapterList extends Service
|
|||||||
return $chapters;
|
return $chapters;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getLearningMapping(CourseModel $course, UserModel $user)
|
protected function getLearningMappings(CourseModel $course, UserModel $user)
|
||||||
{
|
{
|
||||||
$courseRepo = new CourseRepo();
|
$courseRepo = new CourseRepo();
|
||||||
|
|
||||||
@ -69,15 +69,15 @@ class ChapterList extends Service
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$mapping = [];
|
$mappings = [];
|
||||||
|
|
||||||
foreach ($userLearnings as $learning) {
|
foreach ($userLearnings as $learning) {
|
||||||
$mapping[$learning['chapter_id']] = [
|
$mappings[$learning['chapter_id']] = [
|
||||||
'progress' => $learning['progress'],
|
'progress' => $learning['progress'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $mapping;
|
return $mappings;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ class ConsultList extends Service
|
|||||||
|
|
||||||
foreach ($consults as $consult) {
|
foreach ($consults as $consult) {
|
||||||
|
|
||||||
$user = $users[$consult['user_id']] ?? [];
|
$user = $users[$consult['user_id']] ?? new \stdClass();
|
||||||
|
|
||||||
$me = [
|
$me = [
|
||||||
'agreed' => $votes[$consult['id']]['agreed'] ?? 0,
|
'agreed' => $votes[$consult['id']]['agreed'] ?? 0,
|
||||||
@ -96,7 +96,7 @@ class ConsultList extends Service
|
|||||||
|
|
||||||
protected function getConsultVotes(CourseModel $course, UserModel $user)
|
protected function getConsultVotes(CourseModel $course, UserModel $user)
|
||||||
{
|
{
|
||||||
if ($course->id == 0 || !$user->id == 0) {
|
if ($course->id == 0 || $user->id == 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ class ReviewList extends Service
|
|||||||
|
|
||||||
foreach ($reviews as $review) {
|
foreach ($reviews as $review) {
|
||||||
|
|
||||||
$user = $users[$review['user_id']] ?? [];
|
$user = $users[$review['user_id']] ?? new \stdClass();
|
||||||
|
|
||||||
$me = [
|
$me = [
|
||||||
'agreed' => $votes[$review['id']]['agreed'] ?? 0,
|
'agreed' => $votes[$review['id']]['agreed'] ?? 0,
|
||||||
|
@ -13,7 +13,7 @@ class ConsultList extends Service
|
|||||||
|
|
||||||
use UserTrait;
|
use UserTrait;
|
||||||
|
|
||||||
public function getConsults()
|
public function handle()
|
||||||
{
|
{
|
||||||
$user = $this->getLoginUser();
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
@ -60,6 +60,7 @@ class ConsultList extends Service
|
|||||||
'agree_count' => $consult['agree_count'],
|
'agree_count' => $consult['agree_count'],
|
||||||
'oppose_count' => $consult['oppose_count'],
|
'oppose_count' => $consult['oppose_count'],
|
||||||
'create_time' => $consult['create_time'],
|
'create_time' => $consult['create_time'],
|
||||||
|
'update_time' => $consult['update_time'],
|
||||||
'course' => $course,
|
'course' => $course,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@ class CourseList extends Service
|
|||||||
|
|
||||||
use UserTrait;
|
use UserTrait;
|
||||||
|
|
||||||
public function getCourses($id)
|
public function handle()
|
||||||
{
|
{
|
||||||
$user = $this->checkUser($id);
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
$pagerQuery = new PagerQuery();
|
$pagerQuery = new PagerQuery();
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class CourseList extends Service
|
|||||||
|
|
||||||
foreach ($relations as $relation) {
|
foreach ($relations as $relation) {
|
||||||
|
|
||||||
$course = $courses[$relation['course_id']] ?? [];
|
$course = $courses[$relation['course_id']] ?? new \stdClass();
|
||||||
|
|
||||||
$items = [
|
$items = [
|
||||||
'course' => $course,
|
'course' => $course,
|
||||||
|
@ -13,9 +13,9 @@ class FavoriteList extends Service
|
|||||||
|
|
||||||
use UserTrait;
|
use UserTrait;
|
||||||
|
|
||||||
public function getCourses($id)
|
public function handle()
|
||||||
{
|
{
|
||||||
$user = $this->checkUser($id);
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
$pagerQuery = new PagerQuery();
|
$pagerQuery = new PagerQuery();
|
||||||
|
|
||||||
@ -28,9 +28,9 @@ class FavoriteList extends Service
|
|||||||
$page = $pagerQuery->getPage();
|
$page = $pagerQuery->getPage();
|
||||||
$limit = $pagerQuery->getLimit();
|
$limit = $pagerQuery->getLimit();
|
||||||
|
|
||||||
$courseFavoriteRepo = new CourseFavoriteRepo();
|
$favoriteRepo = new CourseFavoriteRepo();
|
||||||
|
|
||||||
$pager = $courseFavoriteRepo->paginate($params, $sort, $page, $limit);
|
$pager = $favoriteRepo->paginate($params, $sort, $page, $limit);
|
||||||
|
|
||||||
return $this->handleCourses($pager);
|
return $this->handleCourses($pager);
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ class FavoriteList extends Service
|
|||||||
|
|
||||||
foreach ($relations as $relation) {
|
foreach ($relations as $relation) {
|
||||||
|
|
||||||
$course = $courses[$relation['course_id']] ?? [];
|
$course = $courses[$relation['course_id']] ?? new \stdClass();
|
||||||
|
|
||||||
$items[] = $course;
|
$items[] = $course;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ class OrderList extends Service
|
|||||||
|
|
||||||
use UserTrait;
|
use UserTrait;
|
||||||
|
|
||||||
public function getUserOrders()
|
public function handle()
|
||||||
{
|
{
|
||||||
$user = $this->getLoginUser();
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
@ -32,10 +32,10 @@ class OrderList extends Service
|
|||||||
|
|
||||||
$pager = $orderRepo->paginate($params, $sort, $page, $limit);
|
$pager = $orderRepo->paginate($params, $sort, $page, $limit);
|
||||||
|
|
||||||
return $this->handleUserOrders($pager);
|
return $this->handleOrders($pager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleUserOrders($pager)
|
public function handleOrders($pager)
|
||||||
{
|
{
|
||||||
if ($pager->total_items == 0) {
|
if ($pager->total_items == 0) {
|
||||||
return $pager;
|
return $pager;
|
||||||
@ -55,11 +55,11 @@ class OrderList extends Service
|
|||||||
'sn' => $order['sn'],
|
'sn' => $order['sn'],
|
||||||
'subject' => $order['subject'],
|
'subject' => $order['subject'],
|
||||||
'amount' => $order['amount'],
|
'amount' => $order['amount'],
|
||||||
|
'status' => $order['status'],
|
||||||
'item_id' => $order['item_id'],
|
'item_id' => $order['item_id'],
|
||||||
'item_type' => $order['item_type'],
|
'item_type' => $order['item_type'],
|
||||||
'item_info' => $order['item_info'],
|
'item_info' => $order['item_info'],
|
||||||
'source_type' => $order['source_type'],
|
'source_type' => $order['source_type'],
|
||||||
'status' => $order['status'],
|
|
||||||
'create_time' => $order['create_time'],
|
'create_time' => $order['create_time'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ class RefundList extends Service
|
|||||||
|
|
||||||
use UserTrait;
|
use UserTrait;
|
||||||
|
|
||||||
public function getRefunds()
|
public function handle()
|
||||||
{
|
{
|
||||||
$user = $this->getLoginUser();
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
@ -38,7 +38,6 @@ class RefundList extends Service
|
|||||||
protected function handleRefunds($pager)
|
protected function handleRefunds($pager)
|
||||||
{
|
{
|
||||||
if ($pager->total_items == 0) {
|
if ($pager->total_items == 0) {
|
||||||
$pager->items = [];
|
|
||||||
return $pager;
|
return $pager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +51,7 @@ class RefundList extends Service
|
|||||||
|
|
||||||
foreach ($refunds as $refund) {
|
foreach ($refunds as $refund) {
|
||||||
|
|
||||||
$order = $orders[$refund['order_id']] ?? [];
|
$order = $orders[$refund['order_id']] ?? new \stdClass();
|
||||||
|
|
||||||
$items[] = [
|
$items[] = [
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
@ -60,7 +59,7 @@ class RefundList extends Service
|
|||||||
'status' => $refund['status'],
|
'status' => $refund['status'],
|
||||||
'apply_note' => $refund['apply_note'],
|
'apply_note' => $refund['apply_note'],
|
||||||
'review_note' => $refund['review_note'],
|
'review_note' => $refund['review_note'],
|
||||||
'create_time' => (int)$refund['create_time'],
|
'create_time' => $refund['create_time'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
73
app/Services/Frontend/My/ReviewList.php
Normal file
73
app/Services/Frontend/My/ReviewList.php
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Frontend\My;
|
||||||
|
|
||||||
|
use App\Builders\ReviewList as ReviewListBuilder;
|
||||||
|
use App\Library\Paginator\Query as PagerQuery;
|
||||||
|
use App\Repos\Review as ReviewRepo;
|
||||||
|
use App\Services\Frontend\Service;
|
||||||
|
use App\Services\Frontend\UserTrait;
|
||||||
|
|
||||||
|
class ReviewList extends Service
|
||||||
|
{
|
||||||
|
|
||||||
|
use UserTrait;
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
|
$pagerQuery = new PagerQuery();
|
||||||
|
|
||||||
|
$params = $pagerQuery->getParams();
|
||||||
|
|
||||||
|
$params['user_id'] = $user->id;
|
||||||
|
$params['deleted'] = 0;
|
||||||
|
|
||||||
|
$sort = $pagerQuery->getSort();
|
||||||
|
$page = $pagerQuery->getPage();
|
||||||
|
$limit = $pagerQuery->getLimit();
|
||||||
|
|
||||||
|
$reviewRepo = new ReviewRepo();
|
||||||
|
|
||||||
|
$pager = $reviewRepo->paginate($params, $sort, $page, $limit);
|
||||||
|
|
||||||
|
return $this->handleReviews($pager);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function handleReviews($pager)
|
||||||
|
{
|
||||||
|
if ($pager->total_items == 0) {
|
||||||
|
return $pager;
|
||||||
|
}
|
||||||
|
|
||||||
|
$builder = new ReviewListBuilder();
|
||||||
|
|
||||||
|
$reviews = $pager->items->toArray();
|
||||||
|
|
||||||
|
$courses = $builder->getCourses($reviews);
|
||||||
|
|
||||||
|
$items = [];
|
||||||
|
|
||||||
|
foreach ($reviews as $review) {
|
||||||
|
|
||||||
|
$course = $courses[$review['course_id']] ?? [];
|
||||||
|
|
||||||
|
$items[] = [
|
||||||
|
'id' => $review['id'],
|
||||||
|
'question' => $review['question'],
|
||||||
|
'answer' => $review['answer'],
|
||||||
|
'agree_count' => $review['agree_count'],
|
||||||
|
'oppose_count' => $review['oppose_count'],
|
||||||
|
'create_time' => $review['create_time'],
|
||||||
|
'update_time' => $review['update_time'],
|
||||||
|
'course' => $course,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$pager->items = $items;
|
||||||
|
|
||||||
|
return $pager;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -8,7 +8,7 @@ use App\Services\Frontend\Service;
|
|||||||
class UserInfo extends Service
|
class UserInfo extends Service
|
||||||
{
|
{
|
||||||
|
|
||||||
public function getUser()
|
public function handle()
|
||||||
{
|
{
|
||||||
$user = $this->getLoginUser();
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
|
@ -11,54 +11,55 @@ use App\Repos\Package as PackageRepo;
|
|||||||
use App\Services\Frontend\Service;
|
use App\Services\Frontend\Service;
|
||||||
use App\Validators\Order as OrderValidator;
|
use App\Validators\Order as OrderValidator;
|
||||||
|
|
||||||
class OrderConfirmInfo extends Service
|
class ConfirmInfo extends Service
|
||||||
{
|
{
|
||||||
|
|
||||||
public function getConfirmInfo()
|
public function handle()
|
||||||
{
|
{
|
||||||
$query = $this->request->getQuery();
|
$itemId = $this->request->getQuery('item_id');
|
||||||
|
$itemType = $this->request->getQuery('item_type');
|
||||||
|
|
||||||
$user = $this->getLoginUser();
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
$validator = new OrderValidator();
|
$validator = new OrderValidator();
|
||||||
|
|
||||||
$validator->checkItemType($query['item_type']);
|
$validator->checkItemType($itemType);
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
$result['item_id'] = $query['item_id'];
|
$result['item_id'] = $itemId;
|
||||||
$result['item_type'] = $query['item_type'];
|
$result['item_type'] = $itemType;
|
||||||
|
|
||||||
if ($query['item_type'] == OrderModel::ITEM_COURSE) {
|
if ($itemType == OrderModel::ITEM_COURSE) {
|
||||||
|
|
||||||
$course = $validator->checkCourseItem($query['item_id']);
|
$course = $validator->checkCourse($itemId);
|
||||||
$courseInfo = $this->handleCourseInfo($course);
|
$courseInfo = $this->handleCourseInfo($course);
|
||||||
|
|
||||||
$result['item_info']['course'] = $courseInfo;
|
$result['item_info']['course'] = $courseInfo;
|
||||||
$result['amount'] = $user->vip ? $course->vip_price : $course->market_price;
|
$result['amount'] = $user->vip ? $course->vip_price : $course->market_price;
|
||||||
|
|
||||||
} elseif ($query['item_type'] == OrderModel::ITEM_PACKAGE) {
|
} elseif ($itemType == OrderModel::ITEM_PACKAGE) {
|
||||||
|
|
||||||
$package = $validator->checkPackageItem($query['item_id']);
|
$package = $validator->checkPackage($itemId);
|
||||||
$packageInfo = $this->handlePackageInfo($package);
|
$packageInfo = $this->handlePackageInfo($package);
|
||||||
|
|
||||||
$result['item_info']['package'] = $packageInfo;
|
$result['item_info']['package'] = $packageInfo;
|
||||||
$result['amount'] = $user->vip ? $package->vip_price : $package->market_price;
|
$result['amount'] = $user->vip ? $package->vip_price : $package->market_price;
|
||||||
|
|
||||||
} elseif ($query['item_type'] == OrderModel::ITEM_VIP) {
|
} elseif ($itemType == OrderModel::ITEM_VIP) {
|
||||||
|
|
||||||
$vip = $validator->checkVipItem($query['item_id']);
|
$vip = $validator->checkVip($itemId);
|
||||||
$vipInfo = $this->handleVipInfo($vip);
|
$vipInfo = $this->handleVipInfo($vip);
|
||||||
|
|
||||||
$result['item_info']['vip'] = $vipInfo;
|
$result['item_info']['vip'] = $vipInfo;
|
||||||
$result['amount'] = $vip->price;
|
$result['amount'] = $vip->price;
|
||||||
|
|
||||||
} elseif ($query['item_type'] == OrderModel::ITEM_REWARD) {
|
} elseif ($itemType == OrderModel::ITEM_REWARD) {
|
||||||
|
|
||||||
list($courseId, $rewardId) = explode('-', $query['item_id']);
|
list($courseId, $rewardId) = explode('-', $itemId);
|
||||||
|
|
||||||
$course = $validator->checkCourseItem($courseId);
|
$course = $validator->checkCourse($courseId);
|
||||||
$reward = $validator->checkRewardItem($rewardId);
|
$reward = $validator->checkReward($rewardId);
|
||||||
|
|
||||||
$courseInfo = $this->handleCourseInfo($course);
|
$courseInfo = $this->handleCourseInfo($course);
|
||||||
$rewardInfo = $this->handleRewardInfo($reward);
|
$rewardInfo = $this->handleRewardInfo($reward);
|
||||||
@ -83,7 +84,6 @@ class OrderConfirmInfo extends Service
|
|||||||
$result = [
|
$result = [
|
||||||
'id' => $package->id,
|
'id' => $package->id,
|
||||||
'title' => $package->title,
|
'title' => $package->title,
|
||||||
'summary' => $package->summary,
|
|
||||||
'market_price' => $package->market_price,
|
'market_price' => $package->market_price,
|
||||||
'vip_price' => $package->vip_price,
|
'vip_price' => $package->vip_price,
|
||||||
];
|
];
|
||||||
@ -126,7 +126,6 @@ class OrderConfirmInfo extends Service
|
|||||||
'id' => $course->id,
|
'id' => $course->id,
|
||||||
'title' => $course->title,
|
'title' => $course->title,
|
||||||
'cover' => $course->cover,
|
'cover' => $course->cover,
|
||||||
'summary' => $course->summary,
|
|
||||||
'model' => $course->model,
|
'model' => $course->model,
|
||||||
'level' => $course->level,
|
'level' => $course->level,
|
||||||
'study_expiry' => $course->study_expiry,
|
'study_expiry' => $course->study_expiry,
|
@ -12,9 +12,9 @@ class OrderCancel extends Service
|
|||||||
|
|
||||||
use OrderTrait;
|
use OrderTrait;
|
||||||
|
|
||||||
public function cancelOrder($sn)
|
public function handle($sn)
|
||||||
{
|
{
|
||||||
$order = $this->checkOrder($sn);
|
$order = $this->checkOrderBySn($sn);
|
||||||
|
|
||||||
$user = $this->getLoginUser();
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
|
@ -17,10 +17,7 @@ use App\Validators\UserDailyLimit as UserDailyLimitValidator;
|
|||||||
class OrderCreate extends Service
|
class OrderCreate extends Service
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
public function handle()
|
||||||
* @return OrderModel
|
|
||||||
*/
|
|
||||||
public function createOrder()
|
|
||||||
{
|
{
|
||||||
$post = $this->request->getPost();
|
$post = $this->request->getPost();
|
||||||
|
|
||||||
@ -51,7 +48,7 @@ class OrderCreate extends Service
|
|||||||
|
|
||||||
if ($post['item_type'] == OrderModel::ITEM_COURSE) {
|
if ($post['item_type'] == OrderModel::ITEM_COURSE) {
|
||||||
|
|
||||||
$course = $validator->checkCourseItem($post['item_id']);
|
$course = $validator->checkCourse($post['item_id']);
|
||||||
|
|
||||||
$validator->checkIfBoughtCourse($user->id, $course->id);
|
$validator->checkIfBoughtCourse($user->id, $course->id);
|
||||||
|
|
||||||
@ -59,7 +56,7 @@ class OrderCreate extends Service
|
|||||||
|
|
||||||
} elseif ($post['item_type'] == OrderModel::ITEM_PACKAGE) {
|
} elseif ($post['item_type'] == OrderModel::ITEM_PACKAGE) {
|
||||||
|
|
||||||
$package = $validator->checkPackageItem($post['item_id']);
|
$package = $validator->checkPackage($post['item_id']);
|
||||||
|
|
||||||
$validator->checkIfBoughtPackage($user->id, $package->id);
|
$validator->checkIfBoughtPackage($user->id, $package->id);
|
||||||
|
|
||||||
@ -67,7 +64,7 @@ class OrderCreate extends Service
|
|||||||
|
|
||||||
} elseif ($post['item_type'] == OrderModel::ITEM_VIP) {
|
} elseif ($post['item_type'] == OrderModel::ITEM_VIP) {
|
||||||
|
|
||||||
$vip = $validator->checkVipItem($post['item_id']);
|
$vip = $validator->checkVip($post['item_id']);
|
||||||
|
|
||||||
$order = $this->createVipOrder($vip, $user);
|
$order = $this->createVipOrder($vip, $user);
|
||||||
|
|
||||||
@ -75,8 +72,8 @@ class OrderCreate extends Service
|
|||||||
|
|
||||||
list($courseId, $rewardId) = explode('-', $post['item_id']);
|
list($courseId, $rewardId) = explode('-', $post['item_id']);
|
||||||
|
|
||||||
$course = $validator->checkCourseItem($courseId);
|
$course = $validator->checkCourse($courseId);
|
||||||
$reward = $validator->checkRewardItem($rewardId);
|
$reward = $validator->checkReward($rewardId);
|
||||||
|
|
||||||
$order = $this->createRewardOrder($course, $reward, $user);
|
$order = $this->createRewardOrder($course, $reward, $user);
|
||||||
}
|
}
|
||||||
|
@ -9,27 +9,22 @@ use App\Validators\Order as OrderValidator;
|
|||||||
class OrderInfo extends Service
|
class OrderInfo extends Service
|
||||||
{
|
{
|
||||||
|
|
||||||
public function getOrderInfo()
|
public function handle($sn)
|
||||||
{
|
{
|
||||||
$sn = $this->request->getQuery('sn');
|
|
||||||
|
|
||||||
$validator = new OrderValidator();
|
$validator = new OrderValidator();
|
||||||
|
|
||||||
$order = $validator->checkOrderBySn($sn);
|
$order = $validator->checkOrderBySn($sn);
|
||||||
|
|
||||||
return $this->handleOrderInfo($order);
|
return $this->handleOrder($order);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function handleOrder(OrderModel $order)
|
||||||
* @param OrderModel $order
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function handleOrderInfo($order)
|
|
||||||
{
|
{
|
||||||
$order->item_info = $this->handleItemInfo($order);
|
$order->item_info = $this->handleItemInfo($order);
|
||||||
|
|
||||||
$result = [
|
return [
|
||||||
'sn' => $order->id,
|
'id' => $order->id,
|
||||||
|
'sn' => $order->sn,
|
||||||
'subject' => $order->subject,
|
'subject' => $order->subject,
|
||||||
'amount' => $order->amount,
|
'amount' => $order->amount,
|
||||||
'status' => $order->status,
|
'status' => $order->status,
|
||||||
@ -39,15 +34,9 @@ class OrderInfo extends Service
|
|||||||
'item_info' => $order->item_info,
|
'item_info' => $order->item_info,
|
||||||
'create_time' => $order->create_time,
|
'create_time' => $order->create_time,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function handleItemInfo(OrderModel $order)
|
||||||
* @param OrderModel $order
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function handleItemInfo($order)
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var array $itemInfo
|
* @var array $itemInfo
|
||||||
@ -70,22 +59,14 @@ class OrderInfo extends Service
|
|||||||
return $itemInfo;
|
return $itemInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function handleCourseInfo(array $itemInfo)
|
||||||
* @param array $itemInfo
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function handleCourseInfo($itemInfo)
|
|
||||||
{
|
{
|
||||||
$itemInfo['course']['cover'] = kg_ci_img_url($itemInfo['course']['cover']);
|
$itemInfo['course']['cover'] = kg_ci_img_url($itemInfo['course']['cover']);
|
||||||
|
|
||||||
return $itemInfo;
|
return $itemInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function handlePackageInfo(array $itemInfo)
|
||||||
* @param array $itemInfo
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function handlePackageInfo($itemInfo)
|
|
||||||
{
|
{
|
||||||
$baseUrl = kg_ci_base_url();
|
$baseUrl = kg_ci_base_url();
|
||||||
|
|
||||||
@ -96,11 +77,7 @@ class OrderInfo extends Service
|
|||||||
return $itemInfo;
|
return $itemInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function handleVipInfo(array $itemInfo)
|
||||||
* @param array $itemInfo
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function handleVipInfo($itemInfo)
|
|
||||||
{
|
{
|
||||||
return $itemInfo;
|
return $itemInfo;
|
||||||
}
|
}
|
||||||
|
@ -9,20 +9,16 @@ use App\Services\Pay\Alipay as AlipayService;
|
|||||||
use App\Services\Pay\Wxpay as WxPayService;
|
use App\Services\Pay\Wxpay as WxPayService;
|
||||||
use App\Validators\Trade as TradeValidator;
|
use App\Validators\Trade as TradeValidator;
|
||||||
|
|
||||||
class OrderTrade extends Service
|
class TradeCreate extends Service
|
||||||
{
|
{
|
||||||
|
|
||||||
use OrderTrait;
|
use OrderTrait;
|
||||||
|
|
||||||
/**
|
public function handle()
|
||||||
* @param string $sn
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function createTrade($sn)
|
|
||||||
{
|
{
|
||||||
$post = $this->request->getPost();
|
$post = $this->request->getPost();
|
||||||
|
|
||||||
$order = $this->checkOrder($sn);
|
$order = $this->checkOrderBySn($post['order_sn']);
|
||||||
|
|
||||||
$user = $this->getLoginUser();
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
@ -58,10 +54,6 @@ class OrderTrade extends Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TradeModel $trade
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
protected function getQrCode(TradeModel $trade)
|
protected function getQrCode(TradeModel $trade)
|
||||||
{
|
{
|
||||||
$qrCode = null;
|
$qrCode = null;
|
@ -7,7 +7,7 @@ use App\Validators\Order as OrderValidator;
|
|||||||
trait OrderTrait
|
trait OrderTrait
|
||||||
{
|
{
|
||||||
|
|
||||||
public function checkOrder($sn)
|
public function checkOrderBySn($sn)
|
||||||
{
|
{
|
||||||
$validator = new OrderValidator();
|
$validator = new OrderValidator();
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Services\Frontend\Package;
|
namespace App\Services\Frontend\Package;
|
||||||
|
|
||||||
|
use App\Caches\PackageCourseList as PackageCourseListCache;
|
||||||
use App\Services\Frontend\PackageTrait;
|
use App\Services\Frontend\PackageTrait;
|
||||||
use App\Services\Frontend\Service;
|
use App\Services\Frontend\Service;
|
||||||
|
|
||||||
@ -10,9 +11,15 @@ class CourseList extends Service
|
|||||||
|
|
||||||
use PackageTrait;
|
use PackageTrait;
|
||||||
|
|
||||||
public function handle()
|
public function handle($id)
|
||||||
{
|
{
|
||||||
|
$package = $this->checkPackageCache($id);
|
||||||
|
|
||||||
|
$cache = new PackageCourseListCache();
|
||||||
|
|
||||||
|
$courses = $cache->get($package->id);
|
||||||
|
|
||||||
|
return $courses ?: [];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,8 @@ class ReviewCreate extends Service
|
|||||||
$this->incrCourseReviewCount($course);
|
$this->incrCourseReviewCount($course);
|
||||||
|
|
||||||
$this->incrUserDailyReviewCount($user);
|
$this->incrUserDailyReviewCount($user);
|
||||||
|
|
||||||
|
return $review;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function incrCourseReviewCount(CourseModel $course)
|
protected function incrCourseReviewCount(CourseModel $course)
|
||||||
|
38
app/Services/Frontend/Review/ReviewDelete.php
Normal file
38
app/Services/Frontend/Review/ReviewDelete.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Frontend\Review;
|
||||||
|
|
||||||
|
use App\Models\Course as CourseModel;
|
||||||
|
use App\Services\Frontend\CourseTrait;
|
||||||
|
use App\Services\Frontend\ReviewTrait;
|
||||||
|
use App\Services\Frontend\Service;
|
||||||
|
use App\Validators\Review as ReviewValidator;
|
||||||
|
|
||||||
|
class ReviewDelete extends Service
|
||||||
|
{
|
||||||
|
|
||||||
|
use CourseTrait, ReviewTrait;
|
||||||
|
|
||||||
|
public function handle($id)
|
||||||
|
{
|
||||||
|
$review = $this->checkReview($id);
|
||||||
|
|
||||||
|
$course = $this->checkCourseCache($review->course_id);
|
||||||
|
|
||||||
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
|
$validator = new ReviewValidator();
|
||||||
|
|
||||||
|
$validator->checkOwner($user->id, $review->user_id);
|
||||||
|
|
||||||
|
$review->delete();
|
||||||
|
|
||||||
|
$this->decrCourseReviewCount($course);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function decrCourseReviewCount(CourseModel $course)
|
||||||
|
{
|
||||||
|
$this->eventsManager->fire('courseCounter:decrReviewCount', $this, $course);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
72
app/Services/Frontend/Review/ReviewInfo.php
Normal file
72
app/Services/Frontend/Review/ReviewInfo.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Frontend\Review;
|
||||||
|
|
||||||
|
use App\Models\Review as ReviewModel;
|
||||||
|
use App\Models\ReviewVote as ReviewVoteModel;
|
||||||
|
use App\Models\User as UserModel;
|
||||||
|
use App\Repos\ReviewVote as ReviewVoteRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
use App\Services\Frontend\ReviewTrait;
|
||||||
|
use App\Services\Frontend\Service;
|
||||||
|
|
||||||
|
class ReviewInfo extends Service
|
||||||
|
{
|
||||||
|
|
||||||
|
use ReviewTrait;
|
||||||
|
|
||||||
|
public function handle($id)
|
||||||
|
{
|
||||||
|
$review = $this->checkReview($id);
|
||||||
|
|
||||||
|
$user = $this->getCurrentUser();
|
||||||
|
|
||||||
|
return $this->handleReview($review, $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function handleReview(ReviewModel $review, UserModel $user)
|
||||||
|
{
|
||||||
|
$result = [
|
||||||
|
'id' => $review->id,
|
||||||
|
'content' => $review->content,
|
||||||
|
'reply' => $review->reply,
|
||||||
|
'rating' => $review->rating,
|
||||||
|
'agree_count' => $review->agree_count,
|
||||||
|
'oppose_count' => $review->oppose_count,
|
||||||
|
'create_time' => $review->create_time,
|
||||||
|
'update_time' => $review->update_time,
|
||||||
|
];
|
||||||
|
|
||||||
|
$me = [
|
||||||
|
'agreed' => 0,
|
||||||
|
'opposed' => 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($user->id > 0) {
|
||||||
|
|
||||||
|
$voteRepo = new ReviewVoteRepo();
|
||||||
|
|
||||||
|
$vote = $voteRepo->findReviewVote($review->id, $user->id);
|
||||||
|
|
||||||
|
if ($vote) {
|
||||||
|
$me['agreed'] = $vote->type == ReviewVoteModel::TYPE_AGREE ? 1 : 0;
|
||||||
|
$me['opposed'] = $vote->type == ReviewVoteModel::TYPE_OPPOSE ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$owner = $userRepo->findById($review->user_id);
|
||||||
|
|
||||||
|
$result['owner'] = [
|
||||||
|
'id' => $owner->id,
|
||||||
|
'name' => $owner->name,
|
||||||
|
'avatar' => $owner->avatar,
|
||||||
|
];
|
||||||
|
|
||||||
|
$result['me'] = $me;
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
35
app/Services/Frontend/Review/ReviewUpdate.php
Normal file
35
app/Services/Frontend/Review/ReviewUpdate.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Frontend\Review;
|
||||||
|
|
||||||
|
use App\Services\Frontend\CourseTrait;
|
||||||
|
use App\Services\Frontend\ReviewTrait;
|
||||||
|
use App\Services\Frontend\Service;
|
||||||
|
use App\Validators\Review as ReviewValidator;
|
||||||
|
|
||||||
|
class ReviewUpdate extends Service
|
||||||
|
{
|
||||||
|
|
||||||
|
use CourseTrait, ReviewTrait;
|
||||||
|
|
||||||
|
public function handle($id)
|
||||||
|
{
|
||||||
|
$post = $this->request->getPost();
|
||||||
|
|
||||||
|
$review = $this->checkReview($id);
|
||||||
|
|
||||||
|
$user = $this->getLoginUser();
|
||||||
|
|
||||||
|
$validator = new ReviewValidator();
|
||||||
|
|
||||||
|
$validator->checkOwner($user->id, $review->user_id);
|
||||||
|
|
||||||
|
$content = $validator->checkContent($post['content']);
|
||||||
|
$rating = $validator->checkRating($post['rating']);
|
||||||
|
|
||||||
|
$review->content = $content;
|
||||||
|
$review->rating = $rating;
|
||||||
|
$review->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -53,7 +53,7 @@ class CourseList extends Service
|
|||||||
|
|
||||||
foreach ($relations as $relation) {
|
foreach ($relations as $relation) {
|
||||||
|
|
||||||
$course = $courses[$relation['course_id']] ?? [];
|
$course = $courses[$relation['course_id']] ?? new \stdClass();
|
||||||
|
|
||||||
$items = [
|
$items = [
|
||||||
'course' => $course,
|
'course' => $course,
|
||||||
|
@ -20,8 +20,6 @@ class UserInfo extends Service
|
|||||||
|
|
||||||
protected function handleUser(UserModel $user)
|
protected function handleUser(UserModel $user)
|
||||||
{
|
{
|
||||||
$user->avatar = kg_ci_img_url($user->avatar);
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $user->id,
|
'id' => $user->id,
|
||||||
'name' => $user->name,
|
'name' => $user->name,
|
||||||
|
@ -109,12 +109,12 @@ class Category extends Validator
|
|||||||
{
|
{
|
||||||
$categoryRepo = new CategoryRepo();
|
$categoryRepo = new CategoryRepo();
|
||||||
|
|
||||||
$list = $categoryRepo->findAll([
|
$categories = $categoryRepo->findAll([
|
||||||
'parent_id' => $category->id,
|
'parent_id' => $category->id,
|
||||||
'deleted' => 0,
|
'deleted' => 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($list->count() > 0) {
|
if ($categories->count() > 0) {
|
||||||
throw new BadRequestException('category.has_child_node');
|
throw new BadRequestException('category.has_child_node');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,12 +169,12 @@ class Chapter extends Validator
|
|||||||
{
|
{
|
||||||
$chapterRepo = new ChapterRepo();
|
$chapterRepo = new ChapterRepo();
|
||||||
|
|
||||||
$list = $chapterRepo->findAll([
|
$chapters = $chapterRepo->findAll([
|
||||||
'parent_id' => $chapter->id,
|
'parent_id' => $chapter->id,
|
||||||
'deleted' => 0,
|
'deleted' => 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($list->count() > 0) {
|
if ($chapters->count() > 0) {
|
||||||
throw new BadRequestException('chapter.has_child_node');
|
throw new BadRequestException('chapter.has_child_node');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,17 +108,40 @@ class Course extends Validator
|
|||||||
|
|
||||||
public function checkDetails($details)
|
public function checkDetails($details)
|
||||||
{
|
{
|
||||||
return $this->filter->sanitize($details, ['trim']);
|
$value = $this->filter->sanitize($details, ['trim']);
|
||||||
|
|
||||||
|
$length = kg_strlen($value);
|
||||||
|
|
||||||
|
if ($length > 3000) {
|
||||||
|
throw new BadRequestException('course.details_too_long');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkSummary($summary)
|
public function checkSummary($summary)
|
||||||
{
|
{
|
||||||
return $this->filter->sanitize($summary, ['trim', 'string']);
|
$value = $this->filter->sanitize($summary, ['trim', 'string']);
|
||||||
|
|
||||||
|
$length = kg_strlen($value);
|
||||||
|
|
||||||
|
if ($length > 500) {
|
||||||
|
throw new BadRequestException('course.summary_too_long');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkKeywords($keywords)
|
public function checkKeywords($keywords)
|
||||||
{
|
{
|
||||||
$keywords = $this->filter->sanitize($keywords, ['trim', 'string']);
|
$keywords = $this->filter->sanitize($keywords, ['trim', 'string']);
|
||||||
|
|
||||||
|
$length = kg_strlen($keywords);
|
||||||
|
|
||||||
|
if ($length > 100) {
|
||||||
|
throw new BadRequestException('course.keywords_too_long');
|
||||||
|
}
|
||||||
|
|
||||||
$keywords = str_replace(['|', ';', ';', '、', ','], '@', $keywords);
|
$keywords = str_replace(['|', ';', ';', '、', ','], '@', $keywords);
|
||||||
$keywords = explode('@', $keywords);
|
$keywords = explode('@', $keywords);
|
||||||
|
|
||||||
@ -156,6 +179,13 @@ class Course extends Validator
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function checkComparePrice($marketPrice, $vipPrice)
|
||||||
|
{
|
||||||
|
if ($vipPrice > $marketPrice) {
|
||||||
|
throw new BadRequestException('course.invalid_compare_price');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function checkStudyExpiry($expiry)
|
public function checkStudyExpiry($expiry)
|
||||||
{
|
{
|
||||||
$options = CourseModel::studyExpiryOptions();
|
$options = CourseModel::studyExpiryOptions();
|
||||||
@ -207,7 +237,7 @@ class Course extends Validator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($publishedCount < $totalCount / 3) {
|
if ($publishedCount / $totalCount < 0.3) {
|
||||||
throw new BadRequestException('course.pub_chapter_not_enough');
|
throw new BadRequestException('course.pub_chapter_not_enough');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,12 +114,12 @@ class Nav extends Validator
|
|||||||
{
|
{
|
||||||
$navRepo = new NavRepo();
|
$navRepo = new NavRepo();
|
||||||
|
|
||||||
$list = $navRepo->findAll([
|
$navs = $navRepo->findAll([
|
||||||
'parent_id' => $nav->id,
|
'parent_id' => $nav->id,
|
||||||
'deleted' => 0,
|
'deleted' => 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($list->count() > 0) {
|
if ($navs->count() > 0) {
|
||||||
throw new BadRequestException('nav.has_child_node');
|
throw new BadRequestException('nav.has_child_node');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ class Order extends Validator
|
|||||||
return $itemType;
|
return $itemType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkCourseItem($itemId)
|
public function checkCourse($itemId)
|
||||||
{
|
{
|
||||||
$courseRepo = new CourseRepo();
|
$courseRepo = new CourseRepo();
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ class Order extends Validator
|
|||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkPackageItem($itemId)
|
public function checkPackage($itemId)
|
||||||
{
|
{
|
||||||
$packageRepo = new PackageRepo();
|
$packageRepo = new PackageRepo();
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ class Order extends Validator
|
|||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkVipItem($itemId)
|
public function checkVip($itemId)
|
||||||
{
|
{
|
||||||
$vipRepo = new VipRepo();
|
$vipRepo = new VipRepo();
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ class Order extends Validator
|
|||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkRewardItem($itemId)
|
public function checkReward($itemId)
|
||||||
{
|
{
|
||||||
$rewardRepo = new RewardRepo();
|
$rewardRepo = new RewardRepo();
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class Slide extends Validator
|
|||||||
throw new BadRequestException('slide.title_too_short');
|
throw new BadRequestException('slide.title_too_short');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($length > 30) {
|
if ($length > 50) {
|
||||||
throw new BadRequestException('slide.title_too_long');
|
throw new BadRequestException('slide.title_too_long');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,12 +72,12 @@ $error['category.invalid_priority'] = '无效的排序值(范围:1-255)';
|
|||||||
$error['category.invalid_publish_status'] = '无效的发布状态';
|
$error['category.invalid_publish_status'] = '无效的发布状态';
|
||||||
$error['category.name_too_short'] = '名称太短(少于2个字符)';
|
$error['category.name_too_short'] = '名称太短(少于2个字符)';
|
||||||
$error['category.name_too_long'] = '名称太长(多于30个字符)';
|
$error['category.name_too_long'] = '名称太长(多于30个字符)';
|
||||||
$error['category.has_child_node'] = '存在子节点,不允许相关操作';
|
$error['category.has_child_node'] = '不允许相关操作(存在子节点)';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导航相关
|
* 导航相关
|
||||||
*/
|
*/
|
||||||
$error['nav.not_found'] = '分类不存在';
|
$error['nav.not_found'] = '导航不存在';
|
||||||
$error['nav.parent_not_found'] = '父级分类不存在';
|
$error['nav.parent_not_found'] = '父级分类不存在';
|
||||||
$error['nav.invalid_url'] = '无效的访问地址';
|
$error['nav.invalid_url'] = '无效的访问地址';
|
||||||
$error['nav.invalid_position'] = '无效的位置类型';
|
$error['nav.invalid_position'] = '无效的位置类型';
|
||||||
@ -86,31 +86,35 @@ $error['nav.invalid_priority'] = '无效的排序值(范围:1-255)';
|
|||||||
$error['nav.invalid_publish_status'] = '无效的发布状态';
|
$error['nav.invalid_publish_status'] = '无效的发布状态';
|
||||||
$error['nav.name_too_short'] = '名称太短(少于2个字符)';
|
$error['nav.name_too_short'] = '名称太短(少于2个字符)';
|
||||||
$error['nav.name_too_long'] = '名称太长(多于30个字符)';
|
$error['nav.name_too_long'] = '名称太长(多于30个字符)';
|
||||||
$error['nav.has_child_node'] = '存在子节点,不允许相关操作';
|
$error['nav.has_child_node'] = '不允许相关操作(存在子节点)';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程相关
|
* 课程相关
|
||||||
*/
|
*/
|
||||||
$error['course.not_found'] = '课程不存在';
|
$error['course.not_found'] = '课程不存在';
|
||||||
$error['course.title_too_short'] = '标题太短(少于5个字符)';
|
$error['course.title_too_short'] = '标题太短(少于5个字符)';
|
||||||
$error['course.title_too_long'] = '标题太长(多于30个字符)';
|
$error['course.title_too_long'] = '标题太长(多于50个字符)';
|
||||||
|
$error['course.summary_too_long'] = '标题太长(多于255个字符)';
|
||||||
|
$error['course.keywords_too_long'] = '关键字太长(多于100个字符)';
|
||||||
|
$error['course.details_too_long'] = '详情太长(多于3000个字符)';
|
||||||
$error['course.invalid_model'] = '无效的模型类别';
|
$error['course.invalid_model'] = '无效的模型类别';
|
||||||
$error['course.invalid_level'] = '无效的难度级别';
|
$error['course.invalid_level'] = '无效的难度级别';
|
||||||
$error['course.invalid_cover'] = '无效的封面';
|
$error['course.invalid_cover'] = '无效的封面';
|
||||||
$error['course.invalid_market_price'] = '无效的市场价格';
|
$error['course.invalid_market_price'] = '无效的市场价格(范围:0-10000)';
|
||||||
$error['course.invalid_vip_price'] = '无效的会员价格';
|
$error['course.invalid_vip_price'] = '无效的会员价格(范围:0-10000)';
|
||||||
|
$error['course.invalid_compare_price'] = '无效的比较定价(会员价格高于市场价格)';
|
||||||
$error['course.invalid_study_expiry'] = '无效的学习期限';
|
$error['course.invalid_study_expiry'] = '无效的学习期限';
|
||||||
$error['course.invalid_refund_expiry'] = '无效的退款期限';
|
$error['course.invalid_refund_expiry'] = '无效的退款期限';
|
||||||
$error['course.invalid_publish_status'] = '无效的发布状态';
|
$error['course.invalid_publish_status'] = '无效的发布状态';
|
||||||
$error['course.pub_chapter_not_found'] = '尚未发现已发布的课时';
|
$error['course.pub_chapter_not_found'] = '尚未发现已发布的课时';
|
||||||
$error['course.pub_chapter_not_enough'] = '已发布的课时太少(未过三分之一)';
|
$error['course.pub_chapter_not_enough'] = '已发布的课时太少(小于30%)';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 话题相关
|
* 话题相关
|
||||||
*/
|
*/
|
||||||
$error['topic.not_found'] = '话题不存在';
|
$error['topic.not_found'] = '话题不存在';
|
||||||
$error['topic.title_too_short'] = '标题太短(少于2个字符)';
|
$error['topic.title_too_short'] = '标题太短(少于2个字符)';
|
||||||
$error['topic.title_too_long'] = '标题太长(多于30个字符)';
|
$error['topic.title_too_long'] = '标题太长(多于50个字符)';
|
||||||
$error['topic.summary_too_long'] = '简介太长(多于255个字符)';
|
$error['topic.summary_too_long'] = '简介太长(多于255个字符)';
|
||||||
$error['topic.invalid_publish_status'] = '无效的发布状态';
|
$error['topic.invalid_publish_status'] = '无效的发布状态';
|
||||||
|
|
||||||
@ -119,7 +123,7 @@ $error['topic.invalid_publish_status'] = '无效的发布状态';
|
|||||||
*/
|
*/
|
||||||
$error['package.not_found'] = '套餐不存在';
|
$error['package.not_found'] = '套餐不存在';
|
||||||
$error['package.title_too_short'] = '标题太短(少于5个字符)';
|
$error['package.title_too_short'] = '标题太短(少于5个字符)';
|
||||||
$error['package.title_too_long'] = '标题太长(多于30个字符)';
|
$error['package.title_too_long'] = '标题太长(多于50个字符)';
|
||||||
$error['package.summary_too_long'] = '简介太长(多于255个字符)';
|
$error['package.summary_too_long'] = '简介太长(多于255个字符)';
|
||||||
$error['package.invalid_market_price'] = '无效的市场价格';
|
$error['package.invalid_market_price'] = '无效的市场价格';
|
||||||
$error['package.invalid_vip_price'] = '无效的会员价格';
|
$error['package.invalid_vip_price'] = '无效的会员价格';
|
||||||
@ -151,7 +155,7 @@ $error['chapter.vod_not_ready'] = '点播资源尚未就绪';
|
|||||||
$error['chapter.live_not_start'] = '直播尚未开始';
|
$error['chapter.live_not_start'] = '直播尚未开始';
|
||||||
$error['chapter.live_time_empty'] = '直播时间尚未设置';
|
$error['chapter.live_time_empty'] = '直播时间尚未设置';
|
||||||
$error['chapter.read_not_ready'] = '文章内容尚未就绪';
|
$error['chapter.read_not_ready'] = '文章内容尚未就绪';
|
||||||
$error['chapter.has_child_node'] = '存在子节点,不允许相关操作';
|
$error['chapter.has_child_node'] = '不允许相关操作(存在子节点)';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点播相关
|
* 点播相关
|
||||||
@ -213,7 +217,7 @@ $error['comment.content_too_long'] = '评价太长(多于1000个字符)';
|
|||||||
*/
|
*/
|
||||||
$error['page.not_found'] = '单页不存在';
|
$error['page.not_found'] = '单页不存在';
|
||||||
$error['page.title_too_short'] = '标题太短(少于2个字符)';
|
$error['page.title_too_short'] = '标题太短(少于2个字符)';
|
||||||
$error['page.title_too_long'] = '标题太长(多于30个字符)';
|
$error['page.title_too_long'] = '标题太长(多于50个字符)';
|
||||||
$error['page.content_too_short'] = '内容太短(少于10个字符)';
|
$error['page.content_too_short'] = '内容太短(少于10个字符)';
|
||||||
$error['page.content_too_long'] = '内容太长(多于3000个字符)';
|
$error['page.content_too_long'] = '内容太长(多于3000个字符)';
|
||||||
$error['page.invalid_publish_status'] = '无效的发布状态';
|
$error['page.invalid_publish_status'] = '无效的发布状态';
|
||||||
@ -223,7 +227,7 @@ $error['page.invalid_publish_status'] = '无效的发布状态';
|
|||||||
*/
|
*/
|
||||||
$error['help.not_found'] = '帮助不存在';
|
$error['help.not_found'] = '帮助不存在';
|
||||||
$error['help.title_too_short'] = '标题太短(少于2个字符)';
|
$error['help.title_too_short'] = '标题太短(少于2个字符)';
|
||||||
$error['help.title_too_long'] = '标题太长(多于30个字符)';
|
$error['help.title_too_long'] = '标题太长(多于50个字符)';
|
||||||
$error['help.content_too_short'] = '内容太短(少于10个字符)';
|
$error['help.content_too_short'] = '内容太短(少于10个字符)';
|
||||||
$error['help.content_too_long'] = '内容太长(多于3000个字符)';
|
$error['help.content_too_long'] = '内容太长(多于3000个字符)';
|
||||||
$error['help.invalid_priority'] = '无效的排序数值(范围:1-255)';
|
$error['help.invalid_priority'] = '无效的排序数值(范围:1-255)';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user