findAll(); //foreach ($tmp as $k => $v) { //$v->delete(); // } $status_option = CommonFn::getComboboxData(HouseKeeping::$status_option, 1, true, 100); $type_option = CommonFn::getComboboxData(HouseKeeping::$type_option, 1, true, 100); $cart_options = CommonFn::getComboboxData(HouseKeeping::$cart_options, 1, true, 100); $skill_options = CommonFn::getComboboxData(HouseKeeping::$skill_options, 1, true, 100); $contract_option = CommonFn::getComboboxData(HouseKeeping::$contract_option, 1, true, 100); $c = new EMongoCriteria(); $c->status('==',2); $tmp = Store::model()->findAll($c); foreach ($tmp as $k => $v) { $store_options[$v->store_id]['name'] = $v->store_name; } $this->render('index', [ 'status_option' => $status_option, 'type_option' => $type_option, 'cart_options' => $cart_options, 'skill_options' => $skill_options, 'contract_option' => $contract_option, ]); } public function actionList() { $pageParams = CommonFn::getPageParams(); $id = intval(Yii::app()->request->getParam('id')); $search = Yii::app()->request->getParam('search', ''); $status = intval(Yii::app()->request->getParam('status', 100)); $criteria = new EMongoCriteria($pageParams); // id筛选 if ($id) { $criteria->_id('==', new MongoId($id)); } // 状态筛选 if ($status != 100) { $criteria->status('==', $status); } $criteria->sort('time',EMongoCriteria::SORT_DESC); $cursor = HouseKeeping::model()->findAll($criteria); $rows = CommonFn::getRowsFromCursor($cursor); $parsedRows = HouseKeeping::model()->parse($rows); $total = $cursor->count(); echo CommonFn::composeDatagridData($parsedRows, $total); } public function actionEdit() { $status = intval(Yii::app()->request->getParam('status', 100)); $contract = intval(Yii::app()->request->getParam('contract', 100)); $type = intval(Yii::app()->request->getParam('type', 100)); $cart = intval(Yii::app()->request->getParam('cart', 100)); $skill = Yii::app()->request->getParam('skill_options'); foreach ($skill as $value) { $skill[] = intval($value); } $age = intval(Yii::app()->request->getParam('age', 0)); $tech = (Yii::app()->request->getParam('tech', '')); $tech_mobile = (Yii::app()->request->getParam('tech_mobile', '')); $desc = (Yii::app()->request->getParam('desc', '')); $yc_time = intval(Yii::app()->request->getParam('yc_time', '')); $server_start_time = intval(Yii::app()->request->getParam('server_start_time', '')); $status_time = intval(Yii::app()->request->getParam('status_time', '')); $server_end_time = intval(Yii::app()->request->getParam('server_end_time', '')); $store_id = (Yii::app()->request->getParam('store_id', '')); $id = Yii::app()->request->getParam('id'); if (!CommonFn::isMongoId($id)) { CommonFn::requestAjax(false, '修改失败', array()); } $h = HouseKeeping::get(new MongoId($id)); if (!empty($contract)) { $h->contract = $contract; } if (!empty($store_id)) { $h->store_id = $store_id; } if (!empty($type)) { $h->type = $type; } if (!empty($cart)) { $h->cart = $cart; } if (!empty($skill)) { $h->skill = $skill; } if (!empty($age)) { $h->age = $age; } if (!empty($desc)) { $h->desc = $desc; } if (!empty($status)) { $h->status = $status; } if (!empty($status_time)) { $h->status_time = $status_time; } if (!empty($server_start_time)) { $h->server_start_time = $server_start_time; } if (!empty($server_end_time)) { $h->server_end_time = $server_end_time; } if (!empty($yc_time)) { $h->yc_time = $yc_time; } if (!empty($tech)) { $h->tech = $tech; } if (!empty($tech_mobile)) { $h->tech_mobile = $tech_mobile; } $success = $h->save(); CommonFn::requestAjax($success, '修改成功', array()); } public function actionAdd() { $h = new HouseKeeping(); $h->user_name = '1'; $h->mobile = '15600266816'; $h->type = 1; $h->cart = 1; $h->address = '1dsfafsdf'; $h->server_start_time = time(); $h->server_end_time = time(); $h->skill = array(1,2,3); $h->yc_time = time(); $h->age = 18; $h->desc = 'fasdf1'; $h->status = 1; $h->status_time = time(); $h->tech = '12asdf'; $h->contract = 1; $h->time = time(); $h->save(); } }