<?php
/**
 * [LJCMS] (C)2012-2099 LJdev,Inc.
 * <E-Mail：aspcms@qq.com>
 * Url http://www.liangjing.org
 *     http://www.8CMS.com
 * Update 2013.11.19
*/

class orderAModel extends X {
    
    public function getList($items) {
        $where      = " WHERE 1=1".$items['searchsql'];
        $start      = ($items['page']-1)*$items['pagesize'];
        $countsql   = "SELECT COUNT(v.id) FROM ".DB_PREFIX."order AS v".$where;
        $total      = parent::$obj->fetch_count($countsql);
        $sql        = "SELECT v.*,g.nickname".
        " FROM ".DB_PREFIX."order AS v".
        " LEFT JOIN ".DB_PREFIXOA."user AS g ON v.user_id=g.id".
        $where." ORDER BY v.id DESC LIMIT ".$start.", ".$items['pagesize']."";

        $array = parent::$obj->getall($sql);
    
        return array($total, $array);
    }
       public function doDel($id) {
        $sql = "DELETE FROM ".DB_PREFIX."notify WHERE adminid='".intval($id)."'";
        return parent::$obj->query($sql);
    }

    public function gettiList($items) {
        $where      = " WHERE 1=1".$items['searchsql'];
        $start      = ($items['page']-1)*$items['pagesize'];
        $countsql   = "SELECT COUNT(v.id) FROM ".DB_PREFIX."tiorder AS v".$where;
        $total      = parent::$obj->fetch_count($countsql);
        $sql        = "SELECT v.*,g.name,g.nickname".
            " FROM ".DB_PREFIX."tiorder AS v".
            " LEFT JOIN ".DB_PREFIXOA."user AS g ON v.user_id=g.id".
            $where." ORDER BY v.id DESC LIMIT ".$start.", ".$items['pagesize']."";

        $array = parent::$obj->getall($sql);

        return array($total, $array);
    }
    public function getdata($ordernum){
           $sql        = "SELECT v.*,g.name,g.nickname".
            " FROM ".DB_PREFIX."tiorder AS v".
            " LEFT JOIN ".DB_PREFIXOA."user AS g ON v.user_id=g.id  WHERE order_number='$ordernum'";
            return parent::$obj->fetch_first($sql);

    }
}
?>