shopService.js 525 B

123456789101112131415161718192021
  1. 'use strict';
  2. const Service = require('egg').Service;
  3. class ShopService extends Service {
  4. async Shop(obj) {
  5. const { ctx } = this;
  6. // 存储数据
  7. // 留神!!!!ctx.model.xxx中xxx指的是model的文件名首字母大写
  8. const ShopList = new ctx.model.ShopModel({
  9. name: obj.name,
  10. // 姓名
  11. notice: obj.notice,
  12. // 护照号
  13. logo: obj.logo || {},
  14. });
  15. // 数据保留到数据库
  16. ShopList.save();
  17. return '增加胜利';
  18. }
  19. }
  20. module.exports = ShopService;