From 8c2b1e4b74c2c64c60779cbafc739fffbefdb265 Mon Sep 17 00:00:00 2001 From: wlx Date: Tue, 26 Nov 2013 13:53:20 +0000 Subject: [PATCH] merge heihedata branch to trunk from r4110 to r4111 --- application/module/Open/Source.php | 61 ++++++++++++++----- .../module/Order/Manager/Offlineapp.php | 20 +++--- 2 files changed, 56 insertions(+), 25 deletions(-) diff --git a/application/module/Open/Source.php b/application/module/Open/Source.php index 51e82760..49730998 100644 --- a/application/module/Open/Source.php +++ b/application/module/Open/Source.php @@ -50,8 +50,13 @@ class Source "code"=>"code" ); - if($this->website == 'westdc'){ + //新浪微博(新浪通行证) + $this->source->sina = new stdClass(); + $this->source->sina->param = array( + ); + + if($this->website == 'westdc'){ $this->source->escience->config = array( 'id' => '71852', 'secret' => 'ad7gd3jZgbzhQM6vIh9vPnQFZQoTGHZI', @@ -61,11 +66,9 @@ class Source 'theme'=>'full' ) ); - } if($this->website == 'heihedata'){ - $this->source->escience->config = array( 'id' => '78969', 'secret' => 'iTGKdCkUPakA2hza2TJ4XZ4cnwlh8Hqz', @@ -75,9 +78,48 @@ class Source 'theme'=>'full' ) ); - } + if($this->website == 'card'){ + $this->source->escience->config = array( + 'id' => '58176', + 'secret' => 'ZM5dEFX5GpJC62IcJ3iajx51T9hzhJkQ', + 'index' => 'http://card.westgis.ac.cn/', + 'callback' => 'http://card.westgis.ac.cn/account/callback/type/escience', + 'other' => array( + 'theme'=>'full' + ) + ); + } + + } + + //Oauth2登录目标 + /* + name : 名称 + code : 获取code的url + token : 获取 token的url + code_response : 获取token时使用的参数值(配合$this->source->OBJECTIVE->param中的code_response使用 + grant_type : 获得token的认证方式,按照oauth2标准,应该是authorization_code + */ + private function initTarget(){ + //中国科技网通行证 + $this->target->escience = array( + 'name' => '中国科技网通行证', + 'code' => 'http://passport.escience.cn/oauth2/authorize', + 'token' => 'https://passport.escience.cn/oauth2/token', + 'code_response' => 'code', + 'grant_type' => 'authorization_code', + ); + + //新浪 + $this->target->sina = array( + 'name' => '新浪微博', + 'code' => 'https://api.weibo.com/oauth2/authorize', + 'token' => '', + 'code_response' => 'code', + 'grant_type' => 'authorization_code' + ); } //获得一个源 @@ -96,17 +138,6 @@ class Source } } - //Oauth2登录目标 - private function initTarget(){ - $this->target->escience = array( - 'name' => '中国科技网通行证', - 'code' => 'http://passport.escience.cn/oauth2/authorize', - 'token' => 'https://passport.escience.cn/oauth2/token', - 'code_response' => 'code', - 'grant_type' => 'authorization_code', - ); - } - //获得Oauth2登录模板 public function getTarget($type = "") { diff --git a/application/module/Order/Manager/Offlineapp.php b/application/module/Order/Manager/Offlineapp.php index 099692d2..15a15168 100644 --- a/application/module/Order/Manager/Offlineapp.php +++ b/application/module/Order/Manager/Offlineapp.php @@ -75,15 +75,15 @@ class Offlineapp "; $rs = $this->db->query($sql); return $rs->fetchAll(); - }// - - //判断是否存在wsn数据申请 - public function hasWsnData($id) - { - $sql="select count(d.id) as wsn from dataorder d left join dataservice s on d.uuid=s.uuid where d.offlineappid=$id and s.service_type in (1,2) and position('waterwsn' in s.service_url)>0 and d.selection is not null"; - $rs=$this->db->query($sql); - $row=$rs->fetch(); - return $row['wsn']; + }// + + //判断是否存在wsn数据申请 + public function hasWsnData($id) + { + $sql="select count(d.id) as wsn from dataorder d left join dataservice s on d.uuid=s.uuid where d.offlineappid=$id and s.service_type in (1,2) and position('waterwsn' in s.service_url)>0 and d.selection is not null"; + $rs=$this->db->query($sql); + $row=$rs->fetch(); + return $row['wsn']; } //重置申请表 @@ -100,7 +100,7 @@ class Offlineapp @unlink($row['applicationform']); } - if($this->db->exec("UPDATE offlineapp SET applicationform=NULL WHERE id=$id")>0) + if($this->db->exec("UPDATE offlineapp SET applicationform=NULL,status=2 WHERE id=$id")>0 && $this->db->exec("UPDATE dataorder SET status=2 WHERE offlineappid=$id")) { @$this->events()->trigger('offlineapp.AppFormReseted', $this, compact('id')); return true;