|
@@ -19,15 +19,8 @@ class content_config
|
|
|
|
|
|
abstract class UGContent
|
|
|
{
|
|
|
- protected $mItemId;
|
|
|
public function __construct($content)
|
|
|
{
|
|
|
- $item_id = intval($content['item_id']);
|
|
|
- if($item_id > 0) {
|
|
|
- $this->mItemId = $item_id;
|
|
|
- } else {
|
|
|
- $this->mItemId = 0;
|
|
|
- }
|
|
|
}
|
|
|
public function base_info()
|
|
|
{
|
|
@@ -39,18 +32,14 @@ abstract class UGContent
|
|
|
|
|
|
return $param;
|
|
|
}
|
|
|
- public function item_id() {
|
|
|
- return $this->mItemId;
|
|
|
- }
|
|
|
|
|
|
public abstract function format_block();
|
|
|
public abstract function is_vote();
|
|
|
- public abstract function vote_result();
|
|
|
|
|
|
protected function item_data($show_type, $show_data, $title='', $type='', $data='', $reserved='')
|
|
|
{
|
|
|
$result['home1_title'] = $title;
|
|
|
- $result['image'] = $show_data;
|
|
|
+ $result['image'] = $show_data;
|
|
|
$result['show_type'] = $show_type;
|
|
|
$result['show_data'] = $show_data;
|
|
|
$result['type'] = $type;
|
|
@@ -99,9 +88,6 @@ class pics_item extends UGContent
|
|
|
public function is_vote() {
|
|
|
return false;
|
|
|
}
|
|
|
- public function vote_result() {
|
|
|
- return [];
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
class text_item extends UGContent
|
|
@@ -124,9 +110,6 @@ class text_item extends UGContent
|
|
|
public function is_vote() {
|
|
|
return false;
|
|
|
}
|
|
|
- public function vote_result() {
|
|
|
- return [];
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
class goods_item extends UGContent
|
|
@@ -142,9 +125,6 @@ class goods_item extends UGContent
|
|
|
public function is_vote() {
|
|
|
return false;
|
|
|
}
|
|
|
- public function vote_result() {
|
|
|
- return [];
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
class voice_item extends UGContent
|
|
@@ -160,21 +140,20 @@ class voice_item extends UGContent
|
|
|
public function is_vote() {
|
|
|
return false;
|
|
|
}
|
|
|
- public function vote_result() {
|
|
|
- return [];
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
class video_item extends UGContent
|
|
|
{
|
|
|
private $mTitle;
|
|
|
private $mVideo;
|
|
|
+ private $mImage;
|
|
|
|
|
|
public function __construct($content)
|
|
|
{
|
|
|
parent::__construct($content);
|
|
|
$this->mTitle = empty($content['title']) ? "" : $content['title'];
|
|
|
$this->mVideo = $content['video'];
|
|
|
+ $this->mImage = $content['cover'];
|
|
|
}
|
|
|
public function set_images($images)
|
|
|
{
|
|
@@ -186,11 +165,11 @@ class video_item extends UGContent
|
|
|
|
|
|
public function format_block()
|
|
|
{
|
|
|
- $image = $this->video();
|
|
|
- if($image == false) return false;
|
|
|
+ $url = $this->video();
|
|
|
+ if($url == false) return false;
|
|
|
|
|
|
$params = $this->base_info();
|
|
|
- $params['item_data'] = $this->item_data('video',$image,$this->mTitle);
|
|
|
+ $params['item_data'] = $this->item_data('image',$this->mImage,$this->mTitle,'video',$this->mVideo);
|
|
|
return $params;
|
|
|
}
|
|
|
|
|
@@ -202,9 +181,6 @@ class video_item extends UGContent
|
|
|
public function is_vote() {
|
|
|
return false;
|
|
|
}
|
|
|
- public function vote_result() {
|
|
|
- return [];
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
class vote_item extends UGContent
|
|
@@ -238,7 +214,8 @@ class vote_item extends UGContent
|
|
|
if($data == false) return false;
|
|
|
|
|
|
$params = $this->base_info();
|
|
|
- $params['item_data'] = $this->item_data('vote','',$this->mTitle,'vote',$data);
|
|
|
+ $reserved = "vote_type={$this->mType}";
|
|
|
+ $params['item_data'] = $this->item_data('vote','',$this->mTitle,'vote',$data,$reserved);
|
|
|
return $params;
|
|
|
}
|
|
|
|
|
@@ -264,6 +241,9 @@ class vote_item extends UGContent
|
|
|
}
|
|
|
return serialize($result);
|
|
|
}
|
|
|
+ public function vote_type() {
|
|
|
+ return $this->mType;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class href_item extends UGContent
|
|
@@ -290,9 +270,6 @@ class href_item extends UGContent
|
|
|
public function is_vote() {
|
|
|
return false;
|
|
|
}
|
|
|
- public function vote_result() {
|
|
|
- return [];
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
class question_item extends UGContent
|
|
@@ -309,9 +286,6 @@ class question_item extends UGContent
|
|
|
public function is_vote() {
|
|
|
return false;
|
|
|
}
|
|
|
- public function vote_result() {
|
|
|
- return [];
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
class special_object
|
|
@@ -349,36 +323,21 @@ class special_object
|
|
|
$this->del_items($sp_id);
|
|
|
|
|
|
$item_sort = 0;
|
|
|
- $i = 0;
|
|
|
- $count = count($this->contents);
|
|
|
-
|
|
|
foreach ($this->contents as $item)
|
|
|
{
|
|
|
$data = $item->format_block();
|
|
|
- ++$i;
|
|
|
- if($count == $i) {
|
|
|
- $fLast = true;
|
|
|
- } else {
|
|
|
- $fLast = false;
|
|
|
- }
|
|
|
if($data == false) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
$data['special_id'] = $sp_id;
|
|
|
$data['item_sort'] = $item_sort;
|
|
|
-
|
|
|
$item_id = $this->save_item($item->item_id(),$data);
|
|
|
-
|
|
|
- if($item->is_vote()) {
|
|
|
+ if($item_id != false && $item->is_vote())
|
|
|
+ {
|
|
|
$vote_result = $item->vote_result();
|
|
|
- $this->mb_special->editUserSpecial($this->special_id,['member_id' => $user_id,'special_id' => $sp_id],['has_vote' => 1,'vote_result' => $vote_result]);
|
|
|
- }
|
|
|
-
|
|
|
- if($item_id > 0 && $fLast == false) {
|
|
|
- $item_sort++;
|
|
|
- $this->insert_divider($sp_id,$item_sort);
|
|
|
- $item_sort++;
|
|
|
+ $vote_type = $item->vote_type();
|
|
|
+ $this->mb_special->editUserSpecial($this->special_id,['member_id' => $user_id,'special_id' => $sp_id],['has_vote' => 1,'vote_type' => $vote_type,'vote_result' => $vote_result]);
|
|
|
}
|
|
|
}
|
|
|
|