|
|
@@ -6,6 +6,8 @@ use App\Model\Depart;
|
|
|
use App\Model\Employee;
|
|
|
use App\Model\EmployeeDepartPermission;
|
|
|
use App\Model\EmployeeRole;
|
|
|
+use App\Model\ItemNodeMissionDetails;
|
|
|
+use App\Model\ItemNodeMissionShare;
|
|
|
use App\Model\Role;
|
|
|
use App\Model\RoleMenu;
|
|
|
use App\Model\RoleMenuButton;
|
|
|
@@ -71,6 +73,36 @@ class LoginService extends Service
|
|
|
]];
|
|
|
}
|
|
|
|
|
|
+ public function shareLogin($data){
|
|
|
+ if(empty($data['account'])) return [false, '账号不能为空'];
|
|
|
+ if(empty($data['password'])) return [false, '密码不能为空'];
|
|
|
+ if(empty($data['share_token'])) return [false, '分享链接不能为空'];
|
|
|
+
|
|
|
+ $account = $data['account'];
|
|
|
+ $password = $data['password'];
|
|
|
+ $employee = Employee::where('del_time',0)
|
|
|
+ ->where('account', $account)
|
|
|
+ ->first();
|
|
|
+ if(empty($employee)) return [false,'账号不存在或已被删除'];
|
|
|
+ $employee = $employee->toArray();
|
|
|
+
|
|
|
+ if(! Hash::check($password, $employee['password'])) return [false,'密码错误'];
|
|
|
+ if($employee['is_admin'] != Employee::IS_ADMIN_ZERO) return [false, '账号限制登录'];
|
|
|
+
|
|
|
+ list($status, $msg) = (new ItemService())->shareCheck($data['share_token'], $employee['id']);
|
|
|
+ if(! $status) return [false, $msg];
|
|
|
+
|
|
|
+ //生成token
|
|
|
+ list($status, $jwtToken) = TokenService::getToken($employee);
|
|
|
+ if(! $status) return [false, $jwtToken];
|
|
|
+
|
|
|
+ return [true, [
|
|
|
+ 'token' => $jwtToken,
|
|
|
+ 'employee_id' => $employee['id'],
|
|
|
+ 'title' => $employee['title'],
|
|
|
+ ]];
|
|
|
+ }
|
|
|
+
|
|
|
private function getPersonRoleForSysMenuList($employee_id) {
|
|
|
$sysMenu = SysMenu::where('del_time',0)
|
|
|
->where('type', SysMenu::type_zero)
|