curing.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * Created by MyPC on 2019/11/5.
  3. */
  4. 'use strict';
  5. const hash= require('../class/hash');
  6. module.exports = (sequelize, DataTypes) => {
  7. const curing = sequelize.define('cloud_curing', {
  8. mobile: DataTypes.STRING,
  9. sso_id: DataTypes.STRING,
  10. compilation_id: DataTypes.STRING,
  11. curingCompany: DataTypes.STRING,
  12. sid: DataTypes.INTEGER,
  13. cid: DataTypes.INTEGER,
  14. status: DataTypes.INTEGER,
  15. client_id: DataTypes.INTEGER,
  16. addtime: DataTypes.STRING,
  17. updateTotal:DataTypes.INTEGER,
  18. upgradeDescribe: DataTypes.STRING,
  19. }, {});
  20. curing.associate = function(models) {
  21. // associations can be defined here
  22. };
  23. /*
  24. * 根据mobile获得已绑定养护云版用户
  25. * */
  26. curing.getCuringByMobile=async function(mobile){
  27. if(mobile==undefined){
  28. return [];
  29. }
  30. var condition={
  31. raw:true,
  32. where: {
  33. mobile: mobile
  34. }};
  35. var curingList = await this.findOne(condition);
  36. return curingList;
  37. };
  38. /*
  39. * 根据ssoid获得已绑定养护云版用户
  40. * */
  41. curing.getCuringBySsoid=async function(ssoid){
  42. if(!hash.isExistence(ssoid)){
  43. return [];
  44. }
  45. var condition={
  46. raw:true,
  47. where: {
  48. sso_id: ssoid
  49. }};
  50. var detail = await this.findOne(condition);
  51. if(!hash.isExistence(detail)){
  52. return [];
  53. }
  54. detail.id=hash.hashEncode(detail.id.toString());
  55. return detail;
  56. };
  57. /*
  58. * 根据id获得已绑定养护云版用户
  59. * */
  60. curing.getCuringById=async function(id){
  61. if(!hash.isExistence(id)){
  62. return [];
  63. }
  64. var condition={
  65. raw:true,
  66. where: {
  67. id: id
  68. }};
  69. var detail = await this.findOne(condition);
  70. return detail;
  71. };
  72. /*
  73. * 获得本地编办
  74. * */
  75. curing.getCuringCompilationList=async function(){
  76. return [];
  77. };
  78. return curing;
  79. };