Exemplo n.º 1
0
 public function addViewLog($ViewInfo)
 {
     $table_to_process = Base_Widget::getDbTable($this->table);
     //根据记录的时间戳确定所在的分表
     $table_to_process .= "_" . date("Ym", $ViewInfo['Time']);
     return $this->db->insert($table_to_process, $ViewInfo);
 }
Exemplo n.º 2
0
 public function getOnline($StartTime, $EndTime, $ServerId, $oWherePartnerPermission)
 {
     if (($StartTime + $EndTime) / 2 > time()) {
         $Return['AvgOnline'] = 0;
         $Return['LowOnline'] = 0;
         $Return['HighOnline'] = 0;
     } else {
         //查询列
         $select_fields = array('ServerId', 'AvgOnline' => 'avg(CurOnline)', 'LowOnline' => 'min(CurOnline)', 'HighOnline' => 'max(HighestOnline)');
         //初始化查询条件
         $whereStartTime = " Time  >= '" . $StartTime . "' ";
         $whereEndTime = " Time  <= '" . $EndTime . "' ";
         $whereServer = $ServerId ? " ServerId = " . $ServerId . " " : "";
         $whereCondition = array($whereStartTime, $whereEndTime, $whereServer, $oWherePartnerPermission);
         $group_fields = array('ServerId');
         $groups = Base_common::getGroupBy($group_fields);
         //生成查询列
         $fields = Base_common::getSqlFields($select_fields);
         //生成分类汇总列
         $where = Base_common::getSqlWhere($whereCondition);
         $Date = date("Ym", ($StartTime + $EndTime) / 2);
         $table_to_process = Base_Widget::getDbTable($this->table) . "_" . $Date;
         $Return = array('UserCount' => 0, 'OnlineCount' => 0);
         $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where . $groups;
         $Online = $this->db->getAll($sql);
         foreach ($Online as $key => $val) {
             $Return['AvgOnline'] += $val['AvgOnline'];
             $Return['LowOnline'] += $val['LowOnline'];
             $Return['HighOnline'] += $val['HighOnline'];
         }
     }
     return $Return;
 }
Exemplo n.º 3
0
 public function getItemSealList($AppId, $ItemId, $SealTime, $days, $dateType)
 {
     $nowTime = time();
     //初始化查询条件
     $whereAppId = $AppId ? " AppId = '" . $AppId . "' " : "";
     $whereItemId = $ItemId ? " MoneyType in (" . $ItemId . ") " : "";
     $whereStartTime = $SealTime ? " MoneyLogDate = '" . date("Y-m-d", $SealTime) . "' " : "";
     $whereHour = $dateType == "hh" ? " Hour = '" . date("H", $SealTime) . "' " : "";
     $whereReason = " `Reason` != 12 ";
     $whereCondition = array($whereAppId, $whereItemId, $whereStartTime, $whereHour, $whereReason);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     $return = array();
     for ($i = 0; $i < $days; $i++) {
         $table_to_process = Base_Widget::getDbTable($this->table_moneylog_compress) . "_" . date("Ymd", $SealTime);
         $sql = "SELECT `UserId`,`MoneyType` as ItemId,sum(`MoneyChanged`) as ItemNum FROM {$table_to_process} as log where 1 " . $where . " GROUP BY `UserId` , `ItemId`";
         $ItemList = $this->db->getAll($sql);
         foreach ($ItemList as $k => $v) {
             if (isset($return[$v['UserId']][$v['ItemId']])) {
                 $return[$v['UserId']][$v['ItemId']] += $v['ItemNum'];
             } else {
                 $return[$v['UserId']][$v['ItemId']] = $v['ItemNum'];
             }
         }
     }
     return $return;
 }
Exemplo n.º 4
0
 /**
  * 查询全部
  * @param $fields
  * @return array
  */
 public function getAll($fields = "*")
 {
     $table_to_process = Base_Widget::getDbTable($this->table);
     $return = $this->db->select($table_to_process, $fields);
     foreach ($return as $key => $value) {
         $PartnerList[$value['PartnerId']] = $value;
     }
     return $PartnerList;
 }
