get('query'); $csql = new \ciy\sql($table); $csql->where('name like', objstr($query, 'name')); $order = objstr($query, 'order', 'id desc'); $csql->order($order); $query['order'] = $order; return [$query, $csql]; } public static function json_init() { global $db; $rsuser = verifyfast(); $table = get('tab'); $post = new \ciy\post(); list($where, $csql) = self::setwhere($db, $post); $pageno = $post->getint('pageno', 1); $pagecount = $post->getint('pagecount', 10); $csql->limit($pageno, $pagecount); $mainrowcount = $post->getint('count'); $rows = $db->get($csql, $mainrowcount); $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows); if ($post->getbool('field')) { $field = array(); $fshow = $db->getfield($field, $table); foreach ($field as $fr => $v) { if ($post->is('_' . $fr)) $field[$fr]['c'] = ',' . $field[$fr]['c']; } $ret['field'] = $field; $ret['fshow'] = $fshow; } if ($post->getbool('once')) { $ret['once'] = true; $input = array(); $input[] = array( 'type' => 'input', 'form' => 'name', 'name' => '名称' ); $ret['searchinput'] = $input; } return succjson($ret); } }