1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import HoverService from "../service/hover-service.js";
- import ApiResult from "../config/api.js";
- const HoverControl = {
- list: async (req, res) => {
- try {
- HoverService.list(req.body).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- page: async (req, res) => {
- try {
- HoverService.page(req.body).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- info: async (req, res) => {
- try {
- HoverService.info(req.params.id).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- add: async (req, res) => {
- try {
- HoverService.add(req.body).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- edit: async (req, res) => {
- try {
- HoverService.edit(req.body).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- del: async (req, res) => {
- try {
- HoverService.del(req.params?.ids?.split(',')).then(data => {
- res.send(new ApiResult().success(data))
- }).catch((e) => {
- res.send(new ApiResult().error(null, e))
- })
- } catch (e) {
- res.send(new ApiResult().error(e))
- }
- },
- }
- export default HoverControl
|