|
@@ -9,16 +9,17 @@ class Handle
|
|
|
public function showUrl($id)
|
|
|
{
|
|
|
$info = Dever::db('short/info')->one($id);
|
|
|
- $type = Dever::db('short/type')->one($info['type']);
|
|
|
+ $type = Dever::db('short/type')->one($info['type_id']);
|
|
|
+ $host = Dever::db('short/host')->one($info['host_id']);
|
|
|
|
|
|
- return $type['host'] . Dever::uid($id);
|
|
|
+ return $host['name'] . Dever::uid($id);
|
|
|
}
|
|
|
|
|
|
- public function get($type, $url, $param, $host = '')
|
|
|
+ public function get($host, $url, $param, $host = '')
|
|
|
{
|
|
|
$param = json_encode($param);
|
|
|
- $where['type'] = $type;
|
|
|
- $type = Dever::db('short/type')->one($type);
|
|
|
+ $where['host_id'] = $host;
|
|
|
+ $host = Dever::db('short/host')->one($host);
|
|
|
$where['key'] = md5($url . '?' . $param);
|
|
|
|
|
|
$info = Dever::db('short/info')->one($where);
|
|
@@ -31,10 +32,10 @@ class Handle
|
|
|
$id = Dever::db('short/info')->insert($where);
|
|
|
}
|
|
|
if ($host) {
|
|
|
- $type['host'] = $host;
|
|
|
+ $host['name'] = $host;
|
|
|
}
|
|
|
|
|
|
- return $type['host'] . Dever::uid($id);
|
|
|
+ return $host['name'] . Dever::uid($id);
|
|
|
}
|
|
|
|
|
|
public function show($str)
|