|
@@ -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 {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|