model->where($where)->orderByRaw($order); if ($limit) { $rst->limit($limit); } return $rst->get(); } /** * 搜索次数增加1,如果不存在则增加一条数据 */ public function setInc($word, $type, $user_data) { $word = trim($word); $word = substr($word, 0, 120); $where = array( 'w_word'=>$word, 'type' =>$type, 'utype' => $user_data['utype'], 'uid' => $user_data['uid'] ); $word_info = $this->model->where($where)->first(); $stime = date('Y-m-d H:i:s', time()); if ($word_info) { return $this->model->where(array('id'=>$word_info->id))->increment('w_hot', 1); } else { $data = array( 'w_word' => $word, 'w_hot' => 1, 'type' => $type, 'utype' => $user_data['utype'], 'uid' => $user_data['uid'], 'list_order' => 0 ); return $this->model->create($data); } //return true; } }