From 1431f433d1e4fd02a0f9ae856345e1b20b0f8613 Mon Sep 17 00:00:00 2001
From: HFO4 <912394456@qq.com>
Date: Tue, 6 Feb 2018 17:08:16 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5=E8=83=8C?=
=?UTF-8?q?=E6=99=AF=E9=80=82=E5=BA=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
application/index/model/B2.php | 72 +++++++++++++++++++++++++
application/index/view/index/index.html | 2 +-
static/css/mdb.css | 5 +-
3 files changed, 77 insertions(+), 2 deletions(-)
create mode 100644 application/index/model/B2.php
diff --git a/application/index/model/B2.php b/application/index/model/B2.php
new file mode 100644
index 00000000..bc5bfc43
--- /dev/null
+++ b/application/index/model/B2.php
@@ -0,0 +1,72 @@
+policy = $policy;
+ $akInfo = explode(":",$this->policy["ak"]);
+ $this->ak = $akInfo[0];
+ if(time()-$akInfo[1]>=86000){
+ $this->updateAuth();
+ }
+ }
+
+ private function updateAuth(){
+ $credentials = base64_encode($this->ak . ":" . $this->policy["sk"]);
+ $url = "https://api.backblazeb2.com/b2api/v1/b2_authorize_account";
+ $session = curl_init($url);
+ $headers = array();
+ $headers[] = "Accept: application/json";
+ $headers[] = "Authorization: Basic " . $credentials;
+ curl_setopt($session, CURLOPT_HTTPHEADER, $headers);
+ curl_setopt($session, CURLOPT_HTTPGET, true);
+ curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false); //不验证证书
+ curl_setopt($session, CURLOPT_SSL_VERIFYHOST, false); //不验证证书
+ $server_output = curl_exec($session);
+ curl_close ($session);
+ $authInfo = json_decode($server_output,true);
+ Db::name("policy")->where("id",$this->policy["id"])
+ ->update([
+ "ak" => $this->ak . ":" . time(),
+ "op_name" => $authInfo["apiUrl"],
+ "url" => $authInfo["downloadUrl"],
+ "op_pwd" => $authInfo["authorizationToken"],
+ ]);
+ $this->policy = Db::name("policy")->where("id",$this->policy["id"])->find();
+ $this->updateUploadAuth();
+ }
+
+ private function updateUploadAuth(){
+ $session = curl_init($this->policy["op_name"] . "/b2api/v1/b2_get_upload_url");
+ $data = array("bucketId" => $this->policy["bucketname"]);
+ $post_fields = json_encode($data);
+ curl_setopt($session, CURLOPT_POSTFIELDS, $post_fields);
+ $headers = array();
+ $headers[] = "Authorization: " . $this->policy["op_pwd"];
+ curl_setopt($session, CURLOPT_HTTPHEADER, $headers);
+ curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false); //不验证证书
+ curl_setopt($session, CURLOPT_SSL_VERIFYHOST, false); //不验证证书
+ curl_setopt($session, CURLOPT_POST, true);
+ curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
+ $server_output = curl_exec($session);
+ curl_close ($session);
+ $authInfo = json_decode($server_output,true);
+ Db::name("policy")->where("id",$this->policy["id"])
+ ->update([
+ "server" => $authInfo["uploadUrl"] . "|" . $authInfo["authorizationToken"],
+ ]);
+ $this->policy = Db::name("policy")->where("id",$this->policy["id"])->find();
+ die("");
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/application/index/view/index/index.html b/application/index/view/index/index.html
index e5b495e2..def77020 100644
--- a/application/index/view/index/index.html
+++ b/application/index/view/index/index.html
@@ -3,7 +3,7 @@
-

