/** * Handle a registration request for the application. * * @param Request $request * @return \Illuminate\Http\Response */ public function postRegister(Requests\Auth\RegisterRequest $request) { /*$validator = $this->registrar->validator($request->all()); if ($validator->fails()) { $this->throwValidationException( $request, $validator ); }*/ $user = $this->registrar->create($request->all()); $this->auth->login($user); \ProfileService::createProfile($request, $user['id']); return redirect('/'); }
$ret = $loginService->DoLogin(); if ($ret) { $ucid = $ret['ucid']; $st = $ret['st']; } else { exit; } //call get_trans_info method of profile service $parameter = array(); if (QUERY_TRANS_TYPE == 'url') { $parameter['url'] = TRANS_URL; } else { if (QUERY_TRANS_TYPE == 'name') { $parameter['name'] = TRANS_NAME; } } $parameterJSON = json_encode($parameter); $profile = new ProfileService(); $ret = $profile->get_trans_info($ucid, $st, $parameterJSON); $retHead = $ret['retHead']; $retBody = $ret['retBody']; if (!$retHead || !$retBody) { exit; } $retBodyArray = json_decode($retBody, TRUE); $transInfo = json_decode($retBodyArray['responseData'], TRUE); var_dump($transInfo); //doLogout, please doLogout after call DataApi services if (isset($ret['ucid']) && isset($ret['st'])) { $loginService->DoLogout($ucid, $st); }
$userAuth = json_decode($request->headers->get('Authorization')); $profileService = new ProfileService(); echo json_encode($profileService->getUserLevel($userAuth->id)); } }); $app->get('/score', function () { if (accessIsOK()) { $request = \Slim\Slim::getInstance()->request(); $userAuth = json_decode($request->headers->get('Authorization')); $profileService = new ProfileService(); echo json_encode($profileService->getTotalScore($userAuth->id)); } }); $app->get('/maxlevel', function () { if (accessIsOK()) { $profileService = new ProfileService(); echo json_encode($profileService->getMaxLevel()); } }); }); $app->get('/activities', function () { if (accessIsOK()) { $request = \Slim\Slim::getInstance()->request(); $userAuth = json_decode($request->headers->get('Authorization')); $activityService = new ActivityLogService(); echo json_encode($activityService->findAll($userAuth->id)); } }); $app->get('/activity/:id', function ($id) { if (accessIsOK()) { $activityService = new ActivityLogService();
<?php $cwd = dirname(__FILE__); $ipath = "/include"; while ($cwd != "/") { if (file_exists($cwd . $ipath . "/findVLE.php")) { set_include_path($cwd . $ipath . PATH_SEPARATOR . $cwd . $ipath . "/PowerTLA" . PATH_SEPARATOR . get_include_path()); break; } $cwd = dirname($cwd); } require_once "findVLE.php"; $service = new ProfileService(); $service->run();
<?php ProfileService::apiDefinition($apis, $enginepath, "profile.php"); ClientService::apiDefinition($apis, $enginepath, "client.php");
require_once 'Config.php'; $loginService = new LoginService(); //preLogin if (!$loginService->PreLogin()) { exit; } //doLogin $ret = $loginService->DoLogin(); if ($ret) { $ucid = $ret['ucid']; $st = $ret['st']; } else { exit; } //call getsites method of profile service $profile = new ProfileService(); $ret = $profile->getsites($ucid, $st); $retHead = $ret['retHead']; $retBody = $ret['retBody']; if (!$retHead || !$retBody) { exit; } /* * Now, you have successfully call the getsites method of * profile service. You can deal with retHead and retBody * an you need. * For instance:Get quota cost in this call and quota remain * $retHeadArray = json_decode($retHead, TRUE); * print("This call cost quota: ".$retHeadArray['quota']."\r\n"); * print("My account has remain quota: ".$retHeadArray['rquota']."\r\n"); *
/** * 处理个人空间应用 */ private function profile() { $service = new ProfileService(); $result = $service->invoke($this->commonUri); echo json_encode($result); }
/** * @Post("/profile/{id}/upload", as="profiles.upload") */ public function store(ProfileRequest $request) { \ProfileService::uploadImage($request, $this->profile); return \Redirect::to('/profile'); }
/** * Update the specified resource in storage. * * @param User $user * @param Requests\UserRequest $request * @return \Illuminate\Http\RedirectResponse */ public function update(User $user, Requests\UserRequest $request) { $data = $request->all(); // If no one checkbox was checked we need to set 'roleCheck' as empty array to avoid error if (!array_key_exists('roleCheck', $data)) { $data['roleCheck'] = []; } if ($user->update($data)) { $user->roles()->sync($data['roleCheck']); \ProfileService::updateProfile($request, $user->profile); } \Session::flash('message', 'Пользователь обновлен'); $page = $request->page; return redirect($page); }