public function AppLogout($user) { FuegoLog::getLog()->LogInfo("APP logout..."); $condition['user_id'] = $user['user_id']; $tokenDao = MispDaoContext::Token(); $result = MispCommonService::Delete($tokenDao, $condition); FuegoLog::getLog()->LogInfo("Delete token success."); return MispErrorCode::SUCCESS; }
static function Delete($userID) { $errorCode = MispErrorCode::SUCCESS; FuegoLog::getLog()->LogInfo("delete user..."); $systemUserDao = MispDaoContext::SystemUser(); $condition['user_id'] = $userID; try { $result = MispCommonService::Delete($systemUserDao, $condition); } catch (FuegoException $e) { $errorCode = $e->getCode(); } return $errorCode; }
public function Delete() { $Req = $this->GetReqObj(); $this->LogInfo("customer delete, customer_id is " . $Req->obj); //删除会员信息 $customerDao = $this->GetModel(); $customerCondition[$customerDao->getPk()] = $Req->obj; try { $result = MispCommonService::Delete($customerDao, $customerCondition); } catch (FuegoException $e) { $this->errorCode = $e->getCode(); $this->ReturnJson(); return; } //删除用户信息 $this->errorCode = MispCommonUserService::Delete($Req->obj); $this->ReturnJson(); }
public function Delete() { $Req = $this->GetReqObj(); $this->LogInfo("delete order, order id is " . $Req->obj); $condition['order_id'] = $Req->obj; $orderDetailDao = LaundryDaoContext::OrderDetail(); try { $result = MispCommonService::Delete($orderDetailDao, $condition); } catch (FuegoException $e) { $this->errorCode = $e->getCode(); $this->ReturnJson(); return; } parent::Delete(); }
public function Delete() { $Req = $this->GetReqObj(); $this->LogInfo("admin delete, user_id is " . $Req->obj); if ($Req->obj == $_SESSION['user']['user_id']) { $this->LogWarn("Delete admin failed, can not delete yourself."); $this->errorCode = MispErrorCode::CANT_DELETE_YOURSELF; $this->ReturnJson(); return; } //删除管理员信息 $adminDao = $this->GetModel(); $adminCondition[$adminDao->getPk()] = $Req->obj; try { $result = MispCommonService::Delete($adminDao, $adminCondition); } catch (FuegoException $e) { $this->errorCode = $e->getCode(); $this->ReturnJson(); return; } //删除用户信息 $this->errorCode = MispCommonUserService::Delete($Req->obj); $this->ReturnJson(); }
public function DeleteModel($model) { $this->LogInfo("delete"); $condition[$model->getPk()] = $this->GetObj(); try { $result = MispCommonService::Delete($model, $condition); } catch (FuegoException $e) { $this->errorCode = $e->getCode(); } $this->ReturnJson(); }
public function Login() { $Req = $this->GetReqObj(); $req = $this->GetCommonData(); $reqType = $this->GetReqType(); $this->LogInfo("User login, Client type is " . $reqType); $user['user_name'] = $req->user_name; $user['password'] = $req->password; if ($reqType == ClientTypeEnum::IOS || $reqType == ClientTypeEnum::ANDROID) { //APP客户端登陆验证 $data = null; $user['company_id'] = $Req->app_id; $this->LogInfo("Login client type is " . $reqType . ",company_id is " . $Req->app_id); //验证用户与登录密码 try { $orignalUser = MispCommonUserService::LoginValidate($user); } catch (FuegoException $e) { $this->errorCode = $e->getCode(); return $this->ReturnJson(); } //获取用户APP登录权限 $privilegeResult = MispCommonDataService::GetRolePrivilege($orignalUser, PrivilegeEnum::ACCESS_TYPE_LOGIN, PrivilegeEnum::ACCESS_VALUE_APP_LOGIN); if (false == $privilegeResult) { //用户不存在APP登录权限 $this->LogWarn("Get role privilege failed.The user don't have APP login privilege, login failed."); $this->errorCode = MispErrorCode::USERNAME_OR_PASSWORD_WRONG; return $this->ReturnJson(); } else { //获取登录权限成功 $this->LogInfo("Get user login privilege success. The user have APP login privilege."); //判断是否已经在其他设备登录 $condition['user_id'] = $orignalUser['user_id']; $tokenDao = MispDaoContext::Token(); $tokenCount = $tokenDao->where($condition)->count(); $this->LogInfo("Token count is " . $tokenCount); if ($tokenCount > 0) { //用户已在其他设备登录,删除已有token $this->LogInfo("The user has login in other device, user name is " . $orignalUser['user_name']); try { $result = MispCommonService::Delete($tokenDao, $condition); $this->LogInfo("Delete orginal token success."); } catch (FuegoException $e) { $this->LogWarn("Delete orginal token failed."); $this->LogWarn("Customer APPLogin failed"); $this->errorCode = MispErrorCode::ERROR_LOGIN_FAILED; $this->ReturnJson(); return; } } //APP登录成功 $data = MispServiceContext::UserManage()->AppLogin($orignalUser); } $this->ReturnJson($data); } if ($reqType == ClientTypeEnum::WEB) { //WEB端登陆验证 //验证用户与登录密码 try { $orignalUser = MispCommonUserService::LoginValidate($user); } catch (FuegoException $e) { $this->errorCode = $e->getCode(); return $this->ReturnJson(); } $privilegeResult = MispCommonDataService::GetRolePrivilege($orignalUser, PrivilegeEnum::ACCESS_TYPE_LOGIN, PrivilegeEnum::ACCESS_VALUE_WEB_LOGIN); if (false == $privilegeResult) { //用户不存在WEB登录权限 $this->LogWarn("Get role privilege failed. The user don't have WEB login privilege, login failed."); $this->errorCode = MispErrorCode::USERNAME_OR_PASSWORD_WRONG; } else { //WEB登录成功 $this->LogInfo("Get user login privilege success. The user have WEB login privilege."); $this->errorCode = MispServiceContext::UserManage()->WebLogin($orignalUser); } } $this->ReturnJson(); }