FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
weworkapi_php/api/datastructure/Batch.class.php at master · EternalSuno/weworkapi_php · GitHub
EternalSuno
/
weworkapi_php
Public
forked from
sbzhu/weworkapi_php
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
weworkapi_php
/
api
/
datastructure
/
Batch.class.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
53 lines (43 loc) · 1.93 KB
Breadcrumbs
weworkapi_php
/
api
/
datastructure
/
Batch.class.php
Copy path
File metadata and controls
53 lines (43 loc) · 1.93 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<?php
include_once
(
__DIR__
.
"
/../../utils/Utils.class.php
"
);
class
CallBack {
public
$
url
=
null
;
// string
public
$
token
=
null
;
// string
public
$
encodingaeskey
=
null
;
// string
}
// class CallBack
class
BatchJobArgs {
public
$
media_id
=
null
;
// string
public
$
to_invite
=
null
;
// bool, 是否邀请新建的成员使用企业微信(将通过微信服务通知或短信或邮件下发邀请,每天自动下发一次,最多持续3个工作日)
public
$
callback
=
null
;
// CallBack
}
// class BatchJobRequest
class
BatchJobResult
{
const
STATUS_PENDING
=
1
;
const
STATUS_STARTED
=
2
;
const
STATUS_FINISHED
=
3
;
public
$
status
=
null
;
// uint, 任务状态,整型,1表示任务开始,2表示任务进行中,3表示任务已完成
public
$
type
=
null
;
// string, 操作类型,目前分别有:sync_user(增量更新成员) replace_user(全量覆盖成员) replace_party(全量覆盖部门)
public
$
total
=
null
;
// uint, 任务运行总条数
public
$
percentage
=
null
;
// uint, 目前运行百分比,当任务完成时为100
public
$
result
=
null
;
// 参考文档
}
// BatchJobResult
class
Batch {
static
public
function
CheckBatchJobArgs
(
$
batchJobArgs
)
{
Utils::
checkNotEmptyStr
(
$
batchJobArgs
->
media_id
,
"
media_id
"
);
}
static
public
function
Array2BatchJobResult
(
$
arr
)
{
$
batchJobResult
=
new
BatchJobResult
();
$
batchJobResult
->
status
= utils::
arrayGet
(
$
arr
,
"
status
"
);
$
batchJobResult
->
type
= utils::
arrayGet
(
$
arr
,
"
type
"
);
$
batchJobResult
->
total
= utils::
arrayGet
(
$
arr
,
"
total
"
);
$
batchJobResult
->
percentage
= utils::
arrayGet
(
$
arr
,
"
percentage
"
);
$
batchJobResult
->
result
= utils::
arrayGet
(
$
arr
,
"
result
"
);
return
$
batchJobResult
;
}
static
public
function
IsJobFinished
(
$
batchJobResult
)
{
return
!
is_null
(
$
batchJobResult
->
status
) &&
$
batchJobResult
->
status
== BatchJobResult::
STATUS_FINISHED
;
}
}
// class Batch
Back
|
FazBrowse Home
|
New Git URL