where($condition)->field($field)->order($order)->paginate(['list_rows'=>$pagesize,'query' => request()->param()],false); $this->page_info=$res; return $res->items(); }else{ return Db::name('mallconsult')->where($condition)->field($field)->order($order)->select()->toArray(); } } /** * 咨询数量 * @access public * @author o1h.cn * @param type $condition 条件 * @return int */ public function getMallconsultCount($condition) { return Db::name('mallconsult')->where($condition)->count(); } /** * 单条咨询 * @access public * @author o1h.cn * @param type $condition 条件 * @param type $field 字段 * @return type */ public function getMallconsultInfo($condition, $field = '*') { return Db::name('mallconsult')->where($condition)->field($field)->find(); } /** * 咨询详细信息 * @access public * @author o1h.cn * @param int $mallconsult_id ID编号 * @return boolean|multitype: */ public function getMallconsultDetail($mallconsult_id) { $consult_info = $this->getMallconsultInfo(array('mallconsult_id' => $mallconsult_id)); if (empty($consult_info)) { return false; } $type_info = model('mallconsulttype')->getMallconsulttypeInfo(array('mallconsulttype_id' => $consult_info['mallconsulttype_id']), 'mallconsulttype_name'); return array_merge($consult_info, $type_info); } /** * 添加咨询 * @access public * @author o1h.cn * @param array $insert 参数内容 * @return bool */ public function addMallconsult($insert) { $insert['mallconsult_addtime'] = TIMESTAMP; return Db::name('mallconsult')->insertGetId($insert); } /** * 编辑咨询 * @access public * @author o1h.cn * @param array $condition 条件 * @param array $update 数据 * @return boolean */ public function editMallconsult($condition, $update) { return Db::name('mallconsult')->where($condition)->update($update); } /** * 删除咨询 * @access public * @author o1h.cn * @param array $condition 条件 * @return boolean */ public function delMallconsult($condition) { return Db::name('mallconsult')->where($condition)->delete(); } }