/**
  *用户ID方式登录
  */
 public function getQuestionListAction()
 {
     //基础元素,必须参与验证
     $Config['Time'] = abs(intval($this->request->Time));
     $Config['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     //URL验证码
     $sign = trim($this->request->sign);
     //私钥,以后要移开到数据库存储
     $p_sign = 'lm';
     $sign_to_check = Base_common::check_sign($Config, $p_sign);
     //不参与验证的元素
     //验证URL是否来自可信的发信方
     if ($sign_to_check == $sign) {
         //验证时间戳,时差超过600秒即认为非法
         if (abs($Config['Time'] - time()) <= 600) {
             $QuestionList = $this->oSecurityAnswer->getAll();
             $result = array('return' => 1, 'QuestionList' => $QuestionList);
         } else {
             $result = array('return' => 0, 'comment' => "时间有误");
         }
     } else {
         $result = array('return' => 0, 'comment' => "验证失败,请检查URL");
     }
     if ($Config['ReturnType']) {
         echo json_encode($result);
     } else {
         //			$r = $result['return']."|".iconv('UTF-8','GBK',$result['comment']);;
         //			if($result['return']==1)
         //			{
         //				$r = $r."|".$result['LoginId']."|".$result['adult'];
         //			}
         //			echo $r;
     }
 }
Exemple #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;
 }
Exemple #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;
 }
Exemple #4
0
 public function GetInsertLastLogoutUser($table_suffix)
 {
     $table_to_process = Base_Widget::getDbTable($this->table_login_log);
     $table_to_process .= "_" . $table_suffix;
     $group_fields = array('UserId', 'AppId', 'PartnerId', 'ServerId');
     $groups = Base_common::getGroupBy($group_fields);
     $where = "and LogoutTime > 0 ";
     $sql = "select \n                t.UserId,t.AppId,t.PartnerId,t.ServerId,t.LoginTime,t.UserLoginIp,t.LogoutTime,t.LoginId,t.UserSourceId,t.UserSourceDetail,t.UserSourceProjectId,t.UserSourceActionId,t.UserRegTime,t.FirstLoginTime \n                from (select UserId,AppId,PartnerId,ServerId,max(LogoutTime) as last\n                from {$table_to_process} \n                where 1 {$where}{$groups}) as log , {$table_to_process} as t \n                where t.UserId = log.UserId and t.AppId = log.AppId and t.PartnerId = log.PartnerId and t.ServerId = log.ServerId and t.LogoutTime = log.last";
     return $sql;
 }
Exemple #5
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;
 }
Exemple #6
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;
 }
 /**
  *获取服务器列表登录
  */
 public function getServerByIpAction()
 {
     //基础元素,必须参与验证
     $Config['ServerIp'] = $this->request->ServerIp;
     $Config['Time'] = abs(intval($this->request->Time));
     $Config['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     //URL验证码
     $sign = trim($this->request->sign);
     //私钥,以后要移开到数据库存储
     $p_sign = 'lm';
     $sign_to_check = Base_common::check_sign($Config, $p_sign);
     //不参与验证的元素
     //验证URL是否来自可信的发信方
     if ($sign_to_check == $sign) {
         //验证时间戳,时差超过600秒即认为非法
         if (abs($Config['Time'] - time()) <= 600) {
             if ($Config['ServerIp']) {
                 $ServerIp = Base_Common::ip2long($Config['ServerIp']);
                 $ServerInfo = $this->oServer->getByIp($ServerIp);
                 if ($ServerInfo['ServerId']) {
                     $result = array('return' => 1, 'ServerInfo' => $ServerInfo, 'comment' => '找到服务器');
                 } else {
                     $result = array('return' => 2, 'comment' => '你所查询的IP不属于任何服务器');
                 }
             } else {
                 $result = array('return' => 0, 'comment' => "请输入服务器IP");
             }
         } else {
             $result = array('return' => 0, 'comment' => "时间有误");
         }
     } else {
         $result = array('return' => 0, 'comment' => "验证失败,请检查URL");
     }
     if ($Config['ReturnType'] == 1) {
         echo json_encode($result);
     } else {
         $r = $result['return'] . "|" . iconv('UTF-8', 'GBK', $result['comment']);
         if ($result['return'] == 1) {
             $r = $r . "|" . $result['ServerInfo']['ServerId'] . "|" . iconv('UTF-8', 'GBK', $result['ServerInfo']['name']);
         }
         echo $r;
     }
 }
 /**
  * 获取单个游戏信息
  */
 public function getAppInfoAction()
 {
     //基础元素,必须参与验证
     $Config['Time'] = abs(intval($this->request->Time));
     $Config['AppId'] = abs(intval($this->request->AppId));
     $Config['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     //URL验证码
     $sign = trim($this->request->sign);
     //私钥,以后要移开到数据库存储
     $p_sign = 'lm';
     $sign_to_check = Base_common::check_sign($Config, $p_sign);
     //不参与验证的元素
     //验证URL是否来自可信的发信方
     if ($sign_to_check == $sign) {
         //验证时间戳,时差超过600秒即认为非法
         if (abs($Config['Time'] - time()) <= 600) {
             if ($Config['AppId']) {
                 $AppInfo = $this->oApp->getRow($Config['AppId']);
                 if ($AppInfo['AppId']) {
                     $result = array('return' => 1, 'AppInfo' => $AppInfo);
                 } else {
                     $result = array('return' => 0, 'comment' => "无此游戏");
                 }
             } else {
                 $result = array('return' => 0, 'comment' => "请指定游戏");
             }
         } else {
             $result = array('return' => 0, 'comment' => "时间有误");
         }
     } else {
         $result = array('return' => 0, 'comment' => "验证失败,请检查URL");
     }
     if ($Config['ReturnType']) {
         echo json_encode($result);
     }
 }
Exemple #9
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;
     }
 }
