Browse Source

add UserController UserDetail action

north 8 năm trước cách đây
mục cha
commit
cdbe5d511f

+ 32 - 0
www/protected/modules/moonclub/controllers/UserController.php

@@ -24,6 +24,38 @@ class  UserController extends MoonClubBaseController{
         }
     }
 
+    public function actionUserDetail() {
+        $user_id = Yii::app()->getRequest()->getParam('user_id');
+        if (CommonFn::isMongoId($user_id)) {
+            $user = RUser::get(new MongoId($user_id));
+            //查找是否有该用户
+            if (!empty($user)) {
+                $user_name = Yii::app()->getRequest()->getParam('user_name','');
+                $sex = Yii::app()->getRequest()->getParam('sex',1);
+                $card_id = Yii::app()->getRequest()->getParam('card_id',0);
+                $mobile = Yii::app()->getRequest()->getParam('mobile','');
+                $address = Yii::app()->getRequest()->getParam('address','');
+                $time = Yii::app()->getRequest()->getParam('time');
+                $register_time = time();
+                $userInfo = new UserInfo;
+                $userInfo->user_id = $user->_id;
+                $userInfo->user_name = $user_name;
+                $userInfo->time = $time;
+                $userInfo->sex = $sex;
+                $userInfo->card_id = $card_id;
+                $userInfo->mobile = $mobile;
+                $userInfo->address = $address;
+                $userInfo->register_time = $register_time;
+                $result = $userInfo->save();
+                CommonFn::requestAjax(true,CommonFn::getMessage('message','operation_success'),$result);
+            } else {
+                CommonFn::requestAjax(false,CommonFn::getMessage('message','id_not_exit'));
+            }
+        } else {
+            CommonFn::requestAjax(false,CommonFn::getMessage('message','params_illegal'));
+        }
+    }
+
 
 
 }

+ 1 - 1
www/protected/modules/moonclub/models/NutritiousMeals.php

@@ -6,7 +6,7 @@
  * Time: 10:53
  * 用户详细信息
  */
-class nutritious_meals extends MongoAr{
+class NutritiousMeals extends MongoAr{
   public $_id;
   public $num; // 餐谱编号
   public $xyh_order_id;// 订单编号

+ 1 - 1
www/protected/modules/moonclub/models/YsServices.php

@@ -6,7 +6,7 @@
  * Time: 10:53
  * 用户详细信息
  */
-class ys_services extends MongoAr{
+class YsServices extends MongoAr{
   public $_id;
   public $num; // 月嫂协议号
   public $xyh_order_id;// 订单编号

+ 0 - 70
www/protected/modules/moonclub/models/Yuesaos.php

@@ -1,70 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: north.Deng
- * Date: 2017/07/20
- * Time: 10:53
- * 用户详细信息
- */
-class yuesaos extends MongoAr{
-  public $_id;
-  public $num; // 月嫂协议号
-  public $xyh_order_id;// 订单编号
-  public $status;// 未预约 0 已预约 1 已诊脉
-  public $user_name;// 月嫂姓名
-  public $month_address;// 月子地址
-  public $posts_time;// 上岗日期
-  public $end_time;// 结束日期
-  public $remarks;// 备注
-
-
-  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 'yuesaos';
-  }
-
-  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['num'] = CommonFn::get_val_if_isset($row,'num','');
-    $newRow['xyh_order_id'] = CommonFn::get_val_if_isset($row,'xyh_order_id','');
-    $newRow['status'] = CommonFn::get_val_if_isset($row,'status','');
-    $newRow['user_name'] = CommonFn::get_val_if_isset($row,'user_name','');
-    $newRow['month_address'] = CommonFn::get_val_if_isset($row,'month_address','');
-    $newRow['posts_time'] = CommonFn::get_val_if_isset($row,'posts_time','');
-    $newRow['end_time'] = CommonFn::get_val_if_isset($row,'end_time','');
-    $newRow['remarks'] = CommonFn::get_val_if_isset($row,'remarks','');
-
-    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);
-  }
-
-
-}