diff --git a/app/Builders/CourseUserList.php b/app/Builders/CourseUserList.php index 66dcb9d1..153dd22c 100644 --- a/app/Builders/CourseUserList.php +++ b/app/Builders/CourseUserList.php @@ -40,7 +40,7 @@ class CourseUserList extends Builder 'id', 'title', 'cover', 'market_price', 'vip_price', 'rating', 'model', 'level', 'attrs', - 'user_count', 'lesson_count', + 'user_count', 'lesson_count', 'review_count', 'favorite_count', ]; $courses = $courseRepo->findByIds($ids, $columns); diff --git a/app/Http/Admin/Controllers/TestController.php b/app/Http/Admin/Controllers/TestController.php index baa12cc4..414c85d5 100644 --- a/app/Http/Admin/Controllers/TestController.php +++ b/app/Http/Admin/Controllers/TestController.php @@ -74,19 +74,20 @@ class TestController extends Controller $pushUrl = $liveService->getPushUrl($streamName); - $codeUrl = $this->url->get( - ['for' => 'web.qrcode_img'], + $qrcode = $this->url->get( + ['for' => 'web.qrcode'], ['text' => urlencode($pushUrl)] ); - $obs = []; - $pos = strrpos($pushUrl, '/'); - $obs['fms_url'] = substr($pushUrl, 0, $pos + 1); - $obs['stream_code'] = substr($pushUrl, $pos + 1); + + $obs = [ + 'fms_url' => substr($pushUrl, 0, $pos + 1), + 'stream_code' => substr($pushUrl, $pos + 1), + ]; $this->view->pick('setting/live_push_test'); - $this->view->setVar('code_url', $codeUrl); + $this->view->setVar('qrcode', $qrcode); $this->view->setVar('obs', $obs); } diff --git a/app/Http/Admin/Services/AlipayTest.php b/app/Http/Admin/Services/AlipayTest.php index 68a98328..cd7bf6d1 100644 --- a/app/Http/Admin/Services/AlipayTest.php +++ b/app/Http/Admin/Services/AlipayTest.php @@ -23,7 +23,7 @@ class AlipayTest extends PayTest if ($code) { $codeUrl = $this->url->get( - ['for' => 'web.qrcode_img'], + ['for' => 'web.qrcode'], ['text' => urlencode($code)] ); } diff --git a/app/Http/Admin/Views/chapter/edit_lesson_live.volt b/app/Http/Admin/Views/chapter/edit_lesson_live.volt index 0f015afb..9d8ebadc 100644 --- a/app/Http/Admin/Views/chapter/edit_lesson_live.volt +++ b/app/Http/Admin/Views/chapter/edit_lesson_live.volt @@ -79,8 +79,7 @@ layer.open({ type: 2, title: '推流测试', - resize: false, - area: ['680px', '380px'], + area: ['680px', '450px'], content: [url, 'no'] }); }); diff --git a/app/Http/Admin/Views/setting/live_push.volt b/app/Http/Admin/Views/setting/live_push.volt index a2ab96b1..9ed1c3f4 100644 --- a/app/Http/Admin/Views/setting/live_push.volt +++ b/app/Http/Admin/Views/setting/live_push.volt @@ -93,8 +93,7 @@ layer.open({ type: 2, title: '推流测试', - resize: false, - area: ['680px', '380px'], + area: ['680px', '450px'], content: [url, 'no'] }); }); diff --git a/app/Http/Admin/Views/setting/live_push_test.volt b/app/Http/Admin/Views/setting/live_push_test.volt index b2e38e48..97a7aa5c 100644 --- a/app/Http/Admin/Views/setting/live_push_test.volt +++ b/app/Http/Admin/Views/setting/live_push_test.volt @@ -1,16 +1,23 @@
+
+ 手机推流 +
+
- -
- 二维码图片 +
+ 二维码图片
+
+ OBS推流 +
+
- +
- +
复制 @@ -18,9 +25,9 @@
- +
- +
复制 diff --git a/app/Http/Web/Controllers/ConsultController.php b/app/Http/Web/Controllers/ConsultController.php index 6c46365c..f40ef5ef 100644 --- a/app/Http/Web/Controllers/ConsultController.php +++ b/app/Http/Web/Controllers/ConsultController.php @@ -6,9 +6,8 @@ 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\ConsultLike as ConsultLikeService; -use App\Services\Frontend\Consult\ConsultRating as ConsultRatingService; +use App\Services\Frontend\Consult\ConsultReply as ConsultReplyService; use App\Services\Frontend\Consult\ConsultUpdate as ConsultUpdateService; -use Phalcon\Mvc\View; /** * @RoutePrefix("/consult") @@ -21,20 +20,7 @@ class ConsultController extends Controller */ public function addAction() { - $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - } - /** - * @Get("/{id:[0-9]+}/edit", name="web.consult.edit") - */ - public function editAction($id) - { - $service = new ConsultInfoService(); - - $consult = $service->handle($id); - - $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); - $this->view->setVar('consult', $consult); } /** @@ -46,10 +32,46 @@ class ConsultController extends Controller $consult = $service->handle($id); - $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); $this->view->setVar('consult', $consult); } + /** + * @Get("/{id:[0-9]+}/edit", name="web.consult.edit") + */ + public function editAction($id) + { + $service = new ConsultInfoService(); + + $consult = $service->handle($id); + + $this->view->setVar('consult', $consult); + } + + /** + * @Route("/{id:[0-9]+}/reply", name="web.consult.reply") + */ + public function replyAction($id) + { + if ($this->request->isPost()) { + + $service = new ConsultReplyService(); + + $service->handle($id); + + $content = ['msg' => '回复咨询成功']; + + return $this->jsonSuccess($content); + + } else { + + $service = new ConsultInfoService(); + + $consult = $service->handle($id); + + $this->view->setVar('consult', $consult); + } + } + /** * @Post("/create", name="web.consult.create") */ @@ -61,12 +83,9 @@ class ConsultController extends Controller $service = new ConsultInfoService(); - $consult = $service->handle($consult->id); + $service->handle($consult->id); - $content = [ - 'consult' => $consult, - 'msg' => '提交咨询成功', - ]; + $content = ['msg' => '提交咨询成功']; return $this->jsonSuccess($content); } @@ -78,12 +97,9 @@ class ConsultController extends Controller { $service = new ConsultUpdateService(); - $consult = $service->handle($id); + $service->handle($id); - $content = [ - 'consult' => $consult, - 'msg' => '更新咨询成功', - ]; + $content = ['msg' => '更新咨询成功']; return $this->jsonSuccess($content); } @@ -118,18 +134,4 @@ class ConsultController extends Controller return $this->jsonSuccess($content); } - /** - * @Post("/{id:[0-9]+}/rating", name="web.consult.rating") - */ - public function ratingAction($id) - { - $service = new ConsultRatingService(); - - $service->handle($id); - - $content = ['msg' => '评价成功']; - - return $this->jsonSuccess($content); - } - } diff --git a/app/Http/Web/Controllers/MyController.php b/app/Http/Web/Controllers/MyController.php index 8a5e02da..390f4bc3 100644 --- a/app/Http/Web/Controllers/MyController.php +++ b/app/Http/Web/Controllers/MyController.php @@ -30,14 +30,11 @@ class MyController extends Controller } /** - * @Get("/home", name="web.my.home") + * @Get("/", name="web.my.index") */ - public function homeAction() + public function indexAction() { - $this->response->redirect([ - 'for' => 'web.user.show', - 'id' => $this->authUser->id, - ]); + return $this->dispatcher->forward(['action' => 'courses']); } /** diff --git a/app/Http/Web/Controllers/PublicController.php b/app/Http/Web/Controllers/PublicController.php index c208141e..ff7d3c76 100644 --- a/app/Http/Web/Controllers/PublicController.php +++ b/app/Http/Web/Controllers/PublicController.php @@ -39,9 +39,9 @@ class PublicController extends \Phalcon\Mvc\Controller } /** - * @Get("/qrcode/img", name="web.qrcode_img") + * @Get("/qrcode", name="web.qrcode") */ - public function qrcodeImageAction() + public function qrcodeAction() { $text = $this->request->getQuery('text'); $level = $this->request->getQuery('level', 'int', 0); diff --git a/app/Http/Web/Controllers/TeachingController.php b/app/Http/Web/Controllers/TeachingController.php index 85801343..7db54747 100644 --- a/app/Http/Web/Controllers/TeachingController.php +++ b/app/Http/Web/Controllers/TeachingController.php @@ -3,8 +3,10 @@ namespace App\Http\Web\Controllers; -use App\Services\Frontend\Teaching\ConsultList as TclService; -use App\Services\Frontend\Teaching\LiveList as TllService; +use App\Services\Frontend\Teaching\ConsultList as ConsultListService; +use App\Services\Frontend\Teaching\CourseList as CourseListService; +use App\Services\Frontend\Teaching\LiveList as LiveListService; +use App\Services\Frontend\Teaching\LivePushUrl as LivePushUrlService; /** @@ -13,12 +15,34 @@ use App\Services\Frontend\Teaching\LiveList as TllService; class TeachingController extends Controller { + /** + * @Get("/", name="web.teaching.index") + */ + public function indexAction() + { + $this->dispatcher->forward(['action' => 'courses']); + } + + /** + * @Get("/courses", name="web.teaching.courses") + */ + public function coursesAction() + { + $service = new CourseListService(); + + $pager = $service->handle(); + + $pager->items = kg_array_object($pager->items); + + $this->view->setVar('pager', $pager); + } + /** * @Get("/lives", name="web.teaching.lives") */ public function livesAction() { - $service = new TllService(); + $service = new LiveListService(); $pager = $service->handle(); @@ -32,7 +56,7 @@ class TeachingController extends Controller */ public function consultsAction() { - $service = new TclService(); + $service = new ConsultListService(); $pager = $service->handle(); @@ -41,4 +65,30 @@ class TeachingController extends Controller $this->view->setVar('pager', $pager); } + /** + * @Get("/live/push", name="web.teaching.live_push") + */ + public function livePushAction() + { + $service = new LivePushUrlService(); + + $pushUrl = $service->handle(); + + $qrcode = $this->url->get( + ['for' => 'web.qrcode'], + ['text' => urlencode($pushUrl)] + ); + + $pos = strrpos($pushUrl, '/'); + + $obs = [ + 'fms_url' => substr($pushUrl, 0, $pos + 1), + 'stream_code' => substr($pushUrl, $pos + 1), + ]; + + $this->view->pick('teaching/live_push'); + $this->view->setVar('qrcode', $qrcode); + $this->view->setVar('obs', $obs); + } + } \ No newline at end of file diff --git a/app/Http/Web/Services/Trade.php b/app/Http/Web/Services/Trade.php index 2bf8898e..ef606c61 100644 --- a/app/Http/Web/Services/Trade.php +++ b/app/Http/Web/Services/Trade.php @@ -62,7 +62,7 @@ class Trade extends Service if ($text) { $qrCodeUrl = $this->url->get( - ['for' => 'web.qrcode_img'], + ['for' => 'web.qrcode'], ['text' => urlencode($text)] ); } diff --git a/app/Http/Web/Views/chapter/live.volt b/app/Http/Web/Views/chapter/live.volt index 7cf965b9..c75d9fda 100644 --- a/app/Http/Web/Views/chapter/live.volt +++ b/app/Http/Web/Views/chapter/live.volt @@ -10,7 +10,7 @@ {% set send_msg_url = url({'for':'web.live.send_msg','id':chapter.id}) %} {% set bind_user_url = url({'for':'web.live.bind_user','id':chapter.id}) %} {% set like_url = url({'for':'web.chapter.like','id':chapter.id}) %} - {% set qrcode_url = url({'for':'web.qrcode_img'},{'text':chapter_full_url}) %} + {% set qrcode_url = url({'for':'web.qrcode'},{'text':chapter_full_url}) %} - {% if consult.answer %} -
- -
- - -
-
-
- {% endif %} -{% endblock %} - -{% block inline_js %} - - - {% endblock %} \ No newline at end of file diff --git a/app/Http/Web/Views/course/consults.volt b/app/Http/Web/Views/course/consults.volt index 18e49063..569975af 100644 --- a/app/Http/Web/Views/course/consults.volt +++ b/app/Http/Web/Views/course/consults.volt @@ -1,5 +1,3 @@ -{{ partial('partials/macro_course') }} - {% if pager.total_pages > 0 %}
{% for item in pager.items %} @@ -13,7 +11,6 @@
-
{{ star_info(item.rating) }}
{{ item.question }}
{{ item.answer }}