Exemple #10
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);
 }
Exemple #11
0
 public function getLogsManagerParams($fields, $LogInfo, $StartDate, $EndDate)
 {
     //$whereId = $ManageId ? "manager_id=".$ManageId:"";
     $whereLog = $LogInfo ? "log LIKE '%" . $LogInfo . "%'" : "";
     $whereStartDate = $StartDate ? " addtime >= '" . strtotime($StartDate) . "' " : "";
     $whereEndDate = $EndDate ? " addtime <= '" . (strtotime($EndDate) + 86400 - 1) . "' " : "";
     $whereCondition = array($whereLog, $whereStartDate, $whereEndDate);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     $sql = "SELECT {$fields} FROM {$this->table} where 1 " . $where . " ORDER BY addtime ASC";
     //echo $sql."<br/>";
     $MachineLog = $this->db->getAll($sql);
     $MachineLogList = array();
     foreach ($MachineLog as $key => $LogInfo) {
         $MachineList[$key]['Udate'] = $LogInfo['addtime'];
         $LogArr = explode("\n\n", $LogInfo['log']);
         $MachineIdStr = explode(":", $LogArr[2]);
         $MachineId = $MachineIdStr[1];
         $Tip = mb_substr($LogArr[0], 0, 2, "utf-8");
         $BeforeMachineInfo = json_decode($LogArr[3], true);
         if ($LogArr[4]) {
             $NextMachineInfo = json_decode($LogArr[4], true);
             foreach ($NextMachineInfo as $key => $val) {
                 if ($key == "Comment") {
                     $NextComment = json_decode($val, true);
                     $NextMachineInfo["Comment"] = $NextComment;
                     $BeforeComment = json_decode($BeforeMachineInfo["Comment"], true);
                     foreach ($NextComment as $ckey => $cval) {
                         if ($cval != $BeforeComment[$ckey]) {
                             if ($ckey == "Status") {
                                 $NextMachineInfo["Comment"][$ckey . "_span"] = $cval;
                             } else {
                                 $NextMachineInfo["Comment"][$ckey] = "<span style='color:red;'>" . $cval . "</span>";
                             }
                         }
                     }
                     $NextMachineInfo["Comment"] = json_encode($NextMachineInfo["Comment"]);
                 } elseif ($val != $BeforeMachineInfo[$key]) {
                     if ($key == "CageId" || $key == "ServerId" || $key == "LocalIP" || $key == "WebIP" || $key == "IntellectProperty" || $key == "Flag") {
                         $NextMachineInfo[$key . "_span"] = $val;
                     } else {
                         $NextMachineInfo[$key] = "<span style='color:red;'>" . $val . "</span>";
                     }
                 }
             }
             $NextMachineInfo['LogDate'] = date("Y-m-d H:i:s", $LogInfo['addtime']);
             $NextMachineInfo['Name'] = $LogInfo['name'];
             unset($NextMachineInfo['Udate']);
             $NextMachineInfo['Tip'] = $Tip;
             $MachineLogList[$MachineId][] = $NextMachineInfo;
         } else {
             $BeforeMachineInfo['LogDate'] = date("Y-m-d H:i:s", $LogInfo['addtime']);
             $BeforeMachineInfo['Name'] = $LogInfo['name'];
             $BeforeMachineInfo['Tip'] = $Tip;
             $MachineLogList[$MachineId][] = $BeforeMachineInfo;
         }
     }
     /*foreach($MachineLog as $key=> $LogInfo)
     		{
     			$MachineList[$key]['Udate'] = $LogInfo['addtime'];
     			//echo $LogInfo['log'];
     			$LogArr = explode("\n\n",$LogInfo['log']);
     			//echo "<pre>";
     			//	print_r($LogArr);
     			$MachineIdStr = explode(":",$LogArr[2]);
     			$MachineId = $MachineIdStr[1];
     			$Tip = mb_substr($LogArr[0],0,2,"utf-8");
     			$BeforeMachineInfo = json_decode($LogArr[3],true);
     				
     			if($LogArr[4]) //有5个值的是修改,没有的是 添加和删除
     			{
     				$NextMachineInfo = json_decode($LogArr[4],true);
     			
     				$NextMachineInfo['LogDate'] = date("Y-m-d H:i:s",$LogInfo['addtime']);
     				$NextMachineInfo['Name'] = $LogInfo['name'];	
     				unset($NextMachineInfo['Udate']);
     				$NextMachineInfo['Tip'] = $Tip;
     				$MachineLogList[$MachineId][] = $NextMachineInfo;
     				
     			}else{
     			
     				$BeforeMachineInfo['LogDate'] = date("Y-m-d H:i:s",$LogInfo['addtime']);
     				$BeforeMachineInfo['Name'] = $LogInfo['name'];	
     				$BeforeMachineInfo['Tip'] = $Tip;
     				$MachineLogList[$MachineId][] = $BeforeMachineInfo;				
     			}
     
     		}*/
     return $MachineLogList;
 }
