Skip to content

Commit

Permalink
新增项目设置,新增开放API
Browse files Browse the repository at this point in the history
  • Loading branch information
star7th committed Jan 15, 2017
1 parent 49fe140 commit f447dea
Show file tree
Hide file tree
Showing 60 changed files with 1,789 additions and 33 deletions.
10 changes: 9 additions & 1 deletion Application/Home/Controller/ItemController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function add(){
}
return ;
}
if ($item_id > 0 ) {
if ($item_id > 0 ) {
$data = array(
"item_name" => $item_name ,
"item_domain" => $item_domain ,
Expand Down Expand Up @@ -433,5 +433,13 @@ public function itemList(){
$this->sendResult($items);
}

public function setting(){
$login_user = $this->checkLogin();
$item_id = I("item_id/d");
$uid = $login_user['uid'] ;
$this->checkItemPermn($uid , $item_id) ;
$this->assign("item_id",$item_id);
$this->display();
}

}
12 changes: 12 additions & 0 deletions Application/Home/Controller/UpdateController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ public function sqlite(){
)";
D("UserToken")->execute($sql);

//创建item_token表
$sql = "CREATE TABLE IF NOT EXISTS `item_token` (
`id` INTEGER PRIMARY KEY ,
`item_id` int(11) NOT NULL DEFAULT '0' ,
`api_key` CHAR(200) NOT NULL UNIQUE ,
`api_token` CHAR(200) NOT NULL ,
`addtime` int(11) NOT NULL DEFAULT '0' ,
`last_check_time` int(11) NOT NULL DEFAULT '0'
)";
D("UserToken")->execute($sql);



echo 'OK!';
}
Expand Down
2 changes: 1 addition & 1 deletion Application/Home/Model/ItemModel.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function import($json,$uid,$item_name= '',$item_description= '',$item_pas
unset($json);
if ($item) {
if ($item['item_domain']) {
$item2 = D("Item")->where("item_domain = '$item[item_domain]' ")->find();
$item2 = D("Item")->where("item_domain = '%s' ".array($item['item_domain']))->find();
if ($item2) {
//个性域名已经存在
return false;
Expand Down
6 changes: 5 additions & 1 deletion Application/Home/Model/UserTokenModel.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public function createToken($uid,$token_expire = 0 ){
}

public function getToken($token){
return $this->where("token='$token'")->find();
return $this->where("token='%s'",array($token))->find();
}

public function setLastTime($token){
return $this->where("token='%s'",array($token))->save(array("last_check_time"=>time()));
}
}
1 change: 1 addition & 0 deletions Application/Home/View/Common/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<script src="__PUBLIC__/js/common/jquery.min.js"></script>
<script src="__PUBLIC__/bootstrap/js/bootstrap.min.js"></script>
<script src="__PUBLIC__/js/common/showdoc.js?v=1.1"></script>
<script src="__PUBLIC__/layer/layer.js"></script>
<div style="display:none">
{:C("STATS_CODE")}
</div>
Expand Down
1 change: 1 addition & 0 deletions Application/Home/View/Common/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
var DocConfig = {
host: window.location.origin,
app: "{:U('/')}",
server: "server/index.php?s=",
pubile:"__PUBLIC__",
}

Expand Down
Loading

0 comments on commit f447dea

Please sign in to comment.