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

miaoxing / app / 4295665606

pending completion
4295665606

push

github

twinh
refactor(admin): 移除未使用的方法

8 of 28 relevant lines covered (28.57%)

0.86 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\App\Metadata\GroupTrait;
6
use Miaoxing\Plugin\BaseModel;
7
use Miaoxing\Plugin\Model\HasAppIdTrait;
8
use Miaoxing\Plugin\Model\ModelTrait;
9
use Miaoxing\Plugin\Model\ReqQueryTrait;
10
use Miaoxing\Plugin\Model\SnowflakeTrait;
11
use Miaoxing\Plugin\Service\UserModel;
12
use Wei\Model\SoftDeleteTrait;
13
use Wei\Ret;
14

15
/**
16
 * GroupModel
17
 *
18
 * @OA\Schema(schema="Group")
19
 * @OA\Property(
20
 *   property="id",
21
 *   type="string",
22
 *   description="编号"
23
 * )
24
 * @OA\Property(
25
 *   property="appId",
26
 *   type="string",
27
 *   description="应用编号"
28
 * )
29
 * @OA\Property(
30
 *   property="name",
31
 *   type="string",
32
 *   description="名称"
33
 * )
34
 * @OA\Property(
35
 *   property="sort",
36
 *   type="int",
37
 *   description="顺序"
38
 * )
39
 * @OA\Property(
40
 *   property="createdBy",
41
 *   type="string",
42
 *   description="创建用户编号"
43
 * )
44
 * @OA\Property(
45
 *   property="createdAt",
46
 *   type="string",
47
 *   description="创建时间"
48
 * )
49
 * @OA\Property(
50
 *   property="updatedBy",
51
 *   type="string",
52
 *   description="更新用户编号"
53
 * )
54
 * @OA\Property(
55
 *   property="updatedAt",
56
 *   type="string",
57
 *   description="更新时间"
58
 * )
59
 * @property GroupModel $parent
60
 * @property GroupModel[]|GroupModel $children
61
 */
62
class GroupModel extends BaseModel
63
{
64
    use GroupTrait;
65
    use HasAppIdTrait;
66
    use ModelTrait;
67
    use ReqQueryTrait;
68
    use SnowflakeTrait;
69
    use SoftDeleteTrait;
70

71
    public function parent(): self
72
    {
73
        return $this->hasOne(static::class, 'id', 'parentId');
×
74
    }
75

76
    public function children(): self
77
    {
78
        return $this->hasMany(static::class, 'parentId')->desc('sort');
×
79
    }
80

81
    public function checkDestroy(): Ret
82
    {
83
        if (UserModel::findBy('groupId', $this->id)) {
×
84
            return err(['很抱歉,该%s已被%s使用,不能删除', '分组', '用户']);
×
85
        }
86
        return suc();
×
87
    }
88
}
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