Exemple #12
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;
 }
Exemple #13
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;
 }
 /**
  *根据用户订单号创建兑换订单
  */
 public function createExchangeByOrderAction()
 {
     //基础元素,必须参与验证
     $Order['OrderId'] = $this->request->OrderId;
     $Order['Time'] = abs(intval($this->request->Time));
     $Order['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     //URL验证码
     $sign = $this->request->sign;
     //私钥,以后要移开到数据库存储
     $p_sign = 'lm';
     $sign_to_check = Base_common::check_sign($Order, $p_sign);
     //不参与验证的元素
     //验证URL是否来自可信的发信方
     if ($sign_to_check == $sign) {
         if ($Order['OrderId']) {
             //验证时间戳,时差超过600秒即认为非法
             if (abs($Order['Time'] - time()) <= 600) {
                 $OrderInfo = $this->oOrder->getRow($Order['OrderId']);
                 //查询订单
                 if ($OrderInfo['OrderId']) {
                     $create = $this->oExchange->createExchangeQueueByOrder($OrderInfo);
                     if ($create) {
                         $result = array('return' => 1, 'ExchangeId' => $create, 'comment' => "创建兑换成功");
                     } else {
                         $result = array('return' => 2, 'comment' => "创建兑换失败");
                     }
                 } else {
                     $result = array('return' => 2, 'comment' => "无此订单");
                 }
             } else {
                 $result = array('return' => 0, 'comment' => "时间有误");
             }
         } else {
             $result = array('return' => 0, 'comment' => "请输入订单号");
         }
     } else {
         $result = array('return' => 0, 'comment' => "验证失败,请检查URL");
     }
     $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     if ($User['ReturnType'] == 1) {
         echo json_encode($result);
     } else {
         //			$r = $result['return']."|".iconv('UTF-8','GBK',$result['comment']);
         //			if($result['return']==1)
         //			{
         //				$r = $r."|".$result['LoginId']."|".$result['adult'];
         //			}
         //			echo $r;
     }
 }
Exemple #15
0
 public function getExchangeDay($StartDate, $EndDate, $ExchangeType, $ServerId, $oWherePartnerPermission)
 {
     //查询列
     $select_fields = array('ExchangeUser' => 'count(distinct(UserId))', 'ExchangeCount' => 'count(*)', 'TotalAppCoin' => 'sum(AppCoin)', 'Date' => "from_unixtime(ExchangeTime,'%Y-%m-%d')");
     //分类统计列
     $group_fields = array('Date', 'AppId', 'PartnerId');
     //初始化查询条件
     $whereStartDate = $StartDate ? " ExchangeTime >= '" . strtotime($StartDate) . "' " : "";
     $whereEndDate = $EndDate ? " ExchangeTime <= '" . (strtotime($EndDate) + 86400 - 1) . "' " : "";
     $whereType = $ExchangeType ? " ExchangeType = " . $ExchangeType . " " : "";
     $whereCondition = array($whereStartTime, $whereEndTime, $oWherePartnerPermission, $whereType);
     //生成查询列
     $fields = Base_common::getSqlFields($select_fields);
     //生成分类汇总列
     $groups = Base_common::getGroupBy($group_fields);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     $date = $StartDate;
     //初始化结果数组
     $StatArr['TotalData'] = array('ExchangeUser' => 0, 'ExchangeCount' => 0, 'TotalAppCoin' => 0);
     do {
         $StatArr['ExchangeDate'][$date] = array('ExchangeUser' => 0, 'ExchangeCount' => 0, 'TotalAppCoin' => 0);
         $date = date("Y-m-d", strtotime($date) + 86400);
     } while (strtotime($date) <= strtotime($EndDate));
     $DateStart = date("Ym", strtotime($StartDate));
     $DateEnd = date("Ym", strtotime($EndDate));
     $DateList = array();
     $Date = $StartDate;
     do {
         $D = date("Ym", strtotime($Date));
         $DateList[] = $D;
         $Date = date("Y-m-d", strtotime("{$Date} +1 month"));
     } while ($D != $DateEnd);
     $oPartnerApp = new Config_Partner_App();
     $oArea = new Config_Area();
     foreach ($DateList as $key => $value) {
         $table_name = Base_Widget::getDbTable($this->table) . "_date_" . $value;
         $sql = "SELECT  {$fields} FROM {$table_name} as log where 1 " . $where . $groups;
         $ExchangeDateArr = $this->db->getAll($sql);
         if (is_array($ExchangeDateArr)) {
             foreach ($ExchangeDateArr as $key => $Stat) {
                 if (isset($StatArr['ExchangeDate'][$Stat['Date']])) {
                     $StatArr['ExchangeDate'][$Stat['Date']]['ExchangeCount'] += $Stat['ExchangeCount'];
                     $StatArr['ExchangeDate'][$Stat['Date']]['ExchangeUser'] += $Stat['ExchangeUser'];
                     $StatArr['ExchangeDate'][$Stat['Date']]['TotalAppCoin'] += $Stat['TotalAppCoin'];
                 } else {
                     $StatArr['ExchangeDate'][$Stat['Date']] = array('ExchangeUser' => 0, 'ExchangeCount' => 0, 'TotalAppCoin' => 0);
                     $StatArr['ExchangeDate'][$Stat['Date']]['ExchangeCount'] += $Stat['ExchangeCount'];
                     $StatArr['ExchangeDate'][$Stat['Date']]['ExchangeUser'] += $Stat['ExchangeUser'];
                     $StatArr['ExchangeDate'][$Stat['Date']]['TotalAppCoin'] += $Stat['TotalAppCoin'];
                 }
             }
         }
     }
     return $StatArr;
 }
 public function checkKa91OrderAction()
 {
     //基础元素,必须参与验证
     $Order['Time'] = abs(intval($this->request->Time));
     $Order['StageOrder'] = $this->request->StageOrder;
     //URL验证码
     $sign = $this->request->sign;
     //私钥,以后要移开到数据库存储
     $p_sign = 'lm';
     $sign_to_check = Base_common::check_sign($Order, $p_sign);
     //不参与验证的元素
     if (in_array($_SERVER["REMOTE_ADDR"], array('61.145.117.183', '61.145.117.184', '219.136.252.38', '121.9.211.6', '58.247.169.182'))) {
         //验证URL是否来自可信的发信方
         if ($sign_to_check == $sign) {
             //验证时间戳,时差超过600秒即认为非法
             if (abs($Order['Time'] - time()) <= 600) {
                 $checkStageOrder = $this->oPay->getKa91StageOrder($Order['StageOrder']);
                 if ($checkStageOrder['StageOrder']) {
                     $result = array('return' => 1, 'OrderId' => $checkStageOrder['OrderId'], 'comment' => "订单执行成功");
                 } else {
                     $result = array('return' => 2, 'comment' => "无此订单");
                 }
             } else {
                 $result = array('return' => 0, 'comment' => "时间有误");
             }
         } else {
             $result = array('return' => 0, 'comment' => "验证失败,请检查URL");
         }
     } else {
         $result = array('return' => 0, 'comment' => "您的IP不在可允许的列表之内");
     }
     echo json_encode($result);
 }
Exemple #17
0
 public function getAll($SourceList)
 {
     if ($SourceList) {
         foreach ($SourceList as $Key => $value) {
             $t[$Key] = $Key;
         }
         $whereSource = " SourceId in (" . implode(",", $t) . ")";
     } else {
         $whereSource = "";
     }
     $whereCondition = array($whereSource);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     $sql = "SELECT * FROM " . $this->getDbTable() . " where 1 " . $where . " ORDER BY SourceId ASC";
     $return = $this->db->getAll($sql);
     if (count($return)) {
         foreach ($return as $key => $value) {
             $AllSourceDetail[$value['SourceDetail']] = $value;
         }
     }
     return $AllSourceDetail;
 }
Exemple #18
0
 public function getSendStatus($Date, $ServerId, $uType)
 {
     $select_fields = array('SendCount' => 'count(*)', 'H' => 'from_unixtime(Sendtime,"%H")', 'm' => 'from_unixtime(SendTime,"%i")');
     $whereuType = $uType ? ' uType = ' . $uType . ' ' : '';
     $whereServer = $ServerId ? ' ServerId = ' . $ServerId . ' ' : '';
     $whereCondition = array($whereuType, $whereServer);
     $group_fields = array('H', 'm');
     //生成分类汇总列
     $groups = Base_common::getGroupBy($group_fields);
     //分类统计列
     //生成查询列
     $fields = Base_common::getSqlFields($select_fields);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     $table_to_process = $this->getDbTable($this->table_date) . "_" . date("Ymd", strtotime($Date));
     $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where . $groups;
     $return = $this->db->getAll($sql);
     $SendStatus = array();
     if (count($return)) {
         foreach ($return as $key => $value) {
             $SendStatus[$value['H'] * 60 + $value['m']]['SendCount'] = $value['SendCount'];
         }
     }
     return $SendStatus;
 }
Exemple #19
0
 public function getPveTowerSummary($StartTime, $EndTime, $UserId, $InstMapId, $HeroId, $ServerId, $TowerIndex, $oWherePartnerPermission)
 {
     //查询列
     $select_fields = array('UserId', 'PassCount' => 'count(*)', 'FirstPassTime' => 'min(EndTowerTime)', 'TotalTime' => 'sum(RunTime)/1000');
     //分类统计列
     $group_fields = array('UserId');
     $groups = Base_common::getGroupBy($group_fields);
     //初始化查询条件
     $whereStartTime = $StartTime ? " CreateTowerTime >= " . $StartTime . " " : "";
     $whereEndTime = $EndTime ? " CreateTowerTime <= " . $EndTime . " " : "";
     $whereUser = $UserId ? " UserId = " . $UserId . " " : "";
     $whereServer = $ServerId ? " ServerId = " . $ServerId . " " : "";
     $whereInstMap = $InstMapId ? " SlkId = " . $InstMapId . " " : "";
     $whereHero = $HeroId != -1 ? " HeroId = " . $HeroId . " " : "";
     $whereIndex = $TowerIndex ? " TowerIndex = " . $TowerIndex . " " : "";
     $whereCondition = array($whereUser, $whereStartTime, $whereEndTime, $whereServer, $whereInstMap, $whereHero, $whereIndex, $oWherePartnerPermission);
     //生成查询列
     $fields = Base_common::getSqlFields($select_fields);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     if ($UserId) {
         //echo "1轮<br>";
         $position = Base_Common::getUserDataPositionById($UserId);
         $table_to_process = Base_Common::getUserTable($this->table_pve_tower_log_user, $position);
         $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where . $groups;
         $PveTowerSummaryArr = $this->db->getAll($sql, false);
         if (isset($PveTowerSummaryArr)) {
             foreach ($PveTowerSummaryArr as $key => $value) {
                 $StatArr['UserList'][$value['UserId']] = $value;
             }
         }
         $StatArr['UserCount'] = count($StatArr['UserList']);
     } elseif (!$UserId && date('m', $StartTime) == date('m', $EndTime)) {
         //echo "1轮<br>";
         $Date = date("Ym", $StartTime);
         $table_to_process = Base_Widget::getDbTable($this->table_pve_tower_log) . "_" . $Date;
         $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where . $groups;
         $PveTowerSummaryArr = $this->db->getAll($sql, false);
         if (isset($PveTowerSummaryArr)) {
             foreach ($PveTowerSummaryArr as $key => $value) {
                 $StatArr['UserList'][$value['UserId']] = $value;
             }
         }
         $StatArr['UserCount'] = count($StatArr['UserList']);
     }
     if (!$UserId && date('m', $StartTime) != date('m', $EndTime)) {
         //echo "256轮<br>";
         for ($i = 0; $i <= 255; $i++) {
             $position = Base_Common::getUserDataPositionById(sprintf("%03d", $i));
             $table_to_process = Base_Common::getUserTable($this->table_pve_tower_log_user, $position);
             $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where . $groups;
             $PveTowerSummaryArr = $this->db->getAll($sql, false);
             if (isset($PveTowerSummaryArr)) {
                 foreach ($PveTowerSummaryArr as $key => $value) {
                     $StatArr['UserList'][$value['UserId']] = $value;
                 }
             }
             $StatArr['UserCount'] = count($StatArr['UserList']);
         }
     }
     return $StatArr;
 }
Exemple #20
0
 /**
  * 获取指定合作商的app区服
  * @param integer $AppId
  * @param integer $PartnerId
  * @param string $fields
  * @return array
  */
 public function getByAppPartner($AppId, $PartnerId, $fields = '*', $is_show = 0)
 {
     $whereApp = $AppId ? " AppId = {$AppId}" : "";
     $wherePartner = $PartnerId ? " PartnerId = {$PartnerId}" : "";
     $whereCondition = array($whereApp, $wherePartner);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     $table_to_process = Base_Widget::getDbTable($this->table);
     if (!$is_show) {
         $sql = "SELECT {$fields} FROM " . $table_to_process . " where 1 " . $where;
     } else {
         $sql = "SELECT {$fields} FROM " . $table_to_process . " where is_show = {$is_show} " . $where;
     }
     $return = $this->db->getAll($sql);
     if ($return) {
         foreach ($return as $key => $value) {
             $AllServer[$value['ServerId']] = $value;
         }
     }
     return $AllServer;
 }
Exemple #21
0
 public function getProductSendQueueDetailCount($UserId, $ProductSendType, $ProductType, $ServerId)
 {
     //查询列
     $select_fields = array('ProductSendQueueCount' => 'count(*)');
     //分类统计列
     //初始化查询条件
     $whereServer = $ServerId ? " ServerId = " . $ServerId . " " : "";
     $whereSendType = $ProductSendType ? " SendType = '" . $ProductSendType . "' " : "";
     $whereType = $ProductType ? " ProductType = '" . $ProductType . "' " : "";
     $whereCondition = array($whereUser, $whereSendType, $whereType, $whereServer);
     //生成查询列
     $fields = Base_common::getSqlFields($select_fields);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     $table_to_process = Base_Widget::getDbTable($this->table_send_queue);
     $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where;
     $ProductSendQueueCount = $this->db->getOne($sql, false);
     if ($ProductSendQueueCount) {
         return $ProductSendQueueCount;
     } else {
         return 0;
     }
 }
Exemple #22
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;
 }
