where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false); $this->page_info = $res; return $res->items(); } else { return Db::name('activity')->where($condition)->order($order)->select()->toArray(); } } /** * 添加活动 * @author csdeshang * @param type $data 查询数据 * @return array 一维数组 */ public function addActivity($data) { return Db::name('activity')->insertGetId($data); } /** * 更新活动 * @author csdeshang * @param type $data 活动数据 * @param type $id 活动id * @return type */ public function editActivity($data, $id) { return Db::name('activity')->where("activity_id='$id' ")->update($data); } /** * 删除活动 * @author csdeshang * @param type $condition 删除条件 * @return type */ public function delActivity($condition) { return Db::name('activity')->where($condition)->delete(); } /** * 根据id查询一条活动 * @author csdeshang * @param int $id 活动id * @return array 一维数组 */ public function getOneActivityById($id) { return Db::name('activity')->where('activity_id', $id)->find(); } }