|
@@ -1,4 +1,4 @@
|
|
|
-<?php
|
|
|
+<?php
|
|
|
/**
|
|
|
* 宠物模型
|
|
|
*/
|
|
@@ -48,6 +48,8 @@ class DealPet extends MongoActiveRecord {
|
|
|
|
|
|
public $count = 1;//现存数量 针对小宠
|
|
|
|
|
|
+ public $from;//数据来源 wozhua xinchong chongwushichang
|
|
|
+
|
|
|
public static $status_option = [
|
|
|
-100 => ['name' => '信息不完善'],
|
|
|
-2 => ['name' => '审核未通过'],
|
|
@@ -72,7 +74,7 @@ class DealPet extends MongoActiveRecord {
|
|
|
];
|
|
|
|
|
|
public function __construct($scenario = 'insert') {
|
|
|
- $this->setMongoDBComponent(Yii::app()->getComponent('cute'));
|
|
|
+ $this->setMongoDBComponent(Yii::app()->getComponent('deal'));
|
|
|
parent::__construct($scenario);
|
|
|
}
|
|
|
|
|
@@ -93,37 +95,37 @@ class DealPet extends MongoActiveRecord {
|
|
|
$res = unserialize($data_cache);
|
|
|
}else{
|
|
|
$data = array();
|
|
|
-
|
|
|
+
|
|
|
$criteria = new EMongoCriteria();
|
|
|
$criteria->root_parent('==',new MongoId('54671c4b0eb9fb89048b45f5'));//狗狗
|
|
|
$criteria->status('==',1);
|
|
|
- $criteria->limit(4);
|
|
|
+ $criteria->limit(4);
|
|
|
$criteria->offset(rand(0,100));
|
|
|
$cursor = self::model()->findAll($criteria);
|
|
|
foreach ($cursor as $key => $value) {
|
|
|
$data[] = $value;
|
|
|
}
|
|
|
$dogs = self::model()->parseIndexList($cursor);
|
|
|
-
|
|
|
+
|
|
|
$criteria = new EMongoCriteria();
|
|
|
$criteria->root_parent('==',new MongoId('546805e40eb9fb32018b45fe'));//猫猫
|
|
|
$criteria->status('==',1);
|
|
|
- $criteria->limit(5);
|
|
|
+ $criteria->limit(5);
|
|
|
$criteria->offset(rand(0,100));
|
|
|
$cursor = self::model()->findAll($criteria);
|
|
|
foreach ($cursor as $key => $value) {
|
|
|
$data[] = $value;
|
|
|
}
|
|
|
|
|
|
- // $criteria = new EMongoCriteria();
|
|
|
- // $criteria->root_parent('notin',[new MongoId('546805e40eb9fb32018b45fe'),new MongoId('54671c4b0eb9fb89048b45f5')]);//其他
|
|
|
- // $criteria->status('==',1);
|
|
|
- // $criteria->limit(3);
|
|
|
- // $criteria->offset(rand(0,10));
|
|
|
- // $cursor = self::model()->findAll($criteria);
|
|
|
- // foreach ($cursor as $key => $value) {
|
|
|
- // $data[] = $value;
|
|
|
- // }
|
|
|
+ // $criteria = new EMongoCriteria();
|
|
|
+ // $criteria->root_parent('notin',[new MongoId('546805e40eb9fb32018b45fe'),new MongoId('54671c4b0eb9fb89048b45f5')]);//其他
|
|
|
+ // $criteria->status('==',1);
|
|
|
+ // $criteria->limit(3);
|
|
|
+ // $criteria->offset(rand(0,10));
|
|
|
+ // $cursor = self::model()->findAll($criteria);
|
|
|
+ // foreach ($cursor as $key => $value) {
|
|
|
+ // $data[] = $value;
|
|
|
+ // }
|
|
|
foreach ($data as $key => $obj) {
|
|
|
$temp['id'] = (string)$obj->_id;
|
|
|
$temp['name'] = $obj->name;
|
|
@@ -493,7 +495,7 @@ class DealPet extends MongoActiveRecord {
|
|
|
//$parents_info['father_hair_color'] = CommonFn::get_val_if_isset($father_info, 'hair_color', '');
|
|
|
// 母亲信息
|
|
|
$mother_info = CommonFn::get_val_if_isset($row, 'mother_info', []);
|
|
|
- // $parents_info['mother_name'] = CommonFn::get_val_if_isset($mother_info, 'name', '');
|
|
|
+ // $parents_info['mother_name'] = CommonFn::get_val_if_isset($mother_info, 'name', '');
|
|
|
$parents_info['mother_avatar'] = CommonFn::get_val_if_isset($mother_info, 'avatar', '');
|
|
|
$parents_info['mother_breeds'] = CommonFn::get_val_if_isset($mother_info, 'breeds', '');
|
|
|
//$parents_info['mother_shoulder_height'] = CommonFn::get_val_if_isset($mother_info, 'shoulder_height', 0);
|