diff --git a/model/lyf.js b/model/lyf.js index 29562ae2bd9fe97bb7ad06a7fe73a51b64dd2254..a30f18e23da6f0b128fd36e2a3b56cc6b3d19849 100644 --- a/model/lyf.js +++ b/model/lyf.js @@ -1,8 +1,20 @@ const mongoose = require("./db"); const Schema = mongoose.Schema; +let AsspSchame = new Schema({ + name: String, + value: Number, +}); +let categorySchema = new Schema({ + name: String, + value: Number, +}); -module.exports = { - -}; +let AsspModel = mongoose.model("assp", AsspSchame); +let categoryModel = mongoose.model("category", categorySchema); +AsspModel.create({ + name:'退货退款', + value:500 +}) +module.exports = { AsspModel, categoryModel }; diff --git a/routes/lyf.js b/routes/lyf.js index fee3a76c07a27a008e12c14e66bbaf6d42ad80aa..263a1668b2003908732af36e1f80e6dccd4d87ac 100644 --- a/routes/lyf.js +++ b/routes/lyf.js @@ -1,5 +1,23 @@ -var express = require('express'); +var express = require("express"); var router = express.Router(); +let { AsspModel, categoryModel } = require("../model/lyf.js"); +router.get("/getassp", async (req, res) => { + let data = await AsspModel.find(); + res.send({ + status: 0, + message: "获取成功", + data, + }); +}); + +router.get("/getcategory", async (req, res) => { + let data = await categoryModel.find(); + res.send({ + status: 0, + message: "获取成功", + data, + }); +}); module.exports = router;