crm开发定制图书馆管理系统(PHP期末报告)

文章目录



crm开发定制一项目概述

 进入21世纪以来,crm开发定制信息技术从根本上推动crm开发定制了图书馆的飞速发展,crm开发定制计算机和计算机管理系crm开发定制统已成为图书馆进行图crm开发定制书管理的主要设备和系统。crm开发定制虽然目前很多大型的图crm开发定制书馆已经有一整套比较crm开发定制完善的管理系统,crm开发定制但是在一些中小型的图书馆中,crm开发定制大部分工作仍需手工完成,crm开发定制工作起来效率比较低,crm开发定制不便于动态、crm开发定制及时地调整图书结构。为了更好地适应当前图书馆的管理需求,解决手工管理中存在的弊端,越来越多的中小型图书馆正在逐步向计算机信息化管理转变。高校拥有一个小型图书馆,为全校师生提供一个阅读、学习的空间。近年来,随着生源不断扩大,图书馆的规模也随之扩大,图书数量也相应地大量增加,有关图书的各种信息成倍增加。面对如此庞大的信息量,校领导决定使用一套合理、有效、规范、实用的图书馆管理系统,对校内图书资料进行统一、 集中的管理。随着现代化的发展,开发一个图书馆管理系统,其开发宗旨是实现图书管理的系统化、规范化和自动化,达成图书资料集中、统一管理的目标。因此,本次项目的目的就是为高校开发一个图书管理系统。

图书管理系统是基于PHP框架的系统。用于在短期内快速搭建系统应用。整个系统大致可分为五个模块,分别是登录模块、图书管理、用户管理、借阅管理个人信息模块。结合老师课堂的讲解,将对系统做进一步的完善。

本次项目课题拟解诀的主要问题就是如何通过我们所学知识设计一个切实可行的系统来实现一些为高校实现图书的管理功能。本次软件开发工具是Eclipse服务器是Xampps后台数据库采用mysql本学期目的要求我们有熟练掌握的PHP架构知识以及HTML框架,还要有通过搜索资料补充完善系统的能力。


提示:以下是本篇文章正文内容,下面案例可供参考

二 图书管理系统描述

2.1 课题简介

本系统主要应用于部分高校的图书馆,总体任务是实现对大学生图书的借阅等进行一些基本功能,如利用对图书信息的查询、修改、增加、删除等基本功能。

本系统主要实现的登录、图书信息展示、用户的管理、图书的借阅等部分。其主要功能主要有:

  1. 登录功能:通过输入不同的账号、密码以及验证码进入不同权限的管理界面,还可以通过管理员添加用户功能实现账号的注册。
  2. 个人中心功能:此项功能是针对于用户开发的个人信息查看功能,包括查看用户的信息,如姓名、班级等,并且实现个人密码修改功能。
  3. 图书信息展示功能:此项功能是本平台的重要功能,包括图书信息的详细信息,如图书名称、作者、图书号、价格、图书简介等,这些信息都是可以更新的。
  4. 用户的管理功能:此项功能主要是针对于管理员设置的,可以对用户的个人信息、账号状态等信息进行修改查询。

