Exemplo n.º 1
0
 public function getList($search)
 {
     $mysql = new Mysql();
     $PageSize = intval($search->PageSize);
     $FirstRow = intval($search->PageIndex - 1) * $PageSize;
     $sqlList = "select Subject,Url from project where (Status=6 or Status=7) and Type=" . intval($this->Type) . " order by Pv desc LIMIT {$FirstRow}, {$PageSize};";
     $sqlCount = "select count(Id) from project where (Status=6 or Status=7) and Type=" . intval($this->Type);
     $res = array();
     if ($search->NeedCount) {
         // 查找 count 和 数据
         $totalCount = $mysql->getVar($sqlCount);
         if (empty($totalCount)) {
             $res["Success"] = true;
             $res["Data"] = null;
             $res["Count"] = 0;
         } else {
             $res["Success"] = true;
             $res["Data"] = $mysql->getData($sqlList);
             $res["Count"] = $totalCount;
         }
     } else {
         // 只查找数据
         $res["Success"] = true;
         $res["Data"] = $mysql->getData($sqlList);
     }
     $mysql->closeDb();
     return $res;
 }
Exemplo n.º 2
0
 public function getUserByProjectId($projectId)
 {
     $mysql = new Mysql();
     $sql = "SELECT GROUP_CONCAT(DISTINCT result.UserId) as Ids ,GROUP_CONCAT(DISTINCT result.name) as Names FROM (SELECT d.UserId,u.Name FROM " . $mysql->dbpre . "developer" . $mysql->debug . " as d ," . $mysql->dbpre . "user" . $mysql->debug . " as u WHERE d.UserId=u.UserId and ProjectId=" . intval($projectId) . " ) as result";
     //echo $sql;
     $result = $mysql->getLine($sql);
     $mysql->closeDb();
     return $result;
 }
Exemplo n.º 3
0
 public function getList($projectId)
 {
     $mysql = new Mysql();
     $sql = "SELECT m.*,u.Name FROM " . $mysql->dbpre . "memo" . $mysql->debug . " as m," . $mysql->dbpre . "user" . $mysql->debug . " as u WHERE m.UserId=u.UserId AND ProjectId=" . intval($projectId);
     // var_dump( $sql );
     // exit;
     $result = $mysql->getData($sql);
     $mysql->closeDb();
     return $result;
 }
Exemplo n.º 4
0
 public function add()
 {
     $reValue = 0;
     $mysql = new Mysql();
     $sql = "insert into boguan_tubu_invit (Name,Phone,Address,CreateTime) values(\n    \t\t'" . $mysql->escape($this->Name) . "',\n            '" . $mysql->escape($this->Phone) . "',\n    \t\t'" . $mysql->escape($this->CreateTime) . "'\n    \t\t)";
     //echo $sql;
     $mysql->runSql($sql);
     $reValue = $mysql->lastId();
     if ($mysql->errno() == 1062) {
         $reValue = -1;
     }
     $mysql->closeDb();
     return $reValue;
 }
Exemplo n.º 5
0
 public function getListByParentId($parentId)
 {
     $mysql = new Mysql();
     $sql = "select * from " . $mysql->dbpre . "department" . $mysql->debug . " where parentId=" . intval($this->ParentId);
     $data = $mysql->getData($sql);
     $mysql->closeDb();
     $res = array();
     if (!empty($data)) {
         $res["Success"] = true;
         $res["Data"] = $data;
     } else {
         $res["Success"] = false;
     }
     return $res;
 }
