DengTao 8 years ago
parent
commit
aad4ac268d

+ 7 - 6
www/protected/commands/GetKennelDetailWorkCommand.php

@@ -80,7 +80,11 @@ class GetKennelDetailWorkCommand extends CConsoleCommand {
 
 
                         $dealPet = new DealPet();
-                        if(!in_array($tmp['cat']['id'],$petTypesId)){
+
+                        if(in_array($tmp['cat']['id'],$petTypesId)) {
+                            exit;
+                            $pet_type = PetTypes::model()->get(new MongoId($petTypes[$tmp['cat']['id']]));
+                        } else {
                             $petTypesId[] = $tmp['cat']['id'];
                             $pet_type = new PetTypes();
                             $pet_type->name = $tmp['cat']['name'];
@@ -94,13 +98,9 @@ class GetKennelDetailWorkCommand extends CConsoleCommand {
                             $pet_type->pic = $tmp['cat']['pic'];
                             $pet_type->level = 2;
                             $pet_type->save();
-                            var_dump($tmp['cat']['id']);
                             $petTypes[$tmp['cat']['id']] = (string)$pet_type->_id;
-                        } else {
-                            $pet_type = PetTypes::model()->get(new MongoId($petTypes[$tmp['cat']['id']]));
                         }
-                        var_dump($petTypesId);
-                        var_dump($petTypes);
+
                         $dealPet->pet_type = new MongoId($pet_type->_id);
 
                         $dealPet->name = $tmp['name'];
@@ -213,3 +213,4 @@ class GetKennelDetailWorkCommand extends CConsoleCommand {
 
     }
 }
+

+ 1 - 1
www/protected/components/CommonFn.php

@@ -47,7 +47,7 @@ class CommonFn
     }
 
     //获得七牛图片的尺寸
-    public function getPicSize($url){
+    public static function getPicSize($url){
         $resources = self::simple_http($url."?imageInfo");
         return json_decode($resources, true);
     }