【调度系统】广东民航医疗快线调度系统源代码
克樊道人
2024-12-02 61ce8cc6883e5f94e6470141df3484167caf31ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
 
include_once(__DIR__."/../../utils/Utils.class.php");
 
class ExtattrItem
{
    public $name = null;
    public $value = null;
 
    public function __construct($name = null, $value = null)
    {
        $this->name = $name;
        $this->value = $value;
    }
}
 
class ExtattrList
{
    public $attrs = null; // ExtattrItem array
}
 
class User
{
    public $userid = null;  // string 
    public $name = null;  // string
    public $english_name = null;  // string
    public $mobile = null;  // string
    public $department = null;  // uint array
    public $order = null;  // uint array
    public $position = null;  // string
    public $gender = null;  // uint [bug]
    public $email = null;  // string
    public $telephone = null;  // string
    public $isleader = null; // uint
    public $avatar_mediaid = null;  // string
    public $enable = null; // uint
    public $extattr = null;  // ExtattrList
    public $status = null; // uint, 激活状态: 1=已激活,2=已禁用,4=未激活。已激活代表已激活企业微信或已关注微信插件。未激活代表既未激活企业微信又未关注微信插件。
 
    static public function Array2User($arr)
    {
        $user = new User();
 
        $user->userid = Utils::arrayGet($arr, "userid");
        $user->name = Utils::arrayGet($arr, "name");
        $user->english_name = Utils::arrayGet($arr, "english_name");
        $user->mobile = Utils::arrayGet($arr, "mobile");
        $user->department = Utils::arrayGet($arr, "department");
        $user->order = Utils::arrayGet($arr, "order");
        $user->position = Utils::arrayGet($arr, "position");
        $user->gender = Utils::arrayGet($arr, "gender");
        $user->email = Utils::arrayGet($arr, "email");
        $user->telephone = Utils::arrayGet($arr, "telephone");
        $user->isleader = Utils::arrayGet($arr, "isleader");
        $user->avatar_mediaid = Utils::arrayGet($arr, "avatar_mediaid");
        $user->enable = Utils::arrayGet($arr, "enable");
        $user->status = Utils::arrayGet($arr, "status");
 
        if (array_key_exists("extattr", $arr)) { 
            $attrs = $arr["extattr"]["attrs"];
            if (is_array($attrs)) {
                $user->extattr = new ExtattrList();
                foreach ($attrs as $item) {
                    $name = $item["name"];
                    $value = $item["value"];
                    $user->extattr->attrs[] = new ExtattrItem($name, $value);
                }
            }
        }
 
        return $user;
    }
 
    static public function Array2UserList($arr)
    {
        $userList = $arr["userlist"];
 
        $retUserList = array();
        if (is_array($userList)) {
            foreach ($userList as $item) {
                $user = User::Array2User($item);
                $retUserList[] = $user;
            }
        }
        return $retUserList;
    }
 
    static public function CheckUserCreateArgs($user)
    { 
        Utils::checkNotEmptyStr($user->userid, "userid"); 
        Utils::checkNotEmptyStr($user->name, "name");
        Utils::checkNotEmptyArray($user->department, "department");
    }
 
    static public function CheckUserUpdateArgs($user)
    { 
        Utils::checkNotEmptyStr($user->userid, "userid");
    } 
 
    static public function CheckuserBatchDeleteArgs($userIdList)
    {
        Utils::checkNotEmptyArray($userIdList, "userid list");
        foreach ($userIdList as $userId) {
            Utils::checkNotEmptyStr($userId, "userid");
        }
        if (count($userIdList) > 200) {
            throw QyApiError("no more than 200 userid once");
        }
    }
 
}