curing.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. curing.getCuringInMobile=async function(mobile,compilation_id){
  24. var option={
  25. where: {
  26. mobile: {
  27. [Op.or]: [mobile]
  28. }
  29. },
  30. raw:true,
  31. };
  32. if(hash.isExistence(compilation_id)){
  33. option.where={compilation_id: compilation_id};
  34. }
  35. if(mobile==undefined){
  36. return [];
  37. }
  38. var condition={
  39. raw:true,
  40. where: {
  41. mobile: mobile
  42. }};
  43. var curingList = await this.findOne(condition);
  44. return curingList;
  45. };
  46. /*
  47. * ����mobile����Ѱ������ư��û�
  48. * */
  49. curing.getCuringByMobile=async function(mobile){
  50. if(mobile==undefined){
  51. return [];
  52. }
  53. var condition={
  54. raw:true,
  55. where: {
  56. mobile: mobile
  57. }};
  58. var curingList = await this.findOne(condition);
  59. return curingList;
  60. };
  61. /*
  62. * ����ssoid����Ѱ������ư��û�
  63. * */
  64. curing.getCuringBySsoid=async function(ssoid){
  65. if(!hash.isExistence(ssoid)){
  66. return [];
  67. }
  68. var condition={
  69. raw:true,
  70. where: {
  71. sso_id: ssoid
  72. }};
  73. var detail = await this.findOne(condition);
  74. if(!hash.isExistence(detail)){
  75. return [];
  76. }
  77. detail.id=hash.hashEncode(detail.id.toString());
  78. return detail;
  79. };
  80. /*
  81. * ����id����Ѱ������ư��û�
  82. * */
  83. curing.getCuringById=async function(id){
  84. if(!hash.isExistence(id)){
  85. return [];
  86. }
  87. var condition={
  88. raw:true,
  89. where: {
  90. id: id
  91. }};
  92. var detail = await this.findOne(condition);
  93. return detail;
  94. };
  95. /*
  96. * ��ñ��ر��
  97. * */
  98. curing.getCuringCompilationList=async function(){
  99. return [];
  100. };
  101. return curing;
  102. };