Jonlin 6 tahun lalu
induk
melakukan
8e3a3fc151

+ 28 - 129
application/user/controller/Member.php

@@ -21,143 +21,42 @@ class Member extends UserControl
     public function index()
     {
         $user_info = $this->getAdminInfo();
-        $user = db('user')->where('user_email',$user_info['user_email'])->find();
-        if($user['user_status'] ==1){
-            $user['user_status_cn'] = '已实名认证';
-        }else{
-            $user['user_status_cn'] = '未实名认证';
-        }
-        $this->assign('user', $user);
-        return $this->fetch();
-    }
-
-    /**
-     * 添加用户
-     * @return mixed
-     */
-    public function add()
-    {
         if (request()->isPost()) {
-            $model_member = Model('member');
-            //判断用户名是否存在
-            $usetime = input('post.member_usetime');
-            $validitytime = $model_member->validity($usetime);
-            $data = array(
-                'member_name' => input('post.member_name'),
-                'member_url' =>input('post.member_url'),
-                'member_mobile' => input('post.member_mobile'),
-                'member_contacts' =>input('post.member_contacts'),
-                'member_mailbox' => input('post.member_mailbox'),
-                'member_usetime' => $usetime,
-                'member_validitytime' => $validitytime,
-                'member_status' => input('post.member_status') ? input('post.member_status') : 1,
-                'member_add_time' => TIMESTAMP
+            $user_name = input('post.user_name');
+            $company = input('post.company');
+            $trade = input('post.trade');
+            $address = input('post.address');
+
+            $update_info = array(
+                'user_name' => $user_name,
+                'company' => $company,
+                'trade' => $trade,
+                'address' => $address
             );
-            //添加到数据库
-            $result = $model_member->addMember($data);
-
-            if ($result) {
-                $cjglz =array('wlcome','wlcome.index','config','config.index','config.add','config.edit','config.del','admin','admin.index','admin.add','admin.edit','admin.del','admingroup','admingroup.index','admingroup.add','admingroup.edit','admingroup.del','product','product.index','product.add','product.edit','product.del','news','news.index','news.add','news.edit','news.del','message','message.index','message.reply','message.del','Visitkf','Visitkf.index','glservice','glservice.index');
-                $limit_str = '';
-                if (is_array($cjglz)) {
-                    $limit_str = implode('|', $cjglz);
-                }
-                $sgda = array(
-                    'group_name' => '超级管理员',
-                    'group_limits' => ds_encrypt($limit_str, MD5_KEY . md5('超级管理员')),
-                    'lang' => 'zh-cn',
-                    'suosgs' => $result,
-                    'addtime' => TIMESTAMP
-                );
-                $groupid = Model('Admingroup')->addAdminGroup($sgda);
-                if($groupid){
-                    //创建一个客服帐号
-                    $erda = array(
-                        'service_name' => input('post.member_mailbox'),
-                        'service_password' => md5('123456'),
-                        'service_group_id' => $groupid,
-                        'service_is_super' => 1,
-                        'service_pid' => $result,
-                        'service_add_time' => TIMESTAMP
-                    );
-                    Model('service')->addservice($erda);
-                    dsLayerOpenSuccess(lang('member_add_succ'));
-                }
-            } else {
-                $this->error(lang('member_add_fail'));
+            //print_r($update_info);
+            $res = db('user')->where('user_id', $user_info['user_id'])->update($update_info);
+            if($res == 1){
+                return $this->redirect('User/Member/index');
             }
-        } else {
-            $member_array = array(
-                'member_status' => 0,
-                'add' => 1,
-            );
-            $this->assign('member', $member_array);
-            $this->setAdminCurItem('add');
-            return $this->fetch('form');
-        }
-    }
 
-    public function edit()
-    {
-        $member_id = input('param.member_id');
-        if (empty($member_id)) {
-            $this->error(lang('param_error'));
-        }
-        $model_member = Model('member');
-        $usetime = input('post.member_usetime');
-        $validitytime = $model_member->validity($usetime);
-        if (!request()->isPost()) {
-            $condition['member_id'] = $member_id;
-            $member_array = $model_member->getMemberInfo($condition);
-            $member_array['add'] = 0;
-            $this->assign('member', $member_array);
-            $this->setAdminCurItem('edit');
-            return $this->fetch('form');
-        } else {
-            $data = array(
-                'member_name' => input('post.member_name'),
-                'member_url' => input('post.member_url'),
-                'member_mobile' => input('post.member_mobile'),
-                'member_contacts' => input('post.member_contacts'),
-                'member_mailbox' => input('post.member_mailbox'),
-                'member_usetime' => $usetime,
-                'member_validitytime' => $validitytime,
-                'member_status' => input('post.member_status'),
-            );
-            //验证数据  END
-            $result = $model_member->editMember(array('member_id' => intval($member_id)), $data);
-            if ($result) {
-                dsLayerOpenSuccess(lang('member_edit_succ'));
-            } else {
-                $this->error(lang('member_edit_fail'));
+        }else{
+            $user = db('user')->where('user_email',$user_info['user_email'])->find();
+            if($user['user_status'] ==1){
+                $user['user_status_cn'] = '已实名认证';
+            }else{
+                $user['user_status_cn'] = '未实名认证';
             }
-        }
-    }
 
-    public function del()
-    {
-        $member_id = input('param.member_id');
-        if (empty($member_id)) {
-            $this->error(lang('param_error'));
-        }
-        $result = db('member')->delete($member_id);
-        if ($result) {
-            ds_json_encode(10000, lang('member_del_succ'));
-        } else {
-            ds_json_encode(10001, lang('member_del_fail'));
+            if($user['user_type'] ==1){
+                $user['user_type_cn'] = '个人用户';
+            }
+            if($user['user_type'] ==2){
+                $user['user_type_cn'] = '公司用户';
+            }
+            $this->assign('user', $user);
+            return $this->fetch();
         }
     }
 
-    protected function getAdminItemList()
-    {
-        $menu_array = array(
-            array(
-                'name' => 'index', 'text' => lang('ds_manage'), 'url' => url('Member/index')
-            ), array(
-                'name' => 'add', 'text' => lang('ds_add'), 'url' => "javascript:dsLayerOpen('".url('Member/add')."','".lang('ds_add')."')"
-            ),
-        );
-        return $menu_array;
-    }
 
 }

+ 53 - 1
application/user/controller/Updatepwd.php

@@ -6,7 +6,7 @@ use think\Controller;
 use think\Lang;
 use think\Validate;
 
-class Updatepwd extends Controller
+class Updatepwd extends UserControl
 {
 
     public function _initialize()
@@ -21,7 +21,59 @@ class Updatepwd extends Controller
      */
     public function index()
     {
+        $user_info = $this->getAdminInfo();
+        $user = db('user')->where('user_id',$user_info['user_id'])->find();
+        if (request()->isPost()) {
+            $password = input('post.password');
+            $new_password = input('post.new_password');
+            $confirm_password = input('post.confirm_password');
+
+            // 原密码 验证
+            if(md5($password) != $user['user_password']){
+                //验证失败
+                $this->error('原密码输入不正确');
+            }
+
+            // 新密码 验证
+            if($new_password != $confirm_password){
+                //验证失败
+                $this->error('新密码不一致');
+            }
+
+            $update_info = array(
+                'user_password' => md5($new_password)
+            );
+            $res = db('user')->where('user_id', $user_info['user_id'])->update($update_info);
+            if($res == 1){
+                return $this->redirect('User/Member/index');
+            }
+
+        }else{
+            $user_info = $this->getAdminInfo();
+            $user = db('user')->where('user_id',$user_info['user_id'])->find();
             return $this->fetch();
+        }
+    }
+
+    /**
+     * 修改用户名
+     * @return mixed
+     */
+    public function username()
+    {
+        return $this->fetch();
+    }
+
+    /**
+     * 修改电话
+     * @return mixed
+     */
+    public function phone()
+    {
+        $user_info = $this->getAdminInfo();
+        $user = db('user')->where('user_id',$user_info['user_id'])->find();
+        $this->assign('user', $user);
+        return $this->fetch();
     }
 
 }

+ 7 - 7
application/user/view/member/index.html

@@ -48,12 +48,12 @@
                 <tr>
                     <td class="td_info">登陆账号</td>
                     <td class="td_user_info">{$Think.session.user_email}&nbsp&nbsp&nbsp{$user['user_status_cn']}</td>
-                    <td class="td_update"><a href="">修改用户名</a>|<a href="/user/Updatepwd/index.html">修改密码</a></td>
+                    <td class="td_update"><a href="/user/Updatepwd/username.html">修改用户名</a>|<a href="/user/Updatepwd/index.html">修改密码</a></td>
                 </tr>
                 <tr>
                     <td class="td_info">手机号码</td>
                     <td class="td_user_info">+ (86)&nbsp&nbsp{$user['user_phone']}</td>
-                    <td class="td_update"><a href="">修改手机号码</a></td>
+                    <td class="td_update"><a href="/user/Updatepwd/phone.html">修改手机号码</a></td>
                 </tr>
             </table>
 
@@ -66,23 +66,23 @@
                 <table>
                     <tr>
                         <td class="td_info">会员类型</td>
-                        <td class="td_user_info">个人用户</td>
+                        <td class="td_user_info">{$user['user_type_cn']}</td>
                     </tr>
                     <tr>
                         <td class="td_info">称呼</td>
-                        <td class="td_user_info"><input type="text" placeholder="请输入称呼"></td>
+                        <td class="td_user_info"><input type="text" name="user_name" placeholder="请输入称呼" value="{$user['user_name']}"></td>
                     </tr>
                     <tr>
                         <td class="td_info">公司名称</td>
-                        <td class="td_user_info"><input type="text" placeholder="请输入公司名称"></td>
+                        <td class="td_user_info"><input type="text" name="company" placeholder="请输入公司名称" value="{$user['company']}"></td>
                     </tr>
                     <tr>
                         <td class="td_info">所属行业</td>
-                        <td class="td_user_info"><input type="text" placeholder="请输入所属行业"></td>
+                        <td class="td_user_info"><input type="text" name="trade" placeholder="请输入所属行业" value="{$user['trade']}"></td>
                     </tr>
                     <tr>
                         <td class="td_info">公司地址</td>
-                        <td class="td_user_info"><input type="text" placeholder="请输入公司地址"></td>
+                        <td class="td_user_info"><input type="text" name="address" placeholder="请输入公司地址" value="{$user['address']}"></td>
                     </tr>
                     <tr>
                         <td class="td_info"></td>

+ 148 - 0
application/user/view/updatepwd/phone.html

@@ -0,0 +1,148 @@
+{extend name="layout:home" /}
+{block name="container"}
+<style>
+    .yanzheng{
+        margin:0px auto;
+        height: 100px;
+        width: 600px;
+    }
+    ul{
+        margin:50px auto;
+        width: 536px;
+        /*border: 1px red solid;*/
+        text-align: center;
+        position: relative;
+    }
+
+    ul li{
+        /*border: 1px #aaa solid;*/
+        border-radius: 2px;
+        height: 30px;
+        width: 30px;
+        line-height:30px ;
+        float: left;
+        margin-left: 220px;
+    }
+    li .num{
+        border: 1px #aaa solid;
+        height: 30px;
+        width: 30px;
+        line-height:30px ;
+        text-align: center;
+        border-radius: 100%;
+        background-color: white;
+    }
+    li .tishi{
+        width: 100px;
+        text-align: center;
+        /*border: 1px #aaa solid;*/
+        margin-left: -35px;
+        color: dodgerblue;
+    }
+    table{
+        margin:0 auto;
+        font-size: 13px;
+    }
+    /*.accountinfo_title table{*/
+    /*margin-left: 150px;*/
+    /*}*/
+    table td{
+        width: 100px;
+        height: 60px;
+        line-height: 60px;
+    }
+    table input{
+        border: 1px #aaa solid;
+        border-radius: 2px;
+        height: 30px;
+        width: 220px;
+        line-height:30px ;
+    }
+</style>
+<div class="layui-tab layui-tab-card">
+    <div class="updatepwd">
+        <form method="post">
+            <div class="yanzheng">
+                <ul>
+                    <div style="border: 1px #aaa solid; width: 530px;margin-top: 15px;position: absolute;z-index: -1;" ></div>
+                    <li style="margin-left: 0px;">
+                        <div class="num">1</div>
+                        <div class="tishi">身份验证</div>
+                    </li>
+                    <li>
+                        <div class="num">2</div>
+                        <div class="tishi">新d电话号码验证</div>
+                    </li>
+                    <li>
+                        <div class="num">3</div>
+                        <div class="tishi">下一步</div>
+                    </li>
+                </ul>
+            </div>
+            <div style="height: 280px;">
+                <table>
+                    <tr>
+                        <td class="td_info">您的电话号码</td>
+                        <td style="position: relative;">+ (86)&nbsp&nbsp{$user['user_phone']}<input type="button" value="获取验证码" style="width: 80px;accept:right;position: absolute;right: 0px;top:15px;"></td>
+                    </tr>
+                    <tr>
+                        <td class="td_info">输入验证码</td>
+                        <td class="td_user_info"><input type="text" name="captcha" id="captcha" placeholder="请输入验证码"></td>
+                    </tr>
+                    <tr>
+                        <td class="td_info"></td>
+                        <td class="next"><input type="button" value="下一步" style="width: 80px;border-color: dodgerblue;color: dodgerblue;background-color: white;"></td>
+                    </tr>
+                </table>
+            </div>
+        </form>
+    </div>
+</div>
+<script>
+    //密码 校验
+    $("#new_password").blur(function(){
+        var password = document.getElementById("new_password").value;
+        var patrn=/^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,20}$/;
+        if (!patrn.exec(password)){
+            document.getElementById("new_password").style.borderColor = "red";
+            document.getElementById("layui-btn").type = "button";
+        }else{
+            document.getElementById("new_password").style.borderColor = "#e6e6e6";
+            if(document.getElementById("confirm_password").style.borderColor != "red"){
+                document.getElementById("layui-btn").type = "submit";
+            }
+        }
+    });
+    $("#confirm_password").blur(function(){
+        var password = document.getElementById("confirm_password").value;
+        var patrn=/^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,20}$/;
+        if (!patrn.exec(password)){
+            document.getElementById("confirm_password").style.borderColor = "red";
+            document.getElementById("layui-btn").type = "button";
+        }else{
+            document.getElementById("confirm_password").style.borderColor = "#e6e6e6";
+            if(document.getElementById("new_password").style.borderColor != "red"){
+                document.getElementById("layui-btn").type = "submit";
+            }
+        }
+    });
+</script>
+<script type="text/javascript">
+    layui.use('laydate', function(){
+        var laydate = layui.laydate;
+
+        //执行一个laydate实例
+        laydate.render({
+            elem: '#creatTime' //指定元素
+        });
+        laydate.render({
+            elem:'#timeRang',
+            range:true,
+            format: 'yyyy/MM/dd',
+            done: function(value, date){
+                /* 时间选择完成后的回调 */
+            }
+        })
+    });
+</script>
+{/block}