图书的借阅功能:此项功能主要是针对于管理员设置的,可以实现对用户的图书借阅及归还等功能。

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登陆接口   

  1.  public function login(){
  2.         header("Content-Type:application/json");
  3.         $rightCode  =   strtolower($_SESSION['verifyCode']);//正确的验证码
  4.         $code       =   strtolower($_POST['verify']);   //输入的验证码
  5.         $userId     =   htmlentities($_POST['userId']);     //账号
  6.         $password   =   md5($_POST['password']);            //密码

        //先验证验证码,正确再验证账号密码,减小数据库压力     

  1.         if($code != $rightCode){
  2.             $this->sendJsonMessage("验证码错误",1);
  3.         }

        //验证账号密码      

  1.   $userModel = new UserModel;
  2.         $where = "id='{$userId}' and pwd='{$password}'";
  3.         $result = $userModel->fetchOne($where);
  4.         if(!empty($result) && $result['status'] == 1){
  5.             $_SESSION['userId']           =     $userId;
  6.             $_SESSION['admin']            =     $result['admin'];
  7.             $_SESSION['last_login_time']  =     $result['last_login_time'];
  8.             $message = array("message"=>"OK","code"=>0,"admin"=>"{$result['admin']}");

(2)图书管理

//展示图书详细信息以及增删改

    //获取每页图书信息        

  1. $offset = ($currentPage - 1) * $eachPerPage;
  2.         $books = $bookModel->fetchAllWithJoin($where,"LIMIT {$offset},{$eachPerPage}");

        //分页     

  1.    $pager = new Pager($currentPage,$count,$eachPerPage,"?p=Admin&c=Book&a=index",$parms);
  2.         
  3.         $this->smarty->assign("books",$books);
  4.         $this->smarty->assign("mode",$mode);
  5.         $this->smarty->assign("pageStr",$pager->page());
  6.         $this->smarty->display("Book/index.html");
  7.     }

    //显示图书详情页面   

  1.  public function detail(){
  2.         $this->accessPage();
  3.         $id = $_GET['id'];
  4.         $bookModel = new BookModel;
  5.         $result = $bookModel->fetchOneWithJoin("book_info.id={$id}");
  6.         
  7.         $this->smarty->assign("book",$result);
  8.         $this->smarty->display("Book/detail.html");
  9.     }

    //显示添加图书页面    

  1. public function add(){
  2.         $this->accessPage();
  3.         $this->smarty->display("Book/add.html");
  4.     }

    //显示编辑图书页面    

  1. public function edit(){
  2.         $this->accessPage();
  3.         $id = $_GET['id'];
  4.         $bookModel =    new BookModel;
  5.         $book      =    $bookModel->fetchOne("id={$id}");
  6.         
  7.         $this->smarty->assign("book",$book);
  8.         $this->smarty->display("Book/edit.html");
  9.     }

    //Json添加图书接口   

  1.  public function insert(){
  2.         $this->accessJson();
  3.         $bookInfo['name']       =    $_POST['name'];
  4.         $bookInfo['author']     =    $_POST['author'];
  5.         $bookInfo['press']      =    $_POST['press'];
  6.         $bookInfo['press_time']  =   $_POST['pressTime'];
  7.         $bookInfo['price']      =    $_POST['price'];
  8.         $bookInfo['ISBN']       =    $_POST['ISBN'];
  9.         $bookInfo['desc']       =    $_POST['desc'];

        //验证信息是否填写完整       

  1.  if(in_array("",$bookInfo)){
  2.             $this->sendJsonMessage("请输入完整信息",1);
  3.         }
  4.         $bookModel = new BookModel;
  5.         if($bookModel->insert($bookInfo)){
  6.             $this->sendJsonMessage("添加成功",0);
  7.         }else{
  8.             $this->sendJsonMessage("添加失败",1);
  9.         }
  10.     }

    //Json接口修改图书  

  1.   public function update(){
  2.         $this->accessJson();
  3.         
  4.         $id                      =    $_POST['id'];
  5.         $bookInfo['name']        =    $_POST['name'];
  6.         $bookInfo['author']      =    $_POST['author'];
  7.         $bookInfo['press']       =    $_POST['press'];
  8.         $bookInfo['press_time']  =    $_POST['press_time'];
  9.         $bookInfo['price']       =    $_POST['price'];
  10.         $bookInfo['ISBN']        =    $_POST['ISBN'];
  11.         $bookInfo['desc']        =    $_POST['desc'];
  12.         //验证信息是否填写完整
  13.         if(in_array("",$bookInfo)){
  14.             $this->sendJsonMessage("请输入完整信息",1);
  15.         }
  16.         $bookModel = new BookModel;
  17.         if($bookModel->update($bookInfo,"id={$id}")){
  18.             $this->sendJsonMessage("修改成功",0);
  19.         }else{
  20.             $this->sendJsonMessage("修改失败",1);
  21.         }
  22.     }

    //Json删除图书接口   

  1.  public function delete(){
  2.         $this->accessJson();
  3.         $id = $_POST['id'];
  4.         $bookModel   = new BookModel;
  5.         $borrowModel = new BorrowModel;
  6.         if($bookModel->delete("id={$id}") && $borrowModel->delete("book_id={$id}")){
  7.             $this->sendJsonMessage("删除成功",0);
  8.         }else{
  9.             $this->sendJsonMessage("删除失败",1);
  10.         }
  11.     }
  12. }

(3)用户管理

