DengTao 8 éve
szülő
commit
fc926439af
1 módosított fájl, 12 hozzáadás és 9 törlés
  1. 12 9
      www/protected/commands/GetKennelDetailWorkCommand.php

+ 12 - 9
www/protected/commands/GetKennelDetailWorkCommand.php

@@ -105,17 +105,19 @@ class GetKennelDetailWorkCommand extends CConsoleCommand {
                         $dealPet->pet_type = new MongoId($pet_type->_id);
 
                         $dealPet->name = $tmp['name'];
-                        //$dealPet->status = $tmp['status'];
+                        $dealPet->status = 1;
                         $dealPet->price = $tmp['price'];
                         $dealPet->pics = array();
-                        foreach ($tmp['photos'] as $v) {
+                        foreach ($tmp['photos'] as $key =>$v) {
+                            $pic = array();
                             $size = CommonFn::getPicSize($v);
                             if (isset($size['width']) && isset($size['height'])) {
-                                $dealPet->pics['width'] = intval($size['width']);
-                                $dealPet->pics['height'] = intval($size['height']);
+                                $pic[$key]['width'] = intval($size['width']);
+                                $pic[$key]['height'] = intval($size['height']);
                             }
 
-                            $dealPet->pics['url'] = $v;
+                            $pic['url'] = $v;
+                            $dealPet->pics[] = (object)$pic;
                         }
 
                         $dealPet->kennel = $kennel->_id;
@@ -141,8 +143,9 @@ class GetKennelDetailWorkCommand extends CConsoleCommand {
 
 
                                 $datetime = date_create($v['date'])->format('U');
-                                $dealPet->vaccine_info['time'] = intval($datetime);
-                                $dealPet->vaccine_info['brand'] = $v['value'];
+                                $vaccine_info['time'] = intval($datetime);
+                                $vaccine_info['brand'] = $v['value'];
+                                $dealPet->vaccine_info[] = (object)$vaccine_info;
 
                             }
                         }
@@ -158,9 +161,9 @@ class GetKennelDetailWorkCommand extends CConsoleCommand {
                             $tmp['deworming_info']['time'] = intval(date_create($tmp['parasited']['date'])->format('U'));
                         }
 
-                        $_deworming_info = (Object)$tmp['deworming_info'];
+
                         $dealPet->deworming_info = array();
-                        $dealPet->deworming_info[] = $_deworming_info;
+                        $dealPet->deworming_info[] = (Object)$tmp['deworming_info'];
 
                         if (isset($value['videos']['length'])) {
                             $value['video']['length'] = floatval($value['video']['length']);