From cc23fe0a3118c067c331d6a9e8f8f6025a98d2c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=A8=E6=A0=88=E5=B0=8F=E5=AD=A6=E7=94=9F?= <1518079521@qq.com> Date: Wed, 4 Dec 2024 14:09:34 +0800 Subject: [PATCH] up --- niucloud/app/api/controller/sys/Config.php | 5 + niucloud/app/dict/diy/ComponentDict.php | 14 +- niucloud/app/install/view/index/step-4.html | 2 +- niucloud/app/lang/zh-cn/api.php | 2 + .../listener/system/AddSiteAfterListener.php | 219 +++++++++++------- niucloud/app/service/admin/diy/DiyService.php | 76 +++++- .../service/admin/site/SiteGroupService.php | 2 +- .../app/service/admin/site/SiteService.php | 4 +- .../service/admin/upgrade/BackupService.php | 54 +++-- .../wxoplatform/OplatformServerService.php | 4 + niucloud/app/service/api/diy/DiyService.php | 40 +++- .../api/member/MemberAccountService.php | 6 +- .../core/member/CoreMemberCashOutService.php | 8 + niucloud/app/upgrade/v054/upgrade.sql | 0 niucloud/app/upgrade/v055/Upgrade.php | 54 +++++ niucloud/config/version.php | 4 +- niucloud/core/dict/BaseDict.php | 2 +- 17 files changed, 369 insertions(+), 127 deletions(-) delete mode 100644 niucloud/app/upgrade/v054/upgrade.sql create mode 100644 niucloud/app/upgrade/v055/Upgrade.php diff --git a/niucloud/app/api/controller/sys/Config.php b/niucloud/app/api/controller/sys/Config.php index 9d1ff4900..07e99eb0a 100644 --- a/niucloud/app/api/controller/sys/Config.php +++ b/niucloud/app/api/controller/sys/Config.php @@ -11,6 +11,7 @@ namespace app\api\controller\sys; +use addon\shop\app\service\core\CoreStatService; use app\service\api\diy\DiyConfigService; use app\service\api\member\MemberConfigService; use app\service\api\member\MemberLevelService; @@ -90,6 +91,10 @@ class Config extends BaseApiController $res[ 'login_config' ] = ( new MemberConfigService() )->getLoginConfig($data[ 'url' ]); ( new MemberService() )->initMemberData(); + //增加访问数 + if(isset($res[ 'site_info' ]['site_id']) && !empty($res[ 'site_info' ]['site_id'])){ + ( new CoreStatService())->addStat([ 'site_id' => $res[ 'site_info' ]['site_id'], 'access_sum' => 1]); + } return success($res); } } diff --git a/niucloud/app/dict/diy/ComponentDict.php b/niucloud/app/dict/diy/ComponentDict.php index a5af8dd14..83e51c1d4 100644 --- a/niucloud/app/dict/diy/ComponentDict.php +++ b/niucloud/app/dict/diy/ComponentDict.php @@ -95,6 +95,7 @@ class ComponentDict 'sort' => 10002, 'value' => [ "imageHeight" => 180, + "isSameScreen"=> false, "list" => [ [ "link" => [ @@ -196,7 +197,14 @@ class ComponentDict "indicatorActiveColor" => '#FF0E0E', 'indicatorStyle' => 'style-1', 'indicatorAlign' => 'center' - ] + ], + 'template' => [ + "margin" => [ + "top" => 10, // 上边距 + "bottom" => 10, // 下边距 + "both" => 0 // 左右边距 + ], + ], ] ], 'RubikCube' => [ @@ -478,8 +486,8 @@ class ComponentDict "topRounded" => 12, // 组件上圆角 "bottomRounded" => 12, // 组件下圆角 "elementBgColor" => '#FFFAF5', // 元素背景颜色 - "topElementRounded" => 0,// 元素上圆角 - "bottomElementRounded" => 0, // 元素下圆角 + "topElementRounded" => 10,// 元素上圆角 + "bottomElementRounded" => 10, // 元素下圆角 "margin" => [ "top" => 10, // 上边距 "bottom" => 10, // 下边距 diff --git a/niucloud/app/install/view/index/step-4.html b/niucloud/app/install/view/index/step-4.html index cfb392559..81411a23f 100644 --- a/niucloud/app/install/view/index/step-4.html +++ b/niucloud/app/install/view/index/step-4.html @@ -20,7 +20,7 @@
+
恭喜您!已成功安装niucloud-admin。
diff --git a/niucloud/app/lang/zh-cn/api.php b/niucloud/app/lang/zh-cn/api.php index 3ea0fe1e4..234c60570 100644 --- a/niucloud/app/lang/zh-cn/api.php +++ b/niucloud/app/lang/zh-cn/api.php @@ -241,6 +241,8 @@ return [ 'REFUND_HAD_APPLIED' => '订单已申请退款', 'ORDER_UNPAID_NOT_ALLOW_APPLY_REFUND' => '订单尚未支付不能进行退款', + //会员套餐 + 'RECHARGE_NOT_EXIST' => '充值套餐不存在', // 缓存相关 'CLEAR_MYSQL_CACHE_SUCCESS' => '数据表缓存清除成功', diff --git a/niucloud/app/listener/system/AddSiteAfterListener.php b/niucloud/app/listener/system/AddSiteAfterListener.php index 79eff32ea..e7e894048 100644 --- a/niucloud/app/listener/system/AddSiteAfterListener.php +++ b/niucloud/app/listener/system/AddSiteAfterListener.php @@ -25,19 +25,29 @@ class AddSiteAfterListener // 创建素材 $category_model = new SysAttachmentCategory(); - $attachment_category = $category_model->create([ - 'site_id' => $site_id, - 'pid' => 0, - 'type' => 'image', - 'name' => '默认素材', - 'sort' => 0 - ]); + $category_info = $category_model->where([ + [ 'site_id', '=', $site_id ], + [ 'name', '=', '默认素材' ] + ])->field('id')->findOrEmpty()->toArray(); + + if (!empty($category_info)) { + $category_id = $category_info[ 'id' ]; + } else { + $attachment_category = $category_model->create([ + 'site_id' => $site_id, + 'pid' => 0, + 'type' => 'image', + 'name' => '默认素材', + 'sort' => 0 + ]); + $category_id = $attachment_category->id; + } $attachment_model = new SysAttachment(); $attachment_list = [ [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'banner1.jpg', // 附件名称 + 'name' => time() . $site_id . $category_id . 'banner1.jpg', // 附件名称 'real_name' => '轮播素材01', // 原始文件名 'path' => 'static/resource/images/attachment/banner1.jpg', // 完整地址 'url' => 'static/resource/images/attachment/banner1.jpg', // 网络地址 @@ -45,38 +55,64 @@ class AddSiteAfterListener 'att_size' => '84097', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'banner2.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'banner2.jpg', // 附件名称 'real_name' => '轮播素材02', // 原始文件名 - 'path' => 'static/resource/images/attachment/banner2.png', // 完整地址 - 'url' => 'static/resource/images/attachment/banner2.png', // 网络地址 + 'path' => 'static/resource/images/attachment/banner2.jpg', // 完整地址 + 'url' => 'static/resource/images/attachment/banner2.jpg', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '54862', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $category_id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $category_id . 'banner3.jpg', // 附件名称 + 'real_name' => '轮播素材03', // 原始文件名 + 'path' => 'static/resource/images/attachment/banner3.jpg', // 完整地址 + 'url' => 'static/resource/images/attachment/banner3.jpg', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '78247', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $category_id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $category_id . 'banner4.png', // 附件名称 + 'real_name' => '轮播素材04', // 原始文件名 + 'path' => 'static/resource/images/attachment/banner4.png', // 完整地址 + 'url' => 'static/resource/images/attachment/banner4.png', // 网络地址 'dir' => 'static/resource/images/attachment', // 附件路径 'att_size' => '95324', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'banner3.png', // 附件名称 - 'real_name' => '轮播素材03', // 原始文件名 - 'path' => 'static/resource/images/attachment/banner3.png', // 完整地址 - 'url' => 'static/resource/images/attachment/banner3.png', // 网络地址 + 'name' => time() . $site_id . $category_id . 'banner5.png', // 附件名称 + 'real_name' => '轮播素材05', // 原始文件名 + 'path' => 'static/resource/images/attachment/banner5.png', // 完整地址 + 'url' => 'static/resource/images/attachment/banner5.png', // 网络地址 'dir' => 'static/resource/images/attachment', // 附件路径 'att_size' => '97570', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'logo.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'logo.png', // 附件名称 'real_name' => '生活圈', // 原始文件名 'path' => 'static/resource/images/attachment/logo.png', // 完整地址 'url' => 'static/resource/images/attachment/logo.png', // 网络地址 @@ -84,12 +120,12 @@ class AddSiteAfterListener 'att_size' => '1517', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_coupon.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_coupon.png', // 附件名称 'real_name' => '优惠券', // 原始文件名 'path' => 'static/resource/images/attachment/nav_coupon.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_coupon.png', // 网络地址 @@ -97,12 +133,12 @@ class AddSiteAfterListener 'att_size' => '30937', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_discount.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_discount.png', // 附件名称 'real_name' => '限时折扣', // 原始文件名 'path' => 'static/resource/images/attachment/nav_discount.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_discount.png', // 网络地址 @@ -110,12 +146,12 @@ class AddSiteAfterListener 'att_size' => '33870', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_fenxiao.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_fenxiao.png', // 附件名称 'real_name' => '分销管理', // 原始文件名 'path' => 'static/resource/images/attachment/nav_fenxiao.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_fenxiao.png', // 网络地址 @@ -123,12 +159,12 @@ class AddSiteAfterListener 'att_size' => '24026', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_fenxiao_zone.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_fenxiao_zone.png', // 附件名称 'real_name' => '分销专区', // 原始文件名 'path' => 'static/resource/images/attachment/nav_fenxiao_zone.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_fenxiao_zone.png', // 网络地址 @@ -136,12 +172,12 @@ class AddSiteAfterListener 'att_size' => '33429', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_giftcard.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_giftcard.png', // 附件名称 'real_name' => '礼品卡', // 原始文件名 'path' => 'static/resource/images/attachment/nav_giftcard.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_giftcard.png', // 网络地址 @@ -149,12 +185,12 @@ class AddSiteAfterListener 'att_size' => '29399', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_my_address.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_my_address.png', // 附件名称 'real_name' => '收货地址', // 原始文件名 'path' => 'static/resource/images/attachment/nav_my_address.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_my_address.png', // 网络地址 @@ -162,12 +198,12 @@ class AddSiteAfterListener 'att_size' => '25280', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_my_newcomer.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_my_newcomer.png', // 附件名称 'real_name' => '新人专享', // 原始文件名 'path' => 'static/resource/images/attachment/nav_my_newcomer.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_my_newcomer.png', // 网络地址 @@ -175,12 +211,12 @@ class AddSiteAfterListener 'att_size' => '32123', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_news_info.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_news_info.png', // 附件名称 'real_name' => '新闻资讯', // 原始文件名 'path' => 'static/resource/images/attachment/nav_news_info.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_news_info.png', // 网络地址 @@ -188,12 +224,12 @@ class AddSiteAfterListener 'att_size' => '27934', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_point_index.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_point_index.png', // 附件名称 'real_name' => '积分商城', // 原始文件名 'path' => 'static/resource/images/attachment/nav_point_index.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_point_index.png', // 网络地址 @@ -201,12 +237,12 @@ class AddSiteAfterListener 'att_size' => '27946 ', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_sign_in.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_sign_in.png', // 附件名称 'real_name' => '签到', // 原始文件名 'path' => 'static/resource/images/attachment/nav_sign_in.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_sign_in.png', // 网络地址 @@ -214,12 +250,12 @@ class AddSiteAfterListener 'att_size' => '33576', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'notice.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'notice.png', // 附件名称 'real_name' => '新闻咨询', // 原始文件名 'path' => 'static/resource/images/attachment/notice.png', // 完整地址 'url' => 'static/resource/images/attachment/notice.png', // 网络地址 @@ -227,12 +263,12 @@ class AddSiteAfterListener 'att_size' => '3069', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'picture_show_head_text2.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'picture_show_head_text2.png', // 附件名称 'real_name' => '品牌特卖', // 原始文件名 'path' => 'static/resource/images/attachment/picture_show_head_text2.png', // 完整地址 'url' => 'static/resource/images/attachment/picture_show_head_text2.png', // 网络地址 @@ -240,12 +276,12 @@ class AddSiteAfterListener 'att_size' => '2825', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'picture_show_head_text3.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'picture_show_head_text3.png', // 附件名称 'real_name' => '官方补贴', // 原始文件名 'path' => 'static/resource/images/attachment/picture_show_head_text3.png', // 完整地址 'url' => 'static/resource/images/attachment/picture_show_head_text3.png', // 网络地址 @@ -253,38 +289,38 @@ class AddSiteAfterListener 'att_size' => '2549', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'single_recommend_banner1.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'single_recommend_banner1.jpg', // 附件名称 'real_name' => '精选推荐01', // 原始文件名 - 'path' => 'static/resource/images/attachment/single_recommend_banner1.png', // 完整地址 - 'url' => 'static/resource/images/attachment/single_recommend_banner1.png', // 网络地址 + 'path' => 'static/resource/images/attachment/single_recommend_banner1.jpg', // 完整地址 + 'url' => 'static/resource/images/attachment/single_recommend_banner1.jpg', // 网络地址 'dir' => 'static/resource/images/attachment', // 附件路径 - 'att_size' => '73548', // 附件大小 + 'att_size' => '71670', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'single_recommend_banner2.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'single_recommend_banner2.jpg', // 附件名称 'real_name' => '精选推荐02', // 原始文件名 - 'path' => 'static/resource/images/attachment/single_recommend_banner2.png', // 完整地址 - 'url' => 'static/resource/images/attachment/single_recommend_banner2.png', // 网络地址 + 'path' => 'static/resource/images/attachment/single_recommend_banner2.jpg', // 完整地址 + 'url' => 'static/resource/images/attachment/single_recommend_banner2.jpg', // 网络地址 'dir' => 'static/resource/images/attachment', // 附件路径 - 'att_size' => '61033', // 附件大小 + 'att_size' => '72948', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'single_recommend_text1.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'single_recommend_text1.png', // 附件名称 'real_name' => '精选推荐', // 原始文件名 'path' => 'static/resource/images/attachment/single_recommend_text1.png', // 完整地址 'url' => 'static/resource/images/attachment/single_recommend_text1.png', // 网络地址 @@ -292,12 +328,12 @@ class AddSiteAfterListener 'att_size' => '3664', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'my_cart.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'my_cart.png', // 附件名称 'real_name' => '购物车', // 原始文件名 'path' => 'static/resource/images/attachment/my_cart.png', // 完整地址 'url' => 'static/resource/images/attachment/my_cart.png', // 网络地址 @@ -305,12 +341,12 @@ class AddSiteAfterListener 'att_size' => '31921', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'home_delivery.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'home_delivery.png', // 附件名称 'real_name' => '送货上门', // 原始文件名 'path' => 'static/resource/images/attachment/home_delivery.png', // 完整地址 'url' => 'static/resource/images/attachment/home_delivery.png', // 网络地址 @@ -318,12 +354,12 @@ class AddSiteAfterListener 'att_size' => '30811', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_all_class.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_all_class.png', // 附件名称 'real_name' => '全部分类', // 原始文件名 'path' => 'static/resource/images/attachment/nav_all_class.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_all_class.png', // 网络地址 @@ -331,12 +367,12 @@ class AddSiteAfterListener 'att_size' => '25427', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_balance.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_balance.png', // 附件名称 'real_name' => '我的余额', // 原始文件名 'path' => 'static/resource/images/attachment/nav_balance.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_balance.png', // 网络地址 @@ -344,12 +380,12 @@ class AddSiteAfterListener 'att_size' => '31437', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_collect.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_collect.png', // 附件名称 'real_name' => '我的收藏', // 原始文件名 'path' => 'static/resource/images/attachment/nav_collect.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_collect.png', // 网络地址 @@ -357,12 +393,12 @@ class AddSiteAfterListener 'att_size' => '24533', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_coupon_01.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_coupon_01.png', // 附件名称 'real_name' => '瓜分好券', // 原始文件名 'path' => 'static/resource/images/attachment/nav_coupon_01.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_coupon_01.png', // 网络地址 @@ -370,12 +406,12 @@ class AddSiteAfterListener 'att_size' => '27068', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_leaderboard.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_leaderboard.png', // 附件名称 'real_name' => '排行榜', // 原始文件名 'path' => 'static/resource/images/attachment/nav_leaderboard.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_leaderboard.png', // 网络地址 @@ -383,12 +419,12 @@ class AddSiteAfterListener 'att_size' => '30098', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_member.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_member.png', // 附件名称 'real_name' => '会员中心', // 原始文件名 'path' => 'static/resource/images/attachment/nav_member.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_member.png', // 网络地址 @@ -396,12 +432,12 @@ class AddSiteAfterListener 'att_size' => '30793', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_point.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_point.png', // 附件名称 'real_name' => '我的积分', // 原始文件名 'path' => 'static/resource/images/attachment/nav_point.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_point.png', // 网络地址 @@ -409,12 +445,12 @@ class AddSiteAfterListener 'att_size' => '28112', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_shop.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_shop.png', // 附件名称 'real_name' => '线上商城', // 原始文件名 'path' => 'static/resource/images/attachment/nav_shop.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_shop.png', // 网络地址 @@ -422,12 +458,12 @@ class AddSiteAfterListener 'att_size' => '23057', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nav_travel.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nav_travel.png', // 附件名称 'real_name' => '旅游出行', // 原始文件名 'path' => 'static/resource/images/attachment/nav_travel.png', // 完整地址 'url' => 'static/resource/images/attachment/nav_travel.png', // 网络地址 @@ -435,12 +471,12 @@ class AddSiteAfterListener 'att_size' => '27429', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ], [ 'site_id' => $site_id, - 'name' => time() . $site_id . $attachment_category->id . 'nva_group_booking.png', // 附件名称 + 'name' => time() . $site_id . $category_id . 'nva_group_booking.png', // 附件名称 'real_name' => '拼团返利', // 原始文件名 'path' => 'static/resource/images/attachment/nva_group_booking.png', // 完整地址 'url' => 'static/resource/images/attachment/nva_group_booking.png', // 网络地址 @@ -448,11 +484,28 @@ class AddSiteAfterListener 'att_size' => '30421', // 附件大小 'att_type' => 'image', // 附件类型image,video 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $attachment_category->id, // 素材分类id + 'cate_id' => $category_id, // 素材分类id 'create_time' => time() ] ]; - $attachment_model->insertAll($attachment_list); + $exist_attachment_list = $attachment_model->where([ + [ 'site_id', '=', $site_id ], + [ 'path', 'in', array_column($attachment_list, 'path', '') ] + ])->field('path')->select()->toArray(); + + if (!empty($exist_attachment_list)) { + $attachment_path_list = array_column($exist_attachment_list, 'path', ''); + + foreach ($attachment_list as $k => $v) { + if (in_array($v[ 'path' ], $attachment_path_list)) { + unset($attachment_list[ $k ]); + } + } + $attachment_list = array_values($attachment_list); + } + if (!empty($attachment_list)) { + $attachment_model->insertAll($attachment_list); + } return true; } diff --git a/niucloud/app/service/admin/diy/DiyService.php b/niucloud/app/service/admin/diy/DiyService.php index 2a6a410a0..a993aedd2 100644 --- a/niucloud/app/service/admin/diy/DiyService.php +++ b/niucloud/app/service/admin/diy/DiyService.php @@ -15,6 +15,7 @@ use app\dict\diy\ComponentDict; use app\dict\diy\LinkDict; use app\dict\diy\PagesDict; use app\dict\diy\TemplateDict; +use app\dict\sys\FileDict; use app\model\diy\Diy; use app\service\admin\sys\SystemService; use app\service\core\diy\CoreDiyConfigService; @@ -141,6 +142,7 @@ class DiyService extends BaseAdminService if (!empty($data[ 'type' ]) && $data[ 'type' ] == 'DIY_PAGE') { $data[ 'is_default' ] = 1; } +// $data[ 'value' ] = $this->handleThumbImgs($data[ 'value' ]); // 将同类型页面的默认值改为0,默认页面只有一个 if (!empty($data[ 'is_default' ])) { @@ -162,6 +164,7 @@ class DiyService extends BaseAdminService if (empty($data[ 'site_id' ])) { $data[ 'site_id' ] = $this->site_id; } +// $data[ 'value' ] = $this->handleThumbImgs($data[ 'value' ]); $this->model->where([ [ 'id', '=', $id ], [ 'site_id', '=', $data[ 'site_id' ] ] ])->update($data); return true; } @@ -590,21 +593,37 @@ class DiyService extends BaseAdminService { $count = count($params[ 'main_app' ]); $addon = array_merge([ '' ], $params[ 'main_app' ]); + $tag = $params[ 'tag' ] ?? 'add'; foreach ($addon as $k => $v) { - if ($count > 1) { - // 站点多应用,使用系统的页面 - if ($k == 0) { - $is_start = 1; + if ($tag == 'add') { + if ($count > 1) { + // 站点多应用,使用系统的页面 + if ($k == 0) { + $is_start = 1; + } else { + $is_start = 0; + } } else { - $is_start = 0; + // 站点单应用,将应用的设为使用中 + if ($k == 0) { + $is_start = 0; + } else { + $is_start = 1; + } } } else { - // 站点单应用,将应用的设为使用中 - if ($k == 0) { + // 编辑站点套餐的情况 + if ($count > 1) { + // 站点多应用,将不更新启动页 $is_start = 0; } else { - $is_start = 1; + // 站点单应用,将应用的设为使用中 + if ($k == 0) { + $is_start = 0; + } else { + $is_start = 1; + } } } @@ -727,4 +746,45 @@ class DiyService extends BaseAdminService } } + // todo 处理缩略图 + public function handleThumbImgs($data) + { + $data = json_decode($data, true); + + // todo $data['global'] + + foreach ($data[ 'value' ] as $k => $v) { + + // 如果图片尺寸超过 中图的大写才压缩 + + // 图片广告 + if ($v[ 'componentName' ] == 'ImageAds') { + foreach ($v[ 'list' ] as $ck => $cv) { + if (!empty($cv[ 'imageUrl' ]) && + strpos($cv[ 'imageUrl' ], 'addon/') === false && + strpos($cv[ 'imageUrl' ], 'static/') === false && + !isset($data[ 'value' ][ $k ][ 'list' ][ $ck ][ 'imageUrlThumbMid' ])) { + $data[ 'value' ][ $k ][ 'list' ][ $ck ][ 'imageUrlThumbMid' ] = get_thumb_images($this->site_id, $cv[ 'imageUrl' ], FileDict::MID); + } + } + } + + // 图文导航 + if ($v[ 'componentName' ] == 'GraphicNav') { + foreach ($v[ 'list' ] as $ck => $cv) { + if (!empty($cv[ 'imageUrl' ]) && + strpos($cv[ 'imageUrl' ], 'addon/') === false && + strpos($cv[ 'imageUrl' ], 'static/') === false && + !isset($data[ 'value' ][ $k ][ 'list' ][ $ck ][ 'imageUrlThumbMid' ])) { + $data[ 'value' ][ $k ][ 'list' ][ $ck ][ 'imageUrlThumbMid' ] = get_thumb_images($this->site_id, $cv[ 'imageUrl' ], FileDict::MID); + } + } + } + + } + + $data = json_encode($data); + return $data; + } + } diff --git a/niucloud/app/service/admin/site/SiteGroupService.php b/niucloud/app/service/admin/site/SiteGroupService.php index d68fbf274..8665bcb67 100644 --- a/niucloud/app/service/admin/site/SiteGroupService.php +++ b/niucloud/app/service/admin/site/SiteGroupService.php @@ -124,7 +124,7 @@ class SiteGroupService extends BaseAdminService // 更新微页面数据 $diy_service = new DiyService(); - $diy_service->loadDiyData([ 'site_id' => $site[ 'site_id' ], 'main_app' => $data[ 'app' ] ]); + $diy_service->loadDiyData([ 'site_id' => $site[ 'site_id' ], 'main_app' => $data[ 'app' ], 'tag' => 'update' ]); } } } diff --git a/niucloud/app/service/admin/site/SiteService.php b/niucloud/app/service/admin/site/SiteService.php index 0b1daae34..40aabb0a8 100644 --- a/niucloud/app/service/admin/site/SiteService.php +++ b/niucloud/app/service/admin/site/SiteService.php @@ -142,7 +142,7 @@ class SiteService extends BaseAdminService // 更新微页面数据 $diy_service = new DiyService(); - $diy_service->loadDiyData([ 'site_id' => $site_id, 'main_app' => $site_group[ 'app' ] ]); + $diy_service->loadDiyData([ 'site_id' => $site_id, 'main_app' => $site_group[ 'app' ], 'tag' => 'add' ]); Cache::delete('user_role_list_' . $data[ 'uid' ]); @@ -181,7 +181,7 @@ class SiteService extends BaseAdminService // 更新微页面数据 $diy_service = new DiyService(); - $diy_service->loadDiyData([ 'site_id' => $site_id, 'main_app' => $site_group[ 'app' ] ]); + $diy_service->loadDiyData([ 'site_id' => $site_id, 'main_app' => $site_group[ 'app' ], 'tag' => 'update' ]); $data[ 'initalled_addon' ] = array_values(array_unique(array_merge($site->initalled_addon, $site_group[ 'app' ], $site_group[ 'addon' ]))); } diff --git a/niucloud/app/service/admin/upgrade/BackupService.php b/niucloud/app/service/admin/upgrade/BackupService.php index b265e4aeb..bec22da32 100644 --- a/niucloud/app/service/admin/upgrade/BackupService.php +++ b/niucloud/app/service/admin/upgrade/BackupService.php @@ -25,28 +25,29 @@ class BackupService extends UpgradeService * 备份代码 * @return void */ - public function backupCode() { - $backup_dir = $this->upgrade_dir .$this->upgrade_task['key'] . DIRECTORY_SEPARATOR . 'backup' . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR; + public function backupCode() + { + $backup_dir = $this->upgrade_dir . $this->upgrade_task[ 'key' ] . DIRECTORY_SEPARATOR . 'backup' . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR; // 创建目录 dir_mkdir($backup_dir); // 备份admin - dir_copy($this->root_path . 'admin', $backup_dir . 'admin', exclude_dirs:[ '.vscode', 'node_modules', 'dist']); + dir_copy($this->root_path . 'admin', $backup_dir . 'admin', exclude_dirs:[ '.vscode', 'node_modules', 'dist' ]); // 备份uni-app - dir_copy($this->root_path . 'uni-app', $backup_dir . 'uni-app', exclude_dirs:['node_modules', 'dist']); + dir_copy($this->root_path . 'uni-app', $backup_dir . 'uni-app', exclude_dirs:[ 'node_modules', 'dist' ]); // 备份web - dir_copy($this->root_path . 'web', $backup_dir . 'web', exclude_dirs:['node_modules', '.nuxt', '.output']); + dir_copy($this->root_path . 'web', $backup_dir . 'web', exclude_dirs:[ 'node_modules', '.nuxt', '.output' ]); // 备份niucloud $niucloud_dir = $backup_dir . 'niucloud' . DIRECTORY_SEPARATOR; - if ($this->upgrade_task['upgrade']['app_key'] == AddonDict::FRAMEWORK_KEY) { - dir_copy($this->root_path . 'niucloud', $niucloud_dir, exclude_dirs:['addon', 'config', 'public', 'vendor', 'runtime']); + if ($this->upgrade_task[ 'upgrade' ][ 'app_key' ] == AddonDict::FRAMEWORK_KEY) { + dir_copy($this->root_path . 'niucloud', $niucloud_dir, exclude_dirs:[ 'addon', 'config', 'public', 'vendor', 'runtime' ]); // 备份版本文件 - $version_file = $this->root_path . 'niucloud' .DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'version.php'; + $version_file = $this->root_path . 'niucloud' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'version.php'; $to_version_file = $niucloud_dir . 'config' . DIRECTORY_SEPARATOR . 'version.php'; file_copy($version_file, $to_version_file); } else { - $addon = $this->upgrade_task['upgrade']['app_key']; + $addon = $this->upgrade_task[ 'upgrade' ][ 'app_key' ]; $addon_dir = $this->root_path . 'niucloud' . DIRECTORY_SEPARATOR . 'addon' . DIRECTORY_SEPARATOR . $addon; $to_addon_dir = $niucloud_dir . 'addon' . DIRECTORY_SEPARATOR . $addon; dir_copy($addon_dir, $to_addon_dir); @@ -69,24 +70,25 @@ class BackupService extends UpgradeService * 备份数据库 * @return void */ - public function backupSql() { - $backup_dir = $this->upgrade_dir .$this->upgrade_task['key'] . DIRECTORY_SEPARATOR . 'backup' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR; + public function backupSql() + { + $backup_dir = $this->upgrade_dir . $this->upgrade_task[ 'key' ] . DIRECTORY_SEPARATOR . 'backup' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR; // 创建目录 dir_mkdir($backup_dir); $db = new DbBackup([ - 'path' => $backup_dir,//数据库备份路径 - 'part' => 1048576,//数据库备份卷大小 + 'path' => $backup_dir,//数据库备份路径 + 'part' => 1048576,//数据库备份卷大小 'compress' => 0,//数据库备份文件是否启用压缩 0不压缩 1 压缩 - 'level' => 9 //数据库备份文件压缩级别 1普通 4 一般 9最高 + 'level' => 9 //数据库备份文件压缩级别 1普通 4 一般 9最高 ]); $tables = []; - $prefix = config('database.connections.'.config('database.default'))['prefix']; - if ($this->upgrade_task['upgrade']['app_key'] == AddonDict::FRAMEWORK_KEY) { + $prefix = config('database.connections.' . config('database.default'))[ 'prefix' ]; + if ($this->upgrade_task[ 'upgrade' ][ 'app_key' ] == AddonDict::FRAMEWORK_KEY) { // 不需要备份的表 - $noot_need_backup = ["{$prefix}sys_user_log", "{$prefix}jobs", "{$prefix}jobs_failed"]; - $sys_models = (new GenerateService())->getModels(['addon' => 'system']); + $noot_need_backup = [ "{$prefix}sys_schedule_log", "{$prefix}sys_user_log", "{$prefix}jobs", "{$prefix}jobs_failed" ]; + $sys_models = ( new GenerateService() )->getModels([ 'addon' => 'system' ]); foreach ($sys_models as $model) { $name = "\\$model"; $class = new $name(); @@ -96,11 +98,19 @@ class BackupService extends UpgradeService } } } else { - $addon_models = (new GenerateService())->getModels(['addon' => $this->upgrade_task['upgrade']['app_key']]); + $addon_models = ( new GenerateService() )->getModels([ 'addon' => $this->upgrade_task[ 'upgrade' ][ 'app_key' ] ]); foreach ($addon_models as $model) { - $name = "\\$model"; - $class = new $name(); - $tables[] = $class->getTable(); + try { + // 不需要备份的表 + $noot_need_backup = [ "{$prefix}shop_stat", "{$prefix}shop_goods_stat", "{$prefix}shop_goods_browse" ]; + $name = "\\$model"; + $class = new $name(); + + if (!in_array($class->getTable(), $noot_need_backup)) { + $tables[] = $class->getTable(); + } + } catch (\Exception $e) { + } } } diff --git a/niucloud/app/service/admin/wxoplatform/OplatformServerService.php b/niucloud/app/service/admin/wxoplatform/OplatformServerService.php index 26afee27f..19a3fda1d 100644 --- a/niucloud/app/service/admin/wxoplatform/OplatformServerService.php +++ b/niucloud/app/service/admin/wxoplatform/OplatformServerService.php @@ -95,6 +95,10 @@ class OplatformServerService extends BaseAdminService $site_id = CoreOplatformService::getSiteIdByAuthorizerAppid($message['ToUserName']); CoreOplatformService::releaseWeapp($site_id); (new WeappVersion())->where(['site_id' => $site_id, 'status' => CloudDict::APPLET_AUDITING ])->update(['status' => CloudDict::APPLET_UPLOAD_SUCCESS ]); + + // 发布后重新设置下域名 + request()->siteId($site_id); + (new WeappVersionService())->setDomain(); return true; } diff --git a/niucloud/app/service/api/diy/DiyService.php b/niucloud/app/service/api/diy/DiyService.php index 7e79f68f7..f91ac5789 100644 --- a/niucloud/app/service/api/diy/DiyService.php +++ b/niucloud/app/service/api/diy/DiyService.php @@ -13,6 +13,7 @@ namespace app\service\api\diy; use app\dict\diy\PagesDict; use app\dict\diy\TemplateDict; +use app\dict\sys\FileDict; use app\model\diy\Diy; use core\base\BaseApiService; @@ -69,6 +70,7 @@ class DiyService extends BaseApiService $field = 'id,site_id,title,name,type,template, mode,value,is_default,share,visit_count'; $info = $this->model->field($field)->where($condition)->findOrEmpty()->toArray(); + if (empty($info)) { // 查询默认页面数据 if (!empty($params[ 'name' ])) { @@ -88,6 +90,8 @@ class DiyService extends BaseApiService ]; } } + } else { +// $info[ 'value' ] = $this->handleThumbImgs($info[ 'value' ]); } return $info; } @@ -111,4 +115,38 @@ class DiyService extends BaseApiService return []; } -} \ No newline at end of file + // todo 使用缩略图 + public function handleThumbImgs($data) + { + $data = json_decode($data, true); + + // todo $data['global'] + + foreach ($data[ 'value' ] as $k => $v) { + + // 图片广告 + if ($v[ 'componentName' ] == 'ImageAds') { + foreach ($v[ 'list' ] as $ck => $cv) { + if (!empty($cv[ 'imageUrlThumbMid' ])) { + $data[ 'value' ][ $k ][ 'list' ][ $ck ][ 'imageUrl' ] = $cv[ 'imageUrlThumbMid' ]; + } + } + } + + // 图文导航 + if ($v[ 'componentName' ] == 'GraphicNav') { + + foreach ($v[ 'list' ] as $ck => $cv) { + if (!empty($cv[ 'imageUrlThumbMid' ])) { + $data[ 'value' ][ $k ][ 'list' ][ $ck ][ 'imageUrl' ] = $cv[ 'imageUrlThumbMid' ]; + } + } + } + + } + + $data = json_encode($data); + return $data; + } + +} diff --git a/niucloud/app/service/api/member/MemberAccountService.php b/niucloud/app/service/api/member/MemberAccountService.php index 60b71e992..caa034f38 100644 --- a/niucloud/app/service/api/member/MemberAccountService.php +++ b/niucloud/app/service/api/member/MemberAccountService.php @@ -40,7 +40,7 @@ class MemberAccountService extends BaseApiService { $where[ 'member_id' ] = $this->member_id; $field = 'id, member_id, site_id, account_type, account_data, from_type, related_id, create_time, memo'; - $search_model = $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ 'member_id', 'account_type', 'from_type', 'create_time', 'account_data_gt', 'account_data_lt', 'keyword' ], $where)->field($field)->order('create_time desc')->append([ 'from_type_name', 'account_type_name' ]); + $search_model = $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ 'member_id', 'account_type', 'from_type', 'create_time', 'account_data_gt', 'account_data_lt', 'keyword' ], $where)->field($field)->order('id desc')->append([ 'from_type_name', 'account_type_name' ]); return $this->pageQuery($search_model); } @@ -68,7 +68,7 @@ class MemberAccountService extends BaseApiService } $where[ 'member_id' ] = $this->member_id; $field = 'id, member_id, site_id, account_type, account_data, from_type, related_id, create_time, memo'; - $search_model = $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->where($type_where)->withSearch([ 'member_id', 'account_type', 'from_type', 'create_time', 'account_data_gt', 'account_data_lt' ], $where)->field($field)->order('create_time desc')->append([ 'from_type_name', 'account_type_name' ]); + $search_model = $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->where($type_where)->withSearch([ 'member_id', 'account_type', 'from_type', 'create_time', 'account_data_gt', 'account_data_lt' ], $where)->field($field)->order('id desc')->append([ 'from_type_name', 'account_type_name' ]); $list = $this->pageQuery($search_model); $list[ 'data' ] = $this->monthlyGrouping($list[ 'data' ]); return $list; @@ -112,7 +112,7 @@ class MemberAccountService extends BaseApiService $where[ 'member_id' ] = $this->member_id; $where[ 'create_time' ] = $data[ 'create_time' ]; $field = 'id, member_id, site_id, account_type, account_data, account_sum, from_type, related_id, create_time, memo'; - $search_model = $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->where($type_where)->withSearch([ 'member_id', 'create_time' ], $where)->field($field)->order('create_time desc')->append([ 'from_type_name', 'account_type_name' ]); + $search_model = $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->where($type_where)->withSearch([ 'member_id', 'create_time' ], $where)->field($field)->order('id desc')->append([ 'from_type_name', 'account_type_name' ]); return $this->pageQuery($search_model); } diff --git a/niucloud/app/service/core/member/CoreMemberCashOutService.php b/niucloud/app/service/core/member/CoreMemberCashOutService.php index 37ef13385..28b9c54c5 100644 --- a/niucloud/app/service/core/member/CoreMemberCashOutService.php +++ b/niucloud/app/service/core/member/CoreMemberCashOutService.php @@ -147,7 +147,15 @@ class CoreMemberCashOutService extends BaseCoreService $data['transfer_account'] = $cash_out['transfer_account']; $transfer_type = $cash_out['transfer_type']; if($transfer_type == TransferDict::WECHAT){ + //根据转账方式和会员的授权信息来判断可以使用的转账方式 $member = (new CoreMemberService())->find($site_id, $cash_out['member_id']); + if(!empty($member['wx_openid'])){ + $data['openid'] = $member['wx_openid']; + } else if(!empty($member['weapp_openid'])){ + $data['openid'] = $member['wweapp_openid']; + }else{ + $data['openid'] = ''; + } $data['openid'] = $member['wx_openid']; } }else{ diff --git a/niucloud/app/upgrade/v054/upgrade.sql b/niucloud/app/upgrade/v054/upgrade.sql deleted file mode 100644 index e69de29bb..000000000 diff --git a/niucloud/app/upgrade/v055/Upgrade.php b/niucloud/app/upgrade/v055/Upgrade.php new file mode 100644 index 000000000..5bf0e8469 --- /dev/null +++ b/niucloud/app/upgrade/v055/Upgrade.php @@ -0,0 +1,54 @@ +handleDiyData(); + } + + /** + * 处理自定义数据 + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + private function handleDiyData() + { + $diy_model = new Diy(); + $where = [ + [ 'value', '<>', '' ] + ]; + $field = 'id,site_id,name,title,template,value'; + $list = $diy_model->where($where)->field($field)->select()->toArray(); + + if (!empty($list)) { + foreach ($list as $k => $v) { + $diy_data = json_decode($v[ 'value' ], true); + + foreach ($diy_data[ 'value' ] as $ck => $cv) { + + // 图片广告 组件 + if ($cv[ 'componentName' ] == 'ImageAds') { + + if (!isset($diy_data[ 'value' ][ $ck ][ 'isSameScreen' ])) { + $diy_data[ 'value' ][ $ck ][ 'isSameScreen' ] = false; + } + + } + + } + + $diy_data = json_encode($diy_data); + $diy_model->where([ [ 'id', '=', $v[ 'id' ] ] ])->update([ 'value' => $diy_data ]); + } + } + + } + +} diff --git a/niucloud/config/version.php b/niucloud/config/version.php index 6b6948f2f..67b60a767 100644 --- a/niucloud/config/version.php +++ b/niucloud/config/version.php @@ -1,6 +1,6 @@ '0.5.4', - 'code' => '202411150001' + 'version' => '0.5.5', + 'code' => '202412030001' ]; diff --git a/niucloud/core/dict/BaseDict.php b/niucloud/core/dict/BaseDict.php index e53c93119..591d101ca 100644 --- a/niucloud/core/dict/BaseDict.php +++ b/niucloud/core/dict/BaseDict.php @@ -47,7 +47,7 @@ abstract class BaseDict extends Storage $headers = request()->header(); $admin_site_id_name = system_name('admin_site_id_name'); - $api_site_id_name = system_name('admin_site_id_name'); + $api_site_id_name = system_name('api_site_id_name'); $site_id = $headers[$admin_site_id_name] ?? $headers[$api_site_id_name] ?? 0; if ((int)$site_id) {