コード例 #1
0
ファイル: Project.class.php プロジェクト: xuyintao/thindev
 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;
 }
コード例 #2
0
ファイル: Memo.class.php プロジェクト: xuyintao/thindev
 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;
 }
コード例 #3
0
ファイル: Department.class.php プロジェクト: xuyintao/thindev
 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;
 }
コード例 #4
0
ファイル: Hours.class.php プロジェクト: xuyintao/thindev
 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;
 }
コード例 #5
0
ファイル: Category.class.php プロジェクト: xuyintao/web01
 function addOrEditCategory($id, $description, $displayOrder, $status, $name, $nameUrl, $parentId, $image)
 {
     $mysql = new Mysql();
     // @helu time 2014-06-13
     //判断别名是否添加过如果添加过则不能添加
     $sqlAlias = "SELECT COUNT(nameurl) as countId, id FROM " . $mysql->dbpre . "category" . $mysql->debug;
     $sqlAlias .= " WHERE nameurl= '" . $mysql->escape($nameUrl) . "'";
     $aliasRes = $mysql->getData($sqlAlias);
     $aliasCount = intval($aliasRes[0]['countId']);
     $aliasId = $aliasRes[0]['id'];
     // var_dump( $id );
     // var_dump( $aliasCount );
     // var_dump( $aliasId );
     // exit;
     if ($aliasCount === 1) {
         if (empty($id) || $id != $aliasId) {
             $result = array();
             $result['Success'] = false;
             $result['Code'] = -1;
             // -1 : 别名已经添加过
             $mysql->closeDb();
             return $result;
         }
     }
     if ($id > 0) {
         $sqlformat = "update %scategory%s set Description='%s',DisplayOrder=%d,status=%d,name='%s',nameurl='%s',parentid=%d,image='%s' where id=%d and belong=%d";
         $sql = sprintf($sqlformat, $mysql->dbpre, $mysql->debug, $mysql->escape($description), intval($displayOrder), intval($status), $mysql->escape($name), $mysql->escape($nameUrl), intval($parentId), $mysql->escape($image), intval($id), intval($this->Belong));
     } else {
         $sqlformat = "insert into %scategory%s (Description,DisplayOrder,status,Name,NameUrl,ParentId,Image,Belong,Creator) values('%s',%d,%d,'%s','%s',%d,'%s',%d,%d)";
         $sql = sprintf($sqlformat, $mysql->dbpre, $mysql->debug, $mysql->escape($description), intval($displayOrder), intval($status), $mysql->escape($name), $mysql->escape($nameUrl), intval($parentId), $mysql->escape($image), intval($this->Belong), intval($this->Creator));
     }
     $result = $mysql->runSql($sql);
     $mysql->closeDb();
     return $result;
 }
コード例 #6
0
ファイル: Post.class.php プロジェクト: xuyintao/web01
 function getChildPosts2($ids)
 {
     $mysql = new Mysql();
     //$postSearch=new PostSearch();
     $sql = "select Id,Subject,Image,Summary,Content,Link,Belong from " . $mysql->dbpre . "post" . $mysql->debug . " where belong=" . intval($this->Belong);
     $sql .= " and id in (" . $ids . ") limit 10;";
     $result = $mysql->getData($sql);
     $mysql->closeDb();
     return $result;
 }
コード例 #7
0
ファイル: Project.class.php プロジェクト: xuyintao/thindev
 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;
 }
コード例 #8
0
ファイル: User.class.php プロジェクト: xuyintao/thindev
 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;
 }