From 265d8a583827d5f5f836c63f50da546d4ff9b424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Mon, 13 Sep 2021 14:15:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/controller/api/Auth.php | 3 +-- app/data/controller/api/Wxapp.php | 11 +++++------ app/data/controller/api/auth/Center.php | 3 +-- app/data/controller/api/auth/Order.php | 10 ++++------ app/data/controller/api/auth/Rebate.php | 9 +++------ app/data/controller/base/postage/Company.php | 3 +-- app/data/controller/shop/Order.php | 3 +-- app/data/controller/shop/Send.php | 3 +-- app/data/service/UserUpgradeService.php | 5 +---- 9 files changed, 18 insertions(+), 32 deletions(-) diff --git a/app/data/controller/api/Auth.php b/app/data/controller/api/Auth.php index 58713fff6..dd8384d12 100644 --- a/app/data/controller/api/Auth.php +++ b/app/data/controller/api/Auth.php @@ -4,7 +4,6 @@ namespace app\data\controller\api; use app\data\service\UserAdminService; use app\data\service\UserTokenService; -use Exception; use think\admin\Controller; use think\exception\HttpResponseException; @@ -79,7 +78,7 @@ abstract class Auth extends Controller return UserAdminService::instance()->get($this->uuid, $this->type); } catch (HttpResponseException $exception) { throw $exception; - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->error($exception->getMessage()); } } diff --git a/app/data/controller/api/Wxapp.php b/app/data/controller/api/Wxapp.php index 31ed2f864..1f5890d61 100644 --- a/app/data/controller/api/Wxapp.php +++ b/app/data/controller/api/Wxapp.php @@ -3,7 +3,6 @@ namespace app\data\controller\api; use app\data\service\UserAdminService; -use Exception; use think\admin\Controller; use think\exception\HttpResponseException; use think\Response; @@ -99,7 +98,7 @@ class Wxapp extends Controller } } catch (HttpResponseException $exception) { throw $exception; - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->error("数据处理失败,{$exception->getMessage()}"); } } @@ -128,7 +127,7 @@ class Wxapp extends Controller } } catch (HttpResponseException $exception) { throw $exception; - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->error("授权换取失败,{$exception->getMessage()}"); } } @@ -154,7 +153,7 @@ class Wxapp extends Controller } } catch (HttpResponseException $exception) { throw $exception; - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->error($exception->getMessage()); } } @@ -170,7 +169,7 @@ class Wxapp extends Controller $this->success('获取直播列表成功!', $list); } catch (HttpResponseException $exception) { throw $exception; - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->error($exception->getMessage()); } } @@ -191,7 +190,7 @@ class Wxapp extends Controller $this->success('获取回放视频成功!', $result); } catch (HttpResponseException $exception) { throw $exception; - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->error($exception->getMessage()); } } diff --git a/app/data/controller/api/auth/Center.php b/app/data/controller/api/auth/Center.php index 24254aee3..c932ee387 100644 --- a/app/data/controller/api/auth/Center.php +++ b/app/data/controller/api/auth/Center.php @@ -6,7 +6,6 @@ use app\data\controller\api\Auth; use app\data\service\RebateService; use app\data\service\UserAdminService; use app\data\service\UserUpgradeService; -use Exception; use think\admin\Storage; use think\exception\HttpResponseException; @@ -71,7 +70,7 @@ class Center extends Auth } } catch (HttpResponseException $exception) { throw $exception; - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->error($exception->getMessage()); } } diff --git a/app/data/controller/api/auth/Order.php b/app/data/controller/api/auth/Order.php index a3de4b3a0..f4aaa7f04 100644 --- a/app/data/controller/api/auth/Order.php +++ b/app/data/controller/api/auth/Order.php @@ -11,8 +11,6 @@ use app\data\service\GoodsService; use app\data\service\OrderService; use app\data\service\PaymentService; use app\data\service\UserAdminService; -use Exception; -use stdClass; use think\admin\extend\CodeExtend; use think\exception\HttpResponseException; @@ -186,7 +184,7 @@ class Order extends Auth $this->success('商品下单成功', $order); } catch (HttpResponseException $exception) { throw $exception; - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->error("商品下单失败,{$exception->getMessage()}"); } } @@ -347,10 +345,10 @@ class Order extends Auth // 返回订单数据及支付发起参数 $type = $order['amount_real'] <= 0 ? 'empty' : $data['payment_code']; $param = PaymentService::instance($type)->create($openid, $order['order_no'], $order['amount_real'], '商城订单支付', '', $data['payment_back'], $data['payment_image']); - $this->success('获取支付参数', ['order' => ShopOrder::mk()->where($map)->find() ?: new stdClass(), 'param' => $param]); + $this->success('获取支付参数', ['order' => ShopOrder::mk()->where($map)->find() ?: new \stdClass(), 'param' => $param]); } catch (HttpResponseException $exception) { throw $exception; - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->error($exception->getMessage()); } } @@ -475,7 +473,7 @@ class Order extends Auth empty($result['code']) ? $this->error($result['info']) : $this->success('快递追踪信息', $result); } catch (HttpResponseException $exception) { throw $exception; - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->error($exception->getMessage()); } } diff --git a/app/data/controller/api/auth/Rebate.php b/app/data/controller/api/auth/Rebate.php index 317cc8132..b622df10a 100644 --- a/app/data/controller/api/auth/Rebate.php +++ b/app/data/controller/api/auth/Rebate.php @@ -4,9 +4,6 @@ namespace app\data\controller\api\auth; use app\data\controller\api\Auth; use app\data\service\RebateService; -use think\db\exception\DataNotFoundException; -use think\db\exception\DbException; -use think\db\exception\ModelNotFoundException; /** * 用户返利管理 @@ -17,9 +14,9 @@ class Rebate extends Auth { /** * 获取用户返利记录 - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException */ public function get() { diff --git a/app/data/controller/base/postage/Company.php b/app/data/controller/base/postage/Company.php index 89e235d79..9f1a17a8b 100644 --- a/app/data/controller/base/postage/Company.php +++ b/app/data/controller/base/postage/Company.php @@ -3,7 +3,6 @@ namespace app\data\controller\base\postage; use app\data\service\ExpressService; -use Exception; use think\admin\Controller; use think\exception\HttpResponseException; @@ -106,7 +105,7 @@ class Company extends Controller $this->success('同步快递公司成功!'); } catch (HttpResponseException $exception) { throw $exception; - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->error('同步快递公司数据失败!'); } } diff --git a/app/data/controller/shop/Order.php b/app/data/controller/shop/Order.php index 3f5296c95..5b9bd4dd4 100644 --- a/app/data/controller/shop/Order.php +++ b/app/data/controller/shop/Order.php @@ -5,7 +5,6 @@ namespace app\data\controller\shop; use app\data\service\OrderService; use app\data\service\PaymentService; use app\data\service\UserAdminService; -use Exception; use think\admin\Controller; use think\admin\extend\CodeExtend; use think\exception\HttpResponseException; @@ -179,7 +178,7 @@ class Order extends Controller } } catch (HttpResponseException $exception) { throw $exception; - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->error($exception->getMessage()); } } diff --git a/app/data/controller/shop/Send.php b/app/data/controller/shop/Send.php index 3f4b37d7b..a098c14b8 100644 --- a/app/data/controller/shop/Send.php +++ b/app/data/controller/shop/Send.php @@ -4,7 +4,6 @@ namespace app\data\controller\shop; use app\data\service\ExpressService; use app\data\service\OrderService; -use Exception; use think\admin\Controller; use think\exception\HttpResponseException; @@ -155,7 +154,7 @@ class Send extends Controller $this->fetch('truck_query'); } catch (HttpResponseException $exception) { throw $exception; - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->error($exception->getMessage()); } } diff --git a/app/data/service/UserUpgradeService.php b/app/data/service/UserUpgradeService.php index bc452f6d1..c28cf1f1e 100644 --- a/app/data/service/UserUpgradeService.php +++ b/app/data/service/UserUpgradeService.php @@ -6,7 +6,6 @@ use app\data\model\DataUser; use app\data\model\DataUserBalance; use app\data\model\ShopOrder; use app\data\model\ShopOrderItem; -use Exception; use think\admin\Service; /** @@ -50,8 +49,6 @@ class UserUpgradeService extends Service $agent = DataUser::mk()->where(['id' => $pid0])->find(); if (empty($agent['vip_code'])) return [0, '代理无推荐资格']; if (stripos($agent['path'], "-{$uuid}-") !== false) return [0, '不能绑定下属']; - // 组装代理数据 - try { $this->app->db->transaction(function () use ($user, $agent, $mode) { // 更新用户代理 @@ -73,7 +70,7 @@ class UserUpgradeService extends Service }); $this->upgrade($user['id']); return [1, '绑定代理成功']; - } catch (Exception $exception) { + } catch (\Exception $exception) { return [0, "绑定代理失败, {$exception->getMessage()}"]; } }