vali 6 years ago
parent
commit
22356151b7
1 changed files with 3 additions and 9 deletions
  1. 3 9
      vendor/GatewayWorker_windows/Applications/whisper/Events.php

+ 3 - 9
vendor/GatewayWorker_windows/Applications/whisper/Events.php

@@ -426,16 +426,10 @@ class Events
         $histarttimelimit = time() - 3600*24 ;
         $bindval = ['user_id'=>$uid,'kf_id'=>intval(trim($toukfid,'KF')),'histime'=>$histarttimelimit] ;
         $oldlog = self::$db->select('*')->from('ws_service_log')->where('user_id= :user_id and  client_id=:client_id and kf_id=:kf_id and  status=2 and  start_time>=:histime ' )->bindValues($bindval)->row();
-        if ($oldlog){
-            self::$db->update('ws_service_log')->cols(['status'=>2,'endtime'=>time()])->where('servicelog_id='.$oldlog['servicelog_id'])->query();
-        }
-
+        if (!$oldlog){            return false;        }
+        self::$db->update('ws_service_log')->cols(['status'=>2,'endtime'=>time()])->where('servicelog_id='.$oldlog['servicelog_id'])->query();
         unset($oldlog['servicelog_id']);
-        $oldlog['kf_id'] = intval(trim($toukfid,'KF'));
-        $oldlog['start_time'] = time();
-        $oldlog['end_time'] = 0 ;
-        $oldlog['status'] = 1 ;
-        $oldlog['evaluate_id'] = 0 ;
+        $oldlog = array_merge($oldlog,['kf_id'=>intval(trim($toukfid,'KF')),'start_time'=>time(),'end_time'=>0,'status'=>1,'evaluate_id'=>0]);
         $new_id = self::$db->insert('ws_service_log')->cols($oldlog)->query();
         if (!$new_id){
             return false;