//对用户信息进行管理

  1. //获取每页用户信息
  2.         $offset = ($currentPage - 1) * $eachPerPage;
  3.         $users = $userModel->fetchAllUser($where,"LIMIT {$offset},{$eachPerPage}");        
  4.         //分页
  5.         $pager = new Pager($currentPage,$count,$eachPerPage,"?p=Admin&c=User&a=index",$parms);
  6.         $this->smarty->assign("users",$users);
  7.         $this->smarty->assign("mode",$mode);
  8.         $this->smarty->assign("pageStr",$pager->page());
  9.         $this->smarty->display("User/index.html");
  10.     }
  11.     //显示添加用户界面
  12.     public function add(){
  13.         $this->accessPage();
  14.         $this->smarty->display("User/add.html");
  15.     }
  16.     //显示管理用户界面
  17.     public function manage(){
  18.         $this->accessPage();
  19.         $id = $_GET['id'];
  20.         $userModel = new UserModel;
  21.         //获取用户信息
  22.         $userInfo  = $userModel->fetchOne("id={$id}");
  23.         
  24.         //阻止url非法传参
  25.         if(empty($userInfo)){
  26.             echo "<script>alert('该用户不存在');</script>";
  27.             die();
  28.         }
  29.         $borrowModel = new BorrowModel;
  30.         //获取用户借阅信息
  31.         $borrowInfo = $borrowModel->getBorrowInfo("borrow_list.user_id={$id}");
  32.         
  33.         $this->smarty->assign("userInfo",$userInfo);
  34.         $this->smarty->assign("borrowInfo",$borrowInfo);
  35.         $this->smarty->display("User/manage.html");
  36.     }
  37.     //Json添加用户接口
  38.     public function insert(){
  39.         $this->accessJson();
  40.         $user['id']      =  $_POST['userId'];
  41.         $user['pwd']     =  md5($_POST['password']);
  42.         $user['name']    =  $_POST['name'];
  43.         $user['class']   =  $_POST['class'];
  44.         $user['status']  =  $_POST['status'] ? 1 : 0;
  45.         $usermodel = new UserModel;
  46.         if(in_array("",$user)){
  47.             $this->sendJsonMessage("请将信息填写完整",1);
  48.         }
  49.         if($usermodel->rowCount("id={$user['id']}")){
  50.             $this->sendJsonMessage("该用户ID已存在",1);
  51.         }
  52.         if($usermodel->insert($user)){
  53.             $this->sendJsonMessage("添加用户成功",0);
  54.         }else{
  55.             $this->sendJsonMessage("添加用户失败",1);
  56.         }
  57.     }
  58.     //Json修改用户接口
  59.     public function changeInfo(){
  60.         $this->accessJson();
  61.         $id             =  $_POST['userId'];
  62.         $data['name']   =  $_POST['name'];
  63.         $data['class']  =  $_POST['class'];
  64.         if(in_array("",$data)){
  65.             $this->sendJsonMessage("请填写完整信息",1);
  66.         }
  67.         $userModel = new UserModel;
  68.         if($userModel->update($data,"id={$id}")){
  69.             $this->sendJsonMessage("修改成功",0);
  70.         }else{
  71.             $this->sendJsonMessage("修改失败",1);
  72.         }
  73.     }
  74.     //Json挂失用户接口
  75.     public function lost(){
  76.         $this->accessJson();
  77.         $id  =  $_POST['userId'];
  78.         $userModel = new UserModel;
  79.         if($userModel->update(array("status"=>0),"id={$id}")){
  80.             $this->sendJsonMessage("挂失成功",0);
  81.         }else{
  82.             $this->sendJsonMessage("挂失失败",1);
  83.         }
  84.     }
  85.     //Json启用用户接口
  86.     public function open(){
  87.         $this->accessJson();
  88.         $id  =  $_POST['userId'];
  89.         $userModel = new UserModel;
  90.         if($userModel->update(array("status"=>1),"id={$id}")){
  91.             $this->sendJsonMessage("启用成功",0);
  92.         }else{
  93.             $this->sendJsonMessage("启用失败",1);
  94.         }
  95.     }
  96.     //Json修改用户密码接口
  97.     public function changePwd(){
  98.         $this->accessJson();
  99.         if(!$_POST['pwd']){
  100.             $this->sendJsonMessage("请输入密码",1);
  101.         }
  102.         $id   = $_POST['userId'];
  103.         $pwd  = md5($_POST['pwd']);
  104.         $userModel = new UserModel;
  105.         if($userModel->update(array("pwd"=>$pwd),"id={$id}")){
  106.             $this->sendJsonMessage("修改成功",0);
  107.         }else{
  108.             $this->sendJsonMessage("修改失败",1);
  109.         }
  110.     }
  111.     //Json删除用户接口
  112.     public function delete(){
  113.         $this->accessJson();
  114.         $id  =  $_POST['userId'];
  115.         $userModel   = new UserModel;
  116.         $borrowModel = new BorrowModel;
  117.         if($userModel->delete("id={$id}") && $borrowModel->delete("user_id={$id}")){
  118.             $this->sendJsonMessage("删除成功",0);
  119.         }else{
  120.             $this->sendJsonMessage("删除失败",1);
  121.         }
  122. }

(4)借阅管理

