Skip to content

Commit

Permalink
v1.2版本发布
Browse files Browse the repository at this point in the history
  • Loading branch information
szvone committed Oct 16, 2018
1 parent f97a9bb commit 3183716
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions application/index/controller/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function upImg(){
Cache::set("SinaPass","");
Cache::set("key","123456");
Cache::set("type","1");
Cache::set("SinaUpdateTime",time());
}

$key = Cache::get("key");
Expand Down
9 changes: 9 additions & 0 deletions application/util/SinaApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ public static function Upload() {
self::sinaLogin(Cache::get("SinaUser"),Cache::get("SinaPass"));
}

if (!Cache::get("SinaUpdateTime")){
Cache::set("SinaUpdateTime",time());
}
$UpdateTime = time() - Cache::get("SinaUpdateTime");
//1小时自动更新一次cookie
if($UpdateTime > 3600){
self::sinaLogin(Cache::get("SinaUser"),Cache::get("SinaPass"));
}

// Curl提交
$ch = curl_init($url);
curl_setopt_array($ch, array(
Expand Down

0 comments on commit 3183716

Please sign in to comment.