Exemplo n.º 5
0
 /**
  * 查询全部
  * @param $fields
  * @return array
  */
 public function getAll($fields = "*")
 {
     $table_to_process = Base_Widget::getDbTable($this->table);
     $sql = "SELECT {$fields} FROM {$table_to_process} ORDER BY ResearchId ASC";
     $totalResearch = $this->db->getAll($sql);
     foreach ($totalResearch as $Key => $value) {
         $ResearchList[$value['ResearchId']] = $value;
     }
     return $ResearchList;
 }
Exemplo n.º 6
0
 public function getMailSentUpByMailAddress($StartDate, $EndDate, $MailType)
 {
     //查询列
     $select_fields = array('MailSent' => 'count(*)', 'UserMail');
     //初始化查询条件
     //		$whereStart = $StartDate?" end_date >= '".strtotime($StartDate)."' ":"";
     //		$whereEnd = $EndDate?" end_date <= '".(strtotime($EndDate)+86400-1)."' ":"";
     $whereType = $MailType ? " MailType ='" . $MailType . "' " : "";
     $group_fields = array('UserMail');
     $groups = Base_common::getGroupBy($group_fields);
     $whereCondition = array($whereStart, $whereEnd, $whereType);
     //生成查询列
     $fields = Base_common::getSqlFields($select_fields);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     $StatArr['MailSent'] = array();
     //		foreach($MailFixList as $key => $value)
     //		{
     //			$StatArr['MailSent'][$value['SubFix']] = array('MailSent'=>0,'Detail'=>array());
     //		}
     //初始化结果数组
     $Date = $StartDate;
     $DateStart = date("Ymd", strtotime($StartDate));
     $DateEnd = date("Ymd", strtotime($EndDate));
     $DateList = array();
     $Date = $StartDate;
     do {
         $D = date("Ymd", strtotime($Date));
         $DateList[] = $D;
         $Date = date("Y-m-d", strtotime("{$Date} +1 day"));
     } while ($D != $DateEnd);
     foreach ($DateList as $k => $v) {
         $table_name = Base_Widget::getDbTable($this->table) . "_log_" . $v;
         $sql = "SELECT {$fields} FROM {$table_name} as log where 1 " . $where . $groups;
         $MailSentArr = $this->db->getAll($sql, false);
         foreach ($MailSentArr as $key => $val) {
             $t = explode("@", $val['UserMail']);
             $MailFix = "@" . $t['1'];
             if (isset($StatArr['MailSent'][$MailFix])) {
                 $StatArr['MailSent'][$MailFix]['MailSent'] += $val['MailSent'];
             } else {
                 $StatArr['MailSent'][$MailFix] = array('MailSent' => 0, 'Detail' => array());
                 $StatArr['MailSent'][$MailFix]['MailSent'] += $val['MailSent'];
             }
             if (isset($StatArr['MailSent'][$MailFix]['Detail'][$val['UserMail']])) {
                 $StatArr['MailSent'][$MailFix]['Detail'][$val['UserMail']] += $val['MailSent'];
             } else {
                 $StatArr['MailSent'][$MailFix]['Detail'][$val['UserMail']] = 0;
                 $StatArr['MailSent'][$MailFix]['Detail'][$val['UserMail']] += $val['MailSent'];
             }
         }
     }
     return $StatArr;
 }
