Jelajahi Sumber

推荐接口修改,增加删除推荐活动项

kindring 2 tahun lalu
induk
melakukan
b9b76635bb
2 mengubah file dengan 25 tambahan dan 0 penghapusan
  1. 6 0
      controller/c_recommend.js
  2. 19 0
      routes/recommend_api.js

+ 6 - 0
controller/c_recommend.js

@@ -42,6 +42,11 @@ async function changeRecommend(recommendId,params){
     return result;
 }
 
+async function deleteItem(recommendId,flightId){
+    let [err,result] = await handle(db_recommend.deleteFlight(recommendId,flightId));
+    if(err){throw err}
+    return result;
+}
 /**
  * 修改推就项目信息
  * @param recommendId
@@ -127,6 +132,7 @@ module.exports = {
     list,
     addRecommend,
     addFlight,
+    deleteItem,
     changeRecommend,
     changeRecommendItem,
     homeRecommends,

+ 19 - 0
routes/recommend_api.js

@@ -116,6 +116,25 @@ router.post('/flight/add',
             apiErrHandle('修改航班项目', res, error);
         }
     });
+router.post('/flight/delete',
+    checkLogin(field.adminType),
+    paramsCheck({
+        post: {
+            recommendId: {required: true},
+            flightId: {required: true},
+        }
+    }),
+    async (req, res) => {
+        try {
+            let results = await c_recommend.deleteItem(req.body.recommendId, req.body.flightId);
+            res.json({
+                rcode: code.ok,
+                data: results
+            })
+        } catch (error) {
+            apiErrHandle('修改航班项目', res, error);
+        }
+    });
 
 router.post('/add',
     checkLogin(field.adminType),