'use strict'; /** * 标段数据模型 * * @author CaiAoLin * @date 2021/8/23 * @version */ module.exports = app => { class TenderMap extends app.BaseService { /** * 构造函数 * * @param {Object} ctx - egg全局变量 * @return {void} */ constructor(ctx) { super(ctx); this.tableName = 'tender_map'; } async addMap(tid, name) { const data = { tid, name, create_time: new Date(), }; return await this.db.insert(this.tableName, data); } async saveMap(mapData) { const id = mapData.id; const updateData = { name: mapData.name, color: mapData.color, map_json: mapData.map_json, center: mapData.center, tips: mapData.tips, }; return await this.db.update(this.tableName, updateData, { where: { id } }); } } return TenderMap; };