提交方法

This commit is contained in:
youda 2025-04-10 02:46:53 +08:00
parent 66aeebd7dd
commit 3ff1553356
96 changed files with 3746 additions and 5762 deletions

0
.cursor/rules/mhbase.mdc Normal file → Executable file
View File

10
.env
View File

@ -1,4 +1,4 @@
APP_DEBUG = true
APP_DEBUG = false
[APP]
DEFAULT_TIMEZONE = Asia/Shanghai
@ -6,12 +6,12 @@ DEFAULT_TIMEZONE = Asia/Shanghai
[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
DATABASE = xinglanmh_shequt
USERNAME = xinglanmh_shequt
PASSWORD = t3aihzA23RcB6RT8
DATABASE = youda_test
USERNAME = youda_test
PASSWORD = youda_test
HOSTPORT = 3306
CHARSET = utf8
DEBUG = true
DEBUG = false
[LANG]
default_lang = zh-cn

0
README_AUTO_OFFSHELF.md Normal file → Executable file
View File

0
app/admin/controller/AdvertType.php Normal file → Executable file
View File

View File

@ -22,11 +22,36 @@ class Base extends MyController
public $admin_id = 0;
public $config = [];
/**
* 访问白名单,无需验证登录
* @var array
*/
protected $whiteList = [
// 格式:'控制器/方法' => true
// 例如:'login/index' => true,
'goods/sync_goods' => true,
];
/**
* 后台初始化
*/
public function initialize()
{
// 获取当前控制器和方法
$controller = strtolower(request()->controller());
$action = strtolower(request()->action());
$currentRoute = $controller . '/' . $action;
// 检查是否在白名单中
if (isset($this->whiteList[$currentRoute]) && $this->whiteList[$currentRoute] === true) {
// 在白名单中,跳过登录验证
$this->config = getConfig('base');
View::assign("config", $this->config);
return;
}
// 不在白名单中,进行登录验证
if (!session('admin_id') || !session('admin_token')) {
echo "<script>location.href='/admin/login'</script>";
die;

View File

@ -52,6 +52,18 @@ class Goods extends Base
$list = $query->page($page, $limit)->select()->toArray();
// 获取盒子ID集合
$goodsIds = array_column($list, 'id');
// 获取盒子扩展信息
$goodsExtendList = [];
if (!empty($goodsIds)) {
$goodsExtends = \app\common\model\GoodsExtend::whereIn('goods_id', $goodsIds)->select()->toArray();
foreach ($goodsExtends as $extend) {
$goodsExtendList[$extend['goods_id']] = $extend;
}
}
// 处理图片路径
foreach ($list as &$item) {
$item['imgurl'] = imageUrl($item['imgurl']);
@ -60,6 +72,14 @@ class Goods extends Base
}
// 添加格式化时间
$item['addtime_text'] = date('Y-m-d H:i', $item['addtime']);
// 添加扩展信息
$item['goods_extend'] = isset($goodsExtendList[$item['id']]) ? $goodsExtendList[$item['id']] : null;
// 修改时间处理
if(isset($item['update_time']) && $item['update_time']){
$item['update_time_text'] = date('Y-m-d H:i', $item['update_time']);
}
}
return $this->renderTable('获取成功', $count, $list);
@ -72,7 +92,7 @@ class Goods extends Base
{
// 查询可用的盒子类型
$goodsTypeList = Db::name('goods_type')
->field('value,sort_order,remark,is_fenlei,fl_name')
->field('value,sort_order,remark,is_fenlei,fl_name,pay_wechat,pay_balance,pay_currency,pay_currency2,pay_coupon,is_deduction')
->where('is_fenlei', 1)
->order('sort_order')
->select()
@ -142,7 +162,7 @@ class Goods extends Base
}
$data['prize_num'] = 0;
$data['category_id'] = 0;
} elseif ($data['type'] == 2 || $data['type'] == 16) {
} elseif ($data['type'] == 2 || $data['type'] == 16 || $data['type'] == 17) {
$data['stock'] = 0;
$data['lock_is'] = 0;
$data['lock_time'] = 0;
@ -390,7 +410,7 @@ class Goods extends Base
}
$data['prize_num'] = 0;
$data['category_id'] = 0;
} elseif ($type == 2 || $type == 16) {
} elseif ($type == 2 || $type == 16 || $type == 17) {
$data['stock'] = 0;
$data['lock_is'] = 0;
$data['lock_time'] = 0;
@ -642,7 +662,7 @@ class Goods extends Base
if ($type == 1 || $type == 3 || $type == 5 || $type == 6 || $type == 10 || $type == 11) {
$where[] = ['num', '=', 1];
} elseif ($type == 2 || $type == 8 || $type == 9 || $type == 15 || $type == 16) {
} elseif ($type == 2 || $type == 8 || $type == 9 || $type == 15 || $type == 16 || $type == 17) {
$where[] = ['num', '=', 0];
} else {
return $this->renderError('请求参数错误1');
@ -687,7 +707,7 @@ class Goods extends Base
}
$real_pro1 += $goods_list_item['real_pro'];
}
if ($type == 2 || $type == 8 || $type == 9 || $type == 15 || $type == 16) {
if ($type == 2 || $type == 8 || $type == 9 || $type == 15 || $type == 16 || $type == 17) {
$goods_list[] = ['title' => '宝箱概率合计', 'real_pro' => $real_pro1, 'id' => -1];
}
$item['children'] = $goods_list;
@ -715,7 +735,7 @@ class Goods extends Base
if( $goods_list_id){
$shang = Shang::where('id', '<=', 33)->where('id', '>', 5)->select()->toArray();
}
} elseif ($info['type'] == 2 || $info['type'] == 8 || $info['type'] == 9 || $info['type'] == 16) {
} elseif ($info['type'] == 2 || $info['type'] == 8 || $info['type'] == 9 || $info['type'] == 16 || $info['type'] == 17 ) {
$shang = Shang::where('id', 'between', [34, 38])->select()->toArray();
} elseif ($info['type'] == 3) {
$shang = Shang::where('id', 'between', [4, 33])->select()->toArray();
@ -833,7 +853,13 @@ class Goods extends Base
if (RegInt($data['stock'])) {
return $this->renderError('奖品数量设置错误,请设置大于0的整数');
}
} else {
} elseif ($type == 17) {
$prize_code = getPrizeCode() . '_' . time();
$data['prize_code'] = $prize_code;
$data['surplus_stock'] = $data['stock'];
}
else {
return $this->err('请求参数错误');
}
if (RegZero($data['sort'])) {
@ -887,7 +913,7 @@ class Goods extends Base
if( $goods_list_id){
$shang = Shang::where('id', '<=', 33)->where('id', '>', 5)->select()->toArray();
}
} elseif ($info['type'] == 2 || $info['type'] == 8 || $info['type'] == 9 || $info['type'] == 16) {
} elseif ($info['type'] == 2 || $info['type'] == 8 || $info['type'] == 9 || $info['type'] == 16 || $info['type'] == 17 ) {
$shang = Shang::where('id', 'between', [34, 38])->select()->toArray();
} elseif ($info['type'] == 15) {
$shang = Shang::where('id', '>=', 114)->select()->toArray();
@ -955,7 +981,7 @@ class Goods extends Base
if ($type == 1 || $type == 5 || $type == 10 || $type == 6 || $type == 11 || $type == 15) {
} elseif ($type == 2 || $type == 8 || $type == 9 || $type == 16) {
} elseif ($type == 2 || $type == 8 || $type == 9 || $type == 16 || $type == 17) {
if (RegMoney($data['real_pro'] * 10000)) {
return $this->renderError('真实概率设置错误,最多保留四位小数');
}
@ -1667,4 +1693,180 @@ class Goods extends Base
}
}
/**
* 盒子扩展设置
*/
public function goods_extend(Request $request)
{
$goods_id = $request->param('goods_id/d');
if (!$goods_id) {
return $this->renderError("参数错误");
}
// 获取盒子信息
$goods = GoodsModel::where('id', $goods_id)->find();
if (!$goods) {
return $this->renderError("盒子不存在");
}
if ($request->isPost()) {
$data = $request->post();
// 验证参数
$data['goods_id'] = $goods_id;
$data['pay_wechat'] = isset($data['pay_wechat']) ? 1 : 0;
$data['pay_balance'] = isset($data['pay_balance']) ? 1 : 0;
$data['pay_currency'] = isset($data['pay_currency']) ? 1 : 0;
$data['pay_currency2'] = isset($data['pay_currency2']) ? 1 : 0;
$data['pay_coupon'] = isset($data['pay_coupon']) ? 1 : 0;
$data['is_deduction'] = isset($data['is_deduction']) ? 1 : 0;
// 查询是否已存在
$exist = \app\common\model\GoodsExtend::getByGoodsId($goods_id);
Db::startTrans();
try {
if ($exist) {
// 更新
\app\common\model\GoodsExtend::where('goods_id', $goods_id)->update($data);
} else {
// 新增
\app\common\model\GoodsExtend::create($data);
}
Db::commit();
return json(['status' => 1, 'msg' => '保存成功']);
} catch (\Exception $e) {
Db::rollback();
return json(['status' => 0, 'msg' => '保存失败: ' . $e->getMessage()]);
}
}
// 获取扩展设置
$extend = \app\common\model\GoodsExtend::getByGoodsId($goods_id);
if (!$extend) {
// 从goods_type表获取默认值
$goodsType = Db::name('goods_type')
->field('pay_wechat, pay_balance, pay_currency, pay_currency2, pay_coupon, is_deduction')
->where('value', $goods['type'])
->find();
if ($goodsType) {
// 如果找到了盒子类型的默认配置
$extend = [
'goods_id' => $goods_id,
'pay_wechat' => $goodsType['pay_wechat'],
'pay_balance' => $goodsType['pay_balance'],
'pay_currency' => $goodsType['pay_currency'],
'pay_currency2' => $goodsType['pay_currency2'],
'pay_coupon' => $goodsType['pay_coupon'],
'is_deduction' => $goodsType['is_deduction']
];
} else {
// 如果没找到,使用默认值
$extend = [
'goods_id' => $goods_id,
'pay_wechat' => 1,
'pay_balance' => 1,
'pay_currency' => 1,
'pay_currency2' => 1,
'pay_coupon' => 1,
'is_deduction' => 1
];
}
}
View::assign('goods', $goods);
View::assign('extend', $extend);
return View::fetch("Goods/goods_extend");
}
/**
* 删除盒子扩展设置
*/
public function goods_extend_del(Request $request)
{
$goods_id = $request->param('goods_id/d');
if (!$goods_id) {
return json(['status' => 0, 'msg' => '参数错误']);
}
// 获取盒子信息
$goods = GoodsModel::where('id', $goods_id)->find();
if (!$goods) {
return json(['status' => 0, 'msg' => '盒子不存在']);
}
// 删除扩展设置
$result = \app\common\model\GoodsExtend::deleteByGoodsId($goods_id);
if ($result) {
return json(['status' => 1, 'msg' => '删除成功']);
} else {
return json(['status' => 0, 'msg' => '删除失败或扩展设置不存在']);
}
}
/**
* 更新盒子排序
*/
public function update_goods_sort(Request $request)
{
$id = $request->post('id/d');
$sort = $request->post('sort/d');
if (empty($id)) {
return json(['status' => 0, 'msg' => '参数错误']);
}
// 验证排序值
if (!is_numeric($sort) || $sort < 0) {
return json(['status' => 0, 'msg' => '排序值必须是非负整数']);
}
// 获取盒子信息
$goods = GoodsModel::where('id', $id)->find();
if (!$goods) {
return json(['status' => 0, 'msg' => '盒子不存在']);
}
// 更新排序值
$result = GoodsModel::where('id', $id)->update(['sort' => $sort]);
if ($result) {
return json(['status' => 1, 'msg' => '更新成功']);
} else {
return json(['status' => 0, 'msg' => '更新失败']);
}
}
/**
* 更新奖品排序
*/
public function goodslist_edit_sort(Request $request)
{
$id = $request->post('id/d');
$sort = $request->post('sort/d');
if (empty($id)) {
return json(['status' => 0, 'msg' => '参数错误']);
}
// 验证排序值
if (!is_numeric($sort) || $sort < 0) {
return json(['status' => 0, 'msg' => '排序值必须是非负整数']);
}
// 获取奖品信息
$goodsList = GoodsList::where('id', $id)->find();
if (!$goodsList) {
return json(['status' => 0, 'msg' => '奖品不存在']);
}
// 更新排序值
$result = GoodsList::where('id', $id)->update(['sort' => $sort]);
if ($result) {
return json(['status' => 1, 'msg' => '更新成功']);
} else {
return json(['status' => 0, 'msg' => '更新失败']);
}
}
}

View File

@ -1,219 +0,0 @@
<?php
namespace app\admin\controller;
use app\admin\controller\Base;
use app\common\model\Category;
use app\common\model\Yushou;
use \think\Request;
use think\facade\View;
use app\common\model\Goods as GoodsModel;
use app\common\model\GoodsList;
use app\common\model\GoodsExtendList as GoodsExtendListModel;
use app\common\model\AdminGoodsLog;
use think\facade\Db;
use app\common\model\Shang;
class GoodsExtend extends Base
{
/**
* 盒子奖品
*/
public function goodsextendlist(Request $request)
{
$goods_id = $request->param('goods_id/d', 0);
$num = $request->param('num/d', 1);
$info = GoodsModel::where(['id' => $goods_id])->find();
if (!$info) {
return $this->renderError('请求参数错误');
}
$type = $info['type'];
$title = trim(input('get.title'));
$lian_ji_type = input('get.lian_ji_type');
$whe = array();
$whe[] = ['goods_id', '=', $goods_id];
if ($num > $info['stock']) {
$num = $info['stock'];
}
if ($type == 1 || $type == 3 || $type == 5 || $type == 6 || $type == 10 || $type == 11) {
if ($num <= 0) {
$num = 1;
}
if ($num != 0) {
$whe[] = ['num', '=', $num];
}
} elseif ($type == 2 || $type == 8 || $type == 9) {
$whe[] = ['num', '=', 0];
} else {
return $this->renderError('请求参数错误1');
}
if (!empty($title)) {
$whe[] = ['title', 'like', '%' . $title . '%'];
}
if (!empty($lian_ji_type)) {
$whe[] = ['lian_ji_type', '=', $lian_ji_type];
}
$field = "*";
$order = "sort desc,shang_id asc,id asc";
$data = GoodsList::getList($whe, $field, $order, 150);
$stock = array_sum(array_column($data['list'], 'stock'));
$surplus_stock = array_sum(array_column($data['list'], 'surplus_stock'));
$reward_num_count = $stock - $surplus_stock;
//GoodsModel
$goodsExtendLists = GoodsExtendListModel::getGoodsExtendList($goods_id);
// $idArray = array_map(function($item) {
// return $item['id'];
// }, $data);
// Shang::where(['id' => $value['shang_id']])->value('title');
$real_pro = 0;
$goods_extend_reward_num = 0;
foreach ($data['list'] as &$value) {
$value['shang'] = Shang::where(['id' => $value['shang_id']])->value('title');
$real_pro += $value['real_pro'];
// $value['rownum'] = $goodsExtendLists::where(['id' => $goods_id])->find();
//找到匹配的数据
$value['goods_extend_reward_num'] = 0;
$value['goods_extend_rawrd_type'] = 0;
$value['goods_extend'] = [];
if (count($goodsExtendLists) > 0) {
foreach ($goodsExtendLists as $item) {
// $temp_goods_extend_data = GoodsExtendListModel::where('prize_code', '=', $goods["prize_code"])->find();
// if ($item['prize_code'] == $value['prize_code']) {
if ($item['goods_list_id'] == $value['id']) {
$goods_extend_reward_num = $item['reward_num']; // 替换为你需要的字段名
$value['goods_extend_reward_num'] = $goods_extend_reward_num;
$value['goods_extend'] = $item;
$value['goods_extend_rawrd_type'] = $item['rawrd_type'];
$value['goods_extend_reward_num_1'] = $item['reward_num_1'];
break; // 找到第一个匹配的对象后退出循环
}
}
}
}
View::assign('list', $data['list']);
View::assign('count', $data['count']);
View::assign('page', $data['page']);
View::assign('goods_id', $goods_id);
View::assign('type', $type);
View::assign('goods_model', $info);
View::assign('num', $num );
View::assign('real_pro', $real_pro);
View::assign('reward_num_count',$reward_num_count);
return View::fetch("GoodsExtend/goodsextendlist");
}
/**
* 编辑奖品
*/
public function goodsextendlist_edit(Request $request)
{
$id = 0;
if (!$request->isPost()) {
$id = $request->param('id/d', 0);
$goods_extend_list_model = GoodsExtendListModel::getGoodsIdExtendList($id);
View::assign('goods_extend', $goods_extend_list_model);
return View::fetch('GoodsExtend/goodsextend_edit');
} else {
$data = input('post.');
if (empty($data['ids'])) {
return $this->renderError('请求参数错误1');
}
if (empty($data['value'])) {
return $this->renderError('请求参数错误1');
}
// if (RegZero($data['value'])) {
// return $this->renderError('请输入整数');
// }
if (RegZero($data['goodid'])) {
return $this->renderError('请求参数错误');
}
$value = $data['value'];
$ids = $data['ids'];
$goodid = $data['goodid'];
$save_goods_extend_data = [];
// rawrd_type:3,
// reward_num:0,
// reward_num1:0,
// reward_num2:0
// $ordinary_prize = GoodsList::where('goods_id', '=', $goods_id)
// ->where('num', '=', $num)
// ->where('shang_id', 'between', self::$shang_prize_id)
// ->order('sort desc,shang_id asc')
// ->select()->toArray();
foreach ($ids as $item) {
$goods_list_id = intval($item);
if ($goods_list_id > 0) {
$goods = GoodsList::where(['id' => $goods_list_id])->find();
if ($goods) {
// $temp_goods_extend_data = GoodsExtendListModel::where('prize_code', '=', $goods["prize_code"])->find(); //getGoodsIdExtendList($goods_list_id);
$temp_goods_extend_data = GoodsExtendListModel::where('goods_list_id', '=', $goods_list_id)->find(); //getGoodsIdExtendList($goods_list_id);
if ($temp_goods_extend_data === null) {
// 创建新的数据
$temp_goods_extend_data = new GoodsExtendListModel();
}
// 更新现有数据
$temp_goods_extend_data->goods_list_id = $item;
$temp_goods_extend_data->reward_num = $value['reward_num'];
$temp_goods_extend_data->rawrd_type = $value['rawrd_type'];
$temp_goods_extend_data->reward_num_1 = $value['reward_num_1'];
$temp_goods_extend_data->goods_id = $goodid;
$temp_goods_extend_data->prize_code = $goods["prize_code"];
$save_goods_extend_data[] = $temp_goods_extend_data;
}
}
}
// 保存数据到数据库中
foreach ($save_goods_extend_data as $data) {
$data->save(); // save() 方法将自动处理是插入还是更新
}
return $this->renderSuccess('编辑成功');
}
}
/**
* 编辑奖品
*/
public function goodsextendlist_del(Request $request)
{
if (!$request->isPost()) {
return $this->renderError('');
} else {
$data = input('post.');
if (empty($data['goods_list_id'])) {
return $this->renderError('请求参数错误1');
}
$goods_list_id = $data['goods_list_id'];
$save_goods_extend_data = GoodsExtendListModel::where('goods_list_id', '=', $goods_list_id)->select();
// 保存数据到数据库中
foreach ($save_goods_extend_data as $data) {
if ($data) {
$data->delete(); // delete() 方法将从数据库中删除该对象
}
}
return $this->renderSuccess('编辑成功');
}
}
}

