/** * Created by MyPC on 2019/11/5. */ 'use strict'; const hash= require('../class/hash'); module.exports = (sequelize, DataTypes) => { const curing = sequelize.define('cloud_curing', { mobile: DataTypes.STRING, sso_id: DataTypes.STRING, compilation_id: DataTypes.STRING, curingCompany: DataTypes.STRING, sid: DataTypes.INTEGER, cid: DataTypes.INTEGER, status: DataTypes.INTEGER, client_id: DataTypes.INTEGER, addtime: DataTypes.STRING, updateTotal:DataTypes.INTEGER, upgradeDescribe: DataTypes.STRING, }, {}); curing.associate = function(models) { // associations can be defined here }; /* * 根据mobile获得已绑定养护云版用户 * */ curing.getCuringByMobile=async function(mobile){ if(mobile==undefined){ return []; } var condition={ raw:true, where: { mobile: mobile }}; var curingList = await this.findOne(condition); return curingList; }; /* * 根据ssoid获得已绑定养护云版用户 * */ curing.getCuringBySsoid=async function(ssoid){ if(!hash.isExistence(ssoid)){ return []; } var condition={ raw:true, where: { sso_id: ssoid }}; var detail = await this.findOne(condition); if(!hash.isExistence(detail)){ return []; } detail.id=hash.hashEncode(detail.id.toString()); return detail; }; /* * 根据id获得已绑定养护云版用户 * */ curing.getCuringById=async function(id){ if(!hash.isExistence(id)){ return []; } var condition={ raw:true, where: { id: id }}; var detail = await this.findOne(condition); return detail; }; /* * 获得本地编办 * */ curing.getCuringCompilationList=async function(){ return []; }; return curing; };