1

我正在使用 $sailsS​​ocket 发出我的 GET 和 POST 请求。我的 POST 请求如下所示;

$sailsSocket.post('/schedules/toDateObj', 
    { jobSchedObj: 
        { repair_shop_equipment_id: response.config.data.schedEquip.rsrcId, 
          repair_history_id: response.data.id, 
          technician_id: response.data.technician_id, 
          allotted_time: response.data.allotted_time,
          times: timeObj,
          repair_shop_id: $localstorage.get('shopId')
          }
      })
      .success(function(){
          $location.path('/app/checkin');
      })
      .error(function (response){
          console.log(response);
      });

这是它保存到的表... 屏幕截图 2015-08-01 在 2 17 15 pm

一切都很好我什至在我的 ScheduleController 中添加了一个 console.log 来检查我的 POST 请求中插入了哪些内容。这是输出; 屏幕截图 2015-08-03 在 4 41 09 pm

问题是当我向Schedule表发出 GET 请求时,它会返回除repair_shop_equipment_id. 这是获取请求;

 var firstDay = scope.getJobsFor[0];
 var lowerBound = firstDay.open_time;
 var lastDay = scope.getJobsFor[scope.getJobsFor.length - 1];
 var upperBound = lastDay.close_time;
 $sailsSocket.get("/schedules", {params:
     {where: {
         repair_shop_id: scope.shopId,
         technician_id: scope.schedTech.id,  
         repair_shop_equipment_id: scope.schedEquip.rsrcId,
         scheduled_start_time:{ date: {'>':lowerBound, '<':upperBound}}
         }
     }
 })
 .success(function (response){

这就是回应...

屏幕截图 2015-08-04 在 1 24 25 pm

这是一个指向 Gist 的链接,其中包含我关联的 Sails 模型和调度控制器;

我的模型配置之一有问题吗?谢谢。

4

0 回答 0