【调度系统】广东民航医疗快线调度系统源代码
克樊道人
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
<?php /*
 * Copyright (C) 2017 All rights reserved.
 *   
 * @File UserTest.php
 * @Brief 
 * @Author abelzhu, abelzhu@tencent.com
 * @Version 1.0
 * @Date 2017-12-26
 *
 */
 
include_once("../src/CorpAPI.class.php");
include_once("../src/ServiceCorpAPI.class.php");
include_once("../src/ServiceProviderAPI.class.php");
 
 
$config = require('./config.php');
// 需启用 "管理工具" -> "通讯录同步", 并使用该处的secret, 才能通过API管理通讯录
//
$api = new CorpAPI($config['CORP_ID'], $config['CONTACT_SYNC_SECRET']);
 
 
try { 
    //
    $user = new User();
    {
        $user->userid = "userid";
        $user->name = "name";
        $user->mobile = "131488888888";
        $user->email = "sbzhu@ipp.cas.cn";
        $user->department = array(1); 
 
        $ExtattrList = new ExtattrList();
        $ExtattrList->attrs = array(new ExtattrItem("s_a_2", "aaa"), new ExtattrItem("s_a_3", "bbb"));
        $user->extattr = $ExtattrList;
    } 
    $api->UserCreate($user);
 
    //
    $user = $api->UserGet("userid");
    var_dump($user);
 
    //
    $user->mobile = "1219887219873";
    $api->UserUpdate($user); 
 
    //
    $userList = $api->userSimpleList(1, 0);
    var_dump($userList);
 
    //
    $userList = $api->UserList(1, 0);
    var_dump($userList);
 
    //
    $openId = null;
    $api->UserId2OpenId("ZhuShengBen", $openId);
    echo "openid: $openId\n";
 
    //
    $userId = null;
    $api->openId2UserId($openId, $userId);
    echo "userid: $userId\n";
 
    //
    $api->UserAuthSuccess("userid");
 
    //
    $api->UserBatchDelete(array("userid", "aaa"));
 
    //
    $api->UserDelete("userid"); 
} catch (Exception $e) { 
    echo $e->getMessage() . "\n";
    $api->UserDelete("userid"); 
}