public function doSubmit(Request $request, $id)
 {
     /* @var Project $project */
     $project = Project::find($id);
     if (!$project) {
         return redirect('backend/admin/project');
     }
     if ($project) {
         $status = ProjectStatus::where('key', '=', 'faculty')->first();
         $project->status()->associate($status)->save();
     }
     return redirect('/backend/project');
 }
Ejemplo n.º 2
0
 public function postCoverUpload(Request $request)
 {
     $content = $request->getContent();
     $requestUri = $request->getRequestUri();
     $authorization = @base64_decode($request->server('HTTP_AUTHORIZATION'));
     $ossPubKeyUrl = @base64_decode($request->server('HTTP_X_OSS_PUB_KEY_URL'));
     $pubKey = @file_get_contents($ossPubKeyUrl);
     $pos = strpos($requestUri, '?');
     if (false === $pos) {
         $authString = urldecode($requestUri) . "\n" . $content;
     } else {
         $authString = urldecode(substr($requestUri, 0, $pos)) . substr($requestUri, $pos, strlen($requestUri) - $pos) . "\n" . $content;
     }
     if ($pubKey && openssl_verify($authString, $authorization, $pubKey, OPENSSL_ALGO_MD5)) {
         try {
             $id = decrypt($request->input('identifier'));
             $project = Project::find($id);
             $config = config('aliyun.oss.archimore');
             $oss = new OssClient($config['access_key_id'], $config['access_key_secret'], $config['endpoint'], $config['is_cname'], $config['security_token']);
             $project->cover && $oss->deleteObject('archimore', $project->cover);
             $project->cover = $request->input('object');
             $project->save();
             $data = ['status' => true, 'message' => '上传并保存成功', 'cover' => oss_image_url($project->cover, '400x250')];
         } catch (\Exception $e) {
             $data = ['status' => false, 'message' => '保存失败'];
         }
     } else {
         $data = ['status' => false, 'message' => '上传失败'];
     }
     $data = json_encode($data);
     return response($data, 200, ['Content-Type' => 'application/json', 'Content-Length' => strlen($data)]);
 }
 public function doSaveMap(Request $request, $projectId)
 {
     $project_form = $request->get('project');
     $project = Project::find($projectId);
     if (!$project) {
         return redirect('backend/admin/project');
     }
     $project->geojson = $project_form['geojson'];
     $project->save();
     return redirect("/backend/admin/project/{$projectId}/edit/sixth");
 }
Ejemplo n.º 4
0
 public function previewProject(Request $request, $id, $role)
 {
     $project = Project::find($id);
     return view('backends.project.preview')->with('project', $project)->with('previewRole', $role);
 }