Exemple #23
0
 public function getTotalPayUser($Date, $oWherePartnerPermission)
 {
     //查询列
     $select_fields = array('PayUser' => 'count(distinct(AcceptUserId))');
     //分类统计列
     //初始化查询条件
     $whereDate = $Date ? " PayedTime < '" . (strtotime($Date) + 86400) . "' " : "";
     $whereCondition = array($whereDate, $oWherePartnerPermission);
     //生成查询列
     $fields = Base_common::getSqlFields($select_fields);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     $table_name = Base_Widget::getDbTable($this->table_first);
     $sql = "SELECT {$fields} FROM {$table_name} as log where 1 " . $where;
     $PayUser = $this->db->getOne($sql, false);
     return $PayUser;
 }
Exemple #24
0
 public function getFAQCount($FaqTypeId = 0, $KeyWord = "")
 {
     $whereType = $FaqTypeId ? " FaqTypeId = " . $FaqTypeId . " " : "";
     $whereKeyWord = $KeyWord ? " (name like '%" . $KeyWord . "%' or Answer like '%" . $KeyWord . "%') " : "";
     $whereCondition = array($whereType, $whereKeyWord);
     $where = Base_common::getSqlWhere($whereCondition);
     //生成条件列
     $limit = $Count ? " limit {$Start},{$Count}" : "";
     $sql = "SELECT count(*) as FaqCount FROM " . $this->getDbTable() . " where 1 " . $where . " ORDER BY FaqTypeId,FaqId ASC" . $limit;
     $FaqCount = $this->db->getOne($sql);
     return $FaqCount;
 }
