123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- 'use strict';
- const repository = require('./repository.js');
- exports.main = async function main(event, context) {
- const { page, action, data } = event;
- switch (page) {
- // 团购页面
- case 'tuangou':
- if (action === 'findGroupBuyPage') {
- // 分页查询团购数据
- return await repository.groupbuy.findGroupBuyPage(data)
- } else if (action === 'addGroupBuy') {
- // 新增团购
- return await repository.groupbuy.addGroupBuy(data)
- } else if (action === 'updateGroupBuy') {
- // 编辑团购(根据Id)
- return await repository.groupbuy.updateGroupBuy(data)
- } else if (action === 'deleteGroupBuy') {
- // 删除团购(根据Id)
- return await repository.groupbuy.deleteGroupBuy(data)
- } else if (action === 'findguigeBytuangouId') {
- // 根据团购Id查询规格
- return await repository.groupbuy.findguigeBytuangouId(data)
- } else if (action === 'addguige') {
- // 新增商品规格
- return await repository.groupbuy.addguige(data)
- } else if (action === 'updateguigeById') {
- // 编辑商品规格
- return await repository.groupbuy.updateguigeById(data)
- } else if (action === 'deleteguigeById') {
- // 根据Id删除商品规格
- return await repository.groupbuy.deleteguigeById(data)
- } else {
- throw new Error('接口未实现!')
- }
- // 异常行为预警页面
- case 'yichangxingweiyujing':
- if (action === 'addBehaviorAlarm') {
- // 新增异常行为告警
- return await repository.abnormal.addBehaviorAlarm(data)
- } else if (action === 'deleteBehaviorAlarm') {
- // 删除异常行为告警
- return await repository.abnormal.deleteBehaviorAlarm(data)
- } else if (action === 'updateBehaviorAlarm') {
- // 编辑异常行为告警
- return await repository.abnormal.updateBehaviorAlarm(data)
- } else if (action === 'findBehaviorAlarmPage') {
- // 条件分页查询
- return await repository.abnormal.findBehaviorAlarmPage(data)
- } else if (action === 'findBehaviorAlarmById') {
- // 根据Id查询
- return await repository.abnormal.findBehaviorAlarmById(data)
- } else {
- throw new Error('接口未实现!')
- }
- // 售后管理页面
- case 'shouhouguanli':
- if (action === 'findSchoolAll') {
- // 查询所有学校
- return await repository.aftersales.findSchoolAll(data)
- } else if (action === 'addAfterService') {
- // 新增售后
- return await repository.aftersales.addAfterService(data)
- } else if (action === 'deleteAfterService') {
- // 删除售后
- return await repository.aftersales.deleteAfterService(data)
- } else if (action === 'updateAfterService') {
- // 编辑异常行为告警
- return await repository.aftersales.updateAfterService(data)
- } else if (action === 'findAfterServicePage') {
- // 条件分页查询
- return await repository.aftersales.findAfterServicePage(data)
- } else if (action === 'findAfterServiceById') {
- // 根据Id查询
- return await repository.aftersales.findAfterServiceById(data)
- } else {
- throw new Error('接口未实现!')
- }
- // 下载量统计页面
- case 'xiazailiangtongji':
- if (action === 'findSchoolAll') {
- // 查询所有学校
- return await repository.aftersales.findSchoolAll(data)
- } else if (action === 'addMicrocode') {
- // 新增
- return await repository.download.addMicrocode(data)
- } else if (action === 'deleteMicrocode') {
- // 删除
- return await repository.download.deleteMicrocode(data)
- } else if (action === 'updateMicrocode') {
- // 编辑
- return await repository.download.updateMicrocode(data)
- } else if (action === 'findMicrocodePage') {
- // 条件分页查询
- return await repository.download.findMicrocodePage(data)
- } else if (action === 'findMicrocodeById') {
- // 根据Id查询
- return await repository.download.findMicrocodeById(data)
- } else {
- throw new Error('接口未实现!')
- }
- // 订单管理页面
- case 'dingdanguanli':
- if (action === 'addOrder') {
- // 新增
- return await repository.order.addOrder(data)
- } else if (action === 'deleteOrder') {
- // 删除
- return await repository.order.deleteOrder(data)
- } else if (action === 'updateOrder') {
- // 编辑
- return await repository.order.updateOrder(data)
- } else if (action === 'findOrderPage') {
- // 条件
- return await repository.order.findOrderPage(data)
- } else if (action === 'findOrderById') {
- // 根据Id查询
- return await repository.order.findOrderById(data)
- } else {
- throw new Error('接口未实现!')
- }
- // 用户行为统计页面
- case 'userstats':
- if (action === 'addMmonitorBehavior') {
- // 新增
- return await repository.userstats.addMmonitorBehavior(data)
- } else if (action === 'deleteMmonitorBehavior') {
- // 删除
- return await repository.userstats.deleteMmonitorBehavior(data)
- } else if (action === 'updateMmonitorBehavior') {
- // 编辑
- return await repository.userstats.updateMmonitorBehavior(data)
- } else if (action === 'findMmonitorBehaviorPage') {
- // 条件
- return await repository.userstats.findMmonitorBehaviorPage(data)
- } else if (action === 'findMmonitorBehaviorById') {
- // 根据Id查询
- return await repository.userstats.findMmonitorBehaviorById(data)
- } else {
- throw new Error('接口未实现!')
- }
- // 付款统计页面接口
- case 'payment':
- if (action === 'findPaymentPage') {
- // 按照班级分组
- return await repository.payment.findPaymentPage(data)
- } else if (action === 'findPaymentPageBySchool') {
- // 按照学校分组
- return await repository.payment.findPaymentPageBySchool(data)
- } else {
- throw new Error('接口未实现!')
- }
- // 首页接口
- case 'home':
- if (action === 'findCountAndTotal') {
- // 今日,今年下单付款统计
- return await repository.home.findCountAndTotal()
- } else if (action === 'findBehaviorAlarm') {
- // 查询异常行为预警
- return await repository.home.findBehaviorAlarm()
- } else if (action === 'findOrderCountByMonth') {
- // 按月份统计下单量
- return await repository.home.findOrderCountByMonth(data)
- } else if (action === 'findOrderCountByDay') {
- // 按天统计下单量
- return await repository.home.findOrderCountByDay(data)
- } else if (action === 'findFileCount') {
- // 按月份分组查询课件上传统计
- return await repository.home.findFileCount(data)
- } else {
- throw new Error('接口未实现!')
- }
- //推荐
- case 'recommende':
- if (action === 'findFileRangee') {
- return await repository.recommend.findFileRangee(data)
- } else {
- throw new Error('接口未实现!')
- }
- default:
- throw new Error('未知的操作类型')
- }
- }
|