正在显示
1 个修改的文件
包含
25 行增加
和
0 行删除
| @@ -3,6 +3,8 @@ | @@ -3,6 +3,8 @@ | ||
| 3 | namespace App\Http\Logic\Bside\User; | 3 | namespace App\Http\Logic\Bside\User; |
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | +use App\Exceptions\AsideGlobalException; | ||
| 7 | +use App\Exceptions\BsideGlobalException; | ||
| 6 | use App\Helper\Common; | 8 | use App\Helper\Common; |
| 7 | use App\Http\Logic\Aside\Project\ProjectLogic; | 9 | use App\Http\Logic\Aside\Project\ProjectLogic; |
| 8 | use App\Models\SmsLog; | 10 | use App\Models\SmsLog; |
| @@ -62,4 +64,27 @@ class UserLoginLogic | @@ -62,4 +64,27 @@ class UserLoginLogic | ||
| 62 | Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip()]); | 64 | Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip()]); |
| 63 | return $this->success($info); | 65 | return $this->success($info); |
| 64 | } | 66 | } |
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * @notes: 请简要描述方法功能 | ||
| 70 | + * @param array $data | ||
| 71 | + * @return array | ||
| 72 | + */ | ||
| 73 | + public function success($data = []) | ||
| 74 | + { | ||
| 75 | + return $data; | ||
| 76 | + } | ||
| 77 | + /** | ||
| 78 | + * @notes: 错误抛出 | ||
| 79 | + * @param string $code | ||
| 80 | + * @param string $message | ||
| 81 | + * @throws AsideGlobalException|BsideGlobalException | ||
| 82 | + */ | ||
| 83 | + public function fail(string $message = "", string $code = Code::SYSTEM_ERROR) | ||
| 84 | + { | ||
| 85 | + if((request()->path()[0]) == \App\Enums\Common\Common::B){ | ||
| 86 | + throw new BsideGlobalException($code, $message); | ||
| 87 | + } | ||
| 88 | + throw new AsideGlobalException($code, $message); | ||
| 89 | + } | ||
| 65 | } | 90 | } |
-
请 注册 或 登录 后发表评论