Exemple #25
0
 public function getNpcItemPurchaseDetailCount($StartTime, $EndTime, $UserId, $ServerId, $MoneyType, $oWherePartnerPermission, $ItemListText)
 {
     //查询列
     $select_fields = array('PurchaseCount' => 'count(*)');
     //初始化查询条件
     $whereStartTime = $StartTime ? " NpcPurchaseTime >= '" . strtotime($StartTime) . "' " : "";
     $whereEndTime = $EndTime ? " NpcPurchaseTime <= '" . strtotime($EndTime) . "' " : "";
     $whereServer = $ServerId ? " ServerId = " . $ServerId . " " : "";
     $whereItemID = $ItemListText ? " ItemID in ( " . $ItemListText . " )" : "";
     $whereUser = $UserId ? " UserId = " . $UserId . " " : "";
     $whereMoney = $MoneyType ? " MoneyType = " . $MoneyType . " " : "";
     $groups = Base_common::getGroupBy($group_fields);
     $whereCondition = array($whereStartTime, $whereEndTime, $whereUser, $whereMoney, $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_Widget::getDbTable($this->table_npc_item_purchase) . "_user_" . $position['db_fix'];
     } else {
         $Date = date("Ym", strtotime($StartTime));
         $table_to_process = Base_Widget::getDbTable($this->table_npc_item_purchase) . "_" . $Date;
     }
     $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where;
     $PurchaseCount = $this->db->getOne($sql, false);
     if ($PurchaseCount) {
         return $PurchaseCount;
     } else {
         return 0;
     }
 }