0
app/admin/controller/GoodsType.php Normal file → Executable file
View File

0
app/admin/controller/Reward.php Normal file → Executable file
View File

0
app/admin/controller/SignConfig.php Normal file → Executable file
View File

0
app/admin/controller/WelfareHouse.php Normal file → Executable file
View File

6
app/admin/middleware/DomainBind.php Normal file → Executable file
View File

@ -43,11 +43,11 @@ class DomainBind
if (!$this->checkDomain($domain)) {
// 记录被拒绝的请求
\think\facade\Log::warning('域名访问被拒绝: ' . $domain . ', 路径: ' . $path);
return $this->error('域名未授权,无法访问', 403);
return $this->error('未授权,无法访问', 403);
}
// 域名允许,记录请求信息(可选,仅用于调试)
\think\facade\Log::info('域名访问通过: ' . $domain . ', 路径: ' . $path);
// \think\facade\Log::info('域名访问通过: ' . $domain . ', 路径: ' . $path);
// 域名允许,继续处理请求
return $next($request);
@ -92,7 +92,7 @@ class DomainBind
// 1. 从配置文件中获取额外允许的域名
try {
$configDomains = Config::get('admin.api_domains', []);
$configDomains = Config::get('api.admin_domains', []);
if (!empty($configDomains) && is_array($configDomains)) {
foreach ($configDomains as $d) {
$d = trim($d);

View File

@ -174,6 +174,7 @@ Route::rule('goodslist', 'Goods/goodslist', 'GET|POST');
Route::rule('goodslist_add', 'Goods/goodslist_add', 'GET|POST');
Route::rule('goodslist_edit', 'Goods/goodslist_edit', 'GET|POST');
Route::rule('goodslist_del', 'Goods/goodslist_del', 'GET|POST');
Route::rule('goodslist_edit_sort', 'Goods/goodslist_edit_sort', 'POST');
Route::rule('give', 'Goods/give', 'GET|POST');
Route::rule('give_add', 'Goods/give_add', 'GET|POST');
Route::rule('give_edit', 'Goods/give_edit', 'GET|POST');
@ -195,13 +196,14 @@ Route::rule('drawlist_del', 'Draw/drawlist_del', 'GET|POST');
Route::rule('draw_add', 'Draw/draw_add', 'GET|POST');
Route::rule('get_sync_addresses', 'Goods/get_sync_addresses', 'GET');
Route::rule('sync_goods', 'Goods/sync_goods', 'POST');
Route::any('goods_edit', 'Goods/goods_edit');
Route::any('goods_del', 'Goods/goods_del');
Route::any('goodslist', 'Goods/goodslist');
Route::any('goods_extend', 'Goods/goods_extend');
Route::any('goods_extend_del', 'Goods/goods_extend_del');
Route::post('update_goods_sort', 'Goods/update_goods_sort');
#============================
#盒子扩展
#============================
Route::rule('goodsextendlist', 'GoodsExtend/goodsextendlist', 'GET|POST');
Route::rule('goodsextendlist_edit', 'GoodsExtend/goodsextendlist_edit', 'GET|POST');
Route::rule('goodsextendlist_del', 'GoodsExtend/goodsextendlist_del', 'POST');
#============================
#Order.php订单管理
#============================

0
app/admin/view/AdvertType/add.html Normal file → Executable file
View File

0
app/admin/view/AdvertType/list_all.html Normal file → Executable file
View File

0
app/admin/view/Config/miniprogram.html Normal file → Executable file
View File

View File

@ -150,6 +150,24 @@
<div class="layui-form-mid layui-word-aux">每日消费达到此金额后可签到0表示不限制</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">外卖盒子ID</label>
<div class="layui-input-block">
<input type="text" name="waimai_box_id"
value="{$app_setting.waimai_box_id|default=0}" autocomplete="off"
class="layui-input" min="0">
<div class="layui-form-mid layui-word-aux">外卖盒子的ID设置为0表示不启用</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">每日免费抽奖ID</label>
<div class="layui-input-block">
<input type="text" name="daily_free_draw_id"
value="{$app_setting.daily_free_draw_id|default=0}" autocomplete="off"
class="layui-input" min="0">
<div class="layui-form-mid layui-word-aux">每日免费送抽奖的ID设置为0表示不启用</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="app-setting-form">保存</button>

View File

@ -1,7 +1,7 @@
{include file="Public:header2"/}
{include file="Public:header3"/}
<body>
<div class="layui-fluid" ">
<div class="layui-fluid" style="margin-top: 15px;">
<div class=" layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
@ -33,15 +33,13 @@
<button class="layui-btn layuiadmin-btn-useradmin" id="searchBtn">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
<button class="layui-btn" id="addGoodsBtn">添加盒子</button>
<button class="layui-btn layui-btn-normal" id="offshelfLogBtn">自动下架日志</button>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;" id="goods-select">
<button class="layui-btn" id="addGoodsBtn">添加盒子</button>
<button class="layui-btn layui-btn-normal" id="offshelfLogBtn">自动下架日志</button>
</div>
<table id="goodsTable" lay-filter="goodsTable"></table>
</div>
</div>
@ -103,6 +101,81 @@
{{# } }}
</script>
<!-- 盒子支付信息模板 -->
<script type="text/html" id="payInfoTpl">
<div class="pay-info-container">
{{# var hasExtend = false; }}
{{# var goodsExtend = d.goods_extend || {}; }}
{{# if(goodsExtend && (goodsExtend.pay_wechat !== undefined || goodsExtend.pay_balance !== undefined ||
goodsExtend.pay_currency !== undefined || goodsExtend.pay_currency2 !== undefined ||
goodsExtend.pay_coupon !== undefined)) { }}
{{# hasExtend = true; }}
<div>
{{# if(goodsExtend.pay_wechat == 1) { }}
<span class="layui-badge layui-bg-green">微信</span>
{{# } }}
{{# if(goodsExtend.pay_balance == 1) { }}
<span class="layui-badge layui-bg-blue">{$app_setting.balance_name}</span>
{{# } }}
{{# if(goodsExtend.pay_currency == 1) { }}
<span class="layui-badge layui-bg-orange">{$app_setting.currency1_name}</span>
{{# } }}
{{# if(goodsExtend.pay_currency2 == 1) { }}
<span class="layui-badge layui-bg-cyan">{$app_setting.currency2_name}</span>
{{# } }}
{{# if(goodsExtend.pay_coupon == 1) { }}
<span class="layui-badge layui-bg-purple">优惠券</span>
{{# } }}
</div>
<div style="margin-top:5px;">
{{# if(goodsExtend.is_deduction == 1) { }}
<span class="layui-badge layui-bg-red">抵扣</span>
{{# } else { }}
<span class="layui-badge layui-bg-gray">支付</span>
{{# } }}
</div>
{{# } else { }}
<span class="layui-badge layui-bg-gray">默认设置</span>
{{# } }}
</div>
</script>
<!-- 盒子价格和套数模板 -->
<script type="text/html" id="priceStockTpl">
<div><b>价格:</b>{{d.price}}元</div>
<div><b>套数:</b>{{d.stock}}</div>
</script>
<!-- 盒子限购等信息模板 -->
<script type="text/html" id="limitInfoTpl">
<div><b>每日限购:</b>{{d.daily_xiangou}}次</div>
<div><b>解锁金额:</b><span class="layui-badge layui-bg-orange">{{d.unlock_amount}}</span></div>
<div><b>抽奖门槛:</b>{{d.choujiang_xianzhi}}</div>
</script>
<!-- 首页显示和锁箱模式模板 -->
<script type="text/html" id="showLockTpl">
{{# if(d.show_is == 1) { }}
<div><b>首页显示:</b><span class="layui-badge layui-bg-danger"></span></div>
{{# } }}
{{# if(d.lock_is == 1) { }}
<div><b>锁箱模式:</b>开启</div>
<div><b>锁箱时间:</b>{{d.lock_time}}秒</div>
{{# } }}
</script>
<!-- 操作栏模板 -->
<script type="text/html" id="toolbarTpl">
<div class="user-extra-info">
@ -121,7 +194,15 @@
<a style="text-decoration:none" lay-event="sync" class="layui-btn layui-btn-normal layui-btn-xs">
<i class="layui-icon layui-icon-sync"></i>同步
</a>
</div>
</div>
<div>
<a style="text-decoration:none" lay-event="extend" class="layui-btn layui-btn-normal layui-btn-xs">
<i class="layui-icon layui-icon-set"></i>扩展设置
</a>
<a style="text-decoration:none" lay-event="extend_del" class="layui-btn layui-btn-danger layui-btn-xs">
<i class="layui-icon layui-icon-delete"></i>删除扩展
</a>
</div>
<div>
<a style="text-decoration:none" lay-event="clear" class="layui-btn layui-btn-danger layui-btn-xs">
<i class="layui-icon layui-icon-delete"></i>清空抽奖
@ -148,7 +229,7 @@
</div>
</script>
{include file="Public:footer"/}
{include file="Public:footer3"/}
<script type="text/javascript">
var table;
@ -187,7 +268,8 @@
url: '{:url("/admin/api/goods/list")}',
page: true,
limit: 20,
height: 'full-' + ($("#goods-select").height() + 140),
lineStyle: 'height:150px',
height: 'full-120',
cols: [[
{
field: 'id', title: '盒子ID', width: 80, templet: function (d) {
@ -199,31 +281,25 @@
}
},
{ field: 'type', title: '盒子类型', width: 120, templet: '#typeTpl' },
{ field: 'title', title: '盒子名称', width: 200 },
{ field: 'price', title: '盒子价格', width: 100 },
{ field: 'title', title: '盒子名称', width: 180 },
{
field: 'price_stock', title: '价格/套数', width: 140, templet: '#priceStockTpl'
},
{
field: 'imgurl', title: '盒子图片', width: 90, templet: function (d) {
return '<img src="' + d.imgurl + '" style="width:60px;height:60px;" class="layui-admin-img" onclick="previewImg(this)">';
}
},
{
field: 'imgurl_detail', title: '盒子详', width: 90, templet: function (d) {
field: 'imgurl_detail', title: '详情图片', width: 90, templet: function (d) {
return d.imgurl_detail ? '<img src="' + d.imgurl_detail + '" style="width:60px;height:60px;" class="layui-admin-img" onclick="previewImg(this)">' : '';
}
},
{ field: 'stock', title: '套数', width: 80 },
{ field: 'daily_xiangou', title: '每日限购', width: 80, templet: function(d) {
return d.daily_xiangou > 0 ? d.daily_xiangou + '次' : '无限制';
}
},
{ field: 'lock_is', title: '锁箱模式', width: 90, templet: '#lockIsTpl' },
{ field: 'show_is', title: '首页显示', width: 90, templet: '#showIsTpl' },
{ field: 'limit_info', title: '限购信息', width: 150, templet: '#limitInfoTpl' },
{ field: 'pay_info', title: '支付信息', width: 150, templet: '#payInfoTpl' },
{ field: 'is_auto_xiajia', title: '自动下架', width: 150, templet: '#autoOffshelfTpl' },
{ field: 'prize_num', title: '擂台赏<br>抽全局赏数量', width: 90 },
{ field: 'unlock_amount', title: '解锁金额', width: 100, templet: function(d) {
return d.unlock_amount > 0 ? '<span class="layui-badge layui-bg-orange">' + d.unlock_amount + '</span>' : '无需解锁';
}},
// 福利屋时间信息
{ field: 'sort', title: '排序', width: 100, edit: 'text' },
{ field: 'is_flw', title: '福利屋信息', width: 200, templet: function(d) {
if (d.type == 15) {
var startTime = d.flw_start_time ? new Date(d.flw_start_time * 1000).toLocaleString() : '未设置';
@ -238,10 +314,19 @@
return '';
}
}},
{ field: 'sort', title: '排序', width: 80 },
{ field: 'addtime_text', title: '添加时间', width: 160 },
{ field: 'show_lock', title: '显示/锁箱', width: 150, templet: '#showLockTpl' },
{
field: 'addtime', title: '添加/修改时间', width: 180, templet: function(d) {
if (d.update_time) {
return '<div><b>添加:</b> ' + d.addtime_text + '</div><div><b>修改:</b> ' + new Date(d.update_time * 1000).toLocaleString() + '</div>';
} else {
return '<div>' + d.addtime_text + '</div>';
}
}
},
{ fixed: 'right',field: 'status', title: '状态', width: 100, templet: '#statusTpl' },
{ fixed: 'right', title: '操作', width: 150, toolbar: '#toolbarTpl' }
{ fixed: 'right', title: '操作', width: 200, toolbar: '#toolbarTpl' }
]],
done: function () {
// 绑定状态切换事件
@ -308,6 +393,49 @@
} else if (layEvent === 'delete') {
// 删除盒子
del(data.id, 3, '删除');
} else if (layEvent === 'extend') {
// 盒子扩展设置
goods_extend(data.id, data.title);
} else if (layEvent === 'extend_del') {
// 删除盒子扩展
goods_extend_del(data.id);
}
});
// 监听单元格编辑
table.on('edit(goodsTable)', function(obj){
var value = obj.value, // 得到修改后的值
data = obj.data, // 得到所在行所有键值
field = obj.field; // 得到字段
// 排序字段修改
if (field === 'sort') {
var loadIndex = layer.load(2);
// 发送请求保存修改
$.ajax({
url: '{:url("/admin/update_goods_sort")}',
type: 'POST',
data: {
id: data.id,
sort: value
},
success: function(res) {
layer.close(loadIndex);
if (res.status === 1) {
layer.msg('排序修改成功', {icon: 1, time: 1000});
} else {
layer.msg(res.msg || '修改失败', {icon: 2, anim: 6, time: 2000});
// 重载表格以恢复原值
table.reload('goodsTable');
}
},
error: function() {
layer.close(loadIndex);
layer.msg('网络错误,请稍后重试', {icon: 2, anim: 6, time: 2000});
// 重载表格以恢复原值
table.reload('goodsTable');
}
});
}
});
});
@ -522,6 +650,42 @@
});
}
// 盒子扩展设置
function goods_extend(goods_id, title) {
var url = "{:url('/admin/goods_extend')}?goods_id=" + goods_id;
layer.open({
type: 2,
title: title + ' - 盒子扩展设置',
shadeClose: false,
shade: 0.3,
area: ['550px', '450px'],
content: url,
});
}
// 删除盒子扩展
function goods_extend_del(goods_id) {
layer.confirm('确定要删除该盒子的扩展设置吗?删除后将恢复默认支付方式。', {
btn: ['确定', '取消'],
title: '删除确认'
}, function (index) {
var url = "{:url('/admin/goods_extend_del')}";
var load = layer.load(2);
var $ = layui.$;
$.post(url, { "goods_id": goods_id }, function (data) {
layer.close(load);
if (data.status == 1) {
layer.msg(data.msg, { icon: 1, time: 2000 }, function() {
table.reload('goodsTable');
});
} else {
layer.msg(data.msg, { icon: 2, anim: 6, time: 2000 });
}
});
layer.close(index);
});
}
// 图片预览功能
function previewImg(obj) {
var img = new Image();
@ -538,37 +702,12 @@
}
</script>
<style>
.layui-table td {
padding: 10px 15px;
/* 调整单元格内边距 */
height: 100px !important;
}
.combined-values div {
margin: 0;
padding: 0px 0;
}
.layui-table-cell {
height: 120px !important;
line-height: 28px;
padding: 0 15px;
position: relative;
box-sizing: border-box
}
.layui-table thead th {
height: 30px !important;
}
.layui-table thead th div {
height: 30px !important;
}
.layui-table-col-special {
height: 30px !important;
}
/* 图片放大样式 */
.layui-admin-img {
@ -580,6 +719,16 @@
transform: scale(1.1);
box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
/* 支付信息容器样式 */
.pay-info-container {
padding: 5px 0;
}
/* 徽章样式 */
.layui-badge {
margin: 2px;
}
</style>
</body>

View File

@ -1,4 +1,9 @@
{include file="Public:header2"/}
<style>
.tips {
width: 100%;
}
</style>
<body style="min-height: 100%;background-color: #fff">
@ -98,6 +103,7 @@
<div class="layui-input-inline">
<input type="number" name="quanju_xiangou" value="0" placeholder="请输入每个箱子的限购次数"
class="layui-input" style="width: 600px">
<div class="layui-form-mid layui-word-aux tips"> </div>
</div>
</div>
<div class="layui-form-item id_stock" id="div_daily_xiangou">
@ -105,6 +111,7 @@
<div class="layui-input-inline">
<input type="number" name="daily_xiangou" value="0" placeholder="请输入每日限购次数"
class="layui-input" style="width: 600px">
<div class="layui-form-mid layui-word-aux tips">每天允许购买的次数0不限制</div>
</div>
</div>
<div class="layui-form-item id_lock_is">
@ -232,8 +239,8 @@
</div>
</div>
<!-- 新增自动下架功能 -->
<div class="layui-form-item">
<label class="layui-form-label">自动下架</label>
<div class="layui-form-item zidongxiajia">
<label class="layui-form-label ">自动下架</label>
<div class="layui-input-inline" style="width: 600px">
<input type="radio" name="is_auto_xiajia" value="0" lay-filter="autoXiajia"
class="layui-input" title="关闭" checked>
@ -255,12 +262,12 @@
placeholder="请输入从多少抽数后开始检测" class="layui-input" style="width: 600px">
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item jiesuojine">
<label class="layui-form-label">解锁金额</label>
<div class="layui-input-inline" style="width: 600px">
<input type="number" name="unlock_amount" value="0"
placeholder="请输入解锁金额0表示无需解锁" class="layui-input" style="width: 600px">
<div class="layui-form-mid layui-word-aux">用户需要消费满此金额才能看到此盒子0表示都能看到</div>
<input type="text" name="unlock_amount" value="0" placeholder="请输入解锁金额0表示无需解锁"
class="layui-input" style="width: 600px">
<div class="layui-form-mid layui-word-aux tips">用户需要消费满此金额才能看到此盒子0表示都能看到</div>
</div>
</div>
<div class="layui-form-item">
@ -334,7 +341,7 @@
$(".lingzhu_fan").hide();
$(".lingzhu_shang_id").hide();
$("#goods_describe_div").hide();
$("#div_daily_xiangou").show(); // 初始显示每日限购次数
$(".flw_time_config").hide(); // 显示福利屋时间配置
$(".lian_ji_num").hide();
$(".id_stock").show();
@ -347,7 +354,11 @@
$(".show_is").show();
$(".sale_time").show();
$("#div_daily_xiangou").show(); // 显示每日限购
// 显示福利屋相关字段
$("#goods_describe_div").hide(); // 显示盒子描述
$(".flw_time_config").hide(); // 显示福利屋时间配置
$("#div_daily_xiangou").hide(); // 显示每日限购次数
$("#div_quanju_xiangou").hide();
//2023-11
$(".rage_is").hide();
$(".rage").hide();
@ -357,12 +368,18 @@
$(".lingzhu_shang_id").hide();
$(".lian_ji_num").hide();
$(".lian_ji_shang_id").hide();
$('.jiesuojine').show();
form.on('radio(type)', function (data) {
console.log('aaa');
var value = data.value; // 当前选中的value值
$("#div_daily_xiangou").show();
$("#goods_describe_div").hide();
$('.jiesuojine').show();
$(".flw_time_config").hide(); // 显示福利屋时间配置
$("#div_daily_xiangou").hide(); // 显示每日限购次数
$("#div_quanju_xiangou").hide();
$('.zidongxiajia').show();
if (value == 1 || value == 11) {
$(".id_stock").show();
$(".id_lock_is").show();
@ -538,6 +555,26 @@
$(".lingzhu_shang_id").hide();
$(".lian_ji_num").hide();
$(".lian_ji_shang_id").hide();
} else if (value == 17) {
$(".id_stock").hide();
$(".id_lock_is").hide();
$(".id_lock_time").hide();
$(".id_prize_num").hide();
$(".coupon_is").hide();
$(".coupon_pro").hide();
$(".integral_is").hide();
$(".show_is").hide();
$(".sale_time").hide();
$(".new_is").hide();
$('.zidongxiajia').hide();
//2023-11
$(".rage_is").hide();
$(".rage").hide();
$(".item_card_id").hide();
$(".lian_ji_num").hide();
$(".lian_ji_shang_id").hide();
$("#div_daily_xiangou").show(); // 显示每日限购
$('.jiesuojine').hide();
}
});
// 自动下架开关切换事件
@ -548,13 +585,13 @@
$('.xiajia-config').hide();
}
});
// 首抽五折切换事件
form.on('radio(shou_zhe)', function (data) {
// 仅记录选择,不做界面显示变化
console.log('首抽五折设置为:', data.value);
});
//执行实例
upload.render({
accept: 'imgurl'

View File

@ -268,10 +268,10 @@
<input type="number" name="xiajia_auto_coushu" value="{$info.xiajia_auto_coushu|default=0}" placeholder="请输入从多少抽数后开始检测" class="layui-input" style="width: 600px">
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item jiesuojine">
<label class="layui-form-label">解锁金额</label>
<div class="layui-input-inline" style="width: 600px">
<input type="number" name="unlock_amount" value="{$info.unlock_amount|default=0}"
<input type="text" name="unlock_amount" value="{$info.unlock_amount|default=0}"
placeholder="请输入解锁金额0表示无需解锁" class="layui-input" style="width: 600px">
<div class="layui-form-mid layui-word-aux">用户需要消费满此金额才能看到此盒子0表示都能看到</div>
</div>
@ -327,8 +327,8 @@
type_switch(value);
})
// 初始化时间选择器
laydate.render({
// 初始化时间选择器
laydate.render({
elem: '#flw_start_time',
type: 'datetime'
});
@ -344,7 +344,7 @@
});
// 如果是福利屋类型,初始时隐藏自动下架选项
if ({$type} == 15) {
if ({$type} == 15||{$type} == 17) {
$("[name='is_auto_xiajia']").parents(".layui-form-item").hide();
}
@ -360,9 +360,22 @@
});
function type_switch(value) {
$('#isshouwchou').show();
$("#goods_describe_div").hide();
$(".lian_ji_num").hide();
$("#goods_describe_div").hide(); // 显示盒子描述
$(".flw_time_config").hide(); // 显示福利屋时间配置
$("#div_daily_xiangou").hide(); // 显示每日限购次数
$("#div_quanju_xiangou").hide();
$('.lingzhu_fan').hide();
$('.lingzhu_shang_id').hide();
$('.lian_ji_num').hide();
$('.lian_ji_shang_id').hide();
$('.jiesuojine').hide();
$('.zidongxiajia').show();
$('.jiesuojine').show();
if (value == 1 || value == 11) {
$(".id_stock").show();
$(".id_lock_is").show();
@ -539,11 +552,31 @@
$(".lingzhu_shang_id").hide();
$(".lian_ji_num").hide();
$(".lian_ji_shang_id").hide();
} else if (value == 17) {
$(".lingzhu_is").hide();
$(".id_stock").hide();
$(".id_lock_is").hide();
$(".id_lock_time").hide();
$(".id_prize_num").hide();
$(".coupon_is").hide();
$(".coupon_pro").hide();
$(".integral_is").hide();
$(".show_is").hide();
$(".sale_time").hide();
$(".new_is").hide();
$('.zidongxiajia').hide();
//2023-11
$(".rage_is").hide();
$(".rage").hide();
$(".item_card_id").hide();
$(".lian_ji_num").hide();
$(".lian_ji_shang_id").hide();
$("#div_daily_xiangou").show(); // 显示每日限购
$('.jiesuojine').hide();
}
}
// 自动下架开关切换事件
form.on('radio(autoXiajia)', function (data) {
form.on('radio(autoXiajia)', function (data) {
if (data.value == "1") {
$('.xiajia-config').show();
} else {

View File

@ -0,0 +1,92 @@
{include file="Public:header2"/}
<body>
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-card-header">盒子扩展设置</div>
<div class="layui-card-body">
<form class="layui-form" id="extendForm">
<input type="hidden" name="goods_id" value="{$goods.id}">
<div class="layui-form-item">
<label class="layui-form-label">盒子信息:</label>
<div class="layui-input-block">
<div class="layui-form-mid layui-word-aux">ID: {$goods.id} | 名称: {$goods.title}</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">支付方式:</label>
<div class="layui-input-block">
<input type="checkbox" name="pay_wechat" value="1" title="微信支付" lay-skin="primary" {if $extend.pay_wechat eq 1}checked{/if}>
<input type="checkbox" name="pay_balance" value="1" title="{$app_setting.balance_name}支付" lay-skin="primary" {if $extend.pay_balance eq 1}checked{/if}>
<input type="checkbox" name="pay_currency" value="1" title="{$app_setting.currency1_name}支付" lay-skin="primary" {if $extend.pay_currency eq 1}checked{/if}>
<input type="checkbox" name="pay_currency2" value="1" title="{$app_setting.currency2_name}支付" lay-skin="primary" {if $extend.pay_currency2 eq 1}checked{/if}>
<input type="checkbox" name="pay_coupon" value="1" title="优惠券支付" lay-skin="primary" {if $extend.pay_coupon eq 1}checked{/if}>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">支付类型:</label>
<div class="layui-input-block">
<input type="radio" name="is_deduction" value="1" title="抵扣" {if $extend.is_deduction eq 1}checked{/if}>
<input type="radio" name="is_deduction" value="0" title="支付" {if $extend.is_deduction eq 0}checked{/if}>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button type="button" class="layui-btn" lay-submit lay-filter="formSubmit">提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button type="button" class="layui-btn layui-btn-primary" id="closeBtn">关闭</button>
</div>
</div>
</form>
</div>
</div>
</div>
{include file="Public:footer"/}
<script>
layui.use(['form', 'layer'], function() {
var form = layui.form,
layer = layui.layer,
$ = layui.$;
// 监听提交
form.on('submit(formSubmit)', function(data) {
var loadIndex = layer.load(2);
$.ajax({
url: '{:url("/admin/goods_extend")}',
type: 'POST',
data: $('#extendForm').serialize(),
success: function(res) {
layer.close(loadIndex);
if (res.status === 1) {
layer.msg(res.msg, {icon: 1, time: 1000}, function() {
// 关闭当前弹出层
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
} else {
layer.msg(res.msg, {icon: 2, anim: 6, time: 2000});
}
},
error: function() {
layer.close(loadIndex);
layer.msg('网络错误,请稍后重试', {icon: 2, anim: 6, time: 2000});
}
});
return false; // 阻止表单默认提交
});
// 关闭按钮点击事件
$('#closeBtn').on('click', function() {
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
});
</script>
</body>
</html>

View File

@ -30,14 +30,12 @@
<button class="layui-btn layuiadmin-btn-useradmin" id="searchBtn">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
<button class="layui-btn" id="addBtn">添加奖品</button>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn" id="addBtn">添加奖品</button>
</div>
<!-- 表格 -->
<table id="goodsListTable" lay-filter="goodsListTable"></table>
@ -153,11 +151,11 @@
columns.push({ field: 'price', title: '价格信息', templet: '#priceTpl', minWidth: 150 });
// 根据类型添加特定列
if ([1, 3, 5,6, 10, 11, 15].indexOf(goodsType) > -1) {
if ([1, 3, 5,6, 10, 11, 15,17].indexOf(goodsType) > -1) {
columns.push({ field: 'stock', title: '奖品数量', minWidth: 100 });
}
if ([2, 8, 9, 16].indexOf(goodsType) > -1) {
if ([2, 8, 9, 16,17].indexOf(goodsType) > -1) {
columns.push({
field: 'real_pro', title: '真实概率', templet: function (d) {
return d.real_pro + '%'
@ -174,7 +172,7 @@
}
columns.push({ field: 'sort', title: '排序', minWidth: 80 });
columns.push({ field: 'sort', title: '排序', minWidth: 80, edit: 'text' });
columns.push({ title: '操作', toolbar: '#operationTpl', minWidth: 210, fixed: 'right' });
// 渲染表格
@ -206,12 +204,6 @@
},
cols: [columns],
parseData: (res) => {
// console.log(res);
// res.data[0].children = [res.data[1]];
// res.data[0].children[0].id=9989;
// res.data[0].isParent = true;
// console.log(res.data);
return {
"totalRow": {
"real_pro": res.code.real_pro,
@ -265,6 +257,43 @@
openAddLayer(data.goods_id, data.id);
}
});
// 监听单元格编辑
table.on('edit(goodsListTable)', function(obj){
var value = obj.value, // 得到修改后的值
data = obj.data, // 得到所在行所有键值
field = obj.field; // 得到字段
// 排序字段修改
if (field === 'sort') {
var loadIndex = layer.load(2);
// 发送请求保存修改
$.ajax({
url: '{:url("/admin/goodslist_edit_sort")}',
type: 'POST',
data: {
id: data.id,
sort: value
},
success: function(res) {
layer.close(loadIndex);
if (res.status === 1) {
layer.msg('排序修改成功', {icon: 1, time: 1000});
} else {
layer.msg(res.msg || '修改失败', {icon: 2, anim: 6, time: 2000});
// 重载表格以恢复原值
table.reload('goodsListTable');
}
},
error: function() {
layer.close(loadIndex);
layer.msg('网络错误,请稍后重试', {icon: 2, anim: 6, time: 2000});
// 重载表格以恢复原值
table.reload('goodsListTable');
}
});
}
});
// 打开添加层
function openAddLayer(goodsId, goods_list_id = '') {

View File

@ -28,7 +28,7 @@
{/if}
<div class="layui-form-item">
<label class="layui-form-label">奖品分类</label>
<div class="layui-input-inline" style="width:700px;">
<div class="layui-input-inline" style="width:500px;">
<input type="radio" lay-filter="goods_type" name="goods_type" value="1"
title="现货" checked>
<input type="radio" lay-filter="goods_type" name="goods_type" value="2"
@ -36,9 +36,11 @@
<input type="radio" lay-filter="goods_type" name="goods_type" value="3"
title="货币">
<input type="radio" lay-filter="goods_type" name="goods_type" value="4"
title="宝箱" {if $goods_list_id}disabled{/if}>
title="宝箱" {if $goods_list_id}disabled{/if} {if $type eq 17}disabled{/if}>
<br />
<span style="font-size: 12px;color: #999;">货币:抽到后直接发放,不会到用户的盒柜里</span>
<span
style="font-size: 12px;color: #999;">货币:抽到后会发放“赠送货币”中配置的数据,本奖品不会到用户的盒柜里。</span><br />
<span style="font-size: 12px;color: #999;">盒子类型为特殊盒子时,无法选择宝箱</span>
</div>
</div>
@ -53,7 +55,7 @@
</select>
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item shoujia">
<label class="layui-form-label">奖品售价</label>
<div class="layui-input-inline">
<input type="text" name="price" autocomplete="off" placeholder="请输入奖品售价"
@ -66,7 +68,7 @@
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item cankao">
<label class="layui-form-label">参考价格</label>
<div class="layui-input-inline">
<input type="text" name="sc_money" autocomplete="off" placeholder="请输入市场参考价格"
@ -74,12 +76,18 @@
</div>
</div>
{if $type eq 1 || $type eq 3 || $type eq 5 || $type eq 10 || $type eq 6 || $type eq 11
|| $type eq 15}
|| $type eq 15|| $type eq 17}
<div class="layui-form-item">
<label class="layui-form-label">奖品数量</label>
<div class="layui-input-inline">
<input type="text" name="stock" autocomplete="off" placeholder="请输入奖品数量"
class="layui-input" style="width: 521px">
{if $type eq 17 }
<div style="width: 521px;" >
<span
style="font-size: 12px;color: #999;">当盒子类型为特殊奖品奖品数量为每天能够抽中的次数当天此奖品数量抽完后不在进入奖池。0则不进入奖池</span>
</div>
{/if}
</div>
</div>
@ -93,22 +101,26 @@
</div>
</div>
{/if}
{if $type eq 2 || $type eq 8 || $type eq 9 || $type eq 16}
{if $type eq 2 || $type eq 8 || $type eq 9 || $type eq 16 || $type eq 17}
<div class="layui-form-item">
<label class="layui-form-label">真实概率</label>
<div class="layui-input-inline" style="width: 700px">
<div class="layui-input-inline" style="width:600px">
<input type="text" name="real_pro" autocomplete="off" placeholder="请输入真实概率"
class="layui-input" style="width: 521px;display: inline-block">%
</div>
</div>
{/if}
{if $type eq 16}
{if $type eq 16 || $type eq 17 }
<div class="layui-form-item">
<label class="layui-form-label">赠送倍率</label>
<div class="layui-input-inline">
<input type="number" name="doubling" value="1" autocomplete="off"
placeholder="请输入赠送倍率" class="layui-input" style="width: 521px">
<div style="width: 521px;">
<span
style="font-size: 12px;color: #999;">用户抽到后会发放相同价值的UU币价值10元的奖品赠送倍率为2。用户抽中后发放本奖品和1000的UU币</span>
</div>
</div>
</div>
{/if}
@ -131,6 +143,9 @@
<label class="layui-form-label">赠送货币</label>
<div class="layui-input-inline " style="width: 80%">
<div id="rewardInfoContainer" style="width: 100%;"></div>
<div style="width: 100%;">
<span style="font-size: 12px;color: #999;">用户抽到后会发放对应的货币。</span>
</div>
</div>
</div>
<div class="layui-form-item">
@ -143,7 +158,7 @@
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">商品详情图</label>
<label class="layui-form-label">商品详情图(翻倍赏使用,其它的为空即可)</label>
<div class="layui-input-inline">
<input type="hidden" name="imgurl_detail" value="" placeholder="请上传商品详情图"
autocomplete="off" class="layui-input">
@ -187,16 +202,25 @@
});
//现货/预售切换
form.on('radio(goods_type)', function (data) {
console.log(111111);
$(".shoujia").show();
$(".cankao").show();
var value = data.value; // 当前选中的value值
if (value == 1) {
$("#sale_time").val('')
$(".sale_time").hide()
} else if (value == 2) {
$(".sale_time").show()
} else if (value == 3 || value == 4) {
} else if (value == 3) {
$("#sale_time").val('')
$(".sale_time").hide()
} else if (value == 4) {
$("#sale_time").val('')
$(".sale_time").hide()
$(".shoujia").hide();
$(".cankao").hide();
$("input[name=price]").val(0);
$("input[name=sc_money]").val(0);
$("input[name=money]").val(0);
}
});

View File

@ -37,9 +37,10 @@
<input type="radio" lay-filter="goods_type" name="goods_type" value="3"
title="货币" {if $goods.goods_type eq 3} checked {/if}>
<input type="radio" lay-filter="goods_type" name="goods_type" value="4"
title="宝箱" {if $goods_list_id}disabled{/if} {if $goods.goods_type eq 4} checked {/if}>
title="宝箱" {if $goods_list_id}disabled{/if} {if $type eq 17}disabled{/if} {if $goods.goods_type eq 4} checked {/if}>
<br />
<span style="font-size: 12px;color: #999;">货币:抽到后直接发放,不会到用户的盒柜里</span>
<span style="font-size: 12px;color: #999;">货币:抽到后会发放"赠送货币"中配置的数据,本奖品不会到用户的盒柜里。</span><br />
<span style="font-size: 12px;color: #999;">盒子类型为特殊盒子时,无法选择宝箱</span>
</div>
</div>
<div class="layui-form-item">
@ -76,12 +77,18 @@
</div>
{if $type eq 1 || $type eq 3 || $type eq 5 || $type eq 10 || $type eq 11 || $type eq 6
|| $type eq 15}
|| $type eq 15 || $type eq 17}
<div class="layui-form-item">
<label class="layui-form-label">奖品数量</label>
<div class="layui-input-inline">
<input type="text" value="{$goods.stock}" autocomplete="off"
placeholder="请输入奖品数量" class="layui-input" style="width: 521px" disabled>
{if $type eq 17 }
<div style="width: 521px;" >
<span
style="font-size: 12px;color: #999;">当盒子类型为特殊奖品奖品数量为每天能够抽中的次数当天此奖品数量抽完后不在进入奖池。0则不进入奖池</span>
</div>
{/if}
</div>
</div>
{/if}
@ -94,7 +101,7 @@
</div>
</div>
{/if}
{if $type eq 2 || $type eq 8 || $type eq 9 || $type eq 16}
{if $type eq 2 || $type eq 8 || $type eq 9 || $type eq 16 || $type eq 17}
<div class="layui-form-item">
<label class="layui-form-label">真实概率</label>
<div class="layui-input-inline" style="width: 700px">
@ -104,13 +111,17 @@
</div>
</div>
{/if}
{if $type eq 16}
{if $type eq 16 || $type eq 17}
<div class="layui-form-item">
<label class="layui-form-label">赠送倍率</label>
<div class="layui-input-inline">
<input type="number" name="doubling" value="{$goods.doubling|default=1}"
autocomplete="off" placeholder="请输入赠送倍率" class="layui-input"
style="width: 521px">
<div style="width: 521px;">
<span
style="font-size: 12px;color: #999;">用户抽到后会发放相同价值的UU币价值10元的奖品赠送倍率为2。用户抽中后发放本奖品和1000的UU币</span>
</div>
</div>
</div>
{/if}
@ -134,6 +145,9 @@
<label class="layui-form-label">赠送货币</label>
<div class="layui-input-inline " style="width: 80%">
<div id="rewardInfoContainer" style="width: 100%;"></div>
<div style="width: 100%;">
<span style="font-size: 12px;color: #999;">用户抽到后会发放对应的货币。</span>
</div>
</div>
</div>
<div class="layui-form-item">

0
app/admin/view/Goods/offshelf/log.html Normal file → Executable file
View File

0
app/admin/view/Goods/type_add.html Normal file → Executable file
View File

0
app/admin/view/Goods/type_edit.html Normal file → Executable file
View File

0
app/admin/view/Goods/type_index.html Normal file → Executable file
View File

View File

@ -1,97 +0,0 @@
{include file="Public:header2"/}
<body style="min-height: 100%;background-color: #fff">
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<form onsubmit="return false;">
<div class="layui-form" wid100 lay-filter="">
<input type="hidden" name="id" value="{if $goods_extend neq null}{$goods_extend.id}{else}0{/if}">
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" onclick="return check()">确认保存</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
{include file="Public:footer"/}
</body>
<script type="text/javascript" src="/static/admin/lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="/static/admin/lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" src="/static/admin/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
</html>
<script type="text/javascript">
layui.use(['layer','form','upload','element','laydate'], function(){
var $ = layui.$;
var form = layui.form;
var upload = layui.upload;
var element = layui.element;
var laydate = layui.laydate;
var new_data = new Date();
new_data.setTime(new_data.getTime()+24*60*60*1000);
var tomorrow_time = new_data.getFullYear()+"-" + (new_data.getMonth()+1) + "-" + new_data.getDate();
laydate.render({
elem: '#sale_time',
min:tomorrow_time
});
//现货/预售切换
form.on('radio(goods_type)', function (data) {
var value = data.value; // 当前选中的value值
if(value == 1){
$("#sale_time").val('')
$(".sale_time").hide()
}else{
$(".sale_time").show()
}
});
upload.render({
accept:'imgurl'
,elem: '#imgurl' //绑定元素
,url: '/admin/picture' //上传接口
,done: function(res){
//上传完毕回调
if(res.status == 1){ //成功
layer.msg("上传成功",{icon:1,time:1000},function(){
$("#imgurl").attr("src",res.data.path); //单图
$("input[name=imgurl]").val(res.data.imgurl);
});
}else{ //失败
layer.msg(res.msg,{icon:2,anim:6,time:1500});
}
}
,error: function(){
//请求异常回调
layer.msg('服务繁忙,请稍后再试',{icon:2,anim:6,time:1500});
}
});
});
function check(){
var url="{:url('/admin/goodslist_edit')}";
var $ = layui.$;
var load=layer.load(2);
$.post(url,$("form").serialize(),function(data){
if(data.status==1){
layer.msg(data.msg,{icon:1,time:1500},function(){
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.layer.close(index);
parent.location.reload();
});
}else{
layer.msg(data.msg,{icon:2,anim:6,time:1500},function(){
layer.close(load);
});
}
})
}
</script>

View File

@ -1,646 +0,0 @@
{include file="Public:header2"/}
<style>
.layui-table-view .layui-table[lay-size=lg] .layui-table-cell {
height: 60px;
line-height: 40px;
}
th>div {
height: 40px !important;
}
</style>
<body>
<div class="layui-fluid">
<div class="layui-card">
<form method="get" class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item" id="select">
<div class="layui-inline">
<div class="layui-input-block" style="margin-left: 0px">
<input type="text" name="title" value="{$Request.get.title}" placeholder="请输入奖品标题"
autocomplete="off" class="layui-input">
</div>
</div>
<input type="hidden" name="goods_id" value="{$goods_id}">
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-useradmin mmm" lay-submit
lay-filter="LAY-user-front-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
<button class="layui-btn" onclick="return goodslist_editAlll()">批量设置</button>
</div>
<div class="layui-inline">
<div>当前第{$num}箱,共{$goods_model['stock']}箱,当前已抽{$reward_num_count}。</div>
</div>
<div class="layui-inline">
<div id="top-page"></div>
</div>
</div>
</form>
<div class="layui-card-body">
<table class="layui-table" lay-filter="goods_extend" id="goods_extend" style="text-align:center">
</table>
</div>
</div>
</div>
{include file="Public:footer"/}
<script type="text/html" id="formModel">
<form id="EditForm" lay-filter="EditForm" class="layui-form" style="padding-right: 20px;padding-left: 20px;">
<div class="layui-row" style="margin-top: 15px;">
<div class="layui-col-xs3">
<select name="rawrd_type" lay-filter="rawrd_type" id="rawrd_type" style="width:99%;">
<!-- <option value="1">保底抽数</option> -->
<option value="2">指定抽数</option>
<!-- <option value="3">范围抽数</option> -->
</select>
</div>
<div class="layui-col-xs9">
<div style="width: 98%;padding-left: 1%;">
<div id="rawrd_type_div">
<input type="number" lay-filter="reward_num" name="reward_num" placeholder="" autocomplete="off" class="layui-input" min="0" step="1" value="" lay-affix="number">
</div>
<div id="rawrd_type_div3" style="display: none;">
<div class="layui-input-inline" style="width:45%;">
<input type="number" lay-filter="reward_num1" name="reward_num1" placeholder="" autocomplete="off" class="layui-input" min="0" step="1" lay-affix="number">
</div>
-
<div class="layui-input-inline" style="width:45%;">
<input type="number" lay-filter="reward_num2" name="reward_num2" placeholder="" autocomplete="off" class="layui-input" min="0" step="1" lay-affix="number">
</div>
</div>
</div>
</div>
</div>
</form>
</script>
<script type="text/javascript">
var tableData = {$list|json_encode|raw};
var goodId = {$goods_id};
function convertUnicodeToString(unicodeString) {
return unicodeString.replace(/\\u[\dA-F]{4}/gi, function (match) {
return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16));
});
}
function isNumber(value) {
const regex = /^-?\d+(\.\d+)?$/;
return regex.test(value);
}
function updateQueryParam(url, param, value) {
let urlObj = new URL(url);
urlObj.searchParams.set(param, value);
return urlObj.toString();
}
var table = null;
var form = null;
layui.use(['layer', 'table', 'layer', 'form', 'laypage'], function () {
var $ = layui.$;
table = layui.table;
form = layui.form;
var laypage = layui.laypage;
laypage.render({
elem: 'top-page',
layout: ['prev','page','next'],
groups: 5,
limit:1,
//
curr:{$num},
count: {$goods_model['stock']}, // 数据总数
prev: '上一箱',
next: '下一箱',
// first: '第一箱',
// last: '最后一项',
jump: function(obj, first){
//obj包含了当前分页的所有参数比如
// console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
//首次不执行
if(!first){
//do something
// console.log(obj.curr);
var load = layer.load(2);
window.location.href=updateQueryParam(window.location.href, "num", obj.curr);//window.location.href.replace("");
}
}
// curr:2
});
const columns = [
{ field: 'id', title: 'ID', type: "checkbox" },
{ title: '序号', type: "numbers", width: 80 },
{ field: 'goods_id', title: '盒子Id', hide: true },
{ field: 'prize_code', title: '奖品编号', hide: true },
// { field: 'id', title: '奖品Id', width: 80 },
{ field: 'title', title: '奖品名称', minwidth: 200, sort: true, templet: (d) => convertUnicodeToString(d.title) },
{ field: 'imgurl', title: '奖品图片', width: 120, templet: (d) => { return `<img src="${d.imgurl}" style="width:60px;height:60px;">` } },
{ field: 'money', title: '奖品兑换价', width: 110, sort: true },
{ field: 'stock', title: '奖品数量', width: 110, sort: true },
{ field: 'surplus_stock', title: '剩余数量', width: 110, sort: true },
{ field: 'price', title: '价格', hide: true },
{ field: 'sort', title: '排序', width: 80, sort: true },
{ field: 'shang_id', title: 'Shang ID', hide: true },
{ field: 'type', title: 'Type', hide: true },
{
field: 'shang', title: '奖赏类型', width: 110, templet: (d) => {
return ` <div ><button class="layui-btn layui-btn-info layui-btn-radius layui-btn-sm">${convertUnicodeToString(d.shang)}</button></div>`
}, sort: true
},
{
field: 'goods_extend_rawrd_type', title: '抽奖类型', width: 130, sort: true, templet: (d) => {
if (d.shang_id >= 10 && d.shang_id <= 33) {
if (d.goods_extend_rawrd_type == 0) {
return '无';
} else if (d.goods_extend_rawrd_type == 1) {
return '保底抽数'
} else if (d.goods_extend_rawrd_type == 2) {
return '指定抽数'
} else if (d.goods_extend_rawrd_type == 3) {
return '抽奖范围'
} else if (d.goods_extend_rawrd_type == 4) {
return '指定用户'
}
return d.goods_extend_reward_num;
}
return '无';
}
},
{
field: 'goods_extend_reward_num', title: '抽奖次数', width: 130, sort: true, templet: (d) => {
if (d.shang_id >= 10 && d.shang_id <= 33) {
if (d.goods_extend_rawrd_type == 0) {
return '无';
}
if (d.goods_extend_rawrd_type == 1) {
return "最少" + d.goods_extend_reward_num + "抽才出现";
}
if (d.goods_extend_rawrd_type == 2) {
return "第" + d.goods_extend_reward_num + "抽必出";
}
if (d.goods_extend_rawrd_type == 3) {
return d.goods_extend_reward_num + "抽~" + d.goods_extend_reward_num_1 + "抽";
}
return d.goods_extend_reward_num;
}
return `无`;
}
},
{
field: '', type: "space", title: '操作', width: 150, templet: (d) => {
if (d.shang_id >= 10 && d.shang_id <= 33) {
return ` <a style="text-decoration:none" title="编辑" onclick="goodslist_edit(${d.id},${d.goods_extend_reward_num})" class="layui-btn layui-btn-radius layui-btn-normal layui-btn-xs">
<i class="layui-icon layui-icon-edit"></i>编辑
</a>
<a style="text-decoration:none" title="重置" onclick="goodslist_del('${d.prize_code}',${d.id})" class="layui-btn layui-btn-radius layui-bg-red layui-btn-xs">
<i class="layui-icon layui-icon-edit"></i>重置
</a>`;
}
return '';
}
},
// { field: 'goods_extend', title: 'Goods Extend' }
];
table.render({
elem: '#goods_extend',
cols: [columns],
data: tableData,
limit: tableData.length,
text: "暂无数据",
size: "lg",
even: true,
height: 'full-180',
done: function (res, curr, count) {
console.log(res, curr, count);
console.log(res.data, tableData);
// 禁用特定行的复选框
for (const index in res.data) {
let item = res.data[index];
// console.log(item);
if (!(item.shang_id >= 10 && item.shang_id <= 33)) {
// console.log();
// document.querySelectorAll('tr[data-index="' + index + '"] td[data-field="id"]')[0].innerHTML = "";
document.querySelectorAll('tr[data-index="' + index + '"] td[data-field="id"] div')[0].style.display = "none";
// var checkbox = document.querySelectorAll('tr[data-index="' + index + '"] input[type="checkbox"]')[0];
// checkbox.disabled = true;
}
}
}
});
table.on('checkbox(goods_extend)', (obj) => {
if (obj.type === 'one' && obj.tr.attr('data-index') == 1) {
obj.checked = false; // 强制取消选中
layui.form.render('checkbox'); // 重新渲染复选框
} else {
}
});
})
var tempvalue = 0;
//编辑奖品
function goodslist_edit(id, content) {
if (content == 0) {
content = "";
}
let tempdatax = tableData.find(it => it.id == id);
if (tempdatax == null) {
layer.msg('数据错误');
// return ;
}
let maxStock = 0;
tableData.map(it => maxStock += it.stock);
console.log(content);
layer.open({
type: 1,
area: ['50%', '40%'],
title: "设置抽奖",
content: $('#formModel').html(),
btn: ['确定', '关闭'],
success: function (layero, index, that) {
// 弹层的最外层元素的 jQuery 对象
console.log(layero);
form.on('select(rawrd_type)', function (data) {
console.log('a');
var elem = data.elem; // 获得 select 原始 DOM 对象
var value = data.value; // 获得被选中的值
var othis = data.othis; // 获得 select 元素被替换后的 jQuery 对象
if (tempvalue == value) {
return;
}
if (tempvalue > 0 && tempvalue != 3 && value < 3) {
return;
}
tempvalue = value;
if (value == 3) {
form.val("EditForm", {
reward_num: 0,
reward_num1: 0,
reward_num2: 0
});
$(layero).find("#rawrd_type_div").hide();
$(layero).find("#rawrd_type_div3").show();
} else {
form.val("EditForm", {
reward_num: 0,
reward_num1: 0,
reward_num2: 0
});
$(layero).find("#rawrd_type_div3").hide();
$(layero).find("#rawrd_type_div").show();
}
// layer.msg(this.innerHTML + ' 的 value: '+ value); // this 为当前选中 <option> 元素对象
});
// 弹层的索引值
console.log(index);
// 弹层内部原型链中的 this --- 2.8+
console.log(that);
var shuju = {
rawrd_type: 2,
reward_num: 0,
reward_num1: 0,
reward_num2: 0
};
if (tempdatax != null) {
if (tempdatax.goods_extend_rawrd_type != 0) {
shuju.rawrd_type = tempdatax.goods_extend_rawrd_type;
}
shuju.reward_num = tempdatax.goods_extend_reward_num;
shuju.reward_num1 = tempdatax.goods_extend_reward_num;
shuju.reward_num2 = tempdatax.goods_extend_reward_num_1;
}
form.val("EditForm", shuju);
tempvalue = 0;
if (tempdatax.goods_extend_rawrd_type == 3) {
$(layero).find("#rawrd_type_div").hide();
$(layero).find("#rawrd_type_div3").show();
} else {
$(layero).find("#rawrd_type_div3").hide();
$(layero).find("#rawrd_type_div").show();
}
form.render();
},
btn1: function (index, layero, that) {
var tdata = form.val("EditForm");
console.log(tdata);
console.log(layero);
var postData = {
reward_num: 0,
reward_num_1: 0,
rawrd_type: 0,
};
//#region 验证
if (tdata.rawrd_type == 3) {
if (tdata.reward_num1 < 0 || tdata.reward_num2 < 0) {
layer.msg('抽奖次数不能小于0');
return;
}
if (tdata.reward_num1 > tdata.reward_num2) {
layer.msg('抽奖范围设置错误');
return;
}
postData.reward_num = parseInt(tdata.reward_num1);
postData.reward_num_1 = parseInt(tdata.reward_num2);
} else {
if (tdata.reward_num < 0) {
layer.msg('抽奖次数不能小于0');
return;
}
if (tdata.reward_num >= maxStock) {
layer.msg('抽奖次数不能大于等于总奖品数量');
return elem.focus();
}
postData.reward_num = parseInt(tdata.reward_num);
postData.reward_num_1 = 0;
}
//#endregion
// reward_num_1
postData.rawrd_type = parseInt(tdata.rawrd_type);
console.log(postData);
save([id], postData, () => {
let tempdata = tableData.find(it => it.id == id);
if (tempdata != null) {
tempdata.goods_extend_rawrd_type = postData.rawrd_type;
tempdata.goods_extend_reward_num = postData.reward_num;
tempdata.goods_extend_reward_num_1 = postData.reward_num_1;
}
table.reload('goods_extend', {
data: tableData
});
layer.close(index);
});
// layer.close(index);
},
btn2: function (index, layero, that) {
layer.close(index);
},
})
return;
}
//编辑奖品
function goodslist_editAlll() {
// debugger
var checkStatus = table.checkStatus('goods_extend');
if (checkStatus.data.length == 0) {
layer.msg('请选择要修改的数据');
return false;
}
let maxStock = 0;
tableData.map(it => maxStock += it.stock);
let tempDate = checkStatus.data.filter(it => it.shang_id >= 10 && it.shang_id <= 33);
console.log(tempDate);
if (tempDate.length == 0) {
layer.msg('请选择要修改的数据');
return false;
}
console.log(tempDate);
let ids = tempDate.map(it => it.id);
console.log(ids);
layer.open({
type: 1,
area: ['50%', '40%'],
title: "设置抽奖",
content: $('#formModel').html(),
btn: ['确定', '关闭'],
success: function (layero, index, that) {
// 弹层的最外层元素的 jQuery 对象
console.log(layero);
form.on('select(rawrd_type)', function (data) {
var elem = data.elem; // 获得 select 原始 DOM 对象
var value = data.value; // 获得被选中的值
var othis = data.othis; // 获得 select 元素被替换后的 jQuery 对象
if (tempvalue == value) {
return;
}
if (tempvalue != 3 && value < 3) {
return;
}
tempvalue = value;
if (value == 3) {
form.val("EditForm", {
reward_num: 0,
reward_num1: 0,
reward_num2: 0
});
$(layero).find("#rawrd_type_div").hide();
$(layero).find("#rawrd_type_div3").show();
} else {
form.val("EditForm", {
reward_num: 0,
reward_num1: 0,
reward_num2: 0
});
$(layero).find("#rawrd_type_div3").hide();
$(layero).find("#rawrd_type_div").show();
}
// layer.msg(this.innerHTML + ' 的 value: '+ value); // this 为当前选中 <option> 元素对象
});
// 弹层的索引值
console.log(index);
// 弹层内部原型链中的 this --- 2.8+
console.log(that);
var shuju = {
rawrd_type: 2,
reward_num: 0,
reward_num1: 0,
reward_num2: 0
};
form.val("EditForm", shuju);
form.render();
},
btn1: function (index, layero, that) {
var tdata = form.val("EditForm");
console.log(tdata);
console.log(layero);
var postData = {
reward_num: 0,
reward_num_1: 0,
rawrd_type: 0,
};
//#region 验证
if (tdata.rawrd_type == 3) {
if (tdata.reward_num1 < 0 || tdata.reward_num2 < 0) {
layer.msg('抽奖次数不能小于0');
return;
}
if (tdata.reward_num1 > tdata.reward_num2) {
layer.msg('抽奖范围设置错误');
return;
}
postData.reward_num = parseInt(tdata.reward_num1);
postData.reward_num_1 = parseInt(tdata.reward_num2);
} else {
if (tdata.reward_num < 0) {
layer.msg('抽奖次数不能小于0');
return;
}
if (tdata.reward_num >= maxStock) {
layer.msg('抽奖次数不能大于等于总奖品数量');
return elem.focus();
}
postData.reward_num = parseInt(tdata.reward_num);
postData.reward_num_1 = 0;
}
//#endregion
// reward_num_1
postData.rawrd_type = parseInt(tdata.rawrd_type);
console.log(postData);
save(ids, postData, () => {
for (const iterator of ids) {
console.log(iterator);
let tempdata = tableData.find(it => it.id == iterator);
if (tempdata != null) {
tempdata.goods_extend_rawrd_type = postData.rawrd_type;
tempdata.goods_extend_reward_num = postData.reward_num;
tempdata.goods_extend_reward_num_1 = postData.reward_num_1;
}
}
table.reload('goods_extend', {
data: tableData
});
layer.close(index);
});
// layer.close(index);
},
btn2: function (index, layero, that) {
layer.close(index);
},
})
return false;
}
//编辑奖品
function goodslist_editAll() {
let content = "";
var checkStatus = table.checkStatus('goods_extend');
if (checkStatus.data.length == 0) {
layer.msg('请选择要修改的数据');
return false;
}
let maxStock = 0;
tableData.map(it => maxStock += it.stock);
let tempDate = checkStatus.data.filter(it => it.shang_id >= 10 && it.shang_id <= 33);
console.log(tempDate);
if (tempDate.length == 0) {
layer.msg('请选择要修改的数据');
return false;
}
console.log(tempDate);
let ids = tempDate.map(it => it.id);
// let idsx = tempDate.map(it =>{ return {id:it.id,prize_code}});
console.log(ids);
layer.prompt({
title: '请输入最低抽奖次数-批量设置', success: function (layero, index, that) {
// 弹层的最外层元素的 jQuery 对象
//变成数字
let t = $(layero[0]).find("input[class=\"layui-layer-input\"]")[0];
if (t != null) {
t.value = content;
t.addEventListener('input', function () {
this.value = this.value.replace(/[^0-9]/g, '');
});
}
},
}, function (value, index, elem) {
console.log(elem);
if (value === '') {
return elem.focus();
}
if (!isNumber(value)) {
layer.msg('请输入数字');
return elem.focus();
}
if (value < 0) {
layer.msg('请输入大于0的数');
return elem.focus();
}
let formattedNum = parseInt(value);
console.log(formattedNum);
if (formattedNum >= maxStock) {
layer.msg('最低抽奖次数不能大于等于总奖品数量');
return elem.focus();
}
save(ids, value, () => {
for (const iterator of ids) {
console.log(iterator);
let tempdata = tableData.find(it => it.id == iterator);
if (tempdata != null) {
tempdata.goods_extend_reward_num = formattedNum;
tempdata.LAY_CHECKED = false;
}
}
table.reload('goods_extend', {
data: tableData
});
layer.close(index);
});
});
return false;
}
function save(ids, content, cal) {
var url = "{:url('/admin/goodsextendlist_edit')}";
var $ = layui.$;
var load = layer.load(2);
$.post(url, { ids: ids, value: content, goodid: goodId }, function (data) {
console.log(data);
layer.close(load);
if (cal) { cal() };
})
}
function goodslist_del(prize_code, id) {
var url = "{:url('/admin/goodsextendlist_del')}";
var $ = layui.$;
var load = layer.load(2);
$.post(url, { goods_list_id: id }, function (data) {
console.log(data);
layer.close(load);
let tempdata = tableData.find(it => it.id == id);
if (tempdata != null) {
tempdata.goods_extend_rawrd_type = 0;
tempdata.goods_extend_reward_num = 0;
tempdata.goods_extend_reward_num_1 = 0;
}
table.reload('goods_extend', {
data: tableData
});
})
}
</script>
</body>
</html>

0
app/admin/view/Public/footer3.html Normal file → Executable file
View File

0
app/admin/view/Public/header3.html Normal file → Executable file
View File

0
app/admin/view/Reward/add.html Normal file → Executable file
View File

0
app/admin/view/Reward/edit.html Normal file → Executable file
View File

0
app/admin/view/Reward/index.html Normal file → Executable file
View File

0
app/admin/view/SignConfig/add.html Normal file → Executable file
View File

0
app/admin/view/SignConfig/edit.html Normal file → Executable file
View File

0
app/admin/view/SignConfig/index.html Normal file → Executable file
View File

0
app/admin/view/SignConfig/reward_edit.html Normal file → Executable file
View File

0
app/admin/view/User/login_stat.html Normal file → Executable file
View File

0
app/admin/view/User/user_integral_detail.html Normal file → Executable file
View File

0
app/admin/view/User/user_money_detail.html Normal file → Executable file
View File

0
app/admin/view/User/user_score_detail.html Normal file → Executable file
View File

0
app/admin/view/welfare_house/add.html Normal file → Executable file
View File

0
app/admin/view/welfare_house/edit.html Normal file → Executable file
View File

0
app/admin/view/welfare_house/index.html Normal file → Executable file
View File

File diff suppressed because it is too large Load Diff

View File

@ -48,7 +48,7 @@ class Base extends MyController
$data['msg'] = "该账户已被封号,请联系客服解封";
exit(json_encode($data, 1));
}
// 检查用户是否有UID如果没有则生成
if (empty($user['uid'])) {
// 获取用户uid配置

0
app/api/controller/Config.php Normal file → Executable file
View File

16
app/api/controller/FuLiWu.php Normal file → Executable file
View File

@ -32,11 +32,15 @@ class FuLiWu extends Base
if ($type_str != 1 && $type_str != 3) {
return $this->renderError('参数错误');
}
$order='sort desc,id desc';
$whe = [];
$whe[] = ['status', '=', $type_str];
$paginate = 15;
$whe[] = ['type', '=', 15];
$whe[] = ['is_open', '=', $type_str == 1 ? 0 : 1];
if($type_str!=1){
$order='open_time desc';
}
$user_id = $this->getUserId();
if ($user_id == 0) {
//充值金额
@ -53,7 +57,7 @@ class FuLiWu extends Base
#盒子
$goods = GoodsModel::where($whe)
->field("id,title,imgurl,price,type,new_is,quanju_xiangou,choujiang_xianzhi,flw_start_time,flw_end_time,open_time,goods_describe,is_open")
->order("sort desc,id desc")->paginate($paginate)->each(function ($itme) {
->order($order)->paginate($paginate)->each(function ($itme) {
$itme['imgurl'] = imageUrl($itme['imgurl']);
$itme['flw_start_time'] = date('Y-m-d H:i:s', $itme['flw_start_time']);
$itme['flw_end_time'] = date('Y-m-d H:i:s', $itme['flw_end_time']);
@ -133,7 +137,7 @@ class FuLiWu extends Base
$goodslist = GoodsList::where('goods_id', '=', $goods_id)
->where('num', '=', 0)
->field('id,title,imgurl,imgurl_detail,stock,price,sc_money,shang_id,surplus_stock,sort')
->order('sort asc')
->order('shang_id desc,sort asc')
->select()
->toArray();
@ -281,9 +285,9 @@ class FuLiWu extends Base
public function fuliwu_user_records(Request $request)
{
$user = $this->getUser();
$user_id = $user['user_id'];
$list = OrderList::where(' user_id', '=', $user_id)
$user_id = $user['id'];
// $user_id = $this->getUserId();
$list = OrderList::where('user_id', '=', $user_id)
->where('order_type', '=', 15)
->field('user_id,addtime,goodslist_title,shang_id,goods_id')
->order('addtime desc')
@ -314,7 +318,7 @@ class FuLiWu extends Base
$user = $this->getUser();
$user_id = $user['user_id'];
$list = OrderList::where(' user_id', '=', $user_id)
$list = OrderList::where('user_id', '=', $user_id)
->where('order_type', '=', 15)
->where('shang_id', '>', 0)
->field('user_id,addtime,goodslist_title,shang_id,goods_id')

View File

@ -22,6 +22,7 @@ use app\common\model\CouponReceive as CouponReceiveModel;
use app\common\model\UserCoupon;
use app\common\model\GoodsType;
use app\common\service\CommonService;
use app\common\model\GoodsExtend;
class Goods extends Base
{
@ -89,7 +90,7 @@ class Goods extends Base
$whe[] = ['type', '=', 16];
} else {
// $whe[] = ['type', 'not in', [4, 10, 15]];
$whe[] = ['type', 'in', 2, 6, 8, 16];
$whe[] = ['type', 'in', [2, 6, 8, 16]];
}
$user_id = $this->getUserId();
@ -435,6 +436,9 @@ class Goods extends Base
foreach ($goodslist_1 as $key_1 => &$value_1) {
$value_1['imgurl'] = imageUrl($value_1['imgurl']);
if ($value_1['shang_id'] == 38) {
unset($value_1['shang_info']);
}
if ($value_1['stock'] == 0) {
//保留两位小数
$value_1['pro'] = '概率:' . round($value_1['real_pro'], 2) . '%';
@ -446,6 +450,7 @@ class Goods extends Base
$surplus_stock_1 = $value_1['surplus_stock'];
$pro_num_1 = 0;
$pro_1 = 0;
if (array_key_exists($value_1['shang_id'], self::$shang_give_arr)) {
#概率
$pro_1 = self::$shang_give_arr[$value_1['shang_id']];
@ -468,9 +473,37 @@ class Goods extends Base
return $this->renderSuccess("请求成功", $goodslist_1);
}
/**
* 获取商品扩展信息
*/
public function getGoodExtend()
{
$goods_id = request()->param('goods_id/d', 0);
$goods_type = request()->param('goods_type/d', 0);
$goods_extend = GoodsExtend::where('goods_id', $goods_id)->find();
if (!$goods_extend) {
// 从goods_type表获取默认值
$goodsType = Db::name('goods_type')
->field('pay_wechat, pay_balance, pay_currency, pay_currency2, pay_coupon, is_deduction')
->where('value', $goods_type)
->find();
if ($goodsType) {
// 如果找到了盒子类型的默认配置
$goods_extend = [
'goods_id' => $goods_id,
'pay_wechat' => $goodsType['pay_wechat'],
'pay_balance' => $goodsType['pay_balance'],
'pay_currency' => $goodsType['pay_currency'],
'pay_currency2' => $goodsType['pay_currency2'],
'pay_coupon' => $goodsType['pay_coupon'],
'is_deduction' => $goodsType['is_deduction']
];
}
}
return $this->renderSuccess("请求成功", $goods_extend);
}
/**
* 换箱箱号
*/
@ -638,16 +671,12 @@ class Goods extends Base
$coupon_id = request()->param('coupon_id/d', 0); //优惠券
#盒子信息
$goods = Goodsmodel::field('title,imgurl_detail,type,price,status,is_shou_zhe,quanju_xiangou,lock_is,choujiang_xianzhi,lock_time')->where(['id' => $goods_id])
$goods = Goodsmodel::field('title,imgurl_detail,type,price,status,is_shou_zhe,quanju_xiangou,lock_is,choujiang_xianzhi,lock_time,daily_xiangou')->where(['id' => $goods_id])
->find();
if (!$goods) {
return $this->renderError("盒子不存在");
}
# 获取盒子类型配置
$goodsType = \app\common\model\GoodsType::where('value', $goods['type'])->find();
if (!$goodsType) {
return $this->renderError("盒子类型配置不存在");
}
if ($goods['status'] != 1) {
return $this->renderError("盒子已下架");
}
@ -655,6 +684,47 @@ class Goods extends Base
if (RegInt($num)) {
return $this->renderError("箱号选择错误");
}
# 获取盒子类型配置
$goods_type = $goods['type'];
$goods_extend = GoodsExtend::getGoodsExtendByGoodsId($goods_id, $goods_type);
if (!$goods_extend) {
return $this->renderError("盒子类型配置不存在");
}
if ($goods['quanju_xiangou'] > 0) {
//限购
$user_toDay_count = OrderList::field('id')->where('goods_id', '=', $goods_id)
->where('user_id', '=', $user['id'])
->where('parent_goods_list_id', '=', 0)
->count();
//已经达到限购先上限
if ($goods['quanju_xiangou'] <= $user_toDay_count) {
return $this->renderError('当前限购' . $goods['quanju_xiangou'] . '次');
}
$now_prize_num = $prize_num + $user_toDay_count;
if ($now_prize_num > $goods['quanju_xiangou']) {
return $this->renderError('购买超出限制,还允许购买' . ($goods['quanju_xiangou'] - $user_toDay_count) . '次');
}
}
if ($goods['daily_xiangou'] > 0) {
//获取今天凌晨时间
$todayMidnight = strtotime('today');
//限购
$user_toDay_count = OrderList::field('id')
->where('goods_id', '=', $goods_id)
->where('user_id', '=', $user['id'])
->where('parent_goods_list_id', '=', 0)
->where('addtime', '>=', $todayMidnight)
->count();
//已经达到限购先上限
if ($user_toDay_count >= $goods['daily_xiangou']) {
return $this->renderError('今日限购' . $goods['daily_xiangou'] . '次');
}
$now_prize_num = $prize_num + $user_toDay_count;
if ($now_prize_num > $goods['daily_xiangou']) {
return $this->renderError('购买超出限制,今日还允许购买' . ($goods['daily_xiangou'] - $user_toDay_count) . '次');
}
}
if ($goods['type'] == 6 && $goods['quanju_xiangou'] > 0) {
//限购
$user_xiangou_count = OrderList::field('id')->where('goods_id', '=', $goods_id)
@ -720,7 +790,7 @@ class Goods extends Base
$coupon_price = 0;
# 判断是否可使用优惠券
if ($shou_zhe_price <= 0 && !empty($coupon_id) && $goodsType['pay_coupon'] == 1) {
if ($shou_zhe_price <= 0 && !empty($coupon_id) && $goods_extend['pay_coupon'] == 1) {
# 获取优惠券信息
$coupon = CouponReceiveModel::where([
'id' => $coupon_id,
@ -754,8 +824,8 @@ class Goods extends Base
if ($shou_zhe_price <= 0) {
$iszhifu = 0;
# 余额抵扣
if ($use_money_is == 1 && $goodsType['pay_balance'] == 1) {
if ($goodsType['is_deduction'] == 1) {
if ($use_money_is == 1 && $goods_extend['pay_balance'] == 1) {
if ($goods_extend['is_deduction'] == 1) {
# 抵扣模式
if ($user['money'] >= $price) {
$use_money = $price;
@ -777,11 +847,10 @@ class Goods extends Base
}
}
}
# 货币1抵扣
if ($use_integral_is == 1 && $goodsType['pay_currency'] == 1) {
if ($use_integral_is == 1 && $goods_extend['pay_currency'] == 1) {
$price_in_currency = $price * 100; # 1:100比例
if ($goodsType['is_deduction'] == 1) {
if ($goods_extend['is_deduction'] == 1) {
# 抵扣模式
if ($user['integral'] >= $price_in_currency) {
$use_integral = $price_in_currency;
@ -803,13 +872,10 @@ class Goods extends Base
}
}
}
# 货币2抵扣
if ($use_money2_is == 1 && $goodsType['pay_currency2'] == 1) {
if ($use_money2_is == 1 && $goods_extend['pay_currency2'] == 1) {
$price_in_currency2 = $price * 100; # 1:100比例
if ($goodsType['is_deduction'] == 1) {
if ($goods_extend['is_deduction'] == 1) {
# 抵扣模式
if (isset($user['money2']) && $user['money2'] >= $price_in_currency2) {
$use_money2 = $price_in_currency2;
@ -831,7 +897,7 @@ class Goods extends Base
}
}
}
if ($goodsType['is_deduction'] == 0 && $iszhifu == 0 && $goodsType['pay_wechat'] == 0) {
if ($goods_extend['is_deduction'] == 0 && $iszhifu == 0 && $goods_extend['pay_wechat'] == 0) {
return $this->renderError('请选择支付方式');
}
}
@ -851,7 +917,8 @@ class Goods extends Base
'score' => $user['money2'],
'use_score' => $use_money2,
'coupon_price' => round($coupon_price, 2),
'coupon_id' => $coupon_id
'coupon_id' => $coupon_id,
'goods_extend' => $goods_extend
];
return $this->renderSuccess("请求成功", $data);
}
@ -877,17 +944,19 @@ class Goods extends Base
$coupon_id = request()->param('coupon_id/d', 0); //优惠券
#盒子信息
$goods = Goodsmodel::field('title,imgurl_detail,type,price,status,is_shou_zhe,quanju_xiangou,lock_is,choujiang_xianzhi,lock_time,flw_start_time,flw_end_time')->where(['id' => $goods_id])
$goods = Goodsmodel::field('title,imgurl_detail,type,price,status,is_shou_zhe,quanju_xiangou,lock_is,choujiang_xianzhi,lock_time,flw_start_time,flw_end_time,daily_xiangou')->where(['id' => $goods_id])
->find();
if (!$goods) {
return $this->renderError("盒子不存在");
}
# 获取盒子类型配置
$goodsType = \app\common\model\GoodsType::where('value', $goods['type'])->find();
if (!$goodsType) {
$goods_type = $goods['type'];
$goods_extend = GoodsExtend::getGoodsExtendByGoodsId($goods_id, $goods_type);
if (!$goods_extend) {
return $this->renderError("盒子类型配置不存在");
}
if ($goods['status'] != 1) {
return $this->renderError("盒子已下架");
}
@ -921,19 +990,39 @@ class Goods extends Base
}
}
}
if ($goods['quanju_xiangou'] > 0) {
// <= $user_xiangou_count
// return $this->renderError('当前活动限购' . $goods['quanju_xiangou'] . '次');
//限购
$user_xiangou_count = OrderList::field('id')->where('goods_id', '=', $goods_id)
$user_toDay_count = OrderList::field('id')->where('goods_id', '=', $goods_id)
->where('user_id', '=', $user['id'])
->where('num', '=', $num)
->where('parent_goods_list_id', '=', 0)
->count();
if ($user_xiangou_count >= $goods['quanju_xiangou']) {
return $this->renderError('当前活动限购' . $goods['quanju_xiangou'] . '次');
//已经达到限购先上限
if ($goods['quanju_xiangou'] <= $user_toDay_count) {
return $this->renderError('当前限购' . $goods['quanju_xiangou'] . '次');
}
$now_prize_num = $prize_num + $user_toDay_count;
if ($now_prize_num > $goods['quanju_xiangou']) {
return $this->renderError('购买超出限制,还允许购买' . ($goods['quanju_xiangou'] - $user_toDay_count) . '次');
}
}
if ($goods['daily_xiangou'] > 0) {
//获取今天凌晨时间
$todayMidnight = strtotime('today');
//限购
$user_toDay_count = OrderList::field('id')
->where('goods_id', '=', $goods_id)
->where('user_id', '=', $user['id'])
->where('parent_goods_list_id', '=', 0)
->where('addtime', '>=', $todayMidnight)
->count();
//已经达到限购先上限
if ($user_toDay_count >= $goods['daily_xiangou']) {
return $this->renderError('今日限购' . $goods['daily_xiangou'] . '次');
}
$now_prize_num = $prize_num + $user_toDay_count;
if ($now_prize_num > $goods['daily_xiangou']) {
return $this->renderError('购买超出限制,今日还允许购买' . ($goods['daily_xiangou'] - $user_toDay_count) . '次');
}
}
if ($goods['type'] != 15) {
@ -1018,7 +1107,7 @@ class Goods extends Base
$coupon_price = 0;
# 判断是否可使用优惠券
if ($shou_zhe_price <= 0 && !empty($coupon_id) && $goodsType['pay_coupon'] == 1) {
if ($shou_zhe_price <= 0 && !empty($coupon_id) && $goods_extend['pay_coupon'] == 1) {
# 获取优惠券信息
$coupon = CouponReceiveModel::where([
'id' => $coupon_id,
@ -1058,8 +1147,8 @@ class Goods extends Base
$iszhifu = 0;
# 余额抵扣
if ($use_money_is == 1 && $goodsType['pay_balance'] == 1) {
if ($goodsType['is_deduction'] == 1) {
if ($use_money_is == 1 && $goods_extend['pay_balance'] == 1) {
if ($goods_extend['is_deduction'] == 1) {
# 抵扣模式
if ($user['money'] >= $price) {
$use_money = $price;
@ -1083,9 +1172,9 @@ class Goods extends Base
}
# 货币1抵扣
if ($use_integral_is == 1 && $goodsType['pay_currency'] == 1) {
if ($use_integral_is == 1 && $goods_extend['pay_currency'] == 1) {
$price_in_currency = $price * 100; # 1:100比例
if ($goodsType['is_deduction'] == 1) {
if ($goods_extend['is_deduction'] == 1) {
# 抵扣模式
if ($user['integral'] >= $price_in_currency) {
$use_integral = $price_in_currency;
@ -1111,9 +1200,9 @@ class Goods extends Base
# 货币2抵扣
if ($use_money2_is == 1 && $goodsType['pay_currency2'] == 1) {
if ($use_money2_is == 1 && $goods_extend['pay_currency2'] == 1) {
$price_in_currency2 = $price * 100; # 1:100比例
if ($goodsType['is_deduction'] == 1) {
if ($goods_extend['is_deduction'] == 1) {
# 抵扣模式
if (isset($user['money2']) && $user['money2'] >= $price_in_currency2) {
$use_money2 = $price_in_currency2;
@ -1136,7 +1225,7 @@ class Goods extends Base
}
}
if ($goodsType['is_deduction'] == 0 && $iszhifu == 0 && $goodsType['pay_wechat'] == 0) {
if ($goods_extend['is_deduction'] == 0 && $iszhifu == 0 && $goods_extend['pay_wechat'] == 0) {
return $this->renderError('请选择支付方式');
}
}
@ -1577,7 +1666,7 @@ class Goods extends Base
if (isset($goods['id'])) {
unset($goods['id']);
}
$goods['status'] = 2;
if ($existingGoods) {
// 更新现有商品
$goodsId = $existingGoods->id;
@ -1598,8 +1687,26 @@ class Goods extends Base
$goodsId = $goodsModel->id;
}
// 处理商品列表数据
// 创建ID映射表用于处理子奖品关联
$idMapping = [];
// 先处理非子奖品goods_list_id为0的奖品
$parentItems = [];
$childItems = [];
// 将奖品分为父奖品和子奖品
foreach ($goodsListData as $listItem) {
if (empty($listItem['goods_list_id'])) {
$parentItems[] = $listItem;
} else {
$childItems[] = $listItem;
}
}
// 先处理父奖品
foreach ($parentItems as $listItem) {
$oldId = $listItem['id'];
// 处理商品列表项
if (isset($listItem['id'])) {
unset($listItem['id']);
@ -1610,6 +1717,30 @@ class Goods extends Base
// 创建新的商品列表项
$goodsListModel = new GoodsList();
$goodsListModel->save($listItem);
// 记录ID映射
$idMapping[$oldId] = $goodsListModel->id;
}
// 再处理子奖品
foreach ($childItems as $listItem) {
$originalParentId = $listItem['goods_list_id'];
// 处理商品列表项
if (isset($listItem['id'])) {
unset($listItem['id']);
}
$listItem['goods_id'] = $goodsId;
// 更新goods_list_id为目标系统中的ID
if (isset($idMapping[$originalParentId])) {
$listItem['goods_list_id'] = $idMapping[$originalParentId];
}
// 创建新的商品列表项
$goodsListModel = new GoodsList();
$goodsListModel->save($listItem);
}
// 提交事务

View File

@ -16,7 +16,7 @@ use think\facade\Db;
use \think\Request;
use app\common\model\Order;
use app\common\model\ProfitMoney;
use PhpOffice\PhpSpreadsheet\Chart\Title;
class Index extends Base
{
@ -86,6 +86,26 @@ class Index extends Base
return $this->renderSuccess("请求成功", $content);
}
/**
* 单页
*/
public function getDanye()
{
$type = \request()->param('type/d', 0);
$info = Danye::where(['id' => $type])->find();
if ($info) {
$content = contentUrl($info['content']);
} else {
$content = '';
}
return $this->renderSuccess("请求成功", [
'content' => $content,
'title' => $info['title']
]);
}
/**
* 获取轮播图
* @return \think\response\Json
@ -216,48 +236,48 @@ class Index extends Base
{
// 获取排行榜类型参数
$type = request()->param('type', '');
// 验证排行榜类型是否有效
$validTypes = ['diamond', 'integral', 'dadajuan', 'invite'];
if (!in_array($type, $validTypes)) {
return $this->renderError('无效的排行榜类型');
}
// 从配置助手获取排行榜时间设置
$timeSettings = \app\common\helper\ConfigHelper::getRankTime($type);
$startTime = !empty($timeSettings['start_time']) ? strtotime($timeSettings['start_time']) : 0;
$endTime = !empty($timeSettings['end_time']) ? strtotime($timeSettings['end_time']) : time();
// 设置分页参数
$page = request()->param('page/d', 1);
$limit = request()->param('limit/d', 10);
// 初始化返回数据
$data = [];
// 根据不同排行榜类型查询数据
switch ($type) {
case 'diamond': // 钻石排行榜
$data = $this->getDiamondRank($startTime, $endTime, $page, $limit);
break;
case 'integral': // UU币排行榜
$data = $this->getIntegralRank($startTime, $endTime, $page, $limit);
break;
case 'dadajuan': // 达达卷排行榜
$data = $this->getDadajuanRank($startTime, $endTime, $page, $limit);
break;
case 'invite': // 邀请新人排行榜
$data = $this->getInviteRank($startTime, $endTime, $page, $limit);
break;
}
// 返回数据
return $this->renderSuccess('请求成功', $data);
}
/**
* 获取钻石排行榜数据
*
@ -273,11 +293,15 @@ class Index extends Base
$where = [
['status', '=', 1],
['use_money', '>', 0],
['user_id', 'not in', function ($query) {
$query->name('user')->where('istest', '>', 0)->where('status', '=', 1)->field('id');
}]
[
'user_id',
'not in',
function ($query) {
$query->name('user')->where('istest', '>', 0)->where('status', '=', 1)->field('id');
}
]
];
// 添加时间范围条件
if ($startTime > 0) {
$where[] = ['pay_time', '>=', $startTime];
@ -285,7 +309,7 @@ class Index extends Base
if ($endTime > 0) {
$where[] = ['pay_time', '<=', $endTime];
}
// 查询数据
$list = Order::where($where)
->field('user_id, sum(use_money) as use_money')
@ -294,7 +318,7 @@ class Index extends Base
->page($page, $limit)
->select()
->toArray();
// 处理用户信息
$rankList = [];
foreach ($list as $index => $item) {
@ -310,10 +334,10 @@ class Index extends Base
];
}
}
return $rankList;
}
/**
* 获取UU币排行榜数据
*
@ -329,11 +353,15 @@ class Index extends Base
$where = [
['status', '=', 1],
['use_integral', '>', 0],
['user_id', 'not in', function ($query) {
$query->name('user')->where('istest', '>', 0)->where('status', '=', 1)->field('id');
}]
[
'user_id',
'not in',
function ($query) {
$query->name('user')->where('istest', '>', 0)->where('status', '=', 1)->field('id');
}
]
];
// 添加时间范围条件
if ($startTime > 0) {
$where[] = ['pay_time', '>=', $startTime];
@ -341,7 +369,7 @@ class Index extends Base
if ($endTime > 0) {
$where[] = ['pay_time', '<=', $endTime];
}
// 查询数据
$list = Order::where($where)
->field('user_id, sum(use_integral) as use_money')
@ -350,7 +378,7 @@ class Index extends Base
->page($page, $limit)
->select()
->toArray();
// 处理用户信息
$rankList = [];
foreach ($list as $index => $item) {
@ -366,10 +394,10 @@ class Index extends Base
];
}
}
return $rankList;
}
/**
* 获取达达卷排行榜数据
*
@ -385,11 +413,15 @@ class Index extends Base
$where = [
['status', '=', 1],
['use_money2', '>', 0],
['user_id', 'not in', function ($query) {
$query->name('user')->where('istest', '>', 0)->where('status', '=', 1)->field('id');
}]
[
'user_id',
'not in',
function ($query) {
$query->name('user')->where('istest', '>', 0)->where('status', '=', 1)->field('id');
}
]
];
// 添加时间范围条件
if ($startTime > 0) {
$where[] = ['pay_time', '>=', $startTime];
@ -397,7 +429,7 @@ class Index extends Base
if ($endTime > 0) {
$where[] = ['pay_time', '<=', $endTime];
}
// 查询数据
$list = Order::where($where)
->field('user_id, sum(use_money2) as use_money')
@ -406,7 +438,7 @@ class Index extends Base
->page($page, $limit)
->select()
->toArray();
// 处理用户信息
$rankList = [];
foreach ($list as $index => $item) {
@ -422,10 +454,10 @@ class Index extends Base
];
}
}
return $rankList;
}
/**
* 获取邀请新人排行榜数据
*
@ -443,7 +475,7 @@ class Index extends Base
['istest', '=', 0], // 排除测试用户
['status', '=', 1] // 只查询状态正常的用户
];
// 添加时间范围条件
if ($startTime > 0) {
$where[] = ['addtime', '>=', $startTime];
@ -451,7 +483,7 @@ class Index extends Base
if ($endTime > 0) {
$where[] = ['addtime', '<=', $endTime];
}
// 查询数据
$list = User::where($where)
->field('pid, COUNT(1) as invite_count')
@ -461,7 +493,7 @@ class Index extends Base
->page($page, $limit)
->select()
->toArray();
// 处理用户信息
$rankList = [];
foreach ($list as $index => $item) {
@ -477,7 +509,7 @@ class Index extends Base
];
}
}
return $rankList;
}

View File

@ -17,8 +17,12 @@ use app\common\model\UserVip;
use app\common\model\UserCoupon;
use think\facade\Db;
use app\common\model\CouponReceive as CouponReceiveModel;
use app\common\model\GoodsExtend;
use \think\Request;
/**
* 无限赏
*/
class Infinite extends Base
{
static $shang_prize_id = [34, 38];#抽奖赏品id
@ -39,6 +43,7 @@ class Infinite extends Base
if ($goods['status'] != 1) {
return $this->renderError("盒子已下架");
}
$goods['addtime'] = date('Y-m-d H:i:s', $goods['addtime']);
$goods['imgurl_detail'] = imageUrl($goods['imgurl_detail']);
@ -125,7 +130,7 @@ class Infinite extends Base
$value['shang_color'] = $value['shang_info']['color'];
unset($value['shang_info']);
}
$goods_list = GoodsList::field('goods_id,shang_id,title,imgurl,price,real_pro,sc_money,goods_type,sale_time,doubling')
$goods_list = GoodsList::field('id,goods_id,shang_id,title,imgurl,price,real_pro,sc_money,goods_type,sale_time,doubling')
->append(['shang_info', 'goods_list'])
->withAttr('imgurl', function ($value, $data) {
return imageUrl($value);
@ -152,6 +157,8 @@ class Infinite extends Base
$type1 = 14;
} elseif ($goods['type'] == 16) {
$type1 = 21;
} elseif ($goods['type'] == 17) {
$type1 = 8;
}
$new_data = [
@ -329,6 +336,42 @@ class Infinite extends Base
return $this->renderSuccess("请求成功", $new_data);
}
/**
* 盒子抽奖记录
* @param \think\Request $request
* @return \think\response\Json
*/
public function infinite_prizerecords(Request $request)
{
$goods_id = request()->param('goods_id/d', 0);
$user_id = $this->getUserId();
// #盒子信息
// $goods = Goodsmodel::field('id,stock,status,type')
// ->where(['id' => $goods_id])
// ->find();
// if (!$goods) {
// return $this->renderError("盒子不存在");
// }
// if ($goods['status'] != 1) {
// return $this->renderError("盒子已下架");
// }
#中奖记录分类
$where = [];
$where[] = ['goods_id', '=', $goods_id];
$where[] = ['num', '=', 0];
$where[] = ['user_id', '=', $user_id];
$data = OrderList::field('user_id,goodslist_title,goodslist_imgurl,addtime')
->where($where)
->where('source', '=', 1)
->order('id desc')
->paginate(100)->each(function ($item) {
$item['addtime'] = date('Y-m-d H:i:s', $item['addtime']);
$item['goodslist_imgurl'] = imageUrl($item['goodslist_imgurl']);
return $item;
});
return $this->renderSuccess("请求成功", $data);
}
/**
* 下单计算金额
*/
@ -343,21 +386,67 @@ class Infinite extends Base
$coupon_id = request()->param('coupon_id/d'); //优惠券
#盒子信息
$goods = Goodsmodel::field('title,imgurl_detail,type,price,status,is_shou_zhe')->where(['id' => $goods_id])
$goods = Goodsmodel::field('id,title,imgurl_detail,type,price,status,is_shou_zhe,quanju_xiangou,daily_xiangou,choujiang_xianzhi')->where(['id' => $goods_id])
->find();
if (!$goods) {
return $this->renderError("盒子不存在");
}
# 获取盒子类型配置
$goodsType = \app\common\model\GoodsType::where('value', $goods['type'])->find();
if (!$goodsType) {
return $this->renderError("盒子类型配置不存在");
}
if ($goods['status'] != 1) {
return $this->renderError("盒子已下架");
}
$goods_type = $goods['type'];
$goods_extend = GoodsExtend::getGoodsExtendByGoodsId($goods_id, $goods_type);
if (!$goods_extend) {
return $this->renderError("盒子类型配置不存在");
}
if ($goods['quanju_xiangou'] > 0) {
//限购
$user_quanju_count = OrderList::field('id')->where('goods_id', '=', $goods_id)
->where('user_id', '=', $user['id'])
->where('parent_goods_list_id', '=', 0)
->count();
//已经达到限购先上限
if ($user_quanju_count >= $goods['quanju_xiangou']) {
return $this->renderError('当前限购' . $goods['quanju_xiangou'] . '次');
}
$now_prize_num = $prize_num + $user_quanju_count;
if ($now_prize_num > $goods['quanju_xiangou']) {
return $this->renderError('购买超出限制,还允许购买' . ($goods['quanju_xiangou'] - $user_quanju_count) . '次');
}
}
if ($goods['daily_xiangou'] > 0) {
//获取今天凌晨时间
$todayMidnight = strtotime('today');
//限购
$user_toDay_count = OrderList::field('id')
->where('goods_id', '=', $goods_id)
->where('user_id', '=', $user['id'])
->where('parent_goods_list_id', '=', 0)
->where('addtime', '>=', $todayMidnight)
->count();
//已经达到限购先上限
if ($user_toDay_count >= $goods['daily_xiangou']) {
return $this->renderError('今日限购' . $goods['daily_xiangou'] . '次');
}
$now_prize_num = $prize_num + $user_toDay_count;
if ($now_prize_num > $goods['daily_xiangou']) {
return $this->renderError('购买超出限制,今日还允许购买' . ($goods['daily_xiangou'] - $user_toDay_count) . '次');
}
}
$user_id = $user['id'];
$choujiang_xianzhi = $goods['choujiang_xianzhi'];
if ($choujiang_xianzhi && $choujiang_xianzhi > 0) {
$user_price = order::where('user_id', '=', $user_id)->where('status', '=', 1)->sum('price');
if ($user_price < $choujiang_xianzhi) {
if ($user['istest'] > 0) {
$user_price = order::where('user_id', '=', $user_id)->where('status', '=', 1)->sum('order_zhe_total');
}
if ($user_price < $choujiang_xianzhi) {
return $this->renderError("消费满" . $choujiang_xianzhi . "元可参与 已消费" . round($user_price, 2) . "");
}
}
}
$goods['imgurl_detail'] = imageUrl($goods['imgurl_detail']);
if ($goods['type'] == 9) {
//连击赏
@ -375,7 +464,7 @@ class Infinite extends Base
$box_price = $goods['price'];
//是否首抽五折
$shou_zhe_price = 0;
$goods_type = $goods['type'];
if ($goods['type'] != 5 && $goods_type != 10) {
$is_chou = Order::field('id')->where([['user_id', '=', $user['id']], ['status', '=', 1]])->find();
$is_chou2 = Order::field('id')->where([['is_shou_zhe', '=', 1], ['status', '=', 1], ['user_id', '=', $user['id']]])->find();
@ -390,16 +479,16 @@ class Infinite extends Base
$order_total = $order_zhe_total = $price;
# 初始化变量
$coupon_id = 0;
$use_money = 0; # 余额抵扣
$use_integral = 0; # 货币1抵扣
$use_money2 = 0; # 货币2抵扣
$zhe = 0; # 会员折扣
$coupon_price = 0; # 优惠券金额
#首抽半价
if ($shou_zhe_price <= 0) {
# 判断是否可使用优惠券
if (!empty($coupon_id) && $goodsType['pay_coupon'] == 1) {
if (!empty($coupon_id) && $goods_extend['pay_coupon'] == 1) {
# 获取优惠券信息
$coupon = CouponReceiveModel::where([
'id' => $coupon_id,
@ -425,19 +514,10 @@ class Infinite extends Base
}
$order_zhe_total = $price;
# 会员折扣
$vip_info = UserVip::where(['id' => $user['vip']])->find();
if ($vip_info && $vip_info['discount'] > 0 && $goods['type'] != 10) {
$zhe = $vip_info['discount'];
$zhe_bl = bcdiv("$zhe", "10", 2);
$order_zhe_total = $price = bcmul("$price", "$zhe_bl", 2);
}
$iszhifu = 0;
# 余额抵扣
if ($use_money_is == 1 && $goodsType['pay_balance'] == 1) {
if ($goodsType['is_deduction'] == 1) {
if ($use_money_is == 1 && $goods_extend['pay_balance'] == 1) {
if ($goods_extend['is_deduction'] == 1) {
# 抵扣模式
if ($user['money'] >= $price) {
$use_money = $price;
@ -460,10 +540,10 @@ class Infinite extends Base
}
}
# 货币1抵扣(吧唧币)
if ($use_integral_is == 1 && $goodsType['pay_currency'] == 1 && $goods_type != 10) {
# 货币1抵扣
if ($use_integral_is == 1 && $goods_extend['pay_currency'] == 1) {
$price_in_currency = $price * 100; # 1:100比例
if ($goodsType['is_deduction'] == 1) {
if ($goods_extend['is_deduction'] == 1) {
# 抵扣模式
if ($user['integral'] >= $price_in_currency) {
$use_integral = $price_in_currency;
@ -489,9 +569,9 @@ class Infinite extends Base
# 货币2抵扣
if ($use_money2_is == 1 && $goodsType['pay_currency2'] == 1) {
if ($use_money2_is == 1 && $goods_extend['pay_currency2'] == 1) {
$price_in_currency2 = $price * 100; # 1:100比例
if ($goodsType['is_deduction'] == 1) {
if ($goods_extend['is_deduction'] == 1) {
# 抵扣模式
if (isset($user['money2']) && $user['money2'] >= $price_in_currency2) {
$use_money2 = $price_in_currency2;
@ -514,29 +594,11 @@ class Infinite extends Base
}
}
if ($goodsType['is_deduction'] == 0 && $iszhifu == 0 && $goodsType['pay_wechat'] == 0) {
if ($goods_extend['is_deduction'] == 0 && $iszhifu == 0 && $goods_extend['pay_wechat'] == 0) {
return $this->renderError('请选择支付方式');
}
} else {
$coupon_id = 0;
$coupon_price = 0;
$use_integral = 0;
$use_money = 0;
$use_money2 = 0;
$zhe = 0;
}
#一发
$goods['price_one'] = (bcmul("{$goods['price']}", "1", 2)) * 1;
#三发
$goods['price_three'] = (bcmul("{$goods['price']}", "3", 2)) * 1;
#五连发
$goods['price_five'] = (bcmul("{$goods['price']}", "5", 2)) * 1;
#十连发
$goods['price_ten'] = (bcmul("{$goods['price']}", "10", 2)) * 1;
#五十发
$goods['price_five_ten'] = (bcmul("{$goods['price']}", "50", 2)) * 1;
#抽奖数量
$goods['prize_num'] = $prize_num;
$data = [
@ -554,6 +616,7 @@ class Infinite extends Base
'use_score' => $use_money2,
'coupon_id' => $coupon_id,
'coupon_price' => round($coupon_price, 2),
'goods_extend' => $goods_extend
];
return $this->renderSuccess("请求成功", $data);
}
@ -578,15 +641,16 @@ class Infinite extends Base
$is_mibao = request()->param('is_mibao/d', 0); //连击赏下 是否是抽的秘宝池 1是 0否
#盒子信息
$goods = Goodsmodel::field('id,title,imgurl_detail,type,price,status,is_shou_zhe,choujiang_xianzhi')->where(['id' => $goods_id])
$goods = Goodsmodel::field('id,title,imgurl_detail,type,price,status,is_shou_zhe,choujiang_xianzhi,quanju_xiangou,daily_xiangou')->where(['id' => $goods_id])
->find();
if (!$goods) {
return $this->renderError("盒子不存在");
}
# 获取盒子类型配置
$goodsType = \app\common\model\GoodsType::where('value', $goods['type'])->find();
if (!$goodsType) {
$goods_type = $goods['type'];
$goods_extend = GoodsExtend::getGoodsExtendByGoodsId($goods_id, $goods_type);
if (!$goods_extend) {
return $this->renderError("盒子类型配置不存在");
}
@ -594,22 +658,62 @@ class Infinite extends Base
return $this->renderError("盒子已下架");
}
if (!in_array($goods['type'], [2, 8, 9, 10,16])) {
if (!in_array($goods['type'], [2, 8, 9, 10, 16, 17])) {
return $this->renderError("非法请求");
}
$user_id = $this->getuserid();
if ($goods['quanju_xiangou'] > 0) {
//限购
$user_toDay_count = OrderList::field('id')->where('goods_id', '=', $goods_id)
->where('user_id', '=', $user['id'])
->where('parent_goods_list_id', '=', 0)
->count();
//已经达到限购先上限
if ($goods['quanju_xiangou'] <= $user_toDay_count) {
return $this->renderError('当前限购' . $goods['quanju_xiangou'] . '次');
}
$now_prize_num = $prize_num + $user_toDay_count;
if ($now_prize_num > $goods['quanju_xiangou']) {
return $this->renderError('购买超出限制,还允许购买' . ($goods['quanju_xiangou'] - $user_toDay_count) . '次');
}
}
if ($goods['daily_xiangou'] > 0) {
//获取今天凌晨时间
$todayMidnight = strtotime('today');
//限购
$user_toDay_count = OrderList::field('id')
->where('goods_id', '=', $goods_id)
->where('user_id', '=', $user['id'])
->where('parent_goods_list_id', '=', 0)
->where('addtime', '>=', $todayMidnight)
->count();
//已经达到限购先上限
if ($user_toDay_count >= $goods['daily_xiangou']) {
return $this->renderError('今日限购' . $goods['daily_xiangou'] . '次');
}
$now_prize_num = $prize_num + $user_toDay_count;
if ($now_prize_num > $goods['daily_xiangou']) {
return $this->renderError('购买超出限制,今日还允许购买' . ($goods['daily_xiangou'] - $user_toDay_count) . '次');
}
}
$user_id = $user['id'];
$choujiang_xianzhi = $goods['choujiang_xianzhi'];
if ($choujiang_xianzhi && $choujiang_xianzhi > 0) {
// SELECT sum(price) FROM xinglanmh_shequt_test.`order` where user_id=4445 and status=1
$user_price = order::where('user_id', '=', $user_id)->where('status', '=', 1)->sum('price');
if ($user_price < $choujiang_xianzhi) {
return $this->renderError("消费满" . $choujiang_xianzhi . "元可参与 已消费" . round($user_price, 2) . "");
if ($user['istest'] > 0) {
$user_price = order::where('user_id', '=', $user_id)->where('status', '=', 1)->sum('order_zhe_total');
}
if ($user_price < $choujiang_xianzhi) {
return $this->renderError("消费满" . $choujiang_xianzhi . "元可参与 已消费" . round($user_price, 2) . "");
}
}
}
$where = [];
$where[] = ['goods_id', '=', $goods_id];
$x = $goods['type'];
if ($goods['type'] == 10) {
if ($goods_type == 10) {
$where[] = ['shang_id', 'between', [10, 33]];
$where[] = ['num', '=', 1];
} else {
@ -666,6 +770,7 @@ class Infinite extends Base
$order_total = $order_zhe_total = $price;
# 初始化变量
$coupon_id = 0;
$use_money = 0; # 余额抵扣
$use_integral = 0; # 货币1抵扣
$use_money2 = 0; # 货币2抵扣
@ -673,17 +778,9 @@ class Infinite extends Base
$coupon_price = 0; # 优惠券金额
#使用折扣
if ($is_shou_zhe == 1) {
$coupon_id = 0;
$coupon_price = 0;
$use_integral = 0;
$use_money = 0;
$use_money2 = 0;
#折扣
$zhe = 0;
} else {
if ($is_shou_zhe <= 0) {
# 判断是否可使用优惠券
if (!empty($coupon_id) && $goodsType['pay_coupon'] == 1) {
if (!empty($coupon_id) && $goods_extend['pay_coupon'] == 1) {
# 获取优惠券信息
$coupon = CouponReceiveModel::where([
'id' => $coupon_id,
@ -708,21 +805,11 @@ class Infinite extends Base
$price = 0;
}
$order_zhe_total = $price;
#折扣
$zhe = 0;
$vip_info = UserVip::where(['id' => $user['vip']])->find();
if ($vip_info && $vip_info['discount'] > 0 && $goods['type'] != 10) {
$zhe = $vip_info['discount'];
$zhe_bl = bcdiv("$zhe", "10", 2);
$order_zhe_total = $price = bcmul("$price", "$zhe_bl", 2);
}
$iszhifu = 0;
# 余额抵扣
if ($use_money_is == 1 && $goodsType['pay_balance'] == 1) {
if ($goodsType['is_deduction'] == 1) {
if ($use_money_is == 1 && $goods_extend['pay_balance'] == 1) {
if ($goods_extend['is_deduction'] == 1) {
# 抵扣模式
if ($user['money'] >= $price) {
$use_money = $price;
@ -744,11 +831,10 @@ class Infinite extends Base
}
}
}
# 货币1抵扣吧唧币
if ($use_integral_is == 1 && $goodsType['pay_currency'] == 1 && $goods['type'] != 10) {
# 货币1抵扣
if ($use_integral_is == 1 && $goods_extend['pay_currency'] == 1) {
$price_in_currency = $price * 100; # 1:100比例
if ($goodsType['is_deduction'] == 1) {
if ($goods_extend['is_deduction'] == 1) {
# 抵扣模式
if ($user['integral'] >= $price_in_currency) {
$use_integral = $price_in_currency;
@ -770,13 +856,10 @@ class Infinite extends Base
}
}
}
# 货币2抵扣
if ($use_money2_is == 1 && $goodsType['pay_currency2'] == 1) {
if ($use_money2_is == 1 && $goods_extend['pay_currency2'] == 1) {
$price_in_currency2 = $price * 100; # 1:100比例
if ($goodsType['is_deduction'] == 1) {
if ($goods_extend['is_deduction'] == 1) {
# 抵扣模式
if (isset($user['money2']) && $user['money2'] >= $price_in_currency2) {
$use_money2 = $price_in_currency2;
@ -799,7 +882,7 @@ class Infinite extends Base
}
}
if ($goodsType['is_deduction'] == 0 && $iszhifu == 0 && $goodsType['pay_wechat'] == 0) {
if ($goods_extend['is_deduction'] == 0 && $iszhifu == 0 && $goods_extend['pay_wechat'] == 0) {
return $this->renderError('请选择支付方式');
}
}
@ -817,6 +900,19 @@ class Infinite extends Base
if ($goods['type'] == 10) {
$num = 1;
}
if ($goods['daily_xiangou'] > 0) {
// 查看一天内有没有未支付的订单,未支付的订单要先作废
$order_info = Order::where('goods_id', '=', $goods_id)
->where('user_id', '=', $user['id'])
->where('num', '=', $num)
->where('status', '=', 0)
->where('addtime', '>=', time() - 86400)
->find();
if ($order_info) {
$order_info->status = 2;
$order_info->save();
}
}
$res = [];
$order_num = create_order_no('MH_', 'order', 'order_num');
#创建订单

View File

@ -22,8 +22,9 @@ use app\common\model\UserRecharge;
use app\common\model\Ads;
use think\facade\Db;
use app\common\model\CouponReceive as CouponReceiveModel;
use app\common\model\GoodsExtendList as GoodsExtendListModel;
use app\common\helper\ConfigHelper;
use app\common\service\RewardService;
/**
* Class Notify 同步处理
* @package app\index\controller
@ -632,44 +633,44 @@ class Notify extends Base
protected function ordinary_prize_notice_box($ordinary_prize, $prize_num, $order_id, $user_id, $goods_id, $order_type, $num)
{
$res = [];
try {
// 过滤掉库存为0的奖品
$valid_prizes = array_filter($ordinary_prize, function($item) {
$valid_prizes = array_filter($ordinary_prize, function ($item) {
return $item['surplus_stock'] > 0;
});
if (empty($valid_prizes)) {
return [0]; // 没有有效奖品
}
// 创建权重数组用于加权随机
$weights = [];
foreach ($valid_prizes as $index => $prize) {
$weights[$index] = $prize['surplus_stock'];
}
// 开普通奖品
for ($i = 0; $i < $prize_num; $i++) {
// 检查是否还有可抽奖品
if (empty($weights) || array_sum($weights) <= 0) {
break;
}
// 使用加权随机算法选择奖品
$selected_index = $this->weightedRandom($weights);
$ordinary_prize_info = $valid_prizes[$selected_index];
// 减少权重以反映库存变化
$weights[$selected_index]--;
// 如果权重为0则从数组中移除
if ($weights[$selected_index] <= 0) {
unset($weights[$selected_index]);
unset($valid_prizes[$selected_index]);
}
$order_goods_info = [
'order_id' => $order_id,
'user_id' => $user_id,
@ -690,36 +691,41 @@ class Notify extends Base
'parent_goods_list_id' => $ordinary_prize_info['goods_list_id'],
'source' => 1, // 标记来源为抽奖
];
// 插入订单商品记录
$res[] = OrderList::insert($order_goods_info);
// 减少库存
$res[] = GoodsList::where(['id' => $ordinary_prize_info['id']])
->dec('surplus_stock')
->update();
// 赠送货币
if (isset($ordinary_prize_info['doubling']) && $ordinary_prize_info['doubling'] > 1) {
$bei = $ordinary_prize_info['doubling'] - 1;
$change_money = $ordinary_prize_info['money'] * $bei * 100;
$res[] = User::changeIntegral($user_id, $change_money, 6, '抽中翻倍赏-' . $ordinary_prize_info['title'] . '赠送');
}
if (isset($ordinary_prize_info['reward_id']) && $ordinary_prize_info['reward_id'] != '') {
RewardService::sendReward($user_id, $ordinary_prize_info['reward_id'], '抽中' . $ordinary_prize_info['title']);
}
// RewardService::sendReward($user['user_id'], $prize['reward_id'], $goods_title . '开奖');
// 处理宝箱奖品
if ($ordinary_prize_info['goods_type'] == 4) {
// 查找宝箱奖品
$goodslist_1 = GoodsList::where(['goods_id' => $goods_id])
->where('goods_list_id', '=', $ordinary_prize_info['id'])
->select()->toArray();
if (!empty($goodslist_1)) {
$box_res = $this->ordinary_prize_notice_box($goodslist_1, 1, $order_id, $user_id, $goods_id, $order_type, $num);
$res = array_merge($res, $box_res);
}
}
}
return $res;
} catch (\Exception $e) {
// 记录错误日志
@ -728,7 +734,7 @@ class Notify extends Base
throw $e;
}
}
/**
* 加权随机算法
* @param array $weights 权重数组
@ -738,14 +744,14 @@ class Notify extends Base
{
$sum = array_sum($weights);
$rand = mt_rand(1, $sum);
foreach ($weights as $index => $weight) {
$rand -= $weight;
if ($rand <= 0) {
return $index;
}
}
return array_key_first($weights); // 防止浮点数精度问题导致无法选中
}
@ -925,7 +931,9 @@ class Notify extends Base
->where(['id' => $ordinary_prize_info['id']])
->dec('surplus_stock')
->update();
if (isset($ordinary_prize_info['reward_id']) && $ordinary_prize_info['reward_id'] != '') {
RewardService::sendReward($user_id, $ordinary_prize_info['reward_id'], '抽中' . $ordinary_prize_info['title']);
}
# 宝箱处理
if ($ordinary_prize_info['goods_type'] == 4) {
# 查找宝箱奖品
@ -985,7 +993,10 @@ class Notify extends Base
->where(['id' => $ordinary_prize_info['id']])
->dec('surplus_stock')
->update();
## 判断是否有奖励
if (isset($ordinary_prize_info['reward_id']) && $ordinary_prize_info['reward_id'] != '') {
RewardService::sendReward($user_id, $ordinary_prize_info['reward_id'], '抽中' . $ordinary_prize_info['title']);
}
# 宝箱处理
if ($ordinary_prize_info['goods_type'] == 4) {
# 查找宝箱奖品
@ -1069,6 +1080,9 @@ class Notify extends Base
#开奖==================================================
if ($order['order_type'] == 10) {
$res[] = $this->infinite_shangchengshang($order);
}
if ($order['order_type'] == 17) {
$res[] = $this->infinite_drawprize_tesu($order);
} else {
$res[] = $this->infinite_drawprize($order);
}
@ -1091,6 +1105,151 @@ class Notify extends Base
}
/**
* 无限赏开奖逻辑
* @param $order 订单信息
*/
protected function infinite_drawprize_tesu($order = [])
{
$user_id = $order['user_id'];#用户ID
$order_id = $order['id'];#订单ID
$goods_id = $order['goods_id'];#盒子ID
$prize_num = $order['prize_num'];#抽奖数量
$order_type = $order['order_type'];#订单类型
$whe = [];
$whe[] = ['id', '=', $order['goods_id']];
$infinite_goods = Goods::getInfo($whe, 'type');
$where = [];
$where[] = ['goods_id', '=', $goods_id];
$where[] = ['num', '=', 0];
$where[] = ['real_pro', '>', 0];
//普通
$where[] = ['lian_ji_type', '=', 0];
$where[] = ['goods_list_id', '=', 0];
#查找奖品
$goodslist = GoodsList::field('id,shang_id,real_pro,stock')
->where($where)
->select()->toArray();
if ($goodslist) {
$res[] = $this->infinite_drawprize_tesu_box($goodslist, $prize_num, $order_id, $user_id, $goods_id, $order_type);
} else {
$res[] = 0;
}
return $res;
}
/**
* 抽出奖品
* @param $order 订单信息
*/
protected function infinite_drawprize_tesu_box($goodslist, $prize_num, $order_id, $user_id, $goods_id, $order_type)
{
// 计算总概率
$totalProbability = array_sum(array_column($goodslist, 'real_pro'));
//获取今天凌晨时间
$todayMidnight = strtotime('today');
// 构建概率区间
$probabilityRanges = [];
$currentRange = 0;
foreach ($goodslist as $good) {
if ($good['stock'] <= 0) {
continue;
}
#判断今日库存
$user_quanju_count = OrderList::field('id')
->where('goods_id', '=', $goods_id)
->where('parent_goods_list_id', '=', 0)
->where('addtime', '>=', $todayMidnight)
->count();
if ($user_quanju_count >= $good['stock']) {
continue;
}
$rangeStart = $currentRange;
$currentRange += $good['real_pro'];
$probabilityRanges[] = [
'id' => $good['id'],
'start' => $rangeStart,
'end' => $currentRange
];
}
$multiple = ConfigHelper::getInfiniteMultiple();
for ($i = 0; $i < $prize_num; $i++) {
// 生成随机数 (保持与原始方法相同的精度100000)
$maxRand = (int) ($totalProbability * $multiple);
$random = mt_rand(0, $maxRand) / $multiple;
// 查找中奖奖品
$prize_id = null;
foreach ($probabilityRanges as $range) {
if ($random >= $range['start'] && $random < $range['end']) {
$prize_id = $range['id'];
break;
}
}
// 获取奖品信息
$prize_info = GoodsList::where(['id' => $prize_id])->find();
#编号
$luck_no = OrderList::field('id')
->where('goods_id', '=', $goods_id)
->where('num', '=', 0)
->where('order_type', '=', $order_type)
->order('id desc')
->value('luck_no');
$luck_no++;
#新增记录
$save_prize_info = [
'order_id' => $order_id,
'user_id' => $user_id,
'status' => 0,#0未操作 1选择兑换 2选择发货
'goods_id' => $goods_id,
'num' => 0,
'doubling' => $prize_info['doubling'],
'shang_id' => $prize_info['shang_id'],
'goodslist_id' => $prize_info['id'],
'goodslist_title' => $prize_info['title'],
'goodslist_imgurl' => $prize_info['imgurl'],
'goodslist_price' => $prize_info['price'],
'goodslist_money' => $prize_info['money'],
'goodslist_type' => $prize_info['goods_type'],
'goodslist_sale_time' => $prize_info['sale_time'],
'addtime' => time(),
'prize_code' => $prize_info['prize_code'],
'order_type' => $order_type,
'luck_no' => $luck_no,
'parent_goods_list_id' => $prize_info['goods_list_id'],
];
#入库===
$res[] = OrderList::insert($save_prize_info);
# 赠送货币
if ($prize_info['doubling'] > 1) {
$bei = $prize_info['doubling'] - 1;
$change_money = $prize_info['money'] * $bei * 100;
$res[] = User::changeIntegral($user_id, $change_money, 6, '抽中翻倍赏-' . $prize_info['title'] . '赠送');
}
if (isset($prize_info['reward_id']) && $prize_info['reward_id'] != '') {
RewardService::sendReward($user_id, $prize_info['reward_id'], '抽中' . $prize_info['title']);
}
# 宝箱
if ($prize_info['goods_type'] == 4) {
# 查找宝箱奖品
$goodslist_1 = GoodsList::where(['goods_id' => $goods_id])
->where('goods_list_id', '=', $prize_info['id'])
->select()->toArray();
// $res[] = $this->infinite_drawprize_box($order);
$res[] = $this->infinite_drawprize_tesu_box($goodslist_1, 1, $order_id, $user_id, $goods_id, $order_type);
}
}
return $res;
}
/**
@ -1232,6 +1391,9 @@ class Notify extends Base
$change_money = $prize_info['money'] * $bei * 100;
$res[] = User::changeIntegral($user_id, $change_money, 6, '抽中翻倍赏-' . $prize_info['title'] . '赠送');
}
if (isset($prize_info['reward_id']) && $prize_info['reward_id'] != '') {
RewardService::sendReward($user_id, $prize_info['reward_id'], '抽中' . $prize_info['title']);
}
# 宝箱
if ($prize_info['goods_type'] == 4) {
# 查找宝箱奖品

0
app/api/controller/Sign.php Normal file → Executable file
View File

0
app/api/controller/WelfareHouse.php Normal file → Executable file
View File

4
app/api/middleware/DomainBind.php Normal file → Executable file
View File

@ -43,11 +43,11 @@ class DomainBind
if (!$this->checkDomain($domain)) {
// 记录被拒绝的请求
\think\facade\Log::warning('域名访问被拒绝: ' . $domain . ', 路径: ' . $path);
return $this->error('域名未授权,无法访问', 403);
return $this->error('未授权,无法访问', 403);
}
// 域名允许,记录请求信息(可选,仅用于调试)
\think\facade\Log::info('域名访问通过: ' . $domain . ', 路径: ' . $path);
// \think\facade\Log::info('域名访问通过: ' . $domain . ', 路径: ' . $path);
// 域名允许,继续处理请求
return $next($request);

View File

@ -39,7 +39,7 @@ Route::any('user_yaoqing', 'Index/get_user_yaoqing');
Route::any('yushourili', 'Index/yushourili');
Route::any('danye', 'Index/danye');
Route::any('getDanye', 'Index/getDanye');
#============================
#User.php个人中心
@ -92,6 +92,7 @@ Route::any('ordermoney', 'Goods/ordermoney');
Route::any('orderbuy', 'Goods/orderbuy');
Route::any('prizeorderlog', 'Goods/prizeorderlog');
Route::any('luck_draw_log', 'Goods/luck_draw_log');
Route::any('getGoodExtend', 'Goods/getGoodExtend');
//首页弹出优惠券
Route::any('coupon', 'Coupon/index');
@ -113,6 +114,7 @@ Route::any('infinite_give_goods', 'Infinite/infinite_give_goods');
Route::any('item_card_chou', 'Infinite/item_card_chou');
Route::any('do_draw', 'Infinite/do_draw'); #抽奖券抽奖
Route::any('ling_zhu_king', 'Infinite/ling_zhu_king'); #领主
Route::any('infinite_prizerecords', 'Infinite/infinite_prizerecords'); #中奖记录
#============================
@ -165,7 +167,7 @@ Route::any('mall_ordermoney', 'Mall/mall_ordermoney');
Route::any('mall_orderbuy', 'Mall/mall_orderbuy');
// 添加API路由
Route::rule('goods/receive_sync', 'Goods/receive_sync', 'POST');
Route::rule('goods_receive_sync', 'Goods/receive_sync', 'POST');
// 配置信息接口
Route::rule('config', 'Config/index', 'GET');

0
app/command/AutoGoodsOffshelf.php Normal file → Executable file
View File

0
app/command/CreateOffshelfLogTable.php Normal file → Executable file
View File

View File

@ -17,7 +17,6 @@ use app\common\model\UserLevelCoupon;
use app\common\model\UserRecharge;
use app\common\model\Ads;
use app\common\model\CouponReceive as CouponReceiveModel;
use app\common\model\GoodsExtendList as GoodsExtendListModel;
use think\facade\Log;
use app\common\model\GoodsList;
use app\common\model\Order;
@ -75,10 +74,7 @@ class FlwOpen extends Command
{
$res = [];
$num = 0; #第几箱
print_r('$goods_id' . $goods_id);
//获取所有的奖品
$goods_list = GoodsList::where('goods_id', '=', $goods_id)
@ -105,7 +101,7 @@ class FlwOpen extends Command
->toArray();
// 如果没有参与用户,直接返回
if (empty($all_order_list)) {
Goods::where(['id' => $goods_id])->update(['is_open' => 1]);
Goods::where(['id' => $goods_id])->update(['is_open' => 1, 'status' => 3]);
return $res;
}
@ -191,8 +187,10 @@ class FlwOpen extends Command
// 更新福利屋状态为已开奖
echo ('福利屋开奖完成 goods_id: ' . $goods_id) . PHP_EOL;
Log::info('福利屋开奖完成 goods_id: ' . $goods_id. PHP_EOL) ;
} else {
echo ('福利屋开奖未完成 goods_id: ' . $goods_id . ', 未处理用户数: ' . $unprocessed_count) . PHP_EOL;
Log::info('福利屋开奖未完成 goods_id: ' . $goods_id . ', 未处理用户数: ' . $unprocessed_count) ;
}
return $res;

0
app/common/helper/ConfigHelper.php Normal file → Executable file
View File

0
app/common/helper/MiniprogramHelper.php Normal file → Executable file
View File

0
app/common/helper/WxPayHelper.php Normal file → Executable file
View File

0
app/common/model/AdvertType.php Normal file → Executable file
View File

View File

@ -0,0 +1,68 @@
<?php
namespace app\common\model;
use app\common\model\Base;
use think\facade\Db;
class GoodsExtend extends Base
{
// 设置数据表名
protected $name = 'goods_extend';
// 设置主键
protected $pk = 'id';
// 自动写入时间戳
protected $autoWriteTimestamp = false;
/**
* 根据盒子ID获取扩展配置
* @param int $goodsId 盒子ID
* @return array|null 盒子扩展配置信息
*/
public static function getByGoodsId($goodsId)
{
return self::where('goods_id', $goodsId)->find();
}
/**
* 删除盒子扩展配置
* @param int $goodsId 盒子ID
* @return bool 删除结果
*/
public static function deleteByGoodsId($goodsId)
{
return self::where('goods_id', $goodsId)->delete();
}
/**
* 根据盒子ID获取扩展配置
* @param int $goodsId 盒子ID
* @param int $goods_type 盒子类型
* @return array|null 盒子扩展配置信息
*/
public static function getGoodsExtendByGoodsId($goodsId, $goods_type)
{
$goods_extend = self::where('goods_id', $goodsId)->find();
if (!$goods_extend) {
// 从goods_type表获取默认值
$goodsType = Db::name('goods_type')
->field('pay_wechat, pay_balance, pay_currency, pay_currency2, pay_coupon, is_deduction')
->where('value', $goods_type)
->find();
if ($goodsType) {
// 如果找到了盒子类型的默认配置
$goods_extend = [
'goods_id' => $goodsId,
'pay_wechat' => $goodsType['pay_wechat'],
'pay_balance' => $goodsType['pay_balance'],
'pay_currency' => $goodsType['pay_currency'],
'pay_currency2' => $goodsType['pay_currency2'],
'pay_coupon' => $goodsType['pay_coupon'],
'is_deduction' => $goodsType['is_deduction']
];
}
}
return $goods_extend;
}
}

View File

@ -1,72 +0,0 @@
<?php
namespace app\common\model;
use app\common\model\Base;
use think\Model;
class GoodsExtendList extends Base
{
// 设置当前模型对应的完整数据表名称
protected $table = 'goods_extend_list';
/**
* 获取列表
*/
public static function getList($where = [], $field = '*', $order = '', $pageSize = "15")
{
$list = self::where($where)
->field($field)
->order($order)
->paginate(['list_rows' => $pageSize, 'query' => request()->param()]);
$page = $list->render();
$data['list'] = $list->toArray()['data'];
$data['count'] = $list->total();
$data['last_page'] = $list->toArray()['last_page'];
$data['page'] = $page;
return $data;
}
/**
* 获取列表 不分页
*/
public static function getAllList($where = [], $field = '*', $order = '', $limit = '0')
{
$data = self::where($where)
->field($field)
->order($order)
->limit($limit)
->select();
return $data;
}
/**
* 获取单条数据
*/
public static function getInfo($where = [], $field = '*')
{
$data = self::where($where)
->field($field)
->find();
return $data;
}
/**
* 获取奖品扩展集合
*/
public static function getGoodsExtendList($goods_id)
{
$data = self::where('goods_id', '=', $goods_id)->select();
return $data;
}
/**
* 获取奖品扩展集合
*/
public static function getGoodsIdExtendList($goods_list_id)
{
$data = self::where('goods_list_id', '=', $goods_list_id)->find();
return $data;
}
}

0
app/common/model/GoodsType.php Normal file → Executable file
View File

0
app/common/model/Reward.php Normal file → Executable file
View File

0
app/common/model/SignConfig.php Normal file → Executable file
View File

0
app/common/model/SignConfigReward.php Normal file → Executable file
View File

0
app/common/model/UserLoginLog.php Normal file → Executable file
View File

0
app/common/model/WelfareHouse.php Normal file → Executable file
View File

0
app/common/service/CommonService.php Normal file → Executable file
View File

0
app/common/service/RewardService.php Normal file → Executable file
View File

11
config/api.php Normal file → Executable file
View File

@ -6,20 +6,15 @@ return [
'localhost',
'127.0.0.1',
'192.168.1.56',
'manghe.zpc-xy.com'
// 添加其他允许的域名
// 'example.com',
// '*.example.com',
'test.zfunbox.cn',
'testapi.zfunbox.cn'
],
# 后台允许访问的域名
'admin_domains' => [
'localhost',
'127.0.0.1',
'192.168.1.56',
'manghe.zpc-xy.com'
// 添加其他允许的域名
// 'example.com',
// '*.example.com',
'test.zfunbox.cn',
],
// 不需要验证域名的白名单路径
'whitelist_paths' => [

View File

@ -224,15 +224,7 @@ return [
],
[
'url' => '/admin/weixinpay',
'name' => '微信支付',
],
[
'url' => '/admin/uploadsFile',
'name' => '图片设置',
],
[
'url' => '/admin/wechatofficialaccount',
'name' => '公众号设置',
'name' => '微信商户设置',
],
[
'url' => '/admin/miniprogram',
@ -240,8 +232,17 @@ return [
],
[
'url' => '/admin/systemconfig',
'name' => '系统置',
'name' => '系统置',
],
[
'url' => '/admin/uploadsFile',
'name' => '图片上传设置',
],
// [
// 'url' => '/admin/wechatofficialaccount',
// 'name' => '公众号设置',
// ],
],
],

345
goods.json Executable file
View File

@ -0,0 +1,345 @@
{
"goods": {
"id": 1023,
"category_id": 0,
"title": "3A\u6e38\u620f\u624b\u67c4",
"imgurl": "https:\/\/mh.shhuanmeng.com\/topic\/20250401\/725d2804734f963d63ec11ab2164e0b6.png",
"imgurl_detail": "https:\/\/mh.shhuanmeng.com\/topic\/20250401\/1709d195b74bad663c10cf0ea5e269cb.png",
"price": "10.00",
"stock": 0,
"sale_stock": 0,
"lock_is": 0,
"lock_time": 0,
"coupon_is": 0,
"coupon_pro": 0,
"integral_is": 0,
"prize_num": 0,
"status": 1,
"sort": 100,
"type": 2,
"show_is": 0,
"show_price": null,
"prize_imgurl": null,
"card_banner": null,
"card_set": null,
"card_notice": null,
"sale_time": 0,
"addtime": 1743496758,
"update_time": 1743497150,
"delete_time": null,
"card_num": 1,
"rage_is": 0,
"rage": 0,
"item_card_id": 0,
"lingzhu_is": 0,
"lingzhu_fan": 0,
"lingzhu_shang_id": 0,
"king_user_id": 0,
"lian_ji_num": 0,
"lian_ji_shang_id": 0,
"is_shou_zhe": 0,
"new_is": 0,
"goods_describe": "",
"quanju_xiangou": 0,
"day_price": "0.00",
"mouth_price": "0.00",
"mouth_pay_price": "0.00",
"day_pay_price": "0.00",
"user_lv": -1,
"is_flw": 0,
"flw_start_time": 0,
"flw_end_time": 0,
"open_time": 0,
"is_open": 0,
"choujiang_xianzhi": 0,
"async_code": "cb29b9c3-5854-4036-a135-9c44fa20994a",
"async_date": "2025-04-08 18:53:48",
"is_auto_xiajia": 1,
"xiajia_lirun": -50,
"xiajia_auto_coushu": 0,
"unlock_amount": "0.00",
"daily_xiangou": 0
},
"goodsList": [{
"id": 122517,
"goods_id": 1023,
"num": 0,
"title": "Sony\/\u7d22\u5c3c Dualsense \u65e0\u7ebf\u624b\u67c4",
"imgurl": "https:\/\/mh.shhuanmeng.com\/topic\/20250401\/aa375bfc9a1777e6d546469b4b1f9593.png",
"stock": 0,
"surplus_stock": 0,
"price": "528.00",
"money": "528.00",
"sc_money": "528.00",
"real_pro": "0.10000",
"goods_type": 1,
"sale_time": 0,
"sort": 0,
"shang_id": 34,
"reward_num": 0,
"rank": 0,
"give_money": 0,
"special_stock": -100,
"card_no": null,
"prize_code": "9PpN60rert_1743496908",
"addtime": 1743496908,
"update_time": 0,
"prize_num": 0,
"type": 0,
"lian_ji_type": 0,
"reward_id": null,
"imgurl_detail": null,
"doubling": 0,
"goods_list_id": 0
}, {
"id": 122518,
"goods_id": 1023,
"num": 0,
"title": "Razer\u96f7\u86c7 \u5e7b\u5f71\u6218\u72fcV2 \u9ed1\u8272",
"imgurl": "https:\/\/mh.shhuanmeng.com\/topic\/20250401\/182ed0fd18d6a31ad7e9d9c9a408a30d.png",
"stock": 0,
"surplus_stock": 0,
"price": "519.00",
"money": "519.00",
"sc_money": "519.00",
"real_pro": "0.10800",
"goods_type": 1,
"sale_time": 0,
"sort": 0,
"shang_id": 34,
"reward_num": 0,
"rank": 0,
"give_money": 0,
"special_stock": -100,
"card_no": null,
"prize_code": "mnHNVtFnHL_1743496943",
"addtime": 1743496943,
"update_time": 0,
"prize_num": 0,
"type": 0,
"lian_ji_type": 0,
"reward_id": null,
"imgurl_detail": null,
"doubling": 0,
"goods_list_id": 0
}, {
"id": 122519,
"goods_id": 1023,
"num": 0,
"title": "Nintendo switch \u4e13\u4e1a\u624b\u67c4pro",
"imgurl": "https:\/\/mh.shhuanmeng.com\/topic\/20250401\/87571bb9329de4e84d9ee6f2641d5881.png",
"stock": 0,
"surplus_stock": 0,
"price": "499.00",
"money": "499.00",
"sc_money": "499.00",
"real_pro": "0.11000",
"goods_type": 1,
"sale_time": 0,
"sort": 0,
"shang_id": 34,
"reward_num": 0,
"rank": 0,
"give_money": 0,
"special_stock": -100,
"card_no": null,
"prize_code": "6gHY4NIeVd_1743496969",
"addtime": 1743496969,
"update_time": 0,
"prize_num": 0,
"type": 0,
"lian_ji_type": 0,
"reward_id": null,
"imgurl_detail": null,
"doubling": 0,
"goods_list_id": 0
}, {
"id": 122520,
"goods_id": 1023,
"num": 0,
"title": "\u9ed1\u9ca8 \u7eff\u5e7d\u7075\u7cbe\u82f1\u624b\u67c4",
"imgurl": "https:\/\/mh.shhuanmeng.com\/topic\/20250401\/083688eda86351c82acd2f6f7db96f5a.png",
"stock": 0,
"surplus_stock": 0,
"price": "449.00",
"money": "449.00",
"sc_money": "449.00",
"real_pro": "0.13200",
"goods_type": 1,
"sale_time": 0,
"sort": 0,
"shang_id": 34,
"reward_num": 0,
"rank": 0,
"give_money": 0,
"special_stock": -100,
"card_no": null,
"prize_code": "HtBPUZjF2E_1743497015",
"addtime": 1743497015,
"update_time": 0,
"prize_num": 0,
"type": 0,
"lian_ji_type": 0,
"reward_id": null,
"imgurl_detail": null,
"doubling": 0,
"goods_list_id": 0
}, {
"id": 122521,
"goods_id": 1023,
"num": 0,
"title": "EGOGO \u80d6\u8fbe\u7845\u80f6\u5c0f\u591c\u706fx1\u4e2a(\u62cd\u62cd\u6b3e-\u4e09\u6321\u8c03\u8282)",
"imgurl": "https:\/\/mh.shhuanmeng.com\/topic\/20250401\/c6e71d8535e9a3636637c23eed483496.png",
"stock": 0,
"surplus_stock": 0,
"price": "55.00",
"money": "55.00",
"sc_money": "55.00",
"real_pro": "1.64000",
"goods_type": 1,
"sale_time": 0,
"sort": 0,
"shang_id": 35,
"reward_num": 0,
"rank": 0,
"give_money": 0,
"special_stock": -100,
"card_no": null,
"prize_code": "SdTQCffI9e_1743497038",
"addtime": 1743497038,
"update_time": 0,
"prize_num": 0,
"type": 0,
"lian_ji_type": 0,
"reward_id": null,
"imgurl_detail": null,
"doubling": 0,
"goods_list_id": 0
}, {
"id": 122522,
"goods_id": 1023,
"num": 0,
"title": "\u53c8\u6e34\u4e50\u56ed \u690d\u7269\u529f\u80fd\u996e\u6599 400mlx5\u74f6 \u968f\u673a5\u74f6",
"imgurl": "https:\/\/mh.shhuanmeng.com\/topic\/20250401\/525e4dc566d8fae2044800a07b0fa212.png",
"stock": 0,
"surplus_stock": 0,
"price": "45.00",
"money": "45.00",
"sc_money": "45.00",
"real_pro": "7.91000",
"goods_type": 4,
"sale_time": 0,
"sort": 0,
"shang_id": 35,
"reward_num": 0,
"rank": 0,
"give_money": 0,
"special_stock": -100,
"card_no": null,
"prize_code": "RAjKZjGSIy_1743497061",
"addtime": 1743497061,
"update_time": 1743955618,
"prize_num": 0,
"type": 0,
"lian_ji_type": 0,
"reward_id": "",
"imgurl_detail": "",
"doubling": 0,
"goods_list_id": 0
}, {
"id": 122523,
"goods_id": 1023,
"num": 0,
"title": "\u83ab\u6bd4\u4e4c\u65af\u73af\u6212\u6307 x1(\u5f00\u53e3\u53ef\u8c03\u8282\u5c3a\u5bf8)",
"imgurl": "https:\/\/mh.shhuanmeng.com\/topic\/20250401\/e08168bece3aa962838c8f6a0cc6e5d4.png",
"stock": 0,
"surplus_stock": 0,
"price": "10.00",
"money": "2.50",
"sc_money": "10.00",
"real_pro": "90.00000",
"goods_type": 1,
"sale_time": 0,
"sort": 0,
"shang_id": 38,
"reward_num": 0,
"rank": 0,
"give_money": 0,
"special_stock": -100,
"card_no": null,
"prize_code": "PFv8RT8sHB_1743497090",
"addtime": 1743497090,
"update_time": 0,
"prize_num": 0,
"type": 0,
"lian_ji_type": 0,
"reward_id": null,
"imgurl_detail": null,
"doubling": 0,
"goods_list_id": 0
}, {
"id": 122584,
"goods_id": 1023,
"num": 0,
"title": "\u73ab\u7470\u8354\u679d",
"imgurl": "https:\/\/mh.shhuanmeng.com\/topic\/20250407\/7f511d54276150136179f06148c9a22e.png",
"stock": 0,
"surplus_stock": 0,
"price": "20.00",
"money": "20.00",
"sc_money": "20.00",
"real_pro": "20.00000",
"goods_type": 1,
"sale_time": 0,
"sort": 0,
"shang_id": 35,
"reward_num": 0,
"rank": 0,
"give_money": 0,
"special_stock": -100,
"card_no": null,
"prize_code": "gPXh7GEuuk_1743955689",
"addtime": 1743955689,
"update_time": 0,
"prize_num": 0,
"type": 0,
"lian_ji_type": 0,
"reward_id": "",
"imgurl_detail": "",
"doubling": 0,
"goods_list_id": 122522
}, {
"id": 122585,
"goods_id": 1023,
"num": 0,
"title": "\u5c71\u68a8\u8377\u53f6",
"imgurl": "https:\/\/mh.shhuanmeng.com\/topic\/20250407\/c677e8c872a2790674c13bda6ce8d847.png",
"stock": 0,
"surplus_stock": 0,
"price": "20.00",
"money": "20.00",
"sc_money": "20.00",
"real_pro": "80.00000",
"goods_type": 1,
"sale_time": 0,
"sort": 0,
"shang_id": 35,
"reward_num": 0,
"rank": 0,
"give_money": 0,
"special_stock": -100,
"card_no": null,
"prize_code": "JLsAtDQB4P_1743955746",
"addtime": 1743955746,
"update_time": 0,
"prize_num": 0,
"type": 0,
"lian_ji_type": 0,
"reward_id": "",
"imgurl_detail": "",
"doubling": 0,
"goods_list_id": 122522
}],
"async_code": "cb29b9c3-5854-4036-a135-9c44fa20994a",
"sync_time": 1744110248
}

0
public/js/reward-component.js Normal file → Executable file
View File

0
public/js/v2.10.3/layui/css/layui.css Normal file → Executable file
View File

0
public/js/v2.10.3/layui/font/iconfont.eot Normal file → Executable file
View File

0
public/js/v2.10.3/layui/font/iconfont.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 326 KiB

After

Width:  |  Height:  |  Size: 326 KiB

0
public/js/v2.10.3/layui/font/iconfont.ttf Normal file → Executable file
View File

0
public/js/v2.10.3/layui/font/iconfont.woff Normal file → Executable file
View File

0
public/js/v2.10.3/layui/font/iconfont.woff2 Normal file → Executable file
View File

0
public/js/v2.10.3/layui/layui.js Normal file → Executable file
View File

0
public/static/admin/reward-component.js Normal file → Executable file
View File

BIN
public/storage/poster/share/5.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

0
public/storage/poster/share/6148.png Normal file → Executable file
View File

0
public/storage/poster/share/6157.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

0
public/storage/poster/share/6158.png Normal file → Executable file
View File

0
public/storage/poster/share/6165.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 391 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

3847
table.sql Normal file → Executable file

File diff suppressed because it is too large Load Diff

0
抽奖算法优化说明.md Normal file → Executable file
View File