|
@@ -351,7 +351,7 @@ class UserService implements UserServiceInterface
|
|
|
*/
|
|
|
public function addRole(array $data) :array
|
|
|
{
|
|
|
-// Db::beginTransaction();
|
|
|
+ Db::beginTransaction();
|
|
|
try{
|
|
|
$data['sort'] = intval($data['sort'])??0;
|
|
|
Role::insertGetId($data);
|
|
@@ -361,9 +361,9 @@ class UserService implements UserServiceInterface
|
|
|
'type'=>1
|
|
|
];
|
|
|
RoleLog::insertGetId($logData);
|
|
|
-// Db::commit();
|
|
|
+ Db::commit();
|
|
|
} catch(\Throwable $ex){
|
|
|
-// Db::rollBack();
|
|
|
+ Db::rollBack();
|
|
|
return Result::error("新增失败",0);
|
|
|
}
|
|
|
return Result::success([]);
|