Selaa lähdekoodia

删除app\common\exception\BaseException

萤火科技 3 vuotta sitten
vanhempi
säilyke
e2504e3912

+ 1 - 2
app/admin/model/store/User.php

@@ -12,7 +12,7 @@ declare (strict_types=1);
 
 namespace app\admin\model\store;
 
-use app\common\exception\BaseException;
+use cores\exception\BaseException;
 use app\common\model\store\User as StoreUserModel;
 
 /**
@@ -57,5 +57,4 @@ class User extends StoreUserModel
         static::update(['is_delete' => '1'], ['store_id' => $storeId]);
         return true;
     }
-
 }

+ 16 - 16
app/api/controller/Address.php

@@ -12,9 +12,10 @@ declare (strict_types=1);
 
 namespace app\api\controller;
 
+use think\response\Json;
 use app\api\service\User as UserService;
 use app\api\model\UserAddress as UserAddressModel;
-use app\common\exception\BaseException;
+use cores\exception\BaseException;
 
 /**
  * 收货地址管理
@@ -25,13 +26,13 @@ class Address extends Controller
 {
     /**
      * 收货地址列表
-     * @return array|\think\response\Json
+     * @return Json
      * @throws BaseException
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
      */
-    public function list()
+    public function list(): Json
     {
         // 获取收货地址列表
         $model = new UserAddressModel;
@@ -41,10 +42,10 @@ class Address extends Controller
 
     /**
      * 获取当前用户默认收货地址
-     * @return array|\think\response\Json
+     * @return Json
      * @throws BaseException
      */
-    public function defaultId()
+    public function defaultId(): Json
     {
         $useInfo = UserService::getCurrentLoginUser(true);
         return $this->renderSuccess(['defaultId' => $useInfo['address_id']]);
@@ -53,10 +54,10 @@ class Address extends Controller
     /**
      * 收货地址详情
      * @param int $addressId 地址ID
-     * @return array|\think\response\Json
+     * @return Json
      * @throws BaseException
      */
-    public function detail(int $addressId)
+    public function detail(int $addressId): Json
     {
         $detail = UserAddressModel::detail($addressId);
         return $this->renderSuccess(compact('detail'));
@@ -64,10 +65,10 @@ class Address extends Controller
 
     /**
      * 添加收货地址
-     * @return array|\think\response\Json
+     * @return Json
      * @throws BaseException
      */
-    public function add()
+    public function add(): Json
     {
         $model = new UserAddressModel;
         if ($model->add($this->postForm())) {
@@ -79,10 +80,10 @@ class Address extends Controller
     /**
      * 编辑收货地址
      * @param int $addressId 地址ID
-     * @return array|\think\response\Json
+     * @return Json
      * @throws BaseException
      */
-    public function edit(int $addressId)
+    public function edit(int $addressId): Json
     {
         $model = UserAddressModel::detail($addressId);
         if ($model->edit($this->postForm())) {
@@ -94,10 +95,10 @@ class Address extends Controller
     /**
      * 设为默认地址
      * @param int $addressId 地址ID
-     * @return array|\think\response\Json
+     * @return Json
      * @throws BaseException
      */
-    public function setDefault(int $addressId)
+    public function setDefault(int $addressId): Json
     {
         $model = UserAddressModel::detail($addressId);
         if ($model->setDefault((int)$model['address_id'])) {
@@ -109,10 +110,10 @@ class Address extends Controller
     /**
      * 删除收货地址
      * @param int $addressId 地址ID
-     * @return array|\think\response\Json
+     * @return Json
      * @throws BaseException
      */
-    public function remove(int $addressId)
+    public function remove(int $addressId): Json
     {
         $model = UserAddressModel::detail($addressId);
         if ($model->remove()) {
@@ -120,5 +121,4 @@ class Address extends Controller
         }
         return $this->renderError($model->getError() ?: '删除失败');
     }
-
 }

+ 3 - 3
app/api/controller/Article.php

@@ -24,7 +24,7 @@ class Article extends Controller
     /**
      * 文章列表
      * @param int $categoryId
-     * @return array
+     * @return \think\response\Json
      * @throws \think\db\exception\DbException
      */
     public function list(int $categoryId = 0)
@@ -37,8 +37,8 @@ class Article extends Controller
     /**
      * 文章详情
      * @param int $articleId
-     * @return array|\think\response\Json
-     * @throws \app\common\exception\BaseException
+     * @return \think\response\Json
+     * @throws \cores\exception\BaseException
      */
     public function detail(int $articleId)
     {

+ 2 - 2
app/api/controller/Cart.php

@@ -12,10 +12,10 @@ declare (strict_types=1);
 
 namespace app\api\controller;
 
+use think\response\Json;
 use app\api\model\Cart as CartModel;
 use app\api\service\Cart as CartService;
-use app\common\exception\BaseException;
-use think\response\Json;
+use cores\exception\BaseException;
 
 /**
  * 购物车管理

+ 0 - 1
app/api/controller/Notify.php

@@ -13,7 +13,6 @@ declare (strict_types=1);
 namespace app\api\controller;
 
 use app\common\library\wechat\WxPay;
-use app\common\exception\BaseException;
 
 /**
  * 支付成功异步通知接口

+ 1 - 1
app/api/controller/Page.php

@@ -25,7 +25,7 @@ class Page extends Controller
      * 页面数据
      * @param int|null $pageId 页面ID, 不传的话默认为首页
      * @return array|\think\response\Json
-     * @throws \app\common\exception\BaseException
+     * @throws \cores\exception\BaseException
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException

+ 3 - 3
app/api/controller/Passport.php

@@ -24,7 +24,7 @@ class Passport extends Controller
     /**
      * 登录接口 (需提交手机号、短信验证码、第三方用户信息)
      * @return array|\think\response\Json
-     * @throws \app\common\exception\BaseException
+     * @throws \cores\exception\BaseException
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
@@ -50,7 +50,7 @@ class Passport extends Controller
      * 业务流程:判断openid是否存在 -> 存在:  更新用户登录信息 -> 返回userId和token
      *                          -> 不存在: 返回false, 跳转到注册页面
      * @return array|\think\response\Json
-     * @throws \app\common\exception\BaseException
+     * @throws \cores\exception\BaseException
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
@@ -74,7 +74,7 @@ class Passport extends Controller
     /**
      * 快捷登录: 微信小程序授权手机号登录
      * @return array|\think\response\Json
-     * @throws \app\common\exception\BaseException
+     * @throws \cores\exception\BaseException
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException

+ 1 - 1
app/api/controller/Recharge.php

@@ -15,7 +15,7 @@ namespace app\api\controller;
 use app\api\model\recharge\Order as OrderModel;
 use app\api\service\Payment as PaymentService;
 use app\common\enum\OrderType as OrderTypeEnum;
-use app\common\exception\BaseException;
+use cores\exception\BaseException;
 
 /**
  * 用户充值管理

+ 1 - 1
app/api/controller/Refund.php

@@ -13,7 +13,7 @@ declare (strict_types=1);
 namespace app\api\controller;
 
 use app\api\model\OrderRefund as OrderRefundModel;
-use app\common\exception\BaseException;
+use cores\exception\BaseException;
 
 /**
  * 订单售后服务

+ 1 - 1
app/api/controller/Upload.php

@@ -18,7 +18,7 @@ use app\api\service\User as UserService;
 use app\common\enum\Setting as SettingEnum;
 use app\common\enum\file\FileType as FileTypeEnum;
 use app\common\library\storage\Driver as StorageDriver;
-use app\common\exception\BaseException;
+use cores\exception\BaseException;
 
 /**
  * 文件库管理

+ 4 - 4
app/api/controller/balance/Log.php

@@ -12,6 +12,7 @@ declare (strict_types=1);
 
 namespace app\api\controller\balance;
 
+use think\response\Json;
 use app\api\controller\Controller;
 use app\api\model\user\BalanceLog as BalanceLogModel;
 
@@ -24,15 +25,14 @@ class Log extends Controller
 {
     /**
      * 余额账单明细列表
-     * @return array
-     * @throws \app\common\exception\BaseException
+     * @return Json
+     * @throws \cores\exception\BaseException
      * @throws \think\db\exception\DbException
      */
-    public function list()
+    public function list(): Json
     {
         $model = new BalanceLogModel;
         $list = $model->getList();
         return $this->renderSuccess(compact('list'));
     }
-
 }

+ 2 - 2
app/api/controller/order/Comment.php

@@ -29,7 +29,7 @@ class Comment extends Controller
      * @param int $orderId
      * @return array
      * @throws \Exception
-     * @throws \app\common\exception\BaseException
+     * @throws \cores\exception\BaseException
      * @throws \think\exception\DbException
      */
     public function list(int $orderId)
@@ -53,7 +53,7 @@ class Comment extends Controller
      * 创建商品评价
      * @param int $orderId
      * @return array|\think\response\Json
-     * @throws \app\common\exception\BaseException
+     * @throws \cores\exception\BaseException
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException

+ 1 - 1
app/api/controller/points/Log.php

@@ -25,7 +25,7 @@ class Log extends Controller
     /**
      * 积分明细列表
      * @return array
-     * @throws \app\common\exception\BaseException
+     * @throws \cores\exception\BaseException
      * @throws \think\db\exception\DbException
      */
     public function list()

+ 1 - 1
app/api/controller/recharge/Order.php

@@ -14,7 +14,7 @@ namespace app\api\controller\recharge;
 
 use app\api\controller\Controller;
 use app\api\model\recharge\Order as OrderModel;
-use app\common\exception\BaseException;
+use cores\exception\BaseException;
 
 /**
  * 充值记录管理

+ 0 - 3
app/api/controller/recharge/Plan.php

@@ -14,7 +14,6 @@ namespace app\api\controller\recharge;
 
 use app\api\controller\Controller;
 use app\api\model\recharge\Plan as PlanModel;
-use app\common\exception\BaseException;
 
 /**
  * 充值套餐管理
@@ -26,7 +25,6 @@ class Plan extends Controller
     /**
      * 充值套餐列表
      * @return array
-     * @throws BaseException
      * @throws \think\db\exception\DbException
      */
     public function list()
@@ -35,5 +33,4 @@ class Plan extends Controller
         $list = $model->getList();
         return $this->renderSuccess(compact('list'));
     }
-
 }

+ 0 - 3
app/api/listener/order/PaySuccess.php

@@ -15,7 +15,6 @@ namespace app\api\listener\order;
 use app\common\service\Message as MessageService;
 use app\common\enum\OrderType as OrderTypeEnum;
 use app\common\enum\order\OrderSource as OrderSourceEnum;
-use app\common\exception\BaseException;
 
 /**
  * 订单支付成功后扩展类
@@ -45,7 +44,6 @@ class PaySuccess
      * 执行句柄
      * @param array $params
      * @return bool
-     * @throws BaseException
      */
     public function handle(array $params)
     {
@@ -74,7 +72,6 @@ class PaySuccess
 
     /**
      * 订单公共业务
-     * @throws BaseException
      */
     private function onCommonEvent()
     {

+ 1 - 1
app/api/model/Article.php

@@ -12,7 +12,7 @@ declare (strict_types=1);
 
 namespace app\api\model;
 
-use app\common\exception\BaseException;
+use cores\exception\BaseException;
 use app\common\model\Article as ArticleModel;
 
 /**

+ 1 - 1
app/api/model/Page.php

@@ -39,7 +39,7 @@ class Page extends PageModel
      * DIY页面详情
      * @param int|null $pageId 页面ID
      * @return array
-     * @throws \app\common\exception\BaseException
+     * @throws BaseException
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException

+ 1 - 3
app/api/model/UserAddress.php

@@ -15,7 +15,7 @@ namespace app\api\model;
 use app\api\model\User as UserModel;
 use app\api\service\User as UserService;
 use app\common\model\UserAddress as UserAddressModel;
-use app\common\exception\BaseException;
+use cores\exception\BaseException;
 
 /**
  * 用户收货地址模型
@@ -174,9 +174,7 @@ class UserAddress extends UserAddressModel
         $detail = self::get(['user_id' => $userId, 'address_id' => $addressId]);
         if (empty($detail)) {
             throwError('未找到该收货地址');
-            return false;
         }
         return $detail;
     }
-
 }

+ 1 - 1
app/api/model/user/PointsLog.php

@@ -25,7 +25,7 @@ class PointsLog extends PointsLogModel
     /**
      * 获取日志明细列表
      * @return \think\Paginator
-     * @throws \app\common\exception\BaseException
+     * @throws \cores\exception\BaseException
      * @throws \think\db\exception\DbException
      */
     public function getList()

+ 0 - 24
app/common/exception/BaseException.php

@@ -1,24 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
-// +----------------------------------------------------------------------
-// | Author: 萤火科技 <admin@yiovo.com>
-// +----------------------------------------------------------------------
-declare (strict_types=1);
-
-namespace app\common\exception;
-
-/**
- * 自定义异常类的基类 (此类已弃用, 请使用cores\exception\BaseException)
- * Class BaseException
- * @package app\common\exception
- */
-class BaseException extends \cores\exception\BaseException
-{
-
-}
-