|
@@ -3,7 +3,7 @@
|
|
|
Doo::loadCore ( 'db/DooModel' );
|
|
|
|
|
|
class Article extends DooModel {
|
|
|
-
|
|
|
+
|
|
|
public $aid;
|
|
|
public $title;
|
|
|
public $content;
|
|
@@ -13,9 +13,9 @@ class Article extends DooModel {
|
|
|
public $trainingType;
|
|
|
public $area;
|
|
|
public $enroll;
|
|
|
-
|
|
|
+
|
|
|
public $enroll_title;
|
|
|
-
|
|
|
+
|
|
|
public $enroll_obj;
|
|
|
public $enroll_content;
|
|
|
public $enroll_fun;
|
|
@@ -24,27 +24,27 @@ class Article extends DooModel {
|
|
|
public $enroll_name;
|
|
|
public $enroll_downdoc;
|
|
|
public $enroll_mark;
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
public $attachment;
|
|
|
public $cid;
|
|
|
public $enroll_time;
|
|
|
public $time;
|
|
|
public $update_time;
|
|
|
-
|
|
|
+
|
|
|
public $_table = 'sc_article';
|
|
|
public $_primarykey = 'aid';
|
|
|
public $_fields = array ('aid', 'title', 'content','synopsis','thum' ,'a_type','trainingType','area','enroll_title', 'enroll','enroll_obj','enroll_content',
|
|
|
'enroll_fun','enroll_adrr','enroll_pay','enroll_name','enroll_downdoc','enroll_mark','attachment', 'cid','enroll_time', 'time','update_time' );
|
|
|
-
|
|
|
+
|
|
|
function getArticleById($aid = 0) {
|
|
|
-
|
|
|
+
|
|
|
return $this->find ( array ('desc' => 'time', 'where' => 'aid=' . $aid, 'asArray' => TRUE ) );
|
|
|
}
|
|
|
|
|
|
function getArticleByTrain($trainingType=2){
|
|
|
return $this->find ( array ('desc' => 'time', 'where' => 'a_type=2 and trainingType='.$trainingType, 'asArray' => TRUE ) );
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// function getArticleByTrain2($trainingType= '',$area = ''){
|
|
@@ -101,26 +101,26 @@ class Article extends DooModel {
|
|
|
$sql .= ' and time+63072000 >= unix_timestamp(now())';
|
|
|
return $this->count ( array ('where' => 'a_type=2'.$sql, 'asArray' => TRUE ) );
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
function getArticleByTrainAid($aid){
|
|
|
return $this->find ( array ('desc' => 'time', 'where' => 'a_type=2 and aid='.$aid, 'asArray' => TRUE ) );
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
function getArticleByCid($cid = 0,$limit) {
|
|
|
-
|
|
|
+
|
|
|
return $this->find ( array ('desc' => 'time', 'limit'=>$limit , 'where' => 'cid=' . $cid, 'asArray' => TRUE ) );
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
function getArticleByCid3($cid = 0,$limit) {
|
|
|
-
|
|
|
+
|
|
|
return $this->find ( array ('desc' => 'update_time', 'limit'=>$limit , 'where' => 'cid=' . $cid, 'asArray' => TRUE ) );
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
function getArticleByCid2($cid = 0,$limit) {
|
|
|
-
|
|
|
+
|
|
|
return $this->find ( array ('desc' => 'update_time', 'limit'=>$limit , 'where' => '(cid=' . $cid .' or cid=3 or cid=7) and title !=""', 'asArray' => TRUE ) );
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
function getArticleList($data = array(), $condition = "", $limit = ""){
|
|
|
foreach ( $data as $key => $value ) {
|
|
|
if (is_numeric ( $value ))
|
|
@@ -128,23 +128,23 @@ function getArticleByCid2($cid = 0,$limit) {
|
|
|
else
|
|
|
$condition .= " and " . $key . " like '%" . $value . "%' ";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$condition = ' where 1 ' . $condition . $limit;
|
|
|
-
|
|
|
+
|
|
|
$sql = "select * from " . $this->_table . $condition;
|
|
|
-
|
|
|
+
|
|
|
$query = Doo::db ()->query ( $sql );
|
|
|
-
|
|
|
+
|
|
|
$result = $query->fetchAll ();
|
|
|
-
|
|
|
+
|
|
|
return $result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
function deleteArticleByIdList($id){
|
|
|
$id = implode ( ",", $id );
|
|
|
-
|
|
|
+
|
|
|
$sql = "delete from " . $this->_table . " where aid in ( " . $id . " )";
|
|
|
-
|
|
|
+
|
|
|
Doo::db ()->query ( $sql );
|
|
|
}
|
|
|
|