+ 148 - 0
application/user/view/updatepwd/username.html

@@ -0,0 +1,148 @@
+{extend name="layout:home" /}
+{block name="container"}
+<style>
+    .yanzheng{
+        margin:0px auto;
+        height: 100px;
+        width: 600px;
+    }
+    ul{
+        margin:50px auto;
+        width: 536px;
+        /*border: 1px red solid;*/
+        text-align: center;
+        position: relative;
+    }
+
+    ul li{
+        /*border: 1px #aaa solid;*/
+        border-radius: 2px;
+        height: 30px;
+        width: 30px;
+        line-height:30px ;
+        float: left;
+        margin-left: 220px;
+    }
+    li .num{
+        border: 1px #aaa solid;
+        height: 30px;
+        width: 30px;
+        line-height:30px ;
+        text-align: center;
+        border-radius: 100%;
+        background-color: white;
+    }
+    li .tishi{
+        width: 100px;
+        text-align: center;
+        /*border: 1px #aaa solid;*/
+        margin-left: -35px;
+        color: dodgerblue;
+    }
+    table{
+        margin:0 auto;
+        font-size: 13px;
+    }
+    /*.accountinfo_title table{*/
+    /*margin-left: 150px;*/
+    /*}*/
+    table td{
+        width: 100px;
+        height: 60px;
+        line-height: 60px;
+    }
+    table input{
+        border: 1px #aaa solid;
+        border-radius: 2px;
+        height: 30px;
+        width: 220px;
+        line-height:30px ;
+    }
+</style>
+<div class="layui-tab layui-tab-card">
+    <div class="updatepwd">
+        <form method="post">
+            <div class="yanzheng">
+                <ul>
+                    <div style="border: 1px #aaa solid; width: 530px;margin-top: 15px;position: absolute;z-index: -1;" ></div>
+                    <li style="margin-left: 0px;">
+                        <div class="num">1</div>
+                        <div class="tishi">身份验证</div>
+                    </li>
+                    <li>
+                        <div class="num">2</div>
+                        <div class="tishi">新登陆邮箱验证</div>
+                    </li>
+                    <li>
+                        <div class="num">3</div>
+                        <div class="tishi">下一步</div>
+                    </li>
+                </ul>
+            </div>
+            <div style="height: 280px;">
+                <table>
+                    <tr>
+                        <td class="td_info">您的用户名</td>
+                        <td style="position: relative;">{$Think.session.user_email}<input type="button" value="获取验证码" style="width: 80px;accept:right;position: absolute;right: 0px;top:15px;"></td>
+                    </tr>
+                    <tr>
+                        <td class="td_info">输入验证码</td>
+                        <td class="td_user_info"><input type="text" name="captcha" id="captcha" placeholder="请输入验证码"></td>
+                    </tr>
+                    <tr>
+                        <td class="td_info"></td>
+                        <td class="next"><input type="button" value="下一步" style="width: 80px;border-color: dodgerblue;color: dodgerblue;background-color: white;"></td>
+                    </tr>
+                </table>
+            </div>
+        </form>
+    </div>
+</div>
+<script>
+    //密码 校验
+    $("#new_password").blur(function(){
+        var password = document.getElementById("new_password").value;
+        var patrn=/^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,20}$/;
+        if (!patrn.exec(password)){
+            document.getElementById("new_password").style.borderColor = "red";
+            document.getElementById("layui-btn").type = "button";
+        }else{
+            document.getElementById("new_password").style.borderColor = "#e6e6e6";
+            if(document.getElementById("confirm_password").style.borderColor != "red"){
+                document.getElementById("layui-btn").type = "submit";
+            }
+        }
+    });
+    $("#confirm_password").blur(function(){
+        var password = document.getElementById("confirm_password").value;
+        var patrn=/^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,20}$/;
+        if (!patrn.exec(password)){
+            document.getElementById("confirm_password").style.borderColor = "red";
+            document.getElementById("layui-btn").type = "button";
+        }else{
+            document.getElementById("confirm_password").style.borderColor = "#e6e6e6";
+            if(document.getElementById("new_password").style.borderColor != "red"){
+                document.getElementById("layui-btn").type = "submit";
+            }
+        }
+    });
+</script>
+<script type="text/javascript">
+    layui.use('laydate', function(){
+        var laydate = layui.laydate;
+
+        //执行一个laydate实例
+        laydate.render({
+            elem: '#creatTime' //指定元素
+        });
+        laydate.render({
+            elem:'#timeRang',
+            range:true,
+            format: 'yyyy/MM/dd',
+            done: function(value, date){
+                /* 时间选择完成后的回调 */
+            }
+        })
+    });
+</script>
+{/block}