From bef2c06923d3ba6727654f734bb93d5a09855dc5 Mon Sep 17 00:00:00 2001
From: colly_wyx <wangyixiong_007@163.com>
Date: Thu, 14 Jun 2018 09:50:43 +0800
Subject: [PATCH] 增加女声

---
 Yfs/Domain/User.php |  111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 109 insertions(+), 2 deletions(-)

diff --git a/Yfs/Domain/User.php b/Yfs/Domain/User.php
index cd27f68..8ef7457 100644
--- a/Yfs/Domain/User.php
+++ b/Yfs/Domain/User.php
@@ -1,18 +1,125 @@
 <?php
-
+/**
+ * ���������������
+ */
 class Domain_User {
 
     public function __construct(){
         $this->model = new Model_User();
     }
 
+    /**
+     * ������
+     * @param  [type] $regUserInfo [description]
+     * @return [type]              [description]
+     */
     public function register($regUserInfo) {
         return $this->model->register($regUserInfo);
     }
 
+    /**
+     * ������������
+     * @param  [type] $phone [description]
+     * @return [type]        [description]
+     */
     public function checkPhone($phone){
-        $user = $this->model->get(array('phone' => $phone));
+        $user = $this->getUserInfoByPhone($phone);
         return $user?false:true;
     }
 
+    /**
+     * ������������������������
+     * @param  [type] $phone [description]
+     * @return [type]        [description]
+     */
+    public function checkUserStatus($phone){
+        $user = $this->getUserInfoByPhone($phone);
+        if($user && $user['is_lock'] == 0){
+            return true;
+        }
+        else{
+            return false;
+        }
+    }
+
+    /**
+     * ���������������������������������
+     * @param  [type] $phone [description]
+     * @return [type]        [description]
+     */
+    public function getUserInfoByPhone($phone){
+        return $this->model->get(array('phone' => $phone));
+    }
+
+    /**
+     * ������������
+     * @return [type] [description]
+     */
+    public function login($phone, $password){
+        $user = $this->getUserInfoByPhone($phone);
+        if($user){
+            if(md5(md5($password).$user['encrypt']) == $user['password']){
+                return true;
+            }
+            else{
+                return false;
+            }
+        }
+        else{
+            return false;
+        }
+    }
+
+    /**
+     * ������������
+     * @param  [type] $phone  [description]
+     * @param  [type] $newPwd [description]
+     * @return [type]         [description]
+     */
+    public function resetPwd($phone, $newPwd){
+        $user = $this->getUserInfoByPhone($phone);
+        if($user && $user['is_lock'] == 0){
+            $data['password'] = md5(md5($newPwd).$user['encrypt']);
+            $result = $this->model->update($data, array('_id' => $user['_id']));
+            if($result){
+                return 0;
+            }
+            else{
+                return 2;
+            }
+        }
+        else{
+            return 1;
+        }
+    }
+
+    /**
+     * ������������������
+     * @param  [type] $data [description]
+     * @return [type]       [description]
+     */
+    public function updateUserInfo($data){
+        if(isset($data['_id']) && !empty($data['_id'])){
+            $id = $data['_id'];
+            $user = $this->model->get(array('_id' => $id)); 
+            unset($data['_id']);
+            if($user && $user['is_lock'] == 0){
+                $result = $this->model->update($data, array('_id' => $id));
+                if($result){
+                    return 0;
+                }
+                else{
+                    return 1;
+                }
+            }
+            else{
+                return 2;
+            }
+        }
+        else{
+            return 3;
+        }
+
+    }
+
 }

--
Gitblit v1.8.0