AuthorityDelController.class.php
1.17 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
<?php
/**
* 权限范围删除
* AbstractController.class.php
* $author$
*/
namespace Apicp\Controller\Integral;
use Common\Service\AuthorityMainService;
use Common\Service\AuthorityService;
class AuthorityDelController extends AbstractController
{
public function index()
{
$amId = I('post.am_id');
if (empty($amId)) {
L('_ERR_PARAMS_CAN_NOT_EMPTY', ['name' => '要删除的ID']);
}
// 删除
try {
$authorityMainServ = new AuthorityMainService();
$haveAuthorityService = new AuthorityService();
$authorityMainServ->start_trans();
$haveAuthorityService->start_trans();
$authorityMainServ->delete_by_conds(['am_id' => $amId]);
$haveAuthorityService->delete_by_conds(['am_id' => $amId]);
$authorityMainServ->commit();
$haveAuthorityService->commit();
} catch (\Exception $e) {
$authorityMainServ->rollback();
$haveAuthorityService->rollback();
// 不影响主流程
\Think\Log::record('删除出错:' . var_export($e->getMessage()));
}
return true;
}
}