|
@@ -8,6 +8,38 @@
|
|
|
|
|
|
namespace activity;
|
|
|
|
|
|
+class limit_item
|
|
|
+{
|
|
|
+ private $mParam;
|
|
|
+ public function __construct($param)
|
|
|
+ {
|
|
|
+ $this->mParam = null;
|
|
|
+ if(isset($param) && is_array($param))
|
|
|
+ {
|
|
|
+ $this->mParam = $param;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ static private function img_url($value)
|
|
|
+ {
|
|
|
+ return $value;
|
|
|
+ return cthumb($value['goods_image'], 360, $value['store_id']);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function to_array()
|
|
|
+ {
|
|
|
+ $info['xianshi_id'] = intval($this->mParam['xianshi_id']);
|
|
|
+ $info['xianshi_name'] = $this->mParam['xianshi_name'];
|
|
|
+ $info['xianshi_title'] = $this->mParam['xianshi_title'];
|
|
|
+ $info['xianshi_explain'] = $this->mParam['xianshi_explain'];
|
|
|
+ $info['start_time'] = intval($this->mParam['start_time']);
|
|
|
+ $info['end_time'] = intval($this->mParam['end_time']);
|
|
|
+ $info['lower_limit'] = intval($this->mParam['lower_limit']);
|
|
|
+ $info['state'] = intval($this->mParam['state']);
|
|
|
+
|
|
|
+ return $info;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
class limitime
|
|
|
{
|
|
|
const XIANSHI_STATE_NORMAL = 1;
|
|
@@ -64,34 +96,28 @@ class limitime
|
|
|
$this->goodsid_limit = array();
|
|
|
|
|
|
$list = $mod->getXianshiList($condition);
|
|
|
- foreach ($list as $val) {
|
|
|
+ foreach ($list as $val)
|
|
|
+ {
|
|
|
$xianshi_id = intval($val['xianshi_id']);
|
|
|
- $this->limit_list[$xianshi_id] = $this->filter($val);
|
|
|
+ $this->limit_list[$xianshi_id] = $val;
|
|
|
$goods_list = Model('p_xianshi_goods')->getXianshiGoodsList(array('xianshi_id' => $xianshi_id));
|
|
|
foreach ($goods_list as $xianshi_goods) {
|
|
|
- $goods_id = intval($val['goods_id']);
|
|
|
+ $goods_id = intval($xianshi_goods['goods_id']);
|
|
|
$this->goodsid_limit[$goods_id] = $xianshi_goods;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private function filter($val)
|
|
|
- {
|
|
|
- if(!empty($val)) {
|
|
|
- unset($val['xianshi_state_text']);
|
|
|
- unset($val['editable']);
|
|
|
- }
|
|
|
- return $val;
|
|
|
- }
|
|
|
-
|
|
|
public function isTakepart($goods_id,&$act_id)
|
|
|
{
|
|
|
if(array_key_exists(intval($goods_id),$this->goodsid_limit))
|
|
|
{
|
|
|
- $act_id = $this->goodsid_gid[$goods_id];
|
|
|
- $start = $this->group_list[$act_id]['start_time'];
|
|
|
- $end = $this->group_list[$act_id]['end_time'];
|
|
|
+ $limit = $this->goodsid_limit[$goods_id];
|
|
|
+
|
|
|
+ $start = $limit['start_time'];
|
|
|
+ $end = $limit['end_time'];
|
|
|
+ $act_id = intval($limit['xianshi_id']);
|
|
|
|
|
|
$cur = time();
|
|
|
if($cur >= intval($start) && $cur < intval($end)) {
|
|
@@ -107,6 +133,13 @@ class limitime
|
|
|
|
|
|
public function get_info($act_id)
|
|
|
{
|
|
|
-
|
|
|
+ if(array_key_exists($act_id,$this->limit_list)) {
|
|
|
+ $limit = $this->limit_list[$act_id];
|
|
|
+ $item = new limit_item($limit);
|
|
|
+ return $item->to_array();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|