//完成用户的结束还书工作 

  1. //Json借书和还书接口
  2.     public function manage(){
  3.         $this->accessJson();
  4.         $bookId  =  $_POST['bookId'];
  5.         $userId  =  $_POST['userId'];
  6.         $action  =  $_POST['action'];
  7.         if($userId == "" || $bookId == ""){
  8.             $this->sendJsonMessage("请填写完整信息",1);
  9.         }
  10.         $borrowModel = new BorrowModel;
  11.         if($action == "borrow"){
  12.             //借书
  13.             if($borrowModel->canBorrow($bookId,$userId)){
  14.                 $data = array(
  15.                     "book_id"     =>  $bookId,
  16.                     "user_id"     =>  $userId,
  17.                     "borrow_date" =>  date("Y-m-d"),
  18.                     "back_date"   =>  date("Y-m-d",strtotime("+2 month"))
  19.                 );
  20.                 if($borrowModel->insert($data)){
  21.                     $this->sendJsonMessage("借书成功",0);
  22.                 }else{
  23.                     $this->sendJsonMessage("借书失败",1);
  24.                 }
  25.             }else{
  26.                 $this->sendJsonMessage("信息错误或该书已借出",1);
  27.             }
  28.         }else if($action == "return"){
  29.             //还书
  30.             if($borrowModel->canReturn($bookId,$userId)){
  31.                 if($borrowModel->delete("book_id={$bookId} AND user_id={$userId}")){
  32.                     $this->sendJsonMessage("还书成功",0);
  33.                 }else{
  34.                     $this->sendJsonMessage("还书失败",1);
  35.                 }
  36.             }else{
  37.                 $this->sendJsonMessage("信息错误或该用户未借此书",1);
  38.             }
  39.         }else{
  40.             $this->sendJsonMessage("参数错误",1);
  41.         }
  42.     }
  43.     //Json续借接口
  44.     public function prolong(){
  45.         $this->accessJson();
  46.         //未传参中断
  47.         if(!isset($_POST['bookId']) || !isset($_POST['userId'])){
  48.             $this->sendJsonMessage("缺少参数",1);
  49.         }
  50.         $bookId = $_POST['bookId'];
  51.         $userId = $_POST['userId'];
  52.         $borrowModel = new BorrowModel;
  53.         $result = $borrowModel->fetchOne("book_id={$bookId} AND user_id={$userId}");
  54.         //没有借书就不能续借
  55.         if(empty($result)){
  56.             $this->sendJsonMessage("该用户没有借阅此书",1);
  57.         }
  58.         //超期不能续借
  59.         if(strtotime($result['back_date']) < time()){
  60.             $this->sendJsonMessage("超期的书不能续借",1);
  61.         }
  62.         //计算应还时间
  63.         $backTime = date("Y-m-d",strtotime("+1 month",strtotime($result['back_date'])));
  64.         $data = array("back_date"=>$backTime);
  65.         if($borrowModel->update($data,"book_id={$bookId} AND user_id={$userId}")){
  66.             $this->sendJsonMessage("续借成功",0);
  67.         }else{
  68.             $this->sendJsonMessage("续借失败",1);
  69.         }
  70.     }
  71.     //Json还书接口
  72.     public function returnBook(){
  73.         $this->accessJson();
  74.         $bookId = $_POST['bookId'];
  75.         $userId = $_POST['userId'];
  76.         $borrowModel = new BorrowModel;
  77.         if($borrowModel->canReturn($bookId,$userId)){
  78.             if($borrowModel->delete("book_id={$bookId} AND user_id={$userId}")){
  79.                 $this->sendJsonMessage("还书成功",0);
  80.             }else{
  81.                 $this->sendJsonMessage("还书失败",1);
  82.             }
  83.         }else{
  84.             $this->sendJsonMessage("信息错误或该用户未借此书",1);
  85.         }
  86. }

3.2 结果展示

总结与反思

由于本次项目相关知识课堂上已经强调过好多次,老师讲的很好,很认真,但是做项目的时间较短,本次开发的“图书管理系统”并没有完全的完成,但是经过小组学习项目制作让我了解了利用PHP开发网页的流程,并且熟悉了Eclipse这款软件的一些操作流程,并且针对于HTML和数据库的运用,以及一些框架的调用都有了很大的提高,相比于之前的web网页开发,本次项目的内容和专业性都有所提升,而且相对来说更加简单便捷

网站建设定制开发 软件系统开发定制 定制软件开发 软件开发定制 定制app开发 app开发定制 app开发定制公司 电商商城定制开发 定制小程序开发 定制开发小程序 客户管理系统开发定制 定制网站 定制开发 crm开发定制 开发公司 小程序开发定制 定制软件 收款定制开发 企业网站定制开发 定制化开发 android系统定制开发 定制小程序开发费用 定制设计 专注app软件定制开发 软件开发定制定制 知名网站建设定制 软件定制开发供应商 应用系统定制开发 软件系统定制开发 企业管理系统定制开发 系统定制开发