Преглед изворни кода

refactor: 统一代码风格

runphp пре 2 недеља
родитељ
комит
107bee30bc

+ 1 - 0
config.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 return [
     [

+ 2 - 2
database/migrations/20250830123540_user_point.php

@@ -30,7 +30,7 @@ class UserPoint extends AbstractMigration
     public function change(): void
     {
         // 用户积分表
-        $table = $this->table('extension_user_point',[
+        $table = $this->table('extension_user_point', [
             'collation' => 'utf8mb4_unicode_ci',
             'id' => false,
             'comment' => '用户积分表',
@@ -41,6 +41,6 @@ class UserPoint extends AbstractMigration
             ->addTimestamps('create_time', 'update_time')
             ->create();
 
-      
+
     }
 }

+ 1 - 1
database/migrations/20250830132345_user_point_log.php

@@ -28,7 +28,7 @@ class UserPointLog extends AbstractMigration
     public function change()
     {
         // 用户积分日志表
-        $table = $this->table('extension_user_point_log',[
+        $table = $this->table('extension_user_point_log', [
             'collation' => 'utf8mb4_unicode_ci',
             'comment' => '用户积分日志表',
         ]);

+ 2 - 1
info.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 return array(
@@ -11,4 +12,4 @@ return array(
     'website' => '',
     'image' => '',
     'license' => 'MIT',
-);
+);

+ 1 - 0
route/admin.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 use think\facade\Route;

+ 3 - 2
src/Controller/UserPointController.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Points\Controller;
@@ -7,9 +8,9 @@ use SixShop\Core\Request;
 use SixShop\Points\Entity\UserPointEntity;
 use SixShop\Points\Enum\UserPointTypeEnum;
 use think\Response;
+
 use function SixShop\Core\page_response;
 use function SixShop\Core\success_response;
-use function SixShop\Core\throw_logic_exception;
 
 class UserPointController
 {
@@ -40,4 +41,4 @@ class UserPointController
             $params['freeze_point'],
         ));
     }
-}
+}

+ 3 - 2
src/Controller/UserPointLogController.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Points\Controller;
@@ -6,8 +7,8 @@ namespace SixShop\Points\Controller;
 use SixShop\Core\Request;
 use SixShop\Points\Entity\UserPointLogEntity;
 use think\Response;
+
 use function SixShop\Core\page_response;
-use function SixShop\Core\success_response;
 
 class UserPointLogController
 {
@@ -22,4 +23,4 @@ class UserPointLogController
         $stats = $entity->getStats($params);
         return page_response($paginate, $stats);
     }
-}
+}

+ 4 - 3
src/Entity/UserPointEntity.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Points\Entity;
@@ -8,6 +9,7 @@ use SixShop\Points\Enum\UserPointTypeEnum;
 use SixShop\Points\Model\UserPointLogModel;
 use think\db\Query;
 use think\Paginator;
+
 use function SixShop\Core\throw_logic_exception;
 
 class UserPointEntity extends BaseEntity
@@ -20,8 +22,7 @@ class UserPointEntity extends BaseEntity
         int               $bizID,
         string            $remark,
         int               $freezePoint = 0,
-    ): self
-    {
+    ): self {
         if ($point == 0 && $freezePoint == 0) {
             throw_logic_exception('积分调整不能为0');
         }
@@ -61,4 +62,4 @@ class UserPointEntity extends BaseEntity
             ->field(['u.id', 'u.avatar', 'u.nickname', 'u.mobile', 'l.point', 'l.update_time'])
             ->paginate($pageAndLimit);
     }
-}
+}

+ 1 - 0
src/Entity/UserPointLogEntity.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Points\Entity;

+ 4 - 1
src/Enum/UserPointTypeEnum.php

@@ -1,6 +1,9 @@
 <?php
+
 declare(strict_types=1);
+
 namespace SixShop\Points\Enum;
+
 enum UserPointTypeEnum: int
 {
     // 1 增加
@@ -11,4 +14,4 @@ enum UserPointTypeEnum: int
     // 3 对冲
     case OFFSET = 3;
 
-}
+}

+ 1 - 3
src/Extension.php

@@ -1,12 +1,10 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Points;
 
 use SixShop\Core\ExtensionAbstract;
-use SixShop\Payment\Contracts\PaymentExtensionInterface;
-use SixShop\Payment\Contracts\PaymentProviderInterface;
-use SixDec\RedeemCode\Hook\RedeemCodeHook;
 
 class Extension extends ExtensionAbstract
 {

+ 3 - 1
src/Model/UserPointLogModel.php

@@ -1,5 +1,7 @@
 <?php
+
 declare(strict_types=1);
+
 namespace SixShop\Points\Model;
 
 use app\model\User;
@@ -37,4 +39,4 @@ class UserPointLogModel extends Model
     {
         $value && $query->whereBetweenTime('create_time', $value[0], $value[1]);
     }
-}
+}

+ 3 - 1
src/Model/UserPointModel.php

@@ -1,5 +1,7 @@
 <?php
+
 declare(strict_types=1);
+
 namespace SixShop\Points\Model;
 
 use think\Model;
@@ -13,4 +15,4 @@ class UserPointModel extends Model
             'pk' => 'user_id'
         ];
     }
-}
+}

+ 4 - 2
test/Entity/UserPointEntityTest.php

@@ -1,5 +1,7 @@
 <?php
+
 declare(strict_types=1);
+
 namespace SixShop\Points\Entity;
 
 use PHPUnit\Framework\TestCase;
@@ -17,7 +19,7 @@ class UserPointEntityTest extends TestCase
     /**
      * 测试添加积分
      */
-    public  function testAdd()
+    public function testAdd()
     {
         UserPointModel::where('user_id', 1)->delete();
         $result = $this->userPointEntity->change(1, 100, UserPointTypeEnum::INCREASE, 1, 1, '测试添加积分');
@@ -29,4 +31,4 @@ class UserPointEntityTest extends TestCase
         $this->assertEquals(200, $result->point);
         $this->assertEquals(1, $result->user_id);
     }
-}
+}