chore: src/app 目录与华为云第一台服务器上的代码做第一次比较合并

This commit is contained in:
2025-11-22 15:00:41 +08:00
parent c1170aafa8
commit f03dbbfc60
53 changed files with 3726 additions and 1228 deletions

View File

@@ -22,7 +22,7 @@ return [
'name' => 'MINGPIAN_INFO',
'title' => '电子名片',
'parent' => 'BASICS_LINK',
'wap_url' => '',
'wap_url' => '/pages/contact/contact',
'web_url' => '',
'sort' => 0
]

View File

@@ -0,0 +1,146 @@
<style>
.upload-img-block .upload-img-box .upload-default{position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);}
</style>
<div class="layui-form form-wrap">
<div class="layui-form-item">
<label class="layui-form-label short-label"><span class="required">*</span>文件名称:</label>
<div class="layui-input-inline">
<input type="text" name="files_title" lay-verify="required" maxlength="40" autocomplete="off" placeholder="请输入标题" class="layui-input len-long">
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item">
<label class="layui-form-label"><span class="required">*</span>文件:</label>
<div class="layui-input-block">
<p class="file-upload">未上传</p>
<button type="button" class="layui-btn" id="cert_upload">
<i class="layui-icon">&#xe67c;</i>上传文件
</button>
<input type="hidden" name="files_url" class="layui-input len-long" value="{$info.files_url ?? ''}" lay-verify="files_url">
<input type="hidden" name="size" class="layui-input len-long" value="{$info.size ?? ''}">
</div>
<div class="word-aux">请选择pdf文件</div>
</div>
</div>
<div class="form-row" id="save">
<button class="layui-btn" lay-submit lay-filter="save">提交</button>
<button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
</div>
<!-- <div class="form-row" id="save1" style="display: none;">
<div style="color:red">(文件越大解码时间越长)上传解码中,请稍等...</div>
</div> -->
</div>
<script>
var form,repeat_flag,
IMAGE_MAX = 9, //最多可以上传多少张图片
imageCollection = [], //图片集合
selectedGoodsId = [],
goods_id = [],
goods_list =[];
layui.use(['form'], function() {
form = layui.form;
repeat_flag = false;
form.render();
// 单图上传
$("body").off("click", "#img").on("click", "#img", function () {
openAlbum(function (data) {
imageCollection = [];
imageCollection.push(data[0].pic_path);
imageCollection.splice(1, imageCollection.length);
var val = '<img src="' + ns.img(imageCollection[0]) + '" alt="">';
$("#img").html(val);
}, 1);
});
/**
* 表单提交(立即发布)
*/
form.on('submit(save)', function(data){
field = data.field;
field.status = 1;
formSubmit(field)
});
new Upload({
elem: '#cert_upload',
url: ns.url("personnel://shop/enterprise/uploadfile"),
accept: 'file',
callback:function (res) {
if (res.code >= 0) {
layer.msg('上传成功');
$("input[name='files_url']").val(res.data.path);
$("input[name='size']").val(res.data.size);
$("input[name='files_url']").siblings(".file-upload").text("已上传");
}
}
});
});
/**
* 提交
*/
function formSubmit(data){
// if (!imageCollection.length){
// layer.msg('请选择封面图!', {icon: 5, anim: 6});
// return;
// }
// $('#save').hide()
// $('#save1').show()
if(repeat_flag) return;
repeat_flag = true;
setTimeout(function (a) {
console.log(1236)
$.ajax({
type: 'POST',
dataType: 'JSON',
url: ns.url("personnel://shop/enterprise/add"),
data: data,
async: false,
success: function(res){
repeat_flag = false;
if (res.code == 0) {
layer.confirm('添加成功', {
title:'操作提示',
btn: ['返回列表', '继续添加'],
closeBtn: 0,
yes: function(index, layero){
if(data.status == 1){
location.hash = ns.hash("personnel://shop/enterprise/lists");
}else{
location.hash = ns.hash("personnel://shop/enterprise/drafts");
}
layer.close(index);
},
btn2: function(index, layero) {
listenerHash(); // 刷新页面
layer.close(index);
}
});
}else{
layer.msg(res.message);
}
$('#save').show()
$('#save1').hide()
}
})
}, 1000);
}
function back() {
location.hash = ns.hash("personnel://shop/enterprise/lists");
}
</script>

View File

@@ -0,0 +1,137 @@
<style>
.upload-img-block .upload-img-box .upload-default{position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);}
</style>
<div class="layui-form form-wrap">
<div class="layui-form-item">
<label class="layui-form-label short-label"><span class="required">*</span>文件标题:</label>
<div class="layui-input-inline">
<input type="text" name="files_title" value="{$info.files_title}" lay-verify="required" maxlength="40" autocomplete="off" placeholder="请输入标题" class="layui-input len-long">
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item">
<label class="layui-form-label"><span class="required">*</span>文件:</label>
<div class="layui-input-block">
{notempty name="$info.files_url"}
<p class="file-upload">已上传</p>
{else/}
<p class="file-upload">未上传</p>
{/notempty}
<button type="button" class="layui-btn" id="cert_upload">
<i class="layui-icon">&#xe67c;</i>上传文件
</button>
<input type="hidden" name="files_url" class="layui-input len-long" value="{$info.files_url ?? ''}" lay-verify="files_url">
<input type="hidden" name="size" class="layui-input len-long" value="{$info.size ?? ''}">
</div>
<div class="word-aux">请选择pdf文件</div>
</div>
</div>
<input type="hidden" name="files_id" value="{$info.files_id}" />
<div class="form-row" id="save">
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
<button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
</div>
<!-- <div class="form-row" id="save1" style="display: none;">
<div style="color:red">(文件越大解码时间越长)上传解码中,请稍等...</div>
</div> -->
</div>
<script>
var form,upload, repeat_flag = false;
layui.use(['form'], function() {
form = layui.form;
form.render();
/**
* 表单提交(立即发布)
*/
form.on('submit(save)', function(data){
field = data.field;
field.status = 1;
formSubmit(field)
});
new Upload({
elem: '#cert_upload',
url: ns.url("/personnel://shop/enterprise/uploadfile"),
accept: 'file',
callback:function (res) {
if (res.code >= 0) {
layer.msg('上传成功');
$("input[name='files_url']").val(res.data.path);
$("input[name='size']").val(res.data.size);
$("input[name='files_url']").siblings(".file-upload").text("已上传");
}
}
});
});
/**
* 提交
*/
function formSubmit(field)
{
// if (!imageCollection.length){
// layer.msg('请选择封面图!', {icon: 5, anim: 6});
// return;
// }
// $('#save').hide()
// $('#save1').show()
if(repeat_flag) return;
repeat_flag = true;
setTimeout(function (a) {
$.ajax({
type: 'POST',
dataType: 'JSON',
url: ns.url("personnel://shop/enterprise/edit"),
data: field,
async: false,
success: function(res){
repeat_flag = false;
if (res.code == 0) {
layer.confirm('编辑成功', {
title:'操作提示',
btn: ['返回列表', '继续编辑'],
yes: function(index, layero){
if(field.status == 1){
location.hash = ns.hash("personnel://shop/enterprise/lists");
}else{
location.hash = ns.hash("personnel://shop/enterprise/drafts");
}
layer.close(index);
},
btn2: function(index, layero) {
layer.close(index);
}
});
}else{
layer.msg(res.message);
}
}
})
}, 1000);
}
function back() {
location.hash = ns.hash("personnel://shop/enterprise/lists");
}
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,155 @@
<!-- 搜索框 -->
<div class="single-filter-box top">
<button class="layui-btn" onclick="add()">添加文件</button>
<div class="layui-form">
<div class="layui-input-inline">
<input type="text" name="search_text" placeholder="请输入标题" autocomplete="off" class="layui-input">
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
<i class="layui-icon">&#xe615;</i>
</button>
</div>
</div>
</div>
<input id="url" value="" type="hidden"></input>
<!-- 列表 -->
<table id="files_list" lay-filter="files_list"></table>
<!-- 操作 -->
<script type="text/html" id="operation">
<div class="table-btn">
<!-- <a class="layui-btn" lay-event="copy">复制链接</a> -->
<a class="layui-btn" lay-event="edit">编辑</a>
<a class="layui-btn" lay-event="delete">删除</a>
</div>
</script>
<!-- 用户信息 -->
<script type="text/html" id="info">
<div class='table-title'>
<div class='title-pic headimg'>
<img layer-src src="{{ns.img('addon/personnel/shop/view/enterprise/fileicon.png')}}" onerror="this.src = '{:img('addon/personnel/shop/view/enterprise/fileicon.png')}' ">
</div>
<div class='title-content'>
<p class="layui-elip" style="font-weight: 600;color:#000">{{d.files_title}}</p>
</div>
</div>
</script>
<script>
var form,laytpl,table, repeat_flag = false;//防重复标识;
layui.use(['form','laytpl'], function() {
form = layui.form;
laytpl = layui.laytpl;
form.render();
table = new Table({
elem: '#files_list',
url: ns.url("personnel://shop/enterprise/lists"),
cols: [
[ {
field: 'files_title',
title: '文件名称',
width: '30%',
unresize: 'false',
templet: '#info'
},
// {
// field: 'category_name',
// title: '文件分类',
// width: '20%',
// unresize: 'false'
// },
/*{
field: 'create_time',
title: '创建时间',
width: '20%',
unresize: 'false',
templet: function (data) {
return ns.time_to_date(data.createtime);
}
}, */{
title: '操作',
toolbar: '#operation',
unresize: 'false',
align : 'right'
}]
],
});
/**
* 搜索功能
*/
form.on('submit(search)', function(data) {
table.reload({
page: {
curr: 1
},
where: data.field
});
});
table.on("sort",function (obj) {
table.reload({
page: {
curr: 1
},
where: {
order:obj.field,
sort:obj.type
}
});
});
/**
* 监听工具栏操作
*/
table.tool(function(obj) {
var data = obj.data;
switch (obj.event) {
case 'copy': // 推广
// promote(data);
$('#url').val(data.url)
console.log(data.files_url)
ns.copy('url')
break;
case 'edit': //编辑
location.hash = ns.hash("personnel://shop/enterprise/edit?files_id=" + data.files_id);
break;
case 'delete': //删除
deletefiles(data.files_id);
break;
}
});
});
/**
* 删除
*/
function deletefiles(files_id) {
if (repeat_flag) return false;
repeat_flag = true;
layer.confirm('确定要删除该文件吗?', function (index) {
layer.close(index);
$.ajax({
url: ns.url("personnel://shop/enterprise/delete"),
data: {files_id},
dataType: 'JSON',
type: 'POST',
success: function (res) {
layer.msg(res.message);
repeat_flag = false;
if (res.code == 0) {
table.reload();
}
}
});
},
function () {
repeat_flag = false;
layer.close();
});
}
function add() {
location.hash = ns.hash("personnel://shop/enterprise/add");
}
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

View File

