【调度系统】广东民航医疗快线调度系统源代码
wzp
2024-12-05 9dc0d99742f5526321e1b5fdb0dec10e6725415e
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
<?php
 
include_once(__DIR__."/../../utils/Utils.class.php");
 
class Agent
{
    public $agentid = null; // string
    public $name = null; // string
    public $square_logo_url = null; // string
    public $description = null; // string
    public $allow_userinfos = null; // string array
    public $allow_partys = null; // uint array
    public $allow_tags = null; // uint array
    public $close = null; // uint, 企业应用是否被禁用
    public $redirect_domain = null; // string
    public $report_location_flag = null; // uint, 企业应用是否打开地理位置上报 0:不上报;1:进入会话上报;
    public $isreportenter = null; // uint, 是否上报用户进入应用事件。0:不接收;1:接收
    public $home_url = null; // string 
 
    public static function Array2Agent($arr)
    {
        $agent = new Agent();
 
        $agent->agentid = Utils::arrayGet($arr, "agentid");
        $agent->name = Utils::arrayGet($arr, "name");
        $agent->square_logo_url = Utils::arrayGet($arr, "square_logo_url");
        $agent->description = Utils::arrayGet($arr, "description");
        $agent->close = Utils::arrayGet($arr, "close");
        $agent->redirect_domain = Utils::arrayGet($arr, "redirect_domain");
        $agent->report_location_flag = Utils::arrayGet($arr, "report_location_flag");
        $agent->isreportenter = Utils::arrayGet($arr, "isreportenter");
        $agent->home_url = Utils::arrayGet($arr, "home_url");
 
        if (array_key_exists("allow_userinfos", $arr) && array_key_exists("user", $arr["allow_userinfos"])) {
            $userArr = $arr["allow_userinfos"]["user"];
            foreach($userArr as $item) {
                $agent->allow_userinfos[] = $item["userid"];
            }
        }
 
        if (array_key_exists("allow_partys", $arr)) {
            $partyAr = $arr["allow_partys"];
            $agent->allow_partys = Utils::arrayGet($partyAr, "partyid");
        }
 
        if (array_key_exists("allow_tags", $arr)) { 
            $tagArr= $arr["allow_tags"];
            $agent->allow_tags= Utils::arrayGet($tagArr, "tagid");
        }
 
        return $agent;
    }
 
    public static function Array2AgentList($arr)
    {
        $agentLIst = array();
 
        foreach($arr["agentlist"] as $item) {
            $agent = self::Array2Agent($item);
            $agentLIst[] = $agent;
        }
 
        return $agentLIst;
    }
 
    public static function Agent2Array($agent)
    { 
        $args = array();
 
        Utils::setIfNotNull($agent->agentid, "agentid", $args);
        Utils::setIfNotNull($agent->name, "name", $args);
        Utils::setIfNotNull($agent->square_logo_url, "square_logo_url", $args);
        Utils::setIfNotNull($agent->description, "description", $args);
        Utils::setIfNotNull($agent->close, "close", $args);
        Utils::setIfNotNull($agent->redirect_domain, "redirect_domain", $args);
        Utils::setIfNotNull($agent->report_location_flag, "report_location_flag", $args);
        Utils::setIfNotNull($agent->isreportenter, "isreportenter", $args);
        Utils::setIfNotNull($agent->home_url, "home_url", $args); 
 
        return $args;
    }
 
    public static function CheckAgentSetArgs($agent)
    { 
        utils::checkIsUInt($agent->agentid, "agentid");
    }
}