field($field)->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false); $this->page_info = $res; $result = $res->items(); } else { $result = Db::name('pmansongquota')->field($field)->where($condition)->order($order)->select()->toArray(); } return $result; } /** * 读取单条记录 * @access public * @author csdeshang * @param type $condition 条件 * @return type */ public function getMansongquotaInfo($condition) { $result = Db::name('pmansongquota')->where($condition)->find(); return $result; } /** * 获取当前可用套餐 * @access public * @author csdeshang * @param int $store_id 店铺id * @return array */ public function getMansongquotaCurrent($store_id) { $condition = array(); $condition[] = array('store_id', '=', $store_id); $condition[] = array('mansongquota_endtime', '>', TIMESTAMP); return $this->getMansongquotaInfo($condition); } /** * 增加 * @access public * @author csdeshang * @param array $data 数据 * @return bool */ public function addMansongquota($data) { return Db::name('pmansongquota')->insertGetId($data); } /** * 更新 * @access public * @author csdeshang * @param array $update 更新数据 * @param array $condition 条件 * @return bool */ public function editMansongquota($update, $condition) { return Db::name('pmansongquota')->where($condition)->update($update); } /** * 删除 * @access public * @author csdeshang * @param array $condition 条件 * @return bool */ public function delMansongquota($condition) { return Db::name('pmansongquota')->where($condition)->delete(); } }