diff --git a/niucloud/app/adminapi/controller/member/Config.php b/niucloud/app/adminapi/controller/member/Config.php index 0f5ad54a8..a7fb34857 100644 --- a/niucloud/app/adminapi/controller/member/Config.php +++ b/niucloud/app/adminapi/controller/member/Config.php @@ -37,6 +37,7 @@ class Config extends BaseAdminController [ 'is_username', 1 ], [ 'is_mobile', 0 ], [ 'is_auth_register', 1 ], + [ 'is_force_access_user_info', 0 ], [ 'is_bind_mobile', 0 ], [ 'agreement_show', 0 ], [ 'bg_url', '' ], diff --git a/niucloud/app/common.php b/niucloud/app/common.php index cf0b6dba9..377b68629 100644 --- a/niucloud/app/common.php +++ b/niucloud/app/common.php @@ -226,6 +226,22 @@ function get_start_and_end_time_by_day($day = '') return [ $day_start_time, $day_end_time ]; } +/** + * 获取本周的 开始、结束时间 + * @param data 日期 + */ +function get_weekinfo_by_time($date) +{ + $idx = strftime("%u", strtotime($date)); + $mon_idx = $idx - 1; + $sun_idx = $idx - 7; + return array( + 'week_start_day' => strftime('%Y-%m-%d', strtotime($date) - $mon_idx * 86400), + 'week_end_day' => strftime('%Y-%m-%d', strtotime($date) - $sun_idx * 86400), + ); +} + + /** * 路径转链接 * @param $path diff --git a/niucloud/app/dict/diy/ComponentDict.php b/niucloud/app/dict/diy/ComponentDict.php index 44de42596..a5af8dd14 100644 --- a/niucloud/app/dict/diy/ComponentDict.php +++ b/niucloud/app/dict/diy/ComponentDict.php @@ -190,6 +190,13 @@ class ComponentDict ] ] ], + // 轮播图设置 + 'swiper' => [ + 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 + "indicatorActiveColor" => '#FF0E0E', + 'indicatorStyle' => 'style-1', + 'indicatorAlign' => 'center' + ] ] ], 'RubikCube' => [ @@ -335,7 +342,7 @@ class ComponentDict 'value' => 'style-1' ], 'text' => '超值爆款', - 'textImg' => 'static/resource/images/diy/active_cube/journalism.png', + 'textImg' => 'static/resource/images/diy/active_cube/active_cube_text1.png', "textLink" => [ "name" => "" ], @@ -497,9 +504,18 @@ class ComponentDict 'search' => [ 'logo' => '', 'text' => '请输入搜索关键词', - "link" => [ - "name" => "" + 'link' => [ + 'name' => '' ], + 'style' => 'style-1', + 'styleName' => '风格一', + "subTitle" => [ + "text" => "本地好价·优选生活", + "textColor" => "#000000", + "startColor" => "rgba(255,255,255,0.7)", + "endColor" => "", + ], + 'positionColor' => '#ffffff', 'hotWord' => [ "interval" => 3, 'list' => [] @@ -627,7 +643,7 @@ class ComponentDict 'value' => [ 'moduleOne' => [ 'head' => [ - 'textImg' => 'addon/shop/diy/index/style3/picture_show_head_text3.png', + "textImg" => "static/resource/images/diy/picture_show/picture_show_head_text3.png", "subText" => "最高补1200元", "subTextColor" => "#666666" ], @@ -642,7 +658,7 @@ class ComponentDict "link" => [ "name" => "" ], - "imageUrl" => "addon/shop/diy/index/style3/picture_show_goods5.png" + "imageUrl" => "static/resource/images/diy/picture_show/picture_05.png" ], [ "btnTitle" => [ @@ -654,7 +670,7 @@ class ComponentDict "link" => [ "name" => "" ], - "imageUrl" => "addon/shop/diy/index/style3/picture_show_goods6.png" + "imageUrl" => "static/resource/images/diy/picture_show/picture_06.png" ] ], "listFrame" => [ @@ -664,7 +680,7 @@ class ComponentDict ], 'moduleTwo' => [ 'head' => [ - 'textImg' => 'addon/shop/diy/index/style3/picture_show_head_text4.png', + "textImg" => "static/resource/images/diy/picture_show/picture_show_head_text4.png", "subText" => "每日上新", "subTextColor" => "#666666" ], @@ -679,7 +695,7 @@ class ComponentDict "link" => [ "name" => "" ], - "imageUrl" => "addon/shop/diy/index/style3/picture_show_goods7.png", + "imageUrl" => "static/resource/images/diy/picture_show/picture_07.png" ], [ "btnTitle" => [ @@ -691,7 +707,7 @@ class ComponentDict "link" => [ "name" => "" ], - "imageUrl" => "addon/shop/diy/index/style3/picture_show_goods8.png" + "imageUrl" => "static/resource/images/diy/picture_show/picture_08.png" ] ], "listFrame" => [ @@ -702,29 +718,29 @@ class ComponentDict "moduleRounded" => [ "topRounded" => 10, "bottomRounded" => 10 - ],// 组件属性 - 'template' => [ - "textColor" => "#303133", // 文字颜色 - 'pageStartBgColor' => '', // 底部背景颜色(开始) - 'pageEndBgColor' => '', // 底部背景颜色(结束) - 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) - 'componentBgUrl' => '', // 组件背景图片 - 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 - "componentStartBgColor" => '', // 组件背景颜色(开始) - "componentEndBgColor" => '', // 组件背景颜色(结束) - "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) - "topRounded" => 0, // 组件上圆角 - "bottomRounded" => 0, // 组件下圆角 - "elementBgColor" => '', // 元素背景颜色 - "topElementRounded" => 0,// 元素上圆角 - "bottomElementRounded" => 0, // 元素下圆角 - "margin" => [ - "top" => 0, // 上边距 - "bottom" => 0, // 下边距 - "both" => 10 // 左右边距 - ], - ] - ], + ], + ],// 组件属性 + 'template' => [ + "textColor" => "#303133", // 文字颜色 + 'pageStartBgColor' => '', // 底部背景颜色(开始) + 'pageEndBgColor' => '', // 底部背景颜色(结束) + 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) + 'componentBgUrl' => '', // 组件背景图片 + 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 + "componentStartBgColor" => '', // 组件背景颜色(开始) + "componentEndBgColor" => '', // 组件背景颜色(结束) + "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) + "topRounded" => 0, // 组件上圆角 + "bottomRounded" => 0, // 组件下圆角 + "elementBgColor" => '', // 元素背景颜色 + "topElementRounded" => 0,// 元素上圆角 + "bottomElementRounded" => 0, // 元素下圆角 + "margin" => [ + "top" => 0, // 上边距 + "bottom" => 0, // 下边距 + "both" => 10 // 左右边距 + ], + ] ] ], ], diff --git a/niucloud/app/dict/diy/PagesDict.php b/niucloud/app/dict/diy/PagesDict.php index e90055e4f..144326249 100644 --- a/niucloud/app/dict/diy/PagesDict.php +++ b/niucloud/app/dict/diy/PagesDict.php @@ -65,7 +65,14 @@ class PagesDict "both" => 10 ], "ignore" => [], - "list" => [] + "list" => [], + // 轮播图设置 + 'swiper' => [ + 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 + "indicatorActiveColor" => '#FF0E0E', + 'indicatorStyle' => 'style-1', + 'indicatorAlign' => 'center' + ] ]; $wap_index_list = ( new ConfigService() )->getWapIndexList([ @@ -489,6 +496,13 @@ class PagesDict "imgWidth" => 100, "imgHeight" => 100 ] + ], + // 轮播图设置 + 'swiper' => [ + 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 + "indicatorActiveColor" => '#FF0E0E', + 'indicatorStyle' => 'style-1', + 'indicatorAlign' => 'center' ] ], [ @@ -614,6 +628,13 @@ class PagesDict ] ] ], + // 轮播图设置 + 'swiper' => [ + 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 + "indicatorActiveColor" => '#FF0E0E', + 'indicatorStyle' => 'style-1', + 'indicatorAlign' => 'center' + ], 'pageStartBgColor' => '', 'pageEndBgColor' => '', 'pageGradientAngle' => 'to bottom', @@ -940,6 +961,13 @@ class PagesDict "imgWidth" => 100, "imgHeight" => 100 ] + ], + // 轮播图设置 + 'swiper' => [ + 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 + "indicatorActiveColor" => '#FF0E0E', + 'indicatorStyle' => 'style-1', + 'indicatorAlign' => 'center' ] ], [ @@ -1065,6 +1093,13 @@ class PagesDict ] ] ], + // 轮播图设置 + 'swiper' => [ + 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 + "indicatorActiveColor" => '#FF0E0E', + 'indicatorStyle' => 'style-1', + 'indicatorAlign' => 'center' + ], 'pageStartBgColor' => '', 'pageEndBgColor' => '', 'pageGradientAngle' => 'to bottom', diff --git a/niucloud/app/dict/menu/admin.php b/niucloud/app/dict/menu/admin.php index a74754b9d..078941620 100644 --- a/niucloud/app/dict/menu/admin.php +++ b/niucloud/app/dict/menu/admin.php @@ -871,7 +871,7 @@ return [ ], [ 'menu_name' => '删除站点用户', - 'menu_key' => 'add_user', + 'menu_key' => 'delete_user', 'menu_short_name' => '', 'menu_type' => '2', 'icon' => '', diff --git a/niucloud/app/dict/pay/PayDict.php b/niucloud/app/dict/pay/PayDict.php index cf02bbe20..8de1932ec 100644 --- a/niucloud/app/dict/pay/PayDict.php +++ b/niucloud/app/dict/pay/PayDict.php @@ -58,7 +58,7 @@ class PayDict 'key' => self::WECHATPAY, 'icon' => self::WECHATPAY_ICON, 'setting_component' => '/src/app/views/setting/components/pay-wechatpay.vue', - 'encrypt_params' => ['mch_public_cert_path', 'mch_secret_cert', 'mch_secret_key'], + 'encrypt_params' => ['mch_public_cert_path', 'mch_secret_cert', 'mch_secret_key', 'wechat_public_cert_path'], ],//微信支付 self::ALIPAY => [ 'name' => get_lang('dict_pay.type_alipay'), diff --git a/niucloud/app/event.php b/niucloud/app/event.php index 8b41f9c14..4e187bcd6 100644 --- a/niucloud/app/event.php +++ b/niucloud/app/event.php @@ -12,6 +12,10 @@ $system_event = [ * 系统事件 */ 'AppInit' => [ 'app\listener\system\AppInitListener' ], + // 站点创建之后 + 'AddSiteAfter' => [ + 'app\listener\system\AddSiteAfterListener' + ], 'HttpRun' => [], 'HttpEnd' => [], 'LogLevel' => [], diff --git a/niucloud/app/lang/en/validate.php b/niucloud/app/lang/en/validate.php index 1a6f5bcaf..e996329b3 100644 --- a/niucloud/app/lang/en/validate.php +++ b/niucloud/app/lang/en/validate.php @@ -75,6 +75,8 @@ return [ 'is_mobile_between' => 'is_mobile must be 0 or 1', 'is_auth_register_number' => 'is_auth_register must be a number', 'is_auth_register_between' => 'is_auth_register must be 0 or 1', + 'is_force_access_user_info_number' => 'is_force_access_user_info must be a number', + 'is_force_access_user_info_between' => 'is_force_access_user_info must be 0 or 1', 'is_bind_mobile_number' => 'is_bind_mobile must be a number', 'is_bind_mobile_between' => 'is_bind_mobile must be 0 or 1', 'username_cannot_pure_number' => 'The account cannot be a pure number' diff --git a/niucloud/app/lang/zh-cn/api.php b/niucloud/app/lang/zh-cn/api.php index fe410eccb..3ea0fe1e4 100644 --- a/niucloud/app/lang/zh-cn/api.php +++ b/niucloud/app/lang/zh-cn/api.php @@ -285,6 +285,7 @@ return [ 'SIGN_AWARD' => '签到奖励', 'GET_AWARD' => '恭喜您获得以下奖励', 'WILL_GET_AWARD' => '您将获得以下奖励', + 'SIGN_PERIOD_GREATER_THAN' => '签到周期必须大于0天', //导出相关 'EXPORT_SUCCESS' => '导出成功', diff --git a/niucloud/app/lang/zh-cn/validate.php b/niucloud/app/lang/zh-cn/validate.php index 047d75657..b8301d2f3 100644 --- a/niucloud/app/lang/zh-cn/validate.php +++ b/niucloud/app/lang/zh-cn/validate.php @@ -78,6 +78,8 @@ return [ 'is_mobile_between' => '手机验证码登录参数必须是0或1', 'is_auth_register_number' => '第三方自动注册参数必须是整数', 'is_auth_register_between' => '第三方自动注册参数必须是0或1', + 'is_force_access_user_info_number' => '强制获取用户信息参数必须是整数', + 'is_force_access_user_info_between' => '强制获取用户信息参数必须是0或1', 'is_bind_mobile_number' => '强制绑定手机参数必须是整数', 'is_bind_mobile_between' => '强制绑定手机参数必须是0或1', 'cash_out_is_open_in' => '是否启用必须是0或者1', diff --git a/niucloud/app/listener/member/MemberLoginListener.php b/niucloud/app/listener/member/MemberLoginListener.php index 507003453..75a543faf 100644 --- a/niucloud/app/listener/member/MemberLoginListener.php +++ b/niucloud/app/listener/member/MemberLoginListener.php @@ -12,8 +12,8 @@ namespace app\listener\member; /** - * 会员登录时间 - * Class MemberLogin + * 会员登录事件 + * Class MemberLoginListener * @package app\listener\member */ class MemberLoginListener diff --git a/niucloud/app/listener/member/MemberRegisterListener.php b/niucloud/app/listener/member/MemberRegisterListener.php index d5813d781..0165e1de6 100644 --- a/niucloud/app/listener/member/MemberRegisterListener.php +++ b/niucloud/app/listener/member/MemberRegisterListener.php @@ -27,11 +27,11 @@ class MemberRegisterListener public function handle($member) { // 注册发放成长值 - CoreMemberService::sendGrowth($member['site_id'], $member['member_id'], 'member_register', ['from_type' => 'member_register']); + CoreMemberService::sendGrowth($member[ 'site_id' ], $member[ 'member_id' ], 'member_register', [ 'from_type' => 'member_register' ]); // 注册发放积分 - CoreMemberService::sendPoint($member['site_id'], $member['member_id'], 'member_register', ['from_type' => 'member_register']); + CoreMemberService::sendPoint($member[ 'site_id' ], $member[ 'member_id' ], 'member_register', [ 'from_type' => 'member_register' ]); // 新人专享活动 - event("MemberLoginAfter", ['site_id' => $member['site_id'], 'member_id' => $member['member_id']]); + event("MemberLoginAfter", [ 'site_id' => $member[ 'site_id' ], 'member_id' => $member[ 'member_id' ] ]); return; } } diff --git a/niucloud/app/listener/system/AddSiteAfterListener.php b/niucloud/app/listener/system/AddSiteAfterListener.php new file mode 100644 index 000000000..79eff32ea --- /dev/null +++ b/niucloud/app/listener/system/AddSiteAfterListener.php @@ -0,0 +1,459 @@ +siteId($site_id); + + // 创建素材 + $category_model = new SysAttachmentCategory(); + $attachment_category = $category_model->create([ + 'site_id' => $site_id, + 'pid' => 0, + 'type' => 'image', + 'name' => '默认素材', + 'sort' => 0 + ]); + + $attachment_model = new SysAttachment(); + $attachment_list = [ + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'banner1.jpg', // 附件名称 + 'real_name' => '轮播素材01', // 原始文件名 + 'path' => 'static/resource/images/attachment/banner1.jpg', // 完整地址 + 'url' => 'static/resource/images/attachment/banner1.jpg', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '84097', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'banner2.png', // 附件名称 + 'real_name' => '轮播素材02', // 原始文件名 + 'path' => 'static/resource/images/attachment/banner2.png', // 完整地址 + 'url' => 'static/resource/images/attachment/banner2.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 + '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', // 网络地址 + '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 + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'logo.png', // 附件名称 + 'real_name' => '生活圈', // 原始文件名 + 'path' => 'static/resource/images/attachment/logo.png', // 完整地址 + 'url' => 'static/resource/images/attachment/logo.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '1517', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'nav_coupon.png', // 附件名称 + 'real_name' => '优惠券', // 原始文件名 + 'path' => 'static/resource/images/attachment/nav_coupon.png', // 完整地址 + 'url' => 'static/resource/images/attachment/nav_coupon.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '30937', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'nav_discount.png', // 附件名称 + 'real_name' => '限时折扣', // 原始文件名 + 'path' => 'static/resource/images/attachment/nav_discount.png', // 完整地址 + 'url' => 'static/resource/images/attachment/nav_discount.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '33870', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'nav_fenxiao.png', // 附件名称 + 'real_name' => '分销管理', // 原始文件名 + 'path' => 'static/resource/images/attachment/nav_fenxiao.png', // 完整地址 + 'url' => 'static/resource/images/attachment/nav_fenxiao.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '24026', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_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', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '33429', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'nav_giftcard.png', // 附件名称 + 'real_name' => '礼品卡', // 原始文件名 + 'path' => 'static/resource/images/attachment/nav_giftcard.png', // 完整地址 + 'url' => 'static/resource/images/attachment/nav_giftcard.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '29399', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_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', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '25280', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_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', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '32123', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_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', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '27934', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_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', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '27946 ', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_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', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '33576', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'notice.png', // 附件名称 + 'real_name' => '新闻咨询', // 原始文件名 + 'path' => 'static/resource/images/attachment/notice.png', // 完整地址 + 'url' => 'static/resource/images/attachment/notice.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '3069', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_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', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '2825', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_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', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '2549', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'single_recommend_banner1.png', // 附件名称 + 'real_name' => '精选推荐01', // 原始文件名 + 'path' => 'static/resource/images/attachment/single_recommend_banner1.png', // 完整地址 + 'url' => 'static/resource/images/attachment/single_recommend_banner1.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '73548', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'single_recommend_banner2.png', // 附件名称 + 'real_name' => '精选推荐02', // 原始文件名 + 'path' => 'static/resource/images/attachment/single_recommend_banner2.png', // 完整地址 + 'url' => 'static/resource/images/attachment/single_recommend_banner2.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '61033', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_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', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '3664', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'my_cart.png', // 附件名称 + 'real_name' => '购物车', // 原始文件名 + 'path' => 'static/resource/images/attachment/my_cart.png', // 完整地址 + 'url' => 'static/resource/images/attachment/my_cart.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '31921', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'home_delivery.png', // 附件名称 + 'real_name' => '送货上门', // 原始文件名 + 'path' => 'static/resource/images/attachment/home_delivery.png', // 完整地址 + 'url' => 'static/resource/images/attachment/home_delivery.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '30811', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_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', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '25427', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'nav_balance.png', // 附件名称 + 'real_name' => '我的余额', // 原始文件名 + 'path' => 'static/resource/images/attachment/nav_balance.png', // 完整地址 + 'url' => 'static/resource/images/attachment/nav_balance.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '31437', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'nav_collect.png', // 附件名称 + 'real_name' => '我的收藏', // 原始文件名 + 'path' => 'static/resource/images/attachment/nav_collect.png', // 完整地址 + 'url' => 'static/resource/images/attachment/nav_collect.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '24533', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_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', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '27068', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'nav_leaderboard.png', // 附件名称 + 'real_name' => '排行榜', // 原始文件名 + 'path' => 'static/resource/images/attachment/nav_leaderboard.png', // 完整地址 + 'url' => 'static/resource/images/attachment/nav_leaderboard.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '30098', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'nav_member.png', // 附件名称 + 'real_name' => '会员中心', // 原始文件名 + 'path' => 'static/resource/images/attachment/nav_member.png', // 完整地址 + 'url' => 'static/resource/images/attachment/nav_member.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '30793', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'nav_point.png', // 附件名称 + 'real_name' => '我的积分', // 原始文件名 + 'path' => 'static/resource/images/attachment/nav_point.png', // 完整地址 + 'url' => 'static/resource/images/attachment/nav_point.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '28112', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'nav_shop.png', // 附件名称 + 'real_name' => '线上商城', // 原始文件名 + 'path' => 'static/resource/images/attachment/nav_shop.png', // 完整地址 + 'url' => 'static/resource/images/attachment/nav_shop.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '23057', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_category->id . 'nav_travel.png', // 附件名称 + 'real_name' => '旅游出行', // 原始文件名 + 'path' => 'static/resource/images/attachment/nav_travel.png', // 完整地址 + 'url' => 'static/resource/images/attachment/nav_travel.png', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '27429', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ], + [ + 'site_id' => $site_id, + 'name' => time() . $site_id . $attachment_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', // 网络地址 + 'dir' => 'static/resource/images/attachment', // 附件路径 + 'att_size' => '30421', // 附件大小 + 'att_type' => 'image', // 附件类型image,video + 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... + 'cate_id' => $attachment_category->id, // 素材分类id + 'create_time' => time() + ] + ]; + $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 64a0b5d28..2a6a410a0 100644 --- a/niucloud/app/service/admin/diy/DiyService.php +++ b/niucloud/app/service/admin/diy/DiyService.php @@ -681,10 +681,12 @@ class DiyService extends BaseAdminService } else { // 针对 多应用首页的数据更新 if ($info[ 'name' ] == 'DIY_INDEX' && $info[ 'type' ] == 'DIY_INDEX') { - $this->edit($info[ 'id' ], [ - 'site_id' => $params[ 'site_id' ], - "value" => json_encode($addon_index_template[ 'data' ]) - ]); + if ($info[ 'is_change' ] == 0) { + $this->edit($info[ 'id' ], [ + 'site_id' => $params[ 'site_id' ], + "value" => json_encode($addon_index_template[ 'data' ]) + ]); + } } } diff --git a/niucloud/app/service/admin/generator/GenerateService.php b/niucloud/app/service/admin/generator/GenerateService.php index 629d91309..cc19694c3 100644 --- a/niucloud/app/service/admin/generator/GenerateService.php +++ b/niucloud/app/service/admin/generator/GenerateService.php @@ -187,7 +187,7 @@ class GenerateService extends BaseAdminService $table_info = $tables[0] ?? []; if(empty($table_info)) throw new AdminException('DATA_NOT_EXIST'); - $table_name = str_replace($tablePrefix, '', $table_info['Name']); + $table_name = preg_replace("/^{$tablePrefix}/", '', $table_info['Name'], 1); $fields = Db::name($table_name)->getFields(); $add_table_data = [ @@ -556,7 +556,7 @@ class GenerateService extends BaseAdminService $tables = Db::query($sql); $table_info = $tables[0] ?? []; if(empty($table_info)) throw new AdminException('DATA_NOT_EXIST'); - $table_name = str_replace($tablePrefix, '', $table_info['Name']); + $table_name = preg_replace("/^{$tablePrefix}/", '', $table_info['Name'], 1); return Db::name($table_name)->getFields(); } diff --git a/niucloud/app/service/admin/generator/core/BaseGenerator.php b/niucloud/app/service/admin/generator/core/BaseGenerator.php index d56bb3aa9..45cb95d07 100644 --- a/niucloud/app/service/admin/generator/core/BaseGenerator.php +++ b/niucloud/app/service/admin/generator/core/BaseGenerator.php @@ -331,7 +331,7 @@ abstract class BaseGenerator public function getTableName() { $tablePrefix = config('database.connections.mysql.prefix'); - return str_replace($tablePrefix, '', $this->table['table_name']); + return preg_replace("/^{$tablePrefix}/", '', $this->table['table_name'], 1); } diff --git a/niucloud/app/service/admin/generator/core/ServiceGenerator.php b/niucloud/app/service/admin/generator/core/ServiceGenerator.php index b70a4cc23..ed365db03 100644 --- a/niucloud/app/service/admin/generator/core/ServiceGenerator.php +++ b/niucloud/app/service/admin/generator/core/ServiceGenerator.php @@ -385,7 +385,7 @@ class ServiceGenerator extends BaseGenerator /** * 关联表方法 - * @return void + * @return string */ public function getWithAllFunction() { diff --git a/niucloud/app/service/admin/member/MemberSignService.php b/niucloud/app/service/admin/member/MemberSignService.php index b73a7b091..a96a28652 100644 --- a/niucloud/app/service/admin/member/MemberSignService.php +++ b/niucloud/app/service/admin/member/MemberSignService.php @@ -15,6 +15,7 @@ use app\model\member\MemberSign; use app\service\core\member\CoreMemberService; use app\service\core\sys\CoreConfigService; use core\base\BaseAdminService; +use core\exception\CommonException; /** * 会员签到服务层 @@ -83,6 +84,7 @@ class MemberSignService extends BaseAdminService */ public function setSign(array $value) { + if ($value[ 'sign_period' ] <= 0) throw new CommonException('SIGN_PERIOD_GREATER_THAN'); $data = [ 'is_use' => $value[ 'is_use' ], //是否开启 'sign_period' => $value[ 'sign_period' ], // 签到周期 @@ -114,4 +116,4 @@ class MemberSignService extends BaseAdminService } return $info[ 'value' ]; } -} \ No newline at end of file +} diff --git a/niucloud/app/service/admin/pay/PayChannelService.php b/niucloud/app/service/admin/pay/PayChannelService.php index 1a2c384e6..3b96f17ca 100644 --- a/niucloud/app/service/admin/pay/PayChannelService.php +++ b/niucloud/app/service/admin/pay/PayChannelService.php @@ -166,6 +166,8 @@ class PayChannelService extends BaseAdminService 'mch_secret_key' => $data[ 'mch_secret_key' ] ?? '',//商户秘钥 现在默认认为是v3版 'mch_secret_cert' => $data[ 'mch_secret_cert' ] ?? '',//商户私钥 字符串或路径 'mch_public_cert_path' => $data[ 'mch_public_cert_path' ] ?? '',//商户公钥证书路径 + 'wechat_public_cert_path' => $data['wechat_public_cert_path'] ?? '', // 微信支付公钥 + 'wechat_public_cert_id' => $data['wechat_public_cert_id'] ?? '' // 微信支付公钥id ]; break; case PayDict::ALIPAY: diff --git a/niucloud/app/service/admin/site/SiteService.php b/niucloud/app/service/admin/site/SiteService.php index 93455a561..0b1daae34 100644 --- a/niucloud/app/service/admin/site/SiteService.php +++ b/niucloud/app/service/admin/site/SiteService.php @@ -179,6 +179,10 @@ class SiteService extends BaseAdminService //添加站点成功事件 event("AddSiteAfter", [ 'site_id' => $site_id, 'main_app' => array_diff($site_group[ 'app' ], $site->initalled_addon), 'site_addons' => array_diff($site_group[ 'addon' ], $site->initalled_addon) ]); + // 更新微页面数据 + $diy_service = new DiyService(); + $diy_service->loadDiyData([ 'site_id' => $site_id, 'main_app' => $site_group[ 'app' ] ]); + $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/sys/AttachmentService.php b/niucloud/app/service/admin/sys/AttachmentService.php index 0388f4137..dbe277f97 100644 --- a/niucloud/app/service/admin/sys/AttachmentService.php +++ b/niucloud/app/service/admin/sys/AttachmentService.php @@ -69,7 +69,7 @@ class AttachmentService extends BaseAdminService */ public function modifyCategory($att_id, $cate_id) { - $where = array ( + $where = array( [ 'att_id', '=', $att_id ], [ 'site_id', '=', $this->site_id ], ); @@ -86,7 +86,7 @@ class AttachmentService extends BaseAdminService public function batchModifyCategory($att_ids, $cate_id) { - $where = array ( + $where = array( [ 'att_id', 'in', is_string($att_ids) ? explode($att_ids) : $att_ids ], [ 'site_id', '=', $this->site_id ], ); @@ -121,7 +121,7 @@ class AttachmentService extends BaseAdminService */ public function getPage(array $data) { - $where = array ( + $where = array( [ 'site_id', '=', $this->site_id ] ); if (!empty($data[ 'att_type' ])) { @@ -151,7 +151,7 @@ class AttachmentService extends BaseAdminService $attachment = $category_model->create($data); if (!$attachment->id) throw new AdminException('ADD_FAIL');//创建失败 - return $attachment->att_id; + return $attachment->id; } /** @@ -162,7 +162,7 @@ class AttachmentService extends BaseAdminService */ public function findCategory(int $site_id, int $id) { - $where = array ( + $where = array( [ 'site_id', '=', $site_id ], [ 'id', '=', $id ] ); @@ -181,7 +181,7 @@ class AttachmentService extends BaseAdminService */ public function editCategory(int $id, array $data) { - $where = array ( + $where = array( [ 'site_id', '=', $this->site_id ], [ 'id', '=', $id ] ); @@ -215,7 +215,7 @@ class AttachmentService extends BaseAdminService */ public function getCategoryPage(array $data) { - $where = array ( + $where = array( [ 'site_id', '=', $this->site_id ] ); if (!empty($data[ 'type' ])) { @@ -237,7 +237,7 @@ class AttachmentService extends BaseAdminService */ public function getCategoryList(array $data) { - $where = array ( + $where = array( [ 'site_id', '=', $this->site_id ] ); if (!empty($data[ 'type' ])) { @@ -259,7 +259,7 @@ class AttachmentService extends BaseAdminService $icon_list = IconDict::getIcon(); foreach ($icon_list as $k => $v) { unset($icon_list[ $k ][ 'glyphs' ]); - if (isset($data[ 'name' ]) && $data[ 'name' ] !='' && !str_contains($v['name'], $data['name'])) { + if (isset($data[ 'name' ]) && $data[ 'name' ] != '' && !str_contains($v[ 'name' ], $data[ 'name' ])) { unset($icon_list[ $k ]); } } @@ -295,7 +295,7 @@ class AttachmentService extends BaseAdminService $icon[ $ck ][ 'real_name' ] = $cv[ 'name' ]; // 查询名称 - if (!empty($data[ 'real_name' ]) && !str_contains($cv['name'], $data['real_name'])) { + if (!empty($data[ 'real_name' ]) && !str_contains($cv[ 'name' ], $data[ 'real_name' ])) { unset($icon[ $ck ]); } } diff --git a/niucloud/app/service/api/member/MemberConfigService.php b/niucloud/app/service/api/member/MemberConfigService.php index e5bfef0b0..de2c5a2d9 100644 --- a/niucloud/app/service/api/member/MemberConfigService.php +++ b/niucloud/app/service/api/member/MemberConfigService.php @@ -36,6 +36,7 @@ class MemberConfigService extends BaseApiService $wechat_auth = ( new WechatAuthService() )->jssdkConfig($url); } catch (\Exception $e) { $res[ 'is_auth_register' ] = 0; + $res[ 'is_force_access_user_info' ] = 0; } } return $res; diff --git a/niucloud/app/service/api/sys/AreaService.php b/niucloud/app/service/api/sys/AreaService.php index 8d13713ed..53aef545f 100644 --- a/niucloud/app/service/api/sys/AreaService.php +++ b/niucloud/app/service/api/sys/AreaService.php @@ -110,10 +110,10 @@ class AreaService extends BaseApiService $url = 'https://apis.map.qq.com/ws/geocoder/v1/'; $map = ( new ConfigService() )->getMap(); - $get_data = array ( - 'location' => $params[ 'latlng' ], + $get_data = array( 'key' => $map[ 'key' ], - 'get_poi' => 0,//是否返回周边POI列表:1.返回;0不返回(默认) + 'location' => $params[ 'latlng' ], + 'get_poi' => 0, // 是否返回周边POI列表:1.返回;0不返回(默认) ); $url = $url . '?' . http_build_query($get_data); @@ -131,12 +131,32 @@ class AreaService extends BaseApiService curl_close($curl); if ($res[ 'status' ] == 0) { - $return_array = $res[ 'result' ][ 'address_component' ] ?? []; - $address_data = array ( - 'province' => $return_array[ 'province' ] ?? '', - 'city' => $return_array[ 'city' ] ?? '', - 'district' => $return_array[ 'district' ] ?? '', - 'address' => $return_array[ 'street_number' ] ?? '', + $return_array = $res[ 'result' ][ 'address_component' ] ?? []; // 地址部件,address不满足需求时可自行拼接 + $address_reference = $res[ 'result' ][ 'address_reference' ] ?? []; + $address = $return_array[ 'street_number' ] ?? ''; // 门牌,可能为空字串 + if (empty($address)) { + $address = $return_array[ 'street' ] ?? ''; // 道路,可能为空字串 + } + + $town = $address_reference[ 'town' ] ?? []; + $landmark_l1 = $address_reference[ 'landmark_l1' ] ?? []; + $landmark_l2 = $address_reference[ 'landmark_l2' ] ?? []; + + $community = ''; + if (!empty($landmark_l2[ 'title' ])) { + $community = $landmark_l2[ 'title' ]; // 二级地标,较一级地标更为精确,规模更小 + } elseif (!empty($landmark_l1[ 'title' ])) { + $community = $landmark_l1[ 'title' ]; // 一级地标,可识别性较强、规模较大的地点、小区等 + } elseif (!empty($town[ 'title' ])) { + $community = $town[ 'title' ]; // 乡镇/街道(四级行政区划) + } + + $address_data = array( + 'province' => $return_array[ 'province' ] ?? '', // 省 + 'city' => $return_array[ 'city' ] ?? '', // 市 + 'district' => $return_array[ 'district' ] ?? '', // 区 + 'community' => $community, + 'address' => $address, 'full_address' => $res[ 'result' ][ 'address' ] ?? '', 'formatted_addresses' => $res[ 'result' ][ 'formatted_addresses' ] ?? [] ); @@ -146,19 +166,20 @@ class AreaService extends BaseApiService $province = str_replace('省', '', $address_data[ 'province' ]); $province = str_replace('市', '', $province); } + $city = $address_data[ 'city' ] ?? ''; $district = $address_data[ 'district' ] ?? ''; $province_info = $this->model->where([ [ 'name', 'like', '%' . $province . '%' ], [ 'level', '=', 1 ] ])->field('id,name')->select()->toArray()[ 0 ] ?? []; $province_id = 0; - $province_name = ''; + $province_name = $address_data[ 'province' ]; $city_id = 0; - $city_name = ''; + $city_name = $address_data[ 'city' ]; $district_id = 0; - $district_name = ''; + $district_name = $address_data[ 'district' ]; if (!empty($province_info)) { $province_id = $province_info[ 'id' ]; @@ -193,9 +214,10 @@ class AreaService extends BaseApiService 'district_id' => $district_id, 'district' => $district_name, + 'community' => $address_data[ 'community' ], + 'full_address' => $address_data[ 'full_address' ], 'formatted_addresses' => $address_data[ 'formatted_addresses' ] - ]; } else { throw new ApiException($res[ 'message' ]); diff --git a/niucloud/app/service/api/weapp/WeappAuthService.php b/niucloud/app/service/api/weapp/WeappAuthService.php index c5040a248..9010d79e2 100644 --- a/niucloud/app/service/api/weapp/WeappAuthService.php +++ b/niucloud/app/service/api/weapp/WeappAuthService.php @@ -99,7 +99,7 @@ class WeappAuthService extends BaseApiService } } if ($member_info->isEmpty()) { - $config = ( new MemberConfigService() )->getLoginConfig(); +// $config = ( new MemberConfigService() )->getLoginConfig(); // $is_auth_register = $config[ 'is_auth_register' ]; // 去掉强制绑定手机号判断,否则开启强制绑定的情况下小程序第三方注册无法注册 // 现在不需要控制自动注册,分为两种情况,一种自动注册,另一种手动点击授权登录注册 diff --git a/niucloud/app/service/api/wechat/WechatAuthService.php b/niucloud/app/service/api/wechat/WechatAuthService.php index 99296c9db..f707a40ee 100644 --- a/niucloud/app/service/api/wechat/WechatAuthService.php +++ b/niucloud/app/service/api/wechat/WechatAuthService.php @@ -122,7 +122,7 @@ class WechatAuthService extends BaseApiService } } if ($member_info->isEmpty()) { - $config = ( new MemberConfigService() )->getLoginConfig(); +// $config = ( new MemberConfigService() )->getLoginConfig(); // $is_auth_register = $config[ 'is_auth_register' ]; // 去掉强制绑定手机号判断,否则开启强制绑定的情况下公众号第三方注册无法注册 // 现在不需要控制自动注册,分为两种情况,一种自动注册,另一种手动点击授权登录注册 @@ -134,6 +134,11 @@ class WechatAuthService extends BaseApiService } else { //可能会更新用户和粉丝表 $login_service = new LoginService(); + // 若用户头像为空,那么从微信获取头像和昵称,然后进行更新 + if (empty($member_info->headimg)) { + $member_info->headimg = $avatar; + $member_info->nickname = $nickname; + } return $login_service->login($member_info, MemberLoginTypeDict::WECHAT); } } diff --git a/niucloud/app/service/core/member/CoreMemberConfigService.php b/niucloud/app/service/core/member/CoreMemberConfigService.php index 632d34645..e495323ee 100644 --- a/niucloud/app/service/core/member/CoreMemberConfigService.php +++ b/niucloud/app/service/core/member/CoreMemberConfigService.php @@ -36,6 +36,7 @@ class CoreMemberConfigService extends BaseCoreService 'is_username' => $info[ 'is_username' ] ?? 1, // 是否用户名密码登录 'is_mobile' => $info[ 'is_mobile' ] ?? 0, // 是否手机验证码登录 'is_auth_register' => $info[ 'is_auth_register' ] ?? 1, // 是否第三方自动注册 + 'is_force_access_user_info' => $info[ 'is_force_access_user_info' ] ?? 0, // 是否强制获取用户信息 'is_bind_mobile' => $info[ 'is_bind_mobile' ] ?? 0, // 是否强制绑定手机 'agreement_show' => $info[ 'agreement_show' ] ?? 0, // 政策协议是否展示 'bg_url' => $info[ 'bg_url' ] ?? '', // 背景图片 @@ -52,10 +53,11 @@ class CoreMemberConfigService extends BaseCoreService public function setLoginConfig(int $site_id, array $data) { $config = [ - 'is_username' => $data[ 'is_username' ] ?? 1,//是否用户名密码登录 - 'is_mobile' => $data[ 'is_mobile' ] ?? 0,//是否手机验证码登录 - 'is_auth_register' => $data[ 'is_auth_register' ] ?? 1,//是否第三方自动注册 - 'is_bind_mobile' => $data[ 'is_bind_mobile' ] ?? 0,//是否强制绑定手机 + 'is_username' => $data[ 'is_username' ] ?? 1,// 是否用户名密码登录 + 'is_mobile' => $data[ 'is_mobile' ] ?? 0, // 是否手机验证码登录 + 'is_auth_register' => $data[ 'is_auth_register' ] ?? 1,// 是否第三方自动注册 + 'is_force_access_user_info' => $data[ 'is_force_access_user_info' ] ?? 0, // 是否强制获取用户信息 + 'is_bind_mobile' => $data[ 'is_bind_mobile' ] ?? 0, // 是否强制绑定手机 'agreement_show' => $data[ 'agreement_show' ] ?? 0, // 政策协议是否展示 'bg_url' => $data[ 'bg_url' ] ?? '', // 背景图片 'desc' => $data[ 'desc' ] ?? '' // 描述 diff --git a/niucloud/app/service/core/niucloud/CoreCloudBaseService.php b/niucloud/app/service/core/niucloud/CoreCloudBaseService.php index 958da8169..daf32f7cd 100644 --- a/niucloud/app/service/core/niucloud/CoreCloudBaseService.php +++ b/niucloud/app/service/core/niucloud/CoreCloudBaseService.php @@ -13,7 +13,6 @@ namespace app\service\core\niucloud; use core\base\BaseCoreService; use core\exception\CommonException; -use core\util\niucloud\http\Response; /** * 云服务层 diff --git a/niucloud/app/service/core/paytype/CoreOfflineService.php b/niucloud/app/service/core/paytype/CoreOfflineService.php index a1bbf9db4..f7a3ac2e1 100644 --- a/niucloud/app/service/core/paytype/CoreOfflineService.php +++ b/niucloud/app/service/core/paytype/CoreOfflineService.php @@ -62,6 +62,7 @@ class CoreOfflineService extends BaseCoreService $site_id = $params['site_id']; $voucher = $params['voucher'] ?? ''; + //线下退款凭证校验 if (empty($voucher)) throw new CommonException('VOUCHER_NOT_EMPTY'); $pay = (new CoreRefundService())->findByRefundNo($site_id, $refund_no); diff --git a/niucloud/app/service/core/wechat/CoreWechatServeService.php b/niucloud/app/service/core/wechat/CoreWechatServeService.php index f6a76dc1e..541a7da33 100644 --- a/niucloud/app/service/core/wechat/CoreWechatServeService.php +++ b/niucloud/app/service/core/wechat/CoreWechatServeService.php @@ -39,7 +39,7 @@ class CoreWechatServeService extends BaseCoreService public function authorization(int $site_id, string $url = '', string $scopes = 'snsapi_base') { $oauth = CoreWechatService::app($site_id)->getOauth(); - return $oauth->scopes([$scopes])->redirect($url); + return $oauth->scopes([ $scopes ])->redirect($url); } /** @@ -54,7 +54,7 @@ class CoreWechatServeService extends BaseCoreService $oauth = CoreWechatService::app($site_id)->getOauth(); return $oauth->userFromCode($code); } catch (\Exception $e) { - throw new CommonException($e->getCode()); + throw new CommonException($e->getCode() . ':' . $e->getMessage()); } } @@ -87,9 +87,9 @@ class CoreWechatServeService extends BaseCoreService $app = CoreWechatService::app($site_id); $server = $app->getServer(); - $server->with(function($message, \Closure $next) use ($site_id){ + $server->with(function($message, \Closure $next) use ($site_id) { // 你的自定义逻辑 - return (new CoreWechatMessageService)->message($site_id, $message); + return ( new CoreWechatMessageService )->message($site_id, $message); }); $response = $server->serve(); return $response; @@ -131,7 +131,8 @@ class CoreWechatServeService extends BaseCoreService * @throws InvalidArgumentException * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface */ - public function scan(int $site_id, string $key, int $expire_seconds = 6 * 24 * 3600, $params = []){ + public function scan(int $site_id, string $key, int $expire_seconds = 6 * 24 * 3600, $params = []) + { $api = CoreWechatService::appApiClient($site_id); if (is_int($key) && $key > 0) { $type = 'QR_SCENE'; @@ -140,7 +141,7 @@ class CoreWechatServeService extends BaseCoreService $type = 'QR_STR_SCENE'; $sceneKey = 'scene_str'; } - $scene = [$sceneKey => $key]; + $scene = [ $sceneKey => $key ]; $param = [ 'expire_seconds' => $expire_seconds, 'action_name' => $type, diff --git a/niucloud/app/upgrade/v053/Upgrade.php b/niucloud/app/upgrade/v053/Upgrade.php index d5ea4ec98..cecbb7f38 100644 --- a/niucloud/app/upgrade/v053/Upgrade.php +++ b/niucloud/app/upgrade/v053/Upgrade.php @@ -1,6 +1,6 @@ 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' ] == 'GoodsCoupon') { + + if (!isset($diy_data[ 'value' ][ $ck ][ 'titleColor' ])) { + $diy_data[ 'value' ][ $ck ][ 'titleColor' ] = '#FFFFFF'; + } + + if (!isset($diy_data[ 'value' ][ $ck ][ 'subTitleColor' ])) { + $diy_data[ 'value' ][ $ck ][ 'subTitleColor' ] = '#FFFFFF'; + } + + if (!isset($diy_data[ 'value' ][ $ck ][ 'couponItem' ])) { + $diy_data[ 'value' ][ $ck ][ 'couponItem' ] = [ + "bgColor" => "#FFFFFF", + "textColor" => "#333333", + "subTextColor" => "#666666", + "moneyColor" => "#333333", + "aroundRadius" => 12 + ]; + } + } + + // 商品列表、多商品组 + if ($cv[ 'componentName' ] == 'GoodsList' || $cv[ 'componentName' ] == 'ManyGoodsList') { + if (!isset($diy_data[ 'value' ][ $ck ][ 'goodsNameStyle' ][ 'isShow' ])) { + $diy_data[ 'value' ][ $ck ][ 'goodsNameStyle' ][ 'isShow' ] = true; + } + + if (!isset($diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'isShow' ])) { + $diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'isShow' ] = true; + } + + if (!isset($diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'control' ])) { + $diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'control' ] = true; + } + + if (!isset($diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'color' ])) { + $diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'color' ] = '#FF4142'; + } + + if (isset($diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'mainColor' ])) { + unset($diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'mainColor' ]); + } + + if (isset($diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'mainControl' ])) { + unset($diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'mainControl' ]); + } + + if (isset($diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'lineColor' ])) { + unset($diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'lineColor' ]); + } + + if (isset($diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'lineControl' ])) { + unset($diy_data[ 'value' ][ $ck ][ 'priceStyle' ][ 'lineControl' ]); + } + + if (!isset($diy_data[ 'value' ][ $ck ][ 'saleStyle' ][ 'isShow' ])) { + $diy_data[ 'value' ][ $ck ][ 'saleStyle' ][ 'isShow' ] = true; + } + + if (!isset($diy_data[ 'value' ][ $ck ][ 'labelStyle' ])) { + $diy_data[ 'value' ][ $ck ][ 'labelStyle' ] = [ + "control" => true, + "isShow" => true + ]; + } + + if (!isset($diy_data[ 'value' ][ $ck ][ 'btnStyle' ])) { + $diy_data[ 'value' ][ $ck ][ 'btnStyle' ] = [ + "fontWeight" => false, + "padding" => 0, + "aroundRadius" => 25, + "cartEvent" => "detail", + "text" => "购买", + "textColor" => "#FFFFFF", + "startBgColor" => "#FF4142", + "endBgColor" => "#FF4142", + "style" => "button", + "control" => true + ]; + } + + } + + // 轮播搜索 组件 + if ($cv[ 'componentName' ] == 'CarouselSearch') { + + if (!isset($diy_data[ 'value' ][ $ck ][ 'search' ][ 'style' ])) { + $diy_data[ 'value' ][ $ck ][ 'search' ][ 'style' ] = 'style-1'; + } + + if (!isset($diy_data[ 'value' ][ $ck ][ 'search' ][ 'styleName' ])) { + $diy_data[ 'value' ][ $ck ][ 'search' ][ 'styleName' ] = '风格一'; + } + + if (!isset($diy_data[ 'value' ][ $ck ][ 'search' ][ 'subTitle' ])) { + $diy_data[ 'value' ][ $ck ][ 'search' ][ 'subTitle' ] = [ + "text" => "本地好价·优选生活", + "textColor" => "#000000", + "startColor" => "rgba(255,255,255,0.7)", + "endColor" => "", + ]; + } + + if (!isset($diy_data[ 'value' ][ $ck ][ 'search' ][ 'positionColor' ])) { + $diy_data[ 'value' ][ $ck ][ 'search' ][ 'positionColor' ] = '#FFFFFF'; + } + + } + + // 图片展播 组件 + if ($cv[ 'componentName' ] == 'PictureShow') { + if ($diy_data[ 'value' ][ $ck ][ 'moduleOne' ][ 'head' ][ 'textImg' ] == 'addon/shop/diy/index/style3/picture_show_head_text3.png') { + $diy_data[ 'value' ][ $ck ][ 'moduleOne' ][ 'head' ][ 'textImg' ] = 'static/resource/images/diy/picture_show/picture_show_head_text3.png'; + } + + if ($diy_data[ 'value' ][ $ck ][ 'moduleOne' ][ 'list' ]) { + + foreach ($diy_data[ 'value' ][ $ck ][ 'moduleOne' ][ 'list' ] as $ps_k => $ps_v) { + if ($ps_v[ 'imageUrl' ] == 'addon/shop/diy/index/style3/picture_show_goods5.png') { + $diy_data[ 'value' ][ $ck ][ 'moduleOne' ][ 'list' ][ $ps_k ][ 'imageUrl' ] = 'static/resource/images/diy/picture_show/picture_05.png'; + } + if ($ps_v[ 'imageUrl' ] == 'addon/shop/diy/index/style3/picture_show_goods6.png') { + $diy_data[ 'value' ][ $ck ][ 'moduleOne' ][ 'list' ][ $ps_k ][ 'imageUrl' ] = 'static/resource/images/diy/picture_show/picture_06.png'; + } + } + } + + if ($diy_data[ 'value' ][ $ck ][ 'moduleTwo' ][ 'head' ][ 'textImg' ] == 'addon/shop/diy/index/style3/picture_show_head_text4.png') { + $diy_data[ 'value' ][ $ck ][ 'moduleTwo' ][ 'head' ][ 'textImg' ] = 'static/resource/images/diy/picture_show/picture_show_head_text4.png'; + } + + if ($diy_data[ 'value' ][ $ck ][ 'moduleTwo' ][ 'list' ]) { + + foreach ($diy_data[ 'value' ][ $ck ][ 'moduleTwo' ][ 'list' ] as $ps_k => $ps_v) { + if ($ps_v[ 'imageUrl' ] == 'addon/shop/diy/index/style3/picture_show_goods7.png') { + $diy_data[ 'value' ][ $ck ][ 'moduleTwo' ][ 'list' ][ $ps_k ][ 'imageUrl' ] = 'static/resource/images/diy/picture_show/picture_07.png'; + } + if ($ps_v[ 'imageUrl' ] == 'addon/shop/diy/index/style3/picture_show_goods8.png') { + $diy_data[ 'value' ][ $ck ][ 'moduleTwo' ][ 'list' ][ $ps_k ][ 'imageUrl' ] = 'static/resource/images/diy/picture_show/picture_08.png'; + } + } + } + + } + + // 图文导航 组件 + if ($cv[ 'componentName' ] == 'GraphicNav') { + + if (!isset($diy_data[ 'value' ][ $ck ][ 'swiper' ])) { + $diy_data[ 'value' ][ $ck ][ 'swiper' ] = [ + 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 + "indicatorActiveColor" => '#FF0E0E', + 'indicatorStyle' => 'style-1', + 'indicatorAlign' => 'center', + ]; + } + } + + } + + $diy_data = json_encode($diy_data); + $diy_model->where([ [ 'id', '=', $v[ 'id' ] ] ])->update([ 'value' => $diy_data ]); + } + } + + } + +} diff --git a/niucloud/app/upgrade/v054/upgrade.sql b/niucloud/app/upgrade/v054/upgrade.sql new file mode 100644 index 000000000..e69de29bb diff --git a/niucloud/app/validate/member/LoginConfig.php b/niucloud/app/validate/member/LoginConfig.php index 9ba988092..746468039 100644 --- a/niucloud/app/validate/member/LoginConfig.php +++ b/niucloud/app/validate/member/LoginConfig.php @@ -26,6 +26,7 @@ class LoginConfig extends Validate 'is_username' => 'number|between:0,1', 'is_mobile' => 'number|between:0,1', 'is_auth_register' => 'number|between:0,1', + 'is_force_access_user_info' => 'number|between:0,1', 'is_bind_mobile' => 'number|between:0,1', ]; @@ -37,11 +38,13 @@ class LoginConfig extends Validate 'is_mobile.between' => 'validate_member.is_mobile_between', 'is_auth_register.number' => 'validate_member.is_auth_register_number', 'is_auth_register.between' => 'validate_member.is_auth_register_between', + 'is_force_access_user_info.number' => 'validate_member.is_force_access_user_info_number', + 'is_force_access_user_info.between' => 'validate_member.is_force_access_user_info_between', 'is_bind_mobile.number' => 'validate_member.is_bind_mobile_number', 'is_bind_mobile.between' => 'validate_member.is_bind_mobile_between', ]; protected $scene = [ - 'set' => ['is_username', 'is_mobile', 'is_auth_register', 'is_bind_mobile'], + 'set' => [ 'is_username', 'is_mobile', 'is_auth_register', 'is_force_access_user_info', 'is_bind_mobile' ], ]; } \ No newline at end of file diff --git a/niucloud/config/version.php b/niucloud/config/version.php index 132fd0578..6b6948f2f 100644 --- a/niucloud/config/version.php +++ b/niucloud/config/version.php @@ -1,6 +1,6 @@ '0.5.3', - 'code' => '202410280001' + 'version' => '0.5.4', + 'code' => '202411150001' ]; diff --git a/niucloud/core/base/BaseApiController.php b/niucloud/core/base/BaseApiController.php index 21af68332..dc2af95f4 100644 --- a/niucloud/core/base/BaseApiController.php +++ b/niucloud/core/base/BaseApiController.php @@ -26,4 +26,4 @@ class BaseApiController extends BaseController } -} \ No newline at end of file +} diff --git a/niucloud/core/base/BaseModel.php b/niucloud/core/base/BaseModel.php index 7d9ede1f4..34063f807 100644 --- a/niucloud/core/base/BaseModel.php +++ b/niucloud/core/base/BaseModel.php @@ -32,7 +32,7 @@ class BaseModel extends Model } $tables = Db::query($sql); $table_info = $tables[0] ?? []; - $table_name = str_replace($tablePrefix, '', $table_info['Name']); + $table_name = preg_replace("/^{$tablePrefix}/", '', $table_info['Name'], 1); return Db::name($table_name)->getFields(); } diff --git a/niucloud/core/pay/Wechatpay.php b/niucloud/core/pay/Wechatpay.php index 4bf9739e9..d7d397322 100644 --- a/niucloud/core/pay/Wechatpay.php +++ b/niucloud/core/pay/Wechatpay.php @@ -39,6 +39,14 @@ class Wechatpay extends BasePay $config['mch_public_cert_path'] = url_to_path($config['mch_public_cert_path'] ?? ''); // 选填-默认为正常模式。可选为: MODE_NORMAL, MODE_SERVICE $config['mode'] = Pay::MODE_NORMAL; + if (!empty($config['wechat_public_cert_path']) && !empty($config['wechat_public_cert_id'])) { + $config['wechat_public_cert_path'] = [ + $config['wechat_public_cert_id'] => url_to_path($config['wechat_public_cert_path']) + ]; + } else { + unset($config['wechat_public_cert_path']); + unset($config['wechat_public_cert_id']); + } Pay::config($this->payConfig($config, 'wechat')); }