Commit 2662808c authored by clone's avatar clone

bug

parent fdc1ba60
...@@ -31,19 +31,19 @@ class Activity extends Basic ...@@ -31,19 +31,19 @@ class Activity extends Basic
public function saveActivity() public function saveActivity()
{ {
$params = $this->params; $params = $this->params;
/*$params = array( /*$params = array(
//'id' => 1, //'id' => 1,
'title' => '活动1', 'title' => '活动1',
'return_type' => '1', 'return_type' => '1',
'money' => '1121', 'money' => '1121',
'return_action' => '0', 'return_action' => '0',
'activity_start_time' => time(), 'activity_start_time' => time(),
'activity_end_time' => time(), 'activity_end_time' => time(),
'use_period' => 30, 'use_period' => 30,
'total' => 100, 'total' => 100,
'available' => 1, 'available' => 1,
'activity_rule' => '加拉时间的发送去问问人情味', 'activity_rule' => '加拉时间的发送去问问人情味',
);*/ );*/
$checkResult = $this->validate($params, "ActivityValidate.create"); $checkResult = $this->validate($params, "ActivityValidate.create");
if (true !== $checkResult) { if (true !== $checkResult) {
return $this->response("101", $checkResult); return $this->response("101", $checkResult);
...@@ -58,10 +58,10 @@ class Activity extends Basic ...@@ -58,10 +58,10 @@ class Activity extends Basic
$total = $params["total"]; $total = $params["total"];
$available = $params["available"]; $available = $params["available"];
$activity_rule = $params["activity_rule"]; $activity_rule = $params["activity_rule"];
if(($return_action == 0 || $return_action == 1) && $return_type != 0){ if (($return_action == 0 || $return_action == 1) && $return_type != 0) {
return $this->response("101", "奖励动作为首次或邀请登陆,奖励类型必须为返现红包"); return $this->response("101", "奖励动作为首次或邀请登陆,奖励类型必须为返现红包");
} }
if( $return_type == 1 && $use_period > 0){ if ($return_type == 1 && $use_period > 0) {
return $this->response("101", "奖励类型为现金的奖励有效期必须为永久"); return $this->response("101", "奖励类型为现金的奖励有效期必须为永久");
} }
...@@ -116,7 +116,10 @@ class Activity extends Basic ...@@ -116,7 +116,10 @@ class Activity extends Basic
} }
$where_["status"] = array("neq", 4); $where_["status"] = array("neq", 4);
$list = $activityModel->getActivityList($field, $where_, $pageNo, $pageSize); $list = $activityModel->getActivityList($field, $where_, $pageNo, $pageSize);
return $this->response("200", "success", $list); $count = $activityModel->getActivityCount($field, $where_);
$result["list"] = $list;
$result["total"] = $count;
return $this->response("200", "success", $result);
} }
......
...@@ -89,6 +89,20 @@ class CActivity extends Model ...@@ -89,6 +89,20 @@ class CActivity extends Model
return $result; return $result;
} }
/**
* @param $field
* @param $params
* @return int|string
*/
public function getActivityCount($field,$params)
{
$result = $this->db_
->field($field)
->where($params)
->count();
return $result;
}
/** /**
* 更新 * 更新
* @param $activity_id * @param $activity_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment