|
@@ -194,9 +194,31 @@ class Journal extends Core
|
|
|
$this->data['buy_desc'] = $buy['buy_content'];
|
|
|
}
|
|
|
|
|
|
+ if ($this->data['info']['buy'] == 2) {
|
|
|
+ $this->data['buy_list'] = array();
|
|
|
+ return $this->data;
|
|
|
+ }
|
|
|
|
|
|
$this->data['buy_list'] = Dever::db('journal/buy_num')->getAll(array('info_id' => $id));
|
|
|
|
|
|
+ if ($this->data['info']['cash'] <= 0) {
|
|
|
+ $this->data['info']['cash'] = 100000;
|
|
|
+ }
|
|
|
+ if ($this->data['buy_list']) {
|
|
|
+ foreach ($this->data['buy_list'] as $k => $v) {
|
|
|
+ if (!$v['name']) {
|
|
|
+ $this->data['buy_list'][$k]['name'] = '购买' . $v['num'] . '本';
|
|
|
+ }
|
|
|
+
|
|
|
+ $price = $v['num'] * $this->data['info']['cash'];
|
|
|
+ if (!$v['price']) {
|
|
|
+ $this->data['buy_list'][$k]['price'] = $price . '元';
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->data['buy_list'][$k]['cash'] = $price;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return $this->data;
|
|
|
}
|
|
|
|
|
@@ -408,6 +430,10 @@ class Journal extends Core
|
|
|
Dever::alert('请传入正确的小刊ID');
|
|
|
}
|
|
|
|
|
|
+ if (!$buy['name']) {
|
|
|
+ $buy['name'] = '购买' . $buy['num'] . '本';
|
|
|
+ }
|
|
|
+
|
|
|
$user = Dever::db('passport/user')->one($this->data['uid']);
|
|
|
$wechat = Dever::db('passport/wechat')->one(array('uid' => $this->data['uid']));
|
|
|
|
|
@@ -431,8 +457,9 @@ class Journal extends Core
|
|
|
$order_data['type'] = 1;
|
|
|
$order_data['status'] = 1;
|
|
|
$order_data['name'] = $info['name'] . '-' . $buy['name'];
|
|
|
- $order_data['num'] = Dever::input('num', 1);
|
|
|
- $order_data['cash'] = $buy['cash'] * $order_data['num'];
|
|
|
+
|
|
|
+ $order_data['num'] = $buy['num'];
|
|
|
+ $order_data['cash'] = $info['cash'] * $order_data['num'];
|
|
|
|
|
|
$id = Dever::db('journal/order')->insert($order_data);
|
|
|
|
|
@@ -567,6 +594,19 @@ class Journal extends Core
|
|
|
|
|
|
Dever::load('act/lib/subscribe')->submit($this->data['uid'], $journal_id, 2);
|
|
|
|
|
|
+ $score = false;
|
|
|
+ $num = false;
|
|
|
+ if ($order['buy_id'] > 0 && isset($info['product_num']) && $info['product_num'] > 0) {
|
|
|
+ $journal_info = Dever::db('journal/info')->one($journal_id);
|
|
|
+ if ($journal_info && $journal_info['score'] > 0) {
|
|
|
+ $score = $info['product_num'] * $info['score'];
|
|
|
+ } elseif ($journal_info) {
|
|
|
+ $num = $info['product_num'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Dever::score($this->data['uid'], 'dh_journal', '兑换小刊', 'act/lib/score.submit?method=pay&type=4&id=' . $journal_id, $score, $num);
|
|
|
+
|
|
|
} else {
|
|
|
Dever::alert('请输入正确的兑换码');
|
|
|
}
|