Exemple #26
0
 /**
  * 获取用户数量
  * @param $fields  所要获取的数据列
  * @param $params 传入的条件列表
  * @return integer
  */
 public function getAuthLogCount($params)
 {
     //生成查询列
     $fields = Base_common::getSqlFields(array("AuthLOgCount" => "count(auth_id)"));
     //获取需要用到的表名
     $table_to_process = Base_Widget::getDbTable($this->table_auth_log);
     //开始时间
     $whereStartDate = isset($params['StartDate']) ? " op_time >= '" . $params['StartDate'] . "' " : "";
     //开始时间
     $whereEndDate = isset($params['EndDate']) ? " op_time <= '" . date("Y-m-d", strtotime($params['EndDate']) + 86400) . "' " : "";
     //审核结果
     $whereAuthResult = isset($this->auth_status_log[$params['AuthResult']]) ? " auth_result = " . $params['AuthResult'] . " " : "";
     //操作人
     $whereManager = $params['ManagerId'] ? " op_uid = " . $params['ManagerId'] . " " : "";
     //所有查询条件置入数组
     $whereCondition = array($whereStartDate, $whereEndDate, $whereAuthResult, $whereManager);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     //生成条件列
     $sql = "SELECT {$fields} FROM {$table_to_process} where 1 " . $where;
     return $this->db->getOne($sql);
 }
