caipin 5 years ago
parent
commit
f7d2f3611c
2 changed files with 34 additions and 16 deletions
  1. 33 4
      app/models/curing.js
  2. 1 12
      app/service/cloudEditionService.js

+ 33 - 4
app/models/curing.js

@@ -23,9 +23,38 @@ module.exports = (sequelize, DataTypes) => {
         // associations can be defined here
     };
 
+    
+    curing.getCuringInMobile=async function(mobile,compilation_id){
+    	var option={
+        		where: {
+        			mobile: {
+                        [Op.or]: [mobile]
+        					}
+        				},
+                raw:true,
+                };
+        if(hash.isExistence(compilation_id)){
+            option.where={compilation_id: compilation_id};
+        }
+    	
+    	
+    	
+    	
+        if(mobile==undefined){
+            return [];
+        }
+        var condition={
+            raw:true,
+            where: {
+                mobile: mobile
+            }};
+        var curingList = await this.findOne(condition);
+        return curingList;
+    };
+    
 
     /*
-     * 根据mobile获得已绑定养护云版用户
+     * ����mobile����Ѱ������ư��û�
      * */
     curing.getCuringByMobile=async function(mobile){
 
@@ -42,7 +71,7 @@ module.exports = (sequelize, DataTypes) => {
     };
 
     /*
-     * 根据ssoid获得已绑定养护云版用户
+     * ����ssoid����Ѱ������ư��û�
      * */
     curing.getCuringBySsoid=async function(ssoid){
         if(!hash.isExistence(ssoid)){
@@ -63,7 +92,7 @@ module.exports = (sequelize, DataTypes) => {
     };
 
     /*
-     * 根据id获得已绑定养护云版用户
+     * ����id����Ѱ������ư��û�
      * */
     curing.getCuringById=async function(id){
         if(!hash.isExistence(id)){
@@ -79,7 +108,7 @@ module.exports = (sequelize, DataTypes) => {
     };
 
     /*
-     * 获得本地编办
+     * 锟斤拷帽锟斤拷乇锟斤拷
      * */
     curing.getCuringCompilationList=async function(){
 

+ 1 - 12
app/service/cloudEditionService.js

@@ -53,18 +53,7 @@ var cloudService={
         }
        
         //获得指定数据
-        var option={
-        		where: {
-        			mobile: {
-                        [Op.or]: [mobile]
-        					}
-        				},
-                raw:true,
-                };
-        if(hash.isExistence(compilation_id)){
-            option.where={compilation_id: compilation_id};
-        }
-        var curingList = await models.cloud_curing.findAll(option);
+        var curingList = await models.cloud_curing.getCuringInMobile(mobile,compilation_id);
         //组合同步云版数据
         var falg=false;
         curingCloudList.forEach(async function(cclValue,cclKey){