🍅文末获取联系🍅
IT实战营是一个专注项目实战的培训机构,多名老师是csdn、51CTO的签约讲师,致力于为学生提供高质量的项目辅导。主要业务方向为Java,Python,小程序,微服务,爬虫,大数据,PHP,NodeJS,asp.net,app等项目辅导,答疑,远程安装运行!
目录
一、项介绍
大学本科专科计算机毕设项目毕业设计源码论文定制php基于web的书店网站的设计与实现_哔哩哔哩_bilibili大学本科专科计算机毕设项目毕业设计源码论文定制php基于web的书店网站的设计与实现共计2条视频,包括:H25 775-php基于web的书店网站的设计与实现、毕业论文书写-网站-IT实战课堂等,UP主更多精彩视频,请关注UP账号。https://www.bilibili.com/video/BV1zh4y1N7xH?share_source=copy_web 该项目含有源码、文档、PPT、配套开发软件、软件安装教程、项目发布教程、包运行成功以及课程答疑与微信售后交流群、送查重系统不限次数免费查重等福利!
软件开发环境及开发工具:
操作系统:Windows 10、Windows 7、Windows 8
开发语言:php
前端技术:JavaScript、VUE.js(2.X)、css3
开发工具:phpstorm、Visual Studio Code/HbuildX
数据库:MySQL 5.7.26(版本号)
数据库管理工具:phpstudy/Navicat
PHP版本:php7.1.9nts
服务器:Nginx1.15.11
下面是资料信息截图:
二、项目相关截图
功能介绍:
快速发展的社会中,人们的生活水平都在提高,生活节奏也在逐渐加快。为了节省时间和提高工作效率,越来越多的人选择利用互联网进行线上打理各种事务,通过线上管理书店也就相继涌现。与此同时,人们开始接受方便的生活方式。他们不仅希望页面简单大方,还希望操作方便,可以快速锁定他们需要的书店管理方式。基于这种情况,我们需要这样一个界面简单大方、功能齐全的系统来解决用户问题,满足用户需求。
课题主要分为两大模块:即管理员模块和用户模块,主要功能包括:系统首页,个人中心,用户管理,图书分类管理,图书信息管理,图书借阅管理,还书登记管理,购买订单管理,图书捐赠管理,书店餐饮管理,订餐订单管理,系统管理等;
下面是系统运行起来后的一些截图:
三、相关代码
<?php
session_start();
class UsersController extends CommonController {
public function __construct()
{
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE");
header('Access-Control-Allow-Headers:Origin,Content-Type,Accept,token,X-Requested-With,device');
}
public $columData = [
'id','addtime','username','password','role'
];
/**
* 登录接口
* POST
* */
public function login(){
$username = isset($_REQUEST['username'])?$_REQUEST['username']:"";
$password = isset($_REQUEST['password'])?$_REQUEST['password']:"";
$sql = "select * from `users` where username = '".$username."' and password = '".$password."'";
$result = table_sql($sql);
if ($result->num_rows > 0) {
// 输出数据
while($row = $result->fetch_assoc()) {
$token_array = [
"iat" => time(), //签发时间
"exp" => time()+7200, //token 过期时间
'tablename'=> 'users',//表名
'isAdmin' => 1,
'id' => $row["id"],
"success" => $row,//记录的uid的信息,如果有其它信息,可以再添加数组的键值对
];
$tokens = base64_encode(json_encode($token_array));
$data = ['code' => 0, 'token' => $tokens];
exit(json_encode($data));
}
} else {
exit(json_encode(['code'=>500,'msg'=>"账号或密码错误"]));
}
}
/**
* 退出
* post
*/
public function logout(){
$token = $this->token();
unset($token);
exit(json_encode(['code'=>0,'msg'=>'退出成功']));
}
/**
* 获取session
*/
public function session(){
$token = $this->token();
$data = json_decode(base64_decode($token),true);
$arrayData = $data['success'];
exit(json_encode(['code'=>0,'data'=>$arrayData]));
}
/**
* 找回密码 重置为123456
**/
public function resetPass(){
$username = input('post.username');
$counts = "select * from `users` where username = '".$username."'";
$cotte = table_sql($counts);
if($cotte->num_rows<1){
exit(json_encode(['code'=>500,'msg'=>"用户名错误。"]));
}
$sql = "update users set password = '123456' where username = '".$username."'";
$result = table_sql($sql);
if($result) exit(json_encode(['code'=>500,'msg'=>"重置密码错误。"]));
exit(json_encode(['code'=>0,'msg'=>"密码已重置为:123456"]));
}
/**
* 分页,列表
* get
*/
public function page(){
$token = $this->token();
$tokens = json_decode(base64_decode($token),true);
if (!isset($tokens['id']) || empty($tokens['id'])) exit(json_encode(['code'=>403,'msg'=>"你还没有登录。"]));
$userid = $tokens['id'];
$page = isset($_REQUEST['page'])?$_REQUEST['page']:"1";
$limt = isset($_REQUEST['limit'])?$_REQUEST['limit']:"10";
$sort = isset($_REQUEST['sort'])?$_REQUEST['sort']:"id";
$order = isset($_REQUEST['order'])?$_REQUEST['order']:"asc";
$where = "";//查询条件
$sql = "select * from `users`".$where;
$count = table_sql($sql);
if ($count->num_rows < 1){
$numberCount = 1;
}else{
$numberCount = $count->num_rows;
}
$page_count = ceil($numberCount/$limt);//页数
$startCount = ($page-1)*10;
$lists = "select * from `users` ".$where." order by ".$sort." ".$order." limit ".$startCount.",".$limt;
$result = table_sql($lists);
$arrayData = array();
if ($result->num_rows > 0) {
while ($datas = $result->fetch_assoc()){
array_push($arrayData,$datas);
}
}
exit(json_encode([
'code'=>0,
'data' => [
"total" => $count,
"pageSize" => $limt,
"totalPage" => $page_count,
"currPage" => $page,
"list" => $arrayData
]
]));
}
/**
* 新增数据接口
* post
*/
public function save(){
$token = $this->token();
$tokens = json_decode(base64_decode($token),true);
if (!isset($tokens['id']) || empty($tokens['id'])) exit(json_encode(['code'=>403,'msg'=>"你还没有登录。"]));
$userid = $tokens['id'];
$keyArr = $valArr = array();
$tmpData = strval(file_get_contents("php://input"));//Content-Type: application/json 需要用到php://input 处理输入流
if (!empty($tmpData)&& isset($tmpData)){
$postData = json_decode($tmpData,true);
foreach ($postData as $key => $value){
if (in_array($key, $this->columData)){
array_push($keyArr,"`".$key."`");
array_push($valArr,"'".$value."'");
}
}
}
$k = implode(',',$keyArr);
$v = implode(',',$valArr);
$sql = "INSERT INTO `users` (".$k.") VALUES (".$v.")";
$result = table_sql($sql);
if (!$result) exit(json_encode(['code'=>500,'msg'=>"新增失败"]));
exit(json_encode(['code'=>0]));
}
/**
* 更新接口
* post
*/
public function update(){
$tmpData = strval(file_get_contents("php://input"));
$postData = json_decode($tmpData,true);
$v = array();
foreach ($postData as $key => $value){
if (in_array($key, $this->columData) && $key != 'id'){
array_push($v,$key." = '".$value."'");
}
}
$value = implode(',',$v);
$sql = "UPDATE users SET ".$value." where id=".$postData['id'];;
$result = table_sql($sql);
if (!$result) exit(json_encode(['code'=>500,'msg'=>"修改失败"]));
exit(json_encode(['code'=>0]));
}
/**
* 删除
* post
*/
public function delete(){
$ids = strval(file_get_contents("php://input"));//发现接收的是字符串
preg_match_all('/\d+/',$ids,$arr);
$str = implode(',',$arr[0]);//拼接字符,
$sql = "delete from users WHERE id in({$str})";
$result = table_sql($sql);
if (!$result) exit(json_encode(['code'=>500,'msg'=>"删除失败。"]));
exit(json_encode(['code'=>0]));
}
/**
* 查询一条数据
* get
*/
public function info($id=false){
$token = $this->token();
$tokens = json_decode(base64_decode($token),true);
if (!isset($tokens['id']) || empty($tokens['id'])) exit(json_encode(['code'=>403,'msg'=>"你还没有登录。"]));
$userid = $tokens['id'];
$name = isset($_REQUEST['name'])? $_REQUEST['name']:"";
if (!empty($id)){
$where = "`id` = ".$id;
}else{
$where = "`name` = ".$name;
}
$sql = "select * from `users` where ".$where;
$result = table_sql($sql);
if (!$result) exit(json_encode(['code'=>500,'msg'=>"查询数据发生错误。"]));
if ($result->num_rows > 0) {
// 输出数据
while($row = $result->fetch_assoc()) {
$lists = $row;
}
}
exit(json_encode([
'code'=>0,
'data'=> $lists
]));
}
}
四、源码获取
大家点赞、收藏、关注、评论啦 、查看👇🏻👇🏻👇🏻获取联系方式👇🏻👇🏻👇🏻