|
@@ -17,9 +17,6 @@ class Journal_v1 extends Core
|
|
|
$this->data['cate'] = $cate;
|
|
|
}
|
|
|
|
|
|
- $cateList = Dever::db('journal/cate')->getAll();
|
|
|
- $this->data['cateList'] = $cateList;
|
|
|
-
|
|
|
return $cate;
|
|
|
}
|
|
|
|
|
@@ -34,30 +31,65 @@ class Journal_v1 extends Core
|
|
|
|
|
|
$cate = $this->getCate();
|
|
|
|
|
|
- $time = time();
|
|
|
- $day = (7 * 86400);
|
|
|
-
|
|
|
|
|
|
$where = array();
|
|
|
if (isset($cate['id'])) {
|
|
|
$where['cate_id'] = $cate['id'];
|
|
|
}
|
|
|
- if ($this->app) {
|
|
|
- $where['cate_id_1'] = 1;
|
|
|
- $where['time'] = $time - $day;
|
|
|
-
|
|
|
+ if (isset($cate['journal_id'])) {
|
|
|
+ $this->data['push'] = Dever::db('journal/info')->getOne($cate['journal_id']);
|
|
|
+ } else {
|
|
|
|
|
|
- $this->data['push'] = Dever::db('journal/info')->getNew($where);
|
|
|
+ $this->data['push'] = Dever::db('journal/info')->getNew();
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
- if (isset($cate['journal_id'])) {
|
|
|
- $this->data['push'] = Dever::db('journal/info')->getOne($cate['journal_id']);
|
|
|
- } else {
|
|
|
-
|
|
|
- $this->data['push'] = Dever::db('journal/info')->getNew();
|
|
|
+ $this->data['push'] = $this->ding($this->data['push']);
|
|
|
+
|
|
|
+
|
|
|
+ $data = Dever::db('journal/info')->getAllByPage($where);
|
|
|
+
|
|
|
+ if ($data) {
|
|
|
+ $this->data['button'] = array();
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ $data[$k] = $this->info($v);
|
|
|
+ $data[$k] = $this->getButton($data[$k]);
|
|
|
}
|
|
|
+
|
|
|
+ $this->data['journal'] = $data;
|
|
|
+ } else {
|
|
|
+ $this->data['journal'] = array();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ return $this->data;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public function getAppList()
|
|
|
+ {
|
|
|
+ $data = array();
|
|
|
+
|
|
|
+ if ($data) {
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
+ $cate = $this->getCate();
|
|
|
+
|
|
|
+
|
|
|
+ $where = array();
|
|
|
+ if (isset($cate['id'])) {
|
|
|
+ $where['cate_id'] = $cate['id'];
|
|
|
+ }
|
|
|
+ $cateList = Dever::db('journal/cate')->getAll();
|
|
|
+ $this->data['cateList'] = $cateList;
|
|
|
+
|
|
|
+ $time = time();
|
|
|
+ $day = (7 * 86400);
|
|
|
+
|
|
|
+ $where['cate_id_1'] = 1;
|
|
|
+ $where['time'] = $time - $day;
|
|
|
+
|
|
|
+
|
|
|
+ $this->data['push'] = Dever::db('journal/info')->getNew($where);
|
|
|
|
|
|
$this->data['push'] = $this->ding($this->data['push']);
|
|
|
|
|
@@ -65,9 +97,13 @@ class Journal_v1 extends Core
|
|
|
$data = Dever::db('journal/info')->getAllByPage($where);
|
|
|
|
|
|
if ($data) {
|
|
|
+ $this->data['button'] = array();
|
|
|
foreach ($data as $k => $v) {
|
|
|
$data[$k] = $this->info($v);
|
|
|
+ $data[$k] = $this->getButton($data[$k]);
|
|
|
+ $data[$k] = $this->getAppSet($data[$k]);
|
|
|
}
|
|
|
+
|
|
|
$this->data['journal'] = $data;
|
|
|
} else {
|
|
|
$this->data['journal'] = array();
|
|
@@ -113,7 +149,7 @@ class Journal_v1 extends Core
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
public function view()
|
|
|
{
|
|
|
$id = $this->check();
|
|
@@ -123,7 +159,7 @@ class Journal_v1 extends Core
|
|
|
return $this->data;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
private function button($info)
|
|
|
{
|
|
|
$this->data['button'] = array();
|
|
@@ -290,6 +326,143 @@ class Journal_v1 extends Core
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public function subscribe()
|
|
|
+ {
|
|
|
+ if (!$this->data['uid']) {
|
|
|
+ Dever::alert('错误的用户信息');
|
|
|
+ }
|
|
|
+ $this->check();
|
|
|
+ $subscribe = Dever::load('act/lib/subscribe')->get($this->data['info']['id'], $this->data['uid'], 4);
|
|
|
+
|
|
|
+ return array('subscribe' => $subscribe);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public function getView()
|
|
|
+ {
|
|
|
+ $this->check();
|
|
|
+ $this->data['button'] = array();
|
|
|
+ $this->data['info'] = $this->getButton($this->info($this->data['info'], false));
|
|
|
+
|
|
|
+ return $this->data;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private function getButton($info)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $info['active'] = $info['top'];
|
|
|
+
|
|
|
+ if ($info['active'] == 1) {
|
|
|
+ $this->setButton('share', 1);
|
|
|
+ } else {
|
|
|
+ $this->setButton('share', -1);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($info['buy'] == 2) {
|
|
|
+
|
|
|
+ $this->setButton('read', 1);
|
|
|
+ $this->setButton('buy', -1);
|
|
|
+ $this->setButton('share', -1);
|
|
|
+ } else {
|
|
|
+ if ($info['ytype'] == 2) {
|
|
|
+
|
|
|
+ $this->setButton('read', 3);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ $this->setButton('read', 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->setButton('buy', 1);
|
|
|
+
|
|
|
+
|
|
|
+ if (checkVersion()->journal_buy == 2) {
|
|
|
+ $this->setButton('buy', -1);
|
|
|
+ $this->setButton('share', -1);
|
|
|
+ }
|
|
|
+ */
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $applet_type = Dever::input('applet_type');
|
|
|
+ if ($applet_type == 2 && isset($this->data['config']['ios_pay']) && $this->data['config']['ios_pay'] == 1 && $info['buy'] == 1) {
|
|
|
+ $this->setButton('buy', -1);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ $info['button'] = $this->data['button'];
|
|
|
+
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public function getAppView()
|
|
|
+ {
|
|
|
+ $this->info();
|
|
|
+
|
|
|
+ $this->data['info'] = $this->getAppSet($this->data['info']);
|
|
|
+
|
|
|
+ return $this->data;
|
|
|
+ }
|
|
|
+
|
|
|
+ private function getAppSet($info)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (isset($info['share_content'])) {
|
|
|
+ $source = Dever::db('source/info')->one(1);
|
|
|
+ $info['share_link'] = $source['code'];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $info['vip_state'] = 1;
|
|
|
+ $info['code_state'] = 1;
|
|
|
+ $version_code = Dever::input('version_code');
|
|
|
+ if ($version_code) {
|
|
|
+ $source_type = Dever::input('source_type');
|
|
|
+ $version_where['source_type'] = $source_type;
|
|
|
+ $version_where['name'] = $version_code;
|
|
|
+ $version = Dever::db('main/version')->getOne($version_where);
|
|
|
+ if ($version && $version['vip'] > 0) {
|
|
|
+ $info['vip_state'] = $version['vip'];
|
|
|
+ $info['code_state'] = $version['button'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $info['vip'] = 2;
|
|
|
+ $vip = Dever::load('vip/lib/member')->get($this->data['uid'], $info['cate_id']);
|
|
|
+ if ($vip > 0) {
|
|
|
+ $info['subscribe'] = 1;
|
|
|
+ $info['vip'] = 1;
|
|
|
+ $this->setButton('read', 1);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $user = Dever::db('passport/user')->one($this->data['uid']);
|
|
|
+ if ($user && $user['mobile']) {
|
|
|
+ $mobileWhere['mobile'] = $user['mobile'];
|
|
|
+ $mobileWhere['product_id'] = $info['id'];
|
|
|
+ $mobile = Dever::db('journal/mobile')->one($mobileWhere);
|
|
|
+ if ($mobile) {
|
|
|
+ $info['subscribe'] = 1;
|
|
|
+ $this->setButton('read', 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ */
|
|
|
+
|
|
|
+ if ($this->source_type == 'ios' && $info['id'] == 26) {
|
|
|
+ $this->setButton('share', -1);
|
|
|
+ }
|
|
|
+
|
|
|
+ $info['button'] = $this->data['button'];
|
|
|
+
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public function buy()
|
|
|
{
|
|
@@ -360,8 +533,8 @@ class Journal_v1 extends Core
|
|
|
return $this->data;
|
|
|
}
|
|
|
|
|
|
- $time = time();
|
|
|
|
|
|
+ $time = time();
|
|
|
if ($this->data['active'] && $time >= $this->data['active']['start'] && $time < $this->data['active']['end']) {
|
|
|
$this->data['active']['status'] = 1;
|
|
|
} else {
|