Exemple #27
0
 public function getCharacterFreeze($UserId, $ServerId)
 {
     //查询列
     $select_fields = array('FreezeCount' => 'count(*)', 'MaxTime' => 'max(EndTime)');
     //分类统计列
     $time = time();
     //初始化查询条件
     $whereStartTime = " StartTime <= " . $time . " ";
     $whereEndTime = " EndTime >= " . $time . " ";
     $whereUser = $UserId ? " UserId = " . $UserId . " " : "";
     $whereServer = $ServerId ? " ServerId = " . $ServerId . " " : "";
     $whereCondition = array($whereUser, $whereStartTime, $whereEndTime, $whereServer);
     //生成查询列
     $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->character_freeze, $position);
     }
     $sql = "SELECT {$fields} FROM {$table_to_process} as log where 1 " . $where;
     $Freeze = $this->db->getRow($sql, false);
     if ($Freeze['FreezeCount']) {
         return $Freeze;
     } else {
         return array('FreezeCount' => 0);
     }
 }
Exemple #28
0
 public function getCageListParams($DepotId, $X, $fields = "*")
 {
     $whereDepot = $DepotId ? " DepotId = " . $DepotId . " " : "";
     $whereX = $X ? " X = '" . $X . "' " : "";
     $whereCondition = array($whereDepot, $whereX);
     //生成条件列
     $where = Base_common::getSqlWhere($whereCondition);
     $sql = "SELECT {$fields} FROM " . $this->getDbTable() . " where 1 " . $where;
     $CageList = $this->db->getAll($sql);
     $returnArr = array();
     foreach ($CageList as $k => $v) {
         $returnArr[$v["CageId"]] = $v;
     }
     return $returnArr;
 }
