瀏覽代碼

剧集存在 exception

liuzejian 1 年之前
父節點
當前提交
551d146c0b

+ 3 - 2
modules/Common/Exceptions/CommonBusinessException.php

@@ -2,13 +2,14 @@
 
 namespace Modules\Common\Exceptions;
 
+use Catch\Exceptions\CatchException;
 use Throwable;
 
-class CommonBusinessException extends \RuntimeException
+class CommonBusinessException extends CatchException
 {
     public function __construct($message = "", $code = 0, Throwable $previous = null)
     {
-        parent::__construct($message, $code, $previous);
+        parent::__construct($message, $code);
     }
 
     public static function throwError($error, Throwable $previous = null) {

+ 1 - 1
modules/Video/Http/Controllers/EpisodeController.php

@@ -81,7 +81,7 @@ class EpisodeController extends CatchController
             return collect($data)->keyBy('series_sequence')->get($item)['series_name'];
         });
         if($alreadySeries->isNotEmpty()) {
-            CommonBusinessException::throwError([-1, $alreadySeries->join(', ') . ' 已经存在']);
+            CommonBusinessException::throwError([-2333, $alreadySeries->join(', ') . ' 已经存在']);
         }
 
         DB::table('video_series')->insert($data);

+ 2 - 2
tests/UsedTestCase.php

@@ -13,11 +13,11 @@ abstract class UsedTestCase extends BaseTestCase
     {
         parent::setUp(); // TODO: Change the autogenerated stub
         $tokenInfo = $this->post('http://localhost/api/login', [
-//            'email' => 'catch@admin.com',
+            'email' => 'catch@admin.com',
             'remember' => false,
 //            'email' => 'xiaoli@qq.com',
             'password' => 'catchadmin',
-            'email' => 'aa@test.com',
+//            'email' => 'aa@test.com',
         ])->json();
         $this->token = $tokenInfo['data']['token'];
     }