|
@@ -10,6 +10,7 @@ class Act
|
|
|
$this->type = Dever::input('type');
|
|
|
$this->type_id = Dever::input('type_id');
|
|
|
$this->db = Dever::db($name, 'place');
|
|
|
+ $this->app = Dever::config('setting')['type'][$this->type];
|
|
|
}
|
|
|
|
|
|
protected function check()
|
|
@@ -40,14 +41,21 @@ class Act
|
|
|
}
|
|
|
|
|
|
# 获取用户互动相关的信息
|
|
|
- public function getInfo($data = array())
|
|
|
+ public function getInfo($data = array(), $field = array())
|
|
|
{
|
|
|
$this->check();
|
|
|
$this->data = $data;
|
|
|
$this->data['type'] = $this->type;
|
|
|
$this->data['type_id'] = $this->type_id;
|
|
|
$this->data['uid'] = Place::$uid;
|
|
|
- return $this->db->find($this->data);
|
|
|
+ return $this->handleInfo($this->db->find($this->data), $field);
|
|
|
+ }
|
|
|
+
|
|
|
+ # 获取详情页
|
|
|
+ public function getView($field = array())
|
|
|
+ {
|
|
|
+ $info = $this->getInfo(array(), $field);
|
|
|
+ return Dever::load('order', $this->app)->getView($info);
|
|
|
}
|
|
|
|
|
|
# 评论列表
|
|
@@ -84,36 +92,8 @@ class Act
|
|
|
$result = array();
|
|
|
if ($data) {
|
|
|
foreach ($data as $k => $v) {
|
|
|
- $info = $this->getTypeInfo($v['type'], $v['type_id']);
|
|
|
+ $info = $this->handleInfo($v, $field);
|
|
|
if ($info) {
|
|
|
- $info['status_name'] = $this->db->value('status', $v['status']);
|
|
|
- $info['type'] = $v['type'];
|
|
|
- $info['type_id'] = $v['id'];
|
|
|
- //$info['cdate'] = $v['cdate'];
|
|
|
- $info['cdate_str'] = date('Y-m-d H:i:s', $v['cdate']);
|
|
|
- if ($field) {
|
|
|
- foreach ($field as $v1) {
|
|
|
- $info[$v1] = $v[$v1];
|
|
|
- }
|
|
|
- }
|
|
|
- if (strstr($this->db->config['load'], 'order')) {
|
|
|
- $info['cash'] = Dever::load('price', 'place')->getText($info['cash'], $info['type']);
|
|
|
- if ($v['type'] == 3) {
|
|
|
- $info['detail'] = Dever::load('order', 'goods')->getDetail($v['id']);
|
|
|
- $info['info'] = '共' . intval($info['num']) . '件商品';
|
|
|
- } else {
|
|
|
- $detail['id'] = $info['id'];
|
|
|
- $detail['name'] = $info['name'];
|
|
|
- $detail['pic'] = $info['pic'];
|
|
|
- $detail['sku_name'] = '';
|
|
|
- $detail['sku_id'] = 0;
|
|
|
- $detail['cash'] = $info['cash'];
|
|
|
- $detail['num'] = $info['num'];
|
|
|
- $info['detail'][] = $detail;
|
|
|
- $info['info'] = '';
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
$result[] = $info;
|
|
|
}
|
|
|
}
|
|
@@ -132,4 +112,42 @@ class Act
|
|
|
return $info;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private function handleInfo($v, $field = array())
|
|
|
+ {
|
|
|
+ if (!$v) {
|
|
|
+ return array();
|
|
|
+ }
|
|
|
+ $info = $this->getTypeInfo($v['type'], $v['type_id']);
|
|
|
+ if ($info) {
|
|
|
+ $info['status_name'] = $this->db->value('status', $v['status']);
|
|
|
+ $info['type'] = $v['type'];
|
|
|
+ $info['type_id'] = $v['id'];
|
|
|
+ //$info['cdate'] = $v['cdate'];
|
|
|
+ $info['cdate_str'] = date('Y-m-d H:i:s', $v['cdate']);
|
|
|
+ if ($field) {
|
|
|
+ foreach ($field as $v1) {
|
|
|
+ $info[$v1] = $v[$v1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($this->db->config['load'] == 'place/order') {
|
|
|
+ $info['cash'] = Dever::load('price', 'place')->getText($info['cash'], $info['type']);
|
|
|
+ if ($v['type'] == 3) {
|
|
|
+ $info['detail'] = Dever::load('order', $this->app)->getDetail($v['id']);
|
|
|
+ $info['info'] = '共' . intval($info['num']) . '件商品';
|
|
|
+ } else {
|
|
|
+ $detail['id'] = $info['id'];
|
|
|
+ $detail['name'] = $info['name'];
|
|
|
+ $detail['pic'] = $info['pic'];
|
|
|
+ $detail['sku_name'] = '';
|
|
|
+ $detail['sku_id'] = 0;
|
|
|
+ $detail['cash'] = $info['cash'];
|
|
|
+ $detail['num'] = $info['num'];
|
|
|
+ $info['detail'][] = $detail;
|
|
|
+ $info['info'] = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|