|
@@ -59,7 +59,7 @@ class Api extends Core
|
|
|
$data['info']['platform_name'] = $info['name'];
|
|
|
$data['info']['qrcode'] = $data['info']['name'] = $data['info']['price'] = $data['info']['s_price'] = '';
|
|
|
|
|
|
- $code = $this->getCode($this->id, $this->parent_page_id, $this->page_id, $index, $this->times, $this->uid);
|
|
|
+ $code = $this->getCode($this->id, $this->parent_page_id, $this->page_id, $index, $this->times, $this->day, $this->uid);
|
|
|
$url .= '?code=' . $code;
|
|
|
|
|
|
$data['info']['qrcode'] = $this->qrcode($url, $content_id);
|
|
@@ -191,6 +191,7 @@ class Api extends Core
|
|
|
$page_id = $record['page_id'];
|
|
|
$times = $record['times_id'];
|
|
|
$index = $record['index'];
|
|
|
+ $day = $record['day'];
|
|
|
} else {
|
|
|
# 获取最新的章节页id
|
|
|
$page_where['info_id'] = $data['info']['id'];
|
|
@@ -201,17 +202,18 @@ class Api extends Core
|
|
|
$parent_page_id = $page[0]['page_id'];
|
|
|
$page_id = $page[0]['id'];
|
|
|
} else {
|
|
|
- Dever::alret('内容还没有准备好');
|
|
|
+ Dever::alert('内容还没有准备好');
|
|
|
}
|
|
|
$times = 0;
|
|
|
if ($this->times) {
|
|
|
$times = $this->times;
|
|
|
}
|
|
|
$index = 0;
|
|
|
+ $day = 0;
|
|
|
}
|
|
|
|
|
|
# 获取code
|
|
|
- $data['code'] = $this->getCode($data['info']['id'], $parent_page_id, $page_id, $index, $times);
|
|
|
+ $data['code'] = $this->getCode($data['info']['id'], $parent_page_id, $page_id, $index, $times, $day);
|
|
|
}
|
|
|
|
|
|
return $data;
|
|
@@ -272,7 +274,12 @@ class Api extends Core
|
|
|
{
|
|
|
$where['id'] = Dever::input('product_id');
|
|
|
$table = Dever::input('table');
|
|
|
- $data['product'] = Dever::db($table)->one($where);
|
|
|
+ if ($table) {
|
|
|
+ $data['product'] = Dever::db($table)->one($where);
|
|
|
+ } else {
|
|
|
+ $data['product']['goods_id'] = $where['id'];
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
if ($data['product'] && isset($data['product']['goods_id']) && $data['product']['goods_id'] > 0) {
|
|
|
$data['product']['goods'] = Dever::load('goods/lib/info')->getInfo($data['product']['goods_id']);
|
|
@@ -351,6 +358,8 @@ class Api extends Core
|
|
|
$data['cur'] = $this->times;
|
|
|
$data['times'] = Dever::db('collection/times')->main($where);
|
|
|
if ($data['times']) {
|
|
|
+ $where['uid'] = $this->uid;
|
|
|
+ $data['user_times'] = Dever::db('collection/user_times')->getData($where);
|
|
|
foreach ($data['times'] as $k => $v) {
|
|
|
$where['times_id'] = $v['id'];
|
|
|
$data['times'][$k]['child'] = Dever::db('collection/times')->child($where);
|
|
@@ -368,7 +377,12 @@ class Api extends Core
|
|
|
$page = Dever::db('collection/page')->getOne($where);
|
|
|
if ($page) {
|
|
|
# 获取code
|
|
|
- $data['code'] = $this->getCode($this->id, $page['page_id'], $page['id'], 0, $page['times_id']);
|
|
|
+ $this->day = $day = Dever::input('day', 0);
|
|
|
+ $data['code'] = $this->getCode($this->id, $page['page_id'], $page['id'], 0, $page['times_id'], $day);
|
|
|
+
|
|
|
+ # 记录选择的时光id和日期
|
|
|
+ $this->recordTimes($page['times_id'], $day);
|
|
|
+
|
|
|
return $data;
|
|
|
}
|
|
|
Dever::alert('error');
|
|
@@ -383,6 +397,11 @@ class Api extends Core
|
|
|
$where['parent_page_id'] = $this->parent_page_id;
|
|
|
$where['page_id'] = $this->page_id;
|
|
|
$where['times_id'] = $this->times;
|
|
|
+ if (!$this->day) {
|
|
|
+ $where['day'] = 0;
|
|
|
+ } else {
|
|
|
+ $where['day'] = $this->day;
|
|
|
+ }
|
|
|
$where['content_id'] = Dever::input('content_id');
|
|
|
$where['index'] = Dever::input('index', 0);
|
|
|
if ($record) {
|
|
@@ -395,6 +414,29 @@ class Api extends Core
|
|
|
return 'yes';
|
|
|
}
|
|
|
|
|
|
+ # 记录用户时光选择操作
|
|
|
+ public function recordTimes($times_id, $day)
|
|
|
+ {
|
|
|
+ $where['info_id'] = $this->id;
|
|
|
+ $where['uid'] = $this->uid;
|
|
|
+ $where['times_id'] = $times_id;
|
|
|
+ $record = Dever::db('collection/user_times')->one($where);
|
|
|
+ if (!$day) {
|
|
|
+ $where['day'] = 0;
|
|
|
+ } else {
|
|
|
+ $where['day'] = $day;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($record) {
|
|
|
+ $where['where_id'] = $record['id'];
|
|
|
+ Dever::db('collection/user_times')->update($where);
|
|
|
+ } else {
|
|
|
+ Dever::db('collection/user_times')->insert($where);
|
|
|
+ }
|
|
|
+
|
|
|
+ return 'yes';
|
|
|
+ }
|
|
|
+
|
|
|
public function ding($data)
|
|
|
{
|
|
|
if (isset($data['num_add_buy']) && isset($data['num_ratio_buy'])) {
|