Exemple #1
0
 public function getSearchCount($where = array())
 {
     $white_list = array('productCatId', 'productCatId2');
     $where = DBHelp::getWhiteItem($where, $white_list);
     $condition = DBHelp::buildWhere($where);
     $sql = "select count(0) from {tbname} where {$condition} ";
     return $this->mScoreDetail->getSingle($sql, $where);
 }
Exemple #2
0
 /**
  * 审核文件
  * @param  参数
  * @return bool
  */
 public function auditSave($params)
 {
     $white_list = array('id', 'isAudit', 'reason');
     $binds = DBHelp::getWhiteItem($params, $white_list, false);
     $time = time();
     $sql = "update {tbname} set isAudit=:isAudit,auditTime='{$time}',reason=:reason where id=:id ";
     return $this->mPushFile->update($sql, $binds);
 }
 public function getSearchCount($push_id, $where)
 {
     $white_list = array();
     $where = DBHelp::getWhiteItem($where, $white_list);
     $condition = DBHelp::buildWhere($where);
     $sql = "select count(0) from {tbname} where pushId='{$push_id}' and {$condition} ";
     return $this->mPushDetail->getSingle($sql, $where);
 }
Exemple #4
0
 public static function getDbConfig()
 {
     unset($_SESSION["DB_CONFIG"]);
     if (isset($_SESSION["DB_CONFIG"])) {
         //return $_SESSION["DB_CONFIG"];
     }
     self::$dbHost = Config::getValueByKey("DB_HOST");
     self::$dbPort = Config::getValueByKey("DB_PORT");
     self::$dbUser = Config::getValueByKey("DB_USER");
     self::$dbPassword = Config::getValueByKey("DB_PASSWROD");
     self::$dbName = Config::getValueByKey("DB_NAME");
     $db = array("host" => self::$dbHost, "port" => self::$dbPort, "user" => self::$dbUser, "password" => self::$dbPassword, "db" => self::$dbName);
     $_SESSION["DB_CONFIG"] = $db;
     return $db;
 }
Exemple #5
0
 public static function total()
 {
     try {
         $num = _NONE;
         $sql = "select sum(visit_count) as num from countor where 1=1";
         Tool::logger(__METHOD__, __LINE__, sprintf("统计访问总数SQL: %s", $sql), _LOG_DEBUG);
         $conn = DBHelp::getConnection();
         $data = $conn->query($sql);
         if (!empty($data) && $data->num_rows > 0) {
             while ($row = $data->fetch_assoc()) {
                 $num = $row["num"];
                 break;
             }
         }
         DBHelp::close($conn);
         Tool::logger(__METHOD__, __LINE__, sprintf("统计访问总数%u.", $num), _LOG_DEBUG);
         return $num;
     } catch (Exception $e) {
         Tool::logger(__METHOD__, __LINE__, "统计访问总数失败:" . $e->getMessage());
         throw new Exception("统计访问总数失败:" . $e->getMessage());
     }
     return _NONE;
 }
Exemple #6
0
 public static function rcount($query)
 {
     try {
         $rcount = _NONE;
         $sql = "select count(1) as rcount from p_sort where 1=1";
         if (is_numeric($query->sortId) && $query->sortId > 0) {
             $sql = $sql . sprintf(" and sort_id=%u", $query->sortId);
         }
         if (strlen($query->sortName) > 0) {
             $sql = $sql . sprintf(" and p.sortName = ''", $query->sortName);
         }
         Tool::logger(__METHOD__, __LINE__, sprintf("查询产品类型总数SQL: %s", $sql), _LOG_DEBUG);
         $conn = DBHelp::getConnection();
         $data = $conn->query($sql);
         if (!empty($data) && $data->num_rows > 0) {
             while ($row = $data->fetch_assoc()) {
                 $rcount = $row["rcount"];
                 break;
             }
         }
         DBHelp::close($conn);
         Tool::logger(__METHOD__, __LINE__, sprintf("查询产品类型总数%u.", $rcount), _LOG_DEBUG);
         return $rcount;
     } catch (Exception $e) {
         Tool::logger(__METHOD__, __LINE__, "查询数据失败:" . $e->getMessage());
         throw new Exception("查询数据失败:" . $e->getMessage());
     }
     return _NONE;
 }
Exemple #7
0
 public static function rcount($query)
 {
     try {
         $rcount = _NONE;
         $sql = "select count(1) as rcount from doc_file where 1=1";
         if (is_numeric($query->fileId) && $query->fileId > 0) {
             $sql = $sql . sprintf(" and file_id=%u", $query->fileId);
         }
         if (strlen($query->inModule) > 0) {
             $sql = $sql . sprintf(" and in_module='%s'", $query->inModule);
         }
         if (strlen($query->fileKey) > 0) {
             $sql = $sql . sprintf(" and file_key='%s'", $query->fileKey);
         }
         if (strlen($query->savedPath) > 0) {
             $sql = $sql . sprintf(" and saved_path='%s'", $query->fileKey);
         }
         Tool::logger(__METHOD__, __LINE__, sprintf("查询图片总数SQL: %s", $sql), _LOG_DEBUG);
         $conn = DBHelp::getConnection();
         $data = $conn->query($sql);
         if (!empty($data) && $data->num_rows > 0) {
             while ($row = $data->fetch_assoc()) {
                 $rcount = $row["rcount"];
                 break;
             }
         }
         DBHelp::free($data);
         DBHelp::close($conn);
         Tool::logger(__METHOD__, __LINE__, sprintf("文件共%u条记录.", $rcount), _LOG_DEBUG);
         return $rcount;
     } catch (Exception $e) {
         Tool::logger(__METHOD__, __LINE__, "查询数据失败:" . $e->getMessage());
         throw $e;
     }
     return _NONE;
 }
Exemple #8
0
 public static function rcount($query)
 {
     try {
         $rcount = _NONE;
         $sql = "select count(1) as rcount from message where 1=1";
         Tool::logger(__METHOD__, __LINE__, sprintf("查询文本内容总数SQL: %s", $sql), _LOG_DEBUG);
         $conn = DBHelp::getConnection();
         $data = $conn->query($sql);
         if (!empty($data) && $data->num_rows > 0) {
             while ($row = $data->fetch_assoc()) {
                 $rcount = $row["rcount"];
                 break;
             }
         }
         DBHelp::close($conn);
         Tool::logger(__METHOD__, __LINE__, sprintf("查询文本内容 总%u.", $rcount), _LOG_DEBUG);
         return $rcount;
     } catch (Exception $e) {
         Tool::logger(__METHOD__, __LINE__, "查询数据失败:" . $e->getMessage());
         throw new Exception("查询数据失败:" . $e->getMessage());
     }
     return _NONE;
 }
Exemple #9
0
 public function EditSave($member_id, $params)
 {
     $white_list = array('truename', 'qq', 'weixin', 'mobile', 'email', 'companyName', 'productCatId', 'productCatId2', 'status', 'reason', 'defineCatName', 'totalScore');
     $params = DBHelp::getWhiteItem($params, $white_list);
     return $this->mMembers->update("update {$this->mMembers->tbname} set" . DBHelpbuildUpData($params) . " where id='{$member_id}'", $params);
 }