This commit is contained in:
manghe 2025-04-04 07:49:31 +00:00
parent 710b7e31a2
commit e85bdc0976
5 changed files with 2081 additions and 209 deletions

View File

@ -1,194 +1,200 @@
{include file="Public:header2"/} {include file="Public:header2"/}
<body> <body>
<style> <style>
.layui-table-cell { .layui-table-cell {
height: auto; height: auto;
} }
</style> </style>
<div class="layui-fluid"> <div class="layui-fluid">
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-body"> <div class="layui-card-body">
<div class="layui-btn-group"> <div class="layui-btn-group">
<button class="layui-btn layui-btn-normal layui-btn-sm" id="add-type">新增类型</button> <button class="layui-btn layui-btn-normal layui-btn-sm" id="add-type">新增类型</button>
</div>
<table id="typeTable" lay-filter="typeTable"></table>
</div> </div>
<table id="typeTable" lay-filter="typeTable"></table>
</div> </div>
</div> </div>
</div>
{include file="Public:footer"/} {include file="Public:footer"/}
<!-- 操作列模板 --> <!-- 操作列模板 -->
<script type="text/html" id="operationTpl"> <script type="text/html" id="operationTpl">
<div class="layui-btn-group"> <div class="layui-btn-group">
<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</button> <button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</button>
<button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button> <button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>
</div> </div>
</script> </script>
<!-- 开关模板 --> <!-- 开关模板 -->
<script type="text/html" id="isShowTpl"> <script type="text/html" id="isShowTpl">
<input type="checkbox" name="is_show" value="{{d.is_show}}" lay-skin="switch" lay-text="是|否" lay-filter="is_show" {{d.is_show == 1 ? 'checked' : ''}} data-id="{{d.id}}"> <input type="checkbox" name="is_show" value="{{d.is_show}}" lay-skin="switch" lay-text="是|否" lay-filter="is_show" {{d.is_show == 1 ? 'checked' : ''}} data-id="{{d.id}}">
</script> </script>
<script type="text/html" id="isFenleiTpl"> <script type="text/html" id="isFenleiTpl">
<input type="checkbox" name="is_fenlei" value="{{d.is_fenlei}}" lay-skin="switch" lay-text="是|否" lay-filter="is_fenlei" {{d.is_fenlei == 1 ? 'checked' : ''}} data-id="{{d.id}}"> <input type="checkbox" name="is_fenlei" value="{{d.is_fenlei}}" lay-skin="switch" lay-text="是|否" lay-filter="is_fenlei" {{d.is_fenlei == 1 ? 'checked' : ''}} data-id="{{d.id}}">
</script> </script>
<script> <script>
layui.use(['table', 'form', 'layer'], function() { layui.use(['table', 'form', 'layer'], function () {
var $ = layui.$; var $ = layui.$;
var form = layui.form; var form = layui.form;
var layer = layui.layer; var layer = layui.layer;
var table = layui.table; var table = layui.table;
// 渲染表格 // 渲染表格
table.render({ table.render({
elem: '#typeTable', elem: '#typeTable',
url: '{:url("goodstype/getTypeList")}', // 后端提供的数据接口 url: '{:url("goodstype/getTypeList")}', // 后端提供的数据接口
page: true, // 开启分页 page: true, // 开启分页
height: 'full-100', height: 'full-100',
limit: 15, // 每页显示的条数 limit: 20, // 每页显示的条数
limits: [15, 30, 50, 100], // 每页条数的选择项 limits: [20, 30, 50, 100], // 每页条数的选择项
cols: [[ // 表头 cols: [[ // 表头
{field: 'id', title: 'ID', width: 80, sort: true, fixed: 'left'}, { field: 'id', title: 'ID', width: 80, sort: true },
{field: 'name', title: '类型名称', width: 150}, { field: 'name', title: '类型名称', width: 150 },
{field: 'value', title: '类型Key', width: 100}, { field: 'value', title: '类型Key', width: 100 },
{field: 'sort_order', title: '排序', width: 100, sort: true}, { field: 'sort_order', title: '排序', width: 100, sort: true },
{field: 'is_show', title: '首页显示', width: 120, templet: '#isShowTpl'}, { field: 'is_show', title: '首页显示', width: 120, templet: '#isShowTpl' },
{field: 'is_fenlei', title: '分类显示', width: 120, templet: '#isFenleiTpl'}, { field: 'is_fenlei', title: '分类显示', width: 120, templet: '#isFenleiTpl' },
{field: 'fl_name', title: '分类名称', width: 150}, { field: 'fl_name', title: '分类名称', width: 150 },
{title: '支付方式', minWidth: 200, templet: function(d){ {
var html = ''; title: '支付方式', minWidth: 200, templet: function (d) {
if(d.pay_wechat == 1) html += '<span class="layui-badge layui-bg-green">微信</span> '; var html = '';
if(d.pay_balance == 1) html += '<span class="layui-badge layui-bg-blue">余额</span> '; if (d.pay_wechat == 1) html += '<span class="layui-badge layui-bg-green">微信</span> ';
if(d.pay_currency == 1) html += '<span class="layui-badge layui-bg-orange">货币</span> '; if (d.pay_balance == 1) html += '<span class="layui-badge layui-bg-blue">余额</span> ';
if(d.pay_currency2 == 1) html += '<span class="layui-badge layui-bg-cyan">货币2</span> '; if (d.pay_currency == 1) html += '<span class="layui-badge layui-bg-orange">货币</span> ';
if(d.pay_coupon == 1) html += '<span class="layui-badge layui-bg-red">优惠券</span> '; if (d.pay_currency2 == 1) html += '<span class="layui-badge layui-bg-cyan">货币2</span> ';
return html; if (d.pay_coupon == 1) html += '<span class="layui-badge layui-bg-red">优惠券</span> ';
}}, return html;
{title: '支付类型', width: 100, templet: function(d){ }
if(d.is_deduction == 1) { },
return '<span class="layui-badge layui-bg-blue">抵扣</span>'; {
} else { title: '支付类型', width: 100, templet: function (d) {
return '<span class="layui-badge layui-bg-orange">支付</span>'; if (d.is_deduction == 1) {
} return '<span class="layui-badge layui-bg-blue">抵扣</span>';
}}, } else {
{field: 'remark', title: '备注', width: 200}, return '<span class="layui-badge layui-bg-orange">支付</span>';
{fixed: 'right', title: '操作', toolbar: '#operationTpl', width: 150} }
]], }
response: { },
statusCode: 1 // 重新规定成功的状态码默认0 { field: 'remark', title: '备注', width: 200 },
}, { fixed: 'right', title: '操作', toolbar: '#operationTpl', width: 150 }
parseData: function(res) { // 将原始数据解析成 table 组件所规定的数据 ]],
return { response: {
"code": res.status, // 解析接口状态 statusCode: 1 // 重新规定成功的状态码默认0
"msg": res.msg, // 解析提示文本 },
"count": res.data.count, // 解析数据长度 parseData: function (res) { // 将原始数据解析成 table 组件所规定的数据
"data": res.data.list // 解析数据列表 return {
}; "code": res.status, // 解析接口状态
} "msg": res.msg, // 解析提示文本
}); "count": res.data.count, // 解析数据长度
"data": res.data.list // 解析数据列表
// 监听工具条事件 };
table.on('tool(typeTable)', function(obj) { }
var data = obj.data; // 获得当前行数据 });
var layEvent = obj.event; // 获得 lay-event 对应的值
// 监听工具条事件
if (layEvent === 'edit') { // 编辑 table.on('tool(typeTable)', function (obj) {
var data = obj.data; // 获得当前行数据
var layEvent = obj.event; // 获得 lay-event 对应的值
if (layEvent === 'edit') { // 编辑
layer.open({
type: 2,
title: '编辑盒子类型',
area: ['80%', '85%'],
fixed: false,
maxmin: true,
content: '{:url("goodstype/edit")}?id=' + data.id,
end: function () {
// 弹窗关闭后刷新表格
table.reload('typeTable');
}
});
} else if (layEvent === 'del') { // 删除
layer.confirm('确定要删除此盒子类型吗?', function (index) {
$.ajax({
url: '{:url("goodstype/delete")}',
type: 'post',
data: { id: data.id },
success: function (res) {
if (res.status) {
layer.msg(res.msg, { icon: 1, time: 1000 });
// 删除成功后刷新表格
table.reload('typeTable');
} else {
layer.msg(res.msg, { icon: 2, time: 1500 });
}
}
});
layer.close(index);
});
}
});
// 新增类型
$('#add-type').on('click', function () {
layer.open({ layer.open({
type: 2, type: 2,
title: '编辑盒子类型', title: '添加盒子类型',
area: ['80%', '85%'], area: ['80%', '85%'],
fixed: false, fixed: false,
maxmin: true, maxmin: true,
content: '{:url("goodstype/edit")}?id=' + data.id, content: '{:url("goodstype/add")}',
end: function() { end: function () {
// 弹窗关闭后刷新表格 // 弹窗关闭后刷新表格
table.reload('typeTable'); table.reload('typeTable');
} }
}); });
} else if (layEvent === 'del') { // 删除 });
layer.confirm('确定要删除此盒子类型吗?', function(index) {
$.ajax({ // 监听首页显示开关
url: '{:url("goodstype/delete")}', form.on('switch(is_show)', function (obj) {
type: 'post', var id = $(this).data('id');
data: {id: data.id}, var value = obj.elem.checked ? 1 : 0;
success: function(res) {
if (res.status) { $.ajax({
layer.msg(res.msg, {icon: 1, time: 1000}); url: '{:url("goodstype/status")}',
// 删除成功后刷新表格 type: 'post',
table.reload('typeTable'); data: { id: id, type: 'is_show', value: value },
} else { success: function (res) {
layer.msg(res.msg, {icon: 2, time: 1500}); if (res.status) {
} layer.msg(res.msg, { icon: 1, time: 1000 });
} else {
layer.msg(res.msg, { icon: 2, time: 1500 }, function () {
obj.elem.checked = !obj.elem.checked;
form.render();
});
} }
}); }
layer.close(index);
}); });
}
});
// 新增类型
$('#add-type').on('click', function() {
layer.open({
type: 2,
title: '添加盒子类型',
area: ['80%', '85%'],
fixed: false,
maxmin: true,
content: '{:url("goodstype/add")}',
end: function() {
// 弹窗关闭后刷新表格
table.reload('typeTable');
}
}); });
});
// 监听分类显示开关
// 监听首页显示开关 form.on('switch(is_fenlei)', function (obj) {
form.on('switch(is_show)', function(obj) { var id = $(this).data('id');
var id = $(this).data('id'); var value = obj.elem.checked ? 1 : 0;
var value = obj.elem.checked ? 1 : 0;
$.ajax({
$.ajax({ url: '{:url("goodstype/status")}',
url: '{:url("goodstype/status")}', type: 'post',
type: 'post', data: { id: id, type: 'is_fenlei', value: value },
data: {id: id, type: 'is_show', value: value}, success: function (res) {
success: function(res) { if (res.status) {
if (res.status) { layer.msg(res.msg, { icon: 1, time: 1000 });
layer.msg(res.msg, {icon: 1, time: 1000}); } else {
} else { layer.msg(res.msg, { icon: 2, time: 1500 }, function () {
layer.msg(res.msg, {icon: 2, time: 1500}, function() { obj.elem.checked = !obj.elem.checked;
obj.elem.checked = !obj.elem.checked; form.render();
form.render(); });
}); }
} }
} });
}); });
}); });
</script>
// 监听分类显示开关
form.on('switch(is_fenlei)', function(obj) {
var id = $(this).data('id');
var value = obj.elem.checked ? 1 : 0;
$.ajax({
url: '{:url("goodstype/status")}',
type: 'post',
data: {id: id, type: 'is_fenlei', value: value},
success: function(res) {
if (res.status) {
layer.msg(res.msg, {icon: 1, time: 1000});
} else {
layer.msg(res.msg, {icon: 2, time: 1500}, function() {
obj.elem.checked = !obj.elem.checked;
form.render();
});
}
}
});
});
});
</script>
</body> </body>
</html>
</html>