Exemplo n.º 7
0
 public function getComplainList($ConditionList, $fields = "*", $order = "desc")
 {
     $table_to_process = Base_Widget::getDbTable($this->table);
     //查询列
     $select_fields = array($fields);
     //初始化查询条件
     $whereStartTime = $ConditionList['StartDate'] ? " time >= " . strtotime($ConditionList['StartDate']) . " " : "";
     $whereEndTime = $ConditionList['EndDate'] ? " time <= " . (strtotime($ConditionList['EndDate']) + 86400) . " " : "";
     $whereQtype = $ConditionList['QtypeId'] ? " qtype = " . $ConditionList['QtypeId'] . " " : "";
     $whereStartTime = $ConditionList['StartTime'] ? " time >= " . $ConditionList['StartTime'] . " " : $whereStartTime;
     $whereEndTime = $ConditionList['EndTime'] ? " time <= " . $ConditionList['EndTime'] . " " : $whereEndTime;
     $t = explode(",", $ConditionList['Public']);
     if (count($t) >= 2) {
         $wherePublic = ' AND public in (' . implode(',', $t) . ')';
     } else {
         $wherePublic = $ConditionList['Public'] >= 0 ? " public = " . $ConditionList['Public'] . " " : "";
     }
     switch ($ConditionList['QuestionStatus']) {
         case 0:
             $whereQuestionStatus = "";
             break;
         case 1:
             $whereQuestionStatus = " status in (0,4)";
             break;
         case 2:
             $whereQuestionStatus = " status in (1,3)";
             break;
         case 3:
             $whereQuestionStatus = " status = 2";
             break;
     }
     $whereCondition = array($whereStartTime, $whereEndTime, $whereQtype, $wherePublic, $whereQuestionStatus);
     //生成查询列
     $fields = Base_common::getSqlFields($select_fields);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     //计算记录数量
     $CountSql = "SELECT count(1) as QuestionNum FROM {$table_to_process} where 1 " . $where;
     $QuestionNum = $this->db->getOne($CountSql);
     //如果记录数量大于页码数量
     if ($QuestionNum >= ($ConditionList['Page'] - 1) * $ConditionList['PageSize']) {
         $Limit = " limit " . ($ConditionList['Page'] - 1) * $ConditionList['PageSize'] . "," . $ConditionList['PageSize'];
         $sql = "SELECT {$fields} FROM {$table_to_process} where 1 " . $where . $groups . " order by time " . $order . $Limit;
         $data = $this->db->getAll($sql);
         $ReturnArr = array("QuestionNum" => $QuestionNum, "QuestionList" => $data);
         $ReturnArr['QuestionList'] = $data;
     } else {
         $ReturnArr = array("QuestionNum" => 0, "QuestionList" => array());
     }
     return $ReturnArr;
 }
Exemplo n.º 8
0
 public function getAll($AppId, $fields = "*")
 {
     if ($AppId) {
         $sql = "SELECT {$fields} FROM " . Base_Widget::getDbTable($this->table) . " where AppId = ? ORDER BY AppId,MoneyId ASC";
         $return = $this->db->getAll($sql, $AppId);
     } else {
         $sql = "SELECT {$fields} FROM " . Base_Widget::getDbTable($this->table) . " ORDER BY AppId,MoneyId ASC";
         $return = $this->db->getAll($sql);
     }
     if (count($return)) {
         foreach ($return as $key => $value) {
             $AllMoney[$value['AppId']][$value['MoneyId']] = $value;
         }
     }
     return $AllMoney;
 }
