123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <?php
- /**
- * Created by north.Deng's MAC
- * User: north.Deng
- * Date: 2018/1/8
- * Time: 上午11:39
- * description :
- */
- class HouseKeepingController extends AdminController
- {
- public function actionIndex()
- {
- /*$tmp = HouseKeeping::model()->findAll();
- foreach ($tmp as $k => $v) {
- $v->delete();
- }
- $tmp = JGEmploye::model()->findAll();
- foreach ($tmp as $k => $v) {
- $v->delete();
- }*/
- //$tmp = JEmploye::model()->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');
- $skills = array();
- if (!empty($skill)) {
- foreach ($skill as $value) {
- $skills[] = 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');
- $cancel_cause = Yii::app()->request->getParam('cancel_cause','');
- if (!CommonFn::isMongoId($id)) {
- CommonFn::requestAjax(false, '修改失败', array());
- }
- $h = HouseKeeping::get(new MongoId($id));
- if (!empty($cancel_cause)) {
- $h->cancel_cause = $cancel_cause;
- }
- 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($skills)) {
- $h->skill = $skills;
- }
- 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();
- }
- public function actionOutputExcel()
- {
- $data = HouseKeeping::model()->findAll();
- Service::factory('Excel1Service')->push($data);
- }
- }
|