123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <?php
- /**
- * Created by north.Deng's MAC
- * User: north.Deng
- * Date: 2018/1/9
- * Time: 上午10:02
- * description :
- */
- class HouseKeepingController extends JBaseController
- {
- 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);
- }
- $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 = intval(Yii::app()->request->getParam('skill', 100));
- $age = intval(Yii::app()->request->getParam('age', 0));
- $tech = intval(Yii::app()->request->getParam('tech', ''));
- $desc = intval(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', ''));
- $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($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;
- }
- $success = $h->save();
- CommonFn::requestAjax($success, '修改成功', array());
- }
- public function actionAdd()
- {
- $mobile = intval(Yii::app()->request->getParam('mobile', 100));
- $user_name = intval(Yii::app()->request->getParam('user_name', 100));
- $type = intval(Yii::app()->request->getParam('type', 100));
- $cart = intval(Yii::app()->request->getParam('cart', 100));
- $skill = intval(Yii::app()->request->getParam('skill', 100));
- $age = intval(Yii::app()->request->getParam('age', 0));
- $address = intval(Yii::app()->request->getParam('address', 0));
- $tech = intval(Yii::app()->request->getParam('tech', ''));
- $desc = intval(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', ''));
- $h = new HouseKeeping();
- $h->user_name = $user_name;
- $h->mobile = $mobile;
- $h->type = $type;
- $h->cart = $cart;
- $h->address = $address;
- $h->server_start_time = $server_start_time;
- $h->server_end_time = $server_end_time;
- $h->skill = $skill;
- $h->yc_time = $yc_time;
- $h->age = $age;
- $h->desc = $desc;
- $h->status = 1;
- $h->status_time = $status_time;
- $h->tech = $tech;
- $h->contract = 1;
- $h->time = time();
- $h->save();
- }
- }
|