コード例 #1
0
 public function AddUser($data_list)
 {
     $alumnus = M('Alumnus');
     $roleuser = M('ThinkRoleUser');
     foreach ($data_list as $key => $value) {
         $data = array('userstatus' => 0, 'realname' => $value['name'], 'sex' => $value['sex'], 'IDcardNo' => $value['id']);
         $roleid = $value['roleid'];
         if ($roleid == 4) {
             $data['username'] = $value['username'];
         }
         $resid = $this->add($data);
         if ($roleid == 4) {
             $user = new \User\Model\UserModel();
             $user->RegisterRandom($resid);
             $user->ResetPwd($resid);
         }
         $roleuser->add(array('role_id' => $roleid, 'user_id' => $resid));
         if ($roleid != 4) {
             $alumnus->add(array('class_id' => $value['classid'], 'user_id' => $resid));
         }
     }
 }
コード例 #2
0
 public function reset_pwd()
 {
     if (IS_POST) {
         $user = new \User\Model\UserModel();
         if ($user->ResetPwd(I('userid'))) {
             $this->success('重置成功');
         } else {
             $this->error('重置失败,用户未注册或系统错误');
         }
     }
 }