+
diff --git a/static/css/mdb.css b/static/css/mdb.css
index 57f1e0de..6c0fc0ff 100644
--- a/static/css/mdb.css
+++ b/static/css/mdb.css
@@ -1 +1,4 @@
-.intro-page .navbar:not(.top-nav-collapse){background:0 0!important;box-shadow:none}.full-height,.full-height body,.full-height header,.full-height header .view{height:100%}.intro-page .navbar:not(.top-nav-collapse){background:0 0!important;box-shadow:none}.creative-lp .navbar{background-color:#6d7275}.grey-skin .navbar{background-color:#7d8488}.navbar{font-weight:300}.navbar.navbar-dark .navbar-brand{color:#fff}.navbar .navbar-brand{-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;overflow:visible}.full-height,.full-height body,.full-height header,.full-height header .view{height:100%}header .view{position:relative;width:100%;height:auto;background-repeat:no-repeat;background-position:center center;-webkit-background-size:cover;-moz-background-size:cover;background-size:cover;-o-background-size:cover}header .view{position:relative;width:100%;height:auto;background-repeat:no-repeat;background-position:center center;background-size:cover}.view{overflow:hidden;position:relative;cursor:default}.creative-lp .hm-gradient .full-bg-img{background:-moz-linear-gradient(45deg,rgba(153,122,226,.6),rgba(3,3,4,.6) 100%);background:-webkit-linear-gradient(45deg,rgba(153,122,226,.6),rgba(3,3,4,.6) 100%);background:linear-gradient(to 45deg,rgba(153,122,226,.6),rgba(3,3,4,.6) 100%)}.full-bg-img{height:100%;width:100%;position:absolute;overflow:hidden;top:0;left:0}.card .card-circle,.card-overlay,.flex-center,.section.team-section .avatar,.testimonial-carousel .testimonial .avatar{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:100%}.white-text{color:#FFF!important}.brand-name{font-size:4.5rem}.font-bold{font-weight:500}.mb-2{margin-bottom:1.5rem!important}.hr-streak hr.hr-light,.intro hr.hr-light,.intro-video hr.hr-light{margin-left:31%;margin-right:31%;background-color:#fff;height:1px}.hr-streak hr,.intro hr,.intro-video hr{margin:1.5rem 0 1.5rem 0}.hr-light{background-color:#fff;height:.5px}.subtext-header{line-height:1.5}.btn-light-green-2{background:#00bfa5}.btn-rounded{-webkit-border-radius:10em;-moz-border-radius:10em;-ms-border-radius:10em;-o-border-radius:10em;border-radius:10em!important}.btn{border-radius:2px;border:0;transition:.2s ease-out;color:#fff!important;margin:6px;white-space:normal!important;word-wrap:break-word;text-transform:uppercase}.btn{font-size:.8rem;padding:.85rem 2.13rem}.badge,.btn,.btn-floating,.card,.card-cascade-2 .card-block,.card-cascade.wider .card-block,.card-wrapper .back,.card-wrapper .front,.cascading-media .view,.chip,.dropdown-content,.dropdown-menu,.jumbotron,.list-group,.modal-dialog.cascading-modal .modal-c-tabs .nav-tabs,.modal-dialog.modal-notify .modal-header,.navbar,.navbar .nav-item .dropdown-menu.dropdown a:active,.navbar .nav-item .dropdown-menu.dropdown a:focus,.navbar .nav-item .dropdown-menu.dropdown a:hover,.pager li a,.pagination .active .page-link,.popover,.pricing-card .price .version,.social-list,.top-nav-collapse,.z-depth-1{box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}.btn,.btn-floating{transition:.5s}
\ No newline at end of file
+.intro-page .navbar:not(.top-nav-collapse){background:0 0!important;box-shadow:none}.full-height,.full-height body,.full-height header,.full-height header .view{height:100%}.intro-page .navbar:not(.top-nav-collapse){background:0 0!important;box-shadow:none}.creative-lp .navbar{background-color:#6d7275}.grey-skin .navbar{background-color:#7d8488}.navbar{font-weight:300}.navbar.navbar-dark .navbar-brand{color:#fff}.navbar .navbar-brand{-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;overflow:visible}.full-height,.full-height body,.full-height header,.full-height header .view{height:100%}header .view{position:relative;width:100%;height:auto;background-repeat:no-repeat;background-position:center center;-webkit-background-size:cover;-moz-background-size:cover;background-size:cover;-o-background-size:cover}header .view{position:relative;width:100%;height:auto;background-repeat:no-repeat;background-position:center center;background-size:cover}.view{overflow:hidden;position:relative;cursor:default}.creative-lp .hm-gradient .full-bg-img{background:-moz-linear-gradient(45deg,rgba(153,122,226,.6),rgba(3,3,4,.6) 100%);background:-webkit-linear-gradient(45deg,rgba(153,122,226,.6),rgba(3,3,4,.6) 100%);background:linear-gradient(to 45deg,rgba(153,122,226,.6),rgba(3,3,4,.6) 100%)}.full-bg-img{height:100%;width:100%;position:absolute;overflow:hidden;top:0;left:0}.card .card-circle,.card-overlay,.flex-center,.section.team-section .avatar,.testimonial-carousel .testimonial .avatar{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:100%}.white-text{color:#FFF!important}.brand-name{font-size:4.5rem}.font-bold{font-weight:500}.mb-2{margin-bottom:1.5rem!important}.hr-streak hr.hr-light,.intro hr.hr-light,.intro-video hr.hr-light{margin-left:31%;margin-right:31%;background-color:#fff;height:1px}.hr-streak hr,.intro hr,.intro-video hr{margin:1.5rem 0 1.5rem 0}.hr-light{background-color:#fff;height:.5px}.subtext-header{line-height:1.5}.btn-light-green-2{background:#00bfa5}.btn-rounded{-webkit-border-radius:10em;-moz-border-radius:10em;-ms-border-radius:10em;-o-border-radius:10em;border-radius:10em!important}.btn{border-radius:2px;border:0;transition:.2s ease-out;color:#fff!important;margin:6px;white-space:normal!important;word-wrap:break-word;text-transform:uppercase}.btn{font-size:.8rem;padding:.85rem 2.13rem}.badge,.btn,.btn-floating,.card,.card-cascade-2 .card-block,.card-cascade.wider .card-block,.card-wrapper .back,.card-wrapper .front,.cascading-media .view,.chip,.dropdown-content,.dropdown-menu,.jumbotron,.list-group,.modal-dialog.cascading-modal .modal-c-tabs .nav-tabs,.modal-dialog.modal-notify .modal-header,.navbar,.navbar .nav-item .dropdown-menu.dropdown a:active,.navbar .nav-item .dropdown-menu.dropdown a:focus,.navbar .nav-item .dropdown-menu.dropdown a:hover,.pager li a,.pagination .active .page-link,.popover,.pricing-card .price .version,.social-list,.top-nav-collapse,.z-depth-1{box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}.btn,.btn-floating{transition:.5s}
+.intro-video{
+ background-image: url(/static/img/output.jpg);
+}
\ No newline at end of file