Exemple #29
0
 public function getIpList($CageIdList, $start, $pageSize)
 {
     if ($CageIdList) {
         $whereCageId = "CageId in ( {$CageIdList} )";
     }
     $limit = $pageSize ? " limit {$start},{$pageSize}" : "";
     //生成条件列
     $where = Base_common::getSqlWhere(array($whereCageId));
     $sql = "SELECT count(*) as MachineCount FROM {$this->table} where 1 " . $where;
     $MachineCount = $this->db->getOne($sql, false);
     if ($MachineCount) {
         $sql = "SELECT MachineId,MachineCode,EstateCode,LocalIP,WebIP,Purpose,ServerId FROM  {$this->table} where 1 " . $where . " ORDER BY Udate DESC " . $limit;
         $MachineArr = $this->db->getAll($sql);
     }
     $MachineList['MachineDetail'] = $MachineArr;
     $MachineList['MachineCount'] = $MachineCount;
     return $MachineList;
 }
 /**
  *获取用户订单信息
  */
 public function getUserOrderListAction()
 {
     //基础元素,必须参与验证
     $Order['UserId'] = $this->request->UserId;
     $Order['AppId'] = abs(intval($this->request->AppId));
     $Order['PartnerId'] = abs(intval($this->request->ParnterId));
     $Order['ServerId'] = abs(intval($this->request->ServerId));
     $Order['StartDate'] = $this->request->StartDate ? $this->request->StartDate : date("Y-m-01", time());
     $Order['EndDate'] = $this->request->EndDate ? $this->request->EndDate : date("Y-m-d", time());
     $Order['PageSize'] = abs(intval($this->request->PageSize));
     $Order['Page'] = abs(intval($this->request->Page));
     $Order['Time'] = abs(intval($this->request->Time));
     $Order['OrderStatus'] = intval($this->request->OrderStatus);
     $Order['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     //URL验证码
     $sign = $this->request->sign;
     //私钥,以后要移开到数据库存储
     $p_sign = 'lm';
     $sign_to_check = Base_common::check_sign($Order, $p_sign);
     //不参与验证的元素
     //验证URL是否来自可信的发信方
     if ($sign_to_check == $sign) {
         if ($Order['UserId']) {
             //验证时间戳,时差超过600秒即认为非法
             if (abs($Order['Time'] - time()) <= 600) {
                 $UserInfo = $this->oUser->GetUserById($Order['UserId']);
                 if ($UserInfo['UserId']) {
                     $OrderListInfo = $this->oOrder->getUserOrderList($Order['UserId'], $Order['AppId'], $Order['PartnerId'], $Order['ServerId'], $Order['StartDate'], $Order['EndDate'], $Order['PageSize'], ($Order['Page'] - 1) * $Order['PageSize'], $Order['OrderStatus']);
                     $result = array('return' => 1, 'OrderList' => $OrderListInfo);
                 } else {
                     $result = array('return' => 2, 'comment' => "无此用户");
                 }
             } else {
                 $result = array('return' => 0, 'comment' => "时间有误");
             }
         } else {
             $result = array('return' => 0, 'comment' => "请指定用户");
         }
     } else {
         $result = array('return' => 0, 'comment' => "验证失败,请检查URL");
     }
     $User['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2;
     if ($User['ReturnType'] == 1) {
         echo json_encode($result);
     } else {
     }
 }