Răsfoiți Sursa

修复:强制类型报错问题

Yahoo 4 ani în urmă
părinte
comite
8216810f71
2 a modificat fișierele cu 8 adăugiri și 8 ștergeri
  1. 5 5
      app/api/model/Coupon.php
  2. 3 3
      app/api/model/Page.php

+ 5 - 5
app/api/model/Coupon.php

@@ -38,13 +38,13 @@ class Coupon extends CouponModel
      * 获取优惠券列表
      * @param int|null $limit 获取的数量
      * @param bool $onlyReceive 只显示可领取
-     * @return array
+     * @return mixed
      * @throws BaseException
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
      */
-    public function getList(int $limit = null, bool $onlyReceive = false): array
+    public function getList(int $limit = null, bool $onlyReceive = false)
     {
         // 查询构造器
         $query = $this->getNewQuery();
@@ -66,11 +66,11 @@ class Coupon extends CouponModel
 
     /**
      * 获取用户已领取的优惠券
-     * @param $couponList
-     * @return array
+     * @param mixed $couponList
+     * @return mixed
      * @throws BaseException
      */
-    private function setIsReceive($couponList): array
+    private function setIsReceive($couponList)
     {
         // 获取用户已领取的优惠券
         $userInfo = UserService::getCurrentLoginUser();

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

@@ -16,6 +16,7 @@ use app\api\model\Goods as GoodsModel;
 use app\api\model\Coupon as CouponModel;
 use app\common\model\Page as PageModel;
 use app\common\library\helper;
+use cores\exception\BaseException;
 
 /**
  * 页面模型
@@ -118,8 +119,8 @@ class Page extends PageModel
     /**
      * 优惠券组件:获取优惠券列表
      * @param $item
-     * @return \think\Collection
-     * @throws \app\common\exception\BaseException
+     * @return array|mixed
+     * @throws BaseException
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
@@ -157,5 +158,4 @@ class Page extends PageModel
         $articleList = $model->getList($item['params']['auto']['category'], $item['params']['auto']['showNum']);
         return $articleList->isEmpty() ? [] : $articleList->toArray()['data'];
     }
-
 }