| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- Doo::loadCore('db/DooModel');
- class Product extends DooModel {
- public $pid;
- public $title;
- public $fulltitle;
- public $content;
- public $p_type;
- public $logo;
- public $link;
- public $anid;
- public $edition;
- public $did;
- public $cid;
- public $time;
- public $orders;
-
- public $_table = 'sc_product';
- public $_primarykey = 'pid';
- public $_fields = array('pid', 'title','fulltitle', 'content', 'p_type' ,'logo','link','anid', 'edition', 'did', 'cid', 'time','orders');
- public function countArchive() {
- return $this->count();
- }
- function getProductByCid($cid = 0 ,$p_type=1){//or p_type=".$p_type." )
- return $this->find ( array ('asc' => 'orders', 'where' => 'cid=' . $cid." and p_type!=2 ", 'asArray' => TRUE ) );
-
- }
-
- function getProductByCidAll($cid = 0 ){
- return $this->find ( array ('asc' => 'orders', 'where' => ' cid=' . $cid." and p_type!=3 ", 'asArray' => TRUE ) );
-
- }
-
- function getProductById($pid = 0 ) {
-
- return $this->find ( array ('asc' => 'time', 'where' => 'pid=' . $pid, 'asArray' => TRUE ) );
- }
-
- function getProductList($data = array(), $condition = "", $limit = ""){
- foreach ( $data as $key => $value ) {
- if (is_numeric ( $value ))
- $condition .= " and " . $key . " = " . $value;
- 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 deleteProductByIdList($id){
- $id = implode ( ",", $id );
-
- $sql = "delete from " . $this->_table . " where pid in ( " . $id . " )";
-
- Doo::db ()->query ( $sql );
- }
-
- }
- ?>
|