CheckController.class.php
1.5 KB
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
<?php
/**
* Created by PhpStorm.
* User: zs_anything
* Date: 17/06/27
* @reader zs_anything 2017-06-29
*/
namespace Apicp\Controller\Invite;
use Common\Model\InviteUserModel;
use Common\Service\InviteUserService;
class CheckController extends AbstractController
{
/**
* 管理员批量审批被邀请加入的用户
*/
public function Index_post()
{
$inviteIds = I("post.inviteIds", []);
$checkStatus = I("post.checkStatus", 0, 'intval');
$rejectDesc = I("post.rejectDesc", '');
// 审批结果是否存在
if (!in_array($checkStatus, [InviteUserModel::CHECK_STATUS_PASS, InviteUserModel::CHECK_STATUS_REJECT])) {
E('_ERR_INVITE_INVALID_STATUS');
}
if (count($inviteIds) < 1) {
E(L('_ERR_PARAMS_EMPTY', ['name' => '邀请ID']));
}
if ($checkStatus == InviteUserModel::CHECK_STATUS_REJECT && empty($rejectDesc)) {
E(L('_ERR_PARAMS_EMPTY', ['name' => '驳回理由']));
}
$inviteUserService = new InviteUserService();
$errorTotal = $inviteUserService->batchApprovalInvitee($inviteIds, $checkStatus,
$rejectDesc, $this->_login->user);
// 判断是否有错误
if ($errorTotal > 0) {
$this->_set_error(L('_ERR_INVITE_APPROVAL_FAIL_TOTAL', ['errorTotal' => $errorTotal]));
$this->_result = [
'errorTotal' => $errorTotal
];
return false;
}
return true;
}
}