Exemplo n.º 6
0
 public function getList($search)
 {
     $mysql = new Mysql();
     $PageSize = intval($search->PageSize);
     $FirstRow = intval($search->PageIndex - 1) * $PageSize;
     $sqlList = "SELECT h.*,(SELECT Subject FROM " . $mysql->dbpre . "project" . $mysql->debug . " WHERE Id=h.ProjectId) AS Subject,u.Name,u.Ratio as UserRotio FROM " . $mysql->dbpre . "hours" . $mysql->debug . " as h," . $mysql->dbpre . "user" . $mysql->debug . " as u WHERE h.UserId=u.UserId";
     $sqlCount = "SELECT COUNT(Id) from " . $mysql->dbpre . "hours" . $mysql->debug . " where 1=1";
     if ($search->ProjectId > -1) {
         $sqlList .= " AND ProjectId= " . intval($search->ProjectId);
         $sqlCount .= " AND ProjectId= " . intval($search->ProjectId);
     }
     if ($search->Status > -1) {
         $sqlList .= " AND Status= " . intval($search->Status);
         $sqlCount .= " AND Status= " . intval($search->Status);
     }
     // var_dump( $sql );
     // exit;
     $sqlList .= " Order by id desc LIMIT {$FirstRow}, {$PageSize};";
     //var_dump( $sqlList );
     //var_dump( $sqlCount );
     // 		exit;
     $res = array();
     if ($search->NeedCount) {
         // 查找 count 和 数据
         $totalCount = $mysql->getVar($sqlCount);
         if (empty($totalCount)) {
             $res["Success"] = true;
             $res["Data"] = null;
             $res["Count"] = 0;
         } else {
             $res["Success"] = true;
             $res["Data"] = $mysql->getData($sqlList);
             //print_r($sqlList);
             $res["Count"] = $totalCount;
         }
         //$Res["Set"] = true;
     } else {
         // 只查找数据
         $res["Success"] = true;
         $res["Data"] = $mysql->getData($sqlList);
         //$res["Set"] = false;
     }
     $mysql->closeDb();
     // $Res["Sql"] = $Sql;
     // $Res["SqlCount"] = $SqlCount;
     return $res;
 }
Exemplo n.º 7
0
 function delCategories($ids, $root)
 {
     $mysql = new Mysql();
     $sqlformat = "delete from %scategory%s where belong=%d and id in (%s)";
     $sql = sprintf($sqlformat, $mysql->dbpre, $mysql->debug, $this->Belong, $ids);
     //echo $sql;return;
     $result = $mysql->runSql($sql);
     if ($result) {
         $newParentId = $root + 1000;
         //转移子分类到默认分类里
         $sqlformat = "Update %scategory%s set ParentId=%d where belong=%d and parentId in (" . $ids . ")";
         $sql = sprintf($sqlformat, $mysql->dbpre, $mysql->debug, intval($newParentId), $this->Belong, $ids);
         //echo $sql;
         $result = $mysql->runSql($sql);
     }
     $mysql->closeDb();
     return $result;
 }
Exemplo n.º 8
0
 function delPosts($ids)
 {
     $mysql = new Mysql();
     $sql = "delete from  " . $mysql->dbpre . "post" . $mysql->debug . " where belong=" . intval($this->Belong) . " and id in (" . $ids . ")";
     $mysql->runSql($sql);
     $mysql->closeDb();
     return true;
 }
