• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

miaoxing / app / 13066009386

20 Jan 2025 04:18PM UTC coverage: 22.581%. Remained the same
13066009386

push

github

twinh
fix(app): 解决 `g-config` 命令将 `[id].jsx` 排在最前面导致其他页面失效

42 of 186 relevant lines covered (22.58%)

3.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Service/GroupModel.php
1
<?php
2

3
namespace Miaoxing\App\Service;
4

5
use Miaoxing\Plugin\BaseModel;
6
use Miaoxing\Plugin\Model\HasAppIdTrait;
7
use Miaoxing\Plugin\Model\ModelTrait;
8
use Miaoxing\Plugin\Model\ReqQueryTrait;
9
use Miaoxing\Plugin\Model\SnowflakeTrait;
10
use Miaoxing\Plugin\Service\UserModel;
11
use Wei\Model\SoftDeleteTrait;
12
use Wei\Ret;
13

14
/**
15
 * GroupModel
16
 *
17
 * @OA\Schema(schema="Group")
18
 * @OA\Property(
19
 *   property="id",
20
 *   type="string",
21
 *   description="编号"
22
 * )
23
 * @OA\Property(
24
 *   property="appId",
25
 *   type="string",
26
 *   description="应用编号"
27
 * )
28
 * @OA\Property(
29
 *   property="name",
30
 *   type="string",
31
 *   description="名称"
32
 * )
33
 * @OA\Property(
34
 *   property="sort",
35
 *   type="int",
36
 *   description="顺序"
37
 * )
38
 * @OA\Property(
39
 *   property="createdBy",
40
 *   type="string",
41
 *   description="创建用户编号"
42
 * )
43
 * @OA\Property(
44
 *   property="createdAt",
45
 *   type="string",
46
 *   description="创建时间"
47
 * )
48
 * @OA\Property(
49
 *   property="updatedBy",
50
 *   type="string",
51
 *   description="更新用户编号"
52
 * )
53
 * @OA\Property(
54
 *   property="updatedAt",
55
 *   type="string",
56
 *   description="更新时间"
57
 * )
58
 * @property string|null $id
59
 * @property string $appId 应用编号
60
 * @property string $parentId 父级分组编号
61
 * @property int $level 层级
62
 * @property string $name
63
 * @property int $sort
64
 * @property int $status
65
 * @property string|null $createdAt
66
 * @property string|null $updatedAt
67
 * @property string $createdBy
68
 * @property string $updatedBy
69
 * @property string|null $deletedAt
70
 * @property string $deletedBy
71
 * @property self $parent
72
 * @property self|self[] $children
73
 * @property string|null $id
74
 * @property string $appId 应用编号
75
 * @property string $parentId 父级分组编号
76
 * @property int $level 层级
77
 * @property string $name
78
 * @property int $sort
79
 * @property int $status
80
 * @property string|null $createdAt
81
 * @property string|null $updatedAt
82
 * @property string $createdBy
83
 * @property string $updatedBy
84
 * @property string|null $deletedAt
85
 * @property string $deletedBy
86
 */
87
class GroupModel extends BaseModel
88
{
89
    use HasAppIdTrait;
90
    use ModelTrait;
91
    use ReqQueryTrait;
92
    use SnowflakeTrait;
93
    use SoftDeleteTrait;
94

95
    /**
96
     * @Relation
97
     * @return self
98
     */
99
    public function parent(): self
100
    {
101
        return $this->hasOne(static::class, 'id', 'parentId');
×
102
    }
103

104
    /**
105
     * @Relation
106
     * @return self|self[]
107
     */
108
    public function children(): self
109
    {
110
        return $this->hasMany(static::class, 'parentId')->desc('sort');
×
111
    }
112

113
    public function checkDestroy(): Ret
114
    {
115
        if (UserModel::findBy('groupId', $this->id)) {
×
116
            return err(['很抱歉,该%s已被%s使用,不能删除', '分组', '用户']);
×
117
        }
118
        return suc();
×
119
    }
120
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc