north 7 years ago
parent
commit
e24ade2baf

+ 1 - 0
www/protected/config/main.php

@@ -45,6 +45,7 @@ return array(
         'o2o',
         'moonclub',
         'y',
+        'j',
     ),
 
     'components'=>array(

+ 69 - 0
www/protected/controllers/HouseKeepingController.php

@@ -0,0 +1,69 @@
+<?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()
+    {
+        $status_option = CommonFn::getComboboxData(HouseKeeping::$status_option, 1, true, 100);
+        $type_option = CommonFn::getComboboxData(HouseKeeping::$status_option, 1, true, 100);
+        $cart_options = CommonFn::getComboboxData(HouseKeeping::$status_option, 1, true, 100);
+        $status_option = CommonFn::getComboboxData(HouseKeeping::$status_option, 1, true, 100);
+        $this->render('index', [
+            'status_option' => $status_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);
+        }
+
+        $cursor = Advisory::model()->findAll($criteria);
+        $rows = CommonFn::getRowsFromCursor($cursor);
+        $parsedRows = Advisory::model()->parse($rows);
+        $total = $cursor->count();
+
+        echo CommonFn::composeDatagridData($parsedRows, $total);
+
+    }
+
+    public function actionEdit()
+    {
+        $status = intval(Yii::app()->request->getParam('status', 100));
+        $id = Yii::app()->request->getParam('id');
+        if (!$id) {
+            CommonFn::requestAjax(false, '');
+        }
+        if ($status == 100) {
+            CommonFn::requestAjax(false, '请选择状态');
+        }
+        $advisory = Advisory::model()->get(new MongoId($id));
+        $advisory->status = $status;
+        $success = $advisory->save();
+        if ($success) {
+            CommonFn::requestAjax(true, '修改成功');
+        }
+
+    }
+
+}

+ 29 - 0
www/protected/modules/j/JModule.php

@@ -0,0 +1,29 @@
+<?php
+
+class JModule extends CWebModule
+{
+	public function init()
+	{
+		// this method is called when the module is being created
+		// you may place code here to customize the module or the application
+
+		// import the module-level models and components
+		$this->setImport(array(
+			'j.models.*',
+			'j.components.*',
+		));
+	}
+    //test
+	public function beforeControllerAction($controller, $action)
+	{
+        $controller->layout = '//layouts/none';
+		if(parent::beforeControllerAction($controller, $action))
+		{
+			// this method is called before any module controller action is performed
+			// you may place customized code here
+			return true;
+		}
+		else
+			return false;
+	}
+}

+ 10 - 0
www/protected/modules/j/components/JBaseController.php

@@ -0,0 +1,10 @@
+<?php
+/**
+ * o2o模块公共基类
+ */
+class JBaseController extends Controller{
+
+    protected function beforeAction($action) {
+        return true;
+    }
+}

+ 10 - 0
www/protected/modules/j/controllers/DefaultController.php

@@ -0,0 +1,10 @@
+<?php
+
+class DefaultController extends JBaseController
+{
+	public function actionIndex()
+	{
+
+		$this->render('index');
+	}
+}

+ 34 - 0
www/protected/modules/j/views/default/index.php

@@ -0,0 +1,34 @@
+<!doctype html>
+<html lang="en">
+<head>
+  <title>享颐会</title>
+  <style>
+    *{
+      margin: 0;
+      padding: 0;
+    }
+  </style>
+  <meta charset="UTF-8">
+  <meta name="viewport"
+        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+  <meta http-equiv="X-UA-Compatible" content="ie=edge">
+  <!-- vue~资源域名-->
+  <!--admin.yiguanjiadev.me-->
+<!--  commontest.yiguanjia.me-->
+  <?php $host = 'common.yiguanjia.me';?>
+  <!-- vue~资源版本号 -->
+  <?php $newVersion = 2017111000?>
+  <link rel="stylesheet" id="app_css" href="http://<?php echo $host ?>/webapp/Y/home/static/css/app.css?v=<?php echo $newVersion?>">
+</head>
+<body>
+<!--vue-->
+<div id=app></div>
+<script type=text/javascript id="manifest"
+        src="http://<?php echo $host ?>/webapp/Y/home/static/js/manifest.js?v=<?php echo $newVersion?>"></script>
+<script type=text/javascript id="vendor"
+        src="http://<?php echo $host ?>/webapp/Y/home/static/js/vendor.js?v=<?php echo $newVersion?>"></script>
+<script type=text/javascript id="appJs"
+        src="http://<?php echo $host ?>/webapp/Y/home/static/js/app.js?v=<?php echo $newVersion?>"></script>
+
+</body>
+</html>

+ 124 - 0
www/protected/modules/o2o/models/HouseKeeping.php

