大家好!我是程序员一帆,感谢您阅读本文,欢迎一键三连哦。
💞当前专栏:微信小程序毕业设计
精彩专栏推荐👇🏻👇🏻👇🏻
开发环境
①前端:微信小程序开发工具
② 后端:php
演示视频
前端:
weixin056基于微信小程序的购物系统-微信端
后端:
weixin056基于微信小程序的购物系统-服务端
原版高清演示视频-编号:056
https://pan.quark.cn/s/c0c9519df9d4
源码下载地址:
https://download.csdn.net/download/2301_76953549/89089725
LW目录
【如需全文请按文末获取联系】
目录
一、项目简介
本基于微信小程序的购物系统有管理员和用户。管理员功能有个人中心,用户管理,商品信息管理,商品分类管理,通知公告管理,购物资讯管理,资讯分类管理,留言板管理,系统管理,订单管理。用户可以注册登录,查看和购买商品,生成订单,进行评价等操作。因而具有一定的实用性。
本站后台采用Think PHP框架进行后台管理开发,可以在浏览器上登录进行后台数据方面的管理,MySQL作为本地数据库,微信小程序用到了微信开发者工具,充分保证系统的稳定性。系统具有界面清晰、操作简单,功能齐全的特点,使得基于微信小程序的购物系统管理工作系统化、规范化。
二、系统设计
2.1软件功能模块设计
设计的功能结构图如下图所示:
2.2数据库设计
(1)管理员信息的实体属性图如下:
(2)留言板实体属性图如图4.13所示:
(3)商品分类信息实体属性图如图4.14所示:
三、系统项目部分截图
3.1后台模块的实现
用户信息管理
管理员可以管理用户信息,可以对用户信息添加修改删除。具体界面的展示如图5.1所示。
3.2商品信息管理
管理员可以对商品信息进行添加修改删除操作。具体界面如图5.2所示。
订单信息管理
管理员可以对各种状态的订单信息进行管理,可以对订单信息发货操作。界面如下图所示:
3.3小程序会员模块的实现
系统首页
小程序用户是需要注册才可以进行登录的,登录后在首页可以查看相关信息,并且下面导航可以点击到其他功能模块。界面如下图所示:
我的菜单
在小程序里点击我的,会出现关于我的界面,在这里可以修改个人信息,以及可以点击其他功能模块。界面如下图所示:
商品信息
用户可以对商品信息进行收藏,点赞,购买,评论等操作。界面如下图所示:
四、部分核心代码
4.1 用户部分
<?php
session_start();
class GouwuzixunController 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'
,'zixunmingcheng'
,'zixunleixing'
,'laiyuan'
,'zixunneirong'
,'faburiqi'
,'fengmiantupian'
];
/**
* 分页,列表
* 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'];
$where = " where 1 ";//查询条件
$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";
foreach ($_REQUEST as $k => $val){
if(in_array($k, $this->columData)){
if ($val != ''){
$where.= " and ".$k." like '".$val."'";
}
}
}
$sql = "select * from `gouwuzixun` ".$where;
$count = table_sql($sql);
if ($count->num_rows < 1){
$numberCount = 0;
}else{
$numberCount = $count->num_rows;
}
$page_count = ceil($numberCount/$limt);//页数
$startCount = ($page-1)*$limt;
$lists = "select * from `gouwuzixun` ".$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" => $numberCount,
"pageSize" => $limt,
"totalPage" => $page_count,
"currPage" => $page,
"list" => $arrayData
]
]));
}
/**
* 分页,列表list
* get
*/
public function lists(){
$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";
$refid = isset($_REQUEST['refid']) ? $_REQUEST['refid'] : "0";
$where = " where 1 ";//查询条件
foreach ($_REQUEST as $k => $val){
if(in_array($k, $this->columData)){
$where.= " and ".$k." like '".$val."'";
}
}
$sql = "select * from `gouwuzixun`".$where;
$count = table_sql($sql);
if ($count->num_rows < 1){
$numberCount = 0;
}else{
$numberCount = $count->num_rows;
}
$page_count = ceil($numberCount/$limt);//页数
$startCount = ($page-1)*$limt;
$lists = "select * from `gouwuzixun` ".$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" => $numberCount,
"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'=>"你还没有登录。"]));
$uid = $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)){
if(!empty($value) || $value == 0) {
if ($key == 'id') {
continue;
}
array_push($keyArr,"`".$key."`");
if($key == 'clicktime') {
array_push($valArr,"'".date('Y-m-d h:i:s', time())."'");
} else {
array_push($valArr,"'".$value."'");
}
}
}
}
}
$k = implode(',',$keyArr);
$v = implode(',',$valArr);
$sql = "INSERT INTO `gouwuzixun` (".$k.") VALUES (".$v.")";
$result = table_sql($sql);
exit(json_encode(['code'=>0]));
}
/**
* 新增数据接口 add
* post
*/
public function add(){
$keyArr = $valArr = array();
$tmpData = strval(file_get_contents("php://input"));
if (!empty($tmpData)&& isset($tmpData)){
$postData = json_decode($tmpData,true);
foreach ($postData as $key => $value){
if (in_array($key, $this->columData)){
if(!empty($value) || $value == 0) {
if ($key == 'id') {
continue;
}
array_push($keyArr,"`".$key."`");
if($key == 'clicktime') {
array_push($valArr,"'".date('Y-m-d h:i:s', time())."'");
} else {
array_push($valArr,"'".$value."'");
}
}
}
}
}
$k = implode(',',$keyArr);
$v = implode(',',$valArr);
$sql = "INSERT INTO `gouwuzixun` (".$k.") VALUES (".$v.")";
$result = table_sql($sql);
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)){
if ($key == "id"){
$id = $value;
}
if(!empty($value) || $value === 0) {
array_push($v,$key." = '".$value."'");
}
}
}
$value = implode(',',$v);
$sql = "UPDATE gouwuzixun SET ".$value." where id = ".$id;
$result = table_sql($sql);
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 gouwuzixun WHERE id in({$str})";
$result = table_sql($sql);
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 `gouwuzixun` where ".$where;
$result = table_sql($sql);
if ($result->num_rows > 0) {
// 输出数据
while($row = $result->fetch_assoc()) {
$lists = $row;
}
}
exit(json_encode([
'code'=>0,
'data'=> $lists
]));
}
/**
* 查询一条数据
* get
*/
public function detail($id=false){
$name = isset($_REQUEST['name'])? $_REQUEST['name']:"";
if ($id){
$where = "`id` = ".$id;
}else{
$where = "`name` = ".$name;
}
$sql = "select * from `gouwuzixun` 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
]));
}
/**
* 获取需要提醒的记录数接口
* get
*/
public function remind($columnName,$type){
$remindStart = isset($_GET['remindstart'])?$_GET['remindstart']:"";
$remindEnd = isset($_GET['remindend'])?$_GET['remindend']:"";
$where = '';
if ($type == 1){//数字
if ($remindStart && $remindEnd){
$where .= " and ".$columnName."<='".$remindEnd."' and ".$columnName.">='".$remindStart."'";
}elseif($remindStart){
$where .= " and ".$columnName.">='".$remindStart."'";
}elseif($remindEnd){
$where .= " and ".$columnName."<='".$remindEnd."'";
}
}else{
if ($remindStart && $remindEnd){
$where .= " and ".$columnName."<='".date("Y-m-d",strtotime("+".$remindEnd." day"))."' and ".$columnName.">='".date("Y-m-d",strtotime("+".$remindStart." day"))."'";
}elseif($remindStart){
$where .= " and ".$columnName.">='".date("Y-m-d",strtotime("+".$remindStart." day"))."'";
}elseif($remindEnd){
$where .= " and ".$columnName."<='".date("Y-m-d",strtotime("+".$remindEnd." day"))."'";
}
}
$sql = "select * from `gouwuzixun` where 1 ".$where;
$result = table_sql($sql);
exit(json_encode(['code'=> 0 ,'count' => $result->num_rows]));
}
}
获取源码或论文
如需对应的LW或源码,以及其他定制需求,也可以点我头像查看个人简介联系。