|
@@ -8,6 +8,8 @@ class Core
|
|
|
{
|
|
|
protected $token;
|
|
|
protected $uid;
|
|
|
+ protected $id;
|
|
|
+ protected $id_code;
|
|
|
protected $share_uid = 0;
|
|
|
protected $user;
|
|
|
protected $year;
|
|
@@ -51,13 +53,47 @@ class Core
|
|
|
# 检查内容
|
|
|
protected function checkInfo()
|
|
|
{
|
|
|
- $this->info = Dever::db('collection/info')->one($this->id);
|
|
|
+ $this->info = $this->get($this->id);
|
|
|
if (!$this->info) {
|
|
|
Dever::alert('内容还没有准备好');
|
|
|
}
|
|
|
return $this->info;
|
|
|
}
|
|
|
|
|
|
+ # 获取内容
|
|
|
+ protected function get($id)
|
|
|
+ {
|
|
|
+ $info = Dever::load('collection/lib/info')->num($id);
|
|
|
+ if ($info) {
|
|
|
+ $this->handle($info);
|
|
|
+ }
|
|
|
+
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected function handle(&$info)
|
|
|
+ {
|
|
|
+ # 过滤一些不用的信息
|
|
|
+ unset($info['num_buy']);
|
|
|
+ unset($info['num_ratio_buy']);
|
|
|
+ unset($info['num_add_buy']);
|
|
|
+ unset($info['num_add_view']);
|
|
|
+ unset($info['num_view']);
|
|
|
+ unset($info['buy_price']);
|
|
|
+ unset($info['audit']);
|
|
|
+ unset($info['status']);
|
|
|
+ unset($info['reorder']);
|
|
|
+ unset($info['admin_founder']);
|
|
|
+ unset($info['admin_editor']);
|
|
|
+ unset($info['udate']);
|
|
|
+ unset($info['state']);
|
|
|
+ unset($info['cdate']);
|
|
|
+ unset($info['score_id']);
|
|
|
+ unset($info['score_type']);
|
|
|
+ unset($info['score_name']);
|
|
|
+ $info['id_code'] = Dever::encode($info['id'], $this->key);
|
|
|
+ }
|
|
|
+
|
|
|
# 检查是否可以查看
|
|
|
protected function checkView()
|
|
|
{
|
|
@@ -97,7 +133,12 @@ class Core
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- $this->id = Dever::input('id');
|
|
|
+ $this->id_code = Dever::input('id');
|
|
|
+ if ($this->id_code == -1) {
|
|
|
+ $this->id = $this->id_code;
|
|
|
+ } else {
|
|
|
+ $this->id = Dever::decode($this->id_code, $this->key);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|