@@ -0,0 +1,124 @@
+<?php
+/**
+ * Created by north.Deng's MAC
+ * User: north.Deng
+ * Date: 2018/1/8
+ * Time: 上午10:03
+ * description :
+ */
+ 
+ class HouseKeeping extends MongoAr
+ {
+     public $_id;
+     public $user_id;
+     public $mobile;//手机号
+     public $address;//服务地址
+     public $type;//服务类型 0-钟点工;1-月嫂;2-育婴师;3-护理老人;4-全套家务
+     public $cart;//服务类型二级选项 0-住家,1-做一休一,2-做五休二,3-做六休一
+     public $server_start_time;//服务时间开始时间
+     public $server_end_time;//服务时间结束时间
+     public $skill;//服务技能 烧饭,保洁,育婴,护理,全套家务
+     public $yc_time;//预产期
+     public $age;//年龄
+     public $desc;//备注
+     public $status;//0-预约中,1-已预约,2-已面试
+     public $status_time;//预约日期
+     public $tech;//服务人员
+     public $contract;//签约状态
+     public $time;//创建时间
+
+
+     //服务形式
+     public static $type_option = array(
+         1 => '钟点工',
+         2 => '月嫂',
+         3 => '育婴师',
+         4 => '护理老人',
+         5 => '全套家务',
+     );
+     public static $cart_options = array(
+         1 => '住家',
+         2 => '做一休一',
+         3 => '做五休二',
+         4 => '做六休一',
+     );
+     public static $skill_options = array(
+         1 => '烧饭',
+         2 => '保洁',
+         3 => '育婴',
+         4 => '护理',
+         5 => '全套家务',
+     );
+     //预约状态
+     public static $status_option = array(
+         1 => '预约中',
+         2 => '已预约',
+         3 => '已面试',
+     );
+     //签约状态
+     public static $contract_option = array(
+         1 => '未签约',
+         2 => '已签约',
+     );
+     public function __construct($scenario='insert'){
+         $this->setMongoDBComponent(Yii::app()->getComponent('mongodb_o2o'));
+         parent::__construct($scenario);
+     }
+
+
+     public static function model($className=__CLASS__)
+     {
+         return parent::model($className);
+     }
+
+     public function getCollectionName()
+     {
+         return 'house_kepping';
+     }
+
+     public static function get($_id) {
+         if(CommonFn::isMongoId($_id)){
+             $criteria = new EMongoCriteria();
+             $criteria->_id('==', $_id);
+             $model = self::model()->find($criteria);
+             return $model;
+         }else{
+             return false;
+         }
+     }
+
+     public function parseRow($row,$output=array()){
+         $newRow = array();
+         $newRow['id'] = (string)$row['_id'];
+
+         $newRow['user_id'] = CommonFn::get_val_if_isset($row,'user_id','');
+         $newRow['mobile'] = CommonFn::get_val_if_isset($row,'mobile','');
+         $newRow['address'] = CommonFn::get_val_if_isset($row,'address','');
+         $newRow['type'] = CommonFn::get_val_if_isset($row,'type','');
+         $newRow['cart'] = CommonFn::get_val_if_isset($row,'cart','');
+         $newRow['skill'] = CommonFn::get_val_if_isset($row,'skill','');
+         $newRow['server_end_time'] = CommonFn::get_val_if_isset($row,'server_end_time','');
+         $newRow['server_start_time'] = CommonFn::get_val_if_isset($row,'server_start_time','');
+         $newRow['yc_time'] = CommonFn::get_val_if_isset($row,'yc_time','');
+         $newRow['age'] = CommonFn::get_val_if_isset($row,'age','');
+         $newRow['status_time'] = CommonFn::get_val_if_isset($row,'status_time','');
+         $newRow['tech'] = CommonFn::get_val_if_isset($row,'tech','');
+         $newRow['contract'] = CommonFn::get_val_if_isset($row,'contract','');
+         $newRow['contract_srt'] = self::$contract_option[intval($newRow['contract'])];
+         $newRow['type_str'] = self::$type_option[intval($newRow['type'])];
+         $newRow['cart_str'] = self::$cart_options[intval($newRow['cart'])];
+         $newRow['skill_str'] = self::$skill_options[intval($newRow['skill'])];
+         $newRow['desc'] = CommonFn::get_val_if_isset($row,'desc','');
+         $newRow['status'] = CommonFn::get_val_if_isset($row,'status');
+         $newRow['status_str'] = self::$status_option[intval($newRow['status'])];
+         $newRow['time'] = CommonFn::get_val_if_isset($row,'time','');
+         if(APPLICATION=='admin'){
+             $newRow['action_user'] = CommonFn::get_val_if_isset($row,'action_user',"");
+             $newRow['action_time'] = CommonFn::get_val_if_isset($row,'action_time',"");
+             $newRow['action_log'] = CommonFn::get_val_if_isset($row,'action_log',"");
+
+         }
+         return $this->output($newRow,$output);
+     }
+
+ }

+ 1 - 1
www/protected/modules/y/controllers/DefaultController.php

@@ -1,6 +1,6 @@
 <?php
 
-class DefaultController extends YBaseController
+class DefaultController extends JBaseController
 {
 	public function actionIndex()
 	{