/** * * 获取需要的条件 */ private function get_condition() { $Members = new members(); if ($this->user['user_id'] || $this->input['member_id']) { $this->member_id = $this->input['member_id'] ? intval($this->input['member_id']) : ($this->user['user_id'] ? $this->user['user_id'] : 0); if (!$Members->checkuser($this->member_id)) { $this->errorOutput(NO_MEMBER); } } elseif (!$this->member_id) { $this->errorOutput(NO_MEMBER_ID); } if ($this->input['mark']) { $this->mark = trim($this->input['mark']); $memberMySet = new memberMySet(); if (!$memberMySet->count(array('mark' => $this->mark))) { $this->errorOutput(MARK_ERROR); } } else { $this->errorOutput(NO_MARK_ERROR); } if ($this->input['total']) { $this->total = trim($this->input['total']); if (!is_numeric($this->total)) { $this->errorOutput(TOTAL_ERROR); } $this->total = (int) $this->total; } if ($this->input['math']) { if (intval($this->input['math']) == 1) { $this->math[total] = '+'; } elseif (intval($this->input['math']) == 2) { $this->math[total] = '-'; } } if ($this->input['totalsum']) { $this->totalsum = trim($this->input['totalsum']); if (!is_numeric($this->totalsum)) { $this->errorOutput(TOTAL_ERROR); } $this->totalsum = (int) $this->totalsum; } if (intval($this->input['summath']) == 1) { $this->math[totalsum] = '+'; } elseif (intval($this->input['summath']) == 2) { $this->math[totalsum] = '-'; } }
public function getMySetBind() { $BindMsid = array(); try { $BindMsid = $this->memberMyFieldBind->getBindMsid(); $info = memberMySet::show($BindMsid, 0, 0, 'id as msid,title as mstitle', 'msid'); } catch (Exception $e) { $this->errorOutput($e->getMessage(), $e->getCode()); } foreach ((array) $info as $k => $v) { $this->addItem($v); } $this->output(); }
/** * * 获取需要的条件 */ private function get_condition() { //搜索标签 if ($this->input['searchtag_id']) { $searchtag = $this->searchtag_detail(intval($this->input['searchtag_id'])); foreach ((array) $searchtag['tag_val'] as $k => $v) { if (in_array($k, array('_id'))) { //防止左边栏分类搜索无效 continue; } $this->input[$k] = $v; } } //搜索标签 if (isset($this->input['k']) && !empty($this->input['k']) || (trim($this->input['key']) || trim(urldecode($this->input['key'])) == '0')) { if (isset($this->input['k']) && !empty($this->input['k'])) { $key = trim($this->input['k']); } elseif (trim($this->input['key']) || trim(urldecode($this->input['key'])) == '0') { $key = trim($this->input['key']); } $binary = ''; //不区分大小些 if (defined('IS_BINARY') && !IS_BINARY) { $binary = 'binary '; } $condition .= ' AND ' . $binary . ' title like \'%' . $key . '%\''; $memberMySet = new memberMySet(); $markInfo = $memberMySet->show($condition, 0, 0, 'mark', 'mark', '', 0); $this->memberMyData->setParams('mark', $markInfo, 'myd'); } else { $this->input['mark'] && ($TParams = $this->memberMyData->setMark(trim($this->input['mark']))); if ($TParams == -3) { $this->errorOutput(PROHIBIT_CN); } elseif ($TParams == -4) { $this->errorOutput(MARK_CHARACTER_ILLEGAL); } elseif ($TParams == -5) { $this->errorOutput(MARK_ERROR); } else { if (trim($this->input['mark']) == $TParams) { $this->memberMyData->setParams('mark', null, 'myd'); } } } $this->memberMyData->setJoin(' LEFT JOIN ' . DB_PREFIX . 'member_myset as mms ON myd.mark=mms.mark'); if (isset($this->input['member_name']) && ($member_name = trimall($this->input['member_name']))) { $members = new members(); $member_id = $members->get_member_id($member_name, false); $member_id && $this->memberMyData->setParams('member_id', $member_id, 'myd'); !$member_id && $this->errorOutput(NO_MEMBER); } $this->memberMyData->setJoin(' LEFT JOIN ' . DB_PREFIX . 'member as m ON myd.member_id=m.member_id'); if (isset($this->input['search']) && ($search = $this->input['search'])) { $this->memberMyData->setParamType('search', 'fuzzy', 1, 'myd'); $this->memberMyData->setParams('search', $search, 'myd'); } if ($this->input['start_time']) { $start_time = strtotime(trim(urldecode($this->input['start_time']))); $condition = " AND myd.create_time >= " . $start_time; $this->memberMyData->setSql()->where($condition); } if ($this->input['end_time']) { $end_time = strtotime(trim(urldecode($this->input['end_time']))); $condition = " AND myd.create_time <= " . $end_time; $this->memberMyData->setSql()->where($condition); } if (isset($this->input['date_search']) && !empty($this->input['date_search'])) { $today = strtotime(date('Y-m-d')); $tomorrow = strtotime(date('y-m-d', TIMENOW + 24 * 3600)); switch (intval($this->input['date_search'])) { case 1: //所有时间段 break; case 2: //昨天的数据 $yesterday = strtotime(date('y-m-d', TIMENOW - 24 * 3600)); $condition = " AND myd.create_time > '" . $yesterday . "' AND myd.create_time < '" . $today . "'"; $this->memberMyData->setSql()->where($condition); break; case 3: //今天的数据 $condition = " AND myd.create_time > '" . $today . "' AND myd.create_time < '" . $tomorrow . "'"; $this->memberMyData->setSql()->where($condition); break; case 4: //最近3天 $last_threeday = strtotime(date('y-m-d', TIMENOW - 2 * 24 * 3600)); $condition = " AND myd.create_time > '" . $last_threeday . "' AND myd.create_time < '" . $tomorrow . "'"; $this->memberMyData->setSql()->where($condition); break; case 5: //最近7天 $last_sevenday = strtotime(date('y-m-d', TIMENOW - 6 * 24 * 3600)); $condition = " AND myd.create_time > '" . $last_sevenday . "' AND myd.create_time < '" . $tomorrow . "'"; $this->memberMyData->setSql()->where($condition); break; default: //所有时间段 break; } } $this->memberMyData->setAs('myd'); }
public function setMFcountAll(array $delret, $type) { $memberMySet = new memberMySet(); foreach ($delret as $v) { $memberMySet->setMFcount($v['msid'], 1, $type); } return true; }