Exemplo n.º 9
0
 public function getLinkM2()
 {
     $table_to_insert = Base_Widget::getDbTable($this->table);
     $DataArr = array('check_time' => time());
     $CheckId = $this->db->insert($table_to_insert, $DataArr);
     if ($CheckId) {
         $sql = "select * from {$table_to_insert} where check_id = ?";
         $return = $this->db->getRow($sql, $CheckId, false);
         if ($return['check_time']) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Exemplo n.º 10
0
 public function getCurrentCommonQustion($ConditionList, $fields = '*')
 {
     $table_to_process = Base_Widget::getDbTable($this->table_common);
     //查询列
     $select_fields = array($fields);
     //初始化查询条件
     $time = time();
     $whereDisplay = " display = 1";
     $whereCondition = array($whereDisplay);
     //生成查询列
     $fields = Base_common::getSqlFields($select_fields);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     $Limit = " limit " . $ConditionList['Count'];
     $sql = "SELECT {$fields} FROM {$table_to_process} where 1 " . $where . $groups . " order by id DESC " . $Limit;
     $CommonQuestion = $this->db->getAll($sql);
     return $CommonQuestion;
 }
Exemplo n.º 11
0
 public function createPvLogDate($Date)
 {
     $table_to_check = Base_Widget::getDbTable($this->table);
     $table_to_process = Base_Widget::getDbTable($this->table) . "_" . $Date;
     $exist = $this->db->checkTableExist($table_to_process);
     if ($exist > 0) {
         return $table_to_process;
     } else {
         $sql = "SHOW CREATE TABLE " . $table_to_check;
         $row = $this->db->getRow($sql);
         $sql = $row['Create Table'];
         $sql = str_replace('`' . $this->table . '`', 'IF NOT EXISTS ' . $table_to_process, $sql);
         $create = $this->db->query($sql);
         if ($create) {
             return $table_to_process;
         } else {
             return false;
         }
     }
 }
Exemplo n.º 12
0
 public function addSystemLog($QuestionId, $AuthorName, $OperatorName, $LogTypeId, $LogText)
 {
     $LogType = $this->config->sys_log_arr;
     $LogTypeId = intval($LogTypeId);
     if (isset($LogType[$LogTypeId])) {
         $tip = $LogType[$LogTypeId];
     } else {
         return false;
     }
     $QuestionId = intval($QuestionId);
     //if($QuestionId == 0)
     //{
     //	return false;
     //}
     $log_id = Base_Common::get_log_sn();
     $message = $tip . $LogText;
     $time = time();
     $date = date("Ym", $time);
     $table_to_process = Base_Widget::getDbTable($this->table) . "_" . $date;
     $dataArr = array('id' => $log_id, 'AuthorName' => $AuthorName, 'qid' => $QuestionId, 'user' => $OperatorName, 'message' => $message, 'time' => $time);
     return $this->db->insert($table_to_process, $dataArr);
 }
Exemplo n.º 13
0
 public function updateOperatorByName($OperatorName, array $bind)
 {
     $table_to_process = Base_Widget::getDbTable($this->table);
     return $this->db->update($table_to_process, $bind, '`login_name` = ?', $OperatorName);
 }
Exemplo n.º 14
0
 public function getQuickLinkByParent($Parent, $fields = '*')
 {
     $table_to_process = Base_Widget::getDbTable($this->table);
     $QuickLink = $this->db->select($table_to_process, $fields, '`Parent`=?', array($Parent));
     return $QuickLink;
 }
Exemplo n.º 15
0
 public function createKa91Pay($Order, $Pay)
 {
     $oOrder = new Lm_Order();
     $oUser = new Lm_User();
     $this->db->begin();
     $Order['OrderId'] = date("YmdHis", $Order['OrderTime']) . sprintf("%03d", $Order['AppId']) . sprintf("%03d", $Order['PartnerId']) . sprintf("%04d", rand(1, 9999));
     //支付订单
     $Pay['OrderId'] = $Order['OrderId'];
     $Pay['PayId'] = date("YmdHis", $Pay['PayedTime']) . sprintf("%04d", rand(1, 9999));
     $Date = date("Ym", $Pay['PayedTime']);
     $table_date = $this->createUserPayTableDate($Date);
     $table_user = $this->createUserPayTableUser($Pay['AcceptUserId']);
     $table_first = Base_Widget::getDbTable($this->table_first);
     $Date = $this->db->insert($table_date, $Pay);
     $User = $this->db->insert($table_user, $Pay);
     $first = $this->db->insert($table_first, $Pay);
     //合作方订单唯一保证
     $StageOrderArr = array('OrderId' => $Pay['OrderId'], 'StageOrder' => $Pay['StageOrder']);
     $InsertStageOrder = $this->insertKa91StageOrder($StageOrderArr);
     //给收款方加余额
     $UserCoinUpdate = $oUser->updateUserCoin($Pay['AcceptUserId'], $Pay['Coin']);
     //给支付方加积分,如无支付方帐号,则不加
     $UserCreditUpdate = $Pay['PayUserId'] ? $oUser->updateUserCredit($Pay['PayUserId'], $Pay['Coin']) : 1;
     //生成订单
     $Order['PayId'] = $Pay['PayId'];
     $Date = date("Ym", $Order['OrderTime']);
     $table_date = $oOrder->createUserOrderTableDate($Date);
     $table_user = $oOrder->createUserOrderTableUser($Order['AcceptUserId']);
     $table_to_insert = $table_date;
     $order_date = $this->db->insert($table_to_insert, $Order);
     if (intval($order_date) && intval($order_date) != 23000) {
         $table_to_insert = $table_user;
         $user = $this->db->insert($table_to_insert, $Order);
     }
     if ($InsertStageOrder && $Date && $User && $UserCoinUpdate && $UserCreditUpdate && $order_date && $user) {
         $this->db->commit();
         return $Pay['OrderId'];
     } else {
         $this->db->rollBack();
         return false;
     }
 }
Exemplo n.º 16
0
 public function getKa91List($Start, $Count, $IsB2b)
 {
     $whereB2b = $IsB2b ? " and IsB2b = {$IsB2b} " : "";
     $limit = $Count ? " limit {$Start} , {$Count}" : "";
     $table_to_process = Base_Widget::getDbTable($this->table_91ka);
     $sql = "select * from {$table_to_process} where 1 " . $whereB2b . " order by `Index`,`IsB2b`" . $limit;
     return $this->db->getAll($sql);
 }
Exemplo n.º 17
0
 public function getUserTable($table, $Position)
 {
     $table_name = Base_Widget::getDbTable($table);
     $table_arr = explode('.', $table_name);
     $StatArr['db'] = $table_arr[0] . "_" . $Position['db_fix'];
     $StatArr['tb'] = $table_arr[1] . "_" . $Position['tb_fix'];
     $table_name = implode(".", $StatArr);
     return $table_name;
 }
Exemplo n.º 18
0
 public function resetProductQueue()
 {
     $table_to_update = Base_Widget::getDbTable($this->table_send_queue);
     $array = array(1, time());
     return $this->db->update($table_to_update, array("SendStatus" => 0), '`SendStatus` = ? and ( ? - `ToSendTime`) >= 60*30', $array);
 }
Exemplo n.º 19
0
 /**
  * Print label and wrapper
  *
  * @param array $field
  */
 protected function print_label(array $field)
 {
     if (!isset($field['social'])) {
         parent::print_label($field);
         return;
     }
     printf('<label for="%s"><span class="fa fa-%s"></span> <span class="text">%s</span></label>', esc_attr($field['id']), esc_attr($field['icon']), esc_html($field['label']));
 }
Exemplo n.º 20
0
 /**
  * 更新批量合作商区服数据
  * @param integer $parnter_id
  * @param array $bind
  * @return boolean
  */
 public function updatePartner($parnter_id, array $bind)
 {
     $table_to_process = Base_Widget::getDbTable($this->table);
     return $this->db->update($table_to_process, $bind, '`PartnerId` = ?', $parnter_id);
 }
Exemplo n.º 21
0
 public function getGag($UserName, $fields = '*')
 {
     $table_to_process = Base_Widget::getDbTable($this->table);
     return $this->db->selectRow($table_to_process, $fields, '`login_name` = ?', $UserName);
 }
Exemplo n.º 22
0
 public function getQuestionNumList($ConditionList)
 {
     $table_to_process = Base_Widget::getDbTable($this->table_question_num);
     //查询列
     $select_fields = array('QuestionNum' => 'sum(questions)', 'QuestionType' => 'question_type', 'Qtype' => 'qtype');
     //分类统计列
     $group_fields = array('QuestionType', 'Qtype');
     //初始化查询条件
     if ($ConditionList['StartDate'] == $ConditionList['EndDate']) {
         $whereDate = $ConditionList['StartDate'] ? " date = '" . $ConditionList['StartDate'] . "' " : "";
         $whereStartDate = "";
         $whereEndDate = "";
     } else {
         $whereStartDate = $ConditionList['StartDate'] ? " date >= '" . $ConditionList['StartDate'] . "' " : "";
         $whereEndDate = $ConditionList['EndDate'] ? " date <= '" . $ConditionList['EndDate'] . "' " : "";
         $whereDate = "";
     }
     $whereQtype = $ConditionList['QtypeId'] ? " qtype = " . $ConditionList['QtypeId'] . " " : "";
     //$whereQuestionType = $ConditionList['QuestionType']?" question_type in (".$ConditionList['QuestionType'].")":"";
     $QuestionTypeArrTemp = explode(',', $ConditionList['QuestionType']);
     $QuestionTypeArr = $this->config->QuestionTypeList;
     foreach ($QuestionTypeArr as $key => $value) {
         if (!in_array($key, $QuestionTypeArrTemp)) {
             unset($QuestionTypeArr[$key]);
         }
     }
     if (count($QuestionTypeArr) < 1) {
         $QuestionTypeArr = $this->config->QuestionTypeList;
     }
     $t = array();
     foreach ($QuestionTypeArr as $key => $value) {
         $t[] = "'" . $key . "'";
     }
     $whereQuestionType = "question_type in (" . implode(",", $t) . ")";
     $whereCondition = array($whereDate, $whereStartDate, $whereEndDate, $whereQtype, $whereQuestionType);
     //print_R($whereCondition);
     //生成查询列
     $fields = Base_common::getSqlFields($select_fields);
     //生成分类汇总列
     $groups = Base_common::getGroupBy($group_fields);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     //初始化问题分类数组
     //获取所有需要显示的主分类列表
     $QtypeList = $this->getAllQtype(1, 'name,id,trading,pid');
     //初始化结果数组
     $QuestionNum = array();
     foreach ($QuestionTypeArr as $QuestionType => $QuestionTypeName) {
         $oCategory = new Kubao_Category();
         $CategoryInfo = $oCategory->getCategoryByQuestionType($QuestionType, 'name');
         $QuestionNum[$QuestionType] = array('content' => $CategoryInfo['name'] . "总量:", 'QuestionNum' => 0, 'QuestionNumList' => array());
         foreach ($QtypeList as $key => $QtypeInfo) {
             if ($QuestionType == "complain") {
                 $TradingConfig = unserialize($QtypeInfo['trading']);
                 //如果该投诉下的问题分类不可直接提交订单申诉则留在列表中,否则去除
                 if (trim($TradingConfig['directOrderUrl']) == "") {
                     $OrderCount = $this->getOrderCount($QtypeInfo['id'], 'order_count');
                     $OrderCount = isset($OrderCount['order_count']) ? intval($OrderCount['order_count']) : 0;
                     $QuestionNum[$QuestionType]['QuestionNumList'][$QtypeInfo['id']] = array('QuestionNum' => 0, 'OrderCount' => $OrderCount, 'QtypeId' => $QtypeInfo['id'], 'content' => $QtypeInfo['name'], 'url' => 'http://sc.5173.com/?index/questionTypeDetail/' . $QtypeInfo['id'] . '/' . $QuestionType);
                     $QuestionNum[$QuestionType]['OrderCount'] += $OrderCount;
                 }
             } else {
                 $QuestionNum[$QuestionType]['QuestionNumList'][$QtypeInfo['id']] = array('QuestionNum' => 0, 'QtypeId' => $QtypeInfo['id'], 'content' => $QtypeInfo['name'], 'url' => 'http://sc.5173.com/?index/questionTypeDetail/' . $QtypeInfo['id'] . '/' . $QuestionType);
             }
         }
         foreach ($QtypeList as $key => $QtypeInfo) {
             if ($QtypeInfo['pid'] > 0) {
                 unset($QuestionNum[$QuestionType]['QuestionNumList'][$QtypeInfo['pid']]);
             }
         }
     }
     $sql = "SELECT {$fields} FROM {$table_to_process} where 1 " . $where . $groups;
     $data = $this->db->getAll($sql);
     foreach ($data as $key => $value) {
         //数据累加
         if (isset($QuestionNum[$value['QuestionType']]['QuestionNumList'][$value['Qtype']])) {
             if ($value['QuestionType'] == "complain") {
                 $QuestionNum[$value['QuestionType']]['QuestionNum'] += $value['QuestionNum'];
                 if ($QuestionNum[$value['QuestionType']]['QuestionNumList'][$value['Qtype']]['OrderCount'] > 0) {
                     $value['QuestionNum'] = $value['QuestionNum'] / $QuestionNum[$value['QuestionType']]['QuestionNumList'][$value['Qtype']]['OrderCount'];
                     if ($value['QuestionNum'] > 1 || $value['QuestionNum'] < 1 / 100 / 100) {
                         $value['QuestionNum'] = "0.01%";
                         //$value['QuestionNum'] = $QuestionNum[$value['QuestionType']]['OrderCount'];
                     } else {
                         $value['QuestionNum'] = sprintf("%2.2f", $value['QuestionNum'] * 100) . "%";
                     }
                 } else {
                     $value['QuestionNum'] = "0.01%";
                     //$value['QuestionNum'] = $value['QuestionNum'];//$QuestionNum[$value['QuestionType']]['OrderCount'];
                 }
                 $QuestionNum[$value['QuestionType']]['QuestionNumList'][$value['Qtype']]['QuestionNum'] = $value['QuestionNum'];
             } else {
                 $QuestionNum[$value['QuestionType']]['QuestionNumList'][$value['Qtype']]['QuestionNum'] = $value['QuestionNum'];
                 $QuestionNum[$value['QuestionType']]['QuestionNum'] += $value['QuestionNum'];
             }
         }
     }
     //初始化为json可识别对象
     foreach ($QuestionTypeArr as $QuestionType => $QuestionTypeName) {
         $QuestionNum[$QuestionType]['QuestionNumList2'] = array();
         foreach ($QuestionNum[$QuestionType]['QuestionNumList'] as $key => $value) {
             $QuestionNum[$QuestionType]['QuestionNumList2'][] = $value;
         }
         $QuestionNum[$QuestionType]['QuestionNumList'] = $QuestionNum[$QuestionType]['QuestionNumList2'];
         unset($QuestionNum[$QuestionType]['QuestionNumList2']);
     }
     if (isset($QuestionNum["complain"])) {
         $Q = sprintf("%2.2f", $QuestionNum["complain"]['QuestionNum'] / $QuestionNum["complain"]['OrderCount'] * 100) . "%";
         if ($Q > 1 || $Q < 1 / 100 / 100) {
             $QuestionNum["complain"]['QuestionNum'] = "0.01%";
         } else {
             $QuestionNum["complain"]['QuestionNum'] = sprintf("%2.2f", $Q) . "%";
         }
     }
     return $QuestionNum;
 }
Exemplo n.º 23
0
 public function getUsedLine($DepotId)
 {
     //查询列
     $select_fields = array('Y', 'X');
     //初始化查询条件
     $whereDepot = $DepotId ? " DepotId = " . $DepotId . " " : "";
     $whereCondition = array($whereDepot);
     //生成查询列
     $fields = Base_common::getSqlFields($select_fields);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     $table_name = Base_Widget::getDbTable($this->table);
     $sql = "SELECT {$fields} FROM {$table_name} as log where 1 " . $where;
     $UsedArr = $this->db->getAll($sql, false);
     foreach ($UsedArr as $key => $Stat) {
         $StatArr[$Stat['X']] = $Stat;
     }
     return $StatArr;
 }
Exemplo n.º 24
0
 public function DelOnlineLogByUserId($User)
 {
     set_time_limit(0);
     $table_online_log = "online_log";
     $dateArr = $this->getEveryDay("20130104", "20130310");
     $OnlineCount = 0;
     foreach ($dateArr as $k => $v) {
         //在线状态可能每个月都有,每天都有,要计算在线的总和,要先查出来,然后返回,删除
         $del_online_log = Base_Widget::getDbTable($table_online_log) . "_" . $v;
         //echo $v."<br/>";
         $sql = "SELECT COUNT(*) FROM {$del_online_log} WHERE UserId = " . $User["UserId"];
         $OnlineCount += intval($this->db->getOne($sql));
         $this->db->delete($del_online_log, "`UserId` = ?", $User["UserId"]);
     }
     return $OnlineCount;
 }
Exemplo n.º 25
0
 /**
  * 
  * 获取父菜单
  * @author 张骥
  */
 public function getParentMenu($menu_id, $fields = '*')
 {
     $table_to_process = Base_Widget::getDbTable($this->table);
     $sql = "SELECT {$fields} FROM {$table_to_process} WHERE `menu_id` = ?";
     $parent = $this->db->getAll($sql, $menu_id);
     foreach ($parent as $k => $v) {
         $parents[$k] = $v;
     }
     return $parents;
 }
Exemplo n.º 26
0
 public function getUserLoginCountByDate($UserList, $StartDate, $EndDate, $oWherePartnerPermission)
 {
     $whereCondition = array($oWherePartnerPermission);
     $where = Base_common::getSqlWhere($whereCondition);
     //初始化结果数组
     $Date = $StartDate;
     $CountList = array('Count' => array());
     do {
         $CountList['Count'][$Date] = array('UserCount' => 0);
         $Date = date("Y-m-d", strtotime($Date) + 86400);
     } while (strtotime($Date) <= strtotime($EndDate));
     foreach ($CountList['Count'] as $date => $arr) {
         $table_to_process = Base_Widget::getDbTable($this->table_date) . "_" . date("Ym", strtotime($date));
         $sql = "SELECT count(distinct UserId) as `LoginCount` FROM {$table_to_process} WHERE `UserId` in (" . implode(",", $UserList) . ") and LoginTime > '" . strtotime($date) . "' and LoginTime < '" . (strtotime($date) + 86400) . "' " . $where;
         $CountList['Count'][$date]['UserCount'] = $this->db->getOne($sql, false);
     }
     return $CountList;
 }
Exemplo n.º 27
0
 /**
  * 初始化表名
  * @return string
  */
 public function init()
 {
     parent::init();
     $this->table = $this->getDbTable($this->table);
     $this->table_date = $this->getDbTable($this->table_date);
 }
Exemplo n.º 28
0
 /**
  * 获取用户数量
  * @param $fields
  * @param $params
  * @return array
  */
 public function getUserCount($params)
 {
     //生成查询列
     $fields = Base_common::getSqlFields(array("UserCount" => "count(user_id)"));
     //获取需要用到的表名
     $table_to_process = Base_Widget::getDbTable($this->table);
     //性别判断
     $whereSex = isset($this->sex[$params['Sex']]) ? " sex = '" . $params['Sex'] . "' " : "";
     //实名认证判断
     $whereAuth = isset($this->auth_status[$params['AuthStatus']]) ? " auth_state = '" . $params['AuthStatus'] . "' " : "";
     //姓名
     $whereName = isset($params['Name']) && trim($params['Name']) ? " name like '%" . $params['Name'] . "%' " : "";
     //昵称
     $whereNickName = isset($params['NickName']) && trim($params['NickName']) ? " nick_name like '%" . $params['NickName'] . "%' " : "";
     //所有查询条件置入数组
     $whereCondition = array($whereSex, $whereName, $whereNickName, $whereAuth);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     //生成条件列
     $sql = "SELECT {$fields} FROM {$table_to_process} where 1 " . $where;
     return $this->db->getOne($sql);
 }
Exemplo n.º 29
0
 /**
  * 初始化表名
  * @return string
  */
 public function init()
 {
     parent::init();
     $this->table = Base_Widget::getDbTable($this->table);
 }
Exemplo n.º 30
0
 public function getItemPickUpCount($StartTime, $EndTime, $UserId, $ServerId, $oWherePartnerPermission, $ItemListText)
 {
     //查询列
     $select_fields = array('PickUpCount' => 'count(*)');
     //初始化查询条件
     $whereStartTime = $StartTime ? " ItemPickUpTime >= '" . strtotime($StartTime) . "' " : "";
     $whereEndTime = $EndTime ? " ItemPickUpTime <= '" . strtotime($EndTime) . "' " : "";
     $whereServer = $ServerId ? " ServerId = " . $ServerId . " " : "";
     $whereItemID = $ItemListText ? " ItemID in ( " . $ItemListText . " )" : "";
     $whereUser = $UserId ? " UserId = " . $UserId . " " : "";
     $whereCondition = array($whereStartTime, $whereEndTime, $whereUser, $whereServer, $oWherePartnerPermission, $whereItemID);
     //生成查询列
     $fields = Base_common::getSqlFields($select_fields);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     if ($UserId) {
         $position = Base_Common::getUserDataPositionById($UserId);
         $table_to_process = Base_Common::getUserTable($this->table_list['pickitem_user'], $position);
     } else {
         $Date = date("Ymd", strtotime($StartTime));
         $table_to_process = Base_Widget::getDbTable($this->table_list['pickitem']) . "_" . $Date;
     }
     $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where;
     $PickUpCount = $this->db->getOne($sql, false);
     if ($PickUpCount) {
         return $PickUpCount;
     } else {
         return 0;
     }
 }