diff --git a/app/Console/Tasks/VodEventTask.php b/app/Console/Tasks/VodEventTask.php index 1a029458..8c235f38 100644 --- a/app/Console/Tasks/VodEventTask.php +++ b/app/Console/Tasks/VodEventTask.php @@ -71,7 +71,7 @@ class VodEventTask extends Task $chapter->update(['attrs' => $attrs]); - $this->updateVodAttrs($chapter->course_id); + $this->updateVodAttrs($chapter); } protected function handleProcedureStateChangedEvent($event) @@ -144,11 +144,11 @@ class VodEventTask extends Task return in_array(strtolower($format), $formats); } - protected function updateVodAttrs($courseId) + protected function updateVodAttrs(ChapterModel $chapter) { $courseStats = new CourseStatService(); - $courseStats->updateVodAttrs($courseId); + $courseStats->updateVodAttrs($chapter->course_id); } } diff --git a/app/Http/Admin/Controllers/SettingController.php b/app/Http/Admin/Controllers/SettingController.php index 7ed6f7ef..23782be7 100644 --- a/app/Http/Admin/Controllers/SettingController.php +++ b/app/Http/Admin/Controllers/SettingController.php @@ -131,7 +131,7 @@ class SettingController extends Controller } else { - $live = $settingService->getSectionSettings($section); + $live = $settingService->getLiveSettings(); $ptt = json_decode($live->pull_trans_template); diff --git a/app/Http/Admin/Controllers/TestController.php b/app/Http/Admin/Controllers/TestController.php index 0e6c0aec..03bc8d7b 100644 --- a/app/Http/Admin/Controllers/TestController.php +++ b/app/Http/Admin/Controllers/TestController.php @@ -195,20 +195,6 @@ class TestController extends Controller return $this->jsonSuccess(['status' => $status]); } - /** - * @Post("/alipay/cancel", name="admin.test.alipay_cancel") - */ - public function alipayCancelAction() - { - $sn = $this->request->getPost('sn'); - - $alipayTestService = new AlipayTestService(); - - $alipayTestService->cancel($sn); - - return $this->jsonSuccess(['msg' => '取消订单成功']); - } - /** * @Get("/wxpay", name="admin.test.wxpay") */ @@ -247,18 +233,4 @@ class TestController extends Controller return $this->jsonSuccess(['status' => $status]); } - /** - * @Post("/wxpay/cancel", name="admin.test.wxpay_cancel") - */ - public function wxpayCancelAction() - { - $sn = $this->request->getPost('sn'); - - $wxpayTestService = new WxpayTestService(); - - $wxpayTestService->cancel($sn); - - return $this->jsonSuccess(['msg' => '取消订单成功']); - } - -} +} \ No newline at end of file diff --git a/app/Http/Admin/Services/AlipayTest.php b/app/Http/Admin/Services/AlipayTest.php index 24574378..832f0514 100644 --- a/app/Http/Admin/Services/AlipayTest.php +++ b/app/Http/Admin/Services/AlipayTest.php @@ -2,10 +2,7 @@ namespace App\Http\Admin\Services; -use App\Models\Order as OrderModel; use App\Models\Trade as TradeModel; -use App\Repos\Order as OrderRepo; -use App\Repos\Trade as TradeRepo; use App\Services\Pay\Alipay as AlipayService; class AlipayTest extends PayTest @@ -38,30 +35,4 @@ class AlipayTest extends PayTest return $alipayService->status($tradeNo); } - public function cancel($tradeNo) - { - $tradeRepo = new TradeRepo(); - - $trade = $tradeRepo->findBySn($tradeNo); - - $orderRepo = new OrderRepo(); - - $order = $orderRepo->findById($trade->order_id); - - $alipayService = new AlipayService(); - - $response = $alipayService->cancel($trade->sn); - - if ($response) { - - $trade->status = TradeModel::STATUS_CLOSED; - $trade->update(); - - if ($order->status != OrderModel::STATUS_PENDING) { - $order->status = OrderModel::STATUS_PENDING; - $order->update(); - } - } - } - } diff --git a/app/Http/Admin/Services/PayTest.php b/app/Http/Admin/Services/PayTest.php index 99824649..6aa3134d 100644 --- a/app/Http/Admin/Services/PayTest.php +++ b/app/Http/Admin/Services/PayTest.php @@ -77,12 +77,4 @@ abstract class PayTest extends Service */ abstract public function scan(TradeModel $trade); - /** - * 取消交易 - * - * @param string $tradeNo - * @return bool - */ - abstract public function cancel($tradeNo); - } diff --git a/app/Http/Admin/Services/Setting.php b/app/Http/Admin/Services/Setting.php index d742f256..ac68421a 100644 --- a/app/Http/Admin/Services/Setting.php +++ b/app/Http/Admin/Services/Setting.php @@ -132,4 +132,17 @@ class Setting extends Service } } + public function getLiveSettings() + { + $live = $this->getSectionSettings('live'); + + $live->notify_stream_begin_url = $live->notify_stream_begin_url ?: kg_full_url(['for' => 'desktop.live_notify'], ['action' => 'streamBegin']); + $live->notify_stream_end_url = $live->notify_stream_end_url ?: kg_full_url(['for' => 'desktop.live_notify'], ['action' => 'streamEnd']); + $live->notify_record_url = $live->notify_record_url ?: kg_full_url(['for' => 'desktop.live_notify'], ['action' => 'record']); + $live->notify_snapshot_url = $live->notify_snapshot_url ?: kg_full_url(['for' => 'desktop.live_notify'], ['action' => 'snapshot']); + $live->notify_porn_url = $live->notify_porn_url ?: kg_full_url(['for' => 'desktop.live_notify'], ['action' => 'porn']); + + return $live; + } + } diff --git a/app/Http/Admin/Services/WxpayTest.php b/app/Http/Admin/Services/WxpayTest.php index 52a2a283..b6094d6e 100644 --- a/app/Http/Admin/Services/WxpayTest.php +++ b/app/Http/Admin/Services/WxpayTest.php @@ -26,11 +26,4 @@ class WxpayTest extends PayTest return $wxpayService->status($tradeNo); } - public function cancel($tradeNo) - { - $wxpayService = new WxpayService(); - - return $wxpayService->close($tradeNo); - } - } diff --git a/app/Http/Admin/Views/setting/live.volt b/app/Http/Admin/Views/setting/live.volt index 5c956525..1aa8f67e 100644 --- a/app/Http/Admin/Views/setting/live.volt +++ b/app/Http/Admin/Views/setting/live.volt @@ -6,6 +6,7 @@