Exemplo n.º 9
0
 function getList($search)
 {
     $mysql = new Mysql();
     $PageSize = intval($search->PageSize);
     $FirstRow = intval($search->PageIndex - 1) * $PageSize;
     $sqlList = "SELECT *,(SELECT name FROM user WHERE UserId=p.UserId) as Name from " . $mysql->dbpre . "project" . $mysql->debug . " as p where 1=1";
     $sqlCount = "SELECT COUNT(Id) from " . $mysql->dbpre . "project" . $mysql->debug . " where 1=1";
     if ($search->Type > -1) {
         $sqlList .= " AND Type= " . intval($search->Type);
         $sqlCount .= " AND Type= " . intval($search->Type);
     }
     if ($search->Department > -1) {
         $sqlList .= " AND Department= " . intval($search->Department);
         $sqlCount .= " AND Department= " . intval($search->Department);
     }
     if ($search->Team > -1) {
         $sqlList .= " AND Team= " . intval($search->Team);
         $sqlCount .= " AND Team= " . intval($search->Team);
     }
     if ($search->Status > 0) {
         if ($search->Status == 100) {
             $sqlList .= " AND Status<6";
             $sqlCount .= " AND Status<6";
         } else {
             if ($search->Status == 200) {
                 $sqlList .= " AND Status>5 AND Status<10";
                 $sqlCount .= " AND Status>5 AND Status<10";
             } else {
                 $sqlList .= " AND Status=" . intval($search->Status);
                 $sqlCount .= " AND Status=" . intval($search->Status);
             }
         }
     }
     if ($search->UserId > 0) {
         $sqlList .= " AND UserId= " . intval($search->UserId);
         $sqlCount .= " AND UserId =" . intval($search->UserId);
     }
     if ($search->Developer > 0) {
         $sqlList .= " AND ( Id in ( SELECT ProjectId FROM " . $mysql->dbpre . "hours" . $mysql->debug . " where UserId =" . intval($search->Developer) . ")";
         $sqlCount .= " AND ( Id in ( SELECT ProjectId FROM " . $mysql->dbpre . "hours" . $mysql->debug . " where UserId =" . intval($search->Developer) . ")";
         $sqlList .= " OR Id in ( SELECT ProjectId FROM " . $mysql->dbpre . "developer" . $mysql->debug . " where UserId =" . intval($search->Developer) . "))";
         $sqlCount .= " OR Id in ( SELECT ProjectId FROM " . $mysql->dbpre . "developer" . $mysql->debug . " where UserId =" . intval($search->Developer) . "))";
     }
     //	1按提交顺序(从先到后)2按上线时间(从近到远)3按总PV值(从高到低)4按推荐指数(从高到低)5按工时(从少到多)
     switch ($search->Order) {
         case 1:
             $sqlList .= " ORDER BY ID ASC";
             break;
         case 2:
             $sqlList .= " ORDER BY PublishTime DESC";
             break;
         case 3:
             $sqlList .= " ORDER BY PV DESC";
             break;
         case 4:
             $sqlList .= " ORDER BY LAUD DESC,PublishTime DESC";
             break;
         case 5:
             $sqlList .= " ORDER BY Hours ASC";
             break;
         default:
             if ($search->Status == 200) {
                 $sqlList .= " ORDER BY PublishTime DESC";
             } else {
                 if ($search->Status == 100) {
                     $sqlList .= " ORDER BY PublishTime ASC, CreateTime ASC";
                 } else {
                     $sqlList .= " ORDER BY Status ASC";
                 }
             }
             break;
     }
     $sqlList .= " LIMIT {$FirstRow}, {$PageSize};";
     //var_dump( $sqlList );
     //var_dump( $sqlCount );
     // 		exit;
     $res = array();
     if ($search->NeedCount) {
         // 查找 count 和 数据
         $totalCount = $mysql->getVar($sqlCount);
         if (empty($totalCount)) {
             $res["Success"] = true;
             $res["Data"] = null;
             $res["Count"] = 0;
         } else {
             $res["Success"] = true;
             $res["Data"] = $mysql->getData($sqlList);
             //print_r($sqlList);
             $res["Count"] = $totalCount;
         }
         //$Res["Set"] = true;
     } else {
         // 只查找数据
         $res["Success"] = true;
         $res["Data"] = $mysql->getData($sqlList);
         //$res["Set"] = false;
     }
     $mysql->closeDb();
     // $Res["Sql"] = $Sql;
     // $Res["SqlCount"] = $SqlCount;
     return $res;
 }
Exemplo n.º 10
0
 public function getUserListByDept($deptId)
 {
     $mysql = new Mysql();
     $sql = "SELECT UserId,Name FROM " . $mysql->dbpre . "user" . $mysql->debug . " WHERE  Department=" . intval($deptId);
     // var_dump( $sql );
     // exit;
     $result = $mysql->getData($sql);
     $mysql->closeDb();
     return $result;
 }