//文章统计

$counts = Db('archives')->where('users_id',$users_id)->count();

$this->assign('counts',$counts);

        $arr =  Db('archives')

            ->field('t.*,a.*')

            ->alias('a')

            ->join('__ARCTYPE__ t', 'a.typeid = t.id', 'LEFT')

            ->where('users_id',$users_id)

            ->order('a.sort_order asc, a.aid desc')

            ->select();

$this->assign('arr',$arr);