@@ -0,0 +1,168 @@
<!-- 搜索框 -->
<div class="single-filter-box top">
<button class="layui-btn" onclick="add()">添加文件</button>
<div class="layui-form">
<div class="layui-input-inline">
<input type="text" name="search_text" placeholder="请输入标题" autocomplete="off" class="layui-input">
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
<i class="layui-icon">&#xe615;</i>
</button>
</div>
</div>
</div>
<input id="url" value="" type="hidden"></input>
<!-- 列表 -->
<table id="files_list" lay-filter="files_list"></table>
<!-- 操作 -->
<script type="text/html" id="operation">
<div class="table-btn">
<!-- <a class="layui-btn" lay-event="copy">复制链接</a> -->
<a class="layui-btn" lay-event="edit">编辑</a>
<a class="layui-btn" lay-event="delete">删除</a>
</div>
</script>
<!-- 用户信息 -->
<script type="text/html" id="info">
<div class='table-title'>
<div class='title-pic headimg'>
<img layer-src src="{{ns.img('/addon/personnel/view/enterprise/fileicon.png')}}" onerror="this.src = '{:img('app/shop/view/files/fileicon.png')}' ">
</div>
<div class='title-content'>
<p class="layui-elip" style="font-weight: 600;color:#000">{{d.files_title}}</p>
<!-- <p class="layui-elip" style="line-height: 1.2;color:#888;font-size: 12px;">发布时间{{ns.time_to_date(d.createtime)}}</p> -->
<!-- <p class="layui-elip" style="color:#888;font-size: 12px;">样本大小{{d.size}}</p> -->
<!-- <div>
<span title="{{ d.mobile }}">{{ d.mobile }}</span>
{{# if (d.status == 0 || d.member_level_type == 1){ }}
{{# if (d.status == 0){ }}
<span class="blacklist">黑名单</span>
{{# } }}
{{# if (d.member_level_type == 1){ }}
<span class="vip_style">SVIP</span>
{{# } }}
{{# } }}
</div> -->
</div>
</div>
</script>
<script>
var form,laytpl,table, repeat_flag = false;//防重复标识;
layui.use(['form','laytpl'], function() {
form = layui.form;
laytpl = layui.laytpl;
form.render();
table = new Table({
elem: '#files_list',
url: ns.url("personnel://shop/enterprise/lists"),
cols: [
[ {
field: 'files_title',
title: '文件名称',
width: '30%',
unresize: 'false',
templet: '#info'
},
// {
// field: 'category_name',
// title: '文件分类',
// width: '20%',
// unresize: 'false'
// },
/*{
field: 'create_time',
title: '创建时间',
width: '20%',
unresize: 'false',
templet: function (data) {
return ns.time_to_date(data.createtime);
}
}, */{
title: '操作',
toolbar: '#operation',
unresize: 'false',
align : 'right'
}]
],
});
/**
* 搜索功能
*/
form.on('submit(search)', function(data) {
table.reload({
page: {
curr: 1
},
where: data.field
});
});
table.on("sort",function (obj) {
table.reload({
page: {
curr: 1
},
where: {
order:obj.field,
sort:obj.type
}
});
});
/**
* 监听工具栏操作
*/
table.tool(function(obj) {
var data = obj.data;
switch (obj.event) {
case 'copy': // 推广
// promote(data);
$('#url').val(data.url)
console.log(data.files_url)
ns.copy('url')
break;
case 'edit': //编辑
location.hash = ns.hash("personnel://shop/enterprise/edit?files_id=" + data.files_id);
break;
case 'delete': //删除
deletefiles(data.files_id);
break;
}
});
});
/**
* 删除
*/
function deletefiles(files_id) {
if (repeat_flag) return false;
repeat_flag = true;
layer.confirm('确定要删除该文件吗?', function (index) {
layer.close(index);
$.ajax({
url: ns.url("personnel://shop/enterprise/delete"),
data: {files_id},
dataType: 'JSON',
type: 'POST',
success: function (res) {
layer.msg(res.message);
repeat_flag = false;
if (res.code == 0) {
table.reload();
}
}
});
},
function () {
repeat_flag = false;
layer.close();
});
}
function add() {
location.hash = ns.hash("personnel://shop/enterprise/add");
}
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

View File

@@ -26,15 +26,13 @@ class Config extends BaseApi
//注册协议
$document_info = $config_model->getRegisterDocument($site_id, 'shop');
//隐私协议
//隐私协议
$rivacy_info = $config_model->getRrivacyDocument($site_id, 'shop');
if($type == 1){//注册
$config = $document_info;
}else{//隐私
$config = $rivacy_info;
}
return $this->response($config);
}

View File

@@ -124,9 +124,16 @@ class Goods extends BaseApi
public function shareImg()
{
$qrcode_param = json_decode($this->params[ 'qrcode_param' ] ?? '{}', true);
$poster = new Poster();
$res = $poster->shareImg($this->params[ 'page' ] ?? '', $qrcode_param, $this->site_id, $this->store_id);
//临时解决分享
$goods = model('goods')->getInfo(['goods_id'=>$qrcode_param['goods_id']]);
$img = explode(',',$goods['goods_image']);
$res['code'] = 0;
$res['data'] = [
'path'=>$img[0]
];
return $this->response($res);
}
/**

View File

@@ -244,7 +244,7 @@ class Goodssku extends BaseApi
// 查询子级
$category_child_list = $goods_category_model->getCategoryList([ [ 'pid', '=', $category_id ], [ 'site_id', '=', $this->site_id ] ], 'category_id,pid,level')[ 'data' ];
$temp_category_list = [];
if (!empty($category_list)) {
$temp_category_list = $category_list;
@@ -333,7 +333,20 @@ class Goodssku extends BaseApi
$join = [
[ 'goods g', 'gs.sku_id = g.sku_id', 'inner' ]
];
file_put_contents(__DIR__ . '/debug.txt', var_export($condition,true));
// 如果是连锁运营模式
if ($this->store_data[ 'config' ][ 'store_business' ] == 'store') {
$join[] = [ 'store_goods_sku sgs', 'sgs.status = 1 and g.sku_id = sgs.sku_id and sgs.store_id=' . $this->store_id, 'right' ];
$condition[] = [ 'g.sale_store', 'like', [ '%all%', '%,' . $this->store_id . ',%' ], 'or' ];
$field = str_replace('gs.price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sgs.price), gs.price) as price', $field);
$field = str_replace('gs.discount_price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sgs.price), gs.price) as discount_price', $field);
if ($this->store_data[ 'store_info' ][ 'stock_type' ] == 'store') {
$field = str_replace('gs.stock', 'IFNULL(sgs.stock, 0) as stock', $field);
}
}
$goods = new Goods();
$list = $goods->getGoodsSkuPageList($condition, $page, $page_size, $order_by, $field, $alias, $join);

View File

@@ -14,12 +14,36 @@ use addon\wxoplatform\model\Config as WxOplatformConfigModel;
use app\model\web\Config as WebConfig;
use think\facade\Log;
use app\model\system\Seal as SealModel;
use Carbon\Carbon;
class Lucky extends BaseApi
{
public function newtest(){
$sealModel = new SealModel();
$params = [
"filename" => "20250625030540175079194017513.xlsx",
"path" => "upload/2035/common/seal/sealmedium_import/20250625/20250625030540175079194017513.xlsx",
"index" => "1",
"success_num" => "0",
"error_num" => "0",
"record" => "0"
];
$res = $sealModel->importMedium($params, 2035);
}
//生成pdf
public function pdf(){
}
// 生成 NFC 跳转 URL Scheme
function generateNFCScheme($accessToken) {
$url = "https://api.weixin.qq.com/wxa/generatenfcscheme?access_token={$accessToken}";

View File

@@ -601,4 +601,12 @@ class Member extends BaseApi
model('personnel_message')->add($insert);
return $this->response(['code'=>0,'message'=>'留言成功~']);
}
public function getbusiness(){
$token = $this->checkToken();
if ($token[ 'code' ] < 0) return $this->response($token);
$list = model('business')->getList([]);
return $this->response(['code'=>0,'data'=>$list]);
}
}

View File

@@ -16,7 +16,6 @@ class Rrapi
*/
public function test()
{
exit;
$model = new Rrmodel();
//同步流程 首先同步所有公众号-》同步商品分类-》同步商品-》同步diy首页-》diy会员-》diy自定义页面-》单独同步vr链接
$uniacid = 1083;//设置大于0同步单个

View File

@@ -0,0 +1,269 @@
<?php
namespace app\api\controller;
use app\model\system\Seal as SealModel;
use Mpdf\Mpdf;
class Seal extends BaseApi
{
public function getimg($keyword){
// 设置内容类型为PNG图片
header('Content-Type: image/png');
$sealModel = new SealModel();
$info = $sealModel->getInfo('seal_medium',['name'=>$keyword]);
$type = ['数据不详','推荐使用','有条件使用','不推荐使用','不能使用'];
$value = [];
if($info['data']){
$value = json_decode($info['data']['value'],true);
}
// dump($value);
// 图片尺寸
$width = 640;
$height = 1280;
// 创建画布
$image = imagecreatetruecolor($width, $height);
// 颜色定义
$white = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0);
$gray = imagecolorallocate($image, 200, 200, 200);
$darkGray = imagecolorallocate($image, 100, 100, 100);
// 填充背景
imagefill($image, 0, 0, $white);
// 设置字体路径(确保服务器上有此字体文件)
$font = PUBLIC_PATH . 'static/font/Microsoft.ttf'; // 宋体字体,支持中文
// if (!file_exists($font)) {
// $font = 'arial.ttf'; // 备用字体
// }
// 添加标题
imagettftext($image, 24, 0, 280, 50, $black, $font, "乙醛");
// 模拟你的数据
// $value = [
// ['text' => '项目1', 'value' => '值1', 'color' => '#FF0000'],
// ['text' => '项目2', 'value' => '值2', 'color' => '#00FF00'],
// ['text' => '项目3', 'value' => '', 'color' => '#0000FF'],
// ];
$type = ['值1' => '类型1', '值2' => '类型2'];
// 表格参数
$startY = 80;
$rowHeight = 40;
$col1Width = 240;
$col2Width = 500;
// 绘制表格边框
imagerectangle($image, 30, $startY, $width-30, $startY + count($value) * $rowHeight, $black);
// 绘制表格内容
foreach ($value as $index => $item) {
$y = $startY + $index * $rowHeight;
// 绘制行线
imageline($image, 30, $y, $width-30, $y, $black);
$item['color'] = $item['color']?$item['color']:'#FFFFFF';
// 解析颜色
$color = sscanf($item['color'], "#%02x%02x%02x");
$textColor = imagecolorallocate($image, $color[0], $color[1], $color[2]);
// dump($textColor);
// 第一列
$bgColor = sscanf(ltrim($item['color'], '#'), "%02x%02x%02x");
$cellBgColor = imagecolorallocate($image, $bgColor[0], $bgColor[1], $bgColor[2]);
imagefilledrectangle($image, 30, $y, 30 + $col1Width, $y + $rowHeight, $cellBgColor);
imagettftext($image, 14, 0, 50, $y + 25, $black, $font, $item['text']);
// 第二列
$displayValue = '数据不详';
imagettftext($image, 14, 0, 30 + $col1Width + 20, $y + 25, $textColor, $font, $displayValue);
// dump($color);
// echo $index.'<br/>';
// break;
// 列分隔线
imageline($image, 30 + $col1Width, $y, 30 + $col1Width, $y + $rowHeight, $black);
}
// 输出PNG图片
$time = time();
imagepng($image,'upload/1/pdfs/'.$time.'.png');
imagedestroy($image);
// echo '<img src="/upload/1/pdfs/a.png">';
return 'upload/1/pdfs/'.$time.'.png';
}
public function getpdf($id){
header('Content-Type: text/html; charset=UTF-8');
$sealModel = new SealModel();
$info = $sealModel->getInfo('seal_medium',['id'=>$id]);
try {
// 创建 mPDF 实例并配置
$mpdf = new \Mpdf\Mpdf([
'autoScriptToLang' => true,
'autoLangToFont' => true,
'mode' => 'utf-8', // 设置编码模式
'format' => 'A4', // 设置页面格式
'orientation' => 'P', // 页面方向 P-纵向/L-横向
'default_font_size' => 12, // 默认字体大小
'default_font' => 'sans-serif', // 默认字体
'margin_left' => 15, // 左边距(毫米)
'margin_right' => 15, // 右边距
'margin_top' => 16, // 上边距
'margin_bottom' => 16, // 下边距
'margin_header' => 9, // 页眉边距
'margin_footer' => 9 // 页脚边距
]);
// 设置文档信息(可选)
// $mpdf->SetTitle('乙醛');
// $mpdf->SetAuthor('你的名字');
// $mpdf->SetCreator('PHP mPDF');
// $mpdf->SetSubject('mPDF 示例');
// $mpdf->SetKeywords('mPDF, PHP, PDF, 示例');
// 添加页眉(可选)
// $mpdf->SetHTMLHeader('
// <div style="text-align: right; font-weight: bold;">
// 乙醛
// </div>
// ');
// 添加页脚(可选)
// $mpdf->SetHTMLFooter('
// <table width="100%">
// <tr>
// <td width="33%">{DATE j-m-Y}</td>
// <td width="33%" align="center">{PAGENO}/{nbpg}</td>
// <td width="33%" style="text-align: right;">乙醛</td>
// </tr>
// </table>
// ');
$type = ['数据不详','推荐使用','有条件使用','不推荐使用','不能使用'];
$value = [];
if($info['data']){
$value = json_decode($info['data']['value'],true);
// foreach($value as &$item){
// $item['value'] = $item['value']?$type[$item['value']]:'数据不详';
// }
// $info['data']['value'] = $value;
}
// dump($value);
// 准备 HTML 内容
$html = '
<h1 style="text-align: center; color: #333;">乙醛</h1>
<table border="1" cellspacing="0" cellpadding="5" width="100%">
<!--<thead>
<tr>
<th width="30%">项目</th>
<th width="40%">描述</th>
</tr>
</thead>-->
<tbody>';
foreach($value as &$item){
// $item['value'] = $item['value']?$type[$item['value']]:'数据不详';
$html .= '<tr>
<td style="background: '.$item['color'].';">'.$item['text'].'</td>
<td style="color: '.$item['color'].';">'.($item['value']?$type[$item['value']]:'数据不详').'</td>
</tr>';
}
$html .= '</tbody>
</table>
';
// echo $html;exit;
// 写入 HTML 内容
$mpdf->WriteHTML($html);
// 输出 PDF
// 方式1直接在浏览器中打开
// $mpdf->Output('example.pdf', \Mpdf\Output\Destination::INLINE);
// 方式2强制下载
// $mpdf->Output('example.pdf', \Mpdf\Output\Destination::DOWNLOAD);
$directory = 'upload/1/pdfs/';
$time = time();
if (!file_exists($directory)) {
// 尝试创建目录(递归创建多级目录)
if (!mkdir($directory, 0755, true)) {
// 创建失败处理
die("无法创建目录: $directory");
}
// echo "目录创建成功: $directory";
}
// 方式3保存到服务器
$pdf = $directory.'/'.$time.'.pdf';
$mpdf->Output($pdf, \Mpdf\Output\Destination::FILE);
return $pdf;
} catch (\Mpdf\MpdfException $e) {
// 处理异常
// echo '生成PDF时出错: ' . $e->getMessage();
}
}
/**
* 基础信息
*/
public function info()
{
$sealModel = new SealModel();
$keyword = $this->params['keyword'] ?? '';
$info = $sealModel->getInfo('seal_medium',['name'=>$keyword]);
//1推荐使用2有条件使用3不推荐使用4不能使用空格数据不详
$type = ['数据不详','推荐使用','有条件使用','不推荐使用','不能使用'];
if($info['data']){
$value = json_decode($info['data']['value'],true);
foreach($value as &$item){
$item['value'] = $item['value']?$type[$item['value']]:'数据不详';
}
$info['data']['value'] = $value;
//生成pdf和img
if(!$info['data']['files_url']){
$pdf = $this->getpdf($info['data']['id']);
if($pdf){
model('seal_medium')->update(['files_url'=>$pdf],['id'=>$info['data']['id']]);
$info['data']['files_url'] = $pdf;
}
}
$info['data']['img_url'] = $this->getimg($keyword);
}
return $this->response($info['data']);
// $help_id = $this->params['id'] ?? 0;
// if (empty($help_id)) {
// return $this->response($this->error('', 'REQUEST_ID'));
// }
// $help = new HelpModel();
// $info = $help->getHelpInfo($help_id);
// return $this->response($info);
}
public function search(){
$sealModel = new SealModel();
$keyword = $this->params['keyword'] ?? '';
$list = $sealModel->getList('seal_medium',[['name','like','%'.$keyword.'%']]);
return $this->response(['code'=>0,'list'=>$list]);
}
/**
* 基础信息
*/
public function getstructure()
{
$sealModel = new SealModel();
$condition[] = [ 'site_id', '=', $this->site_id ];
$field = '*';
$list = $sealModel->getTree1($condition, $field);
if (request()->isJson()) return $list;
return $this->response($list);
}
}

View File

@@ -1,406 +1,416 @@
@CHARSET "UTF-8";
/*图文导航组件*/
.digit-navigation .preview-draggable .preview-box {
padding: 8px 0;
margin: 0 15px;
border-radius: 5px;
}
.digit-navigation .preview-draggable ul {
overflow: hidden;
list-style: none;
}
.digit-navigation .preview-draggable ul.horizontal-scroll {
overflow-x: scroll;
white-space: nowrap;
}
.digit-navigation .preview-draggable ul.horizontal-scroll::-webkit-scrollbar {
display: none;
}
.digit-navigation .preview-draggable li {
width: 50%;
text-align: center;
display: inline-block;
vertical-align: top;
}
.digit-navigation .preview-draggable li img {
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
}
.digit-navigation .preview-draggable li:last-child {
border: 0;
}
.digit-navigation .preview-draggable li span {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
height: 20px;
display: block;
line-height: 20px;
}
/*.digit-navigation .preview-draggable .digit-nav{visibility: hidden;}*/
.digit-navigation .preview-draggable .digit-nav>.wrap {
/* overflow-x: hidden;white-space: nowrap; background: #ffffff; */
display: flex;
/* justify-content: space-around; */
flex-wrap: wrap;
padding: 0 5px;
}
.digit-navigation .digit-nav-list .template-list .template-item {
float: left;
text-align: center;
border: 1px solid #e5e5e5;
margin-right: 20px;
padding: 5px;
background: #ffffff;
cursor: pointer;
}
.digit-navigation .digit-nav-list .template-list .template-item img {
display: block;
}
.digit-navigation .add-item {
padding: 10px;
border: 1px dashed #e5e5e5;
margin: 16px 0 10px;
cursor: pointer;
text-align: center;
}
.digit-navigation .add-item i {
display: inline-block;
height: 24px;
line-height: 24px;
font-size: 18px;
margin-right: 10px;
font-style: normal;
}
.digit-navigation .add-item span {
display: inline-block;
height: 24px;
line-height: 24px;
}
.digit-navigation .error-msg {
margin: 5px 0 0 53px;
color: #f44;
display: none;
}
/* 新的css */
.digit-navigation .digit-nav{
padding: 10px 5px;
}
/* 预览 */
/* 固定显示 */
.digit-navigation .digit-nav.fixed{
display: flex;
flex-wrap: wrap;
}
/* 单边滑动 */
.digit-navigation .digit-nav.singleSlide{
display: flex;
overflow-x: auto;
}
.digit-navigation .digit-nav.singleSlide::-webkit-scrollbar {
height: 5px;
}
.digit-navigation .digit-nav.singleSlide::-webkit-scrollbar-track {
background-color: #e4e4e4;
}
.digit-navigation .digit-nav.singleSlide::-webkit-scrollbar-thumb {
background-color: #999;
}
.digit-navigation .digit-nav.singleSlide .digit-nav-item{
flex-shrink: 0;
}
/* 分页 */
.digit-navigation .digit-nav.pageSlide{
position: relative;
}
.digit-navigation .digit-nav.pageSlide .digit-nav-wrap{
display: flex;
flex-wrap: wrap;
width: 100%;
height: 100%;
}
.digit-navigation .digit-nav.pageSlide .carousel-btn{
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .arrows{
display: flex;
justify-content: space-between;
padding: 0 15px;
position: relative;
top: 50%;
transform: translateY(-50%);
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .arrows i{
display: none;
width: 36px;
height: 36px;
line-height: 36px;
text-align: center;
color: #fff;
background-color: rgba(0, 0, 0, .35);
border-radius: 50%;
cursor: pointer;
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .dot-wrap{
text-align: center;
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .dot-wrap.hide{
display: none;
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .dot-wrap.straightLine i{
width: 12px;
height: 4px;
border-radius: 0;
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .dot-wrap i{
display: inline-block;
width: 7px;
height: 7px;
border-radius: 50%;
background-color: rgba(0, 0, 0, .1);
margin-right: 5px;
cursor: pointer;
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .dot-wrap i.active{
background-color: rgba(0, 0, 0, .5);
}
.digit-navigation .digit-nav.pageSlide .carousel-btn:hover .arrows i{
display: block;
}
.digit-navigation .digit-nav .digit-nav-item{
display: flex;
flex-direction: column;
align-items: center;
padding: 7px 0;
box-sizing: border-box;
}
.newright{
margin-right: 10px;
}
.digit-navigation .digit-nav .digit-nav-item .digit-text{
padding-top: 6px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
width: 100%;
text-align: center;
}
.digit-navigation .digit-nav .digit-nav-item .digit-img{
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 50px;
height: 50px;
font-size: 40px;
}
.digit-navigation .digit-nav .digit-nav-item .digit-img .tag{
position: absolute;
top: -5px;
right: -12px;
color: #fff;
background-color: red;
border-radius: 12px;
border-bottom-left-radius: 0;
transform: scale(0.8);
padding: 2px 6px;
font-size: 12px;
}
.digit-navigation .digit-nav .digit-nav-item .digit-img img{
max-width: 100%;
max-height: 100%;
}
.digit-navigation .digit-nav .digit-nav-item .digit-img i{
font-size: 25px;
color: #666;
}
/* 图文导航项 */
.digit-navigation p.hint {
padding-left: 15px;
font-size: 12px;
color: #909399;
line-height: 20px;
}
.digit-navigation .digit-nav-list>ul {
padding: 10px 0 10px 15px;
}
.digit-navigation .digit-nav-list>ul>li {
padding: 10px 10px 10px 0px;
background: #ffffff;
border: 1px dashed #e5e5e5;
position: relative;
margin-top: 16px;
}
.digit-navigation .digit-nav-list>ul>li>.iconfont {
position: absolute;
top: calc(50% - 10px);
left: 15px;
cursor: move;
font-size: 20px;
}
.digit-navigation .digit-nav-list>ul>li:first-child {
margin-top: 0;
}
.digit-navigation .digit-nav-list>ul>li:hover .del {
display: block;
}
.digit-navigation .edit-attribute .attr-wrap .restore-wrap .img-block, .digit-navigation .edit-attribute .attr-wrap .restore-wrap .img-block.has-choose-image > div{
width: 50px;
height: 50px;
line-height: 50px;
}
.digit-navigation .edit-attribute .attr-wrap .restore-wrap .img-block.has-choose-image img {
width: 35px;
height: 35px;
}
.digit-navigation .edit-attribute .icon-box {
width: 60px;
height: 60px;
font-size: 60px;
border: 1px dashed #ddd;
display: flex;
align-items: center;
justify-content: center;
padding: 0!important;
cursor: pointer;
position: relative;
}
.digit-navigation .edit-attribute .icon-box .select-icon {
width: inherit;
height: inherit;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
line-height: 1;
}
.digit-navigation .edit-attribute .icon-box .select-icon .add {
font-size: 26px;
color: var(--base-color);
}
.digit-navigation .edit-attribute .icon-box .operation {
position: absolute;
width: 100%;
height: 100%;
background: rgba(0,0,0,.6);
flex-direction: column;
display: none;
}
.digit-navigation .edit-attribute .icon-box:hover .operation {
display: flex;
}
.digit-navigation .edit-attribute .icon-box .operation-warp {
flex: 1;
height: 0;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
}
.digit-navigation .edit-attribute .icon-box .iconfont {
margin: 0 3px;
font-size: 16px!important;
}
.digit-navigation .edit-attribute .icon-box .operation .js-replace{
line-height: 1;
color: #fff;
text-align: center;
padding: 5px 0;
background: rgba(0,0,0,.7);
font-size: 12px;
height: unset;
}
.digit-navigation .edit-attribute .digit-nav-list .icon-box .icon-wrap:hover .operation{
display: block;
}
.digit-navigation .edit-attribute .digit-nav-list .img-upload .upload-img-box:hover .operation{
display: block;
}
.digit-navigation .edit-attribute .navigation-set-list .img-upload {
display: flex;
align-items: center;
}
.digit-navigation .edit-attribute .navigation-set-list .img-upload img {
width: 100%;
height: 100%;
}
.digit-navigation .edit-attribute .navigation-set-list .action-box {
display: flex;
}
.digit-navigation .edit-attribute .navigation-set-list .action {
margin-right: 3px;
width: 42px;
height: 28px;
line-height: 28px;
text-align: center;
border: 1px solid #EEEEEE;
cursor: pointer;
}
.digit-navigation .edit-attribute .navigation-set-list .action:hover {
border-color: var(--base-color);
color: var(--base-color);
}
.digit-navigation .img-icon-box{
display: flex;
align-items: center;
@CHARSET "UTF-8";
.digit-navigation .preview-draggable {padding: 0;}
.digit-navigation .audio-wrap audio{width: 100%;position: relative;}
.digit-navigation .edit-attribute .attr-wrap .restore-wrap .audio-add-box .img-block {width: 200px !important;height: 125px !important;margin-bottom: 30px;margin-right: 0;position: relative;}
.digit-navigation .edit-attribute .attr-wrap .restore-wrap .audio-add-box .img-block > div {line-height: 125px;height: 125px !important;width: 100%;text-align: center;}
.digit-navigation .edit-attribute .attr-wrap .restore-wrap .audio-add-box .img-block audio {width: 100% !important;height: 125px !important;}
.digit-navigation .edit-attribute .attr-wrap .restore-wrap .audio-add-box .img-block span{position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);}
.digit-navigation .audio-zhezhao {position: absolute;background: #fff;width: 61%;height: 125px;top: 1px;right: 32px;text-align: center;line-height: 105px;display: none;}
.digit-navigation .audio-zhezhao span {position: absolute;top: 35px;left: 80px;color: #909399;}
/*图文导航组件*/
.digit-navigation .preview-draggable .preview-box {
padding: 8px 0;
margin: 0 15px;
border-radius: 5px;
}
.digit-navigation .preview-draggable ul {
overflow: hidden;
list-style: none;
}
.digit-navigation .preview-draggable ul.horizontal-scroll {
overflow-x: scroll;
white-space: nowrap;
}
.digit-navigation .preview-draggable ul.horizontal-scroll::-webkit-scrollbar {
display: none;
}
.digit-navigation .preview-draggable li {
width: 50%;
text-align: center;
display: inline-block;
vertical-align: top;
}
.digit-navigation .preview-draggable li img {
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
}
.digit-navigation .preview-draggable li:last-child {
border: 0;
}
.digit-navigation .preview-draggable li span {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
height: 20px;
display: block;
line-height: 20px;
}
/*.digit-navigation .preview-draggable .digit-nav{visibility: hidden;}*/
.digit-navigation .preview-draggable .digit-nav>.wrap {
/* overflow-x: hidden;white-space: nowrap; background: #ffffff; */
display: flex;
/* justify-content: space-around; */
flex-wrap: wrap;
padding: 0 5px;
}
.digit-navigation .digit-nav-list .template-list .template-item {
float: left;
text-align: center;
border: 1px solid #e5e5e5;
margin-right: 20px;
padding: 5px;
background: #ffffff;
cursor: pointer;
}
.digit-navigation .digit-nav-list .template-list .template-item img {
display: block;
}
.digit-navigation .add-item {
padding: 10px;
border: 1px dashed #e5e5e5;
margin: 16px 0 10px;
cursor: pointer;
text-align: center;
}
.digit-navigation .add-item i {
display: inline-block;
height: 24px;
line-height: 24px;
font-size: 18px;
margin-right: 10px;
font-style: normal;
}
.digit-navigation .add-item span {
display: inline-block;
height: 24px;
line-height: 24px;
}
.digit-navigation .error-msg {
margin: 5px 0 0 53px;
color: #f44;
display: none;
}
/* 新的css */
.digit-navigation .digit-nav{
padding: 10px 5px;
}
/* 预览 */
/* 固定显示 */
.digit-navigation .digit-nav.fixed{
display: flex;
flex-wrap: wrap;
}
/* 单边滑动 */
.digit-navigation .digit-nav.singleSlide{
display: flex;
overflow-x: auto;
}
.digit-navigation .digit-nav.singleSlide::-webkit-scrollbar {
height: 5px;
}
.digit-navigation .digit-nav.singleSlide::-webkit-scrollbar-track {
background-color: #e4e4e4;
}
.digit-navigation .digit-nav.singleSlide::-webkit-scrollbar-thumb {
background-color: #999;
}
.digit-navigation .digit-nav.singleSlide .digit-nav-item{
flex-shrink: 0;
}
/* 分页 */
.digit-navigation .digit-nav.pageSlide{
position: relative;
}
.digit-navigation .digit-nav.pageSlide .digit-nav-wrap{
display: flex;
flex-wrap: wrap;
width: 100%;
height: 100%;
}
.digit-navigation .digit-nav.pageSlide .carousel-btn{
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .arrows{
display: flex;
justify-content: space-between;
padding: 0 15px;
position: relative;
top: 50%;
transform: translateY(-50%);
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .arrows i{
display: none;
width: 36px;
height: 36px;
line-height: 36px;
text-align: center;
color: #fff;
background-color: rgba(0, 0, 0, .35);
border-radius: 50%;
cursor: pointer;
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .dot-wrap{
text-align: center;
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .dot-wrap.hide{
display: none;
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .dot-wrap.straightLine i{
width: 12px;
height: 4px;
border-radius: 0;
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .dot-wrap i{
display: inline-block;
width: 7px;
height: 7px;
border-radius: 50%;
background-color: rgba(0, 0, 0, .1);
margin-right: 5px;
cursor: pointer;
}
.digit-navigation .digit-nav.pageSlide .carousel-btn .dot-wrap i.active{
background-color: rgba(0, 0, 0, .5);
}
.digit-navigation .digit-nav.pageSlide .carousel-btn:hover .arrows i{
display: block;
}
.digit-navigation .digit-nav .digit-nav-item{
display: flex;
flex-direction: column;
align-items: center;
padding: 7px 0;
box-sizing: border-box;
}
.newright{
margin-right: 10px;
}
.digit-navigation .digit-nav .digit-nav-item .digit-text{
padding-top: 6px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
width: 100%;
text-align: center;
}
.digit-navigation .digit-nav .digit-nav-item .digit-img{
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 50px;
height: 50px;
font-size: 40px;
}
.digit-navigation .digit-nav .digit-nav-item .digit-img .tag{
position: absolute;
top: -5px;
right: -12px;
color: #fff;
background-color: red;
border-radius: 12px;
border-bottom-left-radius: 0;
transform: scale(0.8);
padding: 2px 6px;
font-size: 12px;
}
.digit-navigation .digit-nav .digit-nav-item .digit-img img{
max-width: 100%;
max-height: 100%;
}
.digit-navigation .digit-nav .digit-nav-item .digit-img i{
font-size: 25px;
color: #666;
}
/* 图文导航项 */
.digit-navigation p.hint {
padding-left: 15px;
font-size: 12px;
color: #909399;
line-height: 20px;
}
.digit-navigation .digit-nav-list>ul {
padding: 10px 0 10px 15px;
}
.digit-navigation .digit-nav-list>ul>li {
padding: 10px 10px 10px 0px;
background: #ffffff;
border: 1px dashed #e5e5e5;
position: relative;
margin-top: 16px;
}
.digit-navigation .digit-nav-list>ul>li>.iconfont {
position: absolute;
top: calc(50% - 10px);
left: 15px;
cursor: move;
font-size: 20px;
}
.digit-navigation .digit-nav-list>ul>li:first-child {
margin-top: 0;
}
.digit-navigation .digit-nav-list>ul>li:hover .del {
display: block;
}
.digit-navigation .edit-attribute .attr-wrap .restore-wrap .img-block, .digit-navigation .edit-attribute .attr-wrap .restore-wrap .img-block.has-choose-image > div{
width: 50px;
height: 50px;
line-height: 50px;
}
.digit-navigation .edit-attribute .attr-wrap .restore-wrap .img-block.has-choose-image img {
width: 35px;
height: 35px;
}
.digit-navigation .edit-attribute .icon-box {
width: 60px;
height: 60px;
font-size: 60px;
border: 1px dashed #ddd;
display: flex;
align-items: center;
justify-content: center;
padding: 0!important;
cursor: pointer;
position: relative;
}
.digit-navigation .edit-attribute .icon-box .select-icon {
width: inherit;
height: inherit;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
line-height: 1;
}
.digit-navigation .edit-attribute .icon-box .select-icon .add {
font-size: 26px;
color: var(--base-color);
}
.digit-navigation .edit-attribute .icon-box .operation {
position: absolute;
width: 100%;
height: 100%;
background: rgba(0,0,0,.6);
flex-direction: column;
display: none;
}
.digit-navigation .edit-attribute .icon-box:hover .operation {
display: flex;
}
.digit-navigation .edit-attribute .icon-box .operation-warp {
flex: 1;
height: 0;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
}
.digit-navigation .edit-attribute .icon-box .iconfont {
margin: 0 3px;
font-size: 16px!important;
}
.digit-navigation .edit-attribute .icon-box .operation .js-replace{
line-height: 1;
color: #fff;
text-align: center;
padding: 5px 0;
background: rgba(0,0,0,.7);
font-size: 12px;
height: unset;
}
.digit-navigation .edit-attribute .digit-nav-list .icon-box .icon-wrap:hover .operation{
display: block;
}
.digit-navigation .edit-attribute .digit-nav-list .img-upload .upload-img-box:hover .operation{
display: block;
}
.digit-navigation .edit-attribute .navigation-set-list .img-upload {
display: flex;
align-items: center;
}
.digit-navigation .edit-attribute .navigation-set-list .img-upload img {
width: 100%;
height: 100%;
}
.digit-navigation .edit-attribute .navigation-set-list .action-box {
display: flex;
}
.digit-navigation .edit-attribute .navigation-set-list .action {
margin-right: 3px;
width: 42px;
height: 28px;
line-height: 28px;
text-align: center;
border: 1px solid #EEEEEE;
cursor: pointer;
}
.digit-navigation .edit-attribute .navigation-set-list .action:hover {
border-color: var(--base-color);
color: var(--base-color);
}
.digit-navigation .img-icon-box{
display: flex;
align-items: center;
}

View File

@@ -1,157 +1,158 @@
<nc-component :data="data[index]" class="digit-navigation">
<!-- 预览 -->
<template slot="preview">
<template v-if="nc.lazyLoad">
<div :class="['digit-nav',nc.showStyle] " :style="{
backgroundColor: nc.componentBgColor,
borderTopLeftRadius: (nc.componentAngle == 'round' ? nc.topAroundRadius + 'px' : 0),
borderTopRightRadius: (nc.componentAngle == 'round' ? nc.topAroundRadius + 'px' : 0),
borderBottomLeftRadius: (nc.componentAngle == 'round' ? nc.bottomAroundRadius + 'px' : 0),
borderBottomRightRadius: (nc.componentAngle == 'round' ? nc.bottomAroundRadius + 'px' : 0),
boxShadow: nc.ornament.type == 'shadow' ? ('0 0 5px ' + nc.ornament.color) : '',
border: nc.ornament.type == 'stroke' ? '1px solid ' + nc.ornament.color : ''
}">
<div class="digit-nav-item" v-for="(item) in nc.list" :key="item.id" :style="{width: (100 / nc.rowCount + '%')}">
<!-- <div class="digit-img" v-show="nc.mode != 'text'" :style="{'font-size' : nc.imageSize + 'px', width: nc.imageSize + 'px', height: nc.imageSize + 'px'}">
<img v-if="item.iconType == 'img' && item.imageUrl" :src="changeImgUrl(item.imageUrl)" alt="" :style="{maxWidth: nc.imageSize + 'px', maxHeight: nc.imageSize + 'px', borderRadius: nc.aroundRadius + 'px'}">
<iconfont v-if="item.iconType == 'icon' && item.icon" :icon="item.icon" :value="(item.style ? item.style : null)" :style="{maxWidth: nc.imageSize + 'px', maxHeight: nc.imageSize + 'px'}"></iconfont>
<img v-if="!item.icon && !item.imageUrl" :src="changeImgUrl('public/static/img/default_img/square.png')" alt="" :style="{maxWidth: nc.imageSize + 'px', maxHeight: nc.imageSize + 'px', borderRadius: nc.aroundRadius + 'px'}">
<span class="tag" v-if="item.label.control" :style="{color: item.label.textColor,backgroundImage: 'linear-gradient(' + item.label.bgColorStart + ',' + item.label.bgColorEnd + ')'}">{{item.label.text}}</span>
</div> -->
<!-- margin-right: 10px; -->
<div class="digit-text" :style="{fontSize: nc.font.size+'px',fontWeight: nc.font.weight, color: nc.font.color,backgroundColor:nc.mode=='text'?nc.font.bgcolor:'',paddingBottom:nc.mode=='text'?'7px':''}" style="border-radius: 4px;">
<span :style="{fontSize: nc.font.titlesize+'px',color: nc.font.titlecolor}">{{item.title}}</span>
<span :style="{fontSize: nc.font.unitsize+'px',color: nc.font.unitcolor}">{{item.unit}}</span>
</div>
<div :style="{fontSize: nc.font.descsize+'px',color: nc.font.desccolor}">{{item.desc}}</div>
<!-- <div class="fui-cell-group fui-cell-click" style="margin-top: 0px; background-color: #ffffff;font-size:26px">
<div class="fui-cell">
<div class="fui-cell-icon" style="color: #999999;">
<img v-if="item.iconType == 'img' && item.imageUrl" :src="changeImgUrl(item.imageUrl)" alt="" :style="{maxWidth: '30px', maxHeight: '30px', borderRadius: nc.aroundRadius + 'px'}">
<iconfont v-if="item.iconType == 'icon' && item.icon" :icon="item.icon" :value="(item.style ? item.style : null)" :style="{maxWidth: nc.imageSize + 'px', maxHeight: nc.imageSize + 'px'}"></iconfont>
</div>
<div class="fui-cell-text" style="color: #000000;padding-left: 6px;">{{item.title}}</div>
<div class="fui-cell-remark" style="color: #888888;">查看</div>
</div>
</div> -->
</div>
</div>
</template>
</template>
<!-- 内容编辑 -->
<template slot="edit-content">
<template v-if="nc.lazyLoad">
<digit-nav-list></digit-nav-list>
<div class="template-edit-title">
<h3>数字项设置</h3>
<div class="layui-form-item icon-radio">
<label class="layui-form-label sm">显示样式</label>
<div class="layui-input-block">
<span v-for="item in nc.tempData.rowCountList" :class="[{'layui-hide': item.value != nc.rowCount}]">{{item.name}}</span>
<ul class="icon-wrap">
<li v-for="item in nc.tempData.rowCountList" :class="[item.value == nc.rowCount ? 'text-color border-color' : '']" @click="nc.tempData.methods.setnum(item.value)">
<i :class="['iconfont',item.src]"></i>
</li>
</ul>
</div>
</div>
<div class="digit-nav-list">
<!-- <p class="hint">建议上传尺寸相同的图片(60px * 60px)</p> -->
<ul class="navigation-set-list">
<li v-for="(item,previewIndex) in nc.list" :key="item.id" class="content-block">
<!-- <template>
<div class="layui-form-item">
<label class="layui-form-label sm">图片</label>
<div class="layui-input-block">
<image-upload :data="{ data : item }" :condition="['listmenu','img'].includes(nc.mode)" data-disabled="1"></image-upload>
</div>
</div>
</template> -->
<div class="layui-form-item">
<label class="layui-form-label sm">数字</label>
<div class="layui-input-block">
<input type="number" name='title' placeholder="请输入数字" v-model="item.title" maxlength="20" class="layui-input" autocomplete="off" />
<input type="text" name='unit' placeholder="请输入单位" v-model="item.unit" maxlength="20" class="layui-input" autocomplete="off" />
<input type="text" name='desc' placeholder="请输入描述" v-model="item.desc" maxlength="20" class="layui-input" autocomplete="off" />
</div>
</div>
<!-- <nc-link :data="{ field : item.link, label:'链接' }"></nc-link> -->
<!-- <i class="del" @click="nc.list.splice(previewIndex,1)" data-disabled="1">x</i>
<div class="error-msg"></div>
<div class="iconfont icontuodong"></div> -->
</li>
<!-- <div class="add-item text-color" @click="nc.tempData.methods.addNav()">
<i>+</i>
<span>添加一个数字组</span>
</div> -->
</ul>
</div>
</div>
</template>
</template>
<!-- 样式编辑 -->
<template slot="edit-style">
<template v-if="nc.lazyLoad">
<div class="template-edit-title">
<!--
<h3>图文导航</h3>
<color v-if="nc.ornament.type != 'default'" :data="{ field : 'color', 'label' : '边框颜色', parent : 'ornament', defaultColor : '#EDEDED' }"></color>
<div class="template-edit-title" v-show="['listmenu','img'].includes(nc.mode) && nc.type == 'img'">
<h3>图片设置</h3>
<template v-if="nc.type == 'img'">
<slide :data="{ field : 'aroundRadius', label : '图片圆角', max : 50 }"></slide>
<slide :data="{ field : 'imageSize', label : '图片大小', min: 30, max : 60 }"></slide>
</template>
</div> -->
<div class="template-edit-title">
<h3>数字文字设置</h3>
<slide :data="{ field : 'titlesize',parent:'font', label : '文字大小', min: 12, max : 40 }"></slide>
<color :data="{ field : 'titlecolor', label : '文字颜色',parent:'font',defaultColor: '#303133' }"></color>
</div>
<div class="template-edit-title">
<h3>单位文字设置</h3>
<slide :data="{ field : 'unitsize',parent:'font', label : '文字大小', min: 12, max : 40 }"></slide>
<color :data="{ field : 'unitcolor', label : '文字颜色',parent:'font',defaultColor: '#303133' }"></color>
</div>
<div class="template-edit-title">
<h3>描述文字设置</h3>
<slide :data="{ field : 'descsize',parent:'font', label : '文字大小', min: 12, max : 40 }"></slide>
<color :data="{ field : 'desccolor', label : '文字颜色',parent:'font',defaultColor: '#303133' }"></color>
</div>
</template>
</template>
<!-- 资源 -->
<template slot="resource">
<js>
var listmenuNavResourcePath = "{$resource_path}"; // http路径
var listmenuNavRelativePath = "{$relative_path}"; // 相对路径
</js>
<css src="{$resource_path}/css/design.css?v={$version}"></css>
<js src="{$resource_path}/js/design.js?v={$version}"></js>
</template>
<nc-component :data="data[index]" class="digit-navigation">
<!-- 预览 -->
<template slot="preview">
<template v-if="nc.lazyLoad">
<div :class="['digit-nav',nc.showStyle] " :style="{
backgroundImage: 'url('+nc.imageUrl+')',
backgroundSize:'100% 100%',
borderTopLeftRadius: (nc.componentAngle == 'round' ? nc.topAroundRadius + 'px' : 0),
borderTopRightRadius: (nc.componentAngle == 'round' ? nc.topAroundRadius + 'px' : 0),
borderBottomLeftRadius: (nc.componentAngle == 'round' ? nc.bottomAroundRadius + 'px' : 0),
borderBottomRightRadius: (nc.componentAngle == 'round' ? nc.bottomAroundRadius + 'px' : 0),
boxShadow: nc.ornament.type == 'shadow' ? ('0 0 5px ' + nc.ornament.color) : '',
border: nc.ornament.type == 'stroke' ? '1px solid ' + nc.ornament.color : ''
}">
<div class="digit-nav-item" v-for="(item) in nc.list" :key="item.id" :style="{width: (100 / nc.rowCount + '%')}">
<!-- <div class="digit-img" v-show="nc.mode != 'text'" :style="{'font-size' : nc.imageSize + 'px', width: nc.imageSize + 'px', height: nc.imageSize + 'px'}">
<img v-if="item.iconType == 'img' && item.imageUrl" :src="changeImgUrl(item.imageUrl)" alt="" :style="{maxWidth: nc.imageSize + 'px', maxHeight: nc.imageSize + 'px', borderRadius: nc.aroundRadius + 'px'}">
<iconfont v-if="item.iconType == 'icon' && item.icon" :icon="item.icon" :value="(item.style ? item.style : null)" :style="{maxWidth: nc.imageSize + 'px', maxHeight: nc.imageSize + 'px'}"></iconfont>
<img v-if="!item.icon && !item.imageUrl" :src="changeImgUrl('public/static/img/default_img/square.png')" alt="" :style="{maxWidth: nc.imageSize + 'px', maxHeight: nc.imageSize + 'px', borderRadius: nc.aroundRadius + 'px'}">
<span class="tag" v-if="item.label.control" :style="{color: item.label.textColor,backgroundImage: 'linear-gradient(' + item.label.bgColorStart + ',' + item.label.bgColorEnd + ')'}">{{item.label.text}}</span>
</div> -->
<!-- margin-right: 10px; -->
<div class="digit-text" :style="{fontSize: nc.font.size+'px',fontWeight: nc.font.weight, color: nc.font.color,backgroundColor:nc.mode=='text'?nc.font.bgcolor:'',paddingBottom:nc.mode=='text'?'7px':''}" style="border-radius: 4px;">
<span :style="{fontSize: nc.font.titlesize+'px',color: nc.font.titlecolor}">{{item.title}}</span>
<span :style="{fontSize: nc.font.unitsize+'px',color: nc.font.unitcolor}">{{item.unit}}</span>
</div>
<div :style="{fontSize: nc.font.descsize+'px',color: nc.font.desccolor}">{{item.desc}}</div>
<!-- <div class="fui-cell-group fui-cell-click" style="margin-top: 0px; background-color: #ffffff;font-size:26px">
<div class="fui-cell">
<div class="fui-cell-icon" style="color: #999999;">
<img v-if="item.iconType == 'img' && item.imageUrl" :src="changeImgUrl(item.imageUrl)" alt="" :style="{maxWidth: '30px', maxHeight: '30px', borderRadius: nc.aroundRadius + 'px'}">
<iconfont v-if="item.iconType == 'icon' && item.icon" :icon="item.icon" :value="(item.style ? item.style : null)" :style="{maxWidth: nc.imageSize + 'px', maxHeight: nc.imageSize + 'px'}"></iconfont>
</div>
<div class="fui-cell-text" style="color: #000000;padding-left: 6px;">{{item.title}}</div>
<div class="fui-cell-remark" style="color: #888888;">查看</div>
</div>
</div> -->
</div>
</div>
</template>
</template>
<!-- 内容编辑 -->
<template slot="edit-content">
<template v-if="nc.lazyLoad">
<!-- <digit-nav-list></digit-nav-list> -->
<div class="template-edit-title">
<h3>数字项设置</h3>
<div class="layui-form-item icon-radio">
<label class="layui-form-label sm">显示样式</label>
<div class="layui-input-block">
<span v-for="item in nc.tempData.rowCountList" :class="[{'layui-hide': item.value != nc.rowCount}]">{{item.name}}</span>
<ul class="icon-wrap">
<li v-for="item in nc.tempData.rowCountList" :class="[item.value == nc.rowCount ? 'text-color border-color' : '']" @click="nc.tempData.methods.setnum(item.value)">
<i :class="['iconfont',item.src]"></i>
</li>
</ul>
</div>
</div>
<div class="digit-nav-list">
<!-- <p class="hint">建议上传尺寸相同的图片(60px * 60px)</p> -->
<ul class="navigation-set-list">
<li v-for="(item,previewIndex) in nc.list" :key="item.id" class="content-block">
<!-- <template>
<div class="layui-form-item">
<label class="layui-form-label sm">图片</label>
<div class="layui-input-block">
<image-upload :data="{ data : item }" :condition="['listmenu','img'].includes(nc.mode)" data-disabled="1"></image-upload>
</div>
</div>
</template> -->
<div class="layui-form-item">
<label class="layui-form-label sm">数字</label>
<div class="layui-input-block">
<input type="number" name='title' placeholder="请输入数字" v-model="item.title" maxlength="20" class="layui-input" autocomplete="off" />
<input type="text" name='unit' placeholder="请输入单位" v-model="item.unit" maxlength="20" class="layui-input" autocomplete="off" />
<input type="text" name='desc' placeholder="请输入描述" v-model="item.desc" maxlength="20" class="layui-input" autocomplete="off" />
</div>
</div>
<!-- <nc-link :data="{ field : item.link, label:'链接' }"></nc-link> -->
<!-- <i class="del" @click="nc.list.splice(previewIndex,1)" data-disabled="1">x</i>
<div class="error-msg"></div>
<div class="iconfont icontuodong"></div> -->
</li>
<!-- <div class="add-item text-color" @click="nc.tempData.methods.addNav()">
<i>+</i>
<span>添加一个数字组</span>
</div> -->
</ul>
</div>
</div>
</template>
</template>
<!-- 样式编辑 -->
<template slot="edit-style">
<template v-if="nc.lazyLoad">
<div class="template-edit-title">
<h3>背景设置</h3>
<digit-images></digit-images>
<!-- <color v-if="nc.ornament.type != 'default'" :data="{ field : 'color', 'label' : '边框颜色', parent : 'ornament', defaultColor : '#EDEDED' }"></color>
<div class="template-edit-title" v-show="['listmenu','img'].includes(nc.mode) && nc.type == 'img'">
<h3>图片设置</h3>
<template v-if="nc.type == 'img'">
<slide :data="{ field : 'aroundRadius', label : '图片圆角', max : 50 }"></slide>
<slide :data="{ field : 'imageSize', label : '图片大小', min: 30, max : 60 }"></slide>
</template>
</div> -->
<div class="template-edit-title">
<h3>数字文字设置</h3>
<slide :data="{ field : 'titlesize',parent:'font', label : '文字大小', min: 12, max : 40 }"></slide>
<color :data="{ field : 'titlecolor', label : '文字颜色',parent:'font',defaultColor: '#303133' }"></color>
</div>
<div class="template-edit-title">
<h3>单位文字设置</h3>
<slide :data="{ field : 'unitsize',parent:'font', label : '文字大小', min: 12, max : 40 }"></slide>
<color :data="{ field : 'unitcolor', label : '文字颜色',parent:'font',defaultColor: '#303133' }"></color>
</div>
<div class="template-edit-title">
<h3>描述文字设置</h3>
<slide :data="{ field : 'descsize',parent:'font', label : '文字大小', min: 12, max : 40 }"></slide>
<color :data="{ field : 'desccolor', label : '文字颜色',parent:'font',defaultColor: '#303133' }"></color>
</div>
</template>
</template>
<!-- 资源 -->
<template slot="resource">
<js>
var listmenuNavResourcePath = "{$resource_path}"; // http路径
var listmenuNavRelativePath = "{$relative_path}"; // 相对路径
</js>
<css src="{$resource_path}/css/design.css?v={$version}"></css>
<js src="{$resource_path}/js/design.js?v={$version}"></js>
</template>
</nc-component>

File diff suppressed because it is too large Load Diff

View File

@@ -31,7 +31,7 @@ class Task extends Controller
log_write('Task checkCron ...', 'debug');
$cron_model = new Cron();
$result = $cron_model->checkSchedule();
log_write('Task checkCron result: ' . json_encode($result), 'debug');
log_write('Task checkCron result: ' . formatForLog($result), 'debug');
return $result;
}

View File

@@ -25,7 +25,6 @@ class InitConfig
$this->initConst();
//初始化配置信息
$this->initConfig();
log_write('系统配置信息已初始化', 'debug');
}
/**

View File

@@ -106,7 +106,6 @@ class Goods extends BaseMerchant
$condition[] = [ 'ischeck', '=', 1 ];
}
}
file_put_contents(__DIR__ . '/debug.txt', var_export($condition,true));
if (!empty($start_sale)) $condition[] = [ 'sale_num', '>=', $start_sale ];
if (!empty($end_sale)) $condition[] = [ 'sale_num', '<=', $end_sale ];
if (!empty($start_price)) $condition[] = [ 'price', '>=', $start_price ];

View File

@@ -75,7 +75,7 @@ class Order extends BaseMerchant
$order_status = input('order_status', '');//订单状态
}
}
file_put_contents(__DIR__ . '/debug.txt', var_export($order_status,true));
$order_name = input('order_name', '');
$pay_type = input('pay_type', '');
$order_from = input('order_from', '');

View File

@@ -2160,7 +2160,7 @@ class Goods extends BaseModel
return $this->addGoods($data);
} catch (Exception $e) {
dump($e);
// dump($e);
return $this->error('', $e->getMessage());
}
}

View File

@@ -104,7 +104,8 @@ class GoodsApi extends BaseModel
$goods_sku_detail[ 'store_goods_status' ] = 1;
}
}
//后端处理缺少域名问题,后续处理到前端 add lucky
if($goods_sku_detail['pdf_url']) $goods_sku_detail['pdf_url'] = 'https://'.$_SERVER['HTTP_HOST'].'/'.$goods_sku_detail['pdf_url'];
$goods_sku_detail[ 'purchased_num' ] = 0; // 该商品已购数量
$res[ 'goods_sku_detail' ] = $goods_sku_detail;

View File

@@ -76,7 +76,7 @@ class Login extends BaseModel
$info = [];
$auth_tag = '';
foreach ($data as $key => $value) {
if (in_array($key, [ 'wx_unionid', 'wx_openid', 'weapp_openid', 'qq_openid', 'ali_openid', 'baidu_openid', 'toutiao_openid' ])) {
if (in_array($key, [ 'wx_unionid', 'wx_openid', 'weapp_openid', 'qq_openid', 'ali_openid', 'baidu_openid', 'toutiao_openid', 'huawei_openid' ])) {
$auth_tag = $key;
if (empty($value)) return $this->error('', 'PARAMETER_ERROR');
$info = model("member")->getInfo(
@@ -95,7 +95,8 @@ class Login extends BaseModel
// 会员不存在 第三方自动注册开启 未开启绑定手机 则进行自动注册
$config = new Config();
$config_info = $config->getRegisterConfig($data[ 'site_id' ], 'shop');
if ($config_info[ 'data' ][ 'value' ][ 'third_party' ] && !$config_info[ 'data' ][ 'value' ][ 'bind_mobile' ]) {
//华为元服务静默不用判断强制手机号
if (($config_info[ 'data' ][ 'value' ][ 'third_party' ] && !$config_info[ 'data' ][ 'value' ][ 'bind_mobile' ]) || $auth_tag == 'huawei_openid') {
$register = new Register();
$register_res = $register->authRegister($data);
if ($register_res[ 'code' ] == 0) {

View File

@@ -27,6 +27,14 @@ use think\facade\Config;
class Member extends BaseModel
{
public function getBusinessPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = '', $field = '*')
{
$list = model('business')->pageList($condition, $field, $order, $page, $page_size, '', '', '');
return $this->success($list);
}
/**
* 添加会员(注意等级名称)
* @param $data
@@ -256,6 +264,7 @@ class Member extends BaseModel
$member_info = model('member')->setIsCache(0)->getInfo($condition, $field);
if (!empty($member_info) && empty($member_info[ 'wx_openid' ]) && !empty($member_info[ 'wx_unionid' ])) {
// TODO: 注意, 华为云上的最新代码,下面都注释掉了,
$fans_model = new Fans();
$fans_condition[] = [ "unionid", "=", $member_info[ 'wx_unionid' ] ];
$fans_info = $fans_model->getFansInfo($fans_condition);

View File

@@ -143,6 +143,7 @@ class Register extends BaseModel
'ali_openid' => $data['ali_openid'] ?? '',
'baidu_openid' => $data['baidu_openid'] ?? '',
'toutiao_openid' => $data['toutiao_openid'] ?? '',
'huawei_openid' => $data['huawei_openid'] ?? '',
'headimg' => $data['avatarUrl'] ?? '',
'member_level' => !empty($member_level_info) ? $member_level_info[ 'level_id' ] : 0,
'member_level_name' => !empty($member_level_info) ? $member_level_info[ 'level_name' ] : '',

View File

@@ -1198,7 +1198,6 @@ class OrderCommon extends BaseModel
public function getOrderPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = '', $field = '*', $alias = 'a', $join = [])
{
$order_list = model('order')->pageList($condition, $field, $order, $page, $page_size, $alias, $join);
file_put_contents(__DIR__ . '/debug.txt', var_export($condition,true));
$check_condition = array_column($condition, 2, 0);
if (!empty($order_list[ 'list' ])) {

View File

@@ -36,6 +36,7 @@ class OrderCreate extends BaseModel
model('order')->startTrans();
$pay_model = new Pay();
$this->out_trade_no = $pay_model->createOutTradeNo($this->member_id);
try {
//循环生成多个订单
@@ -52,15 +53,16 @@ class OrderCreate extends BaseModel
$order_insert_data['order_type_name'] = $this->order_type['order_type_name'];
$order_insert_data['order_status_name'] = $this->order_type['order_status']['name'];
$order_insert_data['order_status_action'] = json_encode($this->order_type['order_status'], JSON_UNESCAPED_UNICODE);
$order_insert_data['business'] = input('business','');
if($i >= 1){
//主表订单id
$order_insert_data['host_order_id'] = $this->order_id;
// file_put_contents(__DIR__ . '/debug.txt', var_export($order_insert_data,true));
$order_id = model('order')->add($order_insert_data);
}else{
$order_id = model('order')->add($order_insert_data);
$this->order_id = $order_id;
}
$order_goods_insert_data = [];
//订单项目表
foreach ($v['goods_list'] as $order_goods_v) {

View File

@@ -66,11 +66,11 @@ class Document extends BaseModel
public function getDocument($condition)
{
// $json_condition = json_encode($condition);
// $cache = Cache::get("document_" . $json_condition, "");
// if (!empty($cache)) {
// return $this->success($cache);
// }
$json_condition = json_encode($condition);
$cache = Cache::get("document_" . $json_condition, "");
if (!empty($cache)) {
return $this->success($cache);
}
$check_condition = array_column($condition, 2, 0);
$site_id = $check_condition['site_id'] ?? '';
if ($site_id === '') {
@@ -98,7 +98,7 @@ class Document extends BaseModel
'modify_time' => 0
];
}
// Cache::tag("document")->set("document_" . $json_condition, $info);
Cache::tag("document")->set("document_" . $json_condition, $info);
return $this->success($info);
}

View File

@@ -0,0 +1,338 @@
<?php
namespace app\model\system;
use extend\api\HttpClient;
use think\facade\Cache;
use app\model\BaseModel;
use think\facade\Db;
class Seal extends BaseModel
{
public function getTree($condition = [], $field = '*', $order = 'sort asc,category_id desc', $limit = null)
{
$list = model('seal_structure')->getList($condition, $field, $order, '', '', '', $limit);
$categoryMap = [];
foreach ($list as $item) {
$categoryMap[$item['category_id']] = $item;
$categoryMap[$item['category_id']]['child_list'] = [];
}
$buildTree = function ($parentId = 0) use (&$buildTree, $categoryMap) {
$children = [];
foreach ($categoryMap as $id => $item) {
if ($item['pid'] == $parentId) {
$item['child_list'] = $buildTree($id);
$children[] = $item;
}
}
return $children;
};
$tree = $buildTree(0);
return $this->success($tree);
}
public function getTree1($condition = [], $field = '*', $order = 'sort asc,category_id desc', $limit = null)
{
$list = model('seal_structure')->getList($condition, $field, $order, '', '', '', $limit);
$categoryMap = [];
foreach ($list as $item) {
$categoryMap[$item['category_id']] = $item;
// 初始化子分类数组避免子分类为null
$categoryMap[$item['category_id']]['child_list'] = [];
}
// 递归构建树形结构仅子层级parentId≠0添加「请选择」
$buildTree = function ($parentId = 0) use (&$buildTree, $categoryMap) {
$children = [];
foreach ($categoryMap as $id => $item) {
if ($item['pid'] == $parentId) {
// 1. 递归获取当前分类的子分类子分类会根据parentId判断是否加占位项
$item['child_list'] = $buildTree($id);
$children[] = $item;
}
}
// 2. 关键判断:仅当 parentId ≠ 0子层级才插入「请选择」占位项
if ($parentId != 0 && !empty($children)) { // 非顶级 + 有真实子分类时才加(可选,避免空列表加占位)
$defaultOption = [
'category_id' => 0, // 虚拟ID与真实分类区分
'pid' => $parentId, // 占位项父ID = 当前层级父ID匹配真实子分类
'name' => '请选择', // 显示文本
'child_list' => [], // 占位项无下级(避免无限嵌套)
'is_placeholder' => true // 前端识别标记
// 真实分类的其他字段如sort可按需添加默认值
];
// 在子层级分类列表头部插入占位项
array_unshift($children, $defaultOption);
}
return $children;
};
// 生成树形结构顶级分类parentId=0不添加「请选择」
$tree = $buildTree(0);
return $this->success($tree);
}
/**
* 获取列表带分页
* @param array $condition
* @param int $page
* @param int $page_size
* @param string $order
* @param bool $field
* @param string $alias
* @param array $join
* @return array
*/
public function getPageList($table,array $condition = [], $page = 1, $page_size = PAGE_LIST_ROWS,$order = '',$field = true, $alias = '', $join = [], $group='')
{
$res = model($table)->pageList($condition, $field, $order, $page, $page_size, $alias, $join, $group);
return $this->success($res);
}
/**
* 获取详情
* @param array $condition
* @param bool $field
* @return array
*/
public function getInfo($table,$condition = [], $field = true, $alias = 'a', $join = null)
{
$info = model($table)->getInfo($condition, $field,$alias,$join);
return $this->success($info);
}
public function delete($table,$condition = [])
{
$info = model($table)->delete($condition);
return $this->success($info);
}
/**
* 获取列表不要分页
* @param array $condition
* @return array
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getList($table,$condition = [],$field="*", $order = '', $alias = 'a', $join = [], $group = '')
{
return model($table)->getList($condition,$field,$order,$alias,$join,$group);
}
/**
* 添加
* @param array $data
* @param array $params
* @return array
*/
public function add($table,array $data)
{
if (empty($data) || empty($table)) {
return $this->error('', 'PARAMETER_ERROR');
}
$res = model($table)->add($data);
return $this->success($res);
}
/**
* 编辑
* @param array $data
* @param array $condition
* @param array $params
* @return array
*/
public function edit($table,array $data, array $condition, array $params = [])
{
if (empty($data)) {
return $this->error('', 'PARAMETER_ERROR');
}
$res = model($table)->update($data, $condition);
return $this->success($res);
}
/**
* @param $param
* @param $site_id
* @return array
* @throws \PHPExcel_Exception
* @throws \PHPExcel_Reader_Exception
* @throws \think\exception\PDOException
*/
public function importMedium($param, $site_id)
{
$PHPReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
//载入文件
$PHPExcel = $PHPReader->load($param[ 'path' ]);
//获取表中的第一个工作表如果要获取第二个把0改为1依次类推
$currentSheet = $PHPExcel->getSheet(0);
//获取总行数
$allRow = $currentSheet->getHighestRow();
if ($allRow < 2) {
return $this->error('', '导入了一个空文件');
}
$index = $param[ 'index' ];
//每次导入100条
$length = $index * 2000;
if ($index == 1) {
$num = 27
;
$success_num = 0;
$error_num = 0;
$data_record = [
"member_num" => ( $allRow - 1 ),
"success_num" => 0,
"error_num" => 0,
"create_time" => time(),
"status_name" => "等待导入"
];
$record = model('seal_medium_import_record')->add($data_record);
} else {
$num = ( ( $index - 1 ) * 100 ) + 1;
$success_num = $param[ 'success_num' ];
$error_num = $param[ 'error_num' ];
$record = $param[ 'record' ];
}
$type_num = 0;
model('seal_medium')->startTrans();
$field = ['C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T'];
$name = ['全氟醚FFKM','聚全氟乙丙稀FEPM','丁苯橡胶SBR','氯丁橡胶CR','聚四氟乙烯PTFE','三元乙丙橡胶EPDM','氯醇橡胶 ECO','丁基橡胶 ⅡR','丁腈橡胶 NBR','丙烯酸酯橡胶ACM','聚氨酯 PU','天然橡胶 NR','氟橡胶 FKM','乙丙烯酸酯橡胶AEM','氢化丁腈橡胶HNBR','氟硅橡胶 FVMQ','氯磺化聚乙烯CSM','硅橡胶 VMQ'];
$colors = ['#D5663F','','#E09E36','','#DDDF37','','#75C551','','#54C28D','','#409CBD','','#5B5FBB','','#A061B5','','#BC5A6A',''];//颜色表
try {
for ($i = $num; $i <= $length; $i++) {
//这一行是化学介质行直接跳过
// if($num == 26) continue;
if ($i > $allRow) {
break;
}
$type_num = $i;
$title = $PHPExcel->getActiveSheet()->getCell('B' . $i)->getValue();
$title = trim($title);
if($title == '') break;
//获取每一列的值
$value_data = [];
foreach($field as $k=>$item){
$value = $PHPExcel->getActiveSheet()->getCell($item . $i)->getValue();
// //1推荐使用2有条件使用3不推荐使用4不能使用空格数据不详
$colortext = '#333';
if($value == 1){
$colortext = '#75c551';
}else if($value == 2){
$colortext = '#409cbd';
}else if($value == 3){
$colortext = '#e09e36';
}else if($value == 4){
$colortext = '#ff0000';
}
$value_data[] = [
'text'=>$name[$k],
'value'=>trim($value),
'color'=>$colortext,
'background'=>$colors[$k]
];
// echo $value.'<br/>';
}
// dump($value_data);
$data = [
'name'=>$title,
'value'=>json_encode($value_data)
];
$res = model('seal_medium')->add($data);
// dump($data);
// break;
// exit;
// $not_data = [
// "username" => $username,
// "number" => $number,
// "company" => $company,
// "company_realname" => $company_realname,
// "company_mobile" => $company_mobile,
// ];
// if ($username == "" && $mobile == "") {
// $not_data[ 'content' ] = "失败,用户名或手机号必须存在一个";
// model('member_import_log')->add($not_data);
// $error_num++;
// continue;
// }
// $data = [
// "username" => $username,
// "number" => $number,
// "company" => $company,
// "company_realname" => $company_realname,
// "company_mobile" => $company_mobile,
// ];
// $res = model('seal_medium_import_record')->add($data);
// $product = model('device')->getInfo([ [ 'id', '=', $res ]]);
$not_data[ 'content' ] = "成功";
// model('member_import_log')->add($not_data);
$success_num++;
}
model('seal_medium')->commit();
if ($success_num + $error_num == ( $allRow - 1 )) {
$data_record = [
"member_num" => ( $allRow - 1 ),
"success_num" => $success_num,
"error_num" => $error_num,
"create_time" => time()
];
if ($success_num == ( $allRow - 1 )) {
$data_record[ 'status_name' ] = '导入成功';
} elseif ($error_num == ( $allRow - 1 )) {
$data_record[ 'status_name' ] = '导入失败';
}
model('seal_medium_import_record')->update($data_record, [ 'id' => $record ]);
}
return $this->success([
"allRow" => $allRow,
"num" => $type_num,
"path" => $param[ 'path' ],
"name" => $param[ 'filename' ],
"success_num" => $success_num,
"error_num" => $error_num,
"record" => $record
]);
} catch (\Exception $e) {
model('seal_medium')->rollback();
return $this->error('', $e->getMessage());
}
}
}

View File

@@ -1,5 +1,4 @@
<?php
namespace app\model\web;
use app\model\system\Config as ConfigModel;
@@ -35,7 +34,7 @@ class Config extends BaseModel
'btn' => '清除',
'icon' => 'public/static/img/cache/template.png'
],
/* [
/* [
'name' => '刷新菜单',
'desc' => '新增/修改插件菜单后,需要刷新插件菜单',
'key' => 'menu_cache',
@@ -61,7 +60,7 @@ class Config extends BaseModel
public function setCaptchaConfig($data, $site_id = 1, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->setConfig($data, '验证码设置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'CAPTCHA_CONFIG']]);
$res = $config->setConfig($data, '验证码设置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'CAPTCHA_CONFIG' ] ]);
return $res;
}
@@ -74,20 +73,20 @@ class Config extends BaseModel
public function getCaptchaConfig($site_id = 1, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'CAPTCHA_CONFIG']]);
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'CAPTCHA_CONFIG' ] ]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'shop_login' => 1,
'shop_reception_login' => 1,
'shop_reception_register' => 1
];
} else {
if (isset($res['data']['value']['shop_reception_login']) === false) {
$res['data']['value']['shop_reception_login'] = 1;
if (isset($res[ 'data' ][ 'value' ][ 'shop_reception_login' ]) === false) {
$res[ 'data' ][ 'value' ][ 'shop_reception_login' ] = 1;
}
if (isset($res['data']['value']['shop_reception_register']) === false) {
$res['data']['value']['shop_reception_register'] = 1;
if (isset($res[ 'data' ][ 'value' ][ 'shop_reception_register' ]) === false) {
$res[ 'data' ][ 'value' ][ 'shop_reception_register' ] = 1;
}
}
return $res;
@@ -102,31 +101,31 @@ class Config extends BaseModel
*/
public function setDefaultImg($data, $site_id = 0, $app_module = 'shop')
{
$config_info = $this->getDefaultImg($site_id, $app_module)['data']['value'];
$config_info = $this->getDefaultImg($site_id, $app_module)[ 'data' ][ 'value' ];
if (!empty($config_info)) {
$upload_model = new Upload();
if ($data['goods'] && $config_info['goods'] && $data['goods'] != $config_info['goods']) {
$upload_model->deletePic($config_info['goods'], $site_id);
if ($data[ 'goods' ] && $config_info[ 'goods' ] && $data[ 'goods' ] != $config_info[ 'goods' ]) {
$upload_model->deletePic($config_info[ 'goods' ], $site_id);
}
if ($data['head'] && $config_info['head'] && $data['head'] != $config_info['head']) {
$upload_model->deletePic($config_info['head'], $site_id);
if ($data[ 'head' ] && $config_info[ 'head' ] && $data[ 'head' ] != $config_info[ 'head' ]) {
$upload_model->deletePic($config_info[ 'head' ], $site_id);
}
if ($data['store'] && $config_info['store'] && $data['store'] != $config_info['store']) {
$upload_model->deletePic($config_info['store'], $site_id);
if ($data[ 'store' ] && $config_info[ 'store' ] && $data[ 'store' ] != $config_info[ 'store' ]) {
$upload_model->deletePic($config_info[ 'store' ], $site_id);
}
if ($data['article'] && $config_info['article'] && $data['article'] != $config_info['article']) {
$upload_model->deletePic($config_info['article'], $site_id);
if ($data[ 'article' ] && $config_info[ 'article' ] && $data[ 'article' ] != $config_info[ 'article' ]) {
$upload_model->deletePic($config_info[ 'article' ], $site_id);
}
if ($data['kefu'] && $config_info['kefu'] && $data['kefu'] != $config_info['kefu']) {
$upload_model->deletePic($config_info['kefu'], $site_id);
if ($data[ 'kefu' ] && $config_info[ 'kefu' ] && $data[ 'kefu' ] != $config_info[ 'kefu' ]) {
$upload_model->deletePic($config_info[ 'kefu' ], $site_id);
}
if ($data['phone'] && $config_info['phone'] && $data['phone'] != $config_info['phone']) {
$upload_model->deletePic($config_info['phone'], $site_id);
if ($data[ 'phone' ] && $config_info[ 'phone' ] && $data[ 'phone' ] != $config_info[ 'phone' ]) {
$upload_model->deletePic($config_info[ 'phone' ], $site_id);
}
}
$config = new ConfigModel();
$res = $config->setConfig($data, '默认图设置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'DEFAULT_IMAGE']]);
$res = $config->setConfig($data, '默认图设置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'DEFAULT_IMAGE' ] ]);
return $res;
}
@@ -139,9 +138,9 @@ class Config extends BaseModel
public function getDefaultImg($site_id, $app_model = 'shop')
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_model], ['config_key', '=', 'DEFAULT_IMAGE']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_model ], [ 'config_key', '=', 'DEFAULT_IMAGE' ] ]);
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'goods' => 'public/static/img/default_img/square.png',
'head' => 'public/static/img/default_img/head.png',
'store' => 'public/static/img/default_img/store.png',
@@ -151,14 +150,14 @@ class Config extends BaseModel
];
}
if (empty($res['data']['value']['head'])) {
$res['data']['value']['head'] = 'public/static/img/default_img/head.png';
if (empty($res[ 'data' ][ 'value' ][ 'head' ])) {
$res[ 'data' ][ 'value' ][ 'head' ] = 'public/static/img/default_img/head.png';
}
if (empty($res['data']['value']['article'])) {
$res['data']['value']['article'] = 'public/static/img/default_img/article.png';
if (empty($res[ 'data' ][ 'value' ][ 'article' ])) {
$res[ 'data' ][ 'value' ][ 'article' ] = 'public/static/img/default_img/article.png';
}
if (empty($res['data']['value']['store'])) {
$res['data']['value']['store'] = 'public/static/img/default_img/store.png';
if (empty($res[ 'data' ][ 'value' ][ 'store' ])) {
$res[ 'data' ][ 'value' ][ 'store' ] = 'public/static/img/default_img/store.png';
}
return $res;
}
@@ -174,7 +173,7 @@ class Config extends BaseModel
public function setCopyright($data, $site_id = 1, $app_model = 'shop')
{
$config = new ConfigModel();
$res = $config->setConfig($data, '版权设置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_model], ['config_key', '=', 'COPYRIGHT']]);
$res = $config->setConfig($data, '版权设置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_model ], [ 'config_key', '=', 'COPYRIGHT' ] ]);
return $res;
}
@@ -187,16 +186,16 @@ class Config extends BaseModel
public function getCopyright($site_id = 1, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'COPYRIGHT']]);
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'COPYRIGHT' ] ]);
$auth_info = cache('auth_info_copyright');
if (empty($auth_info)) {
$upgrade_model = new Upgrade();
$auth_info = $upgrade_model->authInfo();
cache('auth_info_copyright', $auth_info, ['expire' => 604800]);
cache('auth_info_copyright', $auth_info, [ 'expire' => 604800 ]);
}
if (empty($res['data']['value'])) {
$res['data']['value'] = [
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'logo' => '',
'company_name' => '',
'copyright_link' => '',
@@ -207,15 +206,16 @@ class Config extends BaseModel
'market_supervision_url' => ''
];
} else {
if (is_null($auth_info) || $auth_info['code'] != 0) {
$res['data']['value']['logo'] = '';
$res['data']['value']['company_name'] = '';
$res['data']['value']['copyright_link'] = '';
$res['data']['value']['copyright_desc'] = '';
if (is_null($auth_info) || $auth_info[ 'code' ] != 0) {
$res[ 'data' ][ 'value' ][ 'logo' ] = '';
$res[ 'data' ][ 'value' ][ 'company_name' ] = '';
$res[ 'data' ][ 'value' ][ 'copyright_link' ] = '';
$res[ 'data' ][ 'value' ][ 'copyright_desc' ] = '';
}
}
// 检查是否授权
$res['data']['value']['auth'] = true;
$res[ 'data' ][ 'value' ][ 'auth' ] = true;
return $res;
}
@@ -229,7 +229,7 @@ class Config extends BaseModel
public function setAuth($data, $site_id = 1, $app_model = 'shop')
{
$config = new ConfigModel();
$res = $config->setConfig($data, '授权设置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_model], ['config_key', '=', 'AUTH']]);
$res = $config->setConfig($data, '授权设置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_model ], [ 'config_key', '=', 'AUTH' ] ]);
return $res;
}
@@ -240,9 +240,9 @@ class Config extends BaseModel
public function getAuth($site_id = 1, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'AUTH']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'AUTH' ] ]);
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'code' => '',
];
}
@@ -259,11 +259,11 @@ class Config extends BaseModel
public function setMapConfig($data, $site_id, $app_model = 'shop')
{
$config = new ConfigModel();
$res = $config->setConfig($data, '地图设置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_model], ['config_key', '=', 'MAP_CONFIG']]);
$res = $config->setConfig($data, '地图设置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_model ], [ 'config_key', '=', 'MAP_CONFIG' ] ]);
return $res;
}
/**
/**
* 获取地图设置
* @param int $site_id
* @param string $app_module
@@ -273,16 +273,16 @@ class Config extends BaseModel
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'MAP_CONFIG']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
'tencent_map_key' => '2PJBZ-A263Q-SED5B-4SAAB-HCUQ5-DUFHE', //默认一个地图TB5BZ-FBRRX-2RJ4C-76SZY-TYQ3H-F4BFC
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'tencent_map_key' => '2PJBZ-A263Q-SED5B-4SAAB-HCUQ5-DUFHE',//默认一个地图TB5BZ-FBRRX-2RJ4C-76SZY-TYQ3H-F4BFC
'wap_is_open' => 1, // 手机端是否开启定位
'wap_valid_time' => 5 // 手机端定位有效期/分钟过期后将重新获取定位信息0为不过期
];
}
$res['data']['value']['wap_is_open'] = $res['data']['value']['wap_is_open'] ?? 1;
$res['data']['value']['wap_valid_time'] = $res['data']['value']['wap_valid_time'] ?? 5;
$res['data']['value']['tencent_map_key'] = '2PJBZ-A263Q-SED5B-4SAAB-HCUQ5-DUFHE';
$res[ 'data' ][ 'value' ][ 'wap_is_open' ] = $res[ 'data' ][ 'value' ][ 'wap_is_open' ] ?? 1;
$res[ 'data' ][ 'value' ][ 'wap_valid_time' ] = $res[ 'data' ][ 'value' ][ 'wap_valid_time' ] ?? 5;
$res[ 'data' ][ 'value' ]['tencent_map_key'] = '2PJBZ-A263Q-SED5B-4SAAB-HCUQ5-DUFHE';
return $res;
}
@@ -296,19 +296,19 @@ class Config extends BaseModel
public function seth5DomainName($data, $site_id = 1, $app_module = 'shop')
{
$search = '/^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/';
if ($data['deploy_way'] == 'separate') {
if (!preg_match($search, $data['domain_name_h5'])) {
if ($data[ 'deploy_way' ] == 'separate') {
if (!preg_match($search, $data[ 'domain_name_h5' ])) {
return $this->error('', '请输入正确的域名地址');
}
}
// 默认部署,更新店铺域名
if ($data['deploy_way'] == 'default') {
if ($data[ 'deploy_way' ] == 'default') {
$this->setShopDomainConfig([
'domain_name' => __ROOT__
], $site_id);
}
$config = new ConfigModel();
$res = $config->setConfig($data, 'H5域名配置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'H5_DOMAIN_NAME']]);
$res = $config->setConfig($data, 'H5域名配置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'H5_DOMAIN_NAME' ] ]);
return $res;
}
@@ -322,9 +322,9 @@ class Config extends BaseModel
public function getH5DomainName($site_id = 1, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'H5_DOMAIN_NAME']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'H5_DOMAIN_NAME' ] ]);
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'domain_name_h5' => __ROOT__ . '/h5',
'deploy_way' => 'default'
];
@@ -342,7 +342,7 @@ class Config extends BaseModel
public function setDomainJumpConfig($data, $site_id = 1, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->setConfig($data, '获取域名跳转配置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'DOMAIN_JUMP_CONFIG']]);
$res = $config->setConfig($data, '获取域名跳转配置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'DOMAIN_JUMP_CONFIG' ] ]);
return $res;
}
@@ -356,12 +356,12 @@ class Config extends BaseModel
{
$config = new ConfigModel();
$res = $config->getConfig([
['site_id', '=', $site_id],
['app_module', '=', $app_module],
['config_key', '=', 'DOMAIN_JUMP_CONFIG']
[ 'site_id', '=', $site_id ],
[ 'app_module', '=', $app_module ],
[ 'config_key', '=', 'DOMAIN_JUMP_CONFIG' ]
]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'jump_type' => 3, // 1用户前台2商家后台3引导页
];
}
@@ -378,19 +378,19 @@ class Config extends BaseModel
public function setPcDomainName($data, $site_id = 1, $app_module = 'shop')
{
$search = '/^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/';
if ($data['deploy_way'] == 'separate') {
if (!preg_match($search, $data['domain_name_pc'])) {
if ($data[ 'deploy_way' ] == 'separate') {
if (!preg_match($search, $data[ 'domain_name_pc' ])) {
return $this->error('', '请输入正确的域名地址');
}
}
// 默认部署,更新店铺域名
if ($data['deploy_way'] == 'default') {
if ($data[ 'deploy_way' ] == 'default') {
$this->setShopDomainConfig([
'domain_name' => __ROOT__
], $site_id);
}
$config = new ConfigModel();
$res = $config->setConfig($data, 'PC域名配置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'PC_DOMAIN_NAME']]);
$res = $config->setConfig($data, 'PC域名配置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'PC_DOMAIN_NAME' ] ]);
return $res;
}
@@ -403,19 +403,19 @@ class Config extends BaseModel
public function getPcDomainName($site_id = 1, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'PC_DOMAIN_NAME']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'PC_DOMAIN_NAME' ] ]);
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'domain_name_pc' => __ROOT__ . '/web',
'deploy_way' => 'default'
];
} else {
if ($res['data']['value']['domain_name_pc'] == '' || empty($res['data']['value']['deploy_way']) || $res['data']['value']['deploy_way'] == 'default') {
$res['data']['value'] = [
if ($res[ 'data' ][ 'value' ][ 'domain_name_pc' ] == '' || empty($res[ 'data' ][ 'value' ][ 'deploy_way' ]) || $res[ 'data' ][ 'value' ][ 'deploy_way' ] == 'default') {
$res[ 'data' ][ 'value' ] = [
'domain_name_pc' => __ROOT__ . '/web'
];
}
$res['data']['value']['deploy_way'] = $res['data']['value']['deploy_way'] ?? 'default';
$res[ 'data' ][ 'value' ][ 'deploy_way' ] = $res[ 'data' ][ 'value' ][ 'deploy_way' ] ?? 'default';
}
return $res;
}
@@ -430,7 +430,7 @@ class Config extends BaseModel
public function setHotSearchWords($data, $site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->setConfig($data, '商品热门搜索关键词', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_HOT_SEARCH_WORDS_CONFIG']]);
$res = $config->setConfig($data, '商品热门搜索关键词', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_HOT_SEARCH_WORDS_CONFIG' ] ]);
return $res;
}
@@ -443,9 +443,9 @@ class Config extends BaseModel
public function getHotSearchWords($site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_HOT_SEARCH_WORDS_CONFIG']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_HOT_SEARCH_WORDS_CONFIG' ] ]);
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'words' => ''
];
}
@@ -462,7 +462,7 @@ class Config extends BaseModel
public function setGuessYouLike($data, $site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->setConfig($data, '商品推荐', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_GUESS_YOU_LIKE_CONFIG']]);
$res = $config->setConfig($data, '商品推荐', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_GUESS_YOU_LIKE_CONFIG' ] ]);
return $res;
}
@@ -475,11 +475,11 @@ class Config extends BaseModel
public function getGuessYouLike($site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_GUESS_YOU_LIKE_CONFIG']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_GUESS_YOU_LIKE_CONFIG' ] ]);
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'title' => '猜你喜欢',
'supportPage' => ['goods_detail', 'cart', 'collect', 'pay', 'order_detail', 'super_member', 'guafen', 'fenxiao_level'],
'supportPage' => [ 'goods_detail', 'cart', 'collect', 'pay', 'order_detail', 'super_member', 'guafen', 'fenxiao_level' ],
'sources' => 'sort',
'goodsIds' => [],
'fontWeight' => false,
@@ -508,7 +508,7 @@ class Config extends BaseModel
],
];
}
$res['data']['value']['nameLineMode'] = $res['data']['value']['nameLineMode'] ?? 'single'; // 商品名称,单行、多行展示
$res[ 'data' ][ 'value' ][ 'nameLineMode' ] = $res[ 'data' ][ 'value' ][ 'nameLineMode' ] ?? 'single'; // 商品名称,单行、多行展示
return $res;
}
@@ -522,17 +522,17 @@ class Config extends BaseModel
public function getDiyAdv($site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'DIY_STARTADV']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
'list' => [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'DIY_STARTADV' ] ]);
if (empty($res[ 'data' ][ 'value' ])){
$res[ 'data' ][ 'value' ] = [
'list' =>[
[
'title' => '启动广告',
'link' => [
'name' => ''
'title'=>'启动广告',
'link'=>[
'name'=>''
],
'iconType' => 'img',
'imageUrl' => "public/static/ext/diyview/img/preview/advs_default.png"
'iconType'=>'img',
'imageUrl'=>"public/static/ext/diyview/img/preview/advs_default.png"
]
],
'advtype' => 1,
@@ -552,12 +552,12 @@ class Config extends BaseModel
public function setDiyAdv($data, $site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->setConfig($data, '启动广告', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'DIY_STARTADV']]);
$res = $config->setConfig($data, '启动广告', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'DIY_STARTADV' ] ]);
return $res;
}
/**
/**
* 获取VR
* @param $site_id
* @param $app_module
@@ -566,14 +566,14 @@ class Config extends BaseModel
public function getDiyVr($site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'DIY_VR']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'DIY_VR' ] ]);
if (empty($res[ 'data' ][ 'value' ])){
$res[ 'data' ][ 'value' ] = [
'title' => '工厂展示',
'url' => 'https://baidu.com',
];
}
// $res[ 'data' ][ 'value' ][ 'nameLineMode' ] = $res[ 'data' ][ 'value' ][ 'nameLineMode' ] ?? 'single'; // 商品名称,单行、多行展示
// $res[ 'data' ][ 'value' ][ 'nameLineMode' ] = $res[ 'data' ][ 'value' ][ 'nameLineMode' ] ?? 'single'; // 商品名称,单行、多行展示
return $res;
}
@@ -587,7 +587,7 @@ class Config extends BaseModel
public function setDiyVr($data, $site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->setConfig($data, 'VR展示', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'DIY_VR']]);
$res = $config->setConfig($data, 'VR展示', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'DIY_VR' ] ]);
return $res;
}
@@ -602,7 +602,7 @@ class Config extends BaseModel
public function setGoodsListConfig($data, $site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->setConfig($data, '商品列表配置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_LIST_CONFIG']]);
$res = $config->setConfig($data, '商品列表配置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_LIST_CONFIG' ] ]);
return $res;
}
@@ -615,9 +615,9 @@ class Config extends BaseModel
public function getGoodsListConfig($site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_LIST_CONFIG']]);
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_LIST_CONFIG' ] ]);
//数据格式化
if (empty($res['data']['value'])) {
if (empty($res[ 'data' ][ 'value' ])) {
$data = [
'fontWeight' => false,
'padding' => 10,
@@ -644,9 +644,9 @@ class Config extends BaseModel
]
]
];
$res['data']['value'] = $data;
$res[ 'data' ][ 'value' ] = $data;
}
$res['data']['value']['nameLineMode'] = $res['data']['value']['nameLineMode'] ?? 'single'; // 商品名称,单行、多行展示
$res[ 'data' ][ 'value' ][ 'nameLineMode' ] = $res[ 'data' ][ 'value' ][ 'nameLineMode' ] ?? 'single'; // 商品名称,单行、多行展示
return $res;
}
@@ -660,7 +660,7 @@ class Config extends BaseModel
public function setDefaultSearchWords($data, $site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->setConfig($data, '默认搜索关键词', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_DEFAULT_SEARCH_WORDS_CONFIG']]);
$res = $config->setConfig($data, '默认搜索关键词', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_DEFAULT_SEARCH_WORDS_CONFIG' ] ]);
return $res;
}
@@ -673,9 +673,9 @@ class Config extends BaseModel
public function getDefaultSearchWords($site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_DEFAULT_SEARCH_WORDS_CONFIG']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_DEFAULT_SEARCH_WORDS_CONFIG' ] ]);
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'words' => '搜索 商品'
];
}
@@ -692,7 +692,7 @@ class Config extends BaseModel
public function setGoodsSort($data, $site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->setConfig($data, '商品默认排序方式', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_SORT_CONFIG']]);
$res = $config->setConfig($data, '商品默认排序方式', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_SORT_CONFIG' ] ]);
return $res;
}
@@ -705,9 +705,9 @@ class Config extends BaseModel
public function getGoodsSort($site_id, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_SORT_CONFIG']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_SORT_CONFIG' ] ]);
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'type' => 'asc',
'default_value' => 100
];
@@ -725,7 +725,7 @@ class Config extends BaseModel
public function setCategoryConfig($data, $site_id = 1, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->setConfig($data, 'PC端首页分类设置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'SHOP_CATEGORY_CONFIG']]);
$res = $config->setConfig($data, 'PC端首页分类设置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'SHOP_CATEGORY_CONFIG' ] ]);
return $res;
}
@@ -738,9 +738,9 @@ class Config extends BaseModel
public function getCategoryConfig($site_id = 1, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'SHOP_CATEGORY_CONFIG']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'SHOP_CATEGORY_CONFIG' ] ]);
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'category' => 1,
'img' => 1
];
@@ -758,7 +758,7 @@ class Config extends BaseModel
public function setGoodsDetailConfig($data, $site_id, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->setConfig($data, '商品详情配置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_DETAIL_CONFIG']]);
$res = $config->setConfig($data, '商品详情配置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_DETAIL_CONFIG' ] ]);
return $res;
}
@@ -771,9 +771,9 @@ class Config extends BaseModel
public function getGoodsDetailConfig($site_id, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_DETAIL_CONFIG']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_DETAIL_CONFIG' ] ]);
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'nav_bar_switch' => 0, // 是否透明0不透明1透明
'introduction_color' => '#303133',
];
@@ -791,7 +791,7 @@ class Config extends BaseModel
public function setShopDomainConfig($data, $site_id = 1, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->setConfig($data, '店铺域名配置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'SHOP_DOMAIN_CONFIG']]);
$res = $config->setConfig($data, '店铺域名配置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'SHOP_DOMAIN_CONFIG' ] ]);
return $res;
}
@@ -804,12 +804,12 @@ class Config extends BaseModel
public function getShopDomainConfig($site_id = 1, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'SHOP_DOMAIN_CONFIG']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'SHOP_DOMAIN_CONFIG' ] ]);
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'domain_name' => __ROOT__,
];
$this->setShopDomainConfig($res['data']['value'], $site_id);
$this->setShopDomainConfig($res[ 'data' ][ 'value' ], $site_id);
}
return $res;
}
@@ -817,11 +817,11 @@ class Config extends BaseModel
{
$qq_map = new \app\model\map\QqMap(['key' => $tencent_map_key]);
$res = $qq_map->ipToDetail([
'ip' => request()->ip() != '127.0.0.1' ? $_SERVER['REMOTE_ADDR'] : '',
'ip' => request()->ip() != '127.0.0.1' ? $_SERVER[ 'REMOTE_ADDR' ] : '',
]);
if (!empty($res)) {
if ($res['status'] != 0 && $type == 0) {
$res['message'] = '腾讯地图配置错误,无法定位地址';
if ($res[ 'status' ] != 0 && $type == 0) {
$res[ 'message' ] = '腾讯地图配置错误,无法定位地址';
}
}
return $res;
@@ -857,7 +857,7 @@ class Config extends BaseModel
public function setGoodsNo($data, $site_id, $app_module)
{
$config = new ConfigModel();
$res = $config->setConfig($data, '商品编码设置', 1, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_NO_CONFIG']]);
$res = $config->setConfig($data, '商品编码设置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_NO_CONFIG' ] ]);
return $res;
}
@@ -870,12 +870,12 @@ class Config extends BaseModel
public function getGoodsNo($site_id, $app_module = 'shop')
{
$config = new ConfigModel();
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'GOODS_NO_CONFIG']]);
if (empty($res['data']['value'])) {
$res['data']['value'] = [
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'GOODS_NO_CONFIG' ] ]);
if (empty($res[ 'data' ][ 'value' ])) {
$res[ 'data' ][ 'value' ] = [
'uniqueness_switch' => 1,
];
}
return $res;
}
}
}

View File

@@ -201,8 +201,89 @@ class DiyViewLink extends BaseModel
$link_list[ $k ][ 'child_list' ] = [];
}
}
// PDF文件分类列表
foreach ($link_list as $k => $v) {
if (isset($v[ 'child_list' ])) {
foreach ($v[ 'child_list' ] as $ck => $cv) {
if ($cv[ 'name' ] == 'FILES_CATE_PAGE') {
$link_list[ $k ][ 'child_list' ][ $ck ][ 'child_list' ] = [ $this->getFllesCateGoryPageLinkList($params[ 'site_id' ])[ 'data' ] ];
}
}
} else {
$link_list[ $k ][ 'child_list' ] = [];
}
}
// PDF文件列表
foreach ($link_list as $k => $v) {
if (isset($v[ 'child_list' ])) {
foreach ($v[ 'child_list' ] as $ck => $cv) {
if ($cv[ 'name' ] == 'FILES_LIST_PAGE') {
$link_list[ $k ][ 'child_list' ][ $ck ][ 'child_list' ] = [ $this->getFllesPageLinkList($params[ 'site_id' ])[ 'data' ] ];
}
}
} else {
$link_list[ $k ][ 'child_list' ] = [];
}
}
file_put_contents(__DIR__ . '/debug.txt', var_export($link_list,true));
return $this->success($link_list);
}
/**
* 查询文章列表
* @param $site_id
* @return array
*/
public function getFllesPageLinkList($site_id)
{
// $article_model = new ArticleModel();
// $condition = [ [ 'site_id', '=', $site_id ], [ 'status', '=', 1 ] ];
// $site_diy_view_list = $article_model->getArticleList($condition,'*', 'create_time desc', 100);
$files_list = model('files')->getList( [ [ 'site_id', '=', $site_id ] ]);
$link_mic = [
'name' => 'FILES_LIST',
'title' => '文件列表',
'parent' => 'FILES_LIST_PAGE',
'child_list' => []
];
foreach ($files_list as $page_k => $page_v) {
$link_mic[ 'child_list' ][] = [
'name' => 'FILES_'.$page_v[ 'files_id' ],
'title' => $page_v[ 'files_title' ],
'parent' => 'FILES_LIST',
'wap_url' => '/pages_tool/files/detail?files_id=' . $page_v[ 'files_id' ]
];
}
return $this->success($link_mic);
}
/**
* 查询文件分类列表
* @param $site_id
* @return array
*/
public function getFllesCateGoryPageLinkList($site_id)
{
$cate_gorylist = model('files_category')->getList( [ [ 'site_id', '=', $site_id ] ]);
$link_mic = [
'name' => 'FILESCATEGORY_LIST',
'title' => '文件分类',
'parent' => 'FILES_CATE_PAGE',
'child_list' => []
];
foreach ($cate_gorylist as $page_k => $page_v) {
$link_mic[ 'child_list' ][] = [
'name' => 'FILES_CATEGORY_'.$page_v[ 'id' ],
'title' => $page_v[ 'category_name' ],
'parent' => 'FILES_CATEGORY_LIST',
'wap_url' => '/pages_tool/files/list?category_id=' . $page_v[ 'id' ]
];
}
return $this->success($link_mic);
}
/**
* 查询文章分类列表
* @param $site_id

View File

@@ -123,11 +123,12 @@ class BaseShop extends Controller
$config_view = Config::get('view');
$config_view[ 'tpl_replace_string' ] = array_merge($config_view[ 'tpl_replace_string' ], $this->replace);
Config::set($config_view, 'view');
// 其他操作
if (!request()->isAjax()) {
$this->initBaseInfo();
$this->loadTemplate();
}
}
/**

View File

@@ -1907,6 +1907,7 @@ class Goods extends BaseShop
if ($data[ 'code' ] < 0) {
return $data;
}
$result = ( new GoodsImport() )->importGoods($data[ 'data' ], $this->site_id, $type);
return $result;
} else {

View File

@@ -35,6 +35,7 @@ class Index extends BaseShop
*/
public function index()
{
$this->assign('shop_status', 1);
$this->handlePromotion();

View File

@@ -25,6 +25,62 @@ use addon\coupon\model\Coupon as CouponModel;
*/
class Member extends BaseShop
{
public function business(){
$member = new MemberModel();
if (request()->isJson()) {
$page = input('page', 1);
$page_size = input('page_size', PAGE_LIST_ROWS);
$search_text = input('search_keys', '');
$condition = [];
if (!empty($search_text)) {
$condition[] = [ 'name', 'like', '%' . $search_text . '%' ];
}
return $member->getBusinessPageList($condition, $page, $page_size,'id desc');
} else {
return $this->fetch('member/business');
}
}
/**
* 添加/编辑
*/
public function businesspost()
{
$member = new MemberModel();
if (request()->isJson()) {
$id = input('id', 0);
$data = [
'realname' => input('realname', ''),
];
if($id>0){
$res = model('business')->update($data,['id'=>$id]);
}else{
$res = model('business')->add($data);
}
return $member->success($res);
}
}
/**
* 删除
*/
public function businessdelete()
{
$member = new MemberModel();
if (request()->isJson()) {
$id = input('id', 0);
$result = model('business')->delete([['id', '=', $id]]);
return $member->success($result);
}
}
/*
* 会员概况
*/

View File

@@ -104,7 +104,7 @@ class Order extends BaseShop
a.invoice_type,a.invoice_title,a.taxpayer_number,a.invoice_rate,a.invoice_content,a.invoice_delivery_money,a.invoice_full_address,a.is_tax_invoice,a.invoice_email,a.invoice_title_type,a.is_fenxiao,
a.point_money,a.member_card_money,a.member_card_order,a.invoice_status,a.invoice_remark,a.invoice_code,a.invoice_image,a.invoice_time,a.predict_delivery_time,a.is_video_number,a.close_cause,
a.cashier_order_type,a.cashier_sell_time,a.cashier_operator_id,a.cashier_operator_name,a.balance,a.total_balance,a.store_id,a.reduction,a.round_money,a.order_scene,
a.store_commission_rate,a.store_commission,s.store_name,a.merch_id';
a.store_commission_rate,a.store_commission,s.store_name,a.merch_id,a.business';
$order_common_model = new OrderCommonModel();
if (request()->isJson()) {
$page_index = input('page', 1);

View File

@@ -548,6 +548,30 @@
<!-- 商品详情 -->
<div class="layui-tab-item">
<div class="layui-form-item">
<label class="layui-form-label short-label"><span class="required">*</span>PDF标题</label>
<div class="layui-input-inline">
<input type="text" name="pdf_name" value="{$goods_info.pdf_name}" maxlength="40" autocomplete="off" placeholder="请输入PDF标题" class="layui-input len-long">
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item">
<label class="layui-form-label"><span class="required">*</span>PDF文件</label>
<div class="layui-input-block">
<p class="file-upload">{if $goods_info.pdf_url}<a href="{:img($goods_info.pdf_url)}" target="_blank" style="color:#4390FF">查看文件</a>{else}未上传{/if}</p>
<button type="button" class="layui-btn" id="cert_upload">
<i class="layui-icon">&#xe67c;</i>
选择PDF文件
</button>
<input type="hidden" name="pdf_url" class="layui-input len-long" value="{$info.pdf_url ?? ''}" lay-verify="pdf_url">
</div>
<div class="word-aux">请选择pdf文件</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label sm"></label>
<div class="layui-input-inline special-length">
@@ -1057,7 +1081,7 @@
<script src="__STATIC__/ext/video/videojs-ie8.min.js"></script>
<script src="__STATIC__/ext/video/video.min.js"></script>
<script src="__STATIC__/ext/searchable_select/searchable_select.js"></script>
<script src="SHOP_JS/goods_edit_common.js?v=4"></script>
<script src="SHOP_JS/goods_edit_common.js?v={$version}"></script>
<script src="SHOP_JS/goods_edit.js"></script>
<script src="SHOP_JS/category_select.js"></script>

View File

@@ -0,0 +1,272 @@
<style>
.layui-layer-content {padding-bottom: 20px!important;}
</style>
<!-- 搜索框 -->
<div class="single-filter-box">
<button class="layui-btn" onclick="addLabel()">添加姓名</button>
<!-- <div class="layui-form">
<div class="layui-input-inline">
<input type="text" name="search_keys" placeholder="请输入姓名名称" autocomplete="off" class="layui-input" maxlength="10">
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
<i class="layui-icon">&#xe615;</i>
</button>
</div>
</div> -->
</div>
<!-- 列表 -->
<table id="attr_class_list" lay-filter="attr_class_list"></table>
<!-- 编辑排序 -->
<script type="text/html" id="editSort">
<input name="sort" type="number" onchange="editSort({{d.id}}, this)" value="{{d.sort}}" class="layui-input edit-sort len-short">
</script>
<!-- 操作 -->
<script type="text/html" id="operation">
<div class="table-btn">
<a class="layui-btn" lay-event="edit">编辑</a>
<a class="layui-btn" lay-event="delete">删除</a>
</div>
</script>
<script type="text/html" id="addLabel">
<div class="layui-form">
<div class="layui-form-item">
<label class="layui-form-label mid"><span class="required">*</span></label>
<div class="layui-input-block">
<input name="realname" type="text" placeholder="请输入" lay-verify="required" class="layui-input len-mid" maxlength="10">
</div>
</div>
<div class="form-row mid">
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
<button class="layui-btn layui-btn-primary" onclick="closeAttrLayer()">返回</button>
</div>
</div>
</script>
<script type="text/html" id="editLabel">
<div class="layui-form">
<div class="layui-form-item">
<label class="layui-form-label mid"><span class="required">*</span></label>
<div class="layui-input-block">
<input name="realname" type="text" value="{{ d.realname }}" placeholder="请输入" lay-verify="required" class="layui-input len-mid" maxlength="10">
</div>
</div>
<input type="hidden" name="id" value="{{ d.id }}">
<div class="form-row mid">
<button class="layui-btn" lay-submit lay-filter="edit_save">保存</button>
<button class="layui-btn layui-btn-primary" onclick="closeAttrLayer()">返回</button>
</div>
</div>
</script>
<script>
var laytpl, add_attr_index = -1,
form, table;
layui.use(['form', 'laytpl'], function() {
var repeat_flag = false; //防重复标识
laytpl = layui.laytpl;
form = layui.form;
form.render();
table = new Table({
elem: '#attr_class_list',
url: ns.url("shop/member/business"),
cols: [
[ {
field: 'realname',
title: '姓名',
unresize: 'false'
},{
title: '操作',
toolbar: '#operation',
unresize: 'false',
align : 'right'
}]
]
});
/**
* 监听工具栏操作
*/
table.tool(function(obj) {
var data = obj.data;
switch (obj.event) {
case 'edit':
editLabel(data);
break;
case 'delete':
deleteLabel(data.id);
break;
}
});
table.on("sort",function (obj) {
table.reload({
page: {
curr: 1
},
where: {
order:obj.field,
sort:obj.type
}
});
});
/**
* 删除
*/
function deleteLabel(id) {
layer.confirm('确认删除吗?', function(index) {
layer.close(index);
$.ajax({
url: ns.url("shop/member/businessdelete"),
data: {
id:id
},
dataType: 'JSON',
type: 'POST',
success: function(res) {
layer.msg(res.message);
if (res.code == 0) {
table.reload();
}
}
});
});
}
/**
* 搜索功能
*/
form.on('submit(search)', function(data) {
table.reload({
page: {
curr: 1
},
where: data.field
});
});
form.on('submit(save)', function(data) {
if (repeat_flag) return false;
repeat_flag = true;
$.ajax({
url: '{:addon_url("shop/member/businesspost")}',
data: data.field,
dataType: 'JSON',
type: 'POST',
success: function(data) {
layer.msg(data.message);
if (data.code == 0) {
table.reload();
layer.close(add_attr_index);
}
repeat_flag = false;
}
});
return false;
});
form.on('submit(edit_save)', function(data) {
if (repeat_flag) return false;
repeat_flag = true;
$.ajax({
url: '{:addon_url("shop/member/businesspost")}',
data: data.field,
dataType: 'JSON',
type: 'POST',
success: function(data) {
layer.msg(data.message);
if (data.code == 0) {
table.reload();
layer.close(add_attr_index);
}
repeat_flag = false;
}
});
return false;
});
/**
* 表单验证
*/
form.verify({
num: function(value) {
if (value == '') {
return;
}
if (value % 1 != 0) {
return '排序数值必须为整数';
}
if (value < 0) {
return '排序数值必须为大于0';
}
}
});
});
function addLabel() {
var add_attr = $("#addLabel").html();
laytpl(add_attr).render({}, function(html) {
add_attr_index = layer.open({
title: '添加姓名',
skin: 'layer-tips-class',
type: 1,
area: ['500px', '300px'],
content: html,
success: function() {
layui.use('form', function() {
var form = layui.form;
form.render('select');
});
}
});
});
}
function editLabel(data) {
var add_attr = $("#editLabel").html();
laytpl(add_attr).render(data, function(html) {
add_attr_index = layer.open({
title: '编辑姓名',
skin: 'layer-tips-class',
type: 1,
area: ['500px', '300px'],
content: html,
success: function() {
layui.use('form', function() {
var form = layui.form;
form.render('select');
});
}
});
});
// laytpl(add_attr).render(data, function(html) {
// add_attr_index = layer.open({
// title: '编辑姓名',
// skin: 'layer-tips-class',
// type: 1,
// area: ['500px', '300px'],
// content: html
// });
// });
}
function closeAttrLayer() {
layer.close(add_attr_index);
}
</script>

View File

@@ -130,7 +130,7 @@
<!-- 主动退款 -->
{include file="order/shop_active_refund" /}
<script src="SHOP_JS/order_list.js?v=3"></script>
<script src="SHOP_JS/order_list.js?v=5"></script>
<script src="SHOP_JS/lodop_funcs.js"></script>
<script>
var laypage,element, form;

View File

@@ -313,6 +313,9 @@ Order.prototype.tbody = function () {
if (order.buyer_ask_delivery_time != '' && order.buyer_ask_delivery_time != 0) tbody += '<span class="order-item-header" style="margin-left:50px;">要求送达时间:' + (order.buyer_ask_delivery_time.indexOf('-') != -1 ? order.buyer_ask_delivery_time : ns.time_to_date(order.buyer_ask_delivery_time) ) + '</span>';
else tbody += '<span class="order-item-header" style="margin-left:50px;">要求送达时间:立即送达</span>';
}
if (order.business) tbody += '<span class="order-item-header" style="color:red;">业务员:' + order.business +'</span>';
tbody += '</td>';
tbody += '<td colspan="2">';
tbody += '<div class="table-btn order-list-top-line" style="align:right;">';

View File

@@ -0,0 +1,375 @@
<style>
.layui-layer-content {padding-bottom: 20px!important;}
.layui-table-cell, .layui-table-tool-panel li {
overflow: hidden;
text-overflow: ellipsis;
white-space: normal;
}
.layui-table-view .layui-table[lay-size=lg] .layui-table-cell {
line-height: 20px;
font-size: 12px;
}
</style>
<!-- 搜索框 -->
<!-- <div class="single-filter-box">
<button class="layui-btn" id="product_file">导入介质材料</button>
<div class="layui-form">
<div class="layui-input-inline">
<input type="text" name="search_keys" placeholder="标签组名称" autocomplete="off" class="layui-input" maxlength="10">
<button type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
<i class="layui-icon">&#xe615;</i>
</button>
</div>
</div>
</div> -->
<!-- 列表 -->
<table id="attr_class_list" lay-filter="attr_class_list"></table>
<!-- 编辑排序 -->
<script type="text/html" id="editSort">
<input name="sort" type="number" onchange="editSort({{d.id}}, this)" value="{{d.sort}}" class="layui-input edit-sort len-short">
</script>
<!-- 操作 -->
<script type="text/html" id="operation">
<div class="table-btn">
<a class="layui-btn" lay-event="edit">编辑</a>
<a class="layui-btn" lay-event="delete">删除</a>
</div>
</script>
<script type="text/html" id="addLabel">
<div class="layui-form">
<div class="layui-form-item">
<label class="layui-form-label mid"><span class="required">*</span></label>
<div class="layui-input-block">
<input name="label_name" type="text" placeholder="标签组名称" lay-verify="required" class="layui-input len-mid" maxlength="10">
</div>
</div>
<div class="form-row mid">
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
<button class="layui-btn layui-btn-primary" onclick="closeAttrLayer()">返回</button>
</div>
</div>
</script>
<script type="text/html" id="editLabel">
<div class="layui-form">
<div class="layui-form-item">
<label class="layui-form-label mid"><span class="required">*</span></label>
<div class="layui-input-block">
<input name="label_name" type="text" value="{{ d.label_name }}" placeholder="标签组名称" lay-verify="required" class="layui-input len-mid" maxlength="10">
</div>
</div>
<input type="hidden" name="id" value="{{ d.id }}">
<div class="form-row mid">
<button class="layui-btn" lay-submit lay-filter="edit_save">保存</button>
<button class="layui-btn layui-btn-primary" onclick="closeAttrLayer()">返回</button>
</div>
</div>
</script>
<script>
var laytpl, add_attr_index = -1,
form, table;
layui.use(['form', 'laytpl'], function() {
var repeat_flag = false; //防重复标识
laytpl = layui.laytpl;
form = layui.form;
form.render();
table = new Table({
elem: '#attr_class_list',
url: ns.url("shop/seal/medium"),
cols: [
[ {
field: 'name',
title: '介质',
width:'8%',
unresize: 'false'
},{
field: 'FFKM',
title: 'FFKM',
unresize: 'false'
},{
field: 'FEPM',
title: 'FEPM',
unresize: 'false'
},{
field: 'SBR',
title: 'SBR',
unresize: 'false'
},{
field: 'CR',
title: 'CR',
unresize: 'false'
},{
field: 'PTFE&PFA',
title: 'PTFE&PFA',
width:'7%',
unresize: 'false'
},{
field: 'EPDM',
title: 'EPDM',
unresize: 'false'
},{
field: 'ECO',
title: 'ECO',
unresize: 'false'
},{
field: 'ⅡR',
title: 'ⅡR',
unresize: 'false'
},{
field: 'NBR',
title: 'NBR',
unresize: 'false'
},{
field: 'ACM',
title: 'ACM',
unresize: 'false'
},{
field: 'PU',
title: 'PU',
unresize: 'false'
},{
field: 'NR',
title: 'NR',
unresize: 'false'
},{
field: 'FKM',
title: 'FKM',
unresize: 'false'
},{
field: 'AEM',
title: 'AEM',
unresize: 'false'
},{
field: 'HNBR',
title: 'HNBR',
unresize: 'false'
},{
field: 'FVMQ',
title: 'FVMQ',
unresize: 'false'
},{
field: 'CSM',
title: 'CSM',
unresize: 'false'
},{
field: 'VMQ',
title: 'VMQ',
unresize: 'false'
},
// {
// title: '操作',
// toolbar: '#operation',
// unresize: 'false',
// align : 'right'
// }
]]
});
/**
* 监听工具栏操作
*/
table.tool(function(obj) {
var data = obj.data;
switch (obj.event) {
case 'edit':
editLabel(data);
break;
case 'delete':
deleteLabel(data.id);
break;
}
});
table.on("sort",function (obj) {
table.reload({
page: {
curr: 1
},
where: {
order:obj.field,
sort:obj.type
}
});
});
/**
* 删除
*/
function deleteLabel(id) {
layer.confirm('确认删除该标签吗?', function(index) {
layer.close(index);
$.ajax({
url: ns.url("shop/goodslabel/delete"),
data: {
id:id
},
dataType: 'JSON',
type: 'POST',
success: function(res) {
layer.msg(res.message);
if (res.code == 0) {
table.reload();
}
}
});
});
}
/**
* 搜索功能
*/
form.on('submit(search)', function(data) {
table.reload({
page: {
curr: 1
},
where: data.field
});
});
form.on('submit(save)', function(data) {
if (repeat_flag) return false;
repeat_flag = true;
$.ajax({
url: '{:addon_url("shop/goodslabel/add")}',
data: data.field,
dataType: 'JSON',
type: 'POST',
success: function(data) {
layer.msg(data.message);
if (data.code == 0) {
table.reload();
layer.close(add_attr_index);
}
repeat_flag = false;
}
});
return false;
});
form.on('submit(edit_save)', function(data) {
if (repeat_flag) return false;
repeat_flag = true;
$.ajax({
url: '{:addon_url("shop/goodslabel/edit")}',
data: data.field,
dataType: 'JSON',
type: 'POST',
success: function(data) {
layer.msg(data.message);
if (data.code == 0) {
table.reload();
layer.close(add_attr_index);
}
repeat_flag = false;
}
});
return false;
});
/**
* 表单验证
*/
form.verify({
num: function(value) {
if (value == '') {
return;
}
if (value % 1 != 0) {
return '排序数值必须为整数';
}
if (value < 0) {
return '排序数值必须为大于0';
}
}
});
});
function addLabel() {
var add_attr = $("#addLabel").html();
laytpl(add_attr).render({}, function(html) {
add_attr_index = layer.open({
title: '添加标签组',
skin: 'layer-tips-class',
type: 1,
area: ['500px', '200px'],
content: html
});
});
}
function editLabel(data) {
var add_attr = $("#editLabel").html();
laytpl(add_attr).render(data, function(html) {
add_attr_index = layer.open({
title: '编辑标签组',
skin: 'layer-tips-class',
type: 1,
area: ['500px', '300px'],
content: html
});
});
}
function closeAttrLayer() {
layer.close(add_attr_index);
}
// 监听单元格编辑
function editSort(id, event){
var data = $(event).val();
if (data == '') {
$(event).val(0);
data = 0;
}
if(!new RegExp("^-?[0-9]\\d*$").test(data)){
layer.msg("排序号只能是整数");
return ;
}
if(data<0){
layer.msg("排序号必须大于0");
return ;
}
$.ajax({
type: 'POST',
url: ns.url("shop/goodslabel/modifySort"),
data: {
sort: data,
id: id
},
dataType: 'JSON',
success: function(res) {
layer.msg(res.message);
if(res.code==0){
table.reload();
}
}
});
}
</script>

View File

@@ -0,0 +1,120 @@
<style>
.single-filter-box {justify-content: left;line-height: 34px}
.single-filter-box a{cursor:pointer;margin-left: 10px}
</style>
<div class="single-filter-box">
<button class="layui-btn" id="product_file">导入介质材料</button>
<!-- <a class="layui-btn layui-btn-primary" onclick="downloadMemberFile()">点击下载模板</a> -->
</div>
<!-- 列表 -->
<table id="product_import_log_list" lay-filter="product_import_log_list"></table>
<!-- 工具栏操作 -->
<script type="text/html" id="operation">
<div class="table-btn">
<a class="layui-btn" lay-event="info">查看</a>
</div>
</script>
<script>
var table,upload,repeat_flag = false;
layui.use(['form', 'laydate','laytpl', 'upload'], function() {
var form = layui.form,
laydate = layui.laydate,
currentDate = new Date(),
laytpl = layui.laytpl,
minDate = "";
upload = layui.upload;
form.render();
/**
* 表格加载
*/
table = new Table({
elem: '#product_import_log_list',
url: ns.url("shop/seal/mediumimport"),
cols: [
[{
field: 'create_time',
title: '导入时间',
width: '20%',
unresize: 'false',
}, {
field: 'member_num',
title: '导入数量',
width: '20%',
unresize: 'false',
}, /*{
field: 'success_num',
title: '导入成功',
width: '20%',
unresize: 'false',
}, {
field: 'error_num',
title: '导入失败',
width: '15%',
unresize: 'false',
}, */
/*{
title: '操作',
unresize: 'false',
toolbar: '#operation',
align : 'right'
}*/
]
]
});
//允许上传的文件后缀
upload.render({
elem: '#product_file'
,url: ns.url("shop/seal/mediumFile"),
accept:'file',
acceptMime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
exts: 'xlsx',
done: function(res){
if (res.code >= 0) {
product_import(1, res.data.name, res.data.path);
repeat_flag = false;
}else{
layer.msg(res.message);
}
}
});
});
function product_import(index, name, path, success_num = 0, error_num = 0, record = 0){
$.ajax({
url: ns.url("shop/seal/startMediumImport"),
data: {
filename: name,
path: path,
index: index,
success_num : success_num,
error_num : error_num,
record : record
},
dataType: 'JSON',
type: 'POST',
success: function (res) {
index ++;
if(res.code == 0){
if(res.data.num < res.data.allRow){
product_import(index, res.data.name, res.data.path, res.data.success_num, res.data.error_num, res.data.record);
}else{
table.reload();
}
}
if(res.data.error_num > 0) {
layer.msg('导入失败');
} else {
layer.msg('导入成功');
}
}
});
}
function downloadMemberFile(){
location.href = ns.url("shop/member/downloadMemberFile");
return false;
}
</script>

View File

@@ -0,0 +1,258 @@
<style>
.table_body{font-family: arial;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}
.goods-category-list .layui-table td{border-left: 0;border-right: 0;}
.goods-category-list .layui-table .switch{font-size: 16px;cursor: pointer;width: 12px;line-height: 1;display: inline-block;text-align: center;vertical-align: middle;}
.goods-category-list .layui-table img{width: 40px;}
.table_div{color:#666}
.table_head{display: flex;font-weight: bold;background-color: #F7F7F7;}
.table_head li{height: 50px;line-height: 50px;border: 0;padding: 0 22px;font-size: 14px;}
.table_head .operate{text-align: right;}
.table_head li:first-child{padding-right: 0;}
/* 统一所有层级的行样式 */
.category-item{display: flex;border-bottom: 1px solid #e6e6e6;background: #fff;height: 52px !important;}
.category-item .table_td{position: relative;padding: 11px 22px 8px;min-height: 30px;line-height: 33px;font-size: 14px;}
.category-item .table_td span{cursor: pointer;}
.category-item .table_td span>img{width:12px;height:12px}
.category-item .table_td .img-box{width:30px;height:30px;line-height: 30px;}
.category-item .table_td:first-child{padding-right:0}
.category-item .table-btn{display: flex;flex-wrap: wrap;justify-content: flex-end;}
.category-item .layui-btn{display: flex;justify-content: center;align-items: center;height: 23px;border-radius: 50px;background-color: transparent;color: var(--base-color);text-align: center;padding: 2px 0;margin: 5px 0 5px 10px;position: relative;}
/* 子分类容器:默认隐藏 */
.child-category-container{display: none;margin-left: 20px;}
.empty_switch{display: inline-block;width:30px;height:25px;padding-right:15px;}
.js-switch{display: inline-block;height:30px;width:30px;text-align: center;}
/* 拖拽图标:动态缩进 */
.drag-icon{cursor: move;display: inline-block;margin-right: 10px;}
/* 1. 修复:拖拽+展开按钮的容器布局用Flex统一对齐 */
.category-item .table_td:first-child { /* 第一个单元格:拖拽+展开按钮的容器 */
/* display: flex; */
align-items: center;
justify-content: flex-start;
width: 20px !important;
padding-left: 5px !important;
}
/* 2. 修复:拖拽图标的尺寸和间距(固定宽高,避免挤压按钮) */
.drag-icon {
cursor: move;
display: inline-flex; /* 让图标本身垂直居中 */
align-items: center;
justify-content: center;
width: 20px; /* 固定宽度,避免不同层级尺寸变化 */
height: 20px; /* 固定高度,确保垂直对齐 */
margin-right: 8px; /* 与+号按钮的固定间距,避免水平错位 */
}
/* 3. 修复:展开/收起按钮的尺寸和对齐(固定宽高,强制居中) */
.js-switch, .empty_switch {
display: inline-flex; /* 按钮内文字垂直居中 */
align-items: center;
justify-content: center;
width: 20px; /* 固定宽度,所有层级按钮一样大 */
height: 20px; /* 固定高度,避免垂直拉伸 */
padding: 0 !important; /* 清除默认padding避免错位 */
margin: 0 !important; /* 清除默认margin */
line-height: 1; /* 重置行高,避免文字上下偏移 */
}
/* 4. 修复:子分类容器的缩进(确保层级嵌套对齐) */
.child-category-container {
display: none;
margin-left: 25px !important; /* 比拖拽图标缩进多5px增强层级感避免整体左偏 */
}
</style>
<!-- 操作按钮区 -->
<div class="single-filter-box" style="display: block">
<button class="layui-btn" onclick="addCategory()">添加选型</button>
</div>
<!-- 分类列表区:根容器+JSON数据注入 -->
<div class="goods-category-list">
<div class="table_div">
<!-- 表头 -->
<ul class="table_head">
<li style="width:60px"></li>
<li style="flex:6">分类名称</li>
<li class="operate" style="flex:2">操作</li>
</ul>
<!-- 表体空容器JS递归渲染内容 -->
<div class="table_body" id="category-container">
{if condition="!$list"}
<!-- 无数据时显示 -->
<div class="category-item">
<div class="table_td" style="flex:1;text-align: center;">暂无数据</div>
</div>
{/if}
</div>
</div>
</div>
<!-- 关键将PHP分类列表转为JS变量模板引擎输出JSON -->
<script>
// 从PHP获取分类数据转为JS数组支持任意层级
var categoryData = {$list|json_encode|raw};
// 编辑页URL生成函数对应PHP的:href_url()
function getEditUrl(cateId,pid) {
return "{:url('shop/goodscategory/editcategory')}?category_id=" + cateId+'&pid='+pid;
}
function AddUrl(cateId) {
location.hash = ns.hash("shop/seal/poststructure",{pid:cateId});
}
function EditUrl(cateId,pid) {
location.hash = ns.hash("shop/seal/poststructure",{id:cateId,pid:pid});
}
</script>
<script src="STATIC_EXT/drag-arrange.js"></script>
<script src="STATIC_EXT/diyview/js/ddsort.js"></script>
<script>
$(function() {
// 1. 初始化若有分类数据调用JS递归渲染
if (categoryData && categoryData.length > 0) {
var $container = $('#category-container');
// 清空无数据提示(若存在)
$container.find('.category-item').remove();
// 递归渲染根分类depth=0
renderCategory(categoryData, 0, $container);
}
// 2. 统一拖拽排序(按父分类分组)
// initDragSort();
// 3. 展开/收起子分类
bindSwitchEvent();
// 4. 图片放大(保持原有逻辑)
// loadImgMagnify();
});
/**
* 前端递归渲染分类
* @param {Array} cateList - 当前层级的分类数组
* @param {Number} depth - 当前层级深度(根分类=0
* @param {jQuery} $parent - 父容器(子分类将插入此容器)
*/
function renderCategory(cateList, depth, $parent) {
// 遍历当前层级的每个分类
var num = 0
cateList.forEach(function(cate,index) {
// --------------------------
// 新增给child_list加默认值空数组
cate.child_list = cate.child_list || [];
// 1. 生成单个分类项的DOM
// --------------------------
var $cateItem = $('<div class="category-item"></div>')
.data('cateid', cate.category_id)
.data('parentid', cate.parent_id || 0)
.data('sort', cate.sort)
.data('depth', depth);
// 1.1 拖拽+展开/收起列
var dragIconStyle = 'margin-left: ' + (depth * 0) + 'px;'; // 动态缩进
console.log(cate.is_answer)
if(cate.pid == 0){
var switchHtml = cate.child_list.length > 0 // 直接判断长度即可
? `<div class="switch text-color js-switch" data-cateid="${cate.category_id}" data-open="0">+</div>`
: `<div class="switch text-color empty_switch"></div>`;
}else{
var switchHtml = (cate.child_list.length > 0) // 直接判断长度即可
? `<div class="switch text-color js-switch" data-cateid="${cate.category_id}" data-open="0" style="position: absolute;left: 0;top: 14px;">+</div>`
: `<div class="switch text-color empty_switch"></div>`;
}
var $col1 = $('<div class="table_td" style="width:60px;position: relative;"></div>')//drag-icon iconfont icontuodong
.html(`<div class="" style="${dragIconStyle}"></div>` + switchHtml);
// 1.2 分类名称列(含英文名称)
var nameHtml = cate.name;
if(cate.is_answer == 1){
nameHtml += '(这是结果)'
var $col2 = $('<div class="table_td" style="flex:6;color:#ff0000"></div>').text(nameHtml);
}else{
var $col2 = $('<div class="table_td" style="flex:6;"></div>').text(nameHtml);
}
// if (cate.en_category_name) nameHtml += `(${cate.en_category_name})`;
// 1.5 操作列(编辑+删除)
var ahtml = `<div class="table-btn">`
if (cate.is_answer == 0) ahtml+= ` <a class="layui-btn" onclick="AddUrl(`+cate.category_id+`)">添加子类</a>`
ahtml+= `<a class="layui-btn" onclick="EditUrl(`+cate.category_id+`,`+cate.pid+`)">编辑</a>
<a class="layui-btn" href="javascript:deleteCategory(${cate.category_id});">删除</a>
</div>`
var $col5 = $('<div class="table_td" style="flex:2;"></div>')
.html(ahtml);
// 组装单个分类项
//, $col3 , $col4
$cateItem.append($col1, $col2, $col5);
// --------------------------
// 2. 生成子分类容器(若有子分类)
// --------------------------
var $childContainer = null;
if (cate.child_list && cate.child_list.length > 0) {
$childContainer = $('<div class="child-category-container" data-parent-cateid="' + cate.category_id + '"></div>');
// 递归渲染子分类(深度+1父容器为当前子分类容器
renderCategory(cate.child_list, depth + 1, $childContainer);
}
// --------------------------
// 3. 插入到父容器
// --------------------------
$parent.append($cateItem);
if ($childContainer) $parent.append($childContainer);
// num = num + 1
});
}
/**
* 绑定展开/收起事件
*/
function bindSwitchEvent() {
$(".js-switch").off('click').on('click', function(e) {
console.log(123)
e.stopPropagation();
var $switch = $(this);
var cateId = $switch.data('cateid');
var isOpen = $switch.data('open') === 1;
console.log(cateId)
// 切换按钮文本和子容器显示状态
$switch.text(isOpen ? '+' : '-');
$(`.child-category-container[data-parent-cateid="${cateId}"]`).toggle(!isOpen);
$switch.data('open', isOpen ? 0 : 1);
});
}
// --------------------------
// 原有功能函数(保持不变)
// --------------------------
function deleteCategory(category_id) {
layer.confirm('确认删除吗?', function(index) {
layer.close(index);
$.ajax({
url: ns.url("shop/seal/deleteStructure"),
data: { category_id: category_id },
dataType: 'JSON',
type: 'POST',
success: function(res) {
layer.msg(res.message);
if (res.code === 0) {
listenerHash(); // 刷新页面
}
}
});
});
}
function addCategory() {
location.hash = ns.hash("shop/seal/poststructure",{pid:0});
// location.hash = ns.hash("shop/goodscategory/addcategory");
}
</script>

View File

@@ -9,7 +9,12 @@ require __DIR__ . '/vendor/autoload.php';
// 创建应用程序
$app = new App();
// 您的代码使用APP_ENV
// 1. 先加载基础.env文件
if (is_file(__DIR__ . '/.env')) {
$app->env->load(__DIR__ . '/.env');
}
// 2. 根据APP_ENV加载环境特定的.env文件
$appEnv = getenv('APP_ENV') ?: '';
if ($appEnv) {
$envFile = __DIR__ . '/.env.' . $appEnv;
@@ -18,5 +23,10 @@ if ($appEnv) {
}
}
// 3. 为了兼容性,如果存在.env.local也加载优先级最高
if (is_file(__DIR__ . '/.env.local')) {
$app->env->load(__DIR__ . '/.env.local');
}
// 应用初始化
$app->console->run();