View File

@ -430,8 +430,8 @@ class Infinite extends Base
$iszhifu = 0; $iszhifu = 0;
# 余额抵扣 # 余额抵扣
if ($use_money_is == 1 && $goodsType['pay_balance'] == 1) { if ($use_money_is == 1 && $goodsType['pay_balance'] == 1) {
if ($goodsType['is_deduction'] == 1) { if ($goodsType['is_deduction'] == 1) {
# 抵扣模式 # 抵扣模式
if ($user['money'] >= $price) { if ($user['money'] >= $price) {
@ -481,7 +481,7 @@ class Infinite extends Base
} }
} }
# 货币2抵扣 # 货币2抵扣
if ($use_money2_is == 1 && $goodsType['pay_currency2'] == 1) { if ($use_money2_is == 1 && $goodsType['pay_currency2'] == 1) {
@ -847,6 +847,9 @@ class Infinite extends Base
if ($price > 0) { if ($price > 0) {
$body = '购买盒子' . $goods['title']; $body = '购买盒子' . $goods['title'];
$attach = 'order_wxs'; $attach = 'order_wxs';
if ($goods['type'] == 16) {
$attach = 'order_fbs';
}
$payRes = (new Pay())->wxCreateOrder($order_num, $price, $user['openid'], $body, $attach); $payRes = (new Pay())->wxCreateOrder($order_num, $price, $user['openid'], $body, $attach);
if ($payRes['status'] == 1) { if ($payRes['status'] == 1) {
#结果集 #结果集

View File

@ -295,7 +295,7 @@ class Notify extends Base
$tempOrder->save(); $tempOrder->save();
} }
} }
} elseif ($table == 'order_wxs') {#抽赏无限赏 } elseif ($table == 'order_wxs' || $table == 'order_fbs') {#抽赏无限赏
$orderInfo = Order::where('order_num', '=', $out_trade_no) $orderInfo = Order::where('order_num', '=', $out_trade_no)
->where('status', '=', 0) ->where('status', '=', 0)
->find(); ->find();
@ -1076,7 +1076,7 @@ class Notify extends Base
#分销奖励 #分销奖励
#开奖================================================== #开奖==================================================
if ($num == 1) { if ($order['order_type'] == 10) {
$res[] = $this->infinite_shangchengshang($order); $res[] = $this->infinite_shangchengshang($order);
} else { } else {
$res[] = $this->infinite_drawprize($order); $res[] = $this->infinite_drawprize($order);

View File

@ -1,45 +0,0 @@
-- 创建奖励表
CREATE TABLE IF NOT EXISTS `reward` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`reward_type` tinyint(1) NOT NULL COMMENT '奖励类型(1:优惠券,2:钻石,3:货币1,4:货币2)',
`reward_id` int(11) DEFAULT NULL COMMENT '奖励ID(当reward_type=1时为优惠券ID)',
`reward_value` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '奖励值',
`title` varchar(100) DEFAULT NULL COMMENT '奖励标题',
`description` varchar(255) DEFAULT NULL COMMENT '奖励描述',
`icon` varchar(255) DEFAULT NULL COMMENT '奖励图标',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态(0禁用,1启用)',
`create_time` int(11) DEFAULT NULL,
`update_time` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='奖励表';
-- 创建签到配置表
CREATE TABLE IF NOT EXISTS `sign_config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` tinyint(1) NOT NULL COMMENT '配置类型(1:累计签到配置,2:每日签到配置)',
`days` int(11) DEFAULT NULL COMMENT '累计天数(type=1时有效)',
`day` tinyint(1) DEFAULT NULL COMMENT '指定星期几(type=2时有效1-7代表周一到周日)',
`title` varchar(100) DEFAULT NULL COMMENT '配置标题',
`icon` varchar(255) DEFAULT NULL COMMENT '图标',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态(0禁用,1启用)',
`sort` int(11) DEFAULT '0' COMMENT '排序',
`create_time` int(11) DEFAULT NULL,
`update_time` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='签到配置表';
-- 创建签到配置奖励关联表
CREATE TABLE IF NOT EXISTS `sign_config_reward` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`sign_config_id` int(11) NOT NULL COMMENT '签到配置ID',
`reward_id` int(11) NOT NULL COMMENT '奖励ID',
`create_time` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_sign_config_id` (`sign_config_id`),
KEY `idx_reward_id` (`reward_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='签到配置奖励关联表';
-- 修改用户签到表添加month和year字段
ALTER TABLE `user_sign`
ADD COLUMN `month` int(11) DEFAULT NULL COMMENT '签到月份' AFTER `days`,
ADD COLUMN `year` int(11) DEFAULT NULL COMMENT '签到年份' AFTER `month`;

1908
table.sql Normal file

File diff suppressed because it is too large Load Diff