文章目录
crm开发定制一项目概述
进入21世纪以来,crm开发定制信息技术从根本上推动crm开发定制了图书馆的飞速发展,crm开发定制计算机和计算机管理系crm开发定制统已成为图书馆进行图crm开发定制书管理的主要设备和系统。crm开发定制虽然目前很多大型的图crm开发定制书馆已经有一整套比较crm开发定制完善的管理系统,crm开发定制但是在一些中小型的图书馆中,crm开发定制大部分工作仍需手工完成,crm开发定制工作起来效率比较低,crm开发定制不便于动态、crm开发定制及时地调整图书结构。为了更好地适应当前图书馆的管理需求,解决手工管理中存在的弊端,越来越多的中小型图书馆正在逐步向计算机信息化管理转变。高校拥有一个小型图书馆,为全校师生提供一个阅读、学习的空间。近年来,随着生源不断扩大,图书馆的规模也随之扩大,图书数量也相应地大量增加,有关图书的各种信息成倍增加。面对如此庞大的信息量,校领导决定使用一套合理、有效、规范、实用的图书馆管理系统,对校内图书资料进行统一、 集中的管理。随着现代化的发展,开发一个图书馆管理系统,其开发宗旨是实现图书管理的系统化、规范化和自动化,达成图书资料集中、统一管理的目标。因此,本次项目的目的就是为高校开发一个图书管理系统。
图书管理系统是基于PHP框架的系统。用于在短期内快速搭建系统应用。整个系统大致可分为五个模块,分别是登录模块、图书管理、用户管理、借阅管理、个人信息模块。结合老师课堂的讲解,将对系统做进一步的完善。
本次项目课题拟解诀的主要问题就是如何通过我们所学知识设计一个切实可行的系统来实现一些为高校实现图书的管理功能。本次软件开发工具是Eclipse,服务器是Xampps,后台数据库采用mysql。本学期目的要求我们有熟练掌握的PHP架构知识以及HTML框架,还要有通过搜索资料补充完善系统的能力。
提示:以下是本篇文章正文内容,下面案例可供参考
二 图书管理系统描述
2.1 课题简介
本系统主要应用于部分高校的图书馆,总体任务是实现对大学生图书的借阅等进行一些基本功能,如利用对图书信息的查询、修改、增加、删除等基本功能。
本系统主要实现的登录、图书信息展示、用户的管理、图书的借阅等部分。其主要功能主要有:
- 登录功能:通过输入不同的账号、密码以及验证码进入不同权限的管理界面,还可以通过管理员添加用户功能实现账号的注册。
- 个人中心功能:此项功能是针对于用户开发的个人信息查看功能,包括查看用户的信息,如姓名、班级等,并且实现个人密码修改功能。
- 图书信息展示功能:此项功能是本平台的重要功能,包括图书信息的详细信息,如图书名称、作者、图书号、价格、图书简介等,这些信息都是可以更新的。
- 用户的管理功能:此项功能主要是针对于管理员设置的,可以对用户的个人信息、账号状态等信息进行修改查询。
图书的借阅功能:此项功能主要是针对于管理员设置的,可以实现对用户的图书借阅及归还等功能。
2.2 模块简介
图1 图书管理系统模块图
本系统分为五大模块,分为登录模块、个人中心、图书管理、用户管理、图书借阅模块。
2.3 数据库结构设计
我所负责的模块中涉及的数据表的相关信息如下:
表1 用户登陆信息表
字段名称 | 数据类型 | 字段长度 | 字段说明 | 备注 |
id | int | 50 | 用户ID | 主键(非空) |
name | varchar | 50 | 用户名 | |
pwd | varchar | 50 | 用户密码 | |
status | tinyint | 3 | 用户状态 | |
| varchar | 50 | 班级 | |
admin | tinyint | 3 | 是否为管理员 | |
last_login_time | datetime | 10 | 上次登录时间 |
表2 图书信息表
字段名称 | 数据类型 | 字段长度 | 字段说明 | 备注 |
id | varchar | 50 | 书号 | 主键(非空) |
name | varchar | 50 | 图书名 | |
autho | varchar | 50 | 作者 | |
press | varchar | 50 | 出版社 | |
press_time | varchar | 50 | 出版时间 | |
price | varchar | 50 | 价格 | |
ISBN | varchar | 50 | ISBN | |
| text | 50 | 作品简介 |
表3 图书借阅表
字段名称 | 数据类型 | 字段长度 | 字段说明 | 备注 |
book_id | int | 50 | 书号 | 主键(非空) |
user_id | int | 50 | 用户ID | |
borrow_date | date | 50 | 借阅日期 | |
back_date | date | 50 | 归还日期 |
三 主要模块的详细设计
3.1 主要技术点说明
(1)登录
//登录验证,添加有验证码功能
//Json登陆接口
- public function login(){
-
- header("Content-Type:application/json");
-
-
-
- $rightCode = strtolower($_SESSION['verifyCode']);//正确的验证码
-
- $code = strtolower($_POST['verify']); //输入的验证码
-
- $userId = htmlentities($_POST['userId']); //账号
-
- $password = md5($_POST['password']); //密码
//先验证验证码,正确再验证账号密码,减小数据库压力
- if($code != $rightCode){
-
- $this->sendJsonMessage("验证码错误",1);
-
- }
//验证账号密码
- $userModel = new UserModel;
-
- $where = "id='{$userId}' and pwd='{$password}'";
-
- $result = $userModel->fetchOne($where);
-
- if(!empty($result) && $result['status'] == 1){
-
-
-
- $_SESSION['userId'] = $userId;
-
- $_SESSION['admin'] = $result['admin'];
-
- $_SESSION['last_login_time'] = $result['last_login_time'];
-
-
-
- $message = array("message"=>"OK","code"=>0,"admin"=>"{$result['admin']}");
(2)图书管理
//展示图书详细信息以及增删改
//获取每页图书信息
- $offset = ($currentPage - 1) * $eachPerPage;
-
- $books = $bookModel->fetchAllWithJoin($where,"LIMIT {$offset},{$eachPerPage}");
//分页
- $pager = new Pager($currentPage,$count,$eachPerPage,"?p=Admin&c=Book&a=index",$parms);
-
-
-
- $this->smarty->assign("books",$books);
-
- $this->smarty->assign("mode",$mode);
-
- $this->smarty->assign("pageStr",$pager->page());
-
- $this->smarty->display("Book/index.html");
-
- }
//显示图书详情页面
- public function detail(){
-
- $this->accessPage();
-
-
-
- $id = $_GET['id'];
-
-
-
- $bookModel = new BookModel;
-
- $result = $bookModel->fetchOneWithJoin("book_info.id={$id}");
-
-
-
- $this->smarty->assign("book",$result);
-
- $this->smarty->display("Book/detail.html");
-
- }
//显示添加图书页面
- public function add(){
-
- $this->accessPage();
-
-
-
- $this->smarty->display("Book/add.html");
-
- }
//显示编辑图书页面
- public function edit(){
-
- $this->accessPage();
-
-
-
- $id = $_GET['id'];
-
-
-
- $bookModel = new BookModel;
-
- $book = $bookModel->fetchOne("id={$id}");
-
-
-
- $this->smarty->assign("book",$book);
-
- $this->smarty->display("Book/edit.html");
-
- }
//Json添加图书接口
- public function insert(){
-
- $this->accessJson();
-
- $bookInfo['name'] = $_POST['name'];
-
- $bookInfo['author'] = $_POST['author'];
-
- $bookInfo['press'] = $_POST['press'];
-
- $bookInfo['press_time'] = $_POST['pressTime'];
-
- $bookInfo['price'] = $_POST['price'];
-
- $bookInfo['ISBN'] = $_POST['ISBN'];
-
- $bookInfo['desc'] = $_POST['desc'];
//验证信息是否填写完整
- if(in_array("",$bookInfo)){
-
- $this->sendJsonMessage("请输入完整信息",1);
-
- }
-
-
-
- $bookModel = new BookModel;
-
- if($bookModel->insert($bookInfo)){
-
- $this->sendJsonMessage("添加成功",0);
-
- }else{
-
- $this->sendJsonMessage("添加失败",1);
-
- }
-
- }
//Json接口修改图书
- public function update(){
-
- $this->accessJson();
-
-
-
- $id = $_POST['id'];
-
- $bookInfo['name'] = $_POST['name'];
-
- $bookInfo['author'] = $_POST['author'];
-
- $bookInfo['press'] = $_POST['press'];
-
- $bookInfo['press_time'] = $_POST['press_time'];
-
- $bookInfo['price'] = $_POST['price'];
-
- $bookInfo['ISBN'] = $_POST['ISBN'];
-
- $bookInfo['desc'] = $_POST['desc'];
-
-
-
- //验证信息是否填写完整
-
- if(in_array("",$bookInfo)){
-
- $this->sendJsonMessage("请输入完整信息",1);
-
- }
-
-
-
- $bookModel = new BookModel;
-
- if($bookModel->update($bookInfo,"id={$id}")){
-
- $this->sendJsonMessage("修改成功",0);
-
- }else{
-
- $this->sendJsonMessage("修改失败",1);
-
- }
-
- }
//Json删除图书接口
- public function delete(){
-
- $this->accessJson();
-
-
-
- $id = $_POST['id'];
-
-
-
- $bookModel = new BookModel;
-
- $borrowModel = new BorrowModel;
-
- if($bookModel->delete("id={$id}") && $borrowModel->delete("book_id={$id}")){
-
- $this->sendJsonMessage("删除成功",0);
-
- }else{
-
- $this->sendJsonMessage("删除失败",1);
-
- }
-
- }
-
- }
(3)用户管理
//对用户信息进行管理
- //获取每页用户信息
-
- $offset = ($currentPage - 1) * $eachPerPage;
-
- $users = $userModel->fetchAllUser($where,"LIMIT {$offset},{$eachPerPage}");
-
-
-
- //分页
-
- $pager = new Pager($currentPage,$count,$eachPerPage,"?p=Admin&c=User&a=index",$parms);
-
-
-
- $this->smarty->assign("users",$users);
-
- $this->smarty->assign("mode",$mode);
-
- $this->smarty->assign("pageStr",$pager->page());
-
- $this->smarty->display("User/index.html");
-
- }
-
-
-
- //显示添加用户界面
-
- public function add(){
-
- $this->accessPage();
-
-
-
- $this->smarty->display("User/add.html");
-
- }
-
-
-
- //显示管理用户界面
-
- public function manage(){
-
- $this->accessPage();
-
-
-
- $id = $_GET['id'];
-
-
-
- $userModel = new UserModel;
-
- //获取用户信息
-
- $userInfo = $userModel->fetchOne("id={$id}");
-
-
-
- //阻止url非法传参
-
- if(empty($userInfo)){
-
- echo "<script>alert('该用户不存在');</script>";
-
- die();
-
- }
-
-
-
- $borrowModel = new BorrowModel;
-
- //获取用户借阅信息
-
- $borrowInfo = $borrowModel->getBorrowInfo("borrow_list.user_id={$id}");
-
-
-
- $this->smarty->assign("userInfo",$userInfo);
-
- $this->smarty->assign("borrowInfo",$borrowInfo);
-
- $this->smarty->display("User/manage.html");
-
- }
-
-
-
- //Json添加用户接口
-
- public function insert(){
-
- $this->accessJson();
-
-
-
- $user['id'] = $_POST['userId'];
-
- $user['pwd'] = md5($_POST['password']);
-
- $user['name'] = $_POST['name'];
-
- $user['class'] = $_POST['class'];
-
- $user['status'] = $_POST['status'] ? 1 : 0;
-
-
-
- $usermodel = new UserModel;
-
-
-
- if(in_array("",$user)){
-
- $this->sendJsonMessage("请将信息填写完整",1);
-
- }
-
-
-
- if($usermodel->rowCount("id={$user['id']}")){
-
- $this->sendJsonMessage("该用户ID已存在",1);
-
- }
-
-
-
- if($usermodel->insert($user)){
-
- $this->sendJsonMessage("添加用户成功",0);
-
- }else{
-
- $this->sendJsonMessage("添加用户失败",1);
-
- }
-
- }
-
-
-
- //Json修改用户接口
-
- public function changeInfo(){
-
- $this->accessJson();
-
-
-
- $id = $_POST['userId'];
-
- $data['name'] = $_POST['name'];
-
- $data['class'] = $_POST['class'];
-
-
-
- if(in_array("",$data)){
-
- $this->sendJsonMessage("请填写完整信息",1);
-
- }
-
-
-
- $userModel = new UserModel;
-
-
-
- if($userModel->update($data,"id={$id}")){
-
- $this->sendJsonMessage("修改成功",0);
-
- }else{
-
- $this->sendJsonMessage("修改失败",1);
-
- }
-
- }
-
-
-
- //Json挂失用户接口
-
- public function lost(){
-
- $this->accessJson();
-
-
-
- $id = $_POST['userId'];
-
-
-
- $userModel = new UserModel;
-
- if($userModel->update(array("status"=>0),"id={$id}")){
-
- $this->sendJsonMessage("挂失成功",0);
-
- }else{
-
- $this->sendJsonMessage("挂失失败",1);
-
- }
-
- }
-
-
-
- //Json启用用户接口
-
- public function open(){
-
- $this->accessJson();
-
-
-
- $id = $_POST['userId'];
-
-
-
- $userModel = new UserModel;
-
- if($userModel->update(array("status"=>1),"id={$id}")){
-
- $this->sendJsonMessage("启用成功",0);
-
- }else{
-
- $this->sendJsonMessage("启用失败",1);
-
- }
-
- }
-
-
-
- //Json修改用户密码接口
-
- public function changePwd(){
-
- $this->accessJson();
-
-
-
- if(!$_POST['pwd']){
-
- $this->sendJsonMessage("请输入密码",1);
-
- }
-
-
-
- $id = $_POST['userId'];
-
- $pwd = md5($_POST['pwd']);
-
-
-
- $userModel = new UserModel;
-
- if($userModel->update(array("pwd"=>$pwd),"id={$id}")){
-
- $this->sendJsonMessage("修改成功",0);
-
- }else{
-
- $this->sendJsonMessage("修改失败",1);
-
- }
-
- }
-
-
-
- //Json删除用户接口
-
- public function delete(){
-
- $this->accessJson();
-
-
-
- $id = $_POST['userId'];
-
-
-
- $userModel = new UserModel;
-
- $borrowModel = new BorrowModel;
-
- if($userModel->delete("id={$id}") && $borrowModel->delete("user_id={$id}")){
-
- $this->sendJsonMessage("删除成功",0);
-
- }else{
-
- $this->sendJsonMessage("删除失败",1);
-
- }
-
- }
(4)借阅管理
//完成用户的结束还书工作
- //Json借书和还书接口
-
- public function manage(){
-
- $this->accessJson();
-
-
-
- $bookId = $_POST['bookId'];
-
- $userId = $_POST['userId'];
-
- $action = $_POST['action'];
-
-
-
- if($userId == "" || $bookId == ""){
-
- $this->sendJsonMessage("请填写完整信息",1);
-
- }
-
-
-
- $borrowModel = new BorrowModel;
-
- if($action == "borrow"){
-
- //借书
-
- if($borrowModel->canBorrow($bookId,$userId)){
-
- $data = array(
-
- "book_id" => $bookId,
-
- "user_id" => $userId,
-
- "borrow_date" => date("Y-m-d"),
-
- "back_date" => date("Y-m-d",strtotime("+2 month"))
-
- );
-
- if($borrowModel->insert($data)){
-
- $this->sendJsonMessage("借书成功",0);
-
- }else{
-
- $this->sendJsonMessage("借书失败",1);
-
- }
-
- }else{
-
- $this->sendJsonMessage("信息错误或该书已借出",1);
-
- }
-
- }else if($action == "return"){
-
- //还书
-
- if($borrowModel->canReturn($bookId,$userId)){
-
- if($borrowModel->delete("book_id={$bookId} AND user_id={$userId}")){
-
- $this->sendJsonMessage("还书成功",0);
-
- }else{
-
- $this->sendJsonMessage("还书失败",1);
-
- }
-
- }else{
-
- $this->sendJsonMessage("信息错误或该用户未借此书",1);
-
- }
-
- }else{
-
- $this->sendJsonMessage("参数错误",1);
-
- }
-
- }
-
-
-
- //Json续借接口
-
- public function prolong(){
-
- $this->accessJson();
-
-
-
- //未传参中断
-
- if(!isset($_POST['bookId']) || !isset($_POST['userId'])){
-
- $this->sendJsonMessage("缺少参数",1);
-
- }
-
-
-
- $bookId = $_POST['bookId'];
-
- $userId = $_POST['userId'];
-
-
-
- $borrowModel = new BorrowModel;
-
- $result = $borrowModel->fetchOne("book_id={$bookId} AND user_id={$userId}");
-
-
-
- //没有借书就不能续借
-
- if(empty($result)){
-
- $this->sendJsonMessage("该用户没有借阅此书",1);
-
- }
-
- //超期不能续借
-
- if(strtotime($result['back_date']) < time()){
-
- $this->sendJsonMessage("超期的书不能续借",1);
-
- }
-
-
-
- //计算应还时间
-
- $backTime = date("Y-m-d",strtotime("+1 month",strtotime($result['back_date'])));
-
- $data = array("back_date"=>$backTime);
-
- if($borrowModel->update($data,"book_id={$bookId} AND user_id={$userId}")){
-
- $this->sendJsonMessage("续借成功",0);
-
- }else{
-
- $this->sendJsonMessage("续借失败",1);
-
- }
-
- }
-
-
-
- //Json还书接口
-
- public function returnBook(){
-
- $this->accessJson();
-
-
-
- $bookId = $_POST['bookId'];
-
- $userId = $_POST['userId'];
-
-
-
- $borrowModel = new BorrowModel;
-
- if($borrowModel->canReturn($bookId,$userId)){
-
- if($borrowModel->delete("book_id={$bookId} AND user_id={$userId}")){
-
- $this->sendJsonMessage("还书成功",0);
-
- }else{
-
- $this->sendJsonMessage("还书失败",1);
-
- }
-
- }else{
-
- $this->sendJsonMessage("信息错误或该用户未借此书",1);
-
- }
-
- }
3.2 结果展示
总结与反思
由于本次项目相关知识课堂上已经强调过好多次,老师讲的很好,很认真,但是做项目的时间较短,本次开发的“图书管理系统”并没有完全的完成,但是经过小组学习项目制作让我了解了利用PHP开发网页的流程,并且熟悉了Eclipse这款软件的一些操作流程,并且针对于HTML和数据库的运用,以及一些框架的调用都有了很大的提高,相比于之前的web网页开发,本次项目的内容和专业性都有所提升,而且相对来说更加简单便捷
。