12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import SourceService from "../service/source-service.js";
- import ApiResult from "../config/api.js";
- const SourceControl = {
- list: async (req, res) => {
- try {
- SourceService.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 {
- SourceService.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 {
- SourceService.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 {
- SourceService.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))
- }
- },
- }
- export default SourceControl
|