colly_wyx
2018-04-26 3fffc1da75d49f832b9faf3467d91202e0220a3b
Yfs/Domain/User.php
@@ -70,4 +70,56 @@
        }
    }
    /**
     * 重置密码
     * @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;
        }
    }
}