diff --git a/niucloud/.gitignore b/niucloud/.gitignore index 5269144f1..5c6f5b639 100644 --- a/niucloud/.gitignore +++ b/niucloud/.gitignore @@ -1,4 +1,5 @@ /.idea /.vscode *.log +/runtime install.lock \ No newline at end of file diff --git a/niucloud/LICENSE.txt b/niucloud/LICENSE.txt new file mode 100644 index 000000000..574a39c40 --- /dev/null +++ b/niucloud/LICENSE.txt @@ -0,0 +1,32 @@ + +ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 +版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn) +All rights reserved。 +ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 + +Apache Licence是著名的非盈利开源组织Apache采用的协议。 +该协议和BSD类似,鼓励代码共享和尊重原作者的著作权, +允许代码修改,再作为开源或商业软件发布。需要满足 +的条件: +1. 需要给代码的用户一份Apache Licence ; +2. 如果你修改了代码,需要在被修改的文件中说明; +3. 在延伸的代码中(修改和有源代码衍生的代码中)需要 +带有原来代码中的协议,商标,专利声明和其他原来作者规 +定需要包含的说明; +4. 如果再发布的产品中包含一个Notice文件,则在Notice文 +件中需要带有本协议内容。你可以在Notice中增加自己的 +许可,但不可以表现为对Apache Licence构成更改。 +具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/niucloud/addon/shop/Addon.php b/niucloud/addon/shop/Addon.php deleted file mode 100644 index eefa879cb..000000000 --- a/niucloud/addon/shop/Addon.php +++ /dev/null @@ -1,1273 +0,0 @@ -where([ - [ 'name', '=', '商城素材' ] - ])->field('id')->findOrEmpty()->toArray(); - - if (!empty($category_info)) { - $category_id = $category_info[ 'id' ]; - } else { - $attachment_category = $category_model->create([ - 'pid' => 0, - 'type' => 'image', - 'name' => '商城素材', - 'sort' => 1 - ]); - $category_id = $attachment_category->id; - } - - $attachment_model = new SysAttachment(); - $attachment_list = [ - [ - 'name' => time() . $category_id . 'banner1.jpg', // 附件名称 - 'real_name' => '轮播素材01', // 原始文件名 - 'path' => 'addon/shop/attachment/banner1.jpg', // 完整地址 - 'url' => 'addon/shop/attachment/banner1.jpg', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '84097', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'banner2.jpg', // 附件名称 - 'real_name' => '轮播素材02', // 原始文件名 - 'path' => 'addon/shop/attachment/banner2.jpg', // 完整地址 - 'url' => 'addon/shop/attachment/banner2.jpg', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '54862', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'banner3.jpg', // 附件名称 - 'real_name' => '轮播素材03', // 原始文件名 - 'path' => 'addon/shop/attachment/banner3.jpg', // 完整地址 - 'url' => 'addon/shop/attachment/banner3.jpg', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '78247', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'banner4.png', // 附件名称 - 'real_name' => '轮播素材04', // 原始文件名 - 'path' => 'addon/shop/attachment/banner4.png', // 完整地址 - 'url' => 'addon/shop/attachment/banner4.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '95324', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'banner5.png', // 附件名称 - 'real_name' => '轮播素材05', // 原始文件名 - 'path' => 'addon/shop/attachment/banner5.png', // 完整地址 - 'url' => 'addon/shop/attachment/banner5.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '97570', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'logo.png', // 附件名称 - 'real_name' => '生活圈', // 原始文件名 - 'path' => 'addon/shop/attachment/logo.png', // 完整地址 - 'url' => 'addon/shop/attachment/logo.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '1517', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_coupon.png', // 附件名称 - 'real_name' => '优惠券', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_coupon.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_coupon.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '30937', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_discount.png', // 附件名称 - 'real_name' => '限时折扣', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_discount.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_discount.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '33870', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_fenxiao.png', // 附件名称 - 'real_name' => '分销管理', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_fenxiao.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_fenxiao.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '24026', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_fenxiao_zone.png', // 附件名称 - 'real_name' => '分销专区', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_fenxiao_zone.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_fenxiao_zone.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '33429', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_giftcard.png', // 附件名称 - 'real_name' => '礼品卡', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_giftcard.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_giftcard.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '29399', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_my_address.png', // 附件名称 - 'real_name' => '收货地址', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_my_address.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_my_address.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '25280', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_my_newcomer.png', // 附件名称 - 'real_name' => '新人专享', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_my_newcomer.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_my_newcomer.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '32123', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_news_info.png', // 附件名称 - 'real_name' => '新闻资讯', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_news_info.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_news_info.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '27934', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_point_index.png', // 附件名称 - 'real_name' => '积分商城', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_point_index.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_point_index.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '27946 ', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_sign_in.png', // 附件名称 - 'real_name' => '签到', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_sign_in.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_sign_in.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '33576', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'notice.png', // 附件名称 - 'real_name' => '新闻咨询', // 原始文件名 - 'path' => 'addon/shop/attachment/notice.png', // 完整地址 - 'url' => 'addon/shop/attachment/notice.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '3069', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'picture_show_head_text2.png', // 附件名称 - 'real_name' => '品牌特卖', // 原始文件名 - 'path' => 'addon/shop/attachment/picture_show_head_text2.png', // 完整地址 - 'url' => 'addon/shop/attachment/picture_show_head_text2.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '2825', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'picture_show_head_text3.png', // 附件名称 - 'real_name' => '官方补贴', // 原始文件名 - 'path' => 'addon/shop/attachment/picture_show_head_text3.png', // 完整地址 - 'url' => 'addon/shop/attachment/picture_show_head_text3.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '2549', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'single_recommend_banner1.jpg', // 附件名称 - 'real_name' => '精选推荐01', // 原始文件名 - 'path' => 'addon/shop/attachment/single_recommend_banner1.jpg', // 完整地址 - 'url' => 'addon/shop/attachment/single_recommend_banner1.jpg', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '71670', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'single_recommend_banner2.jpg', // 附件名称 - 'real_name' => '精选推荐02', // 原始文件名 - 'path' => 'addon/shop/attachment/single_recommend_banner2.jpg', // 完整地址 - 'url' => 'addon/shop/attachment/single_recommend_banner2.jpg', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '72948', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'single_recommend_text1.png', // 附件名称 - 'real_name' => '精选推荐', // 原始文件名 - 'path' => 'addon/shop/attachment/single_recommend_text1.png', // 完整地址 - 'url' => 'addon/shop/attachment/single_recommend_text1.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '3664', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'my_cart.png', // 附件名称 - 'real_name' => '购物车', // 原始文件名 - 'path' => 'addon/shop/attachment/my_cart.png', // 完整地址 - 'url' => 'addon/shop/attachment/my_cart.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '31921', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'home_delivery.png', // 附件名称 - 'real_name' => '送货上门', // 原始文件名 - 'path' => 'addon/shop/attachment/home_delivery.png', // 完整地址 - 'url' => 'addon/shop/attachment/home_delivery.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '30811', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_all_class.png', // 附件名称 - 'real_name' => '全部分类', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_all_class.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_all_class.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '25427', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_balance.png', // 附件名称 - 'real_name' => '我的余额', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_balance.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_balance.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '31437', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_collect.png', // 附件名称 - 'real_name' => '我的收藏', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_collect.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_collect.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '24533', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_coupon_01.png', // 附件名称 - 'real_name' => '瓜分好券', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_coupon_01.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_coupon_01.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '27068', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_leaderboard.png', // 附件名称 - 'real_name' => '排行榜', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_leaderboard.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_leaderboard.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '30098', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_member.png', // 附件名称 - 'real_name' => '会员中心', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_member.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_member.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '30793', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_point.png', // 附件名称 - 'real_name' => '我的积分', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_point.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_point.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '28112', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_shop.png', // 附件名称 - 'real_name' => '线上商城', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_shop.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_shop.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '23057', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_travel.png', // 附件名称 - 'real_name' => '旅游出行', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_travel.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_travel.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '27429', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nva_group_booking.png', // 附件名称 - 'real_name' => '拼团返利', // 原始文件名 - 'path' => 'addon/shop/attachment/nva_group_booking.png', // 完整地址 - 'url' => 'addon/shop/attachment/nva_group_booking.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '30421', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'head_01.png', // 附件名称 - 'real_name' => '超值爆款', // 原始文件名 - 'path' => 'addon/shop/attachment/head_01.png', // 完整地址 - 'url' => 'addon/shop/attachment/head_01.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '3958', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'head_02.png', // 附件名称 - 'real_name' => '限时折扣', // 原始文件名 - 'path' => 'addon/shop/attachment/head_02.png', // 完整地址 - 'url' => 'addon/shop/attachment/head_02.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '2408', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'head_03.png', // 附件名称 - 'real_name' => '商品榜单', // 原始文件名 - 'path' => 'addon/shop/attachment/head_03.png', // 完整地址 - 'url' => 'addon/shop/attachment/head_03.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '2621', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'image_ads_01.png', // 附件名称 - 'real_name' => '商品低至五折', // 原始文件名 - 'path' => 'addon/shop/attachment/image_ads_01.png', // 完整地址 - 'url' => 'addon/shop/attachment/image_ads_01.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '44566', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_01.png', // 附件名称 - 'real_name' => '魔方素材01', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_01.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_01.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '36850', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_02.png', // 附件名称 - 'real_name' => '魔方素材02', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_02.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_02.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '26463', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_03.png', // 附件名称 - 'real_name' => '魔方素材03', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_03.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_03.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '29142', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_04.png', // 附件名称 - 'real_name' => '魔方素材04', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_04.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_04.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '26068', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_05.png', // 附件名称 - 'real_name' => '魔方素材05', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_05.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_05.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '107422', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_06.png', // 附件名称 - 'real_name' => '魔方素材06', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_06.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_06.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '130868', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_07.png', // 附件名称 - 'real_name' => '魔方素材07', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_07.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_07.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '129386', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_08.png', // 附件名称 - 'real_name' => '魔方素材08', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_08.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_08.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '81778', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_sow_community.png', // 附件名称 - 'real_name' => '种草社区', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_sow_community.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_sow_community.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '24576', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ] - ]; - $attachment_model->insertAll($attachment_list); - - // 创建默认商品海报 - $poster = new CorePosterService(); - $template = $poster->getTemplateList('shop', 'shop_goods')[ 0 ]; - $poster->add('shop', [ - 'name' => $template[ 'name' ], - 'type' => $template[ 'type' ], - 'value' => $template[ 'data' ], - 'status' => 1, - 'is_default' => 1 - ]); - - // 创建默认积分商品海报 - $poster = new CorePosterService(); - $template = $poster->getTemplateList('shop', 'shop_point_goods')[ 0 ]; - $poster->add('shop', [ - 'name' => $template[ 'name' ], - 'type' => $template[ 'type' ], - 'value' => $template[ 'data' ], - 'status' => 1, - 'is_default' => 1 - ]); - - $diy_service = new DiyService(); - - // 设置 首页 默认模板 - $diy_service->setDiyData([ - 'key' => 'DIY_INDEX', - 'type' => 'index', - 'addon' => 'shop', - 'is_start' => 1 - ]); - - // 设置 个人中心 默认模板 - $diy_service->setDiyData([ - 'key' => 'DIY_MEMBER_INDEX', - 'type' => 'member_index', - 'addon' => 'shop', - 'is_start' => 1 - ]); - - // 创建 积分商城 微页面 - $addon_flag = 'DIY_SHOP_POINT_INDEX'; - $addon_index_template = $diy_service->getFirstPageData($addon_flag, 'shop'); - $diy_service->add([ - 'page_title' => $addon_index_template[ 'title' ], - "title" => $addon_index_template[ 'title' ], - "name" => $addon_flag, - "type" => $addon_flag, - "template" => $addon_index_template[ 'template' ], - "mode" => $addon_index_template[ 'mode' ], - "value" => json_encode($addon_index_template[ 'data' ]), - "is_default" => 1, - "is_change" => 0 - ]); - - // 创建物流公司 - $company_service = new CoreCompanyService(); - - $company_list = [ - [ - 'create_time' => time(), - 'company_name' => '邮政EMS', - 'logo' => 'addon/shop/express/ems.jpg', - 'url' => 'https://www.ems.com.cn', - 'express_no' => 'EMS', - 'express_no_electronic_sheet' => 'EMS', - 'electronic_sheet_switch' => 1, - 'print_style' => [ - [ - 'template_name' => '一联130 76*130', - 'template_size' => '130', - ], - [ - 'template_name' => '一联130新 76*130', - 'template_size' => '1301', - ], - [ - 'template_name' => '二联180 100*180', - 'template_size' => '180', - ], - [ - 'template_name' => '二联180新 100*180', - 'template_size' => '1801', - ], - [ - 'template_name' => '二联150 100*150', - 'template_size' => '0', - ], - [ - 'template_name' => '二联150新 100*150', - 'template_size' => '1501', - ] - ], - 'exp_type' => [ - [ - 'text' => '特快专递', - 'value' => 1 - ], - [ - 'text' => '代收到付', - 'value' => 8 - ], - [ - 'text' => '快递包裹', - 'value' => 9 - ], - [ - 'text' => '电商标快', - 'value' => 10 - ], - [ - 'text' => '国内标快', - 'value' => 11 - ] - ] - ], - [ - 'create_time' => time(), - 'company_name' => '邮政快递包裹', - 'logo' => 'addon/shop/express/youzhengkd.png', - 'url' => 'https://www.ems.com.cn', - 'express_no' => 'YZPY', - 'express_no_electronic_sheet' => 'YZPY', - 'electronic_sheet_switch' => 1, - 'print_style' => [ - [ - 'template_name' => '一联130 76*130', - 'template_size' => '130', - ], - [ - 'template_name' => '一联130新 76*130', - 'template_size' => '1301', - ], - [ - 'template_name' => '二联1801 100*180', - 'template_size' => '1801', - ], - [ - 'template_name' => '二联180 100*180', - 'template_size' => '0', - ], - [ - 'template_name' => '二联180新 100*180', - 'template_size' => '180', - ], - [ - 'template_name' => '二联150 100*150', - 'template_size' => '150', - ], - [ - 'template_name' => '二联150新 100*150', - 'template_size' => '1501', - ] - ], - 'exp_type' => [ - [ - 'text' => '标准快递', - 'value' => 1 - ] - ] - ], - [ - 'create_time' => time(), - 'company_name' => '顺丰速运', - 'logo' => 'addon/shop/express/shunfeng.png', - 'url' => 'https://www.sf-express.com/chn/sc', - 'express_no' => 'SF', - 'express_no_electronic_sheet' => 'SF', - 'electronic_sheet_switch' => 1, - 'print_style' => [ - [ - 'template_name' => '一联130新 76*130', - 'template_size' => '1301', - ], - [ - 'template_name' => '二联150新 100*150', - 'template_size' => '0', - ], - [ - 'template_name' => '二联180新 100*180', - 'template_size' => '180', - ], - [ - 'template_name' => '三联210新 100*210', - 'template_size' => '210', - ] - ], - 'exp_type' => [ - [ - 'text' => '顺丰特快', - 'value' => 1 - ], - [ - 'text' => '顺丰标快', - 'value' => 2 - ], - [ - 'text' => '顺丰即日', - 'value' => 6 - ], - [ - 'text' => '冷运标快', - 'value' => 201 - ], - [ - 'text' => '顺丰微小件', - 'value' => 202 - ] - ] - ], - [ - 'create_time' => time(), - 'company_name' => '中通快递', - 'logo' => 'addon/shop/express/zhongtong.png', - 'url' => 'https://www.zto.com', - 'express_no' => 'ZTO', - 'express_no_electronic_sheet' => 'ZTO', - 'electronic_sheet_switch' => 1, - 'print_style' => [ - [ - 'template_name' => '一联130 76*130', - 'template_size' => '130', - ], - [ - 'template_name' => '二联180 100*180', - 'template_size' => '0', - ], - [ - 'template_name' => '二联180新 100*180', - 'template_size' => '180', - ] - ], - 'exp_type' => [] - ], - [ - 'create_time' => time(), - 'company_name' => '圆通速递', - 'logo' => 'addon/shop/express/yuantong.png', - 'url' => 'https://www.yto.net.cn', - 'express_no' => 'YTO', - 'express_no_electronic_sheet' => 'YTO', - 'electronic_sheet_switch' => 1, - 'print_style' => [ - [ - 'template_name' => '一联130 76*130', - 'template_size' => '130', - ], - [ - 'template_name' => '一联130新 76*130', - 'template_size' => '1301', - ], - [ - 'template_name' => '二联180 100*180', - 'template_size' => '0', - ], - [ - 'template_name' => '三联180 100*180', - 'template_size' => '180', - ], - [ - 'template_name' => '二联180新 100*180', - 'template_size' => '1801', - ] - ], - 'exp_type' => [ - [ - 'text' => '标准快递', - 'value' => 1 - ], - [ - 'text' => '圆准达', - 'value' => 2 - ] - ] - ], - [ - 'create_time' => time(), - 'company_name' => '申通快递', - 'logo' => 'addon/shop/express/shentong.png', - 'url' => 'https://www.sto.cn/pc', - 'express_no' => 'STO', - 'express_no_electronic_sheet' => 'STO', - 'electronic_sheet_switch' => 1, - 'print_style' => [ - [ - 'template_name' => '一联130 76*130', - 'template_size' => '130', - ], - [ - 'template_name' => '一联130新 76*130', - 'template_size' => '1301', - ], - [ - 'template_name' => '二联180 100*180', - 'template_size' => '0', - ], - [ - 'template_name' => '二联180新 100*180', - 'template_size' => '180', - ], - [ - 'template_name' => '三联180新 100*180', - 'template_size' => '1803', - ], - [ - 'template_name' => '二联150 100*150', - 'template_size' => '150', - ] - ], - 'exp_type' => [ - [ - 'text' => '标准快递', - 'value' => 1 - ], - ] - ], - [ - 'create_time' => time(), - 'company_name' => '韵达速递', - 'logo' => 'addon/shop/express/yunda.png', - 'url' => 'http://www.yundaex.com/cn', - 'express_no' => 'YD', - 'express_no_electronic_sheet' => 'YD', - 'electronic_sheet_switch' => 1, - 'print_style' => [ - [ - 'template_name' => '一联130 100*130', - 'template_size' => '130', - ], - [ - 'template_name' => '二联180 100*180', - 'template_size' => '180', - ], - [ - 'template_name' => '二联203 100*203', - 'template_size' => '0', - ] - ], - 'exp_type' => [] - ], - [ - 'create_time' => time(), - 'company_name' => '极兔速递', - 'logo' => 'addon/shop/express/jitu.png', - 'url' => 'https://www.jtexpress.cn', - 'express_no' => 'JTSD', - 'express_no_electronic_sheet' => 'JTSD', - 'electronic_sheet_switch' => 1, - 'print_style' => [ - [ - 'template_name' => '一联130 100*130', - 'template_size' => '130', - ], - [ - 'template_name' => '二联180 100*180', - 'template_size' => '0', - ] - ], - 'exp_type' => [ - [ - 'text' => '标准快递', - 'value' => 1 - ], - [ - 'text' => '兔优达', - 'value' => 2 - ] - ] - ], - [ - 'create_time' => time(), - 'company_name' => '菜鸟速递', - 'logo' => 'addon/shop/express/cainiao.jpg', - 'url' => 'https://express.cainiao.com/', - 'express_no' => 'CNSD', - 'express_no_electronic_sheet' => 'CNSD', - 'electronic_sheet_switch' => 1, - 'print_style' => [ - [ - 'template_name' => '一联130 100*130', - 'template_size' => '0', - ] - ], - 'exp_type' => [ - [ - 'text' => '当日达', - 'value' => 1 - ], - [ - 'text' => '次日达', - 'value' => 2 - ], - [ - 'text' => '预约配送', - 'value' => 3 - ], - [ - 'text' => '当日下午达', - 'value' => 4 - ], - [ - 'text' => '当日夜间达', - 'value' => 5 - ], - [ - 'text' => '次日上午达', - 'value' => 6 - ] - ] - ], - [ - 'create_time' => time(), - 'company_name' => '京东快递', - 'logo' => 'addon/shop/express/jingdong.jpg', - 'url' => 'https://www.jdl.com', - 'express_no' => 'JD', - 'express_no_electronic_sheet' => 'JD', - 'electronic_sheet_switch' => 1, - 'print_style' => [ - [ - 'template_name' => '一联130新 76*130', - 'template_size' => '130', - ], - [ - 'template_name' => '二联110 100*110', - 'template_size' => '0', - ], - [ - 'template_name' => '二联110新 100*110', - 'template_size' => '110', - ] - ], - 'exp_type' => [] - ] - ]; - $company_service->addAll($company_list); - - $company_list_for_print = $company_service->getList([ - [ 'express_no_electronic_sheet', 'in', [ 'EMS', 'YZPY', 'SF' ] ], - [ 'electronic_sheet_switch', '=', 1 ], - ], 'company_id,company_name,express_no_electronic_sheet,print_style,exp_type'); - - $electronic_sheet_list = []; - foreach ($company_list_for_print as $k => $v) { - $electronic_sheet_list[] = [ - 'template_name' => $v[ 'company_name' ] . ' ' . $v[ 'print_style' ][ 0 ][ 'template_name' ], - 'express_company_id' => $v[ 'company_id' ], - 'customer_name' => '电子面单账号', - 'customer_pwd' => '电子面单密码', - 'send_site' => '', - 'send_staff' => '', - 'month_code' => '', - 'pay_type' => 1, - 'is_notice' => 0, - 'status' => 1, - 'exp_type' => $v[ 'exp_type' ][ 0 ][ 'value' ], - 'print_style' => $v[ 'print_style' ][ 0 ][ 'template_size' ], - 'is_default' => $k == 0 ? 1 : 0, - 'create_time' => time() - ]; - } - - $electronic_sheet_service = new CoreElectronicSheetService(); - $electronic_sheet_service->addAll($electronic_sheet_list); - - // 添加商品标签分组 - $label_group_model = new LabelGroup(); - $label_model = new Label(); - - // 添加默认商品标签分组 - $label_group_res = $label_group_model->create([ - 'group_name' => '默认', - 'create_time' => time(), - ]); - - // 添加商品标签 - $label_list = [ - [ - 'label_name' => '热卖', - 'group_id' => $label_group_res->group_id, - 'style_type' => 'diy', - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(250, 35, 28, 1)', - 'border_color' => '' - ], - 'icon' => '', - 'status' => 1, - 'sort' => 0, - 'create_time' => time() - ], - [ - 'label_name' => '新品推荐', - 'group_id' => $label_group_res->group_id, - 'style_type' => 'diy', - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(250, 35, 28, 1)', - 'border_color' => '' - ], - 'icon' => '', - 'status' => 1, - 'sort' => 1, - 'create_time' => time() - ], - [ - 'label_name' => '甄选优品', - 'group_id' => $label_group_res->group_id, - 'style_type' => 'diy', - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(250, 35, 28, 1)', - 'border_color' => '' - ], - 'icon' => '', - 'status' => 1, - 'sort' => 2, - 'create_time' => time() - ], - [ - 'label_name' => '百亿补贴', - 'group_id' => $label_group_res->group_id, - 'style_type' => 'icon', - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(250, 35, 28, 1)', - 'border_color' => '' - ], - 'icon' => 'addon/shop/goods/label/icon1.png', - 'status' => 1, - 'sort' => 3, - 'create_time' => time() - ], - [ - 'label_name' => '双11', - 'group_id' => $label_group_res->group_id, - 'style_type' => 'icon', - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(250, 35, 28, 1)', - 'border_color' => '' - ], - 'icon' => 'addon/shop/goods/label/icon2.png', - 'status' => 1, - 'sort' => 4, - 'create_time' => time() - ], - [ - 'label_name' => '双12', - 'group_id' => $label_group_res->group_id, - 'style_type' => 'icon', - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(250, 35, 28, 1)', - 'border_color' => '' - ], - 'icon' => 'addon/shop/goods/label/icon3.png', - 'status' => 1, - 'sort' => 5, - 'create_time' => time() - ] - ]; - $label_model->insertAll($label_list); - - $listener = new ThemeColorListener(); - $addon_theme = $listener->handle([ 'key' => 'shop' ]); - $diy_service->initAddonThemeColorData('shop', $addon_theme); - return true; - } - - /** - * 插件卸载执行 - */ - public function uninstall() - { - // 删除自定义海报 - $poster = new CorePosterService(); - $poster->del([ - [ 'type', 'in', [ 'shop_goods', 'shop_point_goods' ] ] - ]); - - // 删除微页面 - $diy_service = new CoreDiyService(); - $diy_service->del([ - [ 'name', 'in', [ 'DIY_SHOP_INDEX', 'DIY_SHOP_MEMBER_INDEX', 'DIY_SHOP_POINT_INDEX' ] ] - ]); - - // 删除商城素材 - $category_model = new SysAttachmentCategory(); - $category_model->where([ - [ 'name', '=', '商城素材' ] - ])->delete(); - - $attachment_model = new SysAttachment(); - $path_arr = [ - 'addon/shop/attachment/banner1.jpg', - 'shop/attachment/banner2.png', - 'addon/shop/attachment/banner3.png', - 'addon/shop/attachment/logo.png', - 'addon/shop/attachment/nav_coupon.png', - 'addon/shop/attachment/nav_discount.png', - 'addon/shop/attachment/nav_fenxiao.png', - 'addon/shop/attachment/nav_fenxiao_zone.png', - 'addon/shop/attachment/nav_giftcard.png', - 'addon/shop/attachment/nav_my_address.png', - 'addon/shop/attachment/nav_my_newcomer.png', - 'addon/shop/attachment/nav_news_info.png', - 'addon/shop/attachment/nav_point_index.png', - 'addon/shop/attachment/nav_sign_in.png', - 'addon/shop/attachment/notice.png', - 'addon/shop/attachment/picture_show_head_text2.png', - 'addon/shop/attachment/picture_show_head_text3.png', - 'addon/shop/attachment/single_recommend_banner1.png', - 'addon/shop/attachment/single_recommend_banner2.png', - 'addon/shop/attachment/single_recommend_text1.png', - 'addon/shop/attachment/my_cart.png', - 'addon/shop/attachment/home_delivery.png', - 'addon/shop/attachment/nav_all_class.png', - 'addon/shop/attachment/nav_balance.png', - 'addon/shop/attachment/nav_collect.png', - 'addon/shop/attachment/nav_coupon_01.png', - 'addon/shop/attachment/nav_leaderboard.png', - 'addon/shop/attachment/nav_member.png', - 'addon/shop/attachment/nav_point.png', - 'addon/shop/attachment/nav_shop.png', - 'addon/shop/attachment/nav_travel.png', - 'addon/shop/attachment/nva_group_booking.png', - 'addon/shop/attachment/head_01.png', - 'addon/shop/attachment/head_02.png', - 'addon/shop/attachment/head_03.png', - 'addon/shop/attachment/image_ads_01.png', - 'addon/shop/attachment/active_cube_01.png', - 'addon/shop/attachment/active_cube_02.png', - 'addon/shop/attachment/active_cube_03.png', - 'addon/shop/attachment/active_cube_04.png', - 'addon/shop/attachment/active_cube_05.png', - 'addon/shop/attachment/active_cube_06.png', - 'addon/shop/attachment/active_cube_07.png', - 'addon/shop/attachment/active_cube_08.png' - ]; - $attachment_model->where([ - [ 'path', 'in', $path_arr ] - ])->delete(); - - $diy_theme_model = new DiyTheme(); - // 删除原有主题风格颜色 - $diy_theme_model->where([ [ 'addon', '=', 'shop' ] ])->delete(); - return true; - } - - /** - * 插件升级执行 - */ - public function upgrade() - { - return true; - } -} diff --git a/niucloud/addon/shop/admin/api/delivery.ts b/niucloud/addon/shop/admin/api/delivery.ts deleted file mode 100644 index 050a22333..000000000 --- a/niucloud/addon/shop/admin/api/delivery.ts +++ /dev/null @@ -1,575 +0,0 @@ -import request from '@/utils/request' - -/********************************* 物流公司 ***************************************/ -/** - * 获取物流公司分页列表 - * @param params - * @returns - */ -export function getCompanyPageList(params: Record) { - return request.get(`shop/delivery/company`, { params }) -} - -/** - * 获取物流公司列表 - * @param params - * @returns - */ -export function getCompanyList(params: Record) { - return request.get(`shop/delivery/company/list`, { params }) -} - -/** - * 获取物流公司详情 - * @param company_id 物流公司company_id - * @returns - */ -export function getCompanyInfo(company_id: number) { - return request.get(`shop/delivery/company/${ company_id }`); -} - -/** - * 添加物流公司 - * @param params - * @returns - */ -export function addCompany(params: Record) { - return request.post('shop/delivery/company', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑物流公司 - * @param params - * @returns - */ -export function editCompany(params: Record) { - return request.put(`shop/delivery/company/${ params.company_id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 删除物流公司 - * @param company_id - * @returns - */ -export function deleteCompany(company_id: number) { - return request.delete(`shop/delivery/company/${ company_id }`, { showErrorMessage: true, showSuccessMessage: true }) -} - -/********************************* 运费模版 ***************************************/ -/** - * 获取运费模版分页列表 - * @param params - * @returns - */ -export function getShippingTemplatePageList(params: Record) { - return request.get(`shop/shipping/template`, { params }) -} - -/** - * 获取运费模版列表 - * @param params - * @returns - */ -export function getShippingTemplateList(params: Record) { - return request.get(`shop/shipping/template/list`, { params }) -} - -/** - * 获取物运费模版详情 - * @param template_id 运费模版template_id - * @returns - */ -export function getShippingTemplateInfo(template_id: number) { - return request.get(`shop/shipping/template/${ template_id }`); -} - -/** - * 添加运费模版 - * @param params - * @returns - */ -export function addShippingTemplate(params: Record) { - return request.post('shop/shipping/template', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑运费模版 - * @param params - * @returns - */ -export function editShippingTemplate(params: Record) { - return request.put(`shop/shipping/template/${ params.template_id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 删除运费模版 - * @param template_id - * @returns - */ -export function deleteShippingTemplate(template_id: number) { - return request.delete(`shop/shipping/template/${ template_id }`, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/********************************* 自提门店 ***************************************/ -/** - * 获取自提门店列表 - * @param params - * @returns - */ -export function getStoreList(params: Record) { - return request.get(`shop/delivery/store`, { params }) -} - -/** - * 获取自提门店详情 - * @param store_id 自提门店store_id - * @returns - */ -export function getStoreInfo(store_id: number) { - return request.get(`shop/delivery/store/${ store_id }`); -} - -/** - * 获取初始化页面信息 - * @returns - */ -export function getStoreInit() { - return request.get(`shop/delivery/store/init`) -} - -/** - * 添加自提门店 - * @param params - * @returns - */ -export function addStore(params: Record) { - return request.post('shop/delivery/store', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑自提门店 - * @param params - * @returns - */ -export function editStore(params: Record) { - return request.put(`shop/delivery/store/${ params.store_id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 删除自提门店 - * @param store_id - * @returns - */ -export function deleteStore(store_id: number) { - return request.delete(`shop/delivery/store/${ store_id }`, { showErrorMessage: true, showSuccessMessage: true }) -} - -/********************************* 物流查询 ***************************************/ -/** - * 设置 物流查询配置 - * @param params - * @returns - */ -export function setDeliverySearch(params: Record) { - return request.post('shop/delivery/search', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 获取 物流查询配置 - * @returns - */ -export function getDeliverySearch() { - return request.get('shop/delivery/search') -} - -/** - * 获取 物流管理配置 - * @returns - */ -export function getShopDeliveryList() { - return request.get('shop/delivery/deliveryList') -} - -/** - * 物流管理设置 - * @param params - * @returns - */ -export function setShopDeliveryConfig(params: Record) { - return request.put(`shop/delivery/setConfig`, params, { showSuccessMessage: true }) -} - -/********************************* 配送员 ***************************************/ -/** - * 获取 配送员列表 - * @param params - * @returns - */ -export function getShopDelivery(params: Record) { - return request.get('shop/shop_delivery/staff', { params }) -} - -/** - * 获取 配送员列表 - * @param params - * @returns - */ -export function getShopDeliverList(params: Record) { - return request.get('shop/shop_delivery/staff/list', { params }) -} - -/** - * 获取配送员信息 - * @param staff_id - * @returns - */ -export function getShopDeliverInfo(staff_id: number) { - return request.get(`shop/shop_delivery/staff/${ staff_id }`); -} - -/** - * 添加配送员 - * @param params - * @returns - */ -export function addShopDeliver(params: Record) { - return request.post('shop/shop_delivery/staff', params, { showSuccessMessage: true }) -} - -/** - * 编辑配送员 - * @param params - * @returns - */ -export function editShopDeliver(params: Record) { - return request.put(`shop/shop_delivery/staff/${ params.deliver_id }`, params, { showSuccessMessage: true }) -} - -/** - * 删除配送员 - * @param staff_id - * @returns - */ -export function deleteShopDeliver(staff_id: number) { - return request.delete(`shop/shop_delivery/staff/${ staff_id }`) -} - - -/********************************* 配送服务商 ***************************************/ - -/** - * 获取配送服务商列表 - * @param params - * @returns - */ -export function getDeliveryServiceList(id: number) { - return request.get(`shop/delivery_store/delivery_service_list/${id}`) -} - -/** - * 服务商开通门店 - * @param params - * @returns - */ -export function deliveryShopOpen(params: Record) { - return request.put(`shop/delivery_store/delivery_shop_open/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 服务商门店品类修改 - * @param params - * @returns - */ -export function deliveryShopEdit(params: Record) { - return request.put(`shop/delivery_store/delivery_shop_edit/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) -} - - -/********************************* 同城配送设置 ***************************************/ - -/** - * 获取同城配送设置 - * @returns - */ -export function getLocal() { - return request.get('shop/local_delivery/config'); -} - -/** - * 设置同城配送 - * @param params - * @returns - */ -export function setLocal(params: Record) { - return request.put('shop/local_delivery/config', params, { showSuccessMessage: true }) -} - -/** - * 获取三方配送列表 - * @param params - * @returns - */ -export function getInUseLocalDeliveryList(params: Record) { - return request.get('shop/local_delivery/list', {params}) -} - -/** - * 获取同城配送平台列表 - */ -export function getLocalDeliveryServiceList() { - return request.get(`shop/local_delivery/service`) -} - - -/** - * 同城配送平台设置 - * @param params - * @returns - */ -export function setLocalDeliveryService(params: Record) { - return request.put(`shop/local_delivery/service/${params.delivery_type}`, params, {showSuccessMessage: true}) -} - -/** - * 同城配送平台详情 - * @param delivery_type - * @returns - */ -export function getLocalDeliveryServiceInfo(delivery_type: string) { - return request.get(`shop/local_delivery/service/${delivery_type}`,) -} - -/** - * 三方配送 - * @returns - */ -export function getThird() { - return request.get('shop/third/init') -} - - - - -/********************************* 同城配送记录 ***************************************/ - -/** - * 获取配送记录状态 - * @param params - * @returns - */ -export function getLocalDeliveryStatus() { - return request.get('shop/local_delivery/order/status') -} - -/** - * 获取配送记录分页列表 - * @param params - * @returns - */ -export function getLocalDeliveryList(params: Record) { - return request.get(`shop/local_delivery/order`, {params}) -} - -/** - * 获取同城配送订单详情 - * @param id - * @returns - */ -export function getLocalDeliveryInfo(id: number) { - return request.get(`shop/local_delivery/order/${ id }`); -} - -/** - * 获取同城配送订单取消原因 - * @param params - * @returns - */ -export function getLocalDeliveryCancelReason(params: Record) { - return request.get('shop/local_delivery/order/cancel_reason', {params}) -} - -/** - * 获取同城配送订单同步 - * @param staff_id - * @returns - */ -export function getLocalDeliverySync(id: number) { - return request.put(`shop/local_delivery/order/sync/${ id }`); -} - -/** - * 同城配送订单取消 - * @param params - * @returns - */ -export function setLocalDeliveryCancel(params: Record) { - return request.put(`shop/local_delivery/order/cancel/${ params.id }`, params, { showSuccessMessage: true }) -} - - -/********************************* 商家配送记录 ***************************************/ -/** - * 获取配送记录状态 - * @param params - * @returns - */ -export function getShopDeliveryStatus() { - return request.get('shop/shop_delivery/order/status') -} - -/** - * 获取商家配送记录分页列表 - * @param params - * @returns - */ -export function getShopDeliveryOrderList(params: Record) { - return request.get(`shop/shop_delivery/order`, {params}) -} - -/** - * 获取同城配送订单详情 - * @param id - * @returns - */ -export function getShopDeliveryInfo(id: number) { - return request.get(`shop/shop_delivery/order/${ id }`); -} - -/** - * 获取商家配送记录订单完成 - * @param staff_id - * @returns - */ -export function getShopDeliveryFinish(id: number) { - return request.put(`shop/shop_delivery/order/finish/${ id }`); -} - -/** - * 获取商家配送记录订单完成 - * @param staff_id - * @returns - */ -export function getDeliveryFinish(id: number) { - return request.put(`shop/local_delivery/order/finish/${ id }`); -} - -/** - * 商家配送记录订单取消 - * @param params - * @returns - */ -export function setShopDeliveryCancel(params: Record) { - return request.put(`shop/shop_delivery/order/cancel/${ params.id }`, params, { showSuccessMessage: true }) -} - -/** - * 获取配送方式 - * @param id - * @returns - */ -export function getShopDeliveryType() { - return request.get(`shop/delivery/type`); -} - - -/********************************* 门店自提 ***************************************/ - -/** - * 获取门店自提分页列表 - * @param params - * @returns - */ -export function getDeliveryStoreList(params: Record) { - return request.get(`shop/delivery/store`, {params}) -} - -/** - * 获取门店选择列表 - * @param params - * @returns - */ -export function getDeliveryStoreListAll(params: Record) { - return request.get(`shop/delivery/store/list`, {params}) -} - -/** - * 获取提货方式 - * @returns - */ -export function getStorePickUpType() { - return request.get(`shop/delivery/store/pick_up_type`); -} - -/** - * 获取配送门店详情 - * @returns - */ -export function getDeliveryStoreDetail(id: number) { - return request.get(`shop/delivery/store/${ id }`); -} - -/** - * 添加配送门店 - * @param params - * @returns - */ -export function addDeliveryStore(params: Record) { - return request.post('shop/delivery/store', params, {showErrorMessage: true, showSuccessMessage: true}) -} - -/** - * 编辑配送门店 - * @param params - * @returns - */ -export function editDeliveryStore(params: Record) { - return request.put(`shop/delivery/store/${params.store_id}`, params, { showErrorMessage: true, showSuccessMessage: true }) -} -/** - * 删除运费模版 - * @param template_id - * @returns - */ -export function deleteDeliveryStore(store_id: number) { - return request.delete(`shop/delivery/store/${store_id}`, {showErrorMessage: true, showSuccessMessage: true}) -} - -/** - * 编辑配送门店状态 - * @param params - * @returns - */ -export function editDeliveryStoreStatus(params: Record) { - return request.put(`shop/delivery/store/modify_status`, params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 获取距离配置 - * @returns - */ -export function getDeliveryConfig() { - return request.get('shop/local_delivery/base_config') -} - - -/** - * 编辑距离配置 - * @param params - * @returns - */ -export function setDeliveryConfig(params: Record) { - return request.put('shop/local_delivery/base_config', params, {showSuccessMessage: true}) -} - diff --git a/niucloud/addon/shop/admin/api/electronic_sheet.ts b/niucloud/addon/shop/admin/api/electronic_sheet.ts deleted file mode 100644 index 7f75c124c..000000000 --- a/niucloud/addon/shop/admin/api/electronic_sheet.ts +++ /dev/null @@ -1,116 +0,0 @@ -import request from '@/utils/request' - -/** - * 获取电子面单分页列表 - * @param params - * @returns - */ -export function getElectronicSheetPageList(params: Record) { - return request.get(`shop/electronic_sheet`, { params }) -} - -/** - * 获取电子面单列表 - * @param params - * @returns - */ -export function getElectronicSheetList(params: Record) { - return request.get(`shop/electronic_sheet/list`, { params }) -} - -/** - * 获取电子面单详情 - * @param id 电子面单id - * @returns - */ -export function getElectronicSheetInfo(id: number) { - return request.get(`shop/electronic_sheet/${ id }`); -} - -/** - * 添加电子面单 - * @param params - * @returns - */ -export function addElectronicSheet(params: Record) { - return request.post('shop/electronic_sheet', params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 编辑电子面单 - * @param params - * @returns - */ -export function editElectronicSheet(params: Record) { - return request.put(`shop/electronic_sheet/${ params.id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 删除电子面单 - * @param id - * @returns - */ -export function deleteElectronicSheet(id: number) { - return request.delete(`shop/electronic_sheet/${ id }`, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 设置默认电子面单模板 - * @param params - * @returns - */ -export function setDefaultElectronicSheet(params: Record) { - return request.put(`shop/electronic_sheet/setDefault/${ params.id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 设置电子面单 设置 - * @param params - * @returns - */ -export function setElectronicSheetConfig(params: Record) { - return request.post('shop/electronic_sheet/config', params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 获取电子面单配置 - * @returns - */ -export function getElectronicSheetConfig() { - return request.get(`shop/electronic_sheet/config`) -} - -/** - * 获取邮费支付方式类型 - * @returns - */ -export function getElectronicSheetPayType() { - return request.get(`shop/electronic_sheet/paytype`) -} - -/** - * 打印电子面单 - * @param params - * @returns - */ -export function printElectronicSheet(params: Record) { - return request.post('shop/electronic_sheet/print', params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/api/goods.ts b/niucloud/addon/shop/admin/api/goods.ts deleted file mode 100644 index c61f69504..000000000 --- a/niucloud/addon/shop/admin/api/goods.ts +++ /dev/null @@ -1,862 +0,0 @@ -import request from '@/utils/request' - -/** - * 获取商品列表 - * @param params - * @returns - */ -export function getGoodsPageList(params: Record) { - return request.get(`shop/goods`, { params }) -} - -/** - * 获取商品详情 - * @param goods_id 商品goods_id - * @returns - */ -export function getGoodsInfo(goods_id: number) { - return request.get(`shop/goods/${ goods_id }`); -} - - -/** - * 获取商品详情模板 - * @param goods_id 商品goods_id - * @returns - */ -export function getGoodsInfoTemplate(params: any) { - return request.get(`diy/list`, { params }); -} - -/** - * 添加实物商品 - * @param params - * @returns - */ -export function addGoods(params: Record) { - return request.post('shop/goods', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑实物商品 - * @param params - */ -export function editGoods(params: Record) { - return request.put(`shop/goods/${ params.goods_id }`, params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 获取商品添加/编辑初始化数据 - * @param params - */ -export function getGoodsInit(params: Record) { - return request.get(`shop/goods/init`, { params }); -} - -/** - * 添加虚拟商品 - * @param params - * @returns - */ -export function addVirtualGoods(params: Record) { - return request.post('shop/goods/virtual', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑虚拟商品 - * @param params - */ -export function editVirtualGoods(params: Record) { - return request.put(`shop/goods/virtual/${ params.goods_id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 获取虚拟商品添加/编辑初始化数据 - * @param params - */ -export function getVirtualGoodsInit(params: Record) { - return request.get(`shop/goods/virtual/init`, { params }); -} - -/** - * 删除商品 - * @param params - * @returns - */ -export function deleteGoods(params: Record) { - return request.put(`shop/goods/delete`, params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 获取回收站商品分页列表 - * @param params - * @returns - */ -export function getRecycleGoodsPageList(params: Record) { - return request.get(`shop/goods/recycle`, { params }) -} - -/** - * 恢复商品 - * @param params - * @returns - */ -export function recycleGoods(params: Record) { - return request.put(`shop/goods/recycle`, params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 修改商品排序号 - * @param params - */ -export function editGoodsSort(params: Record) { - return request.put(`shop/goods/sort`, params, { showSuccessMessage: true }) -} - -/** - * 修改商品上下架状态 - * @param params - */ -export function editGoodsStatus(params: Record) { - return request.put(`shop/goods/status`, params, { showSuccessMessage: true }) -} - -/** - * 复制商品 - * @param params - */ -export function copyGoods(params: Record) { - return request.put(`shop/goods/copy/${ params.goods_id }`, params) -} - -/** - * 获取商品选择分页列表 - * @param params - * @returns - */ -export function getGoodsSelectPageList(params: Record) { - return request.get(`shop/goods/select`, { params }) -} - -/** - * 获取商品SKU规格列表 - * @param params - * @returns - */ -export function getGoodsSkuList(params: Record) { - return request.get(`shop/goods/sku`, { params }) -} - -/** - * 获取商品SKU规格不分页列表 - * @param params - * @returns - */ -export function getGoodsSkuNoPageList(params: Record) { - return request.get(`shop/goods/selectgoodssku`, { params }) -} - -/** 查询商品参与营销活动的数量 - * @param params - * @returns - */ -export function getActiveGoodsCount(params: Record) { - return request.get(`shop/goods/active/count`, { params }) -} - -/** - * 编辑商品SKU规格库存 - * @param params - * @returns - */ -export function editGoodsListStock(params: Record) { - return request.put(`shop/goods/sku/stock`, params, { showSuccessMessage: true }) -} - -/** - * 编辑商品SKU规格价格 - * @param params - * @returns - */ -export function editGoodsListPrice(params: Record) { - return request.put(`shop/goods/sku/price`, params, { showSuccessMessage: true }) -} - -/** - * 编辑商品SKU规格会员价格 - * @param params - * @returns - */ -export function editGoodsListMemberPrice(params: Record) { - return request.put(`shop/goods/sku/member_price`, params, { showSuccessMessage: true }) -} - -/** - * 获取商品类型 - * @returns - */ -export function getGoodsType() { - return request.get(`shop/goods/type`); -} - -/** - * 获取商品标签分页列表 - * @param params - * @returns - */ -export function getLabelPageList(params: Record) { - return request.get(`shop/goods/label`, { params }) -} - -/** - * 获取商品标签列表 - * @param params - * @returns - */ -export function getLabelList(params: Record) { - return request.get(`shop/goods/label/list`, { params }) -} - -/** - * 获取商品标签详情 - * @param label_id 商品标签label_id - * @returns - */ -export function getLabelInfo(label_id: number) { - return request.get(`shop/goods/label/${ label_id }`); -} - -/** - * 添加商品标签 - * @param params - * @returns - */ -export function addLabel(params: Record) { - return request.post('shop/goods/label', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑商品标签 - * @param params - * @returns - */ -export function editLabel(params: Record) { - return request.put(`shop/goods/label/${ params.label_id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 修改商品标签状态 - * @param params - */ -export function modifyLabelStatus(params: Record) { - return request.put(`shop/goods/label/status`, params, { showSuccessMessage: true }) -} - -/** - * 删除商品标签 - * @param label_id - * @returns - */ -export function deleteLabel(label_id: number) { - return request.delete(`shop/goods/label/${ label_id }`, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 修改商品标签排序号 - * @param params - */ -export function modifyLabelSort(params: Record) { - return request.put(`shop/goods/label/sort`, params, { showSuccessMessage: true }) -} - -/** - * 获取商品标签分组分页列表 - * @param params - * @returns - */ -export function getLabelGroupPageList(params: Record) { - return request.get(`shop/goods/label/group`, { params }) -} - -/** - * 获取商品标签分组列表 - * @param params - * @returns - */ -export function getLabelGroupList(params: Record) { - return request.get(`shop/goods/label/group/list`, { params }) -} - -/** - * 获取商品标签分组详情 - * @param label_id 商品标签分组label_id - * @returns - */ -export function getLabelGroupInfo(label_id: number) { - return request.get(`shop/goods/label/group/${ label_id }`); -} - -/** - * 添加商品标签分组 - * @param params - * @returns - */ -export function addLabelGroup(params: Record) { - return request.post('shop/goods/label/group', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑商品标签分组 - * @param params - * @returns - */ -export function editLabelGroup(params: Record) { - return request.put(`shop/goods/label/group/${ params.group_id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 删除商品标签分组 - * @param group_id - * @returns - */ -export function deleteLabelGroup(group_id: number) { - return request.delete(`shop/goods/label/group/${ group_id }`, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 修改商品标签分组排序号 - * @param params - */ -export function modifyLabelGroupSort(params: Record) { - return request.put(`shop/goods/label/group/sort`, params, { showSuccessMessage: true }) -} - -/** - * 复制标签 - * @param params - */ -export function copyLabel(params: Record) { - return request.post(`shop/goods/label/copy/${ params.label_id }`, params, { showSuccessMessage: true }) -} - -/** - * 获取商品品牌分页列表 - * @param params - * @returns - */ -export function getBrandPageList(params: Record) { - return request.get(`shop/goods/brand`, { params }) -} - -/** - * 获取商品品牌列表 - * @param params - * @returns - */ -export function getBrandList(params: Record) { - return request.get(`shop/goods/brand/list`, { params }) -} - -/** - * 获取商品品牌详情 - * @param brand_id 商品品牌brand_id - * @returns - */ -export function getBrandInfo(brand_id: number) { - return request.get(`shop/goods/brand/${ brand_id }`); -} - -/** - * 添加商品品牌 - * @param params - * @returns - */ -export function addBrand(params: Record) { - return request.post('shop/goods/brand', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑商品品牌 - * @param params - * @returns - */ -export function editBrand(params: Record) { - return request.put(`shop/goods/brand/${ params.brand_id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 修改商品品牌排序号 - * @param params - */ -export function modifyBrandSort(params: Record) { - return request.put(`shop/goods/brand/sort`, params, { showSuccessMessage: true }) -} - -/** - * 删除商品品牌 - * @param brand_id - * @returns - */ -export function deleteBrand(brand_id: number) { - return request.delete(`shop/goods/brand/${ brand_id }`, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 获取商品服务分页列表 - * @param params - * @returns - */ -export function getServePageList(params: Record) { - return request.get(`shop/goods/service`, { params }) -} - -/** - * 获取商品服务列表 - * @param params - * @returns - */ -export function getServeList(params: Record) { - return request.get(`shop/goods/service/list`, { params }) -} - -/** - * 获取商品服务详情 - * @param service_id 商品服务service_id - * @returns - */ -export function getServeInfo(service_id: number) { - return request.get(`shop/goods/service/${ service_id }`); -} - -/** - * 添加商品服务 - * @param params - * @returns - */ -export function addServe(params: Record) { - return request.post('shop/goods/service', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑商品服务 - * @param params - * @returns - */ -export function editServe(params: Record) { - return request.put(`shop/goods/service/${ params.service_id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 删除商品服务 - * @param service_id - * @returns - */ -export function deleteServe(service_id: number) { - return request.delete(`shop/goods/service/${ service_id }`, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 获取商品分类树结构 - * @returns - */ -export function getCategoryTree() { - return request.get(`shop/goods/tree`) -} - -/** - * 获取商品分类列表 - * @param params - * @returns - */ -export function getCategoryList(params: Record) { - return request.get(`shop/goods/category`, { params }) -} - -/** - * 获取商品分类详情 - * @param category_id 商品分类category_id - * @returns - */ -export function getCategoryInfo(category_id: number) { - return request.get(`shop/goods/category/${ category_id }`); -} - -/** - * 添加商品分类 - * @param params - * @returns - */ -export function addCategory(params: Record) { - return request.post('shop/goods/category', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑商品分类 - * @param params - * @returns - */ -export function editCategory(params: Record) { - return request.put(`shop/goods/category/${ params.category_id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 删除商品分类 - * @param category_id - * @returns - */ -export function deleteCategory(category_id: number) { - return request.delete(`shop/goods/category/${ category_id }`, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 拖拽编辑商品分类 - * @param params - * @returns - */ -export function updateCategory(params: Record) { - return request.post(`shop/goods/category/update`, params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 设置商品分类配置 - * @param params - * @returns - */ -export function setCategoryConfig(params: Record) { - return request.post(`shop/goods/category/config`, params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 获取商品分类配置 - * @returns - */ -export function getCategoryConfig() { - return request.get(`shop/goods/category/config`); -} - -/** - * 获取商品分类树结构供弹框调用 - * @returns - */ -export function getCategoryTreeComponents() { - return request.get(`shop/goods/category/components`) -} - -/** - * 获取供应商列表 - * @param params - * @returns - */ -export function getSupplierList(params: Record) { - return request.get(`shop_supplier/supplier/list`, { params }) -} - -/** - * 获取商品评价列表 - * @param params - * @returns - */ -export function getEvaluateList(params: Record) { - return request.get(`shop/goods/evaluate`, { params }) -} - -/** - * 添加商品评价 - * @param params - * @returns - */ -export function addEvaluate(params: Record) { - return request.post('shop/goods/evaluate', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 删除商品评价 - * @param evaluate_id - * @returns - */ -export function deleteEvaluate(evaluate_id: number) { - return request.delete(`shop/goods/evaluate/${ evaluate_id }`, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 商品评价 通过 - * @param evaluate_id - * @returns - */ -export function adoptEvaluate(evaluate_id: number) { - return request.put(`shop/goods/evaluate/adopt/${ evaluate_id }`, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 商品评价 拒绝 - * @param evaluate_id - * @returns - */ -export function refuseEvaluate(evaluate_id: number) { - return request.put(`shop/goods/evaluate/refuse/${ evaluate_id }`, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 商品评价 回复 - * @param params - * @returns - */ -export function replyEvaluate(params: Record) { - return request.put(`shop/goods/evaluate/reply/${ params.evaluate_id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 商品评价 置顶 - * @param evaluate_id - * @returns - */ -export function toppingEvaluate(evaluate_id: number) { - return request.put(`shop/goods/evaluate/topping/${ evaluate_id }`, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 商品评价 取消置顶 - * @param evaluate_id - * @returns - */ -export function cancelToppingEvaluate(evaluate_id: number) { - return request.put(`shop/goods/evaluate/cancel_topping/${ evaluate_id }`, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 获取商品评价状态 - * @param params - * @returns - */ -export function getEvaluateStatus() { - return request.get(`shop/goods/evaluate/status`) -} - -/** - * 批量删除商品评价 - * @param params - * @returns - */ -export function batchDelEvaluate(params: Record) { - return request.post(`shop/goods/evaluate/batch/del`,params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 商品评价 批量通过 - * @param params - * @returns - */ -export function batchAdoptEvaluate(params: Record) { - return request.post(`shop/goods/evaluate/batch/adopt`,params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 商品评价 批量拒绝 - * @param params - * @returns - */ -export function batchRefuseEvaluate(params: Record) { - return request.post(`shop/goods/evaluate/batch/refuse`,params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 获取商品参数分页列表 - * @param params - * @returns - */ -export function getAttrPageList(params: Record) { - return request.get(`shop/goods/attr`, { params }) -} - -/** - * 获取商品参数列表 - * @param params - * @returns - */ -export function getAttrList(params: Record) { - return request.get(`shop/goods/attr/list`, { params }) -} - -/** - * 获取商品参数详情 - * @param attr_id 商品参数attr_id - * @returns - */ -export function getAttrInfo(attr_id: number) { - return request.get(`shop/goods/attr/${ attr_id }`); -} - -/** - * 添加商品参数 - * @param params - * @returns - */ -export function addAttr(params: Record) { - return request.post('shop/goods/attr', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑商品参数 - * @param params - * @returns - */ -export function editAttr(params: Record) { - return request.put(`shop/goods/attr/${ params.attr_id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 删除商品参数 - * @param attr_id - * @returns - */ -export function deleteAttr(attr_id: number) { - return request.delete(`shop/goods/attr/${ attr_id }`, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 修改商品参数排序号 - * @param params - */ -export function modifyAttrSort(params: Record) { - return request.put(`shop/goods/attr/sort`, params, { showSuccessMessage: true }) -} - -/** - * 修改商品参数名称 - * @param params - */ -export function modifyAttrName(params: Record) { - return request.put(`shop/goods/attr/attr_name`, params, { showSuccessMessage: true }) -} - -/** - * 修改商品参数值 - * @param params - */ -export function modifyAttrValue(params: Record) { - return request.put(`shop/goods/attr/attr_value`, params, { showSuccessMessage: true }) -} - -/** - * 获取批量设置字典列表 - * @returns - */ -export function getGoodsBatchSetDict() { - return request.get(`shop/goods/batchSet/dict`) -} - -/** - * 商品批量设置 - * @param params - */ -export function goodsBatchSet(params: Record) { - return request.put(`shop/goods/batchSet`, params, { showSuccessMessage: true }) -} - -/** - * 获取商品搜索配置 - * @returns - */ -export function getGoodsConfigSearch() { - return request.get(`shop/goods/config/search`) -} - -/** - * 编辑商品搜索配置 - * @returns - */ -export function setGoodsConfigSearch(param: any) { - return request.post('shop/goods/config/search', param, { showSuccessMessage: true }) -} - - -/** - * 获取商品唯一编码配置 - * @returns - */ -export function getGoodsConfigUnique() { - return request.get(`shop/goods/config/unique`) -} - -/** - * 编辑商品唯一编码配置 - * @returns - */ -export function setGoodsConfigUnique(param: any) { - return request.post('shop/goods/config/unique', param, { showSuccessMessage: true }) -} - -/** - * 校验商品唯一编码 - - * @returns - */ -export function goodsVerify(param: any) { - return request.post('shop/goods/verify/skuno', param) -} - -/** - * 获取商品排序配置 - * @returns - */ -export function getGoodsConfigSort() { - return request.get(`shop/goods/config/sort`) -} - -/** - * 设置商品排序配置 - * @returns - */ -export function setGoodsConfigSort(param: any) { - return request.post('shop/goods/config/sort', param, { showSuccessMessage: true }) -} -// 上下架 - -export function editGoodssingleStatus(params: Record) { - return request.put(`shop/goods/single/status`, params, { showSuccessMessage: true }) -} diff --git a/niucloud/addon/shop/admin/api/marketing.ts b/niucloud/addon/shop/admin/api/marketing.ts deleted file mode 100644 index 2a619bd1a..000000000 --- a/niucloud/addon/shop/admin/api/marketing.ts +++ /dev/null @@ -1,692 +0,0 @@ -import request from '@/utils/request' - -/** - * 营销中心 - * @param params - * @returns - */ -export function getMarketingIndex(params: Record) { - return request.get(`shop/marketing`, { params }) -} - -/** - * 获取商品分类列表 - * @param params - * @returns - */ -export function getGoodsCategoryList(params: Record) { - return request.get(`shop/goods/coupon/init`, { params }) -} - -/** - * 添加优惠券 - * @param params - * @returns - */ -export function addCoupon(params: Record) { - return request.post(`shop/goods/coupon`, params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 获取优惠券状态列表 - * @returns - */ -export function getCouponStatusList() { - return request.get(`shop/goods/coupon/status`) -} - -/** - * 获取优惠券列表 - * @param params - * @returns - */ -export function getCouponList(params: Record) { - return request.get(`shop/goods/coupon`, { params }) -} - -/** - * 获取优惠券列表 - * @param params - * @returns - */ -export function getCouponSelectList(params: Record) { - return request.get(`shop/goods/coupon/select`, { params }) -} - -/** - * 获取商品分类列表 - * @param params - * @returns - */ -export function getSelectedCouponList(params: Record) { - return request.get(`shop/goods/coupon/selected`, { params }) -} - -/** - * 获取优惠券领取记录 - * @param params - * @returns - */ -export function getCouponRecords(params: Record) { - return request.get(`shop/goods/coupon/records`, { params }); -} - -/** - * 获取优惠券详情 - * @param id - * @returns - */ -export function getCouponInfo(id: number) { - return request.get(`shop/goods/coupon/detail/${ id }`); -} - -/** - * 优惠券状态变更 - * @param params - * @returns - */ -export function editCouponStatus(params: Record) { - return request.put(`shop/goods/coupon/setstatus/${ params.status }`, params, { showSuccessMessage: true }) -} - -/** - * 编辑优惠券 - * @param params - * @returns - */ -export function editCoupon(params: Record) { - return request.put(`shop/goods/coupon/edit/${ params.id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 删除优惠券 - * @param params - * @returns - */ -export function deleteCoupon(params: Record) { - return request.post(`shop/goods/coupon/delete`, params, { showSuccessMessage: true }) -} - -/** - * 关闭优惠券 - * @param params - * @returns - */ -export function closeCoupon(params: Record) { - return request.put(`shop/goods/coupon/invalid`, params, { showSuccessMessage: true }) -} - -/** - * 发送优惠券 - * @param params - * @returns - */ -export function sendCoupon(params: Record) { - return request.post(`shop/goods/coupon/send/${ params.id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 获取优惠券发放记录 - * @param params - * @returns - */ -export function getCouponSendRecords(params: Record) { - return request.get(`shop/goods/coupon/send/pages/${ params.id }`, { params }); -} - -/** - * 优惠券init - * @returns - */ -export function initCoupon() { - return request.get(`shop/goods/coupon/send/init`) -} - -/************ 限时折扣 ****************/ -/** - * 获取限时折扣列表 - * @param params - * @returns - */ -export function getActiveDiscountPageList(params: Record) { - return request.get(`shop/active/discount`, { params }) -} - -/** - * 获取限时折扣状态列表 - * @returns - */ -export function getActiveDiscountStatusList() { - return request.get(`shop/active/status`) -} - -/** - * 获取指定活动的折扣信息。 - * - * @param active_id 获取基本信息 - * @returns - */ -export function getBasicInformation(active_id: number) { - return request.get(`shop/active/discount/info/${ active_id }`); -} - -/** - * 获取限时折扣详情 编辑 - * @param active_id - * @returns - */ -export function getActiveDiscountInfo(active_id: number) { - return request.get(`shop/active/discount/${ active_id }`); -} - -/** - * 添加限时折扣 - * @param params - * @returns - */ -export function addActiveDiscount(params: Record) { - return request.post('shop/active/discount', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑限时折扣 - * @param params - * @returns - */ -export function editActiveDiscount(params: Record) { - return request.put(`shop/active/discount/${ params.discount_id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 关闭限时折扣 - * @param active_id - * @returns - */ -export function closeActiveDiscount(active_id: number) { - return request.put(`shop/active/discount/close/${ active_id }`, {}, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 删除限时折扣 - * @param active_id - * @returns - */ -export function deleteActiveDiscount(active_id: number) { - return request.delete(`shop/active/discount/${ active_id }`, { showSuccessMessage: true }) -} - -/** - * 批量关闭限时折扣 - * @param params - * @returns - */ -export function batchCloseActiveDiscount(params: Record) { - return request.post(`shop/active/discount/batchClose`, params, { showSuccessMessage: true }) -} - -/** - * 批量删除限时折扣 - * @param params - * @returns - */ -export function batchDeleteActiveDiscount(params: Record) { - return request.post(`shop/active/discount/batchDelete`, params, { showSuccessMessage: true }) -} - -/** - * 获取参与限时折扣商品列表 - * @param params - * @returns - */ -export function getActiveDiscountGoodsPageList(params: Record) { - return request.get(`shop/active/discount/goods/${ params.active_id }`, { params }) -} - -/** - * 获取参与限时折扣订单列表 - * @param params - * @returns - */ -export function getActiveDiscountOrderPageList(params: Record) { - return request.get(`shop/active/discount/order/${ params.active_id }`, { params }) -} - -/** - * 限时折扣商品校验 - * @param params - * @returns - */ -export function goodscheck(params: Record) { - return request.post(`shop/active/discount/goods/check`, params, {}) -} - -/** - * 获取参与限时折扣会员列表 - * @param params - * @returns - */ -export function getActiveDiscountMemberPageList(params: Record) { - return request.get(`shop/active/discount/member/${ params.active_id }`, { params }) -} - -/** - * 获取活动专题 - * @returns - */ -export function getActiveDiscountConfig() { - return request.get(`shop/active/discount/config`); -} - -/** - * 编辑活动专题 - * @param params - * @returns - */ -export function editActiveDiscountConfig(params: Record) { - return request.put(`shop/active/discount/config`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/********** 积分商品 ***********/ - -/** - * 获取积分商品列表 - * @param params - * @returns - */ -export function getActiveExchangePageList(params: Record) { - return request.get(`shop/active/exchange`, { params }) -} - -/** - * 获取积分商品分页列表(用于弹框选择) - * @param params - * @returns - */ -export function getActiveExchangeSelectPageList(params: Record) { - return request.get(`shop/active/exchange/select`, { params }) -} - -/** - * 获取积分商品详情 - * @param id id - * @returns - */ -export function getActiveExchangeInfo(id: number) { - return request.get(`shop/active/exchange/${ id }`); -} - -/** - * 添加积分商品 - * @param params - * @returns - */ -export function addActiveExchange(params: Record) { - return request.post('shop/active/exchange', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑积分商品 - * @param params - * @returns - */ -export function editActiveExchange(params: Record) { - return request.put(`shop/active/exchange/${ params.id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 编辑积分商品状态 - * @param params - * @returns - */ -export function editActiveExchangeStatus(params: Record) { - return request.put(`shop/active/exchange/status/${ params.id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 删除积分商品 - * @param id - * @returns - */ -export function deleteActiveExchange(id: number) { - return request.delete(`shop/active/exchange/${ id }`, { showSuccessMessage: true }) -} - -/** - * 批量删除积分商品 - * @param params - * @returns - */ -export function batchDeleteActiveExchange(params: Record) { - return request.post(`shop/active/exchange/batchDelete`, params, { showSuccessMessage: true }) -} - -/** - * 批量下架积分商品 - * @param params - * @returns - */ -export function batchDownActiveExchange(params: Record) { - return request.post(`shop/active/exchange/batchDown`, params, { showSuccessMessage: true }) -} - -/** - * 批量上架积分商品 - * @param params - * @returns - */ -export function batchUpActiveExchange(params: Record) { - return request.post(`shop/active/exchange/batchUp`, params, { showSuccessMessage: true }) -} - -/** - * 获取积分商品状态列表 - * @returns - */ -export function getActiveExchangeStatus() { - return request.get(`shop/active/exchange/status`) -} - -/************ 新人专享 ****************/ - -/** - * 获取新人专享设置 - * @returns - */ -export function getActiveNewcomerConfig() { - return request.get(`shop/active/newcomer/config`); -} - -/** - * 编辑新人专享设置 - * @param params - * @returns - */ -export function editActiveNewcomerConfig(params: Record) { - return request.put(`shop/active/newcomer/config`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 获取新人专享列表【首页组件-分页】 - * @param params - * @returns - */ -export function getNewcomerGoodsList(params: Record) { - return request.get('shop/active/newcomer/goods/select', { params }) -} - -/** - * 新人专享 - 已选商品列表 - * @param params - * @returns - */ -export function getNewcomerSelectGoodsList(params: Record) { - return request.get('shop/active/newcomer/goods/selectgoodssku', { params }) -} - -/************ 商品榜单 ****************/ - -/** - * 设置排行榜配置 - * @param params - * @returns - */ -export function setRankConfig(params: Record) { - return request.post('shop/good/rank/config', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 获取排行榜配置 - * @returns - */ -export function getRankConfig() { - return request.get(`shop/good/rank/config`) -} - -/** - * 获取排行榜列表 - * @param params - * @returns - */ -export function getRankPageList(params: Record) { - return request.get(`shop/good/rank`, { params }) -} - -/** - * 获取排行榜选项列表 - * @returns - */ -export function optionData() { - return request.get(`shop/good/rank/dict`) -} - -/** - * 获取排行榜详情 - * @param rank_id - * @returns - */ -export function getRankInfo(rank_id: number) { - return request.get(`shop/good/rank/${ rank_id }`); -} - -/** - * 添加排行榜 - * @param params - * @returns - */ -export function addGoodRank(params: Record) { - return request.post('shop/good/rank', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑排行榜 - * @param params - * @returns - */ -export function editGoodRank(params: Record) { - return request.put(`shop/good/rank/${ params.id }`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 排行榜状态 - * @param params - * @returns - */ -export function editRankStatus(params: Record) { - return request.put(`shop/goods/rank/status`, params, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 删除排行榜 - * @param id - * @returns - */ -export function deleteGoodRank(id: number) { - return request.delete(`shop/good/rank/${ id }`, { showSuccessMessage: true }) -} - -/** - * 批量删除排行榜 - * @param params - * @returns - */ -export function batchDelete(params: Record) { - return request.put(`shop/good/rank/batchDelete`, params, { showSuccessMessage: true }) -} - -/** - * 排行榜修改排序 - * @param params - * @returns - */ -export function modifyGoodsRankSort(params: Record) { - return request.put(`shop/good/rank/sort`, params, { showSuccessMessage: true }) -} - -/** - * 商品排行榜列表 - * @param params - * @returns - */ -export function getSelectRankPageList(params: Record) { - return request.get(`shop/good/rank/select`, { params }) -} - -/************ 满减 ****************/ - -/** - * 获取满减列表 - * @param params - * @returns - */ -export function getManjianList(params: Record) { - return request.get(`shop/manjian`, { params }) -} - -/** - * 获取满减状态 - * @returns - */ -export function getManjianStatusList() { - return request.get(`shop/manjian/status`) -} - -/** - * 添加满减 - * @param params - * @returns - */ -export function addManjian(params: Record) { - return request.post('shop/manjian', params) -} - -/** - * 编辑满减 - * @param params - * @returns - */ -export function editManjian(params: Record) { - return request.put(`shop/manjian/${ params.id }`, params) -} - -/** - * 获取满减详情 - * @param params - * @returns - */ -export function getManjianInfo(params: Record) { - return request.get(`shop/manjian/init`, { params }); -} - -/** - * 检查商品 - * @param params - * @returns - */ -export function goodsCheck(params: Record) { - return request.post('shop/manjian/goods/check', params) -} - -/** - * 获取满减详情会员列表 - * @param params - * @returns - */ -export function getManjianMemberPageList(params: Record) { - return request.get(`shop/manjian/member/${ params.id }`, { params }) -} - -/** - * 关闭满减 - * @param manjian_id - * @returns - */ -export function closeManjian(manjian_id: number) { - return request.put(`shop/manjian/close/${ manjian_id }`, {}, { - showErrorMessage: true, - showSuccessMessage: true - }) -} - -/** - * 获取商品选择列表,代客下单使用 - * @param params - * @returns - */ -export function getGoodsSelectByReplaceBuy(params: Record) { - return request.get(`shop/goods/buy/goods/select`, { params }) -} - -/** - * 获取选中商品选择列表,代客下单使用 - * @param params - * @returns - */ -export function getGoodsSelectedByReplaceBuy(params: Record) { - return request.get(`shop/goods/buy/goods/selected`, { params }) -} - -/** - * 获取商品规格信息 - * @param params - * @returns - */ -export function getGoodsSkuInfo(params: Record) { - return request.get(`shop/goods/buy/sku/select`, { params }) -} - -/* - * 删除满减 - * @param manjian_id - * @returns - */ -export function deleteManjian(manjian_id: number) { - return request.delete(`shop/manjian/${ manjian_id }`, { showSuccessMessage: true }) -} - -/** - * 批量删除满减 - * @param params - * @returns - */ -export function batchDeleteManjian(params: Record) { - return request.put(`shop/manjian/goods/batchDelete`, params, { showSuccessMessage: true }) -} - -/** - * 批量关闭满减 - * @param params - * @returns - */ -export function batchCloseMajian(params: Record) { - return request.put(`shop/manjian/goods/batchClose`, params, { showSuccessMessage: true }) -} diff --git a/niucloud/addon/shop/admin/api/order.ts b/niucloud/addon/shop/admin/api/order.ts deleted file mode 100644 index c8c3af39f..000000000 --- a/niucloud/addon/shop/admin/api/order.ts +++ /dev/null @@ -1,297 +0,0 @@ -import request from '@/utils/request' - -/** - * 获取交易配置 - * @returns - */ -export function getConfig() { - return request.get('shop/order/config') -} - -/** - * 编辑交易配置 - * @returns - */ -export function setConfig(param: any) { - return request.post('shop/order/config', param, { showSuccessMessage: true }) -} - -/** - * 获取订单列表 - * @returns - */ -export function getOrderList(params: Record) { - return request.get('shop/order/list', { params }) -} - -/** - * 获取订单列表 - * @returns - */ -export function getOrderDetail(order_id: number) { - return request.get(`shop/order/detail/${ order_id }`) -} - -/** - * 获取订单状态 - * @return - */ -export function getOrderStatus() { - return request.get(`shop/order/status`) -} - -/** - * 获取订单类型 - * @return - */ -export function getOrderType() { - return request.get(`shop/order/type`) -} - -/** - * 订单关闭 - * @return - */ -export function orderClose(order_id: number) { - return request.put(`shop/order/close/${ order_id }`) -} - -/** - * 订单删除 - * @return - */ -export function orderDelete(params: Record) { - return request.post(`shop/order/delete`,params, { showSuccessMessage: true }) -} - - -/** - * 获取订单配送方式 - * @return - */ -export function getOrderDeliveryType(params: Record) { - return request.get(`shop/order/delivery_type`, { params }) -} - -/** - * 订单发货 - * @return - */ -export function orderDelivery(params: Record) { - return request.put(`shop/order/delivery`, params) -} - -/** - * 商家留言 - * @return - */ -export function setShopRemark(params: Record) { - return request.put(`shop/order/shop_remark`, params) -} - -/** - * 订单完成 - * @return - */ -export function orderFinish(order_id: number) { - return request.put(`shop/order/finish/${ order_id }`) -} - -/** - * 物流包裹信息(物流跟踪) - * @return - */ -export function deliveryPackage(params: Record) { - return request.get(`shop/order/delivery/package`, { params }) -} - -/** - * 物流包裹列表 - * @return - */ -export function deliveryPackageList(params: Record) { - return request.get(`shop/order/delivery/package/list`, { params }) -} - -/** - * 退款售后列表 - * @param {Record} params - * @return - */ -export function orderRefund(params: Record) { - return request.get(`shop/order/refund`, { params }) -} - -/** - * 退款售后详情 - */ -export function orderRefundDetail(refund_id: number) { - return request.get(`shop/order/refund/${ refund_id }`) -} - -/** - * 退款审核 - * @return - */ -export function auditRefund(params: Record) { - return request.put(`shop/order/refund/audit/${ params.order_refund_no }`, params) -} - -/** - * 退款收货审核 - * @return - */ -export function refundDelivery(params: Record) { - return request.put(`shop/order/refund/delivery/${ params.order_refund_no }`, params) -} - -/** - * 获取可退款金额 - */ -export function getRefundMoney(params: Record) { - return request.get(`shop/order/refund/refund_money`, { params }) -} - -/** - * 商家主动退款 - */ -export function shopActiveRefund(params: Record) { - return request.post(`shop/order/refund/active`, params, { showSuccessMessage: true }) -} - -/** - * 获取发票列表 - */ -export function getInvoiceList(params: Record) { - return request.get(`shop/invoice`, { params }) -} - -/** - * 获取发票列表 - */ -export function getInvoiceDetail(id: number) { - return request.get(`shop/invoice/${ id }`) -} - -/** - * 开具发票 - */ -export function setInvoice(id: number, params: Record) { - return request.put(`shop/invoice/${ id }`, params, { showSuccessMessage: true }) -} - -/** - * 开发票 - */ -export function createInvoice(params: Record) { - return request.post(`shop/invoice/add`, params, { showSuccessMessage: true }) -} - -/** - * 发票审核 - */ -export function auditInvoice(params: Record) { - return request.post(`shop/invoice/audit`, params, { showSuccessMessage: true }) -} - -/** - * 获取支付类型 - */ -export function getOrderPayType() { - return request.get(`shop/order/pay/type`) -} - -/** - * 获取订单来源 - */ -export function getOrderFrom() { - return request.get(`shop/order/from`) -} - -/** - * 订单调价 - * @return - */ -export function orderEditPrice(params: Record) { - return request.put(`shop/order/edit_price`, params, { showSuccessMessage: true }) -} - -/** - * 获取订单地址信息 - * @return - */ -export function getOrderEditAddress(params: Record) { - return request.get(`shop/order/edit_delivery`, { params }) -} - -/** - * 获取自提点列表 - * @return - */ -export function getDeliveryList() { - return request.get(`shop/delivery/store/list`) -} - -/** - * 修改地址 - * @return - */ -export function orderEditAddress(params: Record) { - return request.put(`shop/order/edit_delivery`, params) -} - -/** - * 批量发货列表 - * @return - */ -export function getOrderBatchDeliveryList(params: Record) { - return request.get(`shop/order_batch_delivery`, { params }) -} - -/** - * 批量发货导入 - * @return - */ -export function addBatchOrderDelivery(params: Record) { - return request.put(`shop/order_batch_delivery/add_batch_order_delivery`, params) -} - -/** - * 获取批量发货状态 - * @return - */ -export function getOrderBatchDeliveryState() { - return request.get(`shop/order_batch_delivery/get_status`) -} - -/** - * 获取批量发货操作类型 - * @return - */ -export function getOrderBatchDeliveryType() { - return request.get(`shop/order_batch_delivery/get_type`) -} - -/** - * 关闭售后 - * @return - */ -export function closeRefund(order_refund_no: number) { - return request.put(`shop/order/refund/close/${order_refund_no}`) -} - -/** - * 获取已选订单项总重量 - * @return - */ -export function getSelectOrderGoodsWeight(params: Record) { - return request.get(`shop/order/select/weight`, {params}) -} - -/** - * 获取已选订单项配送费用 - * @return - */ -export function getDeliveryFee(params: Record) { - return request.get(`shop/order/delivery/fee`, {params}) -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/api/shop.ts b/niucloud/addon/shop/admin/api/shop.ts deleted file mode 100644 index b2bea12c6..000000000 --- a/niucloud/addon/shop/admin/api/shop.ts +++ /dev/null @@ -1,43 +0,0 @@ -import request from '@/utils/request' - -/** - * 获取统计总数 - */ -export function getShopCountList() { - return request.get(`shop/stat/total`) -} - -/** - * 获取今日统计总数 - */ -export function getShopTodayCountList() { - return request.get(`shop/stat/today`) -} - -/** - * 获取昨日统计总数 - */ -export function getShopYesterdayCountList() { - return request.get(`shop/stat/yesterday`) -} - -/** - * 获取统计图数据 - */ -export function getShopStat() { - return request.get(`shop/stat`) -} - -/** - * 获取订单统计 - */ -export function getShopOrderStat() { - return request.get(`shop/stat/order`) -} - -/** - * 获取商品统计 - */ -export function getShopGoodsStat() { - return request.get(`shop/stat/goods`) -} diff --git a/niucloud/addon/shop/admin/api/shop_address.ts b/niucloud/addon/shop/admin/api/shop_address.ts deleted file mode 100644 index 450d2ddc5..000000000 --- a/niucloud/addon/shop/admin/api/shop_address.ts +++ /dev/null @@ -1,62 +0,0 @@ -import request from '@/utils/request' - -/** - * 获取商家地址库列表 - * @param params - * @returns - */ -export function getShopAddressList(params: Record) { - return request.get(`shop/shop_address`, { params }) -} - -/** - * 获取商家地址库详情 - * @param id 商家地址库id - * @returns - */ -export function getShopAddressInfo(id: number) { - return request.get(`shop/shop_address/${ id }`); -} - -/** - * 添加商家地址库 - * @param params - * @returns - */ -export function addShopAddress(params: Record) { - return request.post('shop/shop_address', params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 编辑商家地址库 - * @param params - * @returns - */ -export function editShopAddress(params: Record) { - return request.put(`shop/shop_address/${ params.id }`, params, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 删除商家地址库 - * @param id - * @returns - */ -export function deleteShopAddress(id: number) { - return request.delete(`shop/shop_address/${ id }`, { showErrorMessage: true, showSuccessMessage: true }) -} - -/** - * 获取商家默认发货地址 - * @returns - */ -export function getShopDefaultDeliveryAddressInfo() { - return request.get('shop/shop_address/default/delivery'); -} - -/** - * 获取商家收货地址 - * @returns - */ -export function getOrderRefundAddress() { - return request.get('shop/order/refund/address'); -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/api/stat.ts b/niucloud/addon/shop/admin/api/stat.ts deleted file mode 100644 index e72684a62..000000000 --- a/niucloud/addon/shop/admin/api/stat.ts +++ /dev/null @@ -1,32 +0,0 @@ -import request from '@/utils/request' - -/** - * 获取商品统计基本信息 - * @returns - */ -export function getGoodsStatisticsBasic(params: Record) { - return request.get('shop/goods/statistics/basic', { params }) -} - -/** - * 获取商品排行图表统计信息 - * @returns - */ -export function getGoodsStatisticsTrend(params: Record) { - return request.get('shop/goods/statistics/trend', { params }) -} - -/** - * 获取商品排行榜统计类型 - */ -export function getGoodsStatisticsType() { - return request.get(`shop/goods/statistics/type`) -} - -/** - * 获取商品排行信息 - * @returns - */ -export function getGoodsStatisticsRank(params: Record) { - return request.get('shop/goods/statistics/rank', { params }) -} diff --git a/niucloud/addon/shop/admin/assets/brand_default.png b/niucloud/addon/shop/admin/assets/brand_default.png deleted file mode 100644 index d99bddd4c..000000000 Binary files a/niucloud/addon/shop/admin/assets/brand_default.png and /dev/null differ diff --git a/niucloud/addon/shop/admin/assets/category_default.png b/niucloud/addon/shop/admin/assets/category_default.png deleted file mode 100644 index 396bbbc3c..000000000 Binary files a/niucloud/addon/shop/admin/assets/category_default.png and /dev/null differ diff --git a/niucloud/addon/shop/admin/assets/category_style2_new.png b/niucloud/addon/shop/admin/assets/category_style2_new.png deleted file mode 100644 index 36db6fa0c..000000000 Binary files a/niucloud/addon/shop/admin/assets/category_style2_new.png and /dev/null differ diff --git a/niucloud/addon/shop/admin/assets/category_style3_new.png b/niucloud/addon/shop/admin/assets/category_style3_new.png deleted file mode 100644 index 136a13d25..000000000 Binary files a/niucloud/addon/shop/admin/assets/category_style3_new.png and /dev/null differ diff --git a/niucloud/addon/shop/admin/assets/category_style4_new.png b/niucloud/addon/shop/admin/assets/category_style4_new.png deleted file mode 100644 index c55654240..000000000 Binary files a/niucloud/addon/shop/admin/assets/category_style4_new.png and /dev/null differ diff --git a/niucloud/addon/shop/admin/assets/discount_banner.png b/niucloud/addon/shop/admin/assets/discount_banner.png deleted file mode 100644 index 0f6577ef9..000000000 Binary files a/niucloud/addon/shop/admin/assets/discount_banner.png and /dev/null differ diff --git a/niucloud/addon/shop/admin/assets/discount_config.png b/niucloud/addon/shop/admin/assets/discount_config.png deleted file mode 100644 index ccef32cbf..000000000 Binary files a/niucloud/addon/shop/admin/assets/discount_config.png and /dev/null differ diff --git a/niucloud/addon/shop/admin/assets/goods_default.png b/niucloud/addon/shop/admin/assets/goods_default.png deleted file mode 100644 index 4a4c75bdc..000000000 Binary files a/niucloud/addon/shop/admin/assets/goods_default.png and /dev/null differ diff --git a/niucloud/addon/shop/admin/assets/store_default.png b/niucloud/addon/shop/admin/assets/store_default.png deleted file mode 100644 index 208d67be1..000000000 Binary files a/niucloud/addon/shop/admin/assets/store_default.png and /dev/null differ diff --git a/niucloud/addon/shop/admin/lang/zh-cn/address.edit.json b/niucloud/addon/shop/admin/lang/zh-cn/address.edit.json deleted file mode 100644 index a661a0d41..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/address.edit.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "contactName": "联系人", - "mobile": "联系方式", - "provinceId": "省", - "cityId": "市", - "districtId": "区", - "address": "详细地址", - "fullAddress": "地址", - "lat": "纬度", - "lng": "经度", - "isDeliveryAddress": "是否是发货地址", - "isRefundAddress": "是否是退货地址", - "isDefaultDelivery": "默认发货地址", - "isDefaultRefund": "默认收货地址", - "contactNamePlaceholder": "请输入联系人", - "mobilePlaceholder": "请输入联系方式", - "mobileTips": "请输入正确的手机号", - "addressPlaceholder": "请输入详细地址", - "fullAddressPlaceholder": "请输入地址", - "latPlaceholder": "请输入纬度", - "lngPlaceholder": "请输入经度", - "isDeliveryAddressPlaceholder": "请输入是否是发货地址", - "isRefundAddressPlaceholder": "请输入是否是退货地址", - "isDefaultDeliveryPlaceholder": "请输入默认发货地址", - "isDefaultRefundPlaceholder": "请输入默认收货地址", - "addShopAddress": "添加商家地址库", - "updateShopAddress": "编辑商家地址库", - "shopAddressDeleteTips": "确定要删除该商家地址库吗?", - "addressType": "地址类型", - "deliveryAddress": "发货地址", - "refundAddress": "收货地址", - "defaultDeliveryAddress": "是否设为默认发货地址", - "defaultRefundAddress": "是否设为默认收货地址", - "addressTypeRequire": "至少需设置一项类型" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/address.list.json b/niucloud/addon/shop/admin/lang/zh-cn/address.list.json deleted file mode 100644 index 17372d2e0..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/address.list.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "id": "", - "contactName": "联系人", - "mobile": "联系方式", - "mobilePlaceholder": "请输入联系方式", - "provinceId": "省", - "cityId": "市", - "districtId": "区", - "address": "详细地址", - "fullAddress": "地址", - "fullAddressPlaceholder": "请输入地址", - "lat": "纬度", - "lng": "经度", - "isDeliveryAddress": "是否是发货地址", - "isRefundAddress": "是否是退货地址", - "isDefaultDelivery": "默认发货地址", - "isDefaultRefund": "默认收货地址", - "addShopAddress": "添加商家地址库", - "updateShopAddress": "编辑商家地址库", - "shopAddressDeleteTips": "确定要删除该数据吗?", - "addressType": "地址类型", - "deliveryAddress": "发货地址", - "refundAddress": "收货地址", - "default": "默认" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/common.json b/niucloud/addon/shop/admin/lang/zh-cn/common.json deleted file mode 100644 index 0cb7159f3..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/common.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "goodsSelectPopupSelectGoodsButton": "选择商品", - "rankSelectPopupSelectRankButton": "选择榜单", - "goodsSelectPopupSelect": "已选", - "goodsSelectPopupPiece": "个", - "goodsSelectPopupSelectGoodsDialog": "商品选择", - "goodsSelectPopupAllGoods": "全部商品", - "defaultGoodsSelect": "默认", - "goodsSelectPopupSelectedGoods": "已选商品", - "goodsSelectPopupGoodsName": "商品名称", - "goodsSelectPopupGoodsNamePlaceholder": "请输入商品名称", - "goodsSelectPopupGoodsStatusPlaceholder": "请选择商品状态", - "goodsSelectPopupGoodsCategory": "商品分类", - "goodsSelectPopupGoodsCategoryPlaceholder": "全部", - "goodsSelectPopupGoodsType": "商品类型", - "goodsSelectPopupGoodsTypePlaceholder": "请选择商品类型", - "goodsSelectPopupGoodsInfo": "商品", - "goodsSelectPopupGoodsPointUnit": "积分", - "goodsSelectPopupGoodsPriceUnit": "元", - "goodsSelectPopupPrice": "价格", - "goodsSelectPopupStock": "库存", - "goodsSelectPopupBeforeTip": "已选择", - "goodsSelectPopupAfterTip": "个商品", - "goodsSelectPopupClearGoods": "取消选择", - "goodsSelectPopupGoodsMinTip": "所选商品数量不能少于", - "goodsSelectPopupGoodsMaxTip": "所选商品数量不能超过", - "goodsTextColor": "文字颜色", - "textColor": "标题颜色", - "subTextColor": "副标题颜色", - "wayPlaceholder": "虚拟商品和实物商品只能选择其中一个类型,请重新选择", - "goodsStyle": "商品样式", - "goodsBgColor": "商品背景", - "goodsNameColor": "商品名称", - "goodsPriceColor": "销售价", - "goodsBtnText": "文本", - "goodsBtnTextPlaceholder": "请输入按钮文字", - "goodsSaleColor": "商品销量", - "goodsBtnColor": "按钮背景", - "goodsNumColor": "已兑人数", - "goodsBuyBtn": "购买按钮", - "goodsShowContent": "显示内容", - "goodsBtnResult": "按钮效果", - "goodsBtnIsShow": "是否显示", - "goodsCartIncident": "点击事件", - "goodsAddCart": "加入购物车", - "goodsBtnStyle": "样式", - "goodsSaleNum": "商品销量", - "goodsDetail": "商品详情", - "goodsRounded": "圆角", - "fenxiaoCommissionPriceColor": "分销佣金", - "goodsCategoryPlaceholder": "请选择商品分类", - "goodsPlaceholder": "请选择商品", - "goodsIsBold": "是否加粗", - "goodsLabel": "商品标签", - "headStyle1": "样式1", - "headStyle2": "样式2", - "headStyle3": "样式3", - "headStyle4": "样式4", - "goodsData": "商品数据", - "sortWay": "排序", - "default": "综合", - "sales": "销量", - "price": "价格", - "manyGoodsListAroundRadius": "图片圆角", - "manyGoodsListCategoryName": "分类名称", - "manyGoodsListSubTitle": "副标题", - "manyGoodsLisAddItem": "添加一个多商品组", - "couponData": "优惠券数据", - "couponContent": "优惠券内容", - "couponTitle": "标题", - "couponTitlePlaceholder": "请输入标题", - "couponSubTitle": "副标题", - "couponSubTitlePlaceholder": "请输入副标题", - "selectCoupon": "选择优惠券", - "allSources": "全部", - "couponNum": "优惠券数量", - "couponPlaceholder": "请选择优惠券", - "couponBtnText": "按钮文字", - "couponBtnTextPlaceholder": "请输入按钮文字", - "couponTitleStyle": "标题样式", - "couponTitleColor": "标题颜色", - "couponSubTitleColor": "副标题颜色", - "couponItemStyle": "优惠券项样式", - "couponMoney": "金额颜色", - "manyGoodsListCategorySet": "分组设置", - "manyGoodsListSourceDiy": "自定义", - "manyGoodsListSourceCategory": "商品分类", - "goodsSet": "商品设置", - "goodsSearchSet": "搜索设置", - "goodsSearchText": "搜索内容", - "goodsSearchTextPlaceholder": "请输入搜索内容", - "shopMemberInfoComponentUidTextColor": "编号颜色", - "shopMemberInfoComponentAccountTextColor": "账户颜色", - "shopMemberInfoComponentAccount": "账号信息", - "shopGoodsRecommendComponentTag": "标签", - "shopGoodsRecommendComponentTagColor": "标签颜色", - "shopGoodsRecommendComponentTagPlaceholder": "请输入标签内容", - "shopGoodsRecommendComponentButtonBorderColor": "按钮边框颜色", - "carouselStyle": "轮播样式", - "recommendIndicatorStyle": "指示器设置", - "recommendIndicatorColor": "常规颜色", - "recommendIndicatorActiveColor": "选中颜色", - "activeCubeBlockContent": "板块内容", - "bgImage": "背景图片", - "rankingTitleIcon": "图标", - "rankSelect": "榜单选择", - "rankName": "榜单名称", - "rankNamePlaceholder": "请输入榜单名称", - "showGoodsNum": "榜单商品数量", - "goodsSourceName": "商品来源", - "ruleTypeName": "排序规则", - "rankTypeName": "排行周期", - "rankSelectPopupAfterTip": "个榜单", - "rankSelectPopupGoodsMinTip": "所选榜单数量不能少于", - "rankSelectPopupGoodsMaxTip": "所选榜单数量不能超过", - "rankingTitleImage": "头部图片", - "rankingSubTitle": "副标题", - "rankingSubTitleTextColor": "副标题颜色", - "rankTextColor": "名称颜色", - "rankingSubTitleLink": "副标题链接", - "listFrameColor": "背景颜色", - "topRounded": "上圆角", - "bottomRounded": "下圆角", - "imageRounded": "图片圆角", - "rankingStyle": "板块样式", - "styleRecommend": "风格推荐", - "countDownStyle": "倒计时样式", - "newcomerNumberColor": "数字颜色", - "newcomerNumberBg": "数字背景色", - "newcomerOtherColor": "文字颜色", - "goodsCategorySelectContentName": "分类名称", - "goodsCategorySelectContentImage": "分类图片", - "goodsCategorySelectContentPlaceholder": "请选择商品分类", - "couponSelectContentTitle": "优惠券名称", - "couponSelectContentTitlePlaceholder": "请输入优惠券名称", - "couponSelectContentType": "类型", - "couponSelectContentPrice": "面值", - "couponSelectContentThreshold": "使用门槛", - "couponSelectContentTips": "请选择优惠券", - "pointExchangeSelectContentTitle": "商品名称", - "pointExchangeSelectContentTitlePlaceholder": "请输入商品名称", - "pointExchangeSelectContentGoodsInfo": "商品信息", - "pointExchangeSelectContentPrice": "兑换价格", - "pointExchangeSelectContentPointUnit": "积分", - "pointExchangeSelectContentPriceUnit": "元", - "pointExchangeSelectContentRedeemedAndSurplus": "已兑/剩余", - "pointExchangeSelectContentTips": "请选择积分商品", - "categoryName": "分类名称", - "categoryImage": "分类图片" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.company.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.company.json deleted file mode 100644 index 770fda74c..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.company.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "companyId": "", - "companyIdPlaceholder": "请输入", - "companyName": "名称", - "companyNamePlaceholder": "请输入物流公司名称", - "logo": "LOGO", - "logoPlaceholder": "请输入物流公司logo", - "url": "网址", - "urlPlaceholder": "请输入物流公司网址", - "expressNoPlaceholder": "请输入物流公司编号", - "expressNoTips": "物流公司编号作用于物流查询,请根据物流跟踪对应配置设置编号", - "expressNoKd100": "快递100物流跟踪编号", - "expressNoKd100Placeholder": "请输入快递100物流跟踪编号", - "addCompany": "添加物流公司", - "updateCompany": "编辑物流公司", - "electronicSheetSwitchName": "是否支持电子面单", - "expressNoElectronicSheet": "快递鸟电子面单编号", - "expressNo": "快递鸟物流跟踪编号", - "companyDeleteTips": "确定要删除该数据吗?" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.company_edit.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.company_edit.json deleted file mode 100644 index fa1f2cb77..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.company_edit.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "companyId": "", - "companyIdPlaceholder": "请输入", - "companyName": "名称", - "companyNamePlaceholder": "请输入物流公司名称", - "logo": "LOGO", - "logoPlaceholder": "请输入物流公司logo", - "url": "网址", - "urlPlaceholder": "请输入物流公司网址", - "expressNo": "快递鸟物流跟踪编号", - "expressNoPlaceholder": "请输入快递鸟物流公司编号", - "expressNoTips": "物流公司编号作用于物流查询,请根据物流跟踪对应配置设置编号", - "expressNoKd100": "快递100物流跟踪编号", - "expressNoKd100Placeholder": "请输入快递100物流跟踪编号", - "addCompany": "添加物流公司", - "updateCompany": "编辑物流公司", - "expressNoElectronicSheet": "快递鸟电子面单编号", - "expressNoElectronicSheetPlaceholder": "请输入快递鸟电子面单编号", - "expressNoElectronicSheetTips": "电子面单编号作用于电子面单查询,请根据电子面单对应配置设置编号", - "printStyle": "模板样式", - "addPrintStyle": "添加模板样式", - "expType": "业务类型", - "addExpType": "添加业务类型", - "expTypeName": "业务名称", - "expTypeTextTips": "业务名称不能为空", - "expTypeValueTips": "业务值不能为空", - "expTypeTextRepeatTips": "业务名称不可以重复,请重新填写", - "expTypeValueRepeatTips": "业务值不可以重复,请重新填写", - "expTypeValueNullTips": "业务值不可以为零", - "expTypeValue": "业务值", - "electronicSheetSwitch": "是否支持电子面单", - "printStyleName": "模板名称", - "printStyleNameTips": "模板名称不能为空", - "printStyleSizeTips": "模板尺寸不能为空", - "printStyleNameRepeatTips": "模板名称不可以重复,请重新填写", - "printStyleSizeRepeatTips": "模板尺寸不可以重复,请重新填写", - "printStyleId": "模板尺寸", - "expTypeTips": "快递鸟业务类型", - "expTypeTips1": "不填默认为1", - "printStyleTips": "快递鸟模版规格(常用)", - "printStyleTips1": "主流快递单打印纸尺寸一般为:76*130,100*180(单位mm)", - "printStyleTips2": "不填写则取物流公司的默认模板", - "examine": "点击查看" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.config.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.config.json deleted file mode 100644 index b177cd0eb..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.config.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "store": "启动门店自提后,买家可选择自提点提货。", - "express": "启用物流配送后,买家下单可以选择快递发货。", - "local_delivery": "启用同城配送后,在配送范围内的买家可以选择同城配送。", - "deliveryStaff": "配送员", - "deliveryCompany": "物流公司", - "deliveryTemplate": "运费模版", - "deliverySearch": "物流跟踪", - "deliveryStore": "自提点", - "localConfig": "同城配送设置" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.electronic_sheet.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.electronic_sheet.json deleted file mode 100644 index 4b72fa8bb..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.electronic_sheet.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "tabESTemplate": "电子面单模板", - "tabESConfig": "设置", - "templateName": "模板名称", - "templateNamePlaceholder": "请输入模板名称", - "expressCompany": "物流公司", - "expressCompanyPlaceholder": "请选择物流公司", - "status": "状态", - "statusOn": "开启", - "statusOff": "关闭", - "addElectronicSheet": "添加电子面单", - "payType": "邮费支付方式", - "isDefault": "默认", - "setDefault": "设为默认", - "electronicSheetDeleteTips": "确定要删除该数据吗?", - "electronicSheetSetDefaultTips": "确定要设置为默认模版吗?" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.electronic_sheet_config.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.electronic_sheet_config.json deleted file mode 100644 index b8fdb16ad..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.electronic_sheet_config.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "tabESTemplate": "电子面单模板", - "tabESConfig": "设置", - "apiSet": "接口设置", - "interfaceType": "接口类型", - "prompt": "提示", - "promptTips1-1": "请到快递鸟官网申请", - "kdn": "快递鸟", - "kdnEBusinessIDLabel": "用户ID", - "kdnEBusinessIDPlaceholder": "请输入快递鸟用户ID", - "kdnEBusinessIDTips": "快递鸟用户ID,EBusinessID", - "kdnAppKeyPlaceholder": "请输入快递鸟API key", - "kdnAppKeyTips": "快递鸟分配的API key", - "printerSet": "打印机设置", - "serverPort1": "服务器端口1", - "serverPort1Placeholder": "请输入服务器端口1", - "serverPort2": "服务器端口2", - "serverPort2Placeholder": "请输入服务器端口2", - "httpsPort": "HTTPS端口", - "httpsPortPlaceholder": "请输入HTTPS端口" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.electronic_sheet_edit.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.electronic_sheet_edit.json deleted file mode 100644 index 94a310abc..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.electronic_sheet_edit.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "basicSettings": "基础设置", - "otherSettings": "其他设置", - "templateName": "模板名称", - "templateNamePlaceholder": "请输入模板名称", - "expressCompany": "物流公司", - "expressCompanyPlaceholder": "请选择物流公司", - "expType": "业务类型", - "status": "状态", - "customerName": "CustomerName", - "customerNamePlaceholder": "请输入电子面单客户账号", - "customerPwd": "CustomerPwd", - "customerPwdTips": "电子面单密码,不同快递叫法不同,例如:密码、密钥、客户编号", - "sendSite": "SendStaff", - "sendSiteTips": "不同快递叫法不同,例如:网点编码、网点编号、网点名称", - "sendStaff": "SendStaff", - "sendStaffTips": "不同快递叫法不同,例如:收件快递员、取件员编号、网点名称", - "monthCode": "MonthCode", - "monthCodeTips": "不同快递叫法不同,例如:月结号、密钥、月结编码", - "payType": "邮费支付方式", - "isNotice": "快递员上门揽件", - "yes": "是", - "no": "否", - "isNoticeTips": "是否通知快递员上门揽件,跨越速运,京东快运,电商标快,填舱标快,填舱电标等业务类型必填", - "printStyle": "模板样式", - "printStylePlaceholder": "请选择模板样式", - "printStyleTips": "快递鸟模版规格(常用)", - "printStyleTips1": "主流快递单打印纸尺寸一般为:76*130,100*180(单位mm)", - "printStyleTips2": "不填写则取物流公司的默认模板", - "isDefault": "是否默认", - "examine": "点击查看", - "customerNameTips": "快递鸟电子面单账号申请", - "customerNameTips1": "电子面单账号对照表" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.local.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.local.json deleted file mode 100644 index 40d7444e9..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.local.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "basicSettings": "同城配送基础设置", - "timeIsOpen": "配送时间设置", - "timeIsOpenTips": "开启后,买家下单选择同城配送时,可选择配送时间,提交订单后,将在买家备注中显示。关闭后,买家下单默认为立即配送", - "close": "关闭", - "open": "开启", - "everyDay": "每天", - "monday": "周一", - "tuesday": "周二", - "wednesday": "周三", - "thursday": "周四", - "friday": "周五", - "saturday": "周六", - "sunday": "周日", - "timeWeekRequire": "请选择配送时间", - "deliveryTimeSetting": "配送时间设置", - "feeType": "收费标准", - "region": "按区域收取配送费", - "distance": "按距离收取配送费", - "district": "按行政区域收取配送费", - "feeSetting": "费用设置", - "weightFee": "续重收费", - "feeSettingTextOne": "km内按", - "feeSettingTextTwo": "元收取配送费,每超出", - "feeSettingTextThree": "km费用增加", - "priceUnit": "元", - "weightFeeTextOne": "商品重量", - "weightFeeTextTwo": "kg 内不额外收费,每超出", - "weightFeeTextThree": "kg 费用增加", - "areaName": "区域名称", - "startPrice": "起送价", - "deliveryPrice": "配送费", - "areaType": "划分方式", - "radius": "半径", - "custom": "自定义", - "addDeliveryArea": "添加配送区域", - "baseDistRequire": "请输入起始公里数", - "gradDistRequire": "请输入超出公里数", - "basePriceRequire": "请输入起始公里内的配送费用", - "gradPriceRequire": "请输入每超出公里部分的费用", - "areaNameRequire": "请输入区域名称", - "startPriceRequire": "请输入起送价", - "startPriceMin": "起送价不能小于0", - "deliveryPriceRequire": "请输入配送费", - "deliveryPriceMin": "配送费不能小于0", - "areaPlaceholder": "请添加配送区域", - "deliveryType": "配送方式", - "business": "商家自配送", - "deliveryTypeRequire": "至少需选择一种配送方式", - "deliveryAddress": "取货地址", - "defaultDeliveryAddressEmpty": "请先配置默认发货地址", - "toSetting": "去配置", - "update": "修改", - "deliveryAddressChange": "取货地址已变更请注意是否需重新调整配送区域", - "tradeTimePlaceholderTwo": "请选择自提时段", - "tradeTimePlaceholderThree": "请选择细分时段", - "tradeTimePlaceholderFour": "结束时间不能小于或等于开始时间", - "tradeTimePlaceholderFive": "后一个时间段的开始时间不能小于前一个时间段的结束时间", - "thrid":"三方配送", - "AppKey":"AppKey", - "AppSecret":"AppSecret", - "shopId":"商户ID", - "shopStoreNo":"商户门店编号", - "AppKeyRequire":"请输入AppKey", - "AppSecretRequire":"请输入AppSecret", - "shopIdRequire":"请输入商户ID", - "shopStoreNoRequire":"请输入商户门店编号", - "deliveryTime":"配送时段设置", - "startTime":"开始时间", - "endTime":"结束时间", - "timeInterval":"细分时段", - "addTime":"添加配送时段", - "deliveryTimeTips":"配送时段设置,若不在配送时段内,则无法进行配送", - "30minute": "30分钟", - "90minute": "90分钟", - "oneHour": "一小时", - "twoHour": "两小时", - "advancaDay": "提前预约", - "advance": "提前", - "day": "天", - "reservationAvailable":"可预约", - "withinDays":"天内", - "advanceTips": "若设置了提前预约,则用户在当前日期前多少天可以预约配送,不可以立即配送", - "mostDays": "最长预约", - "mostDaysTips": "预约配送最长可预约多少天内进行提货", - "formatError": "格式不正确", - "notLessThanZero": "不能小于0", - "mustBeGreaterThanZero": "必须大于0", - "thridRequire": "请选择一个三方配送服务", - "thridSeting": "请填写完整的三方配送配置", - "deliveryArea": "配送区域" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.local_config.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.local_config.json deleted file mode 100644 index 254cfe8c5..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.local_config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "isStoreSelect":"是否开启门店选择", - "isShowPolyline":"是否显示配送轨迹" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.local_delivery_service.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.local_delivery_service.json deleted file mode 100644 index de3374c1a..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.local_delivery_service.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "三方配送类型", - "dadaThirdDelivery":"达达秒送", - "isUse":"是否启用", - "config":"设置", - "dadaAppKey": "APP_KEY", - "dadaAppSecret":"APP_SECRET", - "dadaSourceId": "商户ID", - "dadaAppKeyPlaceholder": "请输入APP_KEY", - "dadaAppSecretPlaceholder":"请输入APP_SECRET", - "dadaSourceIdPlaceholder":"请输入商户ID" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.local_record.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.local_record.json deleted file mode 100644 index ea204d695..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.local_record.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "deliveryNo": "配送单号", - "tradeNo": "交易单号", - "tradeNoPlaceholder":"请输入交易单号", - "deliveryNoPlaceholder":"请输入配送单号", - "createTime":"配送时间", - "startDate":"开始日期", - "endDate":"结束日期", - "deliveryServiceName":"配送服务名称", - "goodsInfo":"商品信息", - "deliveryStart":"配送起点", - "deliveryEnd":"配送终点", - "deliveryStatus":"状态", - "deliveryStatusPlaceholder":"请选择状态", - "deliveryDistance":"配送距离", - "deliveryMoney":"配送费用", - "remark":"备注", - "detail": "详情", - "sync":"同步", - "syncTips":"您确定要同步配送订单吗?", - "finish":"完成", - "finishTips":"您确定要完成配送订单吗?", - "cancelTime":"取消时间", - "riderName":"配送员姓名", - "riderMobile":"配送员手机号", - "outDeliveryNo":"外部配送单号", - "deliveryCancel":"取消配送", - "cancelReasonSelectPlaceholder":"请选择取消原因类型", - "cancelReasonType":"取消原因类型", - "cancelReason":"取消原因", - "cancelReasonPlaceholder":"请输入取消原因" - -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.merchant_record.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.merchant_record.json deleted file mode 100644 index 896564958..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.merchant_record.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "deliveryNo": "配送单号", - "tradeNo": "交易单号", - "tradeNoPlaceholder":"请输入交易单号", - "deliveryNoPlaceholder":"请输入配送单号", - "createTime":"配送时间", - "startDate":"开始日期", - "endDate":"结束日期", - "deliveryServiceName":"配送服务名称", - "goodsInfo":"商品信息", - "deliveryStart":"配送起点", - "deliveryEnd":"配送终点", - "deliveryStatus":"状态", - "deliveryStatusPlaceholder":"请选择状态", - "deliveryDistance":"配送距离", - "deliveryMoney":"配送费用", - "remark":"备注", - "detail": "详情", - "finish":"完成", - "finishTips":"您确定要完成配送订单吗?", - "cancelTime":"取消时间", - "riderName":"配送员姓名", - "riderMobile":"配送员手机号", - "outDeliveryNo":"外部配送单号", - "deliveryCancel":"取消配送", - "cancelReasonSelectPlaceholder":"请选择取消原因类型", - "cancelReasonType":"取消原因类型", - "cancelReason":"取消原因", - "cancelReasonPlaceholder":"请输入取消原因" - -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.search.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.search.json deleted file mode 100644 index 99cd99416..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.search.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "prompt": "提示", - "promptTips1-1": "请到快递鸟官网申请", - "promptTips1-2": "1、按单付费查询,相同单号查询多次计费一次(代码8001)", - "promptTips1-3": "2、按次付费查询,相同单号查询多次计费多次(代码8002)", - "promptTips2": "请到快递100官网申请", - "interfaceType": "接口类型", - "kdn": "快递鸟", - "kd100": "快递100", - "kdnEBusinessIDPlaceholder": "请输入快递鸟EBusinessID", - "kdnEBusinessIDTips": "快递鸟电商ID", - "kdnAppKeyPlaceholder": "请输入快递鸟AppKey", - "kdnAppKeyTips": "快递鸟分配的电商加密私钥", - "isPayEdition": "套餐类型", - "PayPerUse": "按次付费", - "PayPerOrder": "按单付费", - "kd100AppKeyPlaceholder": "请输入快递100AppKey", - "kd100AppKeyTips": "快递100应用密钥", - "kd100CustomerPlaceholder": "请输入快递100Customer", - "kd100CustomerTips": "快递100分配给的公司编号" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.staff.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.staff.json deleted file mode 100644 index 75c0f0755..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.staff.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "addDeliveryPersonnel": "添加配送员", - "updateDeliver": "编辑配送员", - "deliverName": "配送员名称", - "deliverMobile": "配送员手机号", - "deliverNamePlaceholder": "请输入配送员名称", - "deliverMobilePlaceholder": "请输入配送员手机号", - "deliverDeleteTips": "确定要删除该数据吗?" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.store.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.store.json deleted file mode 100644 index 33ad259e6..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.store.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "storeId": "", - "storeName": "自提点信息", - "storeNamePlaceholder": "请输入自提点名称", - "storeLogo": "自提点logo", - "storeMobile": "联系电话", - "address": "详细地址", - "fullAddress": "联系地址", - "longitude": "经度", - "latitude": "纬度", - "tradeTime": "营业时间", - "createTime": "添加时间", - "createTimePlaceholder": "请输入添加时间", - "addStore": "添加自提点", - "updateStore": "编辑自提点", - "storeDeleteTips": "确定要删除该数据吗?", - "storeInfo": "自提点信息" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.store_edit.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.store_edit.json deleted file mode 100644 index 6cd0427df..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.store_edit.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "storeName": "自提点名称", - "storeDesc": "简介", - "storeLogo": "自提点logo", - "storeMobile": "手机号", - "provinceId": "省id", - "cityId": "市", - "districtId": "县(区)", - "address": "详细地址", - "fullAddress": "完整地址", - "longitude": "经度", - "latitude": "纬度", - "tradeTime": "营业时间", - "createTime": "下单时间", - "updateTime": "更新时间", - "storeNamePlaceholder": "请输入自提点名称", - "storeDescPlaceholder": "请输入简介", - "storeLogoPlaceholder": "请上传自提点logo", - "storeMobilePlaceholder": "请输入手机号", - "provinceIdPlaceholder": "请选择省id", - "cityIdPlaceholder": "请选择市", - "districtIdPlaceholder": "请选择县(区)", - "addressPlaceholder": "请输入详细地址", - "fullAddressPlaceholder": "请输入完整地址", - "longitudePlaceholder": "请输入经度", - "latitudePlaceholder": "请输入纬度", - "tradeTimePlaceholder": "请输入营业时间", - "tradeTimeTips": "例:上午9:00-12:00,下午2:00-6:00", - "createTimePlaceholder": "请选择添加时间", - "updateTimePlaceholder": "请输入更新时间", - "addStore": "添加自提点", - "updateStore": "编辑自提点", - "storeDeleteTips": "确定要删除该自提点吗?", - "storeAddress": "自提点地址", - "storeAddressPlaceholder": "请选择自提点地址", - "storeAddressDetail": "自提点详细地址", - "storeAddressDetailPlaceholder": "请输入自提点详细地址", - "storeTime": "自提时段", - "storeDate": "自提日期", - "addTimeRange": "添加时段", - "storeTimeInterval": "细分时段", - "monday": "周一", - "tuesday": "周二", - "wednesday": "周三", - "thursday": "周四", - "friday": "周五", - "saturday": "周六", - "sunday": "周日", - "minute": "分钟", - "hour": "小时", - "startTime": "开始时间", - "endTime": "结束时间", - "tradeTimePlaceholderTwo": "请选择自提时段", - "selectBusinessDays": "请选择自提日期", - "tradeTimePlaceholderThree": "请选择细分时段", - "tradeTimePlaceholderFour": "结束时间不能小于或等于开始时间", - "tradeTimePlaceholderFive": "后一个时间段的开始时间不能小于前一个时间段的结束时间", - "storeDateTips": "所设时间段为可自提时间段,可通过“细分时段”对该自提时段进一步切分", - "storeTimeIntervalTips": "对上方的“自提时段”进行切分,在手机端上将显示切换后的时段供用户选择" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.template.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.template.json deleted file mode 100644 index 7a4d8cb77..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.template.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "templateName": "运费模板名称", - "templateNamePlaceholder": "请输入运费模板名称", - "createTime": "创建时间", - "addTemplate": "添加运费模板", - "updateTemplate": "编辑运费模板", - "templateDeleteTips": "确定要删除该模板吗?", - "feeTypeName": "计费类型", - "freeShipping": "指定区域包邮", - "open": "启用", - "close": "关闭" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery.template_edit.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery.template_edit.json deleted file mode 100644 index 9ebaa81d5..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery.template_edit.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "templateName": "运费模板名称", - "templateNamePlaceholder": "请输入运费模板名称", - "createTime": "创建时间", - "addTemplate": "添加运费模板", - "updateTemplate": "编辑运费模板", - "templateDeleteTips": "确定要删除该模板吗?", - "feeTypeName": "计费类型", - "isDefault": "默认模板", - "num": "按件", - "weight": "按重量", - "volume": "按体积", - "feeSetting": "费用设置", - "selectArea": "选择地区", - "firstNum": "首件(件)", - "continueNum": "续件(件)", - "firstWeight": "首件重量(kg)", - "fee": "运费(元)", - "continueFee": "续费(元)", - "continueWeight": "续件重量(kg)", - "firstVolume": "首件体积(m³)", - "continueVolume": "续件体积(m³)", - "deliveryArea": "配送区域", - "addDeliveryArea": "添加单独配送区域", - "freeShipping": "指定区域包邮", - "freeShippingArea": "包邮区域", - "addFreeShippingArea": "添加包邮区域", - "freeShippingAreaTips": "两个条件满足其一便可以包邮", - "noDelivery": "不配送区域", - "addNoDelivery": "添加不配送区域", - "freeShippingNum": "包邮件数", - "freeShippingWeight": "包邮重量(kg)", - "freeShippingVolume": "包邮体积(m³)", - "freeShippingPrice": "包邮金额", - "areaPlaceholder": "请选择地区", - "noDeliveryPlaceholder": "请选择不配送的地区", - "freeShippingPlaceholder": "请选择包邮的地区", - "notUnderZero": "不能小于等于0" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery_store.delivery_set.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery_store.delivery_set.json deleted file mode 100644 index 7cf284b31..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery_store.delivery_set.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "deliveryServiceName": "服务商", - "openService": "开通", - "editService": "修改品类", - "business": "门店品类", - "businessPlaceholder": "请选择门店品类", - "openStatus": "开通状态", - "editStatus": "门店信息变更状态", - "reason": "备注", - "pass": "通过", - "notPass": "未通过" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/delivery_store.edit.json b/niucloud/addon/shop/admin/lang/zh-cn/delivery_store.edit.json deleted file mode 100644 index 5373b7054..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/delivery_store.edit.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "basicSettings": "同城配送基础设置", - "timeIsOpen": "配送时间设置", - "timeIsOpenTips": "开启后,买家下单选择同城配送时,可选择配送时间,提交订单后,将在买家备注中显示。关闭后,买家下单默认为立即配送", - "close": "关闭", - "open": "开启", - "everyDay": "每天", - "monday": "周一", - "tuesday": "周二", - "wednesday": "周三", - "thursday": "周四", - "friday": "周五", - "saturday": "周六", - "sunday": "周日", - "timeWeekRequire": "请选择配送时间", - "deliveryTimeSetting": "配送时间设置", - "feeType": "收费标准", - "region": "按区域收取配送费", - "distance": "按距离收取配送费", - "district": "按行政区域收取配送费", - "feeSetting": "费用设置", - "weightFee": "续重收费", - "feeSettingTextOne": "km内按", - "feeSettingTextTwo": "元收取配送费,每超出", - "feeSettingTextThree": "km费用增加", - "priceUnit": "元", - "weightFeeTextOne": "商品重量", - "weightFeeTextTwo": "kg 内不额外收费,每超出", - "weightFeeTextThree": "kg 费用增加", - "areaName": "区域名称", - "startPrice": "起送价", - "deliveryPrice": "配送费", - "areaType": "划分方式", - "radius": "半径", - "custom": "自定义", - "addDeliveryArea": "添加配送区域", - "baseDistRequire": "请输入起始公里数", - "gradDistRequire": "请输入超出公里数", - "basePriceRequire": "请输入起始公里内的配送费用", - "gradPriceRequire": "请输入每超出公里部分的费用", - "areaNameRequire": "请输入区域名称", - "startPriceRequire": "请输入起送价", - "startPriceMin": "起送价不能小于0", - "deliveryPriceRequire": "请输入配送费", - "deliveryPriceMin": "配送费不能小于0", - "areaPlaceholder": "请添加配送区域", - "deliveryType": "配送方式", - "business": "商家自配送", - "deliveryTypeRequire": "至少需选择一种配送方式", - "deliveryAddress": "取货地址", - "defaultDeliveryAddressEmpty": "请先配置默认发货地址", - "toSetting": "去配置", - "update": "修改", - "deliveryAddressChange": "取货地址已变更请注意是否需重新调整配送区域", - "tradeTimePlaceholderTwo": "请选择提货时段", - "tradeTimePlaceholderThree": "请选择细分时段", - "tradeTimePlaceholderFour": "结束时间不能小于或等于开始时间", - "tradeTimePlaceholderFive": "后一个时间段的开始时间不能小于前一个时间段的结束时间", - "thrid":"三方配送", - "AppKey":"AppKey", - "AppSecret":"AppSecret", - "shopId":"商户ID", - "shopStoreNo":"商户门店编号", - "AppKeyRequire":"请输入AppKey", - "AppSecretRequire":"请输入AppSecret", - "shopIdRequire":"请输入商户ID", - "shopStoreNoRequire":"请输入商户门店编号", - "deliveryTime":"配送时段设置", - "startTime":"开始时间", - "endTime":"结束时间", - "timeInterval":"细分时段", - "addTime":"添加配送时段", - "deliveryTimeTips":"配送时段设置,若不在配送时段内,则无法进行配送", - "30minute": "30分钟", - "90minute": "90分钟", - "oneHour": "一小时", - "twoHour": "两小时", - "advancaDay": "提前预约", - "advance": "提前", - "day": "天", - "reservationAvailable":"可预约", - "withinDays":"天内", - "advanceTips": "若设置了提前预约,则用户在当前日期前多少天可以预约配送,不可以立即配送", - "mostDays": "最长预约", - "mostDaysTips": "预约配送最长可预约多少天内进行提货", - "formatError": "格式不正确", - "notLessThanZero": "不能小于0", - "mustBeGreaterThanZero": "必须大于0", - "thridRequire": "请选择一个三方配送服务", - "thridSeting": "请填写完整的三方配送配置", - "addressPlaceholder":"请输入详细地址", - "fullAddressPlaceholder":"请输入地址", - "storeName": "提货点名称", - "storeNamePlaceholder": "请输入提货点名称", - "contactName": "联系人姓名", - "contactNamePlaceholder": "请输入联系人姓名", - "storeMobile": "联系人电话", - "storeMobilePlaceholder": "请输入联系人电话", - "tradeTime": "营业时间", - "tradeTimePlaceholder": "请输入营业时间", - "tradeTimeTips": "例:上午9:00-12:00,下午2:00-6:00", - "deliveryStoreTips": "当前提货点为系统自建提货点,无法删除且提货点名称、联系人电话、营业时间及地址只能在店铺设置中统一配置。" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.attr.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.attr.json deleted file mode 100644 index 419ae1752..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.attr.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "attrName": "参数模板名称", - "attrNamePlaceholder": "请输入参数模板名称", - "sortPlaceholder": "请输入排序号", - "addShopGoodsAttr": "添加参数模板", - "updateShopGoodsAttr": "编辑参数模板", - "goodsAttrDeleteTips": "确定要删除该数据吗?", - "sortTips": "排序号格式输入错误", - "manage": "管理" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.attr_edit.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.attr_edit.json deleted file mode 100644 index 0c03e2aeb..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.attr_edit.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "attrName": "参数模板名称", - "attrNamePlaceholder": "请输入参数名称", - "updateAttr": "编辑参数模板", - "sort": "排序号", - "sortPlaceholder": "请输入排序号", - "addShopGoodsAttr": "添加商品参数", - "attrValueType": "参数类型", - "attrValueTypeRadio": "单选", - "attrValueTypeCheckbox": "多选", - "attrValueTypeText": "输入", - "attrValueChild": "参数内容", - "updateShopGoodsAttr": "编辑商品参数", - "goodsAttrDeleteTips": "确定要删除该数据吗?", - "attrValueName": "参数名称", - "addAttrValue": "添加参数", - "attrValueNamePlaceholder": "请输入参数名称" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.brand_list.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.brand_list.json deleted file mode 100644 index 038d763f5..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.brand_list.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "brandId": "品牌ID", - "brandIdPlaceholder": "请输入品牌ID", - "brandName": "品牌名称", - "brandNamePlaceholder": "请输入品牌名称", - "logo": "品牌logo", - "logoPlaceholder": "请输入品牌logo", - "desc": "品牌介绍", - "descPlaceholder": "请输入品牌介绍", - "sort": "排序", - "sortPlaceholder": "请输入排序", - "addBrand": "添加商品品牌", - "updateBrand": "编辑商品品牌", - "brandDeleteTips": "确定要删除该数据吗?", - "textColor": "文字颜色", - "bgColor": "背景颜色", - "borderColor": "边框颜色", - "colorTips": "若未设置颜色,则为默认色" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.category.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.category.json deleted file mode 100644 index 89624234b..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.category.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "categoryId": "商品分类id", - "categoryIdPlaceholder": "请输入商品分类id", - "categoryName": "分类名称", - "categoryNamePlaceholder": "请输入分类名称", - "image": "分类图片", - "imagePlaceholder": "请输入分类图片", - "pid": "上级分类", - "pidPlaceholder": "请选择上级分类", - "categoryFullName": "组装分类名称", - "categoryFullNamePlaceholder": "请输入组装分类名称", - "isShow": "是否显示", - "sort": "排序", - "sortPlaceholder": "请输入排序号", - "addCategory": "添加商品分类", - "updateCategory": "编辑商品分类", - "categoryDeleteTips": "确定要删除该数据吗?", - "categoryDeleteTips1": "子级分类也会删除,确定要删除该数据吗?", - "spreadGoodsCategory": "推广", - "goodsCategorySpreadTitle": "商品分类推广", - "spreadLink": "推广链接", - "copy": "复制", - "downloadQrcode": "下载二维码", - "tabGoodsCategory": "商品分类", - "tabGoodsCategoryConfig": "分类设置" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.category_config.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.category_config.json deleted file mode 100644 index 9c9dcbcb2..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.category_config.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "categoryTemplate": "分类模板", - "categoryType": "分类类型", - "categorystyleOne": "一级分类", - "categorystyleTwo": "二级分类", - "pageSettings": "页面设置", - "pageTitle": "页面名称", - "pageTitlePlaceholder": "请输入页面名称", - "searchControl": "搜索栏", - "searchTitle": "搜索栏文字", - "searchTitlePlaceholder": "请输入搜索栏文字", - "open": "开启", - "close": "关闭", - "goodsStyle": "商品排列", - "singleCols": "单列", - "doubleCols": "双列", - "sort": "商品排序", - "sortPlaceholder": "请选择商品排序", - "cartControl": "购物车显示", - "cartStyle": "购物车样式", - "cartTextPlaceholder": "请输入购物车按钮文字", - "cartEvent": "点击按钮", - "detail": "跳转商品详情", - "cart": "加入购物车", - "tabGoodsCategory": "商品分类", - "tabGoodsCategoryConfig": "分类设置" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.evaluate.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.evaluate.json deleted file mode 100644 index 839a9197a..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.evaluate.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "evaluateId": "", - "evaluateIdPlaceholder": "请输入", - "orderId": "订单id", - "orderIdPlaceholder": "请输入订单id", - "orderGoodsId": "订单项ID", - "orderGoodsIdPlaceholder": "请输入订单项ID", - "goodsId": "商品ID", - "goodsIdPlaceholder": "请选择商品", - "memberId": "会员ID", - "memberIdPlaceholder": "请输入会员ID", - "content": "评价内容", - "contentPlaceholder": "请输入评价内容", - "images": "评价图片", - "imagesPlaceholder": "请输入评价图片", - "isAnonymous": "是否匿名", - "anonymous": "匿名", - "notAnonymous": "不匿名", - "scores": "评价等级", - "scoresPlaceholder": "请输入评价分数 1-5", - "auditName": "审核状态", - "explainFirst": "商家回复", - "explainFirstPlaceholder": "请输入商家回复", - "createTime": "评价时间", - "createTimePlaceholder": "请输入评价时间", - "again": "追评", - "againTime": "追评时间", - "againTimePlaceholder": "请输入追评时间", - "isShow": "是否显示", - "show": "显示", - "notShow": "不显示", - "isShowPlaceholder": "请输入是否显示 1显示 2不显示", - "addEvaluate": "添加自评", - "updateEvaluate": "编辑商品评价", - "evaluateDeleteTips": "确定要删除该数据吗?", - "goodsInfo": "商品信息", - "memberHead": "会员头像", - "memberName": "会员名称", - "memberNamePlaceholder": "请输入会员名称", - "adopt": "通过", - "refuse": "拒绝", - "auditAdoptTips": "确定要通过审核吗?", - "reply": "回复", - "goodsName": "商品名称", - "goodsNamePlaceholder": "请输入商品名称", - "topping": "置顶", - "cancelTopping": "取消置顶", - "memberHeadPlaceholder": "请上传会员头像", - "batchDelete": "批量删除", - "batchDeleteTips": "确定要批量删除选中的评价吗?", - "batchAdopt": "批量通过", - "batchAdoptTips": "确定要批量通过选中的评价吗?", - "batchRefuse": "批量拒绝", - "batchRefuseTips": "确定要批量拒绝选中的评价吗?", - "batchEmptySelectedCommentsTips": "请先选择要操作的评价", - "status":"审核状态", - "statusPlaceholder":"请选择审核状态" - -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.evaluate_edit.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.evaluate_edit.json deleted file mode 100644 index 9283f1f59..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.evaluate_edit.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "orderId": "订单id", - "orderGoodsId": "订单项ID", - "goodsId": "商品ID", - "memberId": "会员ID", - "content": "评价内容", - "images": "评价图片", - "isAnonymous": "0 匿名 1不匿名", - "scores": "评价分数 1-5", - "isAudit": "审核状态 1待审 2通过 3拒绝", - "explainFirst": "解释内容", - "againContent": "追评内容", - "againImages": "追评图片", - "againExplain": "追评解释", - "againTime": "追评时间", - "againIsAudit": "审核状态 1待审 2通过 3拒绝", - "isShow": "是否显示 1显示 2不显示", - "orderIdPlaceholder": "请输入订单id", - "orderGoodsIdPlaceholder": "请输入订单项ID", - "goodsIdPlaceholder": "请输入商品ID", - "memberIdPlaceholder": "请输入会员ID", - "contentPlaceholder": "请输入评价内容", - "imagesPlaceholder": "请上传评价图片", - "isAnonymousPlaceholder": "请输入0 匿名 1不匿名", - "scoresPlaceholder": "请输入评价分数 1-5", - "isAuditPlaceholder": "请输入审核状态 1待审 2通过 3拒绝", - "explainFirstPlaceholder": "请输入解释内容", - "againContentPlaceholder": "请输入追评内容", - "againImagesPlaceholder": "请上传追评图片", - "againExplainPlaceholder": "请输入追评解释", - "againTimePlaceholder": "请输入追评时间", - "againIsAuditPlaceholder": "请输入审核状态 1待审 2通过 3拒绝", - "isShowPlaceholder": "请输入是否显示 1显示 2不显示", - "addEvaluate": "添加商品评价", - "updateEvaluate": "编辑商品评价", - "evaluateDeleteTips": "确定要删除该商品评价吗?" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.label_group_list.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.label_group_list.json deleted file mode 100644 index dfceabecd..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.label_group_list.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "tabGoodsLabel": "商品标签", - "tabGoodsLabelGroup": "标签分组", - "groupName": "分组名称", - "groupNamePlaceholder": "请输入分组名称", - "sort": "排序", - "sortPlaceholder": "请输入排序", - "addLabelGroup": "添加标签分组", - "updateLabelGroup": "编辑标签分组", - "sortTips": "排序号格式输入错误", - "labelGroupDeleteTips": "确定要删除该数据吗?" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.label_list.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.label_list.json deleted file mode 100644 index 6b412506e..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.label_list.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "tabGoodsLabel": "商品标签", - "tabGoodsLabelGroup": "标签分组", - "labelName": "标签名称", - "labelNamePlaceholder": "请输入标签名称", - "groupName": "标签分组", - "groupNamePlaceholder": "请选择标签分组", - "styleType": "效果设置", - "styleByDiy": "自定义", - "styleByIcon": "图片", - "textColor": "文字颜色", - "bgColor": "背景颜色", - "borderColor": "边框颜色", - "colorTips": "若未设置颜色,则为默认色", - "icon": "上传图片", - "iconTips": "建议尺寸:80px*30px,若未上传将显示默认", - "memo": "标签说明", - "memoPlaceholder": "请输入标签说明", - "sort": "排序", - "sortPlaceholder": "请输入排序", - "addLabel": "添加商品标签", - "updateLabel": "编辑商品标签", - "sortTips": "排序号格式输入错误", - "labelDeleteTips": "确定要删除该数据吗?", - "statusOn": "开启", - "statusOff": "关闭", - "status": "状态", - "label": "标签", - "createTime": "创建时间", - "copyLabel": "复制", - "labelCopyTips": "确定要复制该标签吗?" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.list.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.list.json deleted file mode 100644 index f492e442a..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.list.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "goodsName": "商品名称", - "goodsNamePlaceholder": "请输入商品名称", - "goodsCategory": "商品分类", - "goodsCategoryPlaceholder": "全部", - "goodsType": "商品类型", - "goodsTypePlaceholder": "请选择商品类型", - "brand": "商品品牌", - "brandPlaceholder": "请输入商品品牌", - "labelIds": "商品标签", - "labelIdsPlaceholder": "请选择商品标签", - "saleNum": "销量", - "startSaleNumPlaceholder": "最低销量", - "startSaleNumTips": "最低销量输入错误", - "endSaleNumPlaceholder": "最高销量", - "endSaleNumTips": "最高销量输入错误", - "shopSaleNumTips": "最低销量不能大于最高销量", - "skuPrice": "价格", - "startPricePlaceholder": "最低价格", - "startPriceTips": "最低价格输入错误", - "endPricePlaceholder": "最高价格", - "endPriceTips": "最高价格输入错误", - "shopPriceTips": "最低价格不能大于最高价格", - "statusOn": "销售中", - "statusOff": "仓库中", - "statusAll": "全部商品", - "batchOnGoods": "批量上架", - "batchOffGoods": "批量下架", - "batchDeleteGoods": "批量删除", - "batchSetting": "批量设置", - "batchEmptySelectedGoodsTips": "请选择要操作的商品", - "goodsInfo": "商品", - "stock": "库存", - "status": "状态", - "sort": "排序", - "sortTips": "排序号格式输入错误", - "createTime": "创建时间", - "addGoods": "添加商品", - "statusActionOn": "上架", - "statusActionOff": "下架", - "statusChangeTips": "确定要下架该商品吗?", - "spreadGoods": "推广", - "copyGoods": "复制", - "updateGoods": "编辑商品", - "goodsCopyTips": "确定要复制该商品吗?", - "goodsDeleteTips": "确定要删除该商品吗?", - "batchGoodsDeleteTips": "确定要删除这些商品吗", - "batchOperationSku": "批量设置", - "editStockPopupTitle": "编辑商品库存", - "editPricePopupTitle": "编辑商品价格", - "skuName": "规格名称", - "price": "销售价", - "pricePlaceholder": "请输入销售价", - "priceTips": "销售价格式输入错误", - "priceNotZeroTips": "销售价不能小于0", - "marketPrice": "划线价", - "marketPricePlaceholder": "请输入划线价", - "marketPriceTips": "划线价格式输入错误", - "marketPriceNotZeroTips": "划线价不能小于0", - "market_price": "划线价", - "market_pricePlaceholder": "请输入划线价", - "market_priceTips": "划线价格式输入错误", - "market_priceNotZeroTips": "划线价不能小于0", - "costPrice": "成本价", - "costPricePlaceholder": "请输入成本价", - "costPriceTips": "成本价格式输入错误", - "costPriceNotZeroTips": "成本价不能小于0", - "cost_price": "成本价", - "cost_pricePlaceholder": "请输入成本价", - "cost_priceTips": "成本价格式输入错误", - "cost_priceNotZeroTips": "成本价不能小于0", - "stockPlaceholder": "请输入库存", - "stockTips": "库存格式输入错误", - "stockNotZeroTips": "库存不能小于0", - "goodsSpreadTitle": "商品推广", - "spreadLink": "推广链接", - "copy": "复制", - "downloadQrcode": "下载二维码", - "memberPrice": "会员价", - "editMemberPricePopupTitle": "编辑会员价", - "memberDiscount": "会员价优惠方式", - "discount": "会员折扣", - "fixedPrice": "指定会员价", - "nonparticipation": "不参与", - "goodsSku": "商品规格", - "memberEnjoyDiscount": "会员享受折扣", - "discountUnit": "折", - "yuanUnit": "元", - "editMemberPrice": "修改会员价", - "memberLevel": "会员等级", - "memberPricePlaceholder": "请输入会员价", - "discountHint": "会员折扣说明:按照默认会员等级折扣优惠", - "fixedPriceHint": "会员价说明:指定优惠价格,商品未参与活动时,按照会员价优惠,若商品参与活动,则以活动价为准", - "addGoodsLabel": "添加商品标签", - "addGoodsService": "添加商品服务", - "addGoodsCategory": "添加分类", - "addGoodsBrand": "添加品牌", - "addGoodsPoster": "添加海报", - "virtualSaleNumPlaceholder": "请输入虚拟销量", - "posterPlaceholder": "请选择商品海报", - "goodsCategoryPlaceholderTwo": "请选择商品分类", - "virtualSaleNumDesc": "虚拟销量只在前台展示中参与计算", - "virtualSaleNumTips": "虚拟销量格式输入错误", - "virtualSaleNumNotZeroTips": "虚拟销量不能小于0", - "giftTips": "当商品设置为赠品时,该商品仅用于活动赠送,不会在前台展示或出售", - "yes": "是", - "no": "否", - "isFreeShipping": "是否免邮", - "feeType": "运费设置", - "selectTemplate": "选择模板", - "fixedShipping": "统一运费", - "deliveryMoney": "固定运费", - "deliveryMoneyPlaceholder": "请输入固定运费", - "deliveryMoneyTips": "固定运费格式输入错误", - "deliveryMoneyNotZeroTips": "固定运费不能小于0", - "deliveryTemplateId": "运费模板", - "deliveryTemplateIdPlaceholder": "请选择运费模板", - "addDeliveryTemplateId": "添加运费模板", - "deliveryType": "配送方式", - "deliveryTypePlaceholder": "请选择配送方式", - "yuan": "元", - "label": "商品标签", - "service": "商品服务", - "virtualSaleNum": "虚拟销量", - "goodsBrand": "商品品牌", - "goodsPoster": "商品海报", - "isGift": "是否赠品", - "batchSettingTip": "每次仅能设置一项,点击确认成功之后生效", - "setStock": "修改库存", - "addStock": "增加库存", - "reduceStock": "减少库存", - "stockNum": "目标数值", - "stockNumTips": "批量调整商品库存,若商品正在参与营销活动,则不会修改库存", - "confirm": "确认", - "diyForm": "万能表单", - "diyFormPlaceholder": "请选择万能表单", - "addDiyForm": "添加表单", - "productClassificationPlaceholder":"请选择商品分类" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.real_edit.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.real_edit.json deleted file mode 100644 index 65e1ab7c4..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.real_edit.json +++ /dev/null @@ -1,171 +0,0 @@ -{ - "addGoods": "添加商品", - "updateGoods": "编辑商品", - "basicInfoTab": "基础信息", - "goodsType": "商品类型", - "goodsName": "商品名称", - "goodsNamePlaceholder": "请输入商品名称", - "goodsNameMaxLengthTips": "商品名称不能超过60个字符", - "subTitle": "副标题", - "subTitlePlaceholder": "请输入副标题", - "subTitleMaxLengthTips": "副标题不能超过100个字符", - "goodsImage": "商品图片", - "goodsImagePlaceholder": "请上传商品图片", - "goodsVideo": "商品视频", - "goodsVideoPlaceholder": "请上传商品视频", - "goodsVideoTipTile": "注意事项:", - "goodsVideoTipOne": "1、检查upload文件夹是否有读写权限。", - "goodsVideoTipTwo": "2、PHP默认上传限制为2MB,需要在php.ini配置文件中修改“post_max_size”和“upload_max_filesize”的大小。", - "goodsVideoTipThree": "3、视频支持手动输入外链视频地址或者上传本地视频文件", - "goodsVideoTipFour": "4、必须上传.mp4视频格式", - "goodsVideoTipFive": "5、视频文件大小不能超过500MB", - "goodsCategory": "商品分类", - "refresh": "刷新", - "addGoodsCategory": "添加分类", - "goodsCategoryPlaceholder": "请选择商品分类", - "brand": "商品品牌", - "brandPlaceholder": "请输入商品品牌", - "addGoodsBrand": "添加品牌", - "poster": "商品海报", - "posterPlaceholder": "请选择商品海报", - "addGoodsPoster": "添加海报", - "posterTips": "不设置将使用默认海报", - "diyForm": "万能表单", - "diyFormPlaceholder": "请选择万能表单", - "addDiyForm": "添加表单", - "label": "商品标签", - "addGoodsLabel": "添加商品标签", - "goodsService": "商品服务", - "addGoodsService": "添加商品服务", - "supplier": "供应商", - "supplierPlaceholder": "请选择供应商", - "addSupplier": "添加供应商", - "status": "商品状态", - "statusOn": "上架", - "statusOff": "下架", - "isGive": "是否赠品", - "yes": "是", - "no": "否", - "sort": "排序", - "sortPlaceholder": "请输入排序", - "sortTips": "排序号格式输入错误", - "priceStockTab": "价格库存", - "specType": "规格类型", - "singleSpec": "单规格", - "multiSpec": "多规格", - "price": "销售价", - "marketPrice": "划线价", - "costPrice": "成本价", - "weight": "重量", - "volume": "体积", - "goodsStock": "商品库存", - "goodsStockPlaceholder": "请输入商品库存", - "skuNo": "商品编码", - "yuan": "元", - "defaultUnit": "件", - "skuNoPlaceholder": "请输入商品编码", - "goodsSku": "商品规格", - "specNamePlaceholder": "请输入规格项,如颜色、尺码、大小", - "specValueNamePlaceholder": "请输入规格值,如:白色", - "addSpecValue": "+添加规格值", - "addSpec": "添加规格", - "batchOperationSku": "批量设置", - "all": "全部", - "stock": "库存", - "skuWeight": "重量(kg)", - "skuVolume": "体积(m³)", - "confirm": "确定", - "image": "图片", - "defaultSku": "默认规格", - "unit": "单位", - "unitPlaceholder": "请输入单位,默认为:件", - "virtualSaleNum": "虚拟销量", - "virtualSaleNumPlaceholder": "请输入虚拟销量", - "virtualSaleNumDesc": "虚拟销量只在前台展示中参与计算", - "virtualSaleNumTips": "虚拟销量格式输入错误", - "virtualSaleNumNotZeroTips": "虚拟销量不能小于0", - "giftTips": "当商品设置为赠品时,该商品仅用于活动赠送,不会在前台展示或出售", - "maxAddSpecTips": "最多添加5个规格项", - "pleaseEditSpecPlaceholder": "请编辑规格信息", - "refreshSuccess": "刷新成功", - "deliveryTab": "配送设置", - "advancedSetup": "高级设置", - "diyDetailTemplate": "商品详情模版", - "diyDetailTemplatePlaceholder": "请选择商品详情模版", - "addDetailTemp": "添加模板", - "detailTempTip": "不设置将使用默认商品详情模板", - "deliveryType": "配送方式", - "deliveryTypePlaceholder": "请选择配送方式", - "pleaseSelectSku": "请先选择商品规格", - "isLimit": "是否限购", - "isLimitTips": "启用限购后,购买商品时,会对该商品购买量做限制判断。", - "limitType": "限购类型", - "limitTypeTips": "单次限购是针对于每次下单不能超过限购数量,单人限购是针对于会员账号购买这个商品的总数不能超过限购数量。", - "singleTime": "单次限购", - "singlePerson": "单人限购", - "maxBuy": "限购数量", - "maxBuyPlaceholder": "请输入限购数量", - "maxBuyTips": "[限购数量]格式输入错误", - "maxBuyWarnTips": "限购数量超出商品库存时,买家将无法购买该商品", - "maxBuyNotZeroTips": "限购数量不能小于1", - "minBuy": "起购数量", - "minBuyTips": "起购数量超出商品库存时,买家将无法购买该商品", - "minBuyFormatErrorTips": "[起购数量]格式输入错误", - "minBuyNotZeroTips": "起购数量不能小于0", - "minBuyGreaterThanMaxBuyTips": "起购数量不能大于限购数量", - "isFreeShipping": "是否免邮", - "feeType": "运费设置", - "selectTemplate": "选择模板", - "fixedShipping": "统一运费", - "deliveryMoney": "固定运费", - "deliveryMoneyPlaceholder": "请输入固定运费", - "deliveryMoneyTips": "固定运费格式输入错误", - "deliveryMoneyNotZeroTips": "固定运费不能小于0", - "deliveryTemplateId": "运费模板", - "deliveryTemplateIdPlaceholder": "请选择运费模板", - "addDeliveryTemplateId": "添加运费模板", - "goodsDesc": "商品详情", - "goodsDescPlaceholder": "请填写商品详情", - "goodsDescMaxTips": "商品描述字符数应在5~50000之间", - "pricePlaceholder": "请输入销售价", - "priceTips": "[销售价]格式输入错误", - "priceNotZeroTips": "销售价不能小于0", - "marketPricePlaceholder": "请输入划线价", - "marketPriceTips": "[划线价]格式输入错误", - "marketPriceNotZeroTips": "划线价不能小于0", - "costPricePlaceholder": "请输入成本价", - "costPriceTips": "[成本价]格式输入错误", - "costPriceNotZeroTips": "成本价不能小于0", - "weightPlaceholder": "请输入重量", - "weightTips": "[重量(kg)]格式输入错误", - "weightNotZeroTips": "重量(kg)不能小于0", - "volumePlaceholder": "请输入体积", - "volumeTips": "[体积(m³)]格式输入错误", - "volumeNotZeroTips": "体积(m³)不能小于0", - "stockPlaceholder": "请输入库存", - "stockTips": "[库存]格式输入错误", - "stockNotZeroTips": "库存不能小于0", - "specNameRequire": "规格项不能为空", - "specNameRepeat": "规格项不能重复", - "specValueRequire": "规格值不能为空", - "specValueNameRepeat": "规格值不能重复", - "lackDefaultSpec": "商品缺少默认规格", - "goodsArguments": "商品参数", - "goodsArgumentsTemp": "商品参数模板", - "goodsArgumentsTempPlaceholder": "请选择商品参数模板", - "goodsArgumentsTempHint": "商品可以添加自定义商品参数,也可以通过参数模板批量设置商品参数", - "argumentsName": "参数名", - "argumentsValue": "参数值", - "argumentsSortHint": "设置排序,改变商品规格展示顺序", - "operation": "操作", - "delAttr": "删除", - "noData": "无数据", - "addGoodsArguments": "添加商品参数", - "memberDiscount": "会员等级折扣", - "discount": "会员折扣", - "fixedPrice": "指定会员价", - "nonparticipation": "不参与", - "discountHint": "会员折扣说明:按照默认会员等级折扣优惠", - "fixedPriceHint": "会员价说明:指定优惠价格,商品未参与活动时,按照会员价优惠,若商品参与活动,则以活动价为准", - "participateInActiveDisableTips": "商品正在参与营销活动,禁止操作" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.recycle.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.recycle.json deleted file mode 100644 index 078dd85d2..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.recycle.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "goodsName": "商品名称", - "goodsNamePlaceholder": "请输入商品名称", - "goodsCategory": "商品分类", - "goodsCategoryPlaceholder": "全部", - "goodsType": "商品类型", - "goodsTypePlaceholder": "请选择商品类型", - "price": "价格", - "saleNum": "销量", - "statusOn": "销售中", - "statusOff": "仓库中", - "batchRecycle": "批量恢复", - "batchEmptySelectedGoodsTips": "请选择要操作的商品", - "goodsInfo": "商品", - "stock": "库存", - "stockPlaceholder": "请输入商品库存(总和)", - "status": "状态", - "createTime": "创建时间", - "recycle": "恢复", - "goodsRecycleTips": "确定要恢复该商品吗?", - "batchGoodsRecycleTips": "确定要恢复这些商品吗" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.search_config.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.search_config.json deleted file mode 100644 index f8cd355db..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.search_config.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "goodsSearch": "商品搜索", - "goodsCode": "商品编码", - "defaultSearch": "默认搜索", - "defaultWord": "默认搜索关键词", - "defaultWordPlaceholder": "请输入默认搜索关键词", - "defaultWordTips": "默认搜索,将显示在前台搜索框,前台点击时直接作为关键词进行搜索", - "hotSearch": "热门搜索", - "indexKeyword": "搜索的关键字", - "searchPlaceholder": "请输入搜索关键字", - "addSearch": "添加", - "enable": "商品编码唯一性", - "enableTips": "开启后,将验证商品编码唯一性,不能重复", - "searchTips": "列表中已存在该关键字", - "keyWordTips": "搜索关键字不能为空", - "goodSort": "商品排序", - "sortType": "排序方式", - "sortTypePlaceholder": "请选择排序方式", - "sortTypeTips": "选择排序方式时,前台商品将依据排序号优先进行正序或倒序排列,当排序号相同时,均按照创建时间倒序排列。", - "sortColumn": "排序字段", - "sortColumnTips": "请选择用于排序的字段,例如 排序号、价格、销量,不同的排序字段将影响商品的显示优先级。", - "sortColumnPlaceholder": "请选择排序字段", - "defaultSort": "默认排序值", - "defaultSortPlaceholder": "请输入默认排序值", - "defaultSortTips": "默认排值是当添加商品时,如果没有设置排序值的情况下,则按照该位置设置的默认数值参与排序 " -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.service.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.service.json deleted file mode 100644 index 0fa8ac145..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.service.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "serviceName": "服务名称", - "serviceNamePlaceholder": "请输入服务名称", - "desc": "描述", - "descPlaceholder": "请输入描述", - "addServe": "添加商品服务", - "updateServe": "编辑商品服务", - "serveDeleteTips": "确定要删除该数据吗?", - "imagePlaceholder": "请上传服务图片" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/goods.virtual_edit.json b/niucloud/addon/shop/admin/lang/zh-cn/goods.virtual_edit.json deleted file mode 100644 index 933f11caf..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/goods.virtual_edit.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "addGoods": "添加商品", - "updateGoods": "编辑商品", - "basicInfoTab": "基础信息", - "goodsType": "商品类型", - "goodsName": "商品名称", - "goodsNamePlaceholder": "请输入商品名称", - "goodsNameMaxLengthTips": "商品名称不能超过60个字符", - "subTitle": "副标题", - "subTitlePlaceholder": "请输入副标题", - "subTitleMaxLengthTips": "副标题不能超过100个字符", - "goodsImage": "商品图片", - "goodsImagePlaceholder": "请上传商品图片", - "goodsVideo": "商品视频", - "goodsVideoPlaceholder": "请上传商品视频", - "goodsVideoTipTile": "注意事项:", - "goodsVideoTipOne": "1、检查upload文件夹是否有读写权限。", - "goodsVideoTipTwo": "2、PHP默认上传限制为2MB,需要在php.ini配置文件中修改“post_max_size”和“upload_max_filesize”的大小。", - "goodsVideoTipThree": "3、视频支持手动输入外链视频地址或者上传本地视频文件", - "goodsVideoTipFour": "4、必须上传.mp4视频格式", - "goodsVideoTipFive": "5、视频文件大小不能超过500MB", - "goodsCategory": "商品分类", - "advancedSetup": "高级设置", - "diyDetailTemplate": "商品详情模版", - "diyDetailTemplatePlaceholder": "请选择商品详情模版", - "addDetailTemp": "添加模板", - "detailTempTip": "不设置将使用默认商品详情模板", - "refresh": "刷新", - "addGoodsCategory": "添加分类", - "goodsCategoryPlaceholder": "请选择商品分类", - "brand": "商品品牌", - "brandPlaceholder": "请输入商品品牌", - "addGoodsBrand": "添加品牌", - "poster": "商品海报", - "posterPlaceholder": "请选择商品海报", - "addGoodsPoster": "添加海报", - "posterTips": "不设置将使用默认海报", - "diyForm": "万能表单", - "diyFormPlaceholder": "请选择万能表单", - "addDiyForm": "添加表单", - "label": "商品标签", - "addGoodsLabel": "添加商品标签", - "goodsService": "商品服务", - "addGoodsService": "添加商品服务", - "supplier": "供应商", - "supplierPlaceholder": "请选择供应商", - "addSupplier": "添加供应商", - "status": "商品状态", - "statusOn": "上架", - "statusOff": "下架", - "isGive": "是否赠品", - "yes": "是", - "no": "否", - "sort": "排序", - "sortPlaceholder": "请输入排序", - "sortTips": "排序号格式输入错误", - "priceStockTab": "价格库存", - "specType": "规格类型", - "singleSpec": "单规格", - "multiSpec": "多规格", - "price": "销售价", - "marketPrice": "划线价", - "costPrice": "成本价", - "goodsStock": "商品库存", - "goodsStockPlaceholder": "请输入商品库存", - "skuNo": "商品编码", - "yuan": "元", - "defaultUnit": "件", - "skuNoPlaceholder": "请输入商品编码", - "goodsSku": "商品规格", - "specNamePlaceholder": "请输入规格项,如颜色、尺码、大小", - "specValueNamePlaceholder": "请输入规格值,如:白色", - "addSpecValue": "+添加规格值", - "addSpec": "添加规格", - "batchOperationSku": "批量设置", - "all": "全部", - "stock": "库存", - "confirm": "确定", - "image": "图片", - "defaultSku": "默认规格", - "unit": "单位", - "unitPlaceholder": "请输入单位,默认为:件", - "virtualSaleNum": "虚拟销量", - "virtualSaleNumPlaceholder": "请输入虚拟销量", - "virtualSaleNumDesc": "虚拟销量只在前台展示中参与计算", - "virtualSaleNumTips": "虚拟销量格式输入错误", - "virtualSaleNumNotZeroTips": "虚拟销量不能小于0", - "giftTips": "当商品设置为赠品时,该商品仅用于活动赠送,不会在前台展示或出售", - "virtualSetTips": "当设置为店内核销时,若存在未完成的订单,则无法编辑", - "maxAddSpecTips": "最多添加5个规格项", - "pleaseEditSpecPlaceholder": "请编辑规格信息", - "refreshSuccess": "刷新成功", - "isLimit": "是否限购", - "isLimitTips": "启用限购后,购买商品时,会对该商品购买量做限制判断。", - "limitType": "限购类型", - "limitTypeTips": "单次限购是针对于每次下单不能超过限购数量,单人限购是针对于会员账号购买这个商品的总数不能超过限购数量。", - "singleTime": "单次限购", - "singlePerson": "单人限购", - "maxBuy": "限购数量", - "maxBuyPlaceholder": "请输入限购数量", - "maxBuyTips": "[限购数量]格式输入错误", - "maxBuyWarnTips": "限购数量超出商品库存时,买家将无法购买该商品", - "maxBuyNotZeroTips": "限购数量不能小于1", - "minBuy": "起购数量", - "minBuyTips": "起购数量超出商品库存时,买家将无法购买该商品", - "minBuyFormatErrorTips": "[起购数量]格式输入错误", - "minBuyNotZeroTips": "起购数量不能小于0", - "minBuyGreaterThanMaxBuyTips": "起购数量不能大于限购数量", - "goodsDesc": "商品详情", - "goodsDescPlaceholder": "请填写商品详情", - "goodsDescMaxTips": "商品描述字符数应在5~50000之间", - "pricePlaceholder": "请输入销售价", - "priceTips": "[销售价]格式输入错误", - "priceNotZeroTips": "销售价不能小于0", - "marketPricePlaceholder": "请输入划线价", - "marketPriceTips": "[划线价]格式输入错误", - "marketPriceNotZeroTips": "划线价不能小于0", - "costPricePlaceholder": "请输入成本价", - "costPriceTips": "[成本价]格式输入错误", - "costPriceNotZeroTips": "成本价不能小于0", - "stockPlaceholder": "请输入库存", - "stockTips": "[库存]格式输入错误", - "stockNotZeroTips": "库存不能小于0", - "specNameRequire": "规格项不能为空", - "specNameRepeat": "规格项不能重复", - "specValueRequire": "规格值不能为空", - "specValueNameRepeat": "规格值不能重复", - "lackDefaultSpec": "商品缺少默认规格", - "setDeliverGoods": "发货设置", - "autoDeliverGoods": "自动发货", - "handDeliverGoods": "手动发货", - "setTakeGoods": "收货设置", - "autoTakeGoods": "自动收货", - "handTakeGoods": "买家确认收货", - "verifyTakeGoods": "到店核销", - "virtualIndate": "有效期", - "virtualIndatePlaceholder": "请输入有效期", - "verifyVirtualIndate": "核销有效期", - "verifyVirtualIndateOne": "永久", - "verifyVirtualIndateTwo": "购买后几日有效", - "verifyVirtualIndateThree": "指定过期日期", - "verifyHint": "无论何时购买此商品,到达指定时间后都将过期,无法核销。", - "sky": "天", - "virtualIndateErrorHint": "核销有效期不能小于1天", - "virtualIndateErrorOneHint": "核销有效期不能小于等于当前时间", - "goodsArguments": "商品参数", - "goodsArgumentsTemp": "商品参数模板", - "goodsArgumentsTempPlaceholder": "请选择商品参数模板", - "goodsArgumentsTempHint": "商品可以添加自定义商品参数,也可以通过参数模板批量设置商品参数", - "argumentsName": "参数名", - "argumentsValue": "参数值", - "argumentsSortHint": "设置排序,改变商品规格展示顺序", - "operation": "操作", - "delAttr": "删除", - "noData": "无数据", - "addGoodsArguments": "添加商品参数", - "memberDiscount": "会员等级折扣", - "discount": "会员折扣", - "fixedPrice": "指定会员价", - "nonparticipation": "不参与", - "discountHint": "会员折扣说明:按照默认会员等级折扣优惠", - "fixedPriceHint": "会员价说明:指定优惠价格,商品未参与活动时,按照会员价优惠,若商品参与活动,则以活动价为准", - "participateInActiveDisableTips": "商品正在参与营销活动,禁止操作" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/index.index.json b/niucloud/addon/shop/admin/lang/zh-cn/index.index.json deleted file mode 100644 index cbf564f79..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/index.index.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "realtimeOverview": "实时概况", - "updateTime": "更新时间:", - "todayOrderCount": "今日订单数", - "todayOrderSale": "今日销售额", - "todayAddMemberCount": "今日退款金额", - "todayBrowseCount": "今日浏览量", - "yesterday": "昨日:", - "orderCount": "订单总数", - "salesTotal": "销售总额(元)", - "memberTotal": "退款金额", - "browseTotal": "总浏览量", - "agentMatters": "待办事项", - "waitPayOrder": "待付款订单", - "waitDeliveryOrder": "待发货订单", - "waitTakeOrder": "待收货订单", - "refundOrder": "退款订单", - "saleGoodsNum": "出售商品数量", - "warehouseGoodsNum": "仓库商品数量" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.coupon.add.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.coupon.add.json deleted file mode 100644 index b99064ab8..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.coupon.add.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "addCoupon": "添加优惠券", - "title": "名称", - "titlePlaceholder": "请如:XXX优惠券,最多20个字", - "type": "类型", - "price": "面值", - "receiveType": "是否手动领取", - "startTime": "开始时间", - "endTime": "结束时间", - "remainCount": "剩余数量", - "limitCount": "已领取数量", - "receive": "领取记录", - "user": "是", - "grant": "否", - "limit": "限量", - "unlimited": "不限量", - "receiveNumber": "发放数量", - "pricePlaceholder": "请输入优惠券面值", - "remainCountPlaceholder": "最多发放100000张", - "reduction": "满减券", - "noThreshold": "无门槛券", - "threshold": "使用门槛", - "minConditionMoneyPlaceholder": "请输入优惠券的最低消费金额", - "userLimitCount": "限领张数", - "userLimitCountPlaceholder": "请输入限领张数", - "receiveTime": "领取时间", - "limitedTime": "限时", - "unlimitedTime": "不限时", - "days": "天数", - "times": "固定时间", - "validType": "有效期", - "lengthPlaceholder": "请输入使用时间", - "status": "状态", - "open": "开启", - "close": "关闭", - "cancel": "取消", - "save": "保存", - "startDate": "开始时间", - "endDate": "结束时间", - "validTimePlaceholder": "用券截止时间", - "arrivalTimePlaceholder": "领券截止时间" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.coupon.edit.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.coupon.edit.json deleted file mode 100644 index 932564622..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.coupon.edit.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "editCoupon": "编辑优惠券", - "title": "名称", - "titlePlaceholder": "请如:XXX优惠券,最多20个字", - "type": "类型", - "price": "面值", - "receiveType": "是否手动领取", - "startTime": "开始时间", - "endTime": "结束时间", - "remainCount": "剩余数量", - "limitCount": "已领取数量", - "receive": "领取记录", - "user": "是", - "grant": "否", - "limit": "限量", - "unlimited": "不限量", - "receiveNumber": "发放数量", - "pricePlaceholder": "请输入优惠券面值", - "remainCountPlaceholder": "最多发放100000张", - "reduction": "满减券", - "noThreshold": "无门槛券", - "threshold": "使用门槛", - "minConditionMoneyPlaceholder": "请输入优惠券的最低消费金额", - "userLimitCount": "限领张数", - "userLimitCountPlaceholder": "请输入限领张数", - "receiveTime": "领取时间", - "limitedTime": "限时", - "unlimitedTime": "不限时", - "days": "天数", - "times": "固定时间", - "validType": "使用时间", - "lengthPlaceholder": "请输入使用时间", - "status": "状态", - "open": "开启", - "close": "关闭", - "cancel": "取消", - "save": "保存", - "startDate": "开始时间", - "endDate": "结束时间", - "validTimePlaceholder": "用券截止时间", - "arrivalTimePlaceholder": "领券截止时间" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.coupon.list.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.coupon.list.json deleted file mode 100644 index df6492257..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.coupon.list.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "addCoupon": "添加优惠券", - "title": "名称", - "titlePlaceholder": "请输入优惠券名称", - "type": "类型", - "price": "面值", - "receiveType": "是否手动领取", - "startTime": "开始时间", - "endTime": "结束时间", - "count": "数量", - "countTips1": "1、剩余数量是指可主动领取优惠券的剩余数量,总数是指可主动领取优惠券的累计数量", - "countTips2": "2、已领取数量是指用户在前台主动领取的优惠券数量", - "countTips3": "3、已发放数量是指商家在后台给用户直接发放以及用户参与各种营销活动发放的优惠券数量", - "countTips4": "4、发放数量不受优惠券剩余数量限制", - "sumCount": "剩余 / 总数", - "giveCount": "已发放", - "noLimit": "不限量", - "receive": "领取记录", - "edit": "编辑", - "Status": "是否关闭领取", - "threshold": "使用门槛", - "reduction": "满减券", - "noThreshold": "无门槛券", - "couponDeleteTips": "确定要删除该优惠券吗?", - "couponCloseTips": "确定要关闭该优惠券吗?关闭后将不可领取,若会员已领取将变为失效", - "validType": "有效期", - "statusName": "状态", - "receiveTypeTime": "领取有效期", - "spreadGoods": "推广", - "close": "关闭", - "couponSpreadTitle": "优惠券推广", - "downloadQrcode": "下载二维码", - "spreadLink": "推广链接", - "receiveUseCount": "已使用", - "collectionCoupon": "领取记录", - "collectionTitle": "优惠券名称", - "userName": "领用会员", - "collectionReceiveType": "领用方式", - "createTime": "领取时间", - "expireTime": "到期时间", - "status": "当前状态", - "useTime": "使用时间", - "validity": "使用有效期", - "mobile": "手机号", - "memberInfo": "会员信息", - "memberInfoPlaceholder": "请输入会员编码/昵称/手机号搜索", - "collectionSumCount": "发放数量", - "couponInfo": "优惠券基本信息", - "receiveCount": "已领取", - "receiveExpireCount": "已过期", - "receiveInvalidCount": "已失效", - "showOrder": "查看订单", - "send": "发券", - "sendRecord": "发放记录", - "rangeTypePlaceholder": "请选择发放对象", - "sendTime": "发放时间", - "sendStatus": "发放状态", - "selectCoupon": "优惠券名称", - "sendNum": "每人发放数量", - "sendNumPrompt": "请输入每人发放数量", - "num": "张", - "sendNumTip": "不受优惠券库存限制", - "sendNumTipTwo": "输入框限制不能输入超过10", - "rangeType": "发放会员", - "point": "积分", - "balance": "余额", - "memberLabel": "会员标签", - "memberLabelPlaceholder": "请选择会员标签", - "memberLevel": "会员等级", - "memberLevelPlaceholder": "请选择会员等级", - "memberLevelTip": "会员等级不能为空", - "memberTip": "会员不能为空", - "memberLabelTip": "会员标签不能为空", - "sendNumTipThree": "发放数量不能为空", - "sendNumTipFour": "每人发放数量要大于0小于10", - "sendNumTipFive": "输入格式不正确", - "sendCouponTitle": "优惠券发放", - "batchEmptySelectedGoodsTips": "请先选择需要批量操作的优惠券", - "batchDelete": "批量删除", - "batchClose": "批量关闭", - "batchCloseTips": "确定要关闭选中的优惠券吗?关闭后将不可领取,若会员已领取将变为失效", - "batchDeleteTips": "确定要删除选中的优惠券吗?" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.coupon.send.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.coupon.send.json deleted file mode 100644 index 4e0cb1f93..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.coupon.send.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "selectCoupon": "选择的优惠券", - "sendNum": "每人发放数量", - "sendNumPrompt": "请输入每人发放数量", - "num": "张", - "sendNumTip": "不受优惠券库存限制", - "sendNumTipTwo": "输入框限制不能输入超过10", - "rangeType": "发放对象", - "memberInfo": "会员信息", - "mobile": "手机号", - "point": "积分", - "balance": "余额", - "memberLabel": "会员标签", - "memberLabelPlaceholder": "请选择会员标签", - "memberLevel": "会员等级", - "memberLevelPlaceholder": "请选择会员等级", - "memberLevelTip": "会员等级不能为空", - "memberTip": "会员不能为空", - "memberLabelTip": "会员标签不能为空", - "sendNumTipThree": "发放数量不能为空", - "sendNumTipFour": "每人发放数量要大于0小于10", - "sendNumTipFive": "输入格式不正确" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.add.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.add.json deleted file mode 100644 index ac4ec23cc..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.add.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "editDiscount": "添加限时折扣", - "name": "活动名称", - "namePlaceholder": "请输入活动名称", - "nameTip": "活动名称用于展示在商家后台管理", - "title": "标题", - "titlePlaceholder": "请输入活动标题", - "titleTip": "活动标题用户展示在手机或者电脑前端展示使用,建议输入长度不要大于5", - "activityTime": "活动时间", - "discountTimePlaceholder": "请选择活动时间", - "selectProduct": "选择商品", - "selectProductPlaceholder": "请选择商品", - "noSpaceAllowed": "内容不能为空", - "batchOperation": "批量设置", - "batchEmptySelectedGoodsTips": "请选择要操作的商品", - "discountType": "折扣类型", - "price": "原价", - "discounts": "打折", - "discountsTips": "[打折]格式错误", - "discountsTipsTwo": "打折折扣不可小于0", - "discountsTipsThree": "打折折扣不可大于9.9", - "discountsPlaceholder": "请输入打折折扣", - "reduceMoney": "减钱", - "reduceMoneyTips": "[减钱]格式错误", - "reduceMoneyTipsTwo": "减钱金额不可小于0", - "reduceMoneyTipsThree": "减钱金额不可大于原价金额", - "reduceMoneyPlaceholder": "请输入减钱金额", - "promotional": "促销价", - "promotionalTips": "[促销价]格式错误", - "promotionalTipsTwo": "促销价金额不可小于0", - "promotionalTipsThree": "促销价金额不可大于原价金额", - "promotionalPlaceholder": "请输入促销价", - "delete": "删除", - "enabled": "设为参与", - "noEnabled": "设为不参与", - "skuDiscountSettings": "规格折扣设置", - "skuDiscountSettingsPlaceholder": "请输入规格折扣设置" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.config.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.config.json deleted file mode 100644 index af5748583..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "headTitle": "顶部广告图", - "image": "图片上传", - "imagePlaceholder": "请上传图片", - "toLink": "跳转链接", - "toLinkPlaceholder": "请输入跳转链接", - "addConfigList": "添加广告图" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.detail.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.detail.json deleted file mode 100644 index b3364c6f8..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.detail.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "baseInfo": "基础信息", - "name": "活动名称", - "title": "标题", - "status": "状态", - "paymentAmount": "支付金额", - "memberCount": "参与会员数", - "orderCount": "支付订单数", - "createTime": "创建时间", - "startTime": "活动开始时间", - "endTime": "活动结束时间", - "keywordPlaceholder": "请输入商品名称", - "keyword": "商品名称", - "goodsInfo": "商品信息", - "price": "商品价格", - "activeOrderMoney": "累计订单金额", - "activeOrderNum": "累计订单数", - "activeMemberNum": "参与会员数", - "activeSuccessNum": "支付销量", - "orderInfo": "订单编号", - "payTime": "支付时间", - "orderNo": "订单编号", - "orderMoney": "订单金额", - "buyInfo": "买家/收货人", - "payType": "支付类型", - "orderStatus": "订单状态", - "toBePaid": "待支付", - "toBeShipped": "待发货", - "shipped": "已发货", - "receivedGoods": "已收货", - "completed": "已完成", - "closed": "已关闭", - "consumptionMoney": "消费总额", - "participationNum": "参与次数", - "orderTime": "最后下单时间", - "memberInfo": "会员信息" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.edit.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.edit.json deleted file mode 100644 index eb2b7001b..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.edit.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "editDiscount": "编辑限时折扣", - "name": "活动名称", - "namePlaceholder": "请输入活动名称", - "nameTip": "活动名称用于展示在商家后台管理", - "title": "标题", - "titlePlaceholder": "请输入活动标题", - "titleTip": "活动标题用于在手机或者电脑前端,建议输入长度不要大于5", - "activityTime": "活动时间", - "discountTimePlaceholder": "请选择活动时间", - "noSpaceAllowed": "内容不能为空", - "selectProduct": "选择商品", - "selectProductPlaceholder": "请选择商品", - "batchOperation": "批量设置", - "batchEmptySelectedGoodsTips": "请选择要操作的商品", - "discountType": "折扣类型", - "price": "原价", - "discounts": "打折", - "discountsTips": "[打折]格式错误", - "discountsTipsTwo": "打折折扣不可小于0", - "discountsTipsThree": "打折折扣不可大于9.9", - "discountsPlaceholder": "请输入打折折扣", - "reduceMoney": "减钱", - "reduceMoneyTips": "[减钱]格式错误", - "reduceMoneyTipsTwo": "减钱金额不可小于0", - "reduceMoneyTipsThree": "减钱金额不可大于原价金额", - "reduceMoneyPlaceholder": "请输入减钱金额", - "promotional": "促销价", - "promotionalTips": "[促销价]格式错误", - "promotionalTipsTwo": "促销价金额不可小于0", - "promotionalTipsThree": "促销价金额不可大于原价金额", - "promotionalPlaceholder": "请输入促销价", - "delete": "删除", - "enabled": "设为参与", - "noEnabled": "设为不参与", - "skuDiscountSettings": "规格折扣设置", - "skuDiscountSettingsPlaceholder": "请输入规格折扣设置" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.list.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.list.json deleted file mode 100644 index 79530deef..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.discount.list.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "addDiscount": "添加限时折扣", - "name": "名称", - "namePlaceholder": "请输入活动名称", - "title": "标题", - "status": "状态", - "statusPlaceholder": "请选择状态", - "paymentAmount": "支付金额", - "memberCount": "会员数", - "orderCount": "订单数", - "discountTime": "活动时间", - "detail": "详情", - "close": "关闭", - "closeTips": "活动正在进行中,是否确认关闭当前活动?", - "deleteTips": "是否确认删除当前活动", - "baseInfo": "基础信息", - "createTime": "创建时间", - "startTime": "活动开始时间", - "endTime": "活动结束时间", - "keywordPlaceholder": "请输入商品名称", - "keyword": "商品名称", - "goodsInfo": "商品信息", - "price": "商品价格", - "activeOrderMoney": "累计订单金额", - "activeOrderNum": "累计订单数", - "activeMemberNum": "参与会员数", - "activeSuccessNum": "支付销量", - "orderInfo": "订单编号", - "payTime": "支付时间", - "orderNo": "订单编号", - "orderMoney": "订单金额", - "buyInfo": "买家/收货人", - "payType": "支付类型", - "orderStatus": "订单状态", - "toBePaid": "待支付", - "toBeShipped": "待发货", - "shipped": "已发货", - "receivedGoods": "已收货", - "completed": "已完成", - "closed": "已关闭", - "consumptionMoney": "消费总额", - "participationNum": "参与次数", - "orderTime": "最后下单时间", - "memberInfo": "会员信息", - "activeName": "活动名称", - "participationMemberCount": "参与会员数", - "payOrderCount": "支付订单数", - "startDate": "开始时间", - "endDate": "结束时间", - "batchCloseTips": "是否确认批量关闭当前活动?", - "batchDeleteTips": "是否确认批量删除当前活动?", - "batchClose":"批量关闭", - "batchDelete":"批量删除" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.exchange.goods_add.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.exchange.goods_add.json deleted file mode 100644 index 2f752442f..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.exchange.goods_add.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "addGoods": "添加商品", - "baseInfo": "基础设置", - "goodsType": "商品类型", - "goodsName": "商品名称", - "goodsNamePlaceholder": "请输入商品名称", - "goodsTitle": "副标题", - "goodsTitlePlaceholder": "请输入副标题", - "image": "商品图片", - "imagePlaceholder": "请选择商品图片", - "selectProduct": "选择商品", - "selectGoodsPlaceholder": "请选择商品", - "goodsStatus": "商品状态", - "goodsSelect": "选择商品", - "redemptionSettings": "积分设置", - "batchOperation": "批量设置", - "batchEmptySelectedGoodsTips": "请选择要操作的商品", - "goodsSelectPopupGoodsInfo": "商品信息", - "price": "销售价", - "stock": "兑换库存", - "stockPlaceholder": "请输入兑换库存", - "stockTips": "[兑换库存]格式错误", - "stockTipsTwo": "兑换库存不可小于等于0", - "stockTipsThree": "兑换限制数量不可大于商品库存", - "limit": "兑换限制", - "limitPlaceholder": "请输入兑换限制", - "limitTips": "[兑换限制]格式错误", - "limitTipsTwo": "兑换限制数量不可小于等于0", - "limitTipsThree": "兑换限制数量不能大于兑换库存", - "limitUnit": "件/人", - "integralUnit": "积分", - "prickUnit": "元", - "pointPlaceholder": "请输入积分积分", - "pointTips": "[积分]格式错误", - "pointTipsTwo": "积分不可小于等于0", - "money": "兑换价", - "newPrice": "价格", - "moneyTips": "[价格]格式错误", - "moneyTipsTwo": "价格不可小于0", - "limitRules": "每人每单可兑换件数", - "couponSelect": "选择优惠券", - "couponSelectPlaceholder": "请选择优惠券", - "couponName": "优惠券名称", - "couponType": "类型", - "couponPrice": "面值", - "sumCount": "总库存", - "threshold": "使用门槛", - "validType": "有效期", - "receiveTypeTime": "领取有效期", - "balance": "兑换余额", - "balancePlaceholder": "请输入兑换余额", - "balanceTips": "[兑换余额]格式错误", - "balanceTipsTwo": "兑换余额不可小于等于0", - "balanceType": "余额类型", - "goodsSkuTitle": "选择商品规格", - "goodsSkuPlaceholder": "请选择商品规格", - "goodsStock": "库存", - "enabled": "设为参与", - "noEnabled": "设为不参与", - "noEnabledTip": "请至少设置一个规格参与", - "goodsDetail": "商品详情" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.exchange.goods_edit.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.exchange.goods_edit.json deleted file mode 100644 index 7b8394145..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.exchange.goods_edit.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "editGoods": "编辑商品", - "baseInfo": "基础设置", - "goodsType": "商品类型", - "goodsName": "商品名称", - "goodsNamePlaceholder": "请输入商品名称", - "goodsTitle": "副标题", - "goodsTitlePlaceholder": "请输入副标题", - "image": "商品图片", - "imagePlaceholder": "请选择商品图片", - "selectProduct": "选择商品", - "selectGoodsPlaceholder": "请选择商品", - "goodsStatus": "商品状态", - "goodsSelect": "选择商品", - "redemptionSettings": "积分设置", - "batchOperation": "批量设置", - "batchEmptySelectedGoodsTips": "请选择要操作的商品", - "goodsSelectPopupGoodsInfo": "商品信息", - "price": "销售价", - "stock": "兑换库存", - "stockPlaceholder": "请输入兑换库存", - "stockTips": "[兑换库存]格式错误", - "stockTipsTwo": "兑换库存不可小于等于0", - "stockTipsThree": "兑换限制数量不可大于商品库存", - "limit": "兑换限制", - "limitPlaceholder": "请输入兑换限制", - "limitTips": "[兑换限制]格式错误", - "limitTipsTwo": "兑换限制数量不可小于等于0", - "limitTipsThree": "兑换限制数量不能大于兑换库存", - "limitUnit": "件/人", - "integralUnit": "积分", - "prickUnit": "元", - "pointPlaceholder": "请输入积分积分", - "pointTips": "[积分]格式错误", - "pointTipsTwo": "积分不可小于等于0", - "money": "兑换价", - "newPrice": "价格", - "moneyTips": "[价格]格式错误", - "moneyTipsTwo": "价格不可小于0", - "limitRules": "每人每单可兑换件数", - "couponSelect": "选择优惠券", - "couponSelectPlaceholder": "请选择优惠券", - "couponName": "优惠券名称", - "couponType": "类型", - "couponPrice": "面值", - "sumCount": "总库存", - "threshold": "使用门槛", - "validType": "有效期", - "receiveTypeTime": "领取有效期", - "balance": "兑换余额", - "balancePlaceholder": "请输入兑换余额", - "balanceTips": "[兑换余额]格式错误", - "balanceTipsTwo": "兑换余额不可小于等于0", - "balanceType": "余额类型", - "goodsSkuTitle": "选择商品规格", - "goodsSkuPlaceholder": "请选择商品规格", - "goodsStock": "库存", - "enabled": "设为参与", - "noEnabled": "设为不参与", - "noEnabledTip": "请至少设置一个规格参与", - "goodsDetail": "商品详情" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.exchange.goods_list.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.exchange.goods_list.json deleted file mode 100644 index 2d17f9df0..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.exchange.goods_list.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "addGoods": "添加商品", - "goods": "商品", - "goodsName": "商品名称", - "goodsNamePlaceholder": "请输入商品名称", - "status": "状态", - "statusPlaceholder": "请选择状态", - "goodsType": "商品类型", - "exchangePrice": "兑换价格", - "pointUnit": "积分", - "priceUnit": "元", - "redeemedAndSurplus": "已兑/剩余", - "deleteTips": "是否确认删除当前商品", - "createTime": "创建时间", - "spreadGoods": "推广", - "copyGoods": "复制", - "spreadLink": "推广链接", - "copy": "复制", - "downloadQrcode": "下载二维码", - "goodsSpreadTitle": "积分商品推广", - "up": "上架", - "upTips": "是否确认上架当前商品", - "down": "下架", - "downTips": "是否确认下架当前商品", - "startDate": "开始时间", - "endDate": "结束时间", - "batchUpTips":"是否确认批量上架选中的商品?", - "batchDownTips":"是否确认批量下架选中的商品?", - "batchDeleteTips":"是否确认批量删除选中的商品?", - "batchUp":"批量上架", - "batchDown":"批量下架", - "batchDelete":"批量删除" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.exchange.order_list.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.exchange.order_list.json deleted file mode 100644 index 799f7c236..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.exchange.order_list.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "orderNo": "订单编号", - "orderNoPlaceholder": "请输入订单编号", - "orderStatus": "订单状态", - "orderStatusPlaceholder": "请选择订单状态", - "orderFrom": "订单类型", - "orderFromPlaceholder": "请选择订单类型", - "payTime": "支付时间", - "orderGoods": "商品", - "goodsPriceNumber": "单价(元)/数量", - "orderMoney": "实付金额(元)", - "startDate": "开始时间", - "endDate": "结束时间", - "piece": "件", - "activeRefund": "主动退款", - "notes": "备注", - "offlinePayment": "线下支付", - "orderClose": "关闭订单", - "editPrice": "修改价格", - "editAddress": "修改地址", - "sendOutGoods": "发货", - "confirmTakeDelivery": "确认收货", - "all": "全部", - "toBeShipped": "待发货", - "shipped": "已发货", - "receivedGoods": "已收货", - "completed": "已完成", - "closed": "已关闭", - "refunding": "退款中", - "notesDetail": "备注信息", - "delivery": "订单发货", - "company": "物流公司", - "companyPlaceholder": "请选择物流公司", - "expressNumber": "物流单号", - "expressNumberPlaceholder": "请输入物流单号", - "orderGoodsIdsPlaceholder": "请选择订单项", - "virtualDelivery": "虚拟发货", - "goodsName": "商品名称", - "num": "商品数量", - "orderCloseTips": "关闭订单后该订单将无法支付,是否确认关闭?", - "orderFinishTips": "是否确认用户已经收货?", - "orderGoodsPlaceholder": "请选择要发货的商品", - "deliveryStatusName": "发货状态", - "fromType": "订单来源", - "payType": "支付类型", - "orderInfo": "订单信息", - "refundStatusName": "退款状态", - "outTradeNo": "交易流水号", - "exportOrderType": "导出订单类型", - "shopOrder": "订单数据表", - "shopOrderGoods": "订单商品表", - "point": "积分" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.goods_rank.config.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.goods_rank.config.json deleted file mode 100644 index 8cd1fffb9..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.goods_rank.config.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "rankName": "榜单标题", - "rankImages": "榜单图片", - "rankRemark": "榜单说明", - "save": "保存", - "imagePlaceholder": "请上传榜单图片", - "rankNamePlaceholder": "请输入榜单名称", - "rankRemarkPlaceholder": "请输入榜单说明", - "useDefaultRankRemark": "使用默认说明", - "noColor": "常规颜色", - "selectedColor": "选中文字颜色", - "selectedBgColor": "选中背景颜色" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.goods_rank.edit.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.goods_rank.edit.json deleted file mode 100644 index a920fbd11..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.goods_rank.edit.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "addRanking": "添加榜单", - "updateRanking": "修改榜单", - "rankName": "榜单名称", - "rankBanner": "榜单banner", - "imagePlaceholder": "请上传图片", - "rankNamePlaceholder": "请输入榜单名称", - "rankType": "排行周期", - "rankTypePlaceholder": "请选择榜单周期", - "batchDeletion": "批量删除", - "goodsSource": "商品来源", - "goodsSourcePlaceholder": "请选择商品来源", - "addCategory": "添加分类", - "categoryTips": "商品分类不能为空", - "brand": "商品品牌", - "brandPlaceholder": "请选择商品品牌", - "brandTips": "商品品牌不能为空", - "addBrand": "添加品牌", - "label": "商品标签", - "labelTips": "商品标签不能为空", - "addLabel": "添加商品标签", - "sort": "排序", - "sortPlaceholder": "请输入排序号", - "ruleType": "排序规则", - "ruleTypePlaceholder": "请选择排序规则", - "selectGoods": "选择商品", - "sortTips": "排序号格式输入错误", - "goodsJsonEmpty": "商品数据不能为空", - "limitTips": "输入格式不正确", - "rankTypeTips": "天:1天,周:7天,月:30天,季度:90天", - "sortRules": "从大到小排列,支持手动修改排序号调整排名,以满足特定需求展示效果", - "isShow": "状态" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.goods_rank.list.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.goods_rank.list.json deleted file mode 100644 index 21b99f078..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.goods_rank.list.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "addRanking": "添加榜单", - "rankName": "榜单名称", - "rankType": "排行周期", - "rankNamePlaceholder": "请输入榜单名称", - "batchDeletion": "批量删除", - "showGoodsNum": "榜单商品数量", - "goodsSource": "商品来源", - "ruleType": "排序规则", - "createTime": "创建时间", - "deleteTips": "确定删除该榜单吗?", - "batchEmptySelectedGoodsTips": "请先选择要删除的榜单", - "batchGoodsDeleteTips": "确定删除选中的榜单吗?", - "sortTips": "排序号格式输入错误", - "sortRules": "按照排序号从大到小排序", - "isShow": "状态" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.manjian.detail.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.manjian.detail.json deleted file mode 100644 index b3364c6f8..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.manjian.detail.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "baseInfo": "基础信息", - "name": "活动名称", - "title": "标题", - "status": "状态", - "paymentAmount": "支付金额", - "memberCount": "参与会员数", - "orderCount": "支付订单数", - "createTime": "创建时间", - "startTime": "活动开始时间", - "endTime": "活动结束时间", - "keywordPlaceholder": "请输入商品名称", - "keyword": "商品名称", - "goodsInfo": "商品信息", - "price": "商品价格", - "activeOrderMoney": "累计订单金额", - "activeOrderNum": "累计订单数", - "activeMemberNum": "参与会员数", - "activeSuccessNum": "支付销量", - "orderInfo": "订单编号", - "payTime": "支付时间", - "orderNo": "订单编号", - "orderMoney": "订单金额", - "buyInfo": "买家/收货人", - "payType": "支付类型", - "orderStatus": "订单状态", - "toBePaid": "待支付", - "toBeShipped": "待发货", - "shipped": "已发货", - "receivedGoods": "已收货", - "completed": "已完成", - "closed": "已关闭", - "consumptionMoney": "消费总额", - "participationNum": "参与次数", - "orderTime": "最后下单时间", - "memberInfo": "会员信息" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.manjian.edit.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.manjian.edit.json deleted file mode 100644 index e966425e8..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.manjian.edit.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "addFullDiscountBonus": "添加满减送", - "editFullDiscountBonus": "修改满减送", - "activeName": "活动名称", - "activityTime": "活动时间", - "namePlaceholder": "请输入活动名称", - "conditionType": "条件类型", - "overNyuan": "满N元", - "overNgoods": "满N件", - "ruleType": "优惠规则", - "ladder": "阶梯优惠", - "cycle": "循环优惠", - "ruleJson": "优惠设置", - "activityLevel": "活动层级", - "addActivityLevel": "添加活动层级", - "discountThreshold": "优惠门槛", - "placeholder": "请输入", - "delete": "删除", - "discountContent": "优惠内容", - "discountMoney": "订单金额优惠", - "reduce": "减价", - "discountRate": "打折", - "freeShipping": "包邮", - "freeTips": "仅参与该活动的商品包邮,非整单包邮", - "givePoint": "送积分", - "giveGrowth": "送成长值", - "giveBalance": "送余额", - "giveCoupon": "送优惠券", - "giveCouponTips": "如果优惠券数量不足、限领数量已达上限或优惠券状态不是“进行中”,都将导致赠送失败。", - "name": "优惠券名称", - "type": "优惠券类型", - "couponPrice": "优惠券面值", - "couponGiveNum": "赠券数", - "giveGoods": "送赠品", - "giveGoodsTips": "当赠品库存不足或下架时则不赠送", - "stock": "库存", - "giveNum": "赠送数量", - "joinMemberType": "活动对象", - "allMember": "所有会员参与", - "selectedMemberLevel": "指定会员等级", - "selectedMemberLabel": "指定会员标签", - "memberLevel": "会员等级", - "memberLevelPlaceholder": "请选择会员等级", - "memberLabel": "会员标签", - "memberLabelPlaceholder": "请选择会员标签", - "goodsType": "参与商品", - "allGoods": "全部商品参与", - "selectedGoods": "指定商品参与", - "selectedGoodsNot": "指定商品不参与", - "selectGoods": "选择商品", - "remark": "备注", - "rankRemarkPlaceholder": "请输入备注", - "selectActivityTime": "请选择活动时间", - "selectActivityStartTime": "请选择活动开始时间", - "selectActivityEndTime": "请选择活动结束时间", - "selectActivityTimeTips": "活动结束时间不能小于等于活动开始时间", - "addLevelLimit": "层级限制最多添加五个", - "labelTips": "请选择会员标签", - "levelTips": "请选择会员等级", - "goodsJsonEmpty": "请选择商品", - "couponPlaceholder": "请选择优惠券", - "limitPlaceholder": "请输入优惠门槛", - "discountsPlaceholder": "请输入折扣或金额", - "growthPlaceholder": "请输入赠送成长值", - "pointPlaceholder": "请输入赠送积分", - "balancePlaceholder": "请输入赠送余额", - "valueMustBeGreaterThanZero": "优惠门槛必须大于0", - "pointMustBeGreaterThanZero": "赠送积分必须大于0", - "balanceMustBeGreaterThanZero": "赠送余额必须大于0", - "growthMustBeGreaterThanZero": "赠送成长值必须大于0", - "discountMustBeGreaterThanZero": "优惠内容必须大于0", - "discountMustBeGreaterThanNine": "范围大于等于0.1且小于等于9.9", - "limitTips": "输入格式不正确", - "limitTipsTwo": "每个层级的门槛金额不能相同", - "addSuccess": "添加成功", - "updateSuccess": "编辑成功", - "addFail": "添加失败", - "updateFail": "编辑失败", - "goodOnlyOne": "同一商品在一个时间段内只能参加一个满减送活动", - "discountLimit": "优惠金额不能大于优惠门槛", - "giveNumPlaceholder": "请输入赠送数量", - "giveNumMustBeGreaterThanZero": "赠送数量必须大于0", - "giveNumMustBeGreaterThanStock": "赠送数量不能大于库存", - "limitTipsThree": "必须大于上一层级的优惠门槛", - "ruleTypeTips": "阶梯优惠根据设定的门槛逐级增加优惠,达到特定层级门槛即可享受对应优惠,最高可设5个层级。", - "ruleTypeTipsTwo": "循环优惠指每次达到门槛即获赠一次优惠,无次数上限,需合理设置门槛。", - "goodsOffTips": "该商品已下架" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.manjian.list.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.manjian.list.json deleted file mode 100644 index b880d3ee0..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.manjian.list.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "addFullDiscountBonus": "添加满减送", - "name": "活动名称", - "detailTitle": "满减送活动详情", - "activeDetail": "活动详情", - "namePlaceholder": "请输入活动名称", - "title": "标题", - "status": "状态", - "statusPlaceholder": "请选择状态", - "activityTime": "活动时间", - "detail": "详情", - "close": "关闭", - "closeTips": "活动正在进行中,是否确认关闭当前活动?", - "deleteTips": "是否确认删除当前活动", - "createTime": "创建时间", - "startTime": "活动开始时间", - "endTime": "活动结束时间", - "keywordPlaceholder": "请输入商品名称", - "keyword": "商品名称", - "price": "商品价格", - "activeOrderMoney": "累计订单金额", - "activeOrderNum": "支付订单数", - "activeMemberNum": "参与会员数", - "paymentAmount": "支付金额", - "memberCount": "会员数", - "orderCount": "订单数", - "activeSuccessNum": "支付销量", - "activeName": "活动名称", - "participationMemberCount": "参与会员数", - "startDate": "开始时间", - "endDate": "结束时间", - "all": "全部", - "orderTime": "最后下单时间", - "consumptionMoney": "消费总额", - "memberInfo": "会员信息", - "participationNum": "参与次数", - "goodsInfo": "商品信息", - "discountThreshold": "优惠门槛", - "giveGoods": "送赠品", - "givePoint": "送积分", - "giveBalance": "送余额", - "giveGrowth": "送成长值", - "giveCoupon": "送优惠券", - "discountMoney": "订单优惠", - "freeShipping": "包邮", - "basicInfo": "基本信息", - "totalPoint": "累计赠送积分", - "totalBalance": "累计赠送余额", - "totalCouponNum": "累计赠送优惠券", - "totalGoodsNum": "累计赠送商品数", - "activeMember": "活动会员", - "batchDelete": "批量删除", - "batchClose": "批量关闭", - "batchEmptySelectedActiveDeleteTips": "请先选择要删除的活动", - "batchEmptySelectedActiveCloseTips": "请先选择要关闭的活动", - "batchGoodsDeleteTips": "确定删除选中的活动吗?", - "batchGoodsCloseTips": "确定关闭选中的活动吗?" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.newcomer.config.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.newcomer.config.json deleted file mode 100644 index 93428e69c..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.newcomer.config.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "basicInfoTab": "基础设置", - "bannerList": "顶部广告图", - "activeStatus": "是否启用", - "validityType": "有效期", - "validityDay": "天数", - "validityDayPlaceholder": "请输入有效天数", - "validityDayTips": "有效天数不可小于等于0", - "validityDayTipsLeft": "达成门槛立即生效,", - "validityDayTipsRight": "天有效期", - "validityTime": "固定时间", - "validityTimePlaceholder": "请选择有效期截止时间", - "validityTimePlaceholderTwo": "请先选择参与门槛时间", - "validityTimePlaceholderThree": "有效期截止时间不可小于参与门槛时间", - "validityTimeTips": "达成门槛立即生效,有效期截止为", - "validityTimeTipsTwo": "修改有效期将同步更新所有未参与活动用户的结束时间", - "participationWay": "参与门槛", - "neverOrder": "从未下过单的会员", - "assignTimeOrder": "指定时间内未下过单的会员", - "assignTimeRegister": "指定时间内注册的会员", - "appointTimePlaceholder": "请选择指定时间", - "activityGoods": "活动商品", - "selectGoods": "选择商品", - "goodsSkuIdsPlaceholder": "请选择商品", - "limitNum": "限购数量", - "limitNumPlaceholder": "请输入限购数量", - "limitNumTips": "限购数量不可小于等于0", - "limitNumTipsThree": "限购数量不可超过已选商品数量", - "oldPrice": "原价", - "newcomerPrice": "新人价", - "newcomerPricePlaceholder": "请输入新人价", - "newcomerPriceTips": "[新人价]格式错误", - "newcomerPriceTipsOne": "新人价不可小于0", - "newcomerPriceTipsTwo": "新人价不可大于原价", - "batchOperation": "批量操作", - "batchEmptySelectedGoodsTips": "请选择要操作的商品", - "activeDesc": "规则说明", - "activeDescPlaceholder": "请输入规则说明", - "useDefaultActiveDesc": "使用默认说明", - "image": "图片上传", - "imagePlaceholder": "请上传图片", - "toLink": "跳转链接", - "toLinkPlaceholder": "请输入跳转链接", - "addConfigList": "添加广告图" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/marketing.newcomer.order_list.json b/niucloud/addon/shop/admin/lang/zh-cn/marketing.newcomer.order_list.json deleted file mode 100644 index 69e70e816..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/marketing.newcomer.order_list.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "orderNo": "订单编号", - "orderNoPlaceholder": "请输入订单编号", - "orderStatus": "订单状态", - "orderStatusPlaceholder": "请选择订单状态", - "orderFrom": "订单类型", - "orderFromPlaceholder": "请选择订单类型", - "payTime": "支付时间", - "orderGoods": "商品", - "goodsPriceNumber": "单价(元)/数量", - "goodsPriceNumberTips": "新人价商品购买数量为1时,单价显示新人价,购买数量大于1时,单价显示原价或折扣价或会员价", - "orderMoney": "实付金额(元)", - "startDate": "开始时间", - "endDate": "结束时间", - "piece": "件", - "createTime": "创建时间", - "activeRefund": "主动退款", - "notes": "备注", - "offlinePayment": "线下支付", - "orderClose": "关闭订单", - "editPrice": "修改价格", - "editAddress": "修改地址", - "sendOutGoods": "发货", - "confirmTakeDelivery": "确认收货", - "all": "全部", - "toBeShipped": "待发货", - "shipped": "已发货", - "receivedGoods": "已收货", - "completed": "已完成", - "closed": "已关闭", - "refunding": "退款中", - "notesDetail": "备注信息", - "delivery": "订单发货", - "company": "物流公司", - "companyPlaceholder": "请选择物流公司", - "expressNumber": "物流单号", - "expressNumberPlaceholder": "请输入物流单号", - "orderGoodsIdsPlaceholder": "请选择订单项", - "virtualDelivery": "虚拟发货", - "goodsName": "商品名称", - "num": "商品数量", - "orderCloseTips": "关闭订单后该订单将无法支付,是否确认关闭?", - "orderFinishTips": "是否确认用户已经收货?", - "orderGoodsPlaceholder": "请选择要发货的商品", - "deliveryStatusName": "发货状态", - "fromType": "订单来源", - "payType": "支付类型", - "orderInfo": "订单信息", - "refundStatusName": "退款状态", - "outTradeNo": "交易流水号", - "exportOrderType": "导出订单类型", - "shopOrder": "订单数据表", - "shopOrderGoods": "订单商品表", - "point": "积分" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/order.batch_delivery.json b/niucloud/addon/shop/admin/lang/zh-cn/order.batch_delivery.json deleted file mode 100644 index 8e063a3c2..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/order.batch_delivery.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "failuresNum": "发货失败单数", - "succeedNum": "发货成功单数", - "totalNum": "总发货单数", - "operationTime": "操作时间", - "operationType": "操作类型", - "state": "状态", - "operator": "操作人", - "importData": "批量发货", - "templateType": "模板类型", - "fullOrderDelivery": "整单发货模板", - "openOrderDelivery": "拆单发货模板", - "uploadFile": "上传文件", - "createTime": "时间", - "uploadFilePlaceholder": "请上传文件", - "operatorPlaceholder": "请选择操作人", - "causeFailure": "下载失败记录", - "downloadRecord": "下载记录", - "orderTemplate": "下载整单发货模板.xls", - "orderGoodsTemplate": "下载拆单发货模板.xls", - "checkCause": "查看失败原因", - "startTime": "开始时间", - "endTime": "结束时间", - "checkCause1": "失败原因" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/order.config.json b/niucloud/addon/shop/admin/lang/zh-cn/order.config.json deleted file mode 100644 index a6cf28909..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/order.config.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "closeOrderInfo": "自动取消订单", - "closeOrderInfoLeft": "提交订单", - "closeOrderInfoRight": "分钟未付款,自动取消订单", - "closeOrderInfoBottom": "订单取消时间必须在10-1440分钟之间", - "CloseLengthPlaceholder": "请输入订单取消时间", - "isClose": "自动取消订单", - "confirm": "自动确认收货", - "confirmLeft": "发货后", - "confirmRight": "天,自动确认收货", - "confirmBottom": "自动确认收货时间必须在1-30天之间", - "finishLengthPlaceholder": "请输入自动确认收货时间", - "isFinish": "自动确认收货", - "refund": "确认收货后售后", - "refundLeft": "确认收货", - "refundRight": "天内,可申请售后", - "refundBottom": "确认收货后售后时间必须在1-30天之间", - "noAllowRefund": "确认收货后不支持售后", - "validRefundLengthPlaceholder": "请输入确认收货后售后时间", - "invoice": "发票设置", - "isInvoice": "发票开关", - "isInvoiceClose": "关闭", - "isInvoiceOpen": "开启", - "invoiceContent": "发票内容", - "insert": "添加", - "paperInvoice": "纸质发票", - "electronicInvoice": "电子发票", - "invoicePlaceholder": "所有发票内容不能为空", - "invoiceType": "发票类型", - "invoiceTypePlaceholder": "请至少选择一个发票类型", - "evaluate": "评价设置", - "isEvaluate": "评价开关", - "evaluateIsToExamine": "评价审核", - "evaluateIsShow": "评价显示", - "isEvaluateOpen": "开启", - "isEvaluateClose": "关闭", - "diyForm": "万能表单", - "diyFormPlaceholder": "请选择万能表单", - "addDiyForm": "添加表单" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/order.detail.json b/niucloud/addon/shop/admin/lang/zh-cn/order.detail.json deleted file mode 100644 index 2f423f02f..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/order.detail.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "orderNo": "订单编号", - "orderInfo": "订单信息", - "outTradeNo": "交易流水号", - "orderType": "订单类型", - "orderForm": "订单来源", - "takerName": "收货人", - "takerMobile": "收货人手机号", - "takerFullAddress": "收货地址", - "goodsDetail": "商品信息", - "goodsName": "商品名称", - "price": "价格", - "num": "数量", - "goodsMoney": "商品总额", - "preferentialMoney": "优惠金额", - "deliveryMoney": "配送金额", - "operateLog": "订单日志", - "orderNoPlaceholder": "请输入订单编号", - "orderStatus": "订单状态", - "orderStatusPlaceholder": "请选择订单状态", - "orderFrom": "订单类型", - "orderFromPlaceholder": "请选择订单类型", - "payTime": "支付时间", - "orderGoods": "商品", - "goodsPriceNumber": "单价(元)/数量", - "orderMoney": "订单金额", - "buyInfo": "买家/收货人", - "deliveryType": "配送方式", - "startDate": "开始时间", - "endDate": "结束时间", - "piece": "件", - "payType": "支付方式", - "notes": "备注", - "editAddress": "修改地址", - "remind": "提醒", - "remindTips1": "买家付款成功后,货款将直接进入您的商户号(微信、支付宝)", - "remindTips2": "请及时关注你发出的包裹状态,确保可以配送至买家手中", - "remindTips3": "如果买家表示没收到货或货物有问题,请及时联系买家处理,友好协商", - "close": "关闭订单", - "finish": "确认收货", - "delivery": "订单发货", - "deliveryTypePlaceholder": "请选择配送方式", - "company": "物流公司", - "companyPlaceholder": "请选择物流公司", - "expressNumber": "物流单号", - "expressNumberPlaceholder": "请输入物流单号", - "orderGoodsIdsPlaceholder": "请选择订单项", - "virtualDelivery": "虚拟发货", - "orderCloseTips": "关闭订单后该订单将无法支付,是否确认关闭?", - "orderFinishTips": "是否确认用户已经收货?", - "orderGoodsPlaceholder": "请选择要发货的商品", - "memberRemark": "买家留言", - "discountMoney": "总优惠金额", - "couponMoney": "优惠券优惠金额", - "manjianDiscountMoney": "满减优惠金额", - "orderDelivery": "物流信息", - "devliveryTime": "发货时间", - "companyName": "物流公司", - "logisticNo": "物流单号", - "packageInfo": "物流包裹信息", - "deliveryInfo": "发货信息", - "goodsInfo": "商品信息", - "logisticInfo": "物流信息", - "storeName": "自提点名称", - "storeAddress": "自提点地址", - "storeMobile": "自提点电话", - "tradeTime": "营业时间", - "deliveryStatusName": "发货状态", - "package": "包裹", - "noLogisticsRequired": "无需物流", - "notLogistics": "暂无物流信息", - "refundStatusName": "退款状态", - "orderInfoEmpty": "暂无数据", - "editPrice": "修改价格", - "adjustMoneyDialogTitle": "调整价格", - "adjustMoneyUnit": "元", - "adjustMoneyTips": "注意 : 只有订单未付款时才支持改价,改价后请联系买家刷新订单核实订单金额后再支付。当订单总额为0元时,订单将自动支付", - "adjustMoneyDeliveryMoney": "运费", - "adjustMoneyGoodsInfo": "商品信息", - "adjustMoneyPrice": "单价", - "adjustMoneyNum": "数量", - "adjustMoneySubTotal": "小计", - "adjustMoneyDiscountMoney": "优惠金额", - "adjustMoneyLabel": "调整金额", - "adjustMoneyTotal": "总计", - "point": "积分", - "electronicSheetPrintTitle": "打印电子面单", - "electronicSheetTemplate": "面单模板", - "electronicSheetTemplatePlaceholder": "请选择面单模板", - "electronicSheetPrintResult": "打印结果", - "deliveryPackageNo": "包裹编号", - "printStatus": "状态", - "printResultCode": "状态码", - "printRemark": "备注", - "electronicSheetPrintOperation": "打印面单", - "printTicket": "打印小票", - "deliveryWay": "发货方式", - "manualWriteWay": "手动填写", - "electronicSheetWay": "电子面单", - "contacts": "联系人", - "contactsPlaceholder": "请输入联系人", - "ContactInformation": "联系方式", - "ContactInformationPlaceholder": "请输入联系方式", - "selfPickupStores": "自提门店", - "address": "地址", - "province": "请选择省", - "city": "请选择市", - "area": "请选择区/县", - "detailedAddress": "请输入详细地址", - "refundTitle": "商家主动退款", - "refundMoney": "退款金额", - "voluntaryRefund": "主动退款", - "refundState": "完成状态", - "refundType": "退款方式", - "refundInstructions": "退款说明", - "refundInstructionsOne": "1、如果是退部分金额,退款后可以是部分退款状态或退款完成状态", - "refundInstructionsTwo": "2、如果是退全部金额,则退款后一定是退款完成状态", - "refundInstructionsThree": "3、退款完成才会执行相关业务如核销码失效,卡包失效等操作", - "storeDeliveryWay": "商家配送", - "thirdPartyDeliveryWay": "第三方配送", - "deliverName": "配送员", - "deliverNamePlaceholder": "请选择配送员", - "deliverMobile": "配送员手机号", - "deliverMobilePlaceholder": "请输入配送员手机号", - "thirdDeliveryName": "配送平台", - "thirdDeliveryNamePlaceholder": "请选择配送平台", - "goodsWeight": "商品重量", - "goodsWeightPlaceholder": "请输入商品重量", - "weightTips": "[商品重量(kg)]格式输入错误", - "weightNotZeroTips": "商品重量(kg)必须大于0", - "deliveryAddress": "发货地址", - "deliveryPlatform": "配送平台", - "deliveryStatus": "配送状态", - "modifyDelivery": "修改发货信息", - "backRefund": "原路退款", - "offlineRefund": "线下退款", - "refundToBalance": "退款到余额", - "partialRefund": "部分退款状态", - "refundFinish": "退款完成状态", - "shopActiveRefundMoneyPlaceholder": "主动退款金额不能为空或为零", - "shopActiveRefundMoneyTwoPlaceholder": "主动退款金额不能大于可退款总额", - "refundGoodsItem": "商品项", - "refundGoodsInfo": "商品信息", - "refundGoodsSku": "规格", - "refundGoodsPrice": "售价", - "refundPayPrice": "实付金额", - "refundGoodsNum": "数量", - "refundGoodsPlaceholder": "请选择退款的商品", - "formDetail": "表单详情", - "buyerAskDeliveryTime": "要求自提时间", - "verifyCode": "核销码", - "buyers": "买家", - "buyersReserveMobile": "预留手机", - "storeTakerName": "提货人", - "verifierMember": "核销人", - "buyerAskDeliveryTime2":"预约配送时间", - "deliveryTransporterMobile": "配送员手机号", - "deliveryTransporterName": "配送员", - "deliveryTransporterStatus":"配送状态", - "deliveryTransporterInfo":"配送信息" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/order.invoice.json b/niucloud/addon/shop/admin/lang/zh-cn/order.invoice.json deleted file mode 100644 index 42c363db7..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/order.invoice.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "isInvoice": "是否开票", - "isInvoicePlaceholder": "请输入开票类型", - "startDate": "开始时间", - "endDate": "结束时间", - "headType": "抬头类型", - "headerTypeName": "抬头类型", - "person": "个人", - "firm": "企业", - "headTypePlaceholder": "请输入抬头类型", - "headerName": "发票抬头", - "headerNamePlaceholder": "请输入发票抬头", - "name": "发票内容", - "tradeType": "发票类型", - "typeName": "发票名称", - "headTypeName": "抬头类型", - "taxNumber": "纳税人识别号", - "mobile": "手机号", - "email": "邮件", - "telephone": "电话号", - "address": "地址", - "bankTame": "开户银行", - "bankCardNumber": "开户行账号", - "money": "开票金额", - "invoiceNumber": "发票号码", - "invoiceVoucher": "发票凭证", - "remark": "备注", - "createTime": "创建时间", - "invoiceTime": "开票时间", - "status": "状态", - "operation": "操作", - "detail": "详情", - "hasInvoice": "已开票", - "noInvoice": "未开票", - "all": "全部", - "invoice": "开票", - "viewOrder": "查看订单", - "invoiceNumberPlaceholder": "请输入发票号码", - "invoiceVoucherPlaceholder": "请输入发票凭证" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/order.list.json b/niucloud/addon/shop/admin/lang/zh-cn/order.list.json deleted file mode 100644 index a20f8181d..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/order.list.json +++ /dev/null @@ -1,181 +0,0 @@ -{ - "orderNo": "订单编号", - "createTime": "下单时间", - "orderNoPlaceholder": "请输入订单编号", - "memberInfo": "会员信息", - "memberInfoPlaceholder": "请输入会员编号/昵称/账号/手机号搜索", - "orderStatus": "订单状态", - "orderStatusPlaceholder": "请选择订单状态", - "orderFrom": "订单类型", - "orderFromPlaceholder": "请选择订单类型", - "payTime": "支付时间", - "orderGoods": "商品", - "goodsPriceNumber": "单价(元)/数量", - "orderMoney": "实付金额(元)", - "point": "积分", - "buyInfo": "买家/收货人", - "deliveryType": "配送方式", - "startDate": "开始时间", - "endDate": "结束时间", - "piece": "件", - "rightsProtection": "售后", - "activeRefund": "主动退款", - "notes": "备注", - "offlinePayment": "线下支付", - "orderClose": "关闭订单", - "editPrice": "修改价格", - "editAddress": "修改地址", - "sendOutGoods": "发货", - "confirmTakeDelivery": "确认收货", - "all": "全部", - "toBePaid": "待支付", - "toBeShipped": "待发货", - "shipped": "已发货", - "receivedGoods": "已收货", - "completed": "已完成", - "closed": "已关闭", - "refunding": "退款中", - "notesDetail": "备注信息", - "deliveryTypePlaceholder": "请选择配送方式", - "company": "物流公司", - "companyPlaceholder": "请选择物流公司", - "expressNumber": "物流单号", - "expressNumberPlaceholder": "请输入物流单号", - "orderGoodsIdsPlaceholder": "请选择订单项", - "virtualDelivery": "虚拟发货", - "goodsName": "商品名称", - "num": "商品数量", - "orderCloseTips": "关闭订单后该订单将无法支付,是否确认关闭?", - "orderFinishTips": "是否确认用户已经收货?", - "orderGoodsPlaceholder": "请选择要发货的商品", - "deliveryStatusName": "发货状态", - "fromType": "订单来源", - "payType": "支付类型", - "orderInfo": "订单信息", - "refundStatusName": "退款状态", - "outTradeNo": "交易流水号", - "exportOrderType": "导出订单类型", - "shopOrder": "订单数据表", - "shopOrderGoods": "订单商品表", - "adjustMoneyDialogTitle": "调整价格", - "adjustMoneyUnit": "元", - "adjustMoneyTips": "注意 : 只有订单未付款时才支持改价,改价后请联系买家刷新订单核实订单金额后再支付。当订单总额为0元时,订单将自动支付", - "adjustMoneyDeliveryMoney": "运费", - "adjustMoneyGoodsInfo": "商品信息", - "adjustMoneyPrice": "单价", - "adjustMoneyNum": "数量", - "adjustMoneySubTotal": "小计", - "adjustMoneyDiscountMoney": "优惠金额", - "adjustMoneyLabel": "调整金额", - "adjustMoneyTotal": "总计", - "contacts": "联系人", - "contactsPlaceholder": "请输入联系人", - "ContactInformation": "联系方式", - "ContactInformationPlaceholder": "请输入联系方式", - "address": "地址", - "province": "请选择省", - "city": "请选择市", - "area": "请选择区/县", - "detailedAddress": "请输入详细地址", - "selfPickupStores": "自提门店", - "electronicSheetPrintTitle": "打印电子面单", - "electronicSheetTemplate": "面单模板", - "electronicSheetTemplatePlaceholder": "请选择面单模板", - "electronicSheetPrintResult": "打印结果", - "deliveryPackageNo": "包裹编号", - "batchPrintElectronicSheet": "批量打印电子面单", - "batchEmptySelectedOrderTips": "请选择要操作的订单", - "notSupportPrintElectronicSheetTips": "当前选择的订单不支持打印电子面单", - "printStatus": "状态", - "printResultCode": "状态码", - "printRemark": "备注", - "electronicSheetPrintOperation": "打印面单", - "printTicket": "打印小票", - "deliveryWay": "发货方式", - "manualWriteWay": "手动填写", - "electronicSheetWay": "电子面单", - "refundTitle": "商家主动退款", - "refundMoney": "退款金额", - "voluntaryRefund": "主动退款", - "refundState": "完成状态", - "refundType": "退款方式", - "refundInstructions": "退款说明", - "refundInstructionsOne": "1、如果是退部分金额,退款后可以是部分退款状态或退款完成状态", - "refundInstructionsTwo": "2、如果是退全部金额,则退款后一定是退款完成状态", - "refundInstructionsThree": "3、退款完成才会执行相关业务如核销码失效,卡包失效等操作", - "backRefund": "原路退款", - "offlineRefund": "线下退款", - "refundToBalance": "退款到余额", - "partialRefund": "部分退款状态", - "refundFinish": "退款完成状态", - "shopActiveRefundMoneyPlaceholder": "主动退款金额不能为空或为零", - "shopActiveRefundMoneyTwoPlaceholder": "主动退款金额不能大于可退款总额", - "refundGoodsItem": "商品项", - "refundGoodsInfo": "商品信息", - "refundGoodsSku": "规格", - "refundGoodsPrice": "售价", - "refundPayPrice": "实付金额", - "refundGoodsNum": "数量", - "refundGoodsPlaceholder": "请选择退款的商品", - "orderType": "订单类型", - "orderForm": "订单来源", - "takerName": "收货人", - "takerMobile": "收货人手机号", - "takerFullAddress": "收货地址", - "goodsDetail": "商品信息", - "price": "价格", - "detailNum": "数量", - "goodsMoney": "商品总额", - "preferentialMoney": "优惠金额", - "deliveryMoney": "配送金额", - "operateLog": "订单日志", - "detailOrderMoney": "订单金额", - "payWay": "支付方式", - "remind": "提醒", - "remindTips1": "买家付款成功后,货款将直接进入您的商户号(微信、支付宝)", - "remindTips2": "请及时关注你发出的包裹状态,确保可以配送至买家手中", - "remindTips3": "如果买家表示没收到货或货物有问题,请及时联系买家处理,友好协商", - "close": "关闭订单", - "finish": "确认收货", - "delivery": "订单发货", - "memberRemark": "买家留言", - "discountMoney": "总优惠金额", - "couponMoney": "优惠券优惠金额", - "manjianDiscountMoney": "满减优惠金额", - "orderDelivery": "物流信息", - "devliveryTime": "发货时间", - "companyName": "物流公司", - "logisticNo": "物流单号", - "packageInfo": "物流包裹信息", - "deliveryInfo": "发货信息", - "goodsInfo": "商品信息", - "logisticInfo": "物流信息", - "storeName": "自提点名称", - "storeAddress": "自提点地址", - "storeMobile": "自提点电话", - "tradeTime": "营业时间", - "package": "包裹", - "noLogisticsRequired": "无需物流", - "notLogistics": "暂无物流信息", - "orderInfoEmpty": "暂无数据", - "buyerAskDeliveryTime": "要求自提时间", - "deleteTips": "是否确认删除该订单?", - "batchDeleteTips": "是否确认批量删除选中的订单?", - "storeDeliveryWay": "商家配送", - "thirdPartyDeliveryWay": "第三方配送", - "deliverName": "配送员", - "deliverNamePlaceholder": "请选择配送员", - "deliverMobile": "配送员手机号", - "deliverMobilePlaceholder": "请输入配送员手机号", - "thirdDeliveryName": "配送平台", - "thirdDeliveryNamePlaceholder": "请选择配送平台", - "goodsWeight": "商品重量", - "goodsWeightPlaceholder": "请输入商品重量", - "weightTips": "[商品重量(kg)]格式输入错误", - "weightNotZeroTips": "商品重量(kg)必须大于0", - "deliveryStore": "提货点", - "deliveryStorePlaceholder": "请选择提货点", - "deliveryPlatform": "配送平台", - "deliveryStatus": "配送状态", - "goActive":"去开通" -} diff --git a/niucloud/addon/shop/admin/lang/zh-cn/order.refund.json b/niucloud/addon/shop/admin/lang/zh-cn/order.refund.json deleted file mode 100644 index 5edc46c7c..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/order.refund.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "goodsName": "商品名称", - "orderNo": "订单编号", - "orderRefundNo": "退款编号", - "refundTime": "退款时间", - "startDate": "开始时间", - "endDate": "结束时间", - "goodsNamePlaceholder": "请输入商品名称", - "orderNoPlaceholder": "请输入订单编号", - "orderRefundNoPlaceholder": "请输入退款编号", - "goodsInfo": "商品信息", - "orderMoney": "订单金额", - "realityMoney": "实付金额", - "goodsMoney": "商品金额", - "buyMember": "买家", - "refundMoney": "退款金额", - "createTime": "申请时间", - "refundStatus": "退款状态", - "all": "全部", - "refundType": "退款方式", - "applyForRefund": "申请退款", - "refundEnd": "售后结束", - "toBeReturned": "买家待退货", - "receivedGoods": "卖家待收货", - "refundRefuse": "卖家拒绝", - "orderInfo": "订单信息", - "outTradeNo": "交易流水号", - "orderType": "订单类型", - "orderForm": "订单来源", - "takerName": "收货人", - "takerMobile": "收货人手机号", - "takerFullAddress": "收货地址", - "goodsDetail": "商品信息", - "price": "价格", - "num": "数量", - "preferentialMoney": "优惠金额", - "deliveryMoney": "配送金额", - "operateLog": "订单日志", - "orderStatus": "订单状态", - "orderStatusPlaceholder": "请选择订单状态", - "orderFrom": "订单类型", - "orderFromPlaceholder": "请选择订单类型", - "payTime": "支付时间", - "orderGoods": "商品", - "goodsPriceNumber": "单价(元)/数量", - "detailOrderMoney": "实付金额(元)", - "buyInfo": "买家/收货人", - "deliveryType": "配送方式", - "piece": "件", - "payType": "支付方式", - "notes": "备注", - "editAddress": "修改地址", - "remind": "提醒", - "remindTips1": "如果未发货,请点击同意退款给买家。", - "remindTips2": "如果实际已发货,请主动与买家联系。", - "remindTips3": "如果订单整体退款后,优惠券和余额会退还给买家。", - "close": "关闭订单", - "finish": "确认收货", - "delivery": "订单发货", - "deliveryTypePlaceholder": "请选择配送方式", - "company": "物流公司", - "companyPlaceholder": "请选择物流公司", - "expressNumber": "物流单号", - "expressNumberPlaceholder": "请输入物流单号", - "orderGoodsIdsPlaceholder": "请选择订单项", - "virtualDelivery": "虚拟发货", - "orderCloseTips": "关闭订单后该订单将无法支付,是否确认关闭?", - "orderFinishTips": "是否确认用户已经收货?", - "orderGoodsPlaceholder": "请选择要发货的商品", - "memberRemark": "买家留言", - "discountMoney": "订单详情", - "orderDelivery": "物流信息", - "devliveryTime": "发货时间", - "companyName": "物流公司", - "logisticNo": "物流单号", - "packageInfo": "物流包裹信息", - "deliveryInfo": "发货信息", - "logisticInfo": "物流信息", - "storeName": "自提点名称", - "storeAddress": "自提点地址", - "storeMobile": "自提点电话", - "tradeTime": "营业时间", - "deliveryStatusName": "发货状态", - "refundReason": "退款原因", - "afterSales": "售后信息", - "orderRefundRefuse": "退款拒绝", - "orderRefundAgree": "同意退款", - "agree": "同意", - "applyMoney": "申请金额", - "refuse": "拒绝", - "transferAccounts": "转账", - "refuseReason": "拒绝原因", - "shopReasonPlaceholder": "请输入拒绝原因", - "confirmDelivery": "确认收货", - "orderDeliveryTips": "确定商品收到了吗?", - "agreeRefundDelivery": "同意买家收货", - "refundDeliveryAddress": "退货地址", - "refundVoucher": "申请凭证", - "refundRemark": "退款描述", - "agreeMoney": "退款金额", - "moneyPlaceholder": "请输入退款金额", - "refundAddressPlaceholder": "请输入退货地址", - "expressCompany": "物流公司", - "expressRemark": "物流说明", - "orderInfoEmpty": "暂无数据", - "closeRefund": "关闭售后", - "closeRefundTips": "建议先与用户沟通协商,确认后再关闭售后流程。请谨慎操作,确定要关闭售后吗?" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/order.refund_detail.json b/niucloud/addon/shop/admin/lang/zh-cn/order.refund_detail.json deleted file mode 100644 index cd5792721..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/order.refund_detail.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "orderNo": "订单编号", - "orderInfo": "订单信息", - "outTradeNo": "交易流水号", - "orderType": "订单类型", - "orderForm": "订单来源", - "takerName": "收货人", - "takerMobile": "收货人手机号", - "takerFullAddress": "收货地址", - "goodsDetail": "商品信息", - "goodsName": "商品名称", - "price": "价格", - "num": "数量", - "goodsMoney": "商品总额", - "preferentialMoney": "优惠金额", - "deliveryMoney": "配送金额", - "operateLog": "订单日志", - "orderNoPlaceholder": "请输入订单编号", - "orderStatus": "订单状态", - "orderStatusPlaceholder": "请选择订单状态", - "orderFrom": "订单类型", - "orderFromPlaceholder": "请选择订单类型", - "payTime": "支付时间", - "orderGoods": "商品", - "goodsPriceNumber": "单价(元)/数量", - "orderMoney": "实付金额(元)", - "buyInfo": "买家/收货人", - "deliveryType": "配送方式", - "startDate": "开始时间", - "endDate": "结束时间", - "piece": "件", - "payType": "支付方式", - "notes": "备注", - "editAddress": "修改地址", - "remind": "提醒", - "remindTips1": "如果未发货,请点击同意退款给买家。", - "remindTips2": "如果实际已发货,请主动与买家联系。", - "remindTips3": "如果订单整体退款后,优惠券和余额会退还给买家。", - "close": "关闭订单", - "finish": "确认收货", - "delivery": "订单发货", - "deliveryTypePlaceholder": "请选择配送方式", - "company": "物流公司", - "companyPlaceholder": "请选择物流公司", - "expressNumber": "物流单号", - "expressNumberPlaceholder": "请输入物流单号", - "orderGoodsIdsPlaceholder": "请选择订单项", - "virtualDelivery": "虚拟发货", - "orderCloseTips": "关闭订单后该订单将无法支付,是否确认关闭?", - "orderFinishTips": "是否确认用户已经收货?", - "orderGoodsPlaceholder": "请选择要发货的商品", - "memberRemark": "买家留言", - "discountMoney": "订单详情", - "orderDelivery": "物流信息", - "devliveryTime": "发货时间", - "companyName": "物流公司", - "logisticNo": "物流单号", - "packageInfo": "物流包裹信息", - "deliveryInfo": "发货信息", - "goodsInfo": "商品信息", - "logisticInfo": "物流信息", - "storeName": "自提点名称", - "storeAddress": "自提点地址", - "storeMobile": "自提点电话", - "tradeTime": "营业时间", - "deliveryStatusName": "发货状态", - "orderRefundNo": "退款编号", - "createTime": "申请时间", - "refundMoney": "退款金额", - "refundReason": "退款原因", - "afterSales": "售后信息", - "refundStatus": "退款状态", - "orderRefundRefuse": "退款拒绝", - "orderRefundAgree": "同意退款", - "agree": "同意", - "applyMoney": "申请金额", - "refuse": "拒绝", - "transferAccounts": "转账", - "refuseReason": "拒绝原因", - "shopReasonPlaceholder": "请输入拒绝原因", - "confirmDelivery": "确认收货", - "orderDeliveryTips": "确定商品收到了吗?", - "agreeRefundDelivery": "同意买家收货", - "refundDeliveryAddress": "退货地址", - "refundVoucher": "申请凭证", - "refundRemark": "退款描述", - "agreeMoney": "退款金额", - "refundType": "退款方式", - "moneyPlaceholder": "请输入退款金额", - "refundAddressPlaceholder": "请输入退货地址", - "expressCompany": "物流公司", - "expressRemark": "物流说明", - "orderInfoEmpty": "暂无数据" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/lang/zh-cn/stat.goods.json b/niucloud/addon/shop/admin/lang/zh-cn/stat.goods.json deleted file mode 100644 index b89f14d16..000000000 --- a/niucloud/addon/shop/admin/lang/zh-cn/stat.goods.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "goodsOverview": "商品概况", - "timeFilter": "时间筛选", - "startTime": "开始时间", - "endTime": "结束时间", - "search": "搜索", - "goodsAccessNum": "商品浏览量", - "goodsAccessNumTip": "统计时间内,所有商品详情页被访问的次数,一个人在统计时间内访问多次记为多次", - "goodsVisitCount": "商品访客数", - "goodsVisitCountTips": "统计时间内,访问任何商品详情页的人数,一个人在统计时间范围内访问多次只记为一个", - "cartNum": "加购件数", - "cartNumTips": "统计时间内,添加商品进入购物车的商品件数", - "saleNum": "下单件数", - "saleNumTips": "统计时间内,成功下单的商品件数之和(不剔除退款订单)", - "payNum": "支付件数", - "payNumTips": "统计时间内, 成功付款订单的商品件数之和(不剔除退款订单)", - "payMoney": "支付金额", - "payMoneyTips": "统计时间内,成功付款订单的商品金额之和(不剔除退款订单)", - "refundMoney": "退款金额", - "refundMoneyTips": "统计时间内,成功退款的商品金额之和", - "refundNum": "退款件数", - "refundNumTips": "统计时间内,成功退款的商品件数之和", - "goodsRank": "商品排行", - "goodsName": "商品名称", - "goodsNamePlaceholder": "请输入商品名称", - "goodsCategory": "商品分类", - "all": "全部", - "totalType": "统计类型", - "totalTypePlaceholder": "请选择统计类型", - "goodsInfo": "商品信息", - "accessNum": "访问次数", - "visitCount": "访客数", - "cartNumber": "加入购物车数量", - "saleNumber": "商品销量", - "payTotal": "支付总金额", - "collectNum": "收藏数量" -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/views/address/edit.vue b/niucloud/addon/shop/admin/views/address/edit.vue deleted file mode 100644 index 5327979e7..000000000 --- a/niucloud/addon/shop/admin/views/address/edit.vue +++ /dev/null @@ -1,432 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/address/list.vue b/niucloud/addon/shop/admin/views/address/list.vue deleted file mode 100644 index 2cec99c9c..000000000 --- a/niucloud/addon/shop/admin/views/address/list.vue +++ /dev/null @@ -1,157 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/company.vue b/niucloud/addon/shop/admin/views/delivery/company.vue deleted file mode 100644 index ec4fa4e2a..000000000 --- a/niucloud/addon/shop/admin/views/delivery/company.vue +++ /dev/null @@ -1,157 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/company_edit.vue b/niucloud/addon/shop/admin/views/delivery/company_edit.vue deleted file mode 100644 index 2bbd1730d..000000000 --- a/niucloud/addon/shop/admin/views/delivery/company_edit.vue +++ /dev/null @@ -1,316 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/components/delivery-personnel-edit.vue b/niucloud/addon/shop/admin/views/delivery/components/delivery-personnel-edit.vue deleted file mode 100644 index 050978958..000000000 --- a/niucloud/addon/shop/admin/views/delivery/components/delivery-personnel-edit.vue +++ /dev/null @@ -1,111 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/components/local-delivery-service-dada.vue b/niucloud/addon/shop/admin/views/delivery/components/local-delivery-service-dada.vue deleted file mode 100644 index 97f0798df..000000000 --- a/niucloud/addon/shop/admin/views/delivery/components/local-delivery-service-dada.vue +++ /dev/null @@ -1,118 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/components/local_record_detail.vue b/niucloud/addon/shop/admin/views/delivery/components/local_record_detail.vue deleted file mode 100644 index 24e0fb8a7..000000000 --- a/niucloud/addon/shop/admin/views/delivery/components/local_record_detail.vue +++ /dev/null @@ -1,141 +0,0 @@ - - - - - \ No newline at end of file diff --git a/niucloud/addon/shop/admin/views/delivery/components/shop_record_detail.vue b/niucloud/addon/shop/admin/views/delivery/components/shop_record_detail.vue deleted file mode 100644 index 719efcd82..000000000 --- a/niucloud/addon/shop/admin/views/delivery/components/shop_record_detail.vue +++ /dev/null @@ -1,139 +0,0 @@ - - - - - \ No newline at end of file diff --git a/niucloud/addon/shop/admin/views/delivery/config.vue b/niucloud/addon/shop/admin/views/delivery/config.vue deleted file mode 100644 index 15ba2e281..000000000 --- a/niucloud/addon/shop/admin/views/delivery/config.vue +++ /dev/null @@ -1,137 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/electronic_sheet.vue b/niucloud/addon/shop/admin/views/delivery/electronic_sheet.vue deleted file mode 100644 index 80f863971..000000000 --- a/niucloud/addon/shop/admin/views/delivery/electronic_sheet.vue +++ /dev/null @@ -1,198 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/electronic_sheet_config.vue b/niucloud/addon/shop/admin/views/delivery/electronic_sheet_config.vue deleted file mode 100644 index 246a0b843..000000000 --- a/niucloud/addon/shop/admin/views/delivery/electronic_sheet_config.vue +++ /dev/null @@ -1,185 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/electronic_sheet_edit.vue b/niucloud/addon/shop/admin/views/delivery/electronic_sheet_edit.vue deleted file mode 100644 index e7862d447..000000000 --- a/niucloud/addon/shop/admin/views/delivery/electronic_sheet_edit.vue +++ /dev/null @@ -1,270 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/local.vue b/niucloud/addon/shop/admin/views/delivery/local.vue deleted file mode 100644 index 1dda31125..000000000 --- a/niucloud/addon/shop/admin/views/delivery/local.vue +++ /dev/null @@ -1,456 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/local_config.vue b/niucloud/addon/shop/admin/views/delivery/local_config.vue deleted file mode 100644 index 6ffcab073..000000000 --- a/niucloud/addon/shop/admin/views/delivery/local_config.vue +++ /dev/null @@ -1,80 +0,0 @@ - - - - - \ No newline at end of file diff --git a/niucloud/addon/shop/admin/views/delivery/local_delivery_service.vue b/niucloud/addon/shop/admin/views/delivery/local_delivery_service.vue deleted file mode 100644 index 573e4f2ee..000000000 --- a/niucloud/addon/shop/admin/views/delivery/local_delivery_service.vue +++ /dev/null @@ -1,93 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/local_record.vue b/niucloud/addon/shop/admin/views/delivery/local_record.vue deleted file mode 100644 index e0a50a1d0..000000000 --- a/niucloud/addon/shop/admin/views/delivery/local_record.vue +++ /dev/null @@ -1,287 +0,0 @@ - - - - - \ No newline at end of file diff --git a/niucloud/addon/shop/admin/views/delivery/merchant_record.vue b/niucloud/addon/shop/admin/views/delivery/merchant_record.vue deleted file mode 100644 index 9168fa441..000000000 --- a/niucloud/addon/shop/admin/views/delivery/merchant_record.vue +++ /dev/null @@ -1,249 +0,0 @@ - - - - - \ No newline at end of file diff --git a/niucloud/addon/shop/admin/views/delivery/search.vue b/niucloud/addon/shop/admin/views/delivery/search.vue deleted file mode 100644 index 1af326312..000000000 --- a/niucloud/addon/shop/admin/views/delivery/search.vue +++ /dev/null @@ -1,164 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/staff.vue b/niucloud/addon/shop/admin/views/delivery/staff.vue deleted file mode 100644 index 0c2606c29..000000000 --- a/niucloud/addon/shop/admin/views/delivery/staff.vue +++ /dev/null @@ -1,139 +0,0 @@ - - - diff --git a/niucloud/addon/shop/admin/views/delivery/store.vue b/niucloud/addon/shop/admin/views/delivery/store.vue deleted file mode 100644 index bfcafb6e5..000000000 --- a/niucloud/addon/shop/admin/views/delivery/store.vue +++ /dev/null @@ -1,164 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/store_edit.vue b/niucloud/addon/shop/admin/views/delivery/store_edit.vue deleted file mode 100644 index c0eb5624d..000000000 --- a/niucloud/addon/shop/admin/views/delivery/store_edit.vue +++ /dev/null @@ -1,531 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/template.vue b/niucloud/addon/shop/admin/views/delivery/template.vue deleted file mode 100644 index f531fba04..000000000 --- a/niucloud/addon/shop/admin/views/delivery/template.vue +++ /dev/null @@ -1,144 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery/template_edit.vue b/niucloud/addon/shop/admin/views/delivery/template_edit.vue deleted file mode 100644 index f462add00..000000000 --- a/niucloud/addon/shop/admin/views/delivery/template_edit.vue +++ /dev/null @@ -1,505 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery_store/delivery_set.vue b/niucloud/addon/shop/admin/views/delivery_store/delivery_set.vue deleted file mode 100644 index 5a39647ee..000000000 --- a/niucloud/addon/shop/admin/views/delivery_store/delivery_set.vue +++ /dev/null @@ -1,164 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery_store/edit.vue b/niucloud/addon/shop/admin/views/delivery_store/edit.vue deleted file mode 100644 index 3936f196c..000000000 --- a/niucloud/addon/shop/admin/views/delivery_store/edit.vue +++ /dev/null @@ -1,898 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/delivery_store/list.vue b/niucloud/addon/shop/admin/views/delivery_store/list.vue deleted file mode 100644 index 56549f731..000000000 --- a/niucloud/addon/shop/admin/views/delivery_store/list.vue +++ /dev/null @@ -1,160 +0,0 @@ - - - \ No newline at end of file diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-goods-coupon.vue b/niucloud/addon/shop/admin/views/diy/components/edit-goods-coupon.vue deleted file mode 100644 index 3640fa3e6..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-goods-coupon.vue +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-goods-list.vue b/niucloud/addon/shop/admin/views/diy/components/edit-goods-list.vue deleted file mode 100644 index e51d79adb..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-goods-list.vue +++ /dev/null @@ -1,382 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-many-goods-list.vue b/niucloud/addon/shop/admin/views/diy/components/edit-many-goods-list.vue deleted file mode 100644 index 80785032b..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-many-goods-list.vue +++ /dev/null @@ -1,665 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-exchange-goods.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-exchange-goods.vue deleted file mode 100644 index 5d6329af9..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-exchange-goods.vue +++ /dev/null @@ -1,153 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-exchange-info.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-exchange-info.vue deleted file mode 100644 index c833d13e5..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-exchange-info.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-attr.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-attr.vue deleted file mode 100644 index 896d4d70b..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-attr.vue +++ /dev/null @@ -1,40 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-basic-info.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-basic-info.vue deleted file mode 100644 index 1475d28db..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-basic-info.vue +++ /dev/null @@ -1,334 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-bottom.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-bottom.vue deleted file mode 100644 index d34b48dbb..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-bottom.vue +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-desc.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-desc.vue deleted file mode 100644 index 896d4d70b..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-desc.vue +++ /dev/null @@ -1,40 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-evaluate.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-evaluate.vue deleted file mode 100644 index 896d4d70b..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-evaluate.vue +++ /dev/null @@ -1,40 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-purchase-service.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-purchase-service.vue deleted file mode 100644 index bd15cf792..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-purchase-service.vue +++ /dev/null @@ -1,53 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-sow.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-sow.vue deleted file mode 100644 index 896d4d70b..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-detail-sow.vue +++ /dev/null @@ -1,40 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-hot.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-hot.vue deleted file mode 100644 index b897267b5..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-hot.vue +++ /dev/null @@ -1,197 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-ranking.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-ranking.vue deleted file mode 100644 index de59bb36c..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-ranking.vue +++ /dev/null @@ -1,143 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-recommend.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-recommend.vue deleted file mode 100644 index c403d4e00..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-goods-recommend.vue +++ /dev/null @@ -1,199 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-member-info.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-member-info.vue deleted file mode 100644 index 1fa4e4574..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-member-info.vue +++ /dev/null @@ -1,56 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-newcomer.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-newcomer.vue deleted file mode 100644 index 74bf5a562..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-newcomer.vue +++ /dev/null @@ -1,309 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-order-info.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-order-info.vue deleted file mode 100644 index 39ebffa16..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-order-info.vue +++ /dev/null @@ -1,90 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-shop-search.vue b/niucloud/addon/shop/admin/views/diy/components/edit-shop-search.vue deleted file mode 100644 index 918b606ef..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-shop-search.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/diy/components/edit-single-recommend.vue b/niucloud/addon/shop/admin/views/diy/components/edit-single-recommend.vue deleted file mode 100644 index 1f8ed5cdf..000000000 --- a/niucloud/addon/shop/admin/views/diy/components/edit-single-recommend.vue +++ /dev/null @@ -1,348 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/attr.vue b/niucloud/addon/shop/admin/views/goods/attr.vue deleted file mode 100644 index ef480195a..000000000 --- a/niucloud/addon/shop/admin/views/goods/attr.vue +++ /dev/null @@ -1,258 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/attr_edit.vue b/niucloud/addon/shop/admin/views/goods/attr_edit.vue deleted file mode 100644 index 1daa12b5b..000000000 --- a/niucloud/addon/shop/admin/views/goods/attr_edit.vue +++ /dev/null @@ -1,442 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/brand_list.vue b/niucloud/addon/shop/admin/views/goods/brand_list.vue deleted file mode 100644 index ae81f52a3..000000000 --- a/niucloud/addon/shop/admin/views/goods/brand_list.vue +++ /dev/null @@ -1,205 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/category.vue b/niucloud/addon/shop/admin/views/goods/category.vue deleted file mode 100644 index 3c3a30426..000000000 --- a/niucloud/addon/shop/admin/views/goods/category.vue +++ /dev/null @@ -1,264 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/category_config.vue b/niucloud/addon/shop/admin/views/goods/category_config.vue deleted file mode 100644 index 4ea865594..000000000 --- a/niucloud/addon/shop/admin/views/goods/category_config.vue +++ /dev/null @@ -1,236 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/brand-edit.vue b/niucloud/addon/shop/admin/views/goods/components/brand-edit.vue deleted file mode 100644 index d6cf65751..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/brand-edit.vue +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/category-edit.vue b/niucloud/addon/shop/admin/views/goods/components/category-edit.vue deleted file mode 100644 index 2fd0f87cc..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/category-edit.vue +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/coupon-select-popup.vue b/niucloud/addon/shop/admin/views/goods/components/coupon-select-popup.vue deleted file mode 100644 index 54be0890b..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/coupon-select-popup.vue +++ /dev/null @@ -1,302 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/evaluate-add.vue b/niucloud/addon/shop/admin/views/goods/components/evaluate-add.vue deleted file mode 100644 index 61052688a..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/evaluate-add.vue +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/goods-batch-settings-popup.vue b/niucloud/addon/shop/admin/views/goods/components/goods-batch-settings-popup.vue deleted file mode 100644 index 6aa8fa546..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/goods-batch-settings-popup.vue +++ /dev/null @@ -1,690 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/goods-category-select-content.vue b/niucloud/addon/shop/admin/views/goods/components/goods-category-select-content.vue deleted file mode 100644 index 2d32d4d24..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/goods-category-select-content.vue +++ /dev/null @@ -1,231 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/goods-category-spread-popup.vue b/niucloud/addon/shop/admin/views/goods/components/goods-category-spread-popup.vue deleted file mode 100644 index f41c0fb19..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/goods-category-spread-popup.vue +++ /dev/null @@ -1,102 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/goods-member-price-popup.vue b/niucloud/addon/shop/admin/views/goods/components/goods-member-price-popup.vue deleted file mode 100644 index 33c07334f..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/goods-member-price-popup.vue +++ /dev/null @@ -1,294 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/goods-price-edit-popup.vue b/niucloud/addon/shop/admin/views/goods/components/goods-price-edit-popup.vue deleted file mode 100644 index bdd466024..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/goods-price-edit-popup.vue +++ /dev/null @@ -1,296 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/goods-select-content.vue b/niucloud/addon/shop/admin/views/goods/components/goods-select-content.vue deleted file mode 100644 index d147025b4..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/goods-select-content.vue +++ /dev/null @@ -1,360 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/goods-select-popup.vue b/niucloud/addon/shop/admin/views/goods/components/goods-select-popup.vue deleted file mode 100644 index 9659b24c7..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/goods-select-popup.vue +++ /dev/null @@ -1,711 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/goods-spread-popup.vue b/niucloud/addon/shop/admin/views/goods/components/goods-spread-popup.vue deleted file mode 100644 index 70aebafeb..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/goods-spread-popup.vue +++ /dev/null @@ -1,112 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/goods-stock-edit-popup.vue b/niucloud/addon/shop/admin/views/goods/components/goods-stock-edit-popup.vue deleted file mode 100644 index 3bb9e4b12..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/goods-stock-edit-popup.vue +++ /dev/null @@ -1,238 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/label-edit.vue b/niucloud/addon/shop/admin/views/goods/components/label-edit.vue deleted file mode 100644 index 89b9920e8..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/label-edit.vue +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/label-group-edit.vue b/niucloud/addon/shop/admin/views/goods/components/label-group-edit.vue deleted file mode 100644 index a7dfc8c83..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/label-group-edit.vue +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/newcomer-goods-select-popup.vue b/niucloud/addon/shop/admin/views/goods/components/newcomer-goods-select-popup.vue deleted file mode 100644 index c6a004c56..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/newcomer-goods-select-popup.vue +++ /dev/null @@ -1,693 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/components/service-edit.vue b/niucloud/addon/shop/admin/views/goods/components/service-edit.vue deleted file mode 100644 index d4ba688c3..000000000 --- a/niucloud/addon/shop/admin/views/goods/components/service-edit.vue +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/evaluate.vue b/niucloud/addon/shop/admin/views/goods/evaluate.vue deleted file mode 100644 index 8771044e9..000000000 --- a/niucloud/addon/shop/admin/views/goods/evaluate.vue +++ /dev/null @@ -1,425 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/label_group_list.vue b/niucloud/addon/shop/admin/views/goods/label_group_list.vue deleted file mode 100644 index d5b0a8bad..000000000 --- a/niucloud/addon/shop/admin/views/goods/label_group_list.vue +++ /dev/null @@ -1,195 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/label_list.vue b/niucloud/addon/shop/admin/views/goods/label_list.vue deleted file mode 100644 index a206120ae..000000000 --- a/niucloud/addon/shop/admin/views/goods/label_list.vue +++ /dev/null @@ -1,282 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/list.vue b/niucloud/addon/shop/admin/views/goods/list.vue deleted file mode 100644 index bacc101a4..000000000 --- a/niucloud/addon/shop/admin/views/goods/list.vue +++ /dev/null @@ -1,885 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/public/css/goods_edit.scss b/niucloud/addon/shop/admin/views/goods/public/css/goods_edit.scss deleted file mode 100644 index 6c497868a..000000000 --- a/niucloud/addon/shop/admin/views/goods/public/css/goods_edit.scss +++ /dev/null @@ -1,231 +0,0 @@ -.goods-type-wrap { - width: 120px; - height: 60px; - background: #fff; - border-radius: 3px; - float: left; - text-align: center; - padding-top: 8px; - position: relative; - cursor: pointer; - line-height: 23px; - border: 1px solid #e7e7e7; - - .goods-type-name { - font-size: 14px; - font-weight: 600; - color: rgba(0, 0, 0, .85); - } - - .goods-type-desc { - font-size: 12px; - font-weight: 400; - color: #999; - } - - .triangle { - position: absolute; - bottom: 0; - right: 0; - width: 0; - height: 0; - border-bottom: 26px solid var(--el-color-primary); - border-left: 26px solid transparent; - } - - .selected { - position: absolute; - bottom: -2px; - right: 2px; - color: #fff; - } - - &.selected { - border: 1px solid var(--el-color-primary); - } - - &.disabled { - cursor: not-allowed; - - .goods-type-name { - color: #999; - } - } - - &:nth-child(2n) { - margin: 0 12px; - } - -} - -.spec-wrap { - flex: 1; - - .spec-edit-list { - .spec-item { - background: #f7f7f7; - padding: 20px; - margin-bottom: 20px; - position: relative; - border-radius: 6px; - - .spec-name-wrap { - /*margin-bottom: 20px;*/ - } - - .spec-value-wrap { - padding: 25px 30px 0 30px; - position: relative; - - ul { - - display: flex; - flex-wrap: wrap; - flex: 1; - align-items: baseline; - - li { - margin: 0 10px 10px 0; - position: relative; - - .input-width { - width: 200px; - } - - .icon { - width: 32px; - padding: 0; - display: none; - position: absolute; - top: -12px; - right: -20px; - cursor: pointer; - } - - &:hover { - .icon { - display: block; - } - } - } - - } - - .add-spec-value { - cursor: pointer; - user-select: none; - } - - .box { - position: absolute; - top: 0; - left: 10px; - width: 20px; - height: 40px; - border: 1px solid #b8b9bd; - border-top: none; - border-right: none; - } - } - - .del-spec { - border: none; - position: absolute; - top: 10px; - right: 10px; - display: none; - cursor: pointer; - - } - - &:hover { - .del-spec { - display: block; - } - } - } - } -} - -.el-input__suffix { - cursor: pointer; -} - -.el-table__row:focus { - outline: none !important; -} - -.add-spec { - margin-bottom: 16px; -} - -.batch-operation-sku { - display: flex; - margin-bottom: 16px; - background-color: #ffffff; - -ms-flex-wrap: nowrap; - flex-wrap: nowrap; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - - label { - font-size: 14px; - margin-right: 10px; - } - - .set-spec-select { - margin-right: 10px; - max-width: 130px; - } - - .set-input { - max-width: 130px; - min-width: 60px; - margin-right: 10px; - } -} - -.editor-width { - width: 990px; -} - -.sku-table { - :focus { - outline: none; - } -} - -.sku-form-item-wrap :deep(.el-form-item__content) { - margin-left: 0 !important; -} - -.sku-table :deep(.el-table__cell .cell) { - overflow: initial !important; -} - -.attr-table { - width: 859px; - border: 1px solid #e6e6e6; - - thead tr, tbody tr { - border-bottom: 1px solid #e6e6e6; - } - - thead th, tbody td { - padding: 5px 10px; - border-right: 1px solid #e6e6e6; - } - - thead th { - text-align: left; - font-weight: normal; - font-size: 14px; - color: #666; - box-sizing: border-box; - } -} - -.fixed-footer { - z-index: 4; -} \ No newline at end of file diff --git a/niucloud/addon/shop/admin/views/goods/public/js/useGoodsEdit.ts b/niucloud/addon/shop/admin/views/goods/public/js/useGoodsEdit.ts deleted file mode 100644 index 54cec5be6..000000000 --- a/niucloud/addon/shop/admin/views/goods/public/js/useGoodsEdit.ts +++ /dev/null @@ -1,1701 +0,0 @@ -import { reactive, ref, computed, nextTick } from 'vue' -import { t } from '@/lang' -import { TabsPaneContext, ElMessage } from 'element-plus' -import Sortable from 'sortablejs' -import { range, cloneDeep } from 'lodash-es' -import { debounce, deepClone, getImageDimensions } from '@/utils/common' -import { useRoute, useRouter } from 'vue-router' -import Test from '@/utils/test' -import { - getGoodsType, - getBrandList, - getLabelList, - getServeList, - getSupplierList, - getCategoryTree, - getAttrList, - goodsVerify, - getGoodsInfoTemplate -} from '@/addon/shop/api/goods' -import { getPosterList } from '@/app/api/poster' -import { getDiyFormList } from '@/app/api/diy_form' - -// 商品添加/编辑 -export function useGoodsEdit(params: any = {}) { - - const route = useRoute() - const router = useRouter() - - const repeat = ref(false) - - // 表单数据 - const formData: any = reactive({ - goods_id: '', - goods_type: 'real', - - // 基础信息 - goods_name: '', - sub_title: '', - goods_image: '', - goods_video: '', - goods_category: '', - brand_id: '', - poster_id: '', - diy_detail_id: '', - form_id: '', - label_ids: [], - service_ids: [], - supplier_id: '', - status: '1', - is_gift: 0, - sort: '', - - addon_shop_supplier: [], - - // 价格库存 - spec_type: 'single', - price: '', - market_price: '', - cost_price: '', - stock: '', - sku_no: '', - unit: '', - virtual_sale_num: '', - member_discount: '', - is_limit: 0, - limit_type: 1, - max_buy: '', - min_buy: '', - - // 商品参数 - attr_ids: [], - attr_format: [], - - // 商品详情 - goods_desc: '', - skuCheckAll: false,// 是否全选 - skuIsIndeterminate: false,// 是否部分选中 - skuCheckedCities: [],// 选中的规格 - }) - - Object.assign(formData, params.formData); - - formData.goods_id = ref(route.query.goods_id) - - // 追加表单数据 - const appendFormData = params.appendFormData; - Object.assign(formData, appendFormData); - - // 追加刷新商品sku数据 - const appendRefreshGoodsSkuData = params.appendRefreshGoodsSkuData || {}; - - // 追加单规格数据 - const appendSingleGoodsData = params.appendSingleGoodsData; - - const getFormRules = params.getFormRules; - - const formRefArr: any = reactive({}); - - const getFormRef = params.getFormRef; - - const verifyArr: any = reactive([]) - - nextTick(() => { - let formRef = getFormRef(); - for (let key in formRef) { - formRefArr[key] = formRef[key]; - } - - if (params.getVerify) { - verifyArr.splice(0, verifyArr.length, ...params.getVerify()) - } - - }); - - const editApi = params.editApi; - const addApi = params.addApi; - - const activeName: any = ref('basic') - const tabHandleClick = (tab: TabsPaneContext, event: Event) => { - // console.log(tab, event) - } - - // 商品类型 - const goodsType = reactive([]) - - // 切换商品类型 - const changeGoodsType = (data: any) => { - // 添加商品是切换类型不应该是edit - let url = '/shop/goods/'+data.type + '_add' - router.push(url) - } - - // 商品类型 - getGoodsType().then((res) => { - const data = res.data - if (data) { - for (const k in data) { - goodsType.push(data[k]) - } - } - }) - - // 商品分类 - const goodsCategoryOptions = reactive([]) - const goodsCategoryProps = { - multiple: true - } - - const categoryHandleChange = (value: any) => { - // console.log(value, goodsEdit.formData.goods_category, goodsEdit.formData.goods_category.toString()) - } - - // 跳转到商品分类,添加分类 - const toGoodsCategoryEvent = () => { - const url = router.resolve({ - path: '/shop/goods/category' - }) - window.open(url.href) - } - - // 刷新商品分类 - const refreshGoodsCategory = (bool = false) => { - getCategoryTree().then((res) => { - const data = res.data - if (data) { - const goodsCategoryTree: any = [] - data.forEach((item: any) => { - const children: any = [] - if (item.child_list) { - item.child_list.forEach((childItem: any) => { - children.push({ - value: childItem.category_id, - label: childItem.category_name - }) - }) - } - goodsCategoryTree.push({ - value: item.category_id, - label: item.category_name, - children - }) - }) - goodsCategoryOptions.splice(0, goodsCategoryOptions.length, ...goodsCategoryTree) - if (bool) { - ElMessage({ - message: t('refreshSuccess'), - type: 'success' - }) - } - } - }) - } - - refreshGoodsCategory() - - // 品牌列表下拉框 - const brandOptions = reactive([]) - - // 跳转到商品品牌,添加品牌 - const toGoodsBrandEvent = () => { - const url = router.resolve({ - path: '/shop/goods/brand' - }) - window.open(url.href) - } - - // 商品品牌 - // const refreshGoodsBrand = (bool = false) => { - // getBrandList({}).then((res) => { - // const data = res.data - // if (data) { - // brandOptions.splice(0, brandOptions.length, ...data) - // if (bool) { - // ElMessage({ - // message: t('refreshSuccess'), - // type: 'success' - // }) - // } - // } - // }) - // } - const refreshGoodsBrand = (query='', bool = false) => { - getBrandList({brand_name: query}).then((res) => { - const data = res.data - if (data) { - brandOptions.splice(0, brandOptions.length, ...data) - if (bool) { - ElMessage({ - message: t('refreshSuccess'), - type: 'success' - }) - } - } - }) - } - // 不能注释,编辑时需要提前加载 - refreshGoodsBrand() - - // 海报列表下拉框 - const posterOptions = reactive([]) - - // 跳转到海报列表,添加海报 - const toPosterEvent = () => { - const url = router.resolve({ - path: '/poster/list' - }) - window.open(url.href) - } - - // 商品海报 - const refreshGoodsPoster = (bool = false) => { - getPosterList({ - type: 'shop_goods' - }).then((res) => { - const data = res.data - if (data) { - posterOptions.splice(0, posterOptions.length, ...data) - if (bool) { - ElMessage({ - message: t('refreshSuccess'), - type: 'success' - }) - } - } - }) - } - - refreshGoodsPoster() - - // 商品详情列表下拉框 - const detailTemplateOptions = reactive([]) - - // 跳转到微页面,添加商品详情模板 - const toDetailTemplateEvent = () => { - const url = router.resolve({ - path: '/diy/list' - }) - window.open(url.href) - } - - // 刷新微页面 - const refreshDetailTemplate = (bool = false) => { - getGoodsInfoTemplate({ - type: 'DIY_SHOP_GOODS_DETAIL' - }).then((res) => { - const data = res.data - if (data) { - detailTemplateOptions.splice(0, detailTemplateOptions.length, ...data) - if (bool) { - ElMessage({ - message: t('refreshSuccess'), - type: 'success' - }) - } - } - }) - } - - refreshDetailTemplate() - - - // 万能表单列表下拉框 - const diyFormOptions = reactive([]) - - // 跳转到万能表单列表,添加表单 - const toDiyFormEvent = () => { - const url = router.resolve({ - path: '/diy_form/list' - }) - window.open(url.href) - } - - // 刷新万能表单 - const refreshDiyForm = (bool = false) => { - getDiyFormList({ - type: 'DIY_FORM_GOODS_DETAIL', - status: 1 - }).then((res) => { - const data = res.data - if (data) { - diyFormOptions.splice(0, diyFormOptions.length, ...data) - if (bool) { - ElMessage({ - message: t('refreshSuccess'), - type: 'success' - }) - } - } - }) - } - - refreshDiyForm() - - // 标签组列表复选框 - const labelOptions = reactive([]) - - // 跳转到商品标签,添加标签 - const toGoodsLabelEvent = () => { - const url = router.resolve({ - path: '/shop/goods/label' - }) - window.open(url.href) - } - - // 商品标签 - const refreshGoodsLabel = () => { - getLabelList({}).then((res) => { - const data = res.data - if (data) { - labelOptions.splice(0, labelOptions.length, ...data) - } - }) - } - - refreshGoodsLabel() - - // 商品服务列表复选框 - const serviceOptions = reactive([]) - - // 跳转到商品服务,添加服务 - const toGoodsServiceEvent = () => { - const url = router.resolve({ - path: '/shop/goods/service' - }) - window.open(url.href) - } - - // 商品服务 - const refreshGoodsService = () => { - getServeList({}).then((res) => { - const data = res.data - if (data) { - serviceOptions.splice(0, serviceOptions.length, ...data) - } - }) - } - - refreshGoodsService() - - // 供应商列表下拉框 - const supplierOptions = reactive([]) - - // 跳转到供应商 - const toSupplierEvent = () => { - const url = router.resolve({ - path: '/shop_supplier/supplier' - }) - window.open(url.href) - } - - // 供应商 - const refreshSupplier = () => { - getSupplierList({}).then((res) => { - const data = res.data - if (data) { - supplierOptions.splice(0, supplierOptions.length, ...data) - } - }) - } - - const goodsSpecFormat: any = reactive([]) // 规格项/规格值 - const goodsSkuData: any = reactive({}) // 商品SKU规格数据 - const specData: any = reactive([]) // 商品规格值 - - const activeGoodsCount: any = ref(0) - - const isDisabledPrice = () => { - if (activeGoodsCount.value > 0) { - return true; - } - return false; - } - - const handleGoodsInit = (data: any) => { - formData.addon_shop_supplier = data.addon_shop_supplier - if (formData.addon_shop_supplier && formData.addon_shop_supplier.status == 1) { - refreshSupplier() - } - - if (data.default_sort) { - formData.sort = data.default_sort; - } - - if (formData.goods_id && data.goods_info) { - - // 商品参与营销活动的数量 - activeGoodsCount.value = data.goods_info.active_goods_count; - - // 基础信息 - formData.goods_name = data.goods_info.goods_name - formData.sub_title = data.goods_info.sub_title - formData.goods_type = data.goods_info.goods_type - formData.goods_image = data.goods_info.goods_image - formData.goods_video = data.goods_info.goods_video - formData.goods_category = data.goods_info.goods_category - formData.brand_id = data.goods_info.brand_id - formData.poster_id = data.goods_info.poster_id - formData.form_id = data.goods_info.form_id - formData.diy_detail_id = data.goods_info.diy_detail_id - formData.label_ids = data.goods_info.label_ids - formData.service_ids = data.goods_info.service_ids - formData.supplier_id = data.goods_info.supplier_id - formData.status = data.goods_info.status - formData.sort = data.goods_info.sort - formData.is_gift = data.goods_info.is_gift - - /*************** 商品参数-start ****************/ - formData.attr_format = data.goods_info.attr_format - formData.attr_ids = data.goods_info.attr_ids - - attrChange(formData.attr_ids, true) - /*************** 商品参数-end ****************/ - - // 价格库存 - formData.spec_type = data.goods_info.spec_type - formData.stock = data.goods_info.stock - - if (formData.spec_type == 'single') { - // 单规格 - const skuInfo = data.goods_info.sku_list[0] - formData.price = skuInfo.price - formData.market_price = skuInfo.market_price - formData.cost_price = skuInfo.cost_price - formData.sku_no = skuInfo.sku_no - - if (appendSingleGoodsData) Object.assign(formData, appendSingleGoodsData(skuInfo)); - } else if (formData.spec_type == 'multi') { - // 多规格 - const specList = data.goods_info.spec_list - specList.forEach((item: any) => { - const values: any = [] - item.spec_values = item.spec_values.split(',') - item.spec_values.forEach((v: any) => { - values.push({ - id: generateRandom(), - spec_value_name: v - }) - }) - goodsSpecFormat.push({ - id: generateRandom(), - spec_id: item.spec_id, - goods_id: item.goods_id, - spec_name: item.spec_name, - values - }) - }) - - refreshGoodsSkuData(); - - const skuList = data.goods_info.sku_list - - for (let key in goodsSkuData) { - for (let i = 0; i < skuList.length; i++) { - let item = skuList[i]; - if (goodsSkuData[key].spec_name == item.sku_spec_format.replace(/,/g, ' ')) { - goodsSkuData[key].sku_id = item.sku_id; - goodsSkuData[key].sku_image = item.sku_image; - goodsSkuData[key].price = item.price; - goodsSkuData[key].market_price = item.market_price; - goodsSkuData[key].cost_price = item.cost_price; - - for (let field in appendRefreshGoodsSkuData) { - goodsSkuData[key][field] = item[field]; - } - - goodsSkuData[key].stock = item.stock; - goodsSkuData[key].sku_id = item.sku_id; - goodsSkuData[key].sku_no = item.sku_no; - goodsSkuData[key].is_default = item.is_default; - break; - } - } - } - - nextTick(() => { - refreshSkuTable() - bindSpecValue() - }) - } - - formData.member_discount = data.goods_info.member_discount - - formData.unit = data.goods_info.unit - formData.virtual_sale_num = data.goods_info.virtual_sale_num - formData.is_limit = data.goods_info.is_limit - formData.limit_type = data.goods_info.limit_type - formData.max_buy = data.goods_info.max_buy - formData.min_buy = data.goods_info.min_buy - - // 商品详情 - formData.goods_desc = data.goods_info.goods_desc - } - } - - // 绑定拖拽规格值事件 - const bindSpecValue = () => { - // 商品正在参与营销活动,禁止操作 - if (isDisabledPrice()) { - return - } - if (!getFormRef().specValueRef) return - - for (let i = 0; i < getFormRef().specValueRef.length; i++) { - const item = getFormRef().specValueRef[i] - const sortable = Sortable.create(item, { - group: 'draggable-element-' + i, - animation: 200, - // 结束拖拽 - onEnd: event => { - const temp = goodsSpecFormat[i].values[event.oldIndex!] - goodsSpecFormat[i].values.splice(event.oldIndex!, 1) - goodsSpecFormat[i].values.splice(event.newIndex!, 0, temp) - - nextTick(() => { - sortable.sort( - range(goodsSpecFormat[i].values.length).map(value => { - return value.toString() - }) - ) - - // 渲染商品规格数据、表格 - refreshGoodsSkuData() - refreshSkuTable() - }) - } - }) - } - } - - // 生成随机数 - const generateRandom = (len: number = 5) => { - return Number(Math.random().toString().substr(3, len) + Date.now()).toString(36) - } - - // 添加规格项 - const addSpec = () => { - // 商品正在参与营销活动,禁止操作 - if (isDisabledPrice()) { - ElMessage({ - type: 'warning', - message: `${ t('participateInActiveDisableTips') }` - }) - return - } - if (goodsSpecFormat.length > 4) { - ElMessage({ - type: 'warning', - message: `${ t('maxAddSpecTips') }` - }) - return - } - goodsSpecFormat.push({ - id: generateRandom(), - spec_name: '', - values: [ - { - id: generateRandom(), - spec_value_name: '' - } - ] - }) - } - - // 删除规格项 - const deleteSpec = (index: number) => { - // 商品正在参与营销活动,禁止操作 - if (isDisabledPrice()) { - ElMessage({ - type: 'warning', - message: `${ t('participateInActiveDisableTips') }` - }) - return - } - goodsSpecFormat.splice(index, 1) - // 渲染商品规格数据、表格、统计库存变化 - refreshGoodsSkuData() - refreshSkuTable() - specStockSum() - } - - // 添加规格值 - const addSpecValue = (index: number) => { - // 商品正在参与营销活动,禁止操作 - if (isDisabledPrice()) { - ElMessage({ - type: 'warning', - message: `${ t('participateInActiveDisableTips') }` - }) - return - } - goodsSpecFormat[index].values.push({ - id: generateRandom(), - spec_value_name: '' - }) - bindSpecValue() - } - - // 监听规格值变化 - const specValueNameInputListener = debounce((value) => { - // 渲染商品规格数据、表格 - refreshGoodsSkuData() - refreshSkuTable() - - }) - - // 删除规格值 - const deleteSpecValue = (index: number, specIndex: number) => { - // 商品正在参与营销活动,禁止操作 - if (isDisabledPrice()) { - ElMessage({ - type: 'warning', - message: `${ t('participateInActiveDisableTips') }` - }) - return - } - goodsSpecFormat[index].values.splice(specIndex, 1) - // 渲染商品规格数据、表格、统计库存变化 - refreshGoodsSkuData() - refreshSkuTable() - specStockSum() - } - - // 设置默认规格 - const specValueIsDefaultChangeListener = (value: any, key: any) => { - for (const k in goodsSkuData) { - if (k == key) { - goodsSkuData[k].is_default = value - } else { - goodsSkuData[k].is_default = 0 - } - } - } - - // 监听规格库存变化,统计总库存 - const specStockSum = debounce(() => { - let stock = 0 - for (const k in goodsSkuData) { - if (goodsSkuData[k].stock) stock += parseInt(goodsSkuData[k].stock) - } - formData.stock = stock - }) - - // 刷新商品规格数据 - const refreshGoodsSkuData = () => { - const arr = goodsSpecFormat - const tempGoodsSkuData = cloneDeep(goodsSkuData)// 记录原始数据,后续用作对比 - let skuData: any = {} - let tempIndex = 0; - for (const spec of arr) { - let item_prop_arr: any = {} - if (Object.keys(skuData).length > 0) { - for (const ele_2 in skuData) { - for (let ele_3 of spec.values) { - let sku_spec = cloneDeep(skuData[ele_2].sku_spec)// 防止对象引用 - sku_spec.push(ele_3) - item_prop_arr['sku_' + tempIndex] = { - spec_name: `${ skuData[ele_2].spec_name } ${ ele_3.spec_value_name }`, - sku_spec, - sku_image: '', - price: '', - market_price: '', - cost_price: '', - stock: '', - sku_no: '', - is_default: 0 - } - - for (let key in appendRefreshGoodsSkuData) { - item_prop_arr['sku_' + tempIndex][key] = appendRefreshGoodsSkuData[key].value; - } - tempIndex++; - } - } - } else { - for (let ele_1 of spec.values) { - let spec_name = ele_1.spec_value_name - item_prop_arr['sku_' + tempIndex] = { - spec_name: spec_name, - sku_spec: [ele_1], - sku_image: '', - price: '', - market_price: '', - cost_price: '', - stock: '', - sku_no: '', - is_default: 0 - } - for (let key in appendRefreshGoodsSkuData) { - item_prop_arr['sku_' + tempIndex][key] = appendRefreshGoodsSkuData[key].value; - } - tempIndex++; - } - } - - skuData = Object.keys(item_prop_arr).length > 0 ? item_prop_arr : skuData - } - - // 比对已存在的规格项/值,并且赋值 - for (const tempKey in tempGoodsSkuData) { - for (const key in skuData) { - const count = matchSkuSpecCount(tempGoodsSkuData[tempKey].sku_spec, skuData[key].sku_spec) - if (count === skuData[key].sku_spec.length) { - // 匹配成功后,要同步最新的规格项名称、规格值集合 - const specName = skuData[key].spec_name - const skuSpec = skuData[key].sku_spec - Object.assign(skuData[key], tempGoodsSkuData[tempKey]) - skuData[key].spec_name = specName - skuData[key].sku_spec = skuSpec - break - } - } - } - - for (const item in goodsSkuData) { - delete goodsSkuData[item] - } - - let firstSpec = '' - - for (const key in skuData) { - if (firstSpec == '') { - firstSpec = key - skuData[key].is_default = 1 - } else { - skuData[key].is_default = 0 - } - goodsSkuData[key] = skuData[key] - } - formData.skuCheckAll = false;// 是否全选 - formData.skuIsIndeterminate = false// 是否部分选中 - formData.skuCheckedCities = []// 选中的规格 - } - - // 匹配规格值 - const matchSkuSpecCount = (oVal: any, nVal: any) => { - let count = 0// 匹配次数,与规格值相等时为匹配成功 - for (let i = 0; i < oVal.length; i++) { - for (let j = 0; j < nVal.length; j++) { - if (oVal[i].id === nVal[j].id) { - count++ - break - } - } - } - return count - } - - // 刷新商品规格表格 - const refreshSkuTable = () => { - let length = 0 - // 统计有效规格数量 - for (let i = 0; i < goodsSpecFormat.length; i++) { - if (goodsSpecFormat[i].spec_name != '' && goodsSpecFormat[i].values.length > 0) { - length++ - } - } - - let row = 1 // 跨行 - const tempSpecData = [] - - // 规格值单元格合并 - for (let i = length - 1; i >= 0; i--) { - for (let k = 0; k < Object.keys(goodsSkuData).length;) { - if (goodsSpecFormat[i].values.length > 0) { - for (let ele of goodsSpecFormat[i].values) { - tempSpecData.push({ - index: k, - colSpan: i, - rowSpan: row, - spec_value_name: ele.spec_value_name - }) - k = k + row - } - } else { - k++ - } - } - row = row * goodsSpecFormat[i].values.length - } - - tempSpecData.reverse() - specData.splice(0, specData.length, ...tempSpecData) - } - - const batchOperation: any = reactive({ - spec: '', // 所选规格id,空为全部 - price: '', // 销售价 - market_price: '', // 划线价 - cost_price: '', // 成本价 - stock: '', // 库存 - sku_no: '' // 商品编码 - }) - - const appendBatchOperation: any = {}; - for (let key in appendRefreshGoodsSkuData) { - appendBatchOperation[key] = appendRefreshGoodsSkuData[key].value; - } - - Object.assign(batchOperation, appendBatchOperation); - - const skuHandleCheckAllChange = (value: any) => { - formData.skuIsIndeterminate = false - if (value) { - formData.skuCheckedCities = Object.keys(goodsSkuData) - } else { - formData.skuCheckedCities = [] - } - } - const handleCheckedCitiesChange = (value: any) => { - const checkedCount = value.length - formData.skuCheckAll = checkedCount === Object.keys(goodsSkuData).length - formData.skuIsIndeterminate = checkedCount > 0 && checkedCount < Object.keys(goodsSkuData).length - } - // 批量设置确认 - const saveBatch = () => { - if (formData.skuCheckedCities.length == 0) { - ElMessage({ - type: 'warning', - message: `${ t('pleaseSelectSku') }` - }) - return - } - // 验证输入内容 - if (batchOperation.price && (isNaN(batchOperation.price) || !regExp.digit.test(batchOperation.price))) { - ElMessage({ - type: 'warning', - message: `${ t('priceTips') }` - }) - return - } - if (batchOperation.market_price && (isNaN(batchOperation.market_price) || !regExp.digit.test(batchOperation.market_price))) { - ElMessage({ - type: 'warning', - message: `${ t('marketPriceTips') }` - }) - return - } - if (batchOperation.cost_price && (isNaN(batchOperation.cost_price) || !regExp.digit.test(batchOperation.cost_price))) { - ElMessage({ - type: 'warning', - message: `${ t('costPriceTips') }` - }) - return - } - if (batchOperation.stock && (isNaN(batchOperation.stock) || !regExp.number.test(batchOperation.stock))) { - ElMessage({ - type: 'warning', - message: `${ t('stockTips') }` - }) - return - } - - for (let field in appendRefreshGoodsSkuData) { - let reg = regExp[appendRefreshGoodsSkuData[field].regExp] - let message = appendRefreshGoodsSkuData[field].message - - if (batchOperation[field] && (isNaN(batchOperation[field]) || !reg.test(batchOperation[field]))) { - ElMessage({ - type: 'warning', - message: message - }) - return - } - } - - // 设置全部规格 - formData.skuCheckedCities.forEach((key: any) => { - if (batchOperation.price) goodsSkuData[key].price = batchOperation.price - if (batchOperation.market_price) goodsSkuData[key].market_price = batchOperation.market_price - if (batchOperation.cost_price) goodsSkuData[key].cost_price = batchOperation.cost_price - if (batchOperation.stock) goodsSkuData[key].stock = batchOperation.stock - - for (let field in appendRefreshGoodsSkuData) { - if (batchOperation[field]) goodsSkuData[key][field] = batchOperation[field] - } - - if (batchOperation.sku_no) goodsSkuData[key].sku_no = batchOperation.sku_no - }) - - // 保存完清空 - batchOperation.price = '' - batchOperation.market_price = '' - batchOperation.cost_price = '' - batchOperation.stock = '' - batchOperation.sku_no = '' - - for (let field in appendRefreshGoodsSkuData) { - batchOperation[field] = ''; - } - } - - // 正则表达式 - const regExp: any = { - required: /[\S]+/, - number: /^\d{0,10}$/, - digit: /^\d{0,10}(.?\d{0,2})$/, - special: /^\d{0,10}(.?\d{0,3})$/ - } - - // 表单验证规则 - const formRules = computed(() => { - let rules = { - goods_name: [ - { - required: true, - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (value === '') { - callback(new Error(t('goodsNamePlaceholder'))) - } - if (value.length > 60) { - callback(new Error(t('goodsNameMaxLengthTips'))) - } else { - callback() - } - } - } - ], - sub_title: [ - { - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (value.length > 100) { - callback(new Error(t('subTitleMaxLengthTips'))) - } else { - callback() - } - } - } - ], - goods_image: [ - { required: true, message: t('goodsImagePlaceholder'), trigger: 'blur' } - ], - goods_category: [ - { required: true, message: t('goodsCategoryPlaceholder'), trigger: 'blur' } - ], - sort: [ - { - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (isNaN(value) || !regExp.number.test(value)) { - callback(new Error(t('sortTips'))) - } else { - callback() - } - } - } - ], - // unit: [ - // {required: true, message: t('unitPlaceholder'), trigger: 'blur'} - // ], - // 单规格 - price: [ - { - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (formData.spec_type == 'single') { - if (value === '') { - callback(new Error(t('pricePlaceholder'))) - } else if (isNaN(value) || !regExp.digit.test(value)) { - callback(new Error(t('priceTips'))) - } else if (value < 0) { - callback(new Error(t('priceNotZeroTips'))) - } else { - callback() - } - } else { - callback() - } - } - } - ], - market_price: [ - { - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (formData.spec_type == 'single') { - if (isNaN(value) || !regExp.digit.test(value)) { - callback(new Error(t('marketPriceTips'))) - } else if (value < 0) { - callback(new Error(t('marketPriceNotZeroTips'))) - } else { - callback() - } - } else { - callback() - } - } - } - ], - cost_price: [ - { - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (formData.spec_type == 'single') { - if (isNaN(value) || !regExp.digit.test(value)) { - callback(new Error(t('costPriceTips'))) - } else if (value < 0) { - callback(new Error(t('costPriceNotZeroTips'))) - } else { - callback() - } - } else { - callback() - } - } - } - ], - stock: [ - { - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (formData.spec_type == 'single') { - if (value === '') { - callback(new Error(t('stockPlaceholder'))) - } else if (isNaN(value) || !regExp.number.test(value)) { - callback(new Error(t('stockTips'))) - } else if (value < 0) { - callback(new Error(t('stockNotZeroTips'))) - } else { - callback() - } - } else { - callback() - } - } - } - ], - virtual_sale_num: [ - { - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (formData.spec_type == 'single') { - if (isNaN(value) || !regExp.number.test(value)) { - callback(new Error(t('virtualSaleNumTips'))) - } else if (value < 0) { - callback(new Error(t('virtualSaleNumNotZeroTips'))) - } else { - callback() - } - } else { - callback() - } - } - } - ], - // 多规格 - spec_type: [ - { - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (formData.spec_type == 'multi') { - if (Object.keys(goodsSkuData).length == 0) { - callback(new Error(t('pleaseEditSpecPlaceholder'))) - } - } - callback() - } - } - ], - max_buy: [ - { - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (value === '') { - callback(new Error(t('maxBuyPlaceholder'))) - } else if (isNaN(value) || !regExp.number.test(value)) { - callback(new Error(t('maxBuyTips'))) - } else if (value < 1) { - callback(new Error(t('maxBuyNotZeroTips'))) - } else { - callback() - } - } - } - ], - min_buy: [ - { - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (isNaN(value) || !regExp.number.test(value)) { - callback(new Error(t('minBuyFormatErrorTips'))) - } else if (value < 0) { - callback(new Error(t('minBuyNotZeroTips'))) - } else if (formData.is_limit == 1 && value > Number(formData.max_buy)) { - callback(new Error(t('minBuyGreaterThanMaxBuyTips'))) - } else { - callback() - } - } - } - ], - goods_desc: [ - { - required: true, - trigger: ['blur', 'change'], - validator: (rule: any, value: any, callback: any) => { - if (value === '') { - callback(new Error(t('goodsDescPlaceholder'))) - } else if (value.length < 5 || value.length > 50000) { - callback(new Error(t('goodsDescMaxTips'))) - return false - } else { - callback() - } - } - } - ] - }; - - if (getFormRules) { - Object.assign(rules, getFormRules(formData, regExp)); - } - - return rules; - }) - - // 多规格,销售价 验证规则 - const skuPriceRules = () => { - return [{ - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (formData.spec_type == 'multi') { - if (value.length == 0) { - callback(t('pricePlaceholder')) - } else if (isNaN(value) || !regExp.digit.test(value)) { - callback(t('priceTips')) - } else if (value < 0) { - callback(t('priceNotZeroTips')) - } else { - callback(); - } - } else { - callback(); - } - - } - }] - }; - - // 多规格,划线价 验证规则 - const skuMarketPriceRules = () => { - return [{ - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (formData.spec_type == 'multi') { - if (isNaN(value) || !regExp.digit.test(value)) { - callback(t('marketPriceTips')) - } else if (value < 0) { - callback(t('marketPriceNotZeroTips')) - } else { - callback(); - } - } else { - callback(); - } - } - }] - } - - // 多规格,成本价 验证规则 - const skuCostPriceRules = () => { - return [{ - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (formData.spec_type == 'multi') { - if (isNaN(value) || !regExp.digit.test(value)) { - callback(t('costPriceTips')) - } else if (value < 0) { - callback(t('costPriceNotZeroTips')) - } else { - callback(); - } - } else { - callback(); - } - } - }] - } - - // 多规格,库存 验证规则 - const skuStockRules = () => { - return [{ - trigger: 'blur', - validator: (rule: any, value: any, callback: any) => { - if (formData.spec_type == 'multi') { - if (value.length == 0) { - callback(t('stockPlaceholder')) - } else if (isNaN(value) || !regExp.number.test(value)) { - callback(t('stockTips')) - } else if (value < 0) { - callback(t('stockNotZeroTips')) - } else { - callback(); - } - - } else { - callback(); - } - - } - }] - } - - const verify = (callback: any) => { - let formRef = [ - { - key: 'basic', - verify: false, - ref: formRefArr.basicFormRef - }, - { - key: 'price_stock', - verify: false, - ref: formRefArr.priceStockFormRef - }, - { - key: 'price_stock', - verify: false, - ref: formRefArr.skuFormRef - }, - { - key: 'price_stock', - verify: false, - ref: formRefArr.priceStockCommonFormRef - } - ]; - formRef = formRef.concat(verifyArr); - - // 调整验证顺序 -- 详情验证 - let obj = { - key: 'detail', - verify: false, - ref: formRefArr.detailFormRef - }; - formRef.push(obj) - - formRef.forEach((el: any, index) => { - el.ref.validate((valid: any) => { - el.verify = valid - }) - }) - - if (formData.spec_type == 'multi') { - let specVerify = true - let repeatSpecNameArr: any = []; - let repeatSpecValueNameArr: any = []; - for (let i = 0; i < goodsSpecFormat.length; i++) { - const spec = goodsSpecFormat[i] - if (Test.require(spec.spec_name)) { - specVerify = false - ElMessage({ type: 'warning', message: `${ t('specNameRequire') }` }) - break - } - if (repeatSpecNameArr.indexOf(spec.spec_name) > -1) { - specVerify = false - ElMessage({ type: 'warning', message: `${ t('specNameRepeat') }` }) - break - } else { - repeatSpecNameArr.push(spec.spec_name); - } - - if (spec.values.length) { - for (let v = 0; v < spec.values.length; v++) { - const value = spec.values[v] - if (Test.require(value.spec_value_name)) { - specVerify = false - ElMessage({ type: 'warning', message: `${ t('specValueRequire') }` }) - break - } - - if (repeatSpecValueNameArr.indexOf(value.spec_value_name) > -1) { - specVerify = false - ElMessage({ type: 'warning', message: `${ t('specValueNameRepeat') }` }) - break - } else { - repeatSpecValueNameArr.push(value.spec_value_name); - } - } - } else { - specVerify = false - ElMessage({ type: 'warning', message: `${ t('specValueRequire') }` }) - } - - if (!specVerify) break - } - - if (!specVerify) { - activeName.value = 'price_stock' - return - } - - let isHasDefaultSpec = false; // 是否存在默认规格 - for (const k in goodsSkuData) { - if (goodsSkuData[k].is_default) { - isHasDefaultSpec = true; - } - } - - if (!isHasDefaultSpec) { - activeName.value = 'price_stock' - ElMessage({ type: 'warning', message: `${ t('lackDefaultSpec') }` }) - return - } - } - - setTimeout(() => { - let verify = true - // 检测验证,并且定位tab页面 - for (let i = 0; i < formRef.length; i++) { - if (formRef[i].verify == false) { - activeName.value = formRef[i].key - verify = false - break - } - } - if (verify && callback) callback() - }, 10) - } - - // 保存数据 - const save = (callback: any = null) => { - verify(async() => { - - if (repeat.value) return - repeat.value = true - - const api = formData.goods_id ? editApi : addApi - const data = cloneDeep(formData) - const coverImage = data.goods_image.split(',')[0] - - const info = await getImageDimensions(coverImage) - data.goods_image_width = info ? info.width : 800 - data.goods_image_height = info ? info.height : 800 - - if (data.spec_type == 'multi') { - data.stock = 0 - for (const k in goodsSkuData) { - if (goodsSkuData[k].stock) data.stock += parseInt(goodsSkuData[k].stock) - } - } - - const goodsCategory: any = [] - data.goods_category.forEach((item: any) => { - if (typeof item == 'object') { - item.forEach((second: any) => { - if (goodsCategory.indexOf(second) == -1) { - goodsCategory.push(second) - } - }) - } else { - if (goodsCategory.indexOf(item) == -1) { - goodsCategory.push(item) - } - } - }) - - data.goods_category = goodsCategory - data.goods_sku_data = goodsSkuData - data.goods_spec_format = goodsSpecFormat - - /***** 商品参数-start ****/ - data.attr_format = []; - let attrFormat: any = deepClone(attrTableData); - attrFormat.forEach((item: any, index: any) => { - if (item.attr_value_name && item.select_child_val || item.attr_value_id > 0) { - let obj: any = {}; - obj.attr_id = item.attr_id - obj.attr_value_id = item.attr_value_id - obj.attr_value_name = item.attr_value_name - obj.type = item.type - obj.sort = item.sort ? item.sort : 0 - obj.attr_child_value_id = item.select_child_name - obj.attr_child_value_name = item.select_child_val - data.attr_format.push(obj); - } - }); - data.attr_format.sort((a: any, b: any) => { - return b.sort - a.sort - }); - /***** 商品参数-end ****/ - - if (callback) { - Object.assign(data, callback(data)); - } - - api(data).then((res: any) => { - repeat.value = false - router.push('/shop/goods/list') - }).catch(() => { - repeat.value = false - }) - }) - } - - const back = () => { - router.push('/shop/goods/list') - } - - const filterSpecial = (event: any) => { - event.target.value = event.target.value.replace(/[^\u4e00-\u9fa5a-zA-Z0-9\s]/g, '') - event.target.value = event.target.value.replace(/[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/g, '') - } - - const handleBlur = (e: any) => { - formRefArr.detailFormRef?.validateField('goods_desc') - } - - const goodsVerifyFn = (data: any) => { - if (!data.target.value) return false - const obj = { - goods_id: formData.goods_id, - sku_no: data.target.value - } - goodsVerify(obj).then((res) => { - - }) - } - - /******************** 商品参数-start ***************************/ - const attrOptions = reactive([]) - const getAttrListFn = () => { - getAttrList({}).then((res) => { - attrOptions.splice(0, attrOptions.length, ...res.data) - }) - } - - getAttrListFn(); - - const attrTableData: any = reactive([]) - - const attrChange = (attr_id_arr: any = [], isEdit: any = false) => { - if (attr_id_arr.length == 0) { - // 清空已选的商品参数模板 - let temporaryAttrData: any = deepClone(attrTableData); - temporaryAttrData = temporaryAttrData.filter((item: any) => item.attr_value_id < 0); - attrTableData.splice(0, attrTableData.length, ...temporaryAttrData); - } - - // 编辑初始化赋值 - const editInit = () => { - if (isEdit) { - attrTableData.forEach((item: any) => { - for (let i = 0; i < formData.attr_format.length; i++) { - if (formData.attr_format[i].attr_value_id == item.attr_value_id) { - item.select_child_name = formData.attr_format[i].attr_child_value_id - item.select_child_val = formData.attr_format[i].attr_child_value_name - item.sort = formData.attr_format[i].sort - break - } - } - }) - - for (let i = 0; i < formData.attr_format.length; i++) { - if (formData.attr_format[i].attr_value_id < 0) { - let item = formData.attr_format[i] - let obj: any = { - attr_id: item.attr_id, - attr_value_id: item.attr_value_id, - attr_value_name: item.attr_value_name, - sort: item.sort ? item.sort : 0, - type: "text", - select_child_name: item.attr_child_value_id, - select_child_val: item.attr_child_value_name - }; - attrTableData.push(obj); - } - } - - } - } - - if (attr_id_arr.length) { - getAttrList({ - attr_id_arr - }).then((res) => { - let data = res.data; - if (data && Object.keys(data).length) { - let temporaryData: any = deepClone(attrTableData); - temporaryData = temporaryData.filter((item: any) => { - if (item.attr_value_id > 0) { - return attr_id_arr.indexOf(item.attr_id) != -1 - } else { - return true; // 保留自定义添加的商品参数模板 - } - }); - - let formAttrIdArray = temporaryData.map((obj: any) => obj.attr_value_id); - - data.forEach((item: any) => { - if (item.attr_value_format) { - let attr_value_format = JSON.parse(item.attr_value_format) - - // 过滤已添加的商品参数模板 - if (formAttrIdArray.length) { - formAttrIdArray.forEach((id: any) => { - attr_value_format = attr_value_format.filter((child: any) => child.attr_value_id != id) - }) - } - - // 初始化 - attr_value_format.filter((child: any) => { - child.attr_id = item.attr_id - child.select_child_name = child.type == "checkbox" ? [] : '' - child.select_child_val = child.type == "checkbox" ? [] : '' - }); - - attr_value_format.sort((a: any, b: any) => { - return b.sort - a.sort - }); - - temporaryData = temporaryData.concat(attr_value_format); - attrTableData.splice(0, attrTableData.length, ...temporaryData); - } - }) - editInit(); - } - }) - } else { - editInit(); - } - } - - // 添加商品参数 - const addAttr = () => { - let obj: any = { - attr_id: '', - attr_value_id: "", - attr_value_name: "", - child: { - id: 1, - name: '' - }, - sort: 0, - type: "text", - select_child_name: '', - select_child_val: '' - }; - obj.attr_value_id = -Math.floor((new Date().getSeconds()) + Math.floor(new Date().getMilliseconds())); - obj.sort = attrTableData.length + 1; - attrTableData.push(obj); - } - - // 删除商品参数 - const delAttr = (index: any) => { - attrTableData.splice(index, 1); - } - - // 商品参数单选监听 - const attrRadioChange = (index: any, data: any) => { - attrTableData.forEach((item: any, index: any, array: any) => { - if (item.type == 'radio') { - item.child.forEach((childItem: any, childIndex: any) => { - if (childItem.id == data) { - array[index].select_child_name = childItem.id; - array[index].select_child_val = childItem.name; - } - }); - } - return item; - }); - } - - // 商品参数多选监听 - const attrCheckboxChange = (index: any, data: any) => { - attrTableData[index].select_child_val = [] - attrTableData[index].child.forEach((childItem: any, childIndex: any) => { - if (data.indexOf(childItem.id) > -1) { - attrTableData[index].select_child_val.push(childItem.name); - } - }); - } - - return { - formData, - - activeName, - tabHandleClick, - - goodsType, - changeGoodsType, - - goodsCategoryOptions, - goodsCategoryProps, - categoryHandleChange, - toGoodsCategoryEvent, - refreshGoodsCategory, - - brandOptions, - toGoodsBrandEvent, - refreshGoodsBrand, - - posterOptions, - toPosterEvent, - refreshGoodsPoster, - - detailTemplateOptions, - toDetailTemplateEvent, - refreshDetailTemplate, - - diyFormOptions, - toDiyFormEvent, - refreshDiyForm, - - labelOptions, - toGoodsLabelEvent, - refreshGoodsLabel, - - serviceOptions, - toGoodsServiceEvent, - refreshGoodsService, - - supplierOptions, - toSupplierEvent, - refreshSupplier, - - goodsSpecFormat, - goodsSkuData, - specData, - - generateRandom, - - isDisabledPrice, - addSpec, - deleteSpec, - addSpecValue, - specValueNameInputListener, - deleteSpecValue, - specValueIsDefaultChangeListener, - specStockSum, - - batchOperation, - skuHandleCheckAllChange, - handleCheckedCitiesChange, - saveBatch, - - regExp, - - formRules, - skuPriceRules, - skuMarketPriceRules, - skuCostPriceRules, - skuStockRules, - - handleGoodsInit, - save, - back, - filterSpecial, - handleBlur, - - attrOptions, - attrChange, - getAttrListFn, - attrTableData, - addAttr, - delAttr, - attrRadioChange, - attrCheckboxChange, - goodsVerifyFn - } -} diff --git a/niucloud/addon/shop/admin/views/goods/real_edit.vue b/niucloud/addon/shop/admin/views/goods/real_edit.vue deleted file mode 100644 index 5b408dab1..000000000 --- a/niucloud/addon/shop/admin/views/goods/real_edit.vue +++ /dev/null @@ -1,920 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/recycle.vue b/niucloud/addon/shop/admin/views/goods/recycle.vue deleted file mode 100644 index eb904d710..000000000 --- a/niucloud/addon/shop/admin/views/goods/recycle.vue +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/search_config.vue b/niucloud/addon/shop/admin/views/goods/search_config.vue deleted file mode 100644 index bd4524fbc..000000000 --- a/niucloud/addon/shop/admin/views/goods/search_config.vue +++ /dev/null @@ -1,318 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/service.vue b/niucloud/addon/shop/admin/views/goods/service.vue deleted file mode 100644 index 658a8faed..000000000 --- a/niucloud/addon/shop/admin/views/goods/service.vue +++ /dev/null @@ -1,157 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/goods/virtual_edit.vue b/niucloud/addon/shop/admin/views/goods/virtual_edit.vue deleted file mode 100644 index aa8e3ad59..000000000 --- a/niucloud/addon/shop/admin/views/goods/virtual_edit.vue +++ /dev/null @@ -1,747 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/index/index.vue b/niucloud/addon/shop/admin/views/index/index.vue deleted file mode 100644 index da9fbd086..000000000 --- a/niucloud/addon/shop/admin/views/index/index.vue +++ /dev/null @@ -1,398 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/coupon/add.vue b/niucloud/addon/shop/admin/views/marketing/coupon/add.vue deleted file mode 100644 index 347aa47e4..000000000 --- a/niucloud/addon/shop/admin/views/marketing/coupon/add.vue +++ /dev/null @@ -1,446 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-collection.vue b/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-collection.vue deleted file mode 100644 index 6ceff3533..000000000 --- a/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-collection.vue +++ /dev/null @@ -1,199 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-select-content.vue b/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-select-content.vue deleted file mode 100644 index 41eed8a80..000000000 --- a/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-select-content.vue +++ /dev/null @@ -1,164 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-send-popop.vue b/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-send-popop.vue deleted file mode 100644 index cb77f7fd0..000000000 --- a/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-send-popop.vue +++ /dev/null @@ -1,255 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-send-records.vue b/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-send-records.vue deleted file mode 100644 index 86720d09f..000000000 --- a/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-send-records.vue +++ /dev/null @@ -1,139 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-spread-popup.vue b/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-spread-popup.vue deleted file mode 100644 index 613027cd3..000000000 --- a/niucloud/addon/shop/admin/views/marketing/coupon/components/coupon-spread-popup.vue +++ /dev/null @@ -1,107 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/coupon/components/select-member.vue b/niucloud/addon/shop/admin/views/marketing/coupon/components/select-member.vue deleted file mode 100644 index 2504e57d4..000000000 --- a/niucloud/addon/shop/admin/views/marketing/coupon/components/select-member.vue +++ /dev/null @@ -1,298 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/coupon/edit.vue b/niucloud/addon/shop/admin/views/marketing/coupon/edit.vue deleted file mode 100644 index c5c5a58d6..000000000 --- a/niucloud/addon/shop/admin/views/marketing/coupon/edit.vue +++ /dev/null @@ -1,471 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/coupon/list.vue b/niucloud/addon/shop/admin/views/marketing/coupon/list.vue deleted file mode 100644 index 9983132c4..000000000 --- a/niucloud/addon/shop/admin/views/marketing/coupon/list.vue +++ /dev/null @@ -1,390 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/discount/add.vue b/niucloud/addon/shop/admin/views/marketing/discount/add.vue deleted file mode 100644 index a12188bbb..000000000 --- a/niucloud/addon/shop/admin/views/marketing/discount/add.vue +++ /dev/null @@ -1,815 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/discount/components/discount-detail.vue b/niucloud/addon/shop/admin/views/marketing/discount/components/discount-detail.vue deleted file mode 100644 index c5bd7f470..000000000 --- a/niucloud/addon/shop/admin/views/marketing/discount/components/discount-detail.vue +++ /dev/null @@ -1,407 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/discount/components/goods-sku-popup.vue b/niucloud/addon/shop/admin/views/marketing/discount/components/goods-sku-popup.vue deleted file mode 100644 index dfa09579b..000000000 --- a/niucloud/addon/shop/admin/views/marketing/discount/components/goods-sku-popup.vue +++ /dev/null @@ -1,521 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/discount/config.vue b/niucloud/addon/shop/admin/views/marketing/discount/config.vue deleted file mode 100644 index 8cbe35851..000000000 --- a/niucloud/addon/shop/admin/views/marketing/discount/config.vue +++ /dev/null @@ -1,137 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/discount/detail.vue b/niucloud/addon/shop/admin/views/marketing/discount/detail.vue deleted file mode 100644 index d608d9b50..000000000 --- a/niucloud/addon/shop/admin/views/marketing/discount/detail.vue +++ /dev/null @@ -1,380 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/discount/edit.vue b/niucloud/addon/shop/admin/views/marketing/discount/edit.vue deleted file mode 100644 index 5205d1c6e..000000000 --- a/niucloud/addon/shop/admin/views/marketing/discount/edit.vue +++ /dev/null @@ -1,883 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/discount/list.vue b/niucloud/addon/shop/admin/views/marketing/discount/list.vue deleted file mode 100644 index 3edbe9515..000000000 --- a/niucloud/addon/shop/admin/views/marketing/discount/list.vue +++ /dev/null @@ -1,282 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/exchange/components/goods-select-content.vue b/niucloud/addon/shop/admin/views/marketing/exchange/components/goods-select-content.vue deleted file mode 100644 index 6b8616d78..000000000 --- a/niucloud/addon/shop/admin/views/marketing/exchange/components/goods-select-content.vue +++ /dev/null @@ -1,182 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/exchange/components/goods-select-popup.vue b/niucloud/addon/shop/admin/views/marketing/exchange/components/goods-select-popup.vue deleted file mode 100644 index 80258d483..000000000 --- a/niucloud/addon/shop/admin/views/marketing/exchange/components/goods-select-popup.vue +++ /dev/null @@ -1,169 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/exchange/components/goods-sku-select.vue b/niucloud/addon/shop/admin/views/marketing/exchange/components/goods-sku-select.vue deleted file mode 100644 index eb7933f50..000000000 --- a/niucloud/addon/shop/admin/views/marketing/exchange/components/goods-sku-select.vue +++ /dev/null @@ -1,101 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/exchange/goods_add.vue b/niucloud/addon/shop/admin/views/marketing/exchange/goods_add.vue deleted file mode 100644 index 21331b91e..000000000 --- a/niucloud/addon/shop/admin/views/marketing/exchange/goods_add.vue +++ /dev/null @@ -1,846 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/exchange/goods_edit.vue b/niucloud/addon/shop/admin/views/marketing/exchange/goods_edit.vue deleted file mode 100644 index df7fb4d5b..000000000 --- a/niucloud/addon/shop/admin/views/marketing/exchange/goods_edit.vue +++ /dev/null @@ -1,802 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/exchange/goods_list.vue b/niucloud/addon/shop/admin/views/marketing/exchange/goods_list.vue deleted file mode 100644 index 171830db9..000000000 --- a/niucloud/addon/shop/admin/views/marketing/exchange/goods_list.vue +++ /dev/null @@ -1,356 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/exchange/order_list.vue b/niucloud/addon/shop/admin/views/marketing/exchange/order_list.vue deleted file mode 100644 index dcecce28b..000000000 --- a/niucloud/addon/shop/admin/views/marketing/exchange/order_list.vue +++ /dev/null @@ -1,225 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/goods_rank/components/rank-select-popup.vue b/niucloud/addon/shop/admin/views/marketing/goods_rank/components/rank-select-popup.vue deleted file mode 100644 index f2ec57222..000000000 --- a/niucloud/addon/shop/admin/views/marketing/goods_rank/components/rank-select-popup.vue +++ /dev/null @@ -1,281 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/goods_rank/config.vue b/niucloud/addon/shop/admin/views/marketing/goods_rank/config.vue deleted file mode 100644 index fe9241f5e..000000000 --- a/niucloud/addon/shop/admin/views/marketing/goods_rank/config.vue +++ /dev/null @@ -1,130 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/goods_rank/edit.vue b/niucloud/addon/shop/admin/views/marketing/goods_rank/edit.vue deleted file mode 100644 index f285235a2..000000000 --- a/niucloud/addon/shop/admin/views/marketing/goods_rank/edit.vue +++ /dev/null @@ -1,511 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/goods_rank/list.vue b/niucloud/addon/shop/admin/views/marketing/goods_rank/list.vue deleted file mode 100644 index f5ca5b998..000000000 --- a/niucloud/addon/shop/admin/views/marketing/goods_rank/list.vue +++ /dev/null @@ -1,286 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/index.vue b/niucloud/addon/shop/admin/views/marketing/index.vue deleted file mode 100644 index 07e77f1dd..000000000 --- a/niucloud/addon/shop/admin/views/marketing/index.vue +++ /dev/null @@ -1,97 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/manjian/detail.vue b/niucloud/addon/shop/admin/views/marketing/manjian/detail.vue deleted file mode 100644 index e7a1f76d1..000000000 --- a/niucloud/addon/shop/admin/views/marketing/manjian/detail.vue +++ /dev/null @@ -1,288 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/manjian/edit.vue b/niucloud/addon/shop/admin/views/marketing/manjian/edit.vue deleted file mode 100644 index a163d117c..000000000 --- a/niucloud/addon/shop/admin/views/marketing/manjian/edit.vue +++ /dev/null @@ -1,866 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/manjian/list.vue b/niucloud/addon/shop/admin/views/marketing/manjian/list.vue deleted file mode 100644 index 88f694d0b..000000000 --- a/niucloud/addon/shop/admin/views/marketing/manjian/list.vue +++ /dev/null @@ -1,295 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/newcomer/config.vue b/niucloud/addon/shop/admin/views/marketing/newcomer/config.vue deleted file mode 100644 index bf11be6a2..000000000 --- a/niucloud/addon/shop/admin/views/marketing/newcomer/config.vue +++ /dev/null @@ -1,495 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/marketing/newcomer/order_list.vue b/niucloud/addon/shop/admin/views/marketing/newcomer/order_list.vue deleted file mode 100644 index 94d02292b..000000000 --- a/niucloud/addon/shop/admin/views/marketing/newcomer/order_list.vue +++ /dev/null @@ -1,293 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/member/components/benefits-free-shipping.vue b/niucloud/addon/shop/admin/views/member/components/benefits-free-shipping.vue deleted file mode 100644 index e4b80c2a9..000000000 --- a/niucloud/addon/shop/admin/views/member/components/benefits-free-shipping.vue +++ /dev/null @@ -1,63 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/member/components/gift-coupon.vue b/niucloud/addon/shop/admin/views/member/components/gift-coupon.vue deleted file mode 100644 index 194c23c3f..000000000 --- a/niucloud/addon/shop/admin/views/member/components/gift-coupon.vue +++ /dev/null @@ -1,168 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/member/components/growth-rule-buygoods.vue b/niucloud/addon/shop/admin/views/member/components/growth-rule-buygoods.vue deleted file mode 100644 index 176e02f2d..000000000 --- a/niucloud/addon/shop/admin/views/member/components/growth-rule-buygoods.vue +++ /dev/null @@ -1,113 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/member/components/growth-rule-buyorder.vue b/niucloud/addon/shop/admin/views/member/components/growth-rule-buyorder.vue deleted file mode 100644 index 846827acb..000000000 --- a/niucloud/addon/shop/admin/views/member/components/growth-rule-buyorder.vue +++ /dev/null @@ -1,99 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/member/components/point-rule-buygoods.vue b/niucloud/addon/shop/admin/views/member/components/point-rule-buygoods.vue deleted file mode 100644 index fe7ba6257..000000000 --- a/niucloud/addon/shop/admin/views/member/components/point-rule-buygoods.vue +++ /dev/null @@ -1,113 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/member/components/point-rule-orderdeduction.vue b/niucloud/addon/shop/admin/views/member/components/point-rule-orderdeduction.vue deleted file mode 100644 index c599a6f47..000000000 --- a/niucloud/addon/shop/admin/views/member/components/point-rule-orderdeduction.vue +++ /dev/null @@ -1,113 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/member/components/recharge-detail-coupon.vue b/niucloud/addon/shop/admin/views/member/components/recharge-detail-coupon.vue deleted file mode 100644 index 93b655144..000000000 --- a/niucloud/addon/shop/admin/views/member/components/recharge-detail-coupon.vue +++ /dev/null @@ -1,95 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/member/components/recharge-gift-coupon.vue b/niucloud/addon/shop/admin/views/member/components/recharge-gift-coupon.vue deleted file mode 100644 index e25915230..000000000 --- a/niucloud/addon/shop/admin/views/member/components/recharge-gift-coupon.vue +++ /dev/null @@ -1,187 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/order/batch_delivery.vue b/niucloud/addon/shop/admin/views/order/batch_delivery.vue deleted file mode 100644 index 1ab9ab207..000000000 --- a/niucloud/addon/shop/admin/views/order/batch_delivery.vue +++ /dev/null @@ -1,187 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/order/components/adjust-money.vue b/niucloud/addon/shop/admin/views/order/components/adjust-money.vue deleted file mode 100644 index 76aeecb6d..000000000 --- a/niucloud/addon/shop/admin/views/order/components/adjust-money.vue +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/order/components/delivery-action.vue b/niucloud/addon/shop/admin/views/order/components/delivery-action.vue deleted file mode 100644 index b693ae11d..000000000 --- a/niucloud/addon/shop/admin/views/order/components/delivery-action.vue +++ /dev/null @@ -1,631 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/order/components/delivery-package.vue b/niucloud/addon/shop/admin/views/order/components/delivery-package.vue deleted file mode 100644 index 38f0ab72d..000000000 --- a/niucloud/addon/shop/admin/views/order/components/delivery-package.vue +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/order/components/electronic-sheet-print.vue b/niucloud/addon/shop/admin/views/order/components/electronic-sheet-print.vue deleted file mode 100644 index 55f5f2f7a..000000000 --- a/niucloud/addon/shop/admin/views/order/components/electronic-sheet-print.vue +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/order/components/form-detail.vue b/niucloud/addon/shop/admin/views/order/components/form-detail.vue deleted file mode 100644 index 0abb5dc4e..000000000 --- a/niucloud/addon/shop/admin/views/order/components/form-detail.vue +++ /dev/null @@ -1,54 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/order/components/import-data.vue b/niucloud/addon/shop/admin/views/order/components/import-data.vue deleted file mode 100644 index bcf50b07b..000000000 --- a/niucloud/addon/shop/admin/views/order/components/import-data.vue +++ /dev/null @@ -1,93 +0,0 @@ - - - diff --git a/niucloud/addon/shop/admin/views/order/components/invoice-detail.vue b/niucloud/addon/shop/admin/views/order/components/invoice-detail.vue deleted file mode 100644 index 10f3f7272..000000000 --- a/niucloud/addon/shop/admin/views/order/components/invoice-detail.vue +++ /dev/null @@ -1,133 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/order/components/invoice-dialog.vue b/niucloud/addon/shop/admin/views/order/components/invoice-dialog.vue deleted file mode 100644 index 44347bf84..000000000 --- a/niucloud/addon/shop/admin/views/order/components/invoice-dialog.vue +++ /dev/null @@ -1,82 +0,0 @@ - - - diff --git a/niucloud/addon/shop/admin/views/order/components/open-invoice.vue b/niucloud/addon/shop/admin/views/order/components/open-invoice.vue deleted file mode 100644 index 0245d0156..000000000 --- a/niucloud/addon/shop/admin/views/order/components/open-invoice.vue +++ /dev/null @@ -1,225 +0,0 @@ - - - diff --git a/niucloud/addon/shop/admin/views/order/components/order-detail.vue b/niucloud/addon/shop/admin/views/order/components/order-detail.vue deleted file mode 100644 index 325c349e1..000000000 --- a/niucloud/addon/shop/admin/views/order/components/order-detail.vue +++ /dev/null @@ -1,418 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/order/components/order-edit-address.vue b/niucloud/addon/shop/admin/views/order/components/order-edit-address.vue deleted file mode 100644 index 0d4b2b5d3..000000000 --- a/niucloud/addon/shop/admin/views/order/components/order-edit-address.vue +++ /dev/null @@ -1,549 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/order/components/order-export-select.vue b/niucloud/addon/shop/admin/views/order/components/order-export-select.vue deleted file mode 100644 index b6a7ac538..000000000 --- a/niucloud/addon/shop/admin/views/order/components/order-export-select.vue +++ /dev/null @@ -1,61 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/order/components/order-notes.vue b/niucloud/addon/shop/admin/views/order/components/order-notes.vue deleted file mode 100644 index 923bfc7ad..000000000 --- a/niucloud/addon/shop/admin/views/order/components/order-notes.vue +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/order/components/refund-detail.vue b/niucloud/addon/shop/admin/views/order/components/refund-detail.vue deleted file mode 100644 index 4b20e649f..000000000 --- a/niucloud/addon/shop/admin/views/order/components/refund-detail.vue +++ /dev/null @@ -1,540 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/order/components/shop-active-refund.vue b/niucloud/addon/shop/admin/views/order/components/shop-active-refund.vue deleted file mode 100644 index 908e2ab44..000000000 --- a/niucloud/addon/shop/admin/views/order/components/shop-active-refund.vue +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - diff --git a/niucloud/addon/shop/admin/views/order/config.vue b/niucloud/addon/shop/admin/views/order/config.vue deleted file mode 100644 index e873134a3..000000000 --- a/niucloud/addon/shop/admin/views/order/config.vue +++ /dev/null @@ -1,320 +0,0 @@ - - - diff --git a/niucloud/addon/shop/admin/views/order/detail.vue b/niucloud/addon/shop/admin/views/order/detail.vue deleted file mode 100644 index 5935ce1ed..000000000 --- a/niucloud/addon/shop/admin/views/order/detail.vue +++ /dev/null @@ -1,519 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/order/invoice.vue b/niucloud/addon/shop/admin/views/order/invoice.vue deleted file mode 100644 index 475dac914..000000000 --- a/niucloud/addon/shop/admin/views/order/invoice.vue +++ /dev/null @@ -1,307 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/order/list.vue b/niucloud/addon/shop/admin/views/order/list.vue deleted file mode 100644 index 105fb84f4..000000000 --- a/niucloud/addon/shop/admin/views/order/list.vue +++ /dev/null @@ -1,717 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/order/refund.vue b/niucloud/addon/shop/admin/views/order/refund.vue deleted file mode 100644 index f15e6c057..000000000 --- a/niucloud/addon/shop/admin/views/order/refund.vue +++ /dev/null @@ -1,290 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/poster/components/edit-goods-image.vue b/niucloud/addon/shop/admin/views/poster/components/edit-goods-image.vue deleted file mode 100644 index d8fe1eff0..000000000 --- a/niucloud/addon/shop/admin/views/poster/components/edit-goods-image.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/poster/components/edit-goods-market-price.vue b/niucloud/addon/shop/admin/views/poster/components/edit-goods-market-price.vue deleted file mode 100644 index d8fe1eff0..000000000 --- a/niucloud/addon/shop/admin/views/poster/components/edit-goods-market-price.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/poster/components/edit-goods-name.vue b/niucloud/addon/shop/admin/views/poster/components/edit-goods-name.vue deleted file mode 100644 index d8fe1eff0..000000000 --- a/niucloud/addon/shop/admin/views/poster/components/edit-goods-name.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/poster/components/edit-goods-price.vue b/niucloud/addon/shop/admin/views/poster/components/edit-goods-price.vue deleted file mode 100644 index d8fe1eff0..000000000 --- a/niucloud/addon/shop/admin/views/poster/components/edit-goods-price.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/poster/components/preview-goods-image.vue b/niucloud/addon/shop/admin/views/poster/components/preview-goods-image.vue deleted file mode 100644 index d48aab0b3..000000000 --- a/niucloud/addon/shop/admin/views/poster/components/preview-goods-image.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/poster/components/preview-goods-market-price.vue b/niucloud/addon/shop/admin/views/poster/components/preview-goods-market-price.vue deleted file mode 100644 index 85d0f9ec2..000000000 --- a/niucloud/addon/shop/admin/views/poster/components/preview-goods-market-price.vue +++ /dev/null @@ -1,44 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/poster/components/preview-goods-name.vue b/niucloud/addon/shop/admin/views/poster/components/preview-goods-name.vue deleted file mode 100644 index 0f02a4e25..000000000 --- a/niucloud/addon/shop/admin/views/poster/components/preview-goods-name.vue +++ /dev/null @@ -1,47 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/poster/components/preview-goods-price.vue b/niucloud/addon/shop/admin/views/poster/components/preview-goods-price.vue deleted file mode 100644 index 3fbbe3a0b..000000000 --- a/niucloud/addon/shop/admin/views/poster/components/preview-goods-price.vue +++ /dev/null @@ -1,48 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/printer/components/preview-goods-order.vue b/niucloud/addon/shop/admin/views/printer/components/preview-goods-order.vue deleted file mode 100644 index 0da9185fc..000000000 --- a/niucloud/addon/shop/admin/views/printer/components/preview-goods-order.vue +++ /dev/null @@ -1,128 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/sow_community/components/sow-community-gift-coupon.vue b/niucloud/addon/shop/admin/views/sow_community/components/sow-community-gift-coupon.vue deleted file mode 100644 index 99978832f..000000000 --- a/niucloud/addon/shop/admin/views/sow_community/components/sow-community-gift-coupon.vue +++ /dev/null @@ -1,187 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/admin/views/stat/goods.vue b/niucloud/addon/shop/admin/views/stat/goods.vue deleted file mode 100644 index 8d8d6219d..000000000 --- a/niucloud/addon/shop/admin/views/stat/goods.vue +++ /dev/null @@ -1,564 +0,0 @@ - - - diff --git a/niucloud/addon/shop/admin/views/stat/index.vue b/niucloud/addon/shop/admin/views/stat/index.vue deleted file mode 100644 index 7d4a73cc0..000000000 --- a/niucloud/addon/shop/admin/views/stat/index.vue +++ /dev/null @@ -1,251 +0,0 @@ - - - diff --git a/niucloud/addon/shop/admin/views/stat/member.vue b/niucloud/addon/shop/admin/views/stat/member.vue deleted file mode 100644 index 52a651e4b..000000000 --- a/niucloud/addon/shop/admin/views/stat/member.vue +++ /dev/null @@ -1,193 +0,0 @@ - - - diff --git a/niucloud/addon/shop/admin/views/stat/order.vue b/niucloud/addon/shop/admin/views/stat/order.vue deleted file mode 100644 index a6935d38e..000000000 --- a/niucloud/addon/shop/admin/views/stat/order.vue +++ /dev/null @@ -1,302 +0,0 @@ - - - diff --git a/niucloud/addon/shop/admin/views/stat/visit.vue b/niucloud/addon/shop/admin/views/stat/visit.vue deleted file mode 100644 index 773378f70..000000000 --- a/niucloud/addon/shop/admin/views/stat/visit.vue +++ /dev/null @@ -1,254 +0,0 @@ - - - diff --git a/niucloud/addon/shop/app/adminapi/controller/Stat.php b/niucloud/addon/shop/app/adminapi/controller/Stat.php deleted file mode 100644 index 2b4241550..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/Stat.php +++ /dev/null @@ -1,93 +0,0 @@ -getStat()); - } - - /** - * 今日 - * @description 查看统计数据-今日 - * @return void - */ - public function today() { - return success(data: (new StatService())->getStat(date('Y-m-d', time())) ); - } - - /** - * 昨日 - * @description 查看统计数据-昨日 - * @return void - */ - public function yesterday() { - $yesterday = Carbon::yesterday(); - return success(data: (new StatService())->getStat(date('Y-m-d', $yesterday->getTimestamp())) ); - } - - /** - * 获取阶段统计数据 - * @description 查看统计数据-阶段统计数据 - * @return \think\Response - */ - public function stat() { - $data = $this->request->params([ - ['start_date', date('Y-m-d', strtotime('-6 day')) ], - ['end_date', date('Y-m-d', strtotime('+1 day'))] - ]); - return success(data: (new StatService())->getStatData($data['start_date'], $data['end_date'])); - } - - /** - * 获取统计数据按时段 - * @description 查看统计数据-统计数据按时段 - * @return \think\Response - */ - public function hourStat() { - $data = $this->request->params([ - ['date', date('Y-m-d', time()) ], - ]); - return success(data: (new StatService())->getHourStatData($data['date'])); - } - - /** - * 订单统计 - * @description 查看统计数据-订单 - * @return \think\Response - */ - public function order() { - return success(data: (new OrderService())->getOrderCount()); - } - - /** - * @description 查看统计数据-商品 - * @return \think\Response - * @throws \think\db\exception\DbException - */ - public function goods() - { - return success(data: (new GoodsService())->getGoodsCount()); - } -} diff --git a/niucloud/addon/shop/app/adminapi/controller/delivery/Company.php b/niucloud/addon/shop/app/adminapi/controller/delivery/Company.php deleted file mode 100644 index 0dff1acb7..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/delivery/Company.php +++ /dev/null @@ -1,126 +0,0 @@ -request->params([ - [ "company_name", "" ], - [ 'electronic_sheet_switch', '' ] - ]); - return success(( new CompanyService() )->getPage($data)); - } - - /** - * 获取物流公司列表 - * @description 查看物流公司列表-全部 - * @return \think\Response - */ - public function lists() - { - $data = $this->request->params([ - [ "company_name", "" ], - [ 'electronic_sheet_switch', '' ] - ]); - return success(( new CompanyService() )->getList($data)); - } - - /** - * 物流公司详情 - * @description 查看详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success(( new CompanyService() )->getInfo($id)); - } - - /** - * 添加物流公司 - * @description 添加 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "company_name", "" ], - [ "logo", "" ], - [ "url", "" ], - [ "express_no", "" ], // 物流公司编号(用于物流跟踪) - [ 'express_no_electronic_sheet', '' ], //快递鸟 物流公司编号(用于电子面单) - [ 'electronic_sheet_switch', 0 ], //快递鸟 是否支持电子面单(0:不支持,1:支持) - [ 'print_style', '' ], // 电子面单打印模板样式,template_size为空表示默认,json字符串,格式:[{"template_name":"二联150 100*150","template_size":""},{"template_name":"二联180 100*180","template_size":"180"}] - [ 'exp_type', '' ], // 物流公司业务类型,json字符串,格式:[{"value":1,"text":"特快专递"},{"value":8,"text":"代收到付"},{"value":9,"text":"快递包裹"}] - [ "kd100_express_no", "" ], // 快递100 物流公司编号(用于物流跟踪) - [ 'kd100_express_no_electronic_sheet', '' ], // 快递100 物流公司编号(用于电子面单) - ]); - $this->validate($data, 'addon\shop\app\validate\delivery\Company.add'); - $id = ( new CompanyService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 物流公司编辑 - * @description 编辑 - * @param int $id 物流公司id - * @return \think\Response - */ - public function edit($id) - { - $data = $this->request->params([ - [ "company_name", "" ], - [ "logo", "" ], - [ "url", "" ], - [ "express_no", "" ], // 物流公司编号(用于物流跟踪) - [ 'express_no_electronic_sheet', '' ], //快递鸟 物流公司编号(用于电子面单) - [ 'electronic_sheet_switch', 0 ], //快递鸟 是否支持电子面单(0:不支持,1:支持) - [ 'print_style', '' ], // 电子面单打印模板样式,template_size为空表示默认,json字符串,格式:[{"template_name":"二联150 100*150","template_size":""},{"template_name":"二联180 100*180","template_size":"180"}] - [ 'exp_type', '' ], // 物流公司业务类型,json字符串,格式:[{"value":1,"text":"特快专递"},{"value":8,"text":"代收到付"},{"value":9,"text":"快递包裹"}] - [ "kd100_express_no", "" ], // 快递100 物流公司编号(用于物流跟踪) - [ 'kd100_express_no_electronic_sheet', '' ], // 快递100 物流公司编号(用于电子面单) - ]); - $this->validate($data, 'addon\shop\app\validate\delivery\Company.edit'); - ( new CompanyService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 物流公司删除 - * @description 删除 - * @param int $id 物流公司id - * @return \think\Response - */ - public function del(int $id) - { - ( new CompanyService() )->del($id); - return success('DELETE_SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/delivery/Delivery.php b/niucloud/addon/shop/app/adminapi/controller/delivery/Delivery.php deleted file mode 100644 index 056e866f6..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/delivery/Delivery.php +++ /dev/null @@ -1,70 +0,0 @@ -request->params([ - [ "value", "" ], - ]); - - ( new DeliveryService() )->setConfig($data[ 'value' ]); - return success('SUCCESS'); - } - - /** - * 配送页信息 - * @description 获取配送页信息 - * @return \think\Response - */ - public function getDelivery() - { - return success(( new DeliveryService() )->getDeliveryList()); - } - - /** - * 配送页信息 - * @description 获取配送页信息配置 - * @return \think\Response - */ - public function getDeliveryList() - { - return success(( new DeliveryService() )->getDeliveryConfigList()); - } - - /** - * 获取配送方式 - * @return \think\Response - */ - public function getDeliveryType() - { - return success(OrderDeliveryDict::getType()); - } -} diff --git a/niucloud/addon/shop/app/adminapi/controller/delivery/DeliverySearch.php b/niucloud/addon/shop/app/adminapi/controller/delivery/DeliverySearch.php deleted file mode 100644 index 1d35e0c1a..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/delivery/DeliverySearch.php +++ /dev/null @@ -1,53 +0,0 @@ -request->params([ - [ "interface_type", 1 ], - [ "kdniao_id", "" ], - [ "kdniao_app_key", "" ], - [ "kdniao_is_pay", 1 ], - [ "kd100_app_key", "" ], - [ "kd100_customer", "" ], - ]); - ( new DeliverySearchConfigService() )->setConfig($data); - return success('SUCCESS'); - } - - /** - * 获取配置 - * @description 查看物流查询配置 - * @return \think\Response - */ - public function getConfig() - { - return success(( new DeliverySearchConfigService() )->getConfig()); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/adminapi/controller/delivery/ElectronicSheet.php b/niucloud/addon/shop/app/adminapi/controller/delivery/ElectronicSheet.php deleted file mode 100644 index 040829dd0..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/delivery/ElectronicSheet.php +++ /dev/null @@ -1,226 +0,0 @@ -request->params([ - [ "template_name", "" ], - [ "express_company_id", "" ], - [ "is_notice", "" ], - [ "status", "" ], - ]); - $field = 'id,template_name,express_company_id,customer_name,pay_type,is_notice,status,is_default,create_time'; - return success(( new ElectronicSheetService() )->getPage($data, $field)); - } - - /** - * @description 查看电子面单列表 - * @return \think\Response - */ - public function lists() - { - $data = $this->request->params([ - [ "template_name", "" ], - [ "express_company_id", "" ], - [ "is_notice", "" ], - [ "status", "" ], - ]); - $field = 'id,template_name,express_company_id,customer_name,pay_type,is_notice,status,is_default,create_time'; - return success(( new ElectronicSheetService() )->getList($data, $field)); - } - - /** - * @description 电子面单详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success(( new ElectronicSheetService() )->getInfo($id)); - } - - /** - * 添加电子面单 - * @description 添加电子面单 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "template_name", "" ], - [ "express_company_id", 0 ], - [ "customer_name", "" ], - [ "customer_pwd", "" ], - [ "send_site", "" ], - [ "send_staff", "" ], - [ "month_code", "" ], - [ "pay_type", 0 ], - [ "is_notice", 0 ], - [ "status", 0 ], - [ 'exp_type', 0 ], - [ "print_style", "" ], - [ "is_default", 0 ], -// [ "kd100_customer_name", "" ], -// [ "kd100_customer_pwd", "" ], -// [ "kd100_send_site", "" ], -// [ "kd100_send_staff", "" ], -// [ "kd100_month_code", "" ], -// [ "kd100_pay_type", 0 ], - ]); - $this->validate($data, 'addon\shop\app\validate\delivery\ElectronicSheet.add'); - $id = ( new ElectronicSheetService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 电子面单编辑 - * @description 编辑电子面单 - * @param $id 电子面单id - * @return \think\Response - */ - public function edit(int $id) - { - $data = $this->request->params([ - [ "template_name", "" ], - [ "express_company_id", 0 ], - [ "customer_name", "" ], - [ "customer_pwd", "" ], - [ "send_site", "" ], - [ "send_staff", "" ], - [ "month_code", "" ], - [ "pay_type", 0 ], - [ "is_notice", 0 ], - [ "status", 0 ], - [ 'exp_type', 0 ], - [ "print_style", "" ], - [ "is_default", 0 ], -// [ "kd100_customer_name", "" ], -// [ "kd100_customer_pwd", "" ], -// [ "kd100_send_site", "" ], -// [ "kd100_send_staff", "" ], -// [ "kd100_month_code", "" ], -// [ "kd100_pay_type", 0 ], - ]); - $this->validate($data, 'addon\shop\app\validate\delivery\ElectronicSheet.edit'); - ( new ElectronicSheetService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 电子面单删除 - * @description 删除电子面单 - * @param $id 电子面单id - * @return \think\Response - */ - public function del(int $id) - { - ( new ElectronicSheetService() )->del($id); - return success('DELETE_SUCCESS'); - } - - /** - * 电子面单设置默认模板 - * @description 电子面单设置默认模板 - * @param int $id - * @return array|\think\Response - */ - public function setDefault(int $id) - { - ( new ElectronicSheetService() )->setDefault($id); - return success('EDIT_SUCCESS'); - } - - /** - * 设置 电子面单配置 - * @description 设置电子面单配置 - * @return array|\think\Response - */ - public function setConfig() - { - $data = $this->request->params([ - [ "interface_type", "" ], - [ "kdniao_id", "" ], - [ "kdniao_api_key", "" ], - [ 'server_port1', '8000' ], - [ 'server_port2', '18000' ], - [ 'https_port', '8443' ], - [ "kd100_key", "" ], - [ "kd100_secret", "" ], - ]); - ( new ElectronicSheetService() )->setConfig($data); - return success(); - } - - /** - * 获取 电子面单设置 - * @description 查看电子面单设置 - * @return array|\think\Response - */ - public function getConfig() - { - return success(( new ElectronicSheetService() )->getConfig()); - } - - /** - * @description 查看邮费支付方式类型 - * @return array|\think\Response - */ - public function getPayType() - { - return success(( new ElectronicSheetService() )->getPayType()); - } - - /** - * 打印电子面单 - * @description 打印电子面单 - * @return array|\think\Response - */ - public function printElectronicSheet() - { - $data = $this->request->params([ - [ 'print_type', 'single' ], // 打印方式,single:单订单,multiple:多订单 - [ 'order_id', '' ], // 订单id - [ 'electronic_sheet_id', 0 ], // 电子面单id - [ 'order_goods_ids', '' ], - [ 'list', [] ] // 多个包裹,格式:[{ delivery_id : 0, electronic_sheet_id : 0 }] -// [ 'is_delivery', 0 ], // 是否发货 todo 后续扩展 - ]); - $res = ( new ElectronicSheetService() )->printElectronicSheet($data); - if (count($res) == 1) { - if ($res[ 0 ][ 'success' ]) { - return success($res); - } else { - return fail('[' . $res[ 0 ][ 'result_code' ] . '] ' . $res[ 0 ][ 'reason' ], [], $res[ 0 ][ 'result_code' ]); - } - } else { - return success($res); - } - - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/delivery/Local.php b/niucloud/addon/shop/app/adminapi/controller/delivery/Local.php deleted file mode 100644 index eeb259c18..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/delivery/Local.php +++ /dev/null @@ -1,85 +0,0 @@ -getLocal()); - } - - /** - * @description 设置配置 - * @return \think\Response - */ - public function setLocal() - { - $data = $this->request->params([ - ['center', []], - ['fee_type', ''], - ['base_dist', 0], - ['base_price', 0], - ['grad_dist', 0], - ['grad_price', 0], - ['weight_start', 0], - ['weight_unit', 0], - ['weight_price', 0], - ['delivery_type', ''], - ['area', []], - - ['time_is_open', 0], - ['time_type', 0], - ['time_week', ''], - ['time_interval', 30], - ['advance_day', 0], - ['most_day', 7], - ['start_time', 0], - ['end_time', 0], - ['delivery_time', ''], - - ['third_party_config', []] - ]); - return success(data: (new LocalService())->setLocal($data)); - } - - /** - * @description 查看三方配送初始化信息 - * @return \think\Response - */ - public function getThirdPartyInit() - { - return success((new LocalService())->getThirdTypeConfig()); - } - - public function thirdDeliveryCallback($type, $order_no) - { - $params = $this->request->all(); - $params['type'] = $type; - $params['order_no'] = $order_no; - (new LocalService())->thirdDeliveryCallback($params); - } -} diff --git a/niucloud/addon/shop/app/adminapi/controller/delivery/ShippingTemplate.php b/niucloud/addon/shop/app/adminapi/controller/delivery/ShippingTemplate.php deleted file mode 100644 index ffae9bf36..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/delivery/ShippingTemplate.php +++ /dev/null @@ -1,105 +0,0 @@ -request->params([ - [ 'template_name', '' ], - ]); - return success(( new ShippingTemplateService() )->getPage($data)); - } - - /** - * 运费模板列表 - * @description 查看运费模板列表 - * @return void - */ - public function lists() - { - $data = $this->request->params([ - [ 'template_name', '' ], - ]); - return success(( new ShippingTemplateService() )->getList($data)); - } - - /** - * 运费模板详情 - * @description 查看运费模板详情 - * @param int $template_id - * @return void - */ - public function info(int $template_id) - { - return success(( new ShippingTemplateService() )->getInfo($template_id)); - } - - /** - * 添加运费模板 - * @description 添加运费模板 - * @return void - */ - public function add() - { - $data = $this->request->params([ - [ 'template_name', '' ], - [ 'fee_type', '' ], - [ 'area', [] ], - [ 'no_delivery', 0 ], - [ 'is_free_shipping', 0 ] - ]); - return success('ADD_SUCCESS', ( new ShippingTemplateService() )->add($data)); - } - - /** - * 编辑运费模板 - * @description 编辑运费模板 - * @return void - */ - public function edit(int $template_id) - { - $data = $this->request->params([ - [ 'template_name', '' ], - [ 'fee_type', '' ], - [ 'area', [] ], - [ 'no_delivery', 0 ], - [ 'is_free_shipping', 0 ] - ]); - return success('EDIT_SUCCESS', ( new ShippingTemplateService() )->edit($template_id, $data)); - } - - /** - * 删除模板 - * @description 删除运费模板 - * @param int $template_id - * @return \think\Response - */ - public function del(int $template_id) - { - return success('DELETE_SUCCESS', ( new ShippingTemplateService() )->delete($template_id)); - } -} diff --git a/niucloud/addon/shop/app/adminapi/controller/delivery_store/DeliveryService.php b/niucloud/addon/shop/app/adminapi/controller/delivery_store/DeliveryService.php deleted file mode 100644 index 4d4a627ea..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/delivery_store/DeliveryService.php +++ /dev/null @@ -1,63 +0,0 @@ -deliveryServiceList($id)); - } - - /** - * 配送门店开通配送服务 - * @return Response - */ - public function deliveryServiceOpen($id) - { - $data = $this->request->params([ - ['delivery_type', ''], - ['business', ''], - ['extend_data', []] - ]); - (new DeliveryServiceService())->deliveryServiceOpen($id, $data); - return success('SUCCESS'); - } - - /** - * 配送门店品类修改 - * @return Response - */ - public function deliveryServiceEdit($id) - { - $data = $this->request->params([ - ['delivery_type', ''], - ['business', ''] - ]); - (new DeliveryServiceService())->deliveryServiceEdit($id, $data); - return success('SUCCESS'); - } -} diff --git a/niucloud/addon/shop/app/adminapi/controller/delivery_store/DeliveryStore.php b/niucloud/addon/shop/app/adminapi/controller/delivery_store/DeliveryStore.php deleted file mode 100644 index f689153bf..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/delivery_store/DeliveryStore.php +++ /dev/null @@ -1,177 +0,0 @@ -getInitInfo()); - } - - /** - * 获取提货点列表 - * @description 查看提货点列表详情 - * @return \think\Response - */ - public function lists() - { - $data = $this->request->params([ - ['store_name', ''], - ['pick_up_type', ''],//提货类型 - ['create_time', [] ] - ]); - return success(( new DeliveryStoreService() )->getPage($data)); - } - - /** - * 提货点详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success(( new DeliveryStoreService() )->getInfo($id)); - } - - - /** - * 添加提货点 - * @description 添加提货点 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - ['pick_up_type', ''],//提货类型 - ['store_name', ''],//门店名称 - ['store_logo', ''],//门店logo - ['contact_name', ''], - ['store_mobile', ''], - [ 'province_id',0 ], - [ 'city_id',0 ], - [ 'district_id',0 ], - ['address', ''], - ['full_address', ''], - ['longitude', ''], - ['latitude', ''], - ['trade_time', ''], - ['time_is_open', ''], - ['time_week', [] ],//周数组 - ['time_interval', ''],//间隔时间段 单位分钟 - ['trade_time_json', [] ],//营业时间 - [ 'area', [] ],//配送区域 - ['status', 0 ] - ]); - $this->validate($data, 'addon\shop\app\validate\delivery\Store.add'); - $id = ( new DeliveryStoreService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 提货点编辑 - * @description 编辑提货点 - * @param int $id 提货点id - * @return \think\Response - */ - public function edit(int $id) - { - $data = $this->request->params([ - ['pick_up_type', ''],//提货类型 - ['store_name', ''],//门店名称 - ['store_logo', ''],//门店logo - ['contact_name', ''], - ['store_mobile', ''], - [ 'province_id',0 ], - [ 'city_id',0 ], - [ 'district_id',0 ], - ['address', ''], - ['full_address', ''], - ['longitude', ''], - ['latitude', ''], - ['trade_time', ''], - ['time_is_open', ''], - ['time_week', [] ],//周数组 - ['time_interval', ''],//间隔时间段 单位分钟 - ['trade_time_json', [] ],//营业时间 - [ 'area', [] ],//配送区域 - ['status', 0 ] - ]); - $this->validate($data, 'addon\shop\app\validate\delivery\Store.edit'); - ( new DeliveryStoreService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 提货点删除 - * @description 删除提货点 - * @param int $id 提货点id - * @return \think\Response - */ - public function del(int $id) - { - ( new DeliveryStoreService() )->del($id); - return success('DELETE_SUCCESS'); - } - - /** - * @description 查看提货点列表-全部 - * @return \think\Response - */ - public function getList() - { - $data = $this->request->params([ - ['keyword', ''], - ['pick_up_type', '' ] - ]); - return success(( new DeliveryStoreService() )->getList($data)); - } - - /** - * @description 提货点提货类型 - * @return \think\Response - */ - public function getPickUpType() - { - return success(( new DeliveryStoreService() )->getPickUpType()); - } - - /** - * 修改社区分类状态 - * @return \think\Response - */ - public function modifyStatus() - { - $data = $this->request->params([ - [ 'store_id', '' ], - [ 'status', '' ], - ]); - ( new DeliveryStoreService() )->modifyStatus($data); - return success('SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/goods/Attr.php b/niucloud/addon/shop/app/adminapi/controller/goods/Attr.php deleted file mode 100644 index 41a2fc3d5..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/goods/Attr.php +++ /dev/null @@ -1,158 +0,0 @@ -request->params([ - [ "attr_name", "" ], - [ 'order', '' ], - [ 'sort', '' ] - ]); - return success(( new AttrService() )->getPage($data)); - } - - /** - * 获取商品参数分页列表 - * @description 查看商品参数列表-全部 - * @return \think\Response - */ - public function lists() - { - $data = $this->request->params([ - [ 'attr_id_arr', [] ], - [ "attr_name", "" ], - [ 'order', '' ], - [ 'sort', '' ] - ]); - return success(( new AttrService() )->getList($data)); - } - - /** - * 商品参数详情 - * @description 查看商品参数详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success(( new AttrService() )->getInfo($id)); - } - - /** - * 添加商品参数 - * @description 添加商品参数 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "attr_name", "" ], - [ "attr_value_format", "" ], - [ "sort", 0 ] - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Attr.add'); - $id = ( new AttrService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 商品参数编辑 - * @description 编辑商品参数模板 - * @param $id 商品参数id - * @return \think\Response - */ - public function edit(int $id) - { - $data = $this->request->params([ - [ "attr_name", "" ], - [ "sort", 0 ] - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Attr.edit'); - ( new AttrService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 商品参数删除 - * @description 删除商品参数模板 - * @param int $id 商品参数id - * @return \think\Response - */ - public function del(int $id) - { - ( new AttrService() )->del($id); - return success('DELETE_SUCCESS'); - } - - /** - * 修改商品排序号 - * @description 修改商品参数排序 - * @return \think\Response - */ - public function modifySort() - { - $data = $this->request->params([ - [ 'attr_id', '' ], - [ 'sort', '' ], - ]); - ( new AttrService() )->modifySort($data); - return success('SUCCESS'); - } - - /** - * 修改商品参数名称 - * @description 修改商品参数名称 - * @return \think\Response - */ - public function modifyAttrName() - { - $data = $this->request->params([ - [ 'attr_id', '' ], - [ 'attr_name', '' ], - ]); - ( new AttrService() )->modifyAttrName($data); - return success('SUCCESS'); - } - - /** - * 修改商品参数值 - * @description 修改商品参数值 - * @return \think\Response - */ - public function modifyAttrValueFormat() - { - $data = $this->request->params([ - [ 'attr_id', '' ], - [ 'attr_value_format', '' ], - ]); - ( new AttrService() )->modifyAttrValueFormat($data); - return success('SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/goods/Brand.php b/niucloud/addon/shop/app/adminapi/controller/goods/Brand.php deleted file mode 100644 index 54b0eda6b..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/goods/Brand.php +++ /dev/null @@ -1,125 +0,0 @@ -request->params([ - [ "brand_name","" ], - [ 'order', '' ], - [ 'sort', '' ] - ]); - return success((new BrandService())->getPage($data)); - } - - /** - * 获取商品品牌列表 - * @description 查看商品列表-全部 - * @return \think\Response - */ - public function lists(){ - $data = $this->request->params([ - ["brand_name",""] - ]); - return success((new BrandService())->getList($data)); - } - - /** - * 商品品牌详情 - * @description 查看详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id){ - return success((new BrandService())->getInfo($id)); - } - - /** - * 添加商品品牌 - * @description 添加商品品牌 - * @return \think\Response - */ - public function add(){ - $data = $this->request->params([ - ["brand_name",""], - ["logo",""], - ["desc",""], - ["sort",0], - ["color_json",""], - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Brand.add'); - $id = (new BrandService())->add($data); - return success('ADD_SUCCESS', ['id' => $id]); - } - - /** - * 商品品牌编辑 - * @description 编辑商品品牌 - * @param $id 商品品牌id - * @return \think\Response - */ - public function edit($id){ - $data = $this->request->params([ - ["brand_name",""], - ["logo",""], - ["desc",""], - ["sort",0], - ["color_json",""], - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Brand.edit'); - (new BrandService())->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 商品品牌删除 - * @description 删除商品品牌 - * @param $id 商品品牌id - * @return \think\Response - */ - public function del(int $id){ - (new BrandService())->del($id); - return success('DELETE_SUCCESS'); - } - - /** - * 修改排序 - * @description 编辑品牌排序 - * @return \think\Response - */ - public function modifySort() - { - $data = $this->request->params([ - [ 'brand_id', '' ], - [ 'sort', '' ], - ]); - ( new BrandService() )->modifySort($data); - return success('SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/goods/Category.php b/niucloud/addon/shop/app/adminapi/controller/goods/Category.php deleted file mode 100644 index ff5231b2d..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/goods/Category.php +++ /dev/null @@ -1,176 +0,0 @@ -request->params([ - [ "category_name", "" ] - ]); - return success(( new CategoryService() )->getPage($data)); - } - - /** - * 获取商品分类列表 - * @description 查看商品分类列表-全部 - * @return \think\Response - */ - public function lists() - { - $data = $this->request->params([ - [ "category_name", "" ], - [ 'level', '' ] - ]); - return success(( new CategoryService() )->getList($data)); - } - - /** - * 获取商品分类树结构 - * @description 查看商品分类树结构-树结构 - * @return \think\Response - */ - public function tree() - { - return success(( new CategoryService() )->getTree()); - } - - /** - * 商品分类详情 - * @description 查看商品分类详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success(( new CategoryService() )->getInfo($id)); - } - - /** - * 添加商品分类 - * @description 添加商品分类 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "category_name", "" ], - [ "image", "" ], - [ "pid", 0 ], - [ "is_show", 0 ], - [ "sort", 0 ] - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Category.add'); - $id = ( new CategoryService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 商品分类编辑 - * @description 编辑商品分类 - * @param $id 商品分类id - * @return \think\Response - */ - public function edit($id) - { - $data = $this->request->params([ - [ "category_name", "" ], - [ "image", "" ], - [ "pid", 0 ], - [ "is_show", 0 ], - [ "sort", '' ] - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Category.edit'); - ( new CategoryService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 商品分类删除 - * @description 删除商品分类 - * @param $id 商品分类id - * @return \think\Response - */ - public function del(int $id) - { - ( new CategoryService() )->del($id); - return success('DELETE_SUCCESS'); - } - - /** - * 拖拽修改分类 - * @description 拖拽修改分类排序 - */ - public function editCategory() - { - $data = $this->request->params([ - [ "category_sort_array", [] ] - ]); - ( new CategoryService() )->updateCategory($data); - return success('SUCCESS'); - } - - /** - * 设置商品分类配置 - * @description 设置商品分类配置 - * @return \think\Response - */ - public function setGoodsCategoryConfig() - { - $data = $this->request->params([ - [ "level", "" ], - [ "template", "" ], - [ "page_title", "" ], - [ "search", "" ], - [ "goods", "" ], - [ "sort", "" ], - [ "cart", '' ], - ]); - ( new CategoryService() )->setGoodsCategoryConfig($data); - return success('SUCCESS'); - } - - /** - * 获取商品分类配置 - * @description 查看商品分类配置 - * @return \think\Response - */ - public function getGoodsCategoryConfig() - { - return success(( new CategoryService() )->getGoodsCategoryConfig()); - } - - /** - * 获取商品分类树结构供弹框调用 - * @description 获取商品分类树结构供弹框调用-树结构 - * @return \think\Response - */ - public function components() - { - return success(( new CategoryService() )->getTreeComponents()); - } -} diff --git a/niucloud/addon/shop/app/adminapi/controller/goods/Config.php b/niucloud/addon/shop/app/adminapi/controller/goods/Config.php deleted file mode 100644 index 5af6cc31d..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/goods/Config.php +++ /dev/null @@ -1,98 +0,0 @@ -getSearchConfig()); - } - - /** - * 设置搜索配置 - * @description 设置搜索配置 - * @return \think\Response - */ - public function setSearchConfig() - { - - $data = $this->request->params([ - [ "default_word", "" ], - [ "search_words", "" ] - ]); - ( new ConfigService() )->setSearchConfig($data); - return success('SUCCESS'); - } - - /** - * 获取商品唯一编码配置 - * @description 获取商品唯一编码配置 - * @return \think\Response - */ - public function getUniqueConfig() - { - - return success(( new ConfigService() )->getUniqueConfig()); - } - - /** - * 设置商品唯一编码配置 - * @description 设置商品唯一编码配置 - * @return \think\Response - */ - public function setUniqueConfig() - { - $data = $this->request->params([ - [ "is_enable", 0 ] - ]); - ( new ConfigService() )->setUniqueConfig($data); - return success('SUCCESS'); - } - - - /** - * 获取商品排序配置 - * @description 查看商品排序配置 - * @return \think\Response - */ - public function getSortConfig() - { - return success(( new ConfigService() )->getSortConfig()); - } - - /** - * 设置商品排序配置 - * @description 设置商品排序配置 - * @return \think\Response - */ - public function setSortConfig() - { - $data = $this->request->params([ - [ "sort_type", GoodsDict::SORT_TYPE_ASC ], - [ "sort_column", GoodsDict::SORT_COLUMN_SORT ], - [ "default_sort", 0 ], - ]); - ( new ConfigService() )->setSortConfig($data); - return success('SUCCESS'); - } -} diff --git a/niucloud/addon/shop/app/adminapi/controller/goods/Evaluate.php b/niucloud/addon/shop/app/adminapi/controller/goods/Evaluate.php deleted file mode 100644 index 3209651b3..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/goods/Evaluate.php +++ /dev/null @@ -1,214 +0,0 @@ -request->params([ - [ 'goods_name', '' ], - [ 'status', '' ], - ]); - return success(( new EvaluateService() )->getPage($data)); - } - - /** - * 商品评价详情 - * @param int $id - * @description 查看商品评价详情 - * @return \think\Response - */ - public function info(int $id) - { - return success(( new EvaluateService() )->getInfo($id)); - } - - /** - * 添加商品评价 - * @description 添加商品评价 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "goods_id", 0 ], - [ "member_head", "" ], - [ "member_name", "" ], - [ "content", "" ], - [ "images", "" ], - [ "is_anonymous", 0 ], - [ "scores", 0 ], - [ "is_show", 0 ], - [ "create_time", 0 ] - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Evaluate.add'); - $id = ( new EvaluateService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 商品评价删除 - * @description 删除商品评价 - * @param $id 商品评价id - * @return \think\Response - */ - public function del(int $id) - { - ( new EvaluateService() )->del($id); - return success('DELETE_SUCCESS'); - } - - /** - * 评价审核 - * @description 审核评价 - * @param $id - */ - public function evaluateAudit($id) - { - $data = $this->request->params([ - [ "is_audit", 0 ], - ]); - ( new EvaluateService() )->audit($id, $data); - - return success('SUCCESS'); - } - - /** - * 审核通过 - * @description 审核-通过评价 - * @param $id - * @return \think\Response - */ - public function adopt($id) - { - ( new EvaluateService() )->auditAdopt($id); - - return success('SUCCESS'); - } - - /** - * 审核拒绝 - * @description 审核-拒绝通过评价 - * @param $id - * @return \think\Response - */ - public function refuse($id) - { - ( new EvaluateService() )->auditRefuse($id); - - return success('SUCCESS'); - } - - /** - * 评价回复 - * @description 回复评价 - * @param $id - */ - public function evaluateReply($id) - { - $data = $this->request->params([ - [ "explain_first", '' ], - ]); - ( new EvaluateService() )->reply($id, $data); - - return success('SUCCESS'); - } - - /** - * 置顶 - * @description 置顶评价 - * @param $id - */ - public function topping($id) - { - ( new EvaluateService() )->topping($id); - - return success('SUCCESS'); - } - - /** - * 取消置顶 - * @description 取消置顶评价 - * @param $id - */ - public function cancelTopping($id) - { - ( new EvaluateService() )->cancelTopping($id); - - return success('SUCCESS'); - } - - /** - * 获取审核状态 - * @description 审核状态 - * @return \think\Response - */ - public function status() - { - return success(EvaluateDict::getStatus()); - } - - /** - * 批量通过 - * @description 批量通过 - */ - public function batchAdopt() - { - $data = $this->request->params([ - [ 'evaluate_ids', [] ], - ]); - ( new EvaluateService() )->batchAdopt($data['evaluate_ids']); - return success('SUCCESS'); - } - - /** - * 批量拒绝 - * @description 批量拒绝 - */ - public function batchRefuse() - { - $data = $this->request->params([ - [ 'evaluate_ids', [] ], - ]); - ( new EvaluateService() )->batchRefuse($data['evaluate_ids']); - return success('SUCCESS'); - } - - /** - * 批量删除 - * @description 批量删除 - */ - public function batchDel() - { - $data = $this->request->params([ - [ 'evaluate_ids', [] ], - ]); - ( new EvaluateService() )->batchDel($data['evaluate_ids']); - return success('SUCCESS'); - } -} diff --git a/niucloud/addon/shop/app/adminapi/controller/goods/Goods.php b/niucloud/addon/shop/app/adminapi/controller/goods/Goods.php deleted file mode 100644 index 958209a53..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/goods/Goods.php +++ /dev/null @@ -1,540 +0,0 @@ -request->params([ - ["goods_name", ""], - ["goods_category", ''], - ["goods_type", ""], - ["brand_id", ""], - ["label_ids", ""], - ["start_sale_num", ""], - ["end_sale_num", ""], - ["start_price", ""], - ["end_price", ""], - ["status", ""], - ['order', ''], - ['sort', ''] - ]); - return success((new GoodsService())->getPage($data)); - } - - /** - * 商品详情 - * @description 查看商品详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success((new GoodsService())->getInfo($id)); - } - - /** - * 获取商品添加/编辑数据 - * @description 获取初始化数据 - * @return \think\Response - */ - public function init() - { - $data = $this->request->params([ - ["goods_id", 0], - ]); - return success((new GoodsService())->getInit($data)); - } - - /** - * 添加商品 - * @description 添加商品 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - ["goods_name", ""], - ["sub_title", ""], - ["goods_type", ""], - ["goods_image", ""], - ["goods_image_width", ""], - ["goods_image_height", ""], - ["goods_video", ""], - ["goods_category", ''], - ["brand_id", 0], - ["label_ids", ""], - ['service_ids', ''], - ['supplier_id', 0], - ["status", 0], - ["sort", 0], - ['attr_ids', []], - ['attr_format', ''], - ['is_gift', 0], - - // 规格类型,single:单规格,multi:多规格 - ['spec_type', ''], - - // 单规格数据 - ["price", 0], - ["market_price", 0], - ["cost_price", 0], - ["price", 0], - ["weight", 0], - ["volume", 0], - ["stock", 0], - ["sku_no", ''], - ["unit", "件"], - ["virtual_sale_num", 0], - ["is_limit", 0], - ["limit_type", 1], - ["max_buy", 0], - ["min_buy", 0], - - // 多规格数据 - ['goods_spec_format', ''], - ['goods_sku_data', ''], - - // 配送设置 - ["delivery_type", ""], - ["is_free_shipping", 0], - ['fee_type', ''], - ['delivery_money', 0], - ["delivery_template_id", 0], - - // 商品详情 - ["goods_desc", "", false], - - ['member_discount', ''], // 会员等级折扣,不参与:空,会员折扣:discount,指定会员价:fixed_price - ['poster_id', 0], // 海报id - ['form_id', 0], // 万能表单id - ['diy_detail_id', 0] // 自定义详情id - ]); - - $this->validate($data, 'addon\shop\app\validate\goods\Goods.add'); - $id = (new GoodsService())->add($data); - return success('ADD_SUCCESS', ['id' => $id]); - } - - /** - * 商品编辑 - * @description 编辑商品 - * @param $id - * @return \think\Response - */ - public function edit($id) - { - $data = $this->request->params([ - ["goods_name", ""], - ["sub_title", ""], - ["goods_type", ""], - ["goods_image", ""], - ["goods_image_width", ""], - ["goods_image_height", ""], - ["goods_video", ""], - ["goods_category", ''], - ["brand_id", 0], - ["label_ids", ""], - ['service_ids', ''], - ['supplier_id', 0], - ["status", 0], - ["sort", 0], - ['attr_ids', []], - ['attr_format', ''], - ['is_gift', 0], - - // 规格类型,single:单规格,multi:多规格 - ['spec_type', ''], - - // 单规格数据 - ["price", 0], - ["market_price", 0], - ["cost_price", 0], - ["price", 0], - ["weight", 0], - ["volume", 0], - ["stock", 0], - ["sku_no", ''], - ["unit", "件"], - ["virtual_sale_num", 0], - ["is_limit", 0], - ["limit_type", 1], - ["max_buy", 0], - ["min_buy", 0], - - // 多规格数据 - ['goods_spec_format', ''], - ['goods_sku_data', ''], - - // 配送设置 - ["delivery_type", ""], - ["is_free_shipping", 0], - ['fee_type', ''], - ['delivery_money', 0], - ["delivery_template_id", 0], - - // 商品详情 - ["goods_desc", "", false], - - ['member_discount', ''], // 会员等级折扣,不参与:空,会员折扣:discount,指定会员价:fixed_price - - ['poster_id', 0], // 海报id - ['form_id', 0], // 万能表单id - ['diy_detail_id', 0] // 自定义详情id - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Goods.edit'); - $res = (new GoodsService())->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 商品删除 - * @description 删除商品 - * @return \think\Response - */ - public function del() - { - $data = $this->request->params([ - ['is_all', 0], - ['where', []], - ['goods_ids', ''],//is_all == 1时 goods_ids 为未选中的ID - ]); - (new GoodsService())->del($data); - return success('DELETE_SUCCESS'); - } - - /** - * 商品恢复 - * @description 恢复商品 - * @return \think\Response - */ - public function recycle() - { - $data = $this->request->params([ - ['goods_ids', ''], - ]); - (new GoodsService())->recycle($data['goods_ids']); - return success('SUCCESS'); - } - - /** - * 获取商品类型 - * @description 获取商品类型 - * @return \think\Response - */ - public function type() - { - return success((new GoodsService())->getType()); - } - - /** - * 修改商品排序号 - * @description 修改商品排序号 - * @return \think\Response - */ - public function editSort() - { - $data = $this->request->params([ - ['goods_id', ''], - ['sort', ''], - ]); - (new GoodsService())->editSort($data); - return success('SUCCESS'); - } - - /** - * 修改商品上下架状态 - * @description 修改商品上下架状态 - * @return \think\Response - */ - public function editStatus() - { - $data = $this->request->params([ - ['is_all', 0], - ['where', []], - ['goods_ids', ''], - ['status', ''], - ]); - (new GoodsService())->editStatus($data); - return success('SUCCESS'); - } - - /** - * 修改商品上下架状态(单商品) - * @description 修改商品上下架状态(单商品) - * @return \think\Response - */ - public function editSingleStatus() - { - $data = $this->request->params([ - ['goods_id', 0], - ['status', 0], - ]); - (new GoodsService())->editSingleStatus($data); - return success('SUCCESS'); - } - - /** - * 复制商品 - * @description 复制商品 - * @param int $goods_id - * @return \think\Response - */ - public function copy(int $goods_id) - { - (new GoodsService())->copy($goods_id); - return success('SUCCESS'); - } - - /** - * 获取回收站商品分页列表 - * @description 查看回收站商品分页列表 - * @return \think\Response - */ - public function recyclePages() - { - $data = $this->request->params([ - ["goods_name", ""], - ["goods_category", ''], - ["goods_type", ""], - ['order', ''], - ['sort', ''] - ]); - return success((new GoodsService())->getRecyclePage($data)); - } - - /** - * 商品选择分页列表(按照单商品) - * @description 获取商品选择分页列表(按照单商品) - * @return \think\Response - */ - public function select() - { - $data = $this->request->params([ - ['keyword', ''], // 搜索关键词 - ["goods_category", ""], // 商品分类 - ["goods_type", ""], // 商品分类 - ["select_type", "all"], // 商品分类 - ["start_price", ""], - ["end_price", ""], - ['goods_ids', []], // 已选商品id集合 - ['sku_ids', []], // 已选商品规格id集合 - ['verify_goods_ids', []], // 检测商品id集合是否存在,移除不存在的商品id,纠正数据准确性 - ['verify_sku_ids', []], // 检测商品规格id集合是否存在,移除不存在的商品规格id,纠正数据准确性 - ['is_gift', 0] // 是否查询赠品(0:不查赠品 1:查询赠品) - ]); - - return success((new GoodsService())->getSelectPage($data)); - } - - /** - * 商品选择分页列表(带sku) - * @return \think\Response - */ - public function selectGoodsSku() - { - $data = $this->request->params([ - ['keyword', ''], // 搜索关键词 - ["goods_category", ""], // 商品分类 - ["goods_type", ""], // 商品分类 - ['goods_ids', ''], // 已选商品id集合 - ['verify_goods_ids', ''], // 检测商品id集合是否存在,移除不存在的商品id,纠正数据准确性 - ['verify_sku_ids', []], // 检测商品规格id集合是否存在,移除不存在的商品规格id,纠正数据准确性 - ['is_gift', 0] // 是否查询赠品(0:不查赠品 1:查询赠品) - ]); - - return success((new GoodsService())->getSelectSku($data)); - } - - /** - * 商品选择分页列表(代客下单专用) - * @description 获取商品选择分页列表(代客下单专用) - * @return \think\Response - */ - public function buyGoodsSelect() - { - $data = $this->request->params([ - ['keyword', ''], // 搜索关键词 - ["goods_category", ""], // 商品分类 - ["goods_type", ""], // 商品分类 - ["member_id", 0], // 会员id - ]); - - return success((new GoodsService())->getBuyGoodsSelect($data)); - } - - /** - * 已选商品分页列表(代客下单专用) - * @description 获取已选商品分页列表(代客下单专用) - * @return \think\Response - */ - public function buyGoodsSelected() - { - $data = $this->request->params([ - ['sku_ids', []], - ['member_id', 0], - ]); - - return success((new GoodsService())->getBuyGoodsSelected($data)); - } - - /** - * 获取商品规格信息,切换规格(代客下单专用) - * @description 获取商品规格信息,切换规格(代客下单专用) - */ - public function buySkuSelect() - { - $data = $this->request->params([ - ['sku_id', 0], - ['member_id', 0], - ]); - return success((new GoodsService())->getBuySkuSelect($data)); - } - - /** - * 查询商品SKU规格列表 - * @description 查询商品SKU规格列表 - * @return \think\Response - */ - public function sku() - { - $data = $this->request->params([ - ['goods_id', ''] - ]); - - return success((new GoodsService())->getSkuList($data)); - } - - /** - * 编辑商品规格列表库存 - * @description 编辑商品规格列表库存 - * @return \think\Response - */ - public function editGoodsListStock() - { - $data = $this->request->params([ - ['goods_id', 0], - ['sku_list', ''] - ]); - (new GoodsService())->editGoodsListStock($data); - return success('EDIT_SUCCESS'); - } - - /** - * 编辑商品规格列表价格 - * @description 编辑商品规格列表库存 - * @return \think\Response - */ - public function editGoodsListPrice() - { - $data = $this->request->params([ - ['goods_id', 0], - ['sku_list', ''] - ]); - (new GoodsService())->editGoodsListPrice($data); - return success('EDIT_SUCCESS'); - } - - /** - * 编辑商品规格列表会员价格 - * @description 编辑商品规格列表会员价格 - * @return \think\Response - */ - public function editGoodsListMemberPrice() - { - $data = $this->request->params([ - ['goods_id', 0], - ['member_discount', ''], // 会员等级折扣,不参与:空,会员折扣:discount,指定会员价:fixed_price - ['sku_list', ''] - ]); - (new GoodsService())->editGoodsListMemberPrice($data); - return success('EDIT_SUCCESS'); - } - - /** - * 查询商品参与营销活动的数量 - * @description 查询商品参与营销活动的数量 - * @return \think\Response - */ - public function getActiveGoodsCount() - { - $data = $this->request->params([ - ['goods_id', ''] - ]); - - return success(data: (new GoodsService())->getActiveGoodsCount($data['goods_id'])); - } - - /** - * 批量设置商品 - * @description 批量设置商品 - * @return \think\Response - */ - public function batchSet() - { - $data = $this->request->params([ - ['is_all', 0], - ['goods_ids', []], - ['set_value', []], - ['set_type', ''], - ['where', []], - - ]); - (new GoodsService())->batchSet($data); - return success('EDIT_SUCCESS'); - } - - /** - * 获取批量设置类型 - * @description 获取批量设置类型 - * @return \think\Response - */ - public function getBatchSetDict() - { - return success((new GoodsService())->getBatchSetDict()); - } - - /** - * 验证商品编码是否重复 - * @description 验证商品编码是否重复 - * @return \think\Response - */ - public function verifySkuNo() - { - $params = $this->request->params( - [ - ['sku_no', ''], - ['goods_id', 0] - ]); - (new ConfigService())->verifySkuNo($params); - return success('SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/goods/Label.php b/niucloud/addon/shop/app/adminapi/controller/goods/Label.php deleted file mode 100644 index 60bfbbf67..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/goods/Label.php +++ /dev/null @@ -1,169 +0,0 @@ -request->params([ - [ "label_name", "" ], - [ 'group_id', 0 ], - [ 'order', '' ], - [ 'sort', '' ] - ]); - return success(( new LabelService() )->getPage($data)); - } - - /** - * 获取商品标签列表 - * @description 获取商品标签列表-全部 - * @return \think\Response - */ - public function lists() - { - $data = $this->request->params([ - [ "label_name", "" ] - ]); - return success(( new LabelService() )->getList($data)); - } - - /** - * 商品标签详情 - * @description 查看商品标签详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success(( new LabelService() )->getInfo($id)); - } - - /** - * 添加商品标签 - * @description 添加商品标签 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "label_name", "" ], - [ 'group_id', 0 ], - [ 'style_type', '' ], - [ 'color_json', '' ], - [ 'icon', '' ], - [ 'status', '' ], - [ "memo", "" ], - [ "sort", 0 ], - ]); - - $this->validate($data, 'addon\shop\app\validate\goods\Label.add'); - $id = ( new LabelService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 商品标签编辑 - * @description 编辑商品标签 - * @param $id `商品标签id` - * @return \think\Response - */ - public function edit($id) - { - $data = $this->request->params([ - [ "label_name", "" ], - [ 'group_id', 0 ], - [ 'style_type', '' ], - [ 'color_json', '' ], - [ 'icon', '' ], - [ 'status', '' ], - [ "memo", "" ], - [ "sort", 0 ], - - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Label.edit'); - ( new LabelService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 商品标签删除 - * @description 删除商品标签 - * @param $id 商品标签id - * @return \think\Response - */ - public function del(int $id) - { - ( new LabelService() )->del($id); - return success('DELETE_SUCCESS'); - } - - /** - * 修改排序 - * @description 修改商品标签排序 - * @return \think\Response - */ - public function modifySort() - { - $data = $this->request->params([ - [ 'label_id', '' ], - [ 'sort', '' ], - ]); - ( new LabelService() )->modifySort($data); - return success('SUCCESS'); - } - - /** - * 修改状态 - * @description 添加商品标签状态 - * @return \think\Response - */ - public function modifyStatus() - { - $data = $this->request->params([ - [ 'label_id', '' ], - [ 'status', '' ], - ]); - ( new LabelService() )->modifyStatus($data); - return success('SUCCESS'); - } - - /** - * 复制分类 - * @description 复制商品标签 - * @param int $id - * @return \think\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function copy(int $id) - { - (new LabelService())->copy($id); - return success('SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/goods/LabelGroup.php b/niucloud/addon/shop/app/adminapi/controller/goods/LabelGroup.php deleted file mode 100644 index c369423ab..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/goods/LabelGroup.php +++ /dev/null @@ -1,124 +0,0 @@ -request->params([ - [ "group_name", "" ], - [ 'order', '' ], - [ 'sort', '' ] - ]); - return success(( new LabelGroupService() )->getPage($data)); - } - - /** - * 获取商品标签分组列表 - * @description 获取商品标签分组列表-全部 - * @return \think\Response - */ - public function lists() - { - $data = $this->request->params([ - [ "group_name", "" ] - ]); - return success(( new LabelGroupService() )->getList($data)); - } - - /** - * 商品标签分组详情 - * @description 查看商品标签分组详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success(( new LabelGroupService() )->getInfo($id)); - } - - /** - * 添加商品标签分组 - * @description 添加商品标签分组 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "group_name", "" ], - [ "sort", 0 ], - ]); - $this->validate($data, 'addon\shop\app\validate\goods\LabelGroup.add'); - $id = ( new LabelGroupService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 商品标签分组编辑 - * @description 编辑商品标签分组 - * @param $id 商品标签分组id - * @return \think\Response - */ - public function edit($id) - { - $data = $this->request->params([ - [ "group_name", "" ], - [ "sort", 0 ], - ]); - $this->validate($data, 'addon\shop\app\validate\goods\LabelGroup.edit'); - ( new LabelGroupService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 商品标签分组删除 - * @description 删除商品标签分组 - * @param $id 商品标签分组id - * @return \think\Response - */ - public function del(int $id) - { - ( new LabelGroupService() )->del($id); - return success('DELETE_SUCCESS'); - } - - /** - * 修改排序 - * @description 修改商品标签分组排序 - * @return \think\Response - */ - public function modifySort() - { - $data = $this->request->params([ - [ 'group_id', '' ], - [ 'sort', '' ], - ]); - ( new LabelGroupService() )->modifySort($data); - return success('SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/goods/Rank.php b/niucloud/addon/shop/app/adminapi/controller/goods/Rank.php deleted file mode 100644 index da7389a21..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/goods/Rank.php +++ /dev/null @@ -1,214 +0,0 @@ -request->params([ -// [ "rank_name", "" ], - [ "rank_images", "" ], -// [ "rank_remark", "" ], - [ "no_color", "" ], - [ "select_color", "" ], - [ "select_bg_color_start", "" ], - [ "select_bg_color_end", "" ], - ]); - ( new RankService() )->setGoodsRankConfig($data); - return success('SUCCESS'); - } - - /** - * 获取商品排行配置 - * @description 查看商品排行配置 - * @return \think\Response - */ - public function getRankConfig() - { - return success(( new RankService() )->getGoodsRankConfig()); - } - - /** - * 获取商品排行榜分页列表 - * @description 查看商品排行榜列表-分页 - * @return \think\Response - */ - public function pages() - { - $data = $this->request->params([ - [ "name", "" ], - [ "rank_type", "" ], - [ 'order', '' ], - [ 'sort', '' ] - ]); - return success(( new RankService() )->getPage($data)); - } - - /** - * 添加商品排行榜 - * @description 添加商品排行榜 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "name", "" ], - [ "rank_type", '' ], - [ "goods_source", '' ], - [ "rule_type", '' ], - [ "goods_json", [] ], - [ "category_ids", [] ], - [ "brand_ids", [] ], - [ "label_ids", [] ], - [ "sort", 0 ], - [ "status", 1 ], - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Rank.add'); - $id = ( new RankService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 编辑商品排行榜 - * @description 编辑商品排行榜 - * @param int $id 排行榜id - * @return \think\Response - */ - public function edit($id) - { - $data = $this->request->params([ - [ "name", "" ], - [ "rank_type", '' ], - [ "goods_source", '' ], - [ "rule_type", '' ], - [ "goods_json", [] ], - [ "category_ids", [] ], - [ "brand_ids", [] ], - [ "label_ids", [] ], - [ "sort", 0 ], - [ "status", 1 ], - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Rank.edit'); - ( new RankService() )->edit($id, $data); - return success('EDIT_SUCCESS', [ 'id' => $id ]); - } - - /** - * 商品排行榜详情 - * @description 查看商品排行榜详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success(( new RankService() )->getInfo($id)); - } - - /** - * 删除 - * @description 删除商品排行榜 - * @param int $id 排行榜id - * @return \think\Response - */ - public function del(int $id) - { - ( new RankService() )->del($id); - return success('DELETE_SUCCESS'); - } - - /** - * 商品排行榜选项列表 - * @description 商品排行榜选项列表 - * @param int $id - * @return \think\Response - */ - public function getOptionData() - { - return success(( new RankService() )->getOptionData()); - } - - /** - * 修改榜单排序号 - * @description 修改榜单排序号 - * @return \think\Response - */ - public function editSort() - { - $data = $this->request->params([ - [ "rank_id", "" ], - [ "sort", 0 ], - ]); - ( new RankService() )->editSort($data); - return success('EDIT_SUCCESS'); - } - - /** - * 批量删除 - * @description 批量删除商品排行榜 - * @param int $id - * @return \think\Response - */ - public function batchDelete() - { - $data = $this->request->params([ - [ "rank_id", [] ], - ]); - ( new RankService() )->batchDelete($data); - return success('DELETE_SUCCESS'); - } - - /** - * 获取排行榜分页列表(用于弹框选择) - * @description 获取排行榜分页列表 - * @return \think\Response - */ - public function select() - { - $data = $this->request->params([ - [ "name", "" ], - [ "rank_type", "" ], - [ "verify_rank_ids", [] ], - ]); - return success(( new RankService() )->getSelectPage($data)); - } - - /** - * 修改状态 - * @description 修改商品排行榜状态 - * @return \think\Response - */ - public function modifyStatus() - { - $data = $this->request->params([ - [ 'rank_id', '' ], - [ 'status', '' ], - ]); - ( new RankService() )->modifyStatus($data); - return success('SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/goods/Service.php b/niucloud/addon/shop/app/adminapi/controller/goods/Service.php deleted file mode 100644 index 46a033948..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/goods/Service.php +++ /dev/null @@ -1,109 +0,0 @@ -request->params([ - [ "service_name", "" ] - ]); - return success(( new ServiceService() )->getPage($data)); - } - - /** - * 获取商品服务列表 - * @description 查看商品服务列表-全部 - * @return \think\Response - */ - public function lists() - { - $data = $this->request->params([ - [ "service_name", "" ] - ]); - return success(( new ServiceService() )->getList($data)); - } - - /** - * 商品服务详情 - * @description 查看商品服务详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success(( new ServiceService() )->getInfo($id)); - } - - /** - * 添加商品服务 - * @description 添加商品服务 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "service_name", "" ], - [ "image", "" ], - [ "desc", "" ], - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Service.add'); - $id = ( new ServiceService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 商品服务编辑 - * @description 编辑服务编辑 - * @param $id 商品服务id - * @return \think\Response - */ - public function edit($id) - { - $data = $this->request->params([ - [ "service_name", "" ], - [ "image", "" ], - [ "desc", "" ], - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Service.edit'); - ( new ServiceService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 商品服务删除 - * @description 删除服务编辑 - * @param $id 商品服务id - * @return \think\Response - */ - public function del(int $id) - { - ( new ServiceService() )->del($id); - return success('DELETE_SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/goods/Statistics.php b/niucloud/addon/shop/app/adminapi/controller/goods/Statistics.php deleted file mode 100644 index a5217c347..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/goods/Statistics.php +++ /dev/null @@ -1,96 +0,0 @@ -request->params([ - [ "date", "" ], - ]); - return success(( new StatisticsService() )->getBasic($data)); - } - - /** - * 获取商品统计图表信息 - * @description 查看商品统计图表信息 - * @return \think\Response - */ - public function getTrend() - { - $data = $this->request->params([ - [ "date", "" ], - ]); - return success(( new StatisticsService() )->getTrend($data)); - } - - /** - * 获取商品排行榜信息 - * @description 查看商品排行榜信息 - * @return \think\Response - */ - public function getRank() - { - $data = $this->request->params([ - [ "category_ids", []], - [ "type", "access_num"], - [ "date", "" ], - [ "goods_name", "" ], - ]); - return success(( new StatisticsService() )->getRank($data)); - } - - /** - * 获取商品排行榜统计类型 - * @description 获取商品排行榜统计类型 - * @return \think\Response - */ - public function getType() - { - $data = $this->request->params([ - ]); - return success(( new StatisticsService() )->getType($data)); - } - - /** - * 同步商品统计信息 - * @description 同步商品统计信息 - * @return \think\Response - */ - public function syncStatGoods() - { - $data = $this->request->params([ - [ "date", [] ], - ]); - return success(( new StatisticsService() )->syncStatGoods($data['date'])); - } - - - - - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/goods/VirtualGoods.php b/niucloud/addon/shop/app/adminapi/controller/goods/VirtualGoods.php deleted file mode 100644 index 56552f567..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/goods/VirtualGoods.php +++ /dev/null @@ -1,172 +0,0 @@ -request->params([ - [ "goods_id", 0 ], - ]); - return success(( new VirtualGoodsService() )->getInit($data)); - } - - /** - * 添加商品 - * @description 添加虚拟商品 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "goods_name", "" ], - [ "sub_title", "" ], - [ "goods_type", "" ], - [ "goods_image", "" ], - ["goods_image_width", ""], - ["goods_image_height", ""], - [ "goods_video", "" ], - [ "goods_category", '' ], - [ "brand_id", 0 ], - [ "label_ids", "" ], - [ 'service_ids', '' ], - [ 'supplier_id', 0 ], - [ "status", 0 ], - [ "sort", 0 ], - [ 'attr_ids', 0 ], - [ 'attr_format', '' ], - [ 'is_gift', 0 ], - - // 规格类型,single:单规格,multi:多规格 - [ 'spec_type', '' ], - - // 单规格数据 - [ "price", 0 ], - [ "market_price", 0 ], - [ "cost_price", 0 ], - [ "price", 0 ], - [ "stock", 0 ], - [ "sku_no", '' ], - [ "unit", "件" ], - [ "virtual_sale_num", 0 ], - [ "is_limit", 0 ], - [ "limit_type", 1 ], - [ "max_buy", 0 ], - [ "min_buy", 0 ], - - // 多规格数据 - [ 'goods_spec_format', '' ], - [ 'goods_sku_data', '' ], - - // 收发货设置 - [ 'virtual_auto_delivery', 0 ], // 虚拟商品是否自动发货 - [ 'virtual_receive_type', 'artificial' ], // 虚拟商品收货方式,auto:自动收货,artificial:买家确认收货,verify:到店核销 - [ 'virtual_verify_type', 0 ], // 虚拟商品核销有效期类型,0:不限,1:购买后几日有效,2:指定过期日期 - [ 'virtual_indate', 0 ], // 虚拟到期时间 - - // 商品详情 - [ "goods_desc", "" ], - - [ 'member_discount', '' ], // 会员等级折扣,不参与:空,会员折扣:discount,指定会员价:fixed_price - [ 'poster_id', 0 ], // 海报id - ['form_id', 0], // 万能表单id - ['diy_detail_id', 0] // 自定义详情id - ]); - - $this->validate($data, 'addon\shop\app\validate\goods\Goods.add'); - $id = ( new VirtualGoodsService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 商品编辑 - * @description 编辑虚拟商品 - * @param $id 商品id - * @return \think\Response - */ - public function edit($id) - { - $data = $this->request->params([ - [ "goods_name", "" ], - [ "sub_title", "" ], - [ "goods_type", "" ], - [ "goods_image", "" ], - ["goods_image_width", ""], - ["goods_image_height", ""], - [ "goods_video", "" ], - [ "goods_category", '' ], - [ "brand_id", 0 ], - [ "label_ids", "" ], - [ 'service_ids', '' ], - [ 'supplier_id', 0 ], - [ "status", 0 ], - [ "sort", 0 ], - [ 'attr_ids', 0 ], - [ 'attr_format', '' ], - [ 'is_gift', 0 ], - - // 规格类型,single:单规格,multi:多规格 - [ 'spec_type', '' ], - - // 单规格数据 - [ "price", 0 ], - [ "market_price", 0 ], - [ "cost_price", 0 ], - [ "price", 0 ], - [ "stock", 0 ], - [ "sku_no", '' ], - [ "unit", "件" ], - [ "virtual_sale_num", 0 ], - [ "is_limit", 0 ], - [ "limit_type", 1 ], - [ "max_buy", 0 ], - [ "min_buy", 0 ], - - // 多规格数据 - [ 'goods_spec_format', '' ], - [ 'goods_sku_data', '' ], - - // 收发货设置 - [ 'virtual_auto_delivery', 0 ], // 虚拟商品是否自动发货 - [ 'virtual_receive_type', 'artificial' ], // 虚拟商品收货方式,auto:自动收货,artificial:买家确认收货,verify:到店核销 - [ 'virtual_verify_type', 0 ], // 虚拟商品核销有效期类型,0:不限,1:购买后几日有效,2:指定过期日期 - [ 'virtual_indate', 0 ], // 虚拟到期时间 - - // 商品详情 - [ "goods_desc", "" ], - - [ 'member_discount', '' ], // 会员等级折扣,不参与:空,会员折扣:discount,指定会员价:fixed_price - [ 'poster_id', 0 ], // 海报id - ['form_id', 0], // 万能表单id - ['diy_detail_id', 0] // 自定义详情id - ]); - $this->validate($data, 'addon\shop\app\validate\goods\Goods.edit'); - $res = ( new VirtualGoodsService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/local_delivery/config/Config.php b/niucloud/addon/shop/app/adminapi/controller/local_delivery/config/Config.php deleted file mode 100644 index facc96a3b..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/local_delivery/config/Config.php +++ /dev/null @@ -1,49 +0,0 @@ -request->params([ - ['is_show_polyline',0],//是否显示配送轨迹 - ['is_local_delivery_store_select',0],//是否开启门店选择 - ]); - (new ConfigService())->setConfig($data); - return success('SUCCESS'); - - } - - /** - * 获取配置 - * @return Response - */ - public function getConfig(): Response - { - return success((new ConfigService())->getConfig()); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/adminapi/controller/local_delivery/config/Local.php b/niucloud/addon/shop/app/adminapi/controller/local_delivery/config/Local.php deleted file mode 100644 index 6f101e825..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/local_delivery/config/Local.php +++ /dev/null @@ -1,65 +0,0 @@ -getLocal()); - } - - /** - * @description 设置配置 - * @return \think\Response - */ - public function setLocal() - { - $data = $this->request->params([ - ['fee_type', ''], - ['base_dist', 0], - ['base_price', 0], - ['grad_dist', 0], - ['grad_price', 0], - ['weight_start', 0], - ['weight_unit', 0], - ['weight_price', 0], - - ['time_is_open', 0], - ['time_type', 0], - ['time_week', ''], - ['time_interval', 30], - ['advance_day', 0], - ['most_day', 7], - ['start_time', 0], - ['end_time', 0], - ['delivery_time', ''], - - ['area_data', []], - ]); - return success(data: (new LocalService())->setLocal($data)); - } -} diff --git a/niucloud/addon/shop/app/adminapi/controller/local_delivery/order/LocalDeliveryOrder.php b/niucloud/addon/shop/app/adminapi/controller/local_delivery/order/LocalDeliveryOrder.php deleted file mode 100644 index b89434c60..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/local_delivery/order/LocalDeliveryOrder.php +++ /dev/null @@ -1,120 +0,0 @@ -request->params([ - ['delivery_no', ''], - ['trade_no', ''], - ['status', ''], - ['create_time', []], - ]); - return success(( new LocalDeliveryOrderService() )->getPage($data)); - } - - /** - * 本地配送订单详情 - * @param int $id - * @return Response - */ - public function info(int $id): Response - { - return success(( new LocalDeliveryOrderService() )->getInfo($id)); - } - - /** - * 取消订单 - * @param int $id - * @return Response - */ - public function closeOrder(int $id): Response - { - $data = $this->request->params([ - ['cancel_reason_id', ''], - ['cancel_reason', ''] - ]); - $res = ( new LocalDeliveryOrderService() )->closeOrder($id, $data); - if ($res) { - return success('CANCEL_SUCCESS'); - } else { - return fail('FAIL'); - } - } - - /** - * 完成订单 - * @param int $id - * @return Response - */ - public function finishOrder(int $id): Response - { - $res = ( new LocalDeliveryOrderService() )->finishOrder($id); - if ($res) { - return success('SUCCESS'); - } else { - return fail('FAIL'); - } - } - - /** - * 同步订单信息 - * @param int $id - * @return Response - */ - public function syncOrder(int $id): Response - { - $res = ( new LocalDeliveryOrderService() )->syncOrder($id); - if ($res) { - return success('SUCCESS'); - } else { - return fail('FAIL'); - } - } - - /** - * 订单取消原因 - * @return Response - */ - public function getCancelReasonList(): Response - { - $data = $this->request->params([ - ['service', ''] - ]); - return success(( new LocalDeliveryOrderService() )->getCancelReasonList($data['service'])); - } - - /** - * 获取订单状态列表 - * @return Response - */ - public function getOrderStatusList(): Response - { - return success((new LocalDeliveryOrderService())->getOrderStatusList()); - } -} diff --git a/niucloud/addon/shop/app/adminapi/controller/local_delivery/service/LocalDeliveryService.php b/niucloud/addon/shop/app/adminapi/controller/local_delivery/service/LocalDeliveryService.php deleted file mode 100644 index bb44955a5..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/local_delivery/service/LocalDeliveryService.php +++ /dev/null @@ -1,79 +0,0 @@ -getList(); - return success($res); - } - - /** - * 设置配置 - * @return Response - */ - public function setConfig($delivery_type) - { - //参数获取 - $delivery_type_list = LocalDeliveryDict::getType(); - if (!array_key_exists($delivery_type, $delivery_type_list)) throw new AdminException('LOCAL_DELIVERY_TYPE_NOT_EXIST'); - //数据验证 - $data = [ - ['is_use', 0] - ]; - foreach ($delivery_type_list[$delivery_type]['params'] as $k_param => $v_param) { - $data[] = [$k_param, '']; - } - $request_data = $this->request->params($data); - (new LocalDeliveryServiceService())->setConfig($delivery_type, $request_data); - return success('SUCCESS'); - - } - - /** - * 获取配置 - * @return Response - */ - public function getConfig($delivery_type) - { - return success((new LocalDeliveryServiceService())->getConfig($delivery_type,true)); - } - - /** - * 获取已启用配送服务商列表 - * @return Response - */ - public function getInUseList() - { - $data = $this->request->params([ - ['store_id', 0], - ]); - return success((new LocalDeliveryServiceService())->getInUseList($data)); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/adminapi/controller/marketing/Coupon.php b/niucloud/addon/shop/app/adminapi/controller/marketing/Coupon.php deleted file mode 100644 index 76be4d68e..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/marketing/Coupon.php +++ /dev/null @@ -1,254 +0,0 @@ -request->params([]); - return success(( new CouponService() )->getInit()); - } - - /** - * 获取商品优惠券列表 - * @description 查看优惠券列表-分页 - * @return \think\Response - */ - public function lists() - { - $data = $this->request->params([ - [ "title", "" ], - [ "status", "" ] - ]); - return success(( new CouponService() )->getPage($data)); - } - - /** - * 商品优惠券详情 - * @description 查看优惠券详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success(( new CouponService() )->getInfo($id)); - } - - /** - * 添加商品优惠券 - * @description 添加商品优惠券 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "title", '' ], - [ "receive_time", "" ], - [ "remain_count", 0 ], - [ "limit", '' ], - [ "limit_count", '' ], - [ "price", 1 ], - [ "min_condition_money", '' ], - [ "type", 1 ], - [ "receive_type", '' ], - [ "valid_type", '' ], - [ "length", '' ], - [ "valid_time", '' ], - [ "goods_ids", [] ], - [ "goods_category_ids", "" ], - [ 'receive_type_time', '' ], - [ 'threshold', '' ] - ]); - $id = ( new CouponService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 商品优惠券编辑 - * @description 编辑商品优惠券 - * @param $id 商品优惠券id - * @return \think\Response - */ - public function edit($id) - { - $data = $this->request->params([ - [ "title", '' ], - [ "receive_time", "" ], - [ "remain_count", 0 ], - [ "limit", '' ], - [ "limit_count", '' ], - [ "price", 1 ], - [ "min_condition_money", '' ], - [ "type", 1 ], - [ "receive_type", '' ], - [ "valid_type", '' ], - [ "length", '' ], - [ "valid_time", '' ], - [ "goods_ids", [] ], - [ "goods_category_ids", "" ], - [ 'receive_type_time', '' ], - [ 'threshold', '' ] - ]); - ( new CouponService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 商品优惠券删除 - * @description 删除商品优惠券 - * @param $id 商品优惠券id - * @return \think\Response - */ - public function del() - { - $data = $this->request->params([ - [ 'ids', [] ], - ]); - ( new CouponService() )->del($data['ids']); - return success('DELETE_SUCCESS'); - } - - /** - * 会员领取详情 - * @description 查看会员领取优惠券详情 - */ - public function getMemberCoupon() - { - $data = $this->request->params([ - [ 'id', '' ], - [ 'keywords', '' ] - ]); - return success(( new CouponService() )->getMemberCoupon($data)); - } - - /** - * 领取状态编辑 - * @description 修改优惠券状态 - */ - public function setCouponStatus($status) - { - $data = $this->request->params([ - [ 'id', '' ], - ]); - ( new CouponService() )->setStatus($data[ 'id' ], $status); - return success('EDIT_SUCCESS'); - } - - /** - * 优惠券选择分页列表 - * @description 获取优惠券列表-1全部 - * @return \think\Response - */ - public function select() - { - $data = $this->request->params([ - [ "title", "" ], - [ "verify_coupon_ids", "" ] - ]); - return success(( new CouponService() )->getSelectPage($data)); - } - - /** - * 查询选中的优惠券 - * @description 查询选中的优惠券 - * @return \think\Response - */ - public function getSelectedLists() - { - $data = $this->request->params([ - [ "coupon_id", '' ], - ]); - return success(( new CouponService() )->getSelectedList($data[ 'coupon_id' ])); - } - - /** - * 优惠券关闭 - * @description 批量关闭优惠券 - */ - public function couponInvalid() - { - $data = $this->request->params([ - [ "ids", [] ], - ]); - ( new CouponService() )->couponInvalid($data['ids']); - return success('SUCCESS'); - } - - /** - * 获取优惠券状态 - * @description 获取优惠券状态字典 - */ - public function getCouponStatus() - { - return success(data:CouponDict::getStatus()); - } - - /** - * 获取发送优惠券范围初始化数据 - * @description 获取发送优惠券范围初始化数据 - * @return \think\Response - */ - public function getSendRangeInit() - { - return success([ - 'range_type_list'=>CouponDict::getSendCouponRangeType(), - ]); - } - - /** - * 获取发送记录分页列表 - * @description 查看发送记录列表-分页 - * @return \think\Response - */ - - public function getSendPages($coupon_id) - { - $data = $this->request->params([ - [ "range_type", '' ], - ['create_time', []], - ]); - return success(( new CouponService() )->getSendReordsPageList($coupon_id,$data)); - } - - /** - * 发放优惠券 - * @description 发放优惠券 - * @param $coupon_id - * @return \think\Response - */ - public function sendCoupon($coupon_id) - { - $data = $this->request->params([ - [ "range_type", '' ], - [ "range_param", '' ], - [ "send_num", '' ], - ]); - ( new CouponService() )->sendCoupon($coupon_id,$data); - return success("SUCCESS"); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/marketing/Discount.php b/niucloud/addon/shop/app/adminapi/controller/marketing/Discount.php deleted file mode 100644 index 9abdd67e5..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/marketing/Discount.php +++ /dev/null @@ -1,264 +0,0 @@ -request->params([ - [ "name", "" ], - [ "status", "" ], - [ "active_id", [] ], - ]); - return success(( new DiscountService() )->getPage($data)); - } - - /** - * 详情-基础信息 - * @description 查看限时折扣详情 - * @param int $discount_id - * @return \think\Response - */ - public function info(int $discount_id) - { - return success(( new DiscountService() )->getInfo($discount_id)); - } - - /** - * 详情 - * @description 查看限时折扣详情 - * @param int $discount_id - * @return \think\Response - */ - public function detail(int $discount_id) - { - return success(( new DiscountService() )->getDetail($discount_id)); - } - - /** - * 添加限时折扣 - * @description 添加限时折扣 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "name", '' ], - [ "remark", "" ], - [ "start_time", '' ], - [ "end_time", '' ], - [ "goods_list", [] ], - ]); - - $id = ( new DiscountService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 限时折扣编辑 - * @description 编辑限时折扣 - * @param int $discount_id - * @return \think\Response - */ - public function edit(int $discount_id) - { - $data = $this->request->params([ - [ "name", '' ], - [ "remark", "" ], - [ "start_time", '' ], - [ "end_time", '' ], - [ "goods_list", [] ], - ]); - - ( new DiscountService() )->edit($discount_id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 限时折扣商品校验 - * @description 限时折扣商品校验 - * @return \think\Response - */ - public function checkGoods() - { - $data = $this->request->params([ - [ "start_time", '' ],//开始时间 - [ "end_time", '' ],//结束时间 - [ "goods_ids", [] ],//校验的商品id - [ "discount_id", 0 ],//限时折扣活动id - ]); - - return success('SUCCESS', data:( new DiscountService() )->checkGoodsData($data)); - } - - /** - * 获取活动状态 - * @description 获取限时折扣活动状态字典 - * @return \think\Response - */ - public function status() - { - return success(ActiveDict::getStatus()); - } - - /** - * 删除活动 - * @description 删除限时折扣 - * @param int $discount_id - * @return \think\Response - */ - public function del(int $discount_id) - { - ( new DiscountService() )->del($discount_id); - return success('DELETE_SUCCESS'); - } - - /** - * 活动关闭 - * @description 关闭限时折扣 - * @param int $discount_id - * @return \think\Response - */ - public function close(int $discount_id) - { - ( new DiscountService() )->discountClose($discount_id); - return success('SUCCESS'); - } - - /** - * 获取限时活动状态 - */ - public function discountStatus() - { - return success(DiscountDict::getStatus()); - } - - /** - * 批量删除活动 - * @description 批量删除限时折扣 - * @return \think\Response - */ - public function batchDelete() - { - $data = $this->request->params([ - [ 'ids', [] ], - ]); - ( new DiscountService() )->batchDel($data['ids']); - return success('SUCCESS'); - } - - /** - * 批量关闭活动 - * @description 批量关闭限时折扣 - * @return \think\Response - */ - public function batchClose() - { - $data = $this->request->params([ - [ 'ids', [] ], - ]); - ( new DiscountService() )->batchClose($data['ids']); - return success('SUCCESS'); - } - - /** - * 参与订单 - * @description 查看限时折扣订单 - * @param int $active_id - * @return \think\Response - */ - public function order(int $active_id) - { - $data = $this->request->params([ - [ 'status', '' ], - [ 'create_time', [] ], - [ 'pay_time', [] ], - [ 'search_type', 'order_no' ], - [ 'search_name', '' ], - ]); - - return success(( new DiscountService() )->order($active_id, $data)); - } - - /** - * 参与会员 - * @description 查看限时折扣会员 - * @param int $active_id - * @return \think\Response - * @throws \think\db\exception\DbException - */ - public function member(int $active_id) - { - $data = $this->request->params([ - [ 'keyword', '' ], - ]); - - return success(( new DiscountService() )->member($active_id, $data)); - } - - /** - * 参与商品 - * @description 查看限时折扣商品 - * @param int $active_id - * @return \think\Response - * @throws \think\db\exception\DbException - */ - public function goods(int $active_id) - { - $data = $this->request->params([ - [ 'keyword', '' ], - ]); - - return success(( new DiscountService() )->goods($active_id, $data)); - } - - /** - * 获取轮播图配置 - * @description 获取轮播图配置 - * @return void - */ - public function banner() - { - return success(( new DiscountService() )->getDiscountBannerConfig()); - } - - /** - * 设置轮播图配置 - * @description 设置轮播图配置 - * @return \think\Response - */ - public function setBanner() - { - $data = $this->request->params([ - [ 'list', [] ], - ]); - $res = ( new DiscountService() )->setConfig('SHOP_DISCOUNT_BANNER_CONFIG', $data[ 'list' ]); - return success('SUCCESS', $res); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/marketing/Exchange.php b/niucloud/addon/shop/app/adminapi/controller/marketing/Exchange.php deleted file mode 100644 index 3283b0fcc..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/marketing/Exchange.php +++ /dev/null @@ -1,220 +0,0 @@ -request->params([ - [ "names", "" ], - [ "status", "" ], - [ "create_time", "" ], - [ "active_id", [] ], - ]); - return success(( new ExchangeService() )->getPage($data)); - } - - /** - * 积分商品分页列表(用于弹框选择) - * @description 积分商城列表-全部 - * @return \think\Response - */ - public function select() - { - $data = $this->request->params([ - [ "names", "" ], - [ "create_time", "" ], - [ 'verify_goods_ids', [] ], // 检测id集合是否存在,移除不存在的id,纠正数据准确性 - ]); - return success(( new ExchangeService() )->getSelectPage($data)); - } - - /** - * 获取活动商品类型 - * @description 积分商城商品类型 - * @return \think\Response - */ - public function type() - { - return success(ExchangeDict::getType()); - } - - /** - * 获取积分商城状态 - * @description 积分商城状态字典 - */ - public function status() - { - return success(ExchangeDict::getStatus()); - } - - /** - * 添加积分商城 - * @description 添加积分商城活动 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "type", '' ], - [ "names", "" ], - [ "title", '' ], - [ "image", '' ], - [ "product_detail", '{}' ], - [ "point", '' ], - [ "price", '' ], - [ "limit_num", '' ], - [ "content", '' ], - [ "sort", '' ], - [ "stock", '' ], - ]); - $id = ( new ExchangeService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 详情 - * @description 查看积分商城详情 - * @param int $id - * @return \think\Response - */ - public function detail(int $id) - { - return success(( new ExchangeService() )->getDetail($id)); - } - - /** - * 积分商城编辑 - * @description 编辑积分商城活动 - * @param int $id - * @return \think\Response - */ - public function edit(int $id) - { - $data = $this->request->params([ - [ "type", '' ], - [ "names", "" ], - [ "title", '' ], - [ "image", '' ], - [ "product_detail", '{}' ], - [ "point", '' ], - [ "price", '' ], - [ "limit_num", '' ], - [ "content", '' ], - [ "sort", '' ], - [ "stock", '' ], - ]); - ( new ExchangeService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 修改上架状态 - * @description 修改积分商城上下架 - * @param int $id - * @return \think\Response - */ - public function editStatus(int $id) - { - $data = $this->request->params([ - [ 'status', '' ], - ]); - ( new ExchangeService() )->editStatus($data, $id); - return success('SUCCESS'); - } - - /** - * 删除活动 - * @description 删除积分商城活动 - * @param int $id - * @return \think\Response - */ - public function del(int $id) - { - ( new ExchangeService() )->del($id); - return success('DELETE_SUCCESS'); - } - - /** - * 批量删除活动 - * @description 批量删除积分商城活动 - * @return \think\Response - */ - public function batchDelete() - { - $data = $this->request->params([ - [ 'ids', [] ], - ]); - ( new ExchangeService() )->batchDelete($data['ids']); - return success('SUCCESS'); - } - - /** - * 批量下架活动 - * @description 批量下架积分商城活动 - * @return \think\Response - */ - public function batchDown() - { - $data = $this->request->params([ - [ 'ids', [] ], - ]); - ( new ExchangeService() )->batchDown($data['ids']); - return success('SUCCESS'); - } - - /** - * 批量上架架活动 - * @description 批量下架积分商城活动 - * @return \think\Response - */ - public function batchUp() - { - $data = $this->request->params([ - [ 'ids', [] ], - ]); - ( new ExchangeService() )->batchUp($data['ids']); - return success('SUCCESS'); - } - - /** - * 修改排序 - * @description 修改积分商城活动排序 - * @param int $id - * @return \think\Response - */ - public function modifySort(int $id) - { - $data = $this->request->params([ - [ 'sort', '' ], - ]); - ( new ExchangeService() )->modifySort($data, $id); - return success('SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/marketing/Index.php b/niucloud/addon/shop/app/adminapi/controller/marketing/Index.php deleted file mode 100644 index 6a66fdca5..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/marketing/Index.php +++ /dev/null @@ -1,33 +0,0 @@ -request->params([ - ['addon', ''], - ]); - return success((new MarketingService())->index($data)); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/marketing/Manjian.php b/niucloud/addon/shop/app/adminapi/controller/marketing/Manjian.php deleted file mode 100644 index 9f94e327c..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/marketing/Manjian.php +++ /dev/null @@ -1,223 +0,0 @@ -request->params([ - [ "manjian_name", "" ], - [ "status", "" ], - [ "create_time", [] ], - [ "active_id", [] ], - ]); - return success(( new ManjianService() )->getPage($data)); - } - - /** - * 满减送关闭 - * @description 关闭满减活动 - * @return \think\Response - */ - public function closeManjian($id) - { - ( new ManjianService() )->closeManjian($id); - return success('SUCCESS'); - } - - /** - * 满减送删除 - * @description 删除满减活动 - * @return \think\Response - */ - public function del($id) - { - ( new ManjianService() )->del($id); - return success('DELETE_SUCCESS'); - } - - /** - * 满减送详情 - * @description 查看满减活动详情 - * @param int $id - * @return \think\Response - */ - public function info($id) - { - return success(( new ManjianService() )->info($id)); - } - - /** - * 参与会员 - * @description 查看满减活动参与会员 - * @param int $id - * @return \think\Response - * @throws \think\db\exception\DbException - */ - public function member(int $id) - { - $data = $this->request->params([ - [ 'keyword', '' ], - ]); - - return success(( new ManjianService() )->member($id, $data)); - } - - /** - * 添加满减送 - * @description 添加满减活动 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "manjian_name", '' ],//名称 - [ "condition_type", '' ],//条件类型 - [ "goods_type", '' ],//参与商品 - [ "join_member_type", '' ],//参与会员 - [ "rule_type", '' ],//优惠规格 - [ "rule_json", '' ],//优惠规则json - [ "goods_ids", [] ],//商品id集 - [ "level_ids", [] ],//会员等级id集 - [ "label_ids", [] ],//会员标签id集 - [ "start_time", '' ],//开始时间 - [ "end_time", '' ],//开始时间 - [ "remark", '' ],//备注 - [ "goods_data", [] ],//参与商品json数据 - ]); - - $res = ( new ManjianService() )->add($data); - if ($res[ 'code' ] === 1) { - return success('ADD_SUCCESS', $res); - } else { - return success('ADD_FAIL', $res); - } - - } - - /** - * 获取满减送编辑数据 - * @description 获取满减送编辑数据 - * @return \think\Response - */ - public function init() - { - $data = $this->request->params([ - [ "manjian_id", 0 ], - ]); - return success(( new ManjianService() )->getInit($data)); - } - - /** - * 商品编辑 - * @description 编辑满减活动 - * @param $id - * @return \think\Response - */ - public function edit($id) - { - $data = $this->request->params([ - [ "manjian_name", '' ],//名称 - [ "condition_type", '' ],//条件类型 - [ "goods_type", '' ],//参与商品 - [ "join_member_type", '' ],//参与会员 - [ "rule_type", '' ],//优惠规格 - [ "rule_json", [] ],//优惠规则json - [ "goods_ids", [] ],//商品id集 - [ "level_ids", [] ],//会员等级id集 - [ "label_ids", [] ],//会员标签id集 - [ "start_time", '' ],//开始时间 - [ "end_time", '' ],//开始时间 - [ "remark", '' ],//备注 - [ "goods_data", [] ],//参与商品json数据 - ]); - - $res = ( new ManjianService() )->edit($id, $data); - if ($res[ 'code' ] === 1) { - return success('EDIT_SUCCESS', $res); - } else { - return success('EDIT_FAIL', $res); - } - } - - /** - * 获取活动状态 - * @description 获取满减送活动状态字典 - * @return \think\Response - */ - public function status() - { - return success(ManjianDict::getStatus()); - } - - /** - * 满减送商品校验 - * @return \think\Response - */ - public function checkGoods() - { - $data = $this->request->params([ - [ "goods_type", '' ],//参与商品类型 - [ "start_time", '' ],//开始时间 - [ "end_time", '' ],//结束时间 - [ "goods_ids", [] ],//校验的商品id - [ "manjian_id", 0 ],//满减活动id - ]); - return success('SUCCESS', data:( new ManjianService() )->checkGoods($data)); - } - - /** - * 批量关闭 - * @description 批量关闭满减送活动 - * @return \think\Response - */ - public function batchClose() - { - $data = $this->request->params([ - [ "manjian_id", [] ], - ]); - ( new ManjianService() )->batchClose($data); - return success('SUCCESS'); - } - - /** - * 批量删除 - * @description 批量删除满减送活动 - * @return \think\Response - */ - public function batchDelete() - { - $data = $this->request->params([ - [ "manjian_id", [] ], - ]); - ( new ManjianService() )->batchDelete($data); - return success('DELETE_SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/marketing/Newcomer.php b/niucloud/addon/shop/app/adminapi/controller/marketing/Newcomer.php deleted file mode 100644 index dbf1f6df9..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/marketing/Newcomer.php +++ /dev/null @@ -1,99 +0,0 @@ -request->params([ - [ "active_status", '' ], //是否启用 active:开启 close:关闭 - [ "active_desc", '' ], - [ "goods_data", '{}' ], - [ "validity_type", 'day' ], //有效期类型,day:x天有效,date:指定过期日期 - [ "validity_day", 3 ], //有效天数 - [ "validity_time", 0 ], //有效时间 - [ "participation_way", 'never_order' ], //参与方式,never_order:从未下过单的会员,assign_time_order:指定时间内未下过单会员,assign_time_register:指定时间内注册的会员 - [ "appoint_time", 0 ], //指定时间 - [ "limit_num", 1 ], //限购数量 - [ "banner_list", [] ], //广告图 - ]); - ( new NewcomerService() )->setConfig($data); - return success('SET_SUCCESS'); - } - - /** - * 获取新增专享配置 - * @description 获取新增专享配置 - * @return \think\Response - */ - public function getConfig() - { - return success(( new NewcomerService() )->getConfig()); - } - - /** - * 商品选择分页列表(按照单商品) - * @description 商品选择分页列表(按照单商品) - * @return \think\Response - */ - public function select() - { - $data = $this->request->params([ - [ 'keyword', '' ], // 搜索关键词 - [ "goods_category", "" ], // 商品分类 - [ "goods_type", "" ], // 商品分类 - [ "select_type", "all" ], // 商品分类 - [ 'goods_ids', [] ], // 已选商品id集合 - [ 'sku_ids', [] ], // 已选商品规格id集合 - [ 'verify_goods_ids', [] ], // 检测商品id集合是否存在,移除不存在的商品id,纠正数据准确性 - [ 'verify_sku_ids', [] ] // 检测商品规格id集合是否存在,移除不存在的商品规格id,纠正数据准确性 - ]); - - return success(( new NewcomerService() )->getSelectPage($data)); - } - - /** - * 已选商品列表 - * @description 获取已选商品列表 - * @return \think\Response - */ - public function selectGoodsSku() - { - $data = $this->request->params([ - [ 'keyword', '' ], // 搜索关键词 - [ "goods_category", "" ], // 商品分类 - [ "goods_type", "" ], // 商品分类 - [ 'goods_ids', '' ], // 已选商品id集合 - [ 'verify_goods_ids', [] ], // 检测商品id集合是否存在,移除不存在的商品id,纠正数据准确性 - [ 'verify_sku_ids', [] ] // 检测商品规格id集合是否存在,移除不存在的商品规格id,纠正数据准确性 - ]); - - return success(( new NewcomerService() )->getSelectSku($data)); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/order/Config.php b/niucloud/addon/shop/app/adminapi/controller/order/Config.php deleted file mode 100644 index fd7745f8d..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/order/Config.php +++ /dev/null @@ -1,63 +0,0 @@ -request->params([ - [ "is_close", 1 ], - [ "close_length", "" ], - [ "is_finish", "" ], - [ "finish_length", 1 ], - [ "no_allow_refund", "" ], - [ "refund_length", "" ], - [ "is_invoice", "" ], - [ "invoice_type", "" ], - [ "invoice_content", "" ], - [ "is_evaluate", 1 ], - [ "evaluate_is_to_examine", 1 ], - [ "evaluate_is_show", 1 ], - [ 'form_id', '' ] - ]); - - ( new ConfigService() )->setConfig($data); - return success('SUCCESS'); - } - - /** - * 获取交易配置 - * @description 获取交易配置 - * @return \think\Response - */ - public function getConfig() - { - (new Upgrade())->handle(); - return success(( new ConfigService() )->getConfig()); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/order/Invoice.php b/niucloud/addon/shop/app/adminapi/controller/order/Invoice.php deleted file mode 100644 index 5763ec122..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/order/Invoice.php +++ /dev/null @@ -1,100 +0,0 @@ -request->params([ - ['create_time', []], - ['invoice_time', []], - ['header_name', ''], - ['header_type', 'all'], - ['is_invoice', 'all'], - ]); - return success((new InvoiceService())->getPage($data)); - } - - /** - * 发票信息 - * @description 查看订单发票信息 - * @param int $order_id - * @return Response - */ - public function info(int $id) - { - return success((new InvoiceService())->getInfo($id)); - } - - /** - * @description 开具发表 - * @param int $id - * @return Response - */ - public function invoicing(int $id) { - $data = $this->request->params([ - ['remark', ''], - ['invoice_number', ''], - ['invoice_voucher', ''], - ]); - return success('SUCCESS', data:(new InvoiceService())->invoicing($id, $data)); - } - - /** - * @description 审核发票 - * @param int $id - * @return Response - */ - public function audit() { - $data = $this->request->params([ - ['ids', []] - ]); - return success('SUCCESS', data:(new InvoiceService())->audit($data)); - } - - /** - * @description 添加发票 - * @return Response - */ - public function add() - { - $data = $this->request->params([ - ['order_no', ''], - ['header_type', ''], - ['header_name', ''], - ['type', ''], - ['name', ''], - ['tax_number', ''], - ['mobile', ''], - ['email', ''], - ['telephone', ''], - ['address', ''], - ['bank_name', ''], - ['bank_card_number', ''], - ['pay_voucher', ''], - ['money', ''], - ]); - (new InvoiceService())->add($data); - return success('SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/order/Order.php b/niucloud/addon/shop/app/adminapi/controller/order/Order.php deleted file mode 100644 index 2a4acc49f..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/order/Order.php +++ /dev/null @@ -1,374 +0,0 @@ -request->params([ - ['search_type', ''], - ['search_name', ''], - ['status', ''], - ['pay_type', ''], - ['order_from', ''], - ['create_time', []], - ['pay_time', []], - ['activity_type', ''], - ['keyword', ''], - ]); - return success((new OrderService())->getPage($data)); - } - - /** - * 订单详情 - * @description 查看订单详情 - * @param int $order_id - * @return Response - */ - public function detail(int $id) - { - return success((new OrderService())->getDetail($id)); - } - - /** - * 获取订单状态 - * @description 获取订单状态字典 - * @return Response - */ - public function getOrderStatus() - { - return success(OrderDict::getStatus()); - } - - /** - * 获取订单类型 - * @description 获取订单类型字典 - * @return Response - */ - public function getOrderType() - { - return success(OrderDict::getOrderType()); - } - - /** - * 订单关闭 - * @description 关闭订单 - * @param $id - * @return Response - */ - public function orderClose($id) - { - (new OrderCloseService())->close($id); - return success('SUCCESS'); - } - - /** - * 订单完成 - * @description 完成订单 - * @param $id - * @return Response - */ - public function orderFinish($id) - { - (new OrderFinishService())->finish($id); - return success(); - } - - /** - * 订单发货 - * @description 订单发货 - * @param $id - * @return Response - */ - public function orderDelivery() - { - $data = $this->request->params([ - ['order_id', 0], - ['delivery_ids', []],//修改 - ['order_goods_ids', []], - ['delivery_type', ''], - ['delivery_way', ''], // 发货方式,manual_write:手动填写,electronic_sheet:电子面单 - ['express_company_id', ''], - ['express_number', ''], - ['electronic_sheet_id', 0], // 电子面单 - ['local_deliver_id', 0],//配送员 - ['remark', ''],//配送员 - ['local_delivery_type', ''], - ['goods_weight', 0], - ['store_id', ''],//提货点id - ]); - return success("DELIVERY_SUCCESS", (new OrderDeliveryService())->delivery($data)); - } - - /** - * - * 获取订单配送方式 - * @description 获取订单配送方式 - */ - public function getDeliveryType() - { - $data = $this->request->params([ - ['delivery_type', ''], - ]); - return success(OrderDeliveryDict::getChildType($data['delivery_type'])); - } - - /** - * 商家留言 - * @description 设置商家留言 - * @return Response - */ - public function setShopRemark() - { - $data = $this->request->params([ - ['order_id', ''], - ['shop_remark', ''], - ]); - (new OrderService())->shopRemark($data); - return success("SUCCESS"); - } - - /** - * 订单包裹 - * @description 查看订单包裹 - * @return Response - */ - public function getOrderPackage() - { - $data = $this->request->params([ - ['id', ''], - ['mobile', ''], - ]); - return success(data: (new OrderDeliveryService())->getDeliveryPackage($data)); - } - - /** - * 订单包裹列表 - * @description 查看订单包裹列表-分页 - * @return Response - */ - public function getDeliveryPackageList() - { - $data = $this->request->params([ - ['order_id', ''], - ]); - return success((new OrderDeliveryService())->getDeliveryPackageList($data)); - } - - /** - * 获取支付方式 - * @description 获取订单支付方式字典 - * @return Response - */ - public function getPayType() - { - return success(PayDict::getPayType()); - } - - /** - * 获取订单来源 - * @description 获取订单来源字典 - */ - public function getOrderFrom() - { - return success((new OrderService())->getOrderFrom()); - } - - /** - * 订单改价 - * @description 修改订单价格 - * @return void - */ - public function editPrice() - { - $data = $this->request->params([ - ['order_id', 0], - ['delivery_money', 0], - ['order_goods_data', []], - ]); - return success(data: (new OrderService())->editPrice($data)); - } - - /** - * 订单配送信息修改 - * @description 修改订单配送信息 - */ - public function editDelivery() - { - $data = $this->request->params([ - ['order_id', 0], - ['delivery_type', ''], - ['take_store_id', 0], - ['taker_name', ''], - ['taker_mobile', ''], - ['taker_province', 0], - ['taker_city', 0], - ['taker_district', 0], - ['taker_address', ''], - ['taker_full_address', ''], - ['taker_longitude', ''], - ['taker_latitude', ''], - ['taker_store_id', 0], - ]); - return success("SUCCESS", (new OrderService())->editDelivery($data)); - } - - /** - * 订单修改配送信息数据获取 - * @description 修改订单配送信息 - */ - public function editDeliveryData() - { - $data = $this->request->params([ - ['order_id', 0], - ['delivery_type', ''], - ['take_store_id', 0], - ['taker_name', ''], - ['taker_mobile', ''], - ['taker_province', 0], - ['taker_city', 0], - ['taker_district', 0], - ['taker_address', ''], - ['taker_full_address', ''], - ['taker_longitude', ''], - ['taker_latitude', ''], - ['taker_store_id', 0], - ]); - return success(data: (new OrderService())->getEditDeliveryData($data)); - } - - /** - *获取订单批量操作记录 - * @description 查看订单批量操作 - * @return Response - */ - public function getOrderBatchDeliveryPage() - { - $data = $this->request->params([ - ['status', ''], - ['type', ''], - ['main_id', ''], - ['create_time', []], - ]); - return success((new OrderBatchDeliveryService())->getPage($data)); - } - - /** - * 记录详情 - * @description 查看批量操作订单配送记录信息 - * @param $id - * @return Response - * @throws \think\db\exception\DbException - */ - public function getOrderBatchDeliveryInfo($id) - { - return success((new OrderBatchDeliveryService())->getInfo($id)); - } - - /** - * 发布导入批量操作 - * @description 批量订单发货 - * @return Response - */ - public function addBatchOrderDelivery() - { - $data = $this->request->params([ - ['data', []],//['path' => '', 'type' => 'order/order_goods'] - ]); - return success(data: (new OrderBatchDeliveryService())->addBatchOrderDelivery($data)); - } - - /** - * 获取操作类型 - * @description 获取批量发送类型字典 - * @return Response - */ - public function getBatchType() - { - return success(data: OrderBatchDeliveryDict::getType()); - } - - /** - * 获取批量状态 - * @description 获取订单批量发送状态字典 - * @return Response - */ - public function getBatchStatus() - { - return success(data: OrderBatchDeliveryDict::getStatus()); - } - - /** - * 获取已选商品总重量 - * @return \think\Response - */ - public function getSelectOrderGoodsWeight() - { - $data = $this->request->params([ - [ 'order_goods_ids', [] ], // 已选订单项id集合 - ]); - return success(data:( new OrderService() )->getSelectOrderGoodsWeight($data)); - } - - /** - * 配送费用计算 - */ - public function getDeliveryFee() - { - $data = $this->request->params([ - ['order_id', 0], - ['order_goods_ids', []], - ['delivery_type', ''], - ['delivery_way', ''], - ['local_delivery_type', ''], - ['goods_weight', 0], - ['store_id', 0], - ]); - return success(data:( new OrderDeliveryService() )->getDeliveryFee($data)); - } - - /** - * @description 删除订单 - * @return Response - */ - public function delete() - { - $params = $this->request->params([ - ['order_ids', []] - ]); - $order_ids = $params['order_ids']; - $res = (new OrderService)->delete($order_ids); - return success("DELETE_SUCCESS"); - - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/refund/Refund.php b/niucloud/addon/shop/app/adminapi/controller/refund/Refund.php deleted file mode 100644 index bff5cfa71..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/refund/Refund.php +++ /dev/null @@ -1,122 +0,0 @@ -request->params([ - [ 'order_refund_no', '' ], - [ 'status', '' ], - [ 'create_time', [] ], - ]); - return success(( new RefundService() )->getPage($data)); - } - - /** - * 详情 - * @description 查看订单退款详情 - * @param string $order_refund_no - * @return Response - */ - public function detail($id) - { - return success(( new RefundService() )->getDetail($id)); - } - - /** - * 审核退款 - * @description 操作审核订单退款 - * @return Response - */ - public function auditApply($order_refund_no) - { - $data = $this->request->params([ - [ 'shop_reason', '' ], - [ 'is_agree', '' ], - [ 'money', 0 ], - [ 'refund_address_id', 0 ] - ]); - $data[ 'order_refund_no' ] = $order_refund_no; - ( new RefundActionService() )->auditApply($data); - return success(); - } - - /** - * 确认收货 - * @description 操作确认收货 - * @return Response - */ - public function auditRefundGoods($order_refund_no) - { - $data = $this->request->params([ - [ 'shop_reason', '' ], - [ 'is_agree', '' ] - ]); - $data[ 'order_refund_no' ] = $order_refund_no; - ( new RefundActionService() )->auditRefundGoods($data); - return success(); - } - - /** - * 商家主动退款 - * @description 操作订单主动退款 - * @return Response - */ - public function shopActiveRefund() - { - $data = $this->request->params([ - [ 'order_goods_ids', [] ], - [ 'shop_active_refund_money', 0 ], - [ 'shop_active_refund_remark', '' ], - ]); - ( new RefundActionService() )->shopActiveRefund($data); - return success(); - } - - /** - * 获取订单项可退款金额 - * @description 查看订单项可退款金额 - * @return Response - */ - public function getOrderRefundMoney() - { - $data = $this->request->params([ - [ 'order_goods_ids', [] ] - ]); - return success(data: ( new RefundActionService() )->getOrderRefundMoney($data)); - } - - /** - * 关闭售后 - * @description 操作关闭售后 - * @return void - */ - public function closeRefund($order_refund_no) - { - (new RefundActionService())->closeRefund($order_refund_no); - return success(); - } - - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/shop_address/ShopAddress.php b/niucloud/addon/shop/app/adminapi/controller/shop_address/ShopAddress.php deleted file mode 100644 index 05df82bb3..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/shop_address/ShopAddress.php +++ /dev/null @@ -1,137 +0,0 @@ -request->params([ - [ "mobile", "" ], - [ "full_address", "" ] - ]); - return success(( new ShopAddressService() )->getPage($data)); - } - - /** - * 商家地址库详情 - * @description 查看商家地址库详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success(( new ShopAddressService() )->getInfo($id)); - } - - /** - * 添加商家地址库 - * @description 添加商家地址库 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - [ "contact_name", "" ], - [ "mobile", "" ], - [ "province_id", 0 ], - [ "city_id", 0 ], - [ "district_id", 0 ], - [ "address", "" ], - [ "full_address", "" ], - [ "lat", "" ], - [ "lng", "" ], - [ "is_delivery_address", 0 ], - [ "is_refund_address", 0 ], - [ "is_default_delivery", 0 ], - [ "is_default_refund", 0 ] - ]); - $this->validate($data, 'addon\shop\app\validate\shop_address\ShopAddress.add'); - $id = ( new ShopAddressService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 商家地址库编辑 - * @description 编辑商家地址库 - * @param $id 商家地址库id - * @return \think\Response - */ - public function edit($id) - { - $data = $this->request->params([ - [ "contact_name", "" ], - [ "mobile", "" ], - [ "province_id", 0 ], - [ "city_id", 0 ], - [ "district_id", 0 ], - [ "address", "" ], - [ "full_address", "" ], - [ "lat", "" ], - [ "lng", "" ], - [ "is_delivery_address", 0 ], - [ "is_refund_address", 0 ], - [ "is_default_delivery", 0 ], - [ "is_default_refund", 0 ] - ]); - $this->validate($data, 'addon\shop\app\validate\shop_address\ShopAddress.edit'); - ( new ShopAddressService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 商家地址库删除 - * @description 删除商家地址库 - * @param $id 商家地址库id - * @return \think\Response - */ - public function del(int $id) - { - ( new ShopAddressService() )->del($id); - return success('DELETE_SUCCESS'); - } - - /** - * @description 获取默认配送地址 - * @return \think\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function defaultDelivery() - { - return success(data:( new ShopAddressService() )->getDefaultDeliveryAddress()); - } - - /** - * 获取商家地址(不分页) - * @description 获取商家地址库列表-不分页 - */ - public function getList() - { - return success(( new ShopAddressService() )->getList()); - } -} diff --git a/niucloud/addon/shop/app/adminapi/controller/shop_delivery/deliver/Deliver.php b/niucloud/addon/shop/app/adminapi/controller/shop_delivery/deliver/Deliver.php deleted file mode 100644 index cb693f87e..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/shop_delivery/deliver/Deliver.php +++ /dev/null @@ -1,109 +0,0 @@ -request->params([ - ['deliver_name', ''], - ['deliver_mobile', ''] - ]); - return success(( new DeliverService() )->getPage($data)); - } - - /** - * 获取配送员列表 - * @description 查看配送员列表 - * @return \think\Response - */ - public function lists() - { - $data = $this->request->params([ - ['deliver_name', ''], - ['deliver_mobile', ''] - ]); - return success(( new DeliverService() )->getList($data)); - } - - /** - * 配送员详情 - * @description 查看配送员详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success(( new DeliverService() )->getInfo($id)); - } - - /** - * 添加配送员 - * @description 添加配送员 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - ['deliver_name', ''], - ['deliver_mobile', ''], - ]); - $id = ( new DeliverService() )->add($data); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 配送员编辑 - * @description 编辑配送员 - * @param int $id 自提门店id - * @return \think\Response - */ - public function edit($id) - { - $data = $this->request->params([ - ['deliver_name', ''], - ['deliver_mobile', ''], - ]); - ( new DeliverService() )->edit($id, $data); - return success('EDIT_SUCCESS'); - } - - /** - * 配送员删除 - * @description 删除配送员 - * @param int $id - * @return Response - */ - public function del(int $id) - { - ( new DeliverService() )->del($id); - return success('DELETE_SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/adminapi/controller/shop_delivery/order/ShopDeliveryOrder.php b/niucloud/addon/shop/app/adminapi/controller/shop_delivery/order/ShopDeliveryOrder.php deleted file mode 100644 index c7509186f..000000000 --- a/niucloud/addon/shop/app/adminapi/controller/shop_delivery/order/ShopDeliveryOrder.php +++ /dev/null @@ -1,92 +0,0 @@ -request->params([ - ['delivery_no', ''], - ['trade_no', ''], - ['status', ''], - ['create_time', []], - ]); - return success(( new ShopDeliveryOrderService() )->getPage($data)); - } - - /** - * 商家配送订单详情 - * @param int $id - * @return Response - */ - public function info(int $id): Response - { - return success(( new ShopDeliveryOrderService() )->getInfo($id)); - } - - /** - * 取消订单 - * @param int $id - * @return Response - */ - public function closeOrder(int $id): Response - { - $data = $this->request->params([ - ['cancel_reason', ''] - ]); - $res = ( new ShopDeliveryOrderService() )->closeOrder($id, $data); - if ($res) { - return success('CANCEL_SUCCESS'); - } else { - return fail('FAIL'); - } - } - - /** - * 完成订单 - * @param int $id - * @return Response - */ - public function finishOrder(int $id): Response - { - $res = ( new ShopDeliveryOrderService() )->finishOrder($id); - if ($res) { - return success('SUCCESS'); - } else { - return fail('FAIL'); - } - } - - /** - * 获取订单状态列表 - * @return Response - */ - public function getOrderStatusList(): Response - { - return success((new ShopDeliveryOrderService())->getOrderStatusList()); - } -} diff --git a/niucloud/addon/shop/app/adminapi/route/route.php b/niucloud/addon/shop/app/adminapi/route/route.php deleted file mode 100644 index a87d990b5..000000000 --- a/niucloud/addon/shop/app/adminapi/route/route.php +++ /dev/null @@ -1,896 +0,0 @@ -middleware([ - AdminCheckToken::class, - AdminCheckRole::class, - AdminLog::class -]); diff --git a/niucloud/addon/shop/app/api/controller/Config.php b/niucloud/addon/shop/app/api/controller/Config.php deleted file mode 100644 index adf998caa..000000000 --- a/niucloud/addon/shop/app/api/controller/Config.php +++ /dev/null @@ -1,31 +0,0 @@ -getInvoiceConfig()); - } - - /** - * 评价设置 - * @return \think\Response - */ - public function evaluate() - { - return success(( new ConfigService() )->getEvaluateConfig()); - } -} diff --git a/niucloud/addon/shop/app/api/controller/cart/Cart.php b/niucloud/addon/shop/app/api/controller/cart/Cart.php deleted file mode 100644 index 91e676362..000000000 --- a/niucloud/addon/shop/app/api/controller/cart/Cart.php +++ /dev/null @@ -1,128 +0,0 @@ -request->params([ - [ 'goods_id', 0 ], - [ 'sku_id', 0 ], - [ 'num', 0 ], - [ 'market_type', 0 ], - [ 'market_type_id', 0 ], - [ 'status', 1 ], - [ 'invalid_remark', '' ], - ]); - $this->validate($data, 'addon\shop\app\validate\cart\Cart.add'); - $id = ( ( new CartService() )->add($data) ); - return success('ADD_SUCCESS', [ 'id' => $id ]); - } - - /** - * 编辑购物车 - * @return \think\Response - */ - public function edit() - { - $data = $this->request->params([ - [ 'id', 0 ], - [ 'sku_id', 0 ], - [ 'num', 0 ], - ]); - $this->validate($data, 'addon\shop\app\validate\cart\Cart.edit'); - ( new CartService() )->edit($data); - return success('EDIT_SUCCESS'); - } - - /** - * 购物车删除,支持批量 - * @return \think\Response - */ - public function del() - { - $data = $this->request->params([ - [ 'ids', '' ], - ]); - ( new CartService() )->del($data); - return success('DELETE_SUCCESS'); - } - - /** - * 清空购物车 - * @return \think\Response - */ - public function clear() - { - ( new CartService() )->clear(); - return success('DELETE_SUCCESS'); - } - - /** - * 获取购物车列表 - * @return \think\Response - */ - public function lists() - { - $data = $this->request->params([]); - return success('SUCCESS', ( new CartService() )->getList($data)); - } - - /** - * 获取购物车商品列表 - * @return \think\Response - */ - public function goodsLists() - { - $data = $this->request->params([]); - return success('SUCCESS',( new CartService() )->getGoodsList($data)); - } - - /** - * 获取购物车数量 - * @return \think\Response - */ - public function sum() - { - $data = $this->request->params([ - [ 'goods_id', 0 ], - ]); - return success('SUCCESS', ( new CartService() )->getSum($data)); - } - - /** - * 购物车计算 - */ - public function calculate() - { - $data = $this->request->params([ - [ 'sku_ids', [] ], - ]); - - return success('SUCCESS',( new CartService() )->calculate($data)); - } - -} diff --git a/niucloud/addon/shop/app/api/controller/delivery/Order.php b/niucloud/addon/shop/app/api/controller/delivery/Order.php deleted file mode 100644 index 6f17868bc..000000000 --- a/niucloud/addon/shop/app/api/controller/delivery/Order.php +++ /dev/null @@ -1,47 +0,0 @@ -request->all(); - $params['type'] = $type; - $params['order_no'] = $order_no; - return (new CoreLocalDeliveryOrderNotifyService())->notify($type, $order_no, $action, $params); - } - - /** - * 获取配送轨迹 - * @return Response - */ - public function getTrackOfLocalDeliveryOrder() - { - $data = $this->request->params([ - [ 'trade_no', '' ], - ]); - return success(( new OrderService() )->getTrackOfLocalDeliveryOrder($data)); - } -} diff --git a/niucloud/addon/shop/app/api/controller/exchange/Exchange.php b/niucloud/addon/shop/app/api/controller/exchange/Exchange.php deleted file mode 100644 index 7bab89f10..000000000 --- a/niucloud/addon/shop/app/api/controller/exchange/Exchange.php +++ /dev/null @@ -1,77 +0,0 @@ -request->params([ - ["names", ""], - ["status", 1], - ["create_time", ""], - ['order', ''], // 排序方式(综合:空,销量:sale_num,价格:price) - ['sort', 'desc'], // 升序:asc,降序:desc - ['status', 1], // 升序:asc,降序:desc - ]); - return success((new ExchangeService())->getPage($data)); - } - - /** - * 商品详情 - * @param int $id - * @return Response - */ - public function detail(int $id) - { - return success((new ExchangeService())->getDetail($id)); - } - - /** - * 获取商品列表供组件调用 - * @return \think\Response - */ - public function components() - { - $data = $this->request->params([ - ['num', 0], - ["names", ""], - ['ids', ''], - ['order', ''], // 排序方式(综合:空,销量:sale_num,价格:price) - ['sort', 'desc'], // 升序:asc,降序:desc - ['status', 1], // 升序:asc,降序:desc - ]); - return success((new ExchangeService())->getGoodsComponents($data)); - } - - /** - * 获取积分页面供组件调用 - * @return \think\Response - */ - public function getPointInfo() - { - return success((new ExchangeService())->getPointInfo()); - } - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/api/controller/exchange/OrderCreate.php b/niucloud/addon/shop/app/api/controller/exchange/OrderCreate.php deleted file mode 100644 index aecdf1aba..000000000 --- a/niucloud/addon/shop/app/api/controller/exchange/OrderCreate.php +++ /dev/null @@ -1,66 +0,0 @@ -request->params([ - ['order_key', []], - ['sku_data', []], - ['delivery', []], - ['discount', []],//优惠 - ]); - return success('SUCCESS', (new OrderCreateService())->calculate($data)); - } - - /** - * 订单创建 - * @return Response - */ - public function create() - { - $data = $this->request->params([ - ['order_key', []], - ['delivery', [] ], - ['member_remark', ''],//买家留言 - ['invoice', []],//发票 - ]); - return success('SUCCESS', (new OrderCreateService())->create($data)); - } - - /** - * 获取自提点 - * @return Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function getStore() - { - $data = $this->request->params([ - ['latlng', []], - ]); - return success('SUCCESS', (new OrderCreateService())->getStore($data['latlng'])); - } -} diff --git a/niucloud/addon/shop/app/api/controller/goods/Config.php b/niucloud/addon/shop/app/api/controller/goods/Config.php deleted file mode 100644 index 458a7f545..000000000 --- a/niucloud/addon/shop/app/api/controller/goods/Config.php +++ /dev/null @@ -1,26 +0,0 @@ -getSearchConfig()); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/api/controller/goods/Evaluate.php b/niucloud/addon/shop/app/api/controller/goods/Evaluate.php deleted file mode 100644 index 749249d53..000000000 --- a/niucloud/addon/shop/app/api/controller/goods/Evaluate.php +++ /dev/null @@ -1,97 +0,0 @@ -request->params([ - ['goods_id', 0], - ['scores', []], - ]); - return success((new EvaluateService())->getPage($data)); - } - - /** - * 商品评价详情 - * @param int $id - * @return \think\Response - */ - public function info(int $id) - { - return success((new EvaluateService())->getInfo($id)); - } - - /** - * 添加商品评价 - * @return \think\Response - */ - public function add() - { - $data = $this->request->params([ - ["evaluate_array", []], - ]); - (new EvaluateService())->add($data); - return success('SHOP_GOODS_EVALUATE_SUCCESS'); - } - - /** - * 评价统计 - * @return \think\Response - * @throws \think\db\exception\DbException - */ - public function count() - { - $data = $this->request->params([ - ['goods_id', 0], - ]); - return success((new EvaluateService())->getCount($data['goods_id'])); - } - - /** - * 商品详情展示 - * @return \think\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function lists() - { - $data = $this->request->params([ - ['goods_id', 0], - ]); - return success((new EvaluateService())->getList($data['goods_id'])); - } - - /** - * 评价信息 - * @param $id - */ - public function getEvaluate($id) - { - return success((new EvaluateService())->getDetail($id)); - } -} diff --git a/niucloud/addon/shop/app/api/controller/goods/Goods.php b/niucloud/addon/shop/app/api/controller/goods/Goods.php deleted file mode 100644 index 1f862fd1a..000000000 --- a/niucloud/addon/shop/app/api/controller/goods/Goods.php +++ /dev/null @@ -1,96 +0,0 @@ -request->params([ - [ 'keyword', '' ], // 搜索关键词 - [ "goods_category", "" ], // 商品分类 - [ "brand_id", "" ], // 品牌id - [ "label_ids", "" ], // 商品标签 - [ "start_price", "" ], // 价格开始区间 - [ "end_price", "" ], // 价格结束区间 - [ 'order', '' ], // 排序方式(综合:空,销量:sale_num,价格:price) - [ 'sort', 'desc' ], // 升序:asc,降序:desc - [ 'coupon_id', '' ] // 优惠券id - ]); - - return success(( new GoodsService() )->getPage($data)); - } - - /** - * 获取商品详情 - * @return \think\Response - */ - public function detail() - { - $data = $this->request->params([ - [ 'goods_id', 0 ], - [ 'sku_id', 0 ], - [ 'type', '' ], // 来源营销活动类型,discount:限时折扣,newcomer_discount:新人价 - ]); - return success(( new GoodsService() )->getDetail($data)); - } - - /** - * 获取商品规格信息,切换规格 - */ - public function sku() - { - $data = $this->request->params([ - [ 'sku_id', 0 ], - ]); - return success(( new GoodsService() )->getSku($data[ 'sku_id' ])); - } - - /** - * 获取商品列表供组件调用 - * @return \think\Response - */ - public function components() - { - $data = $this->request->params([ - [ 'num', 0 ], - [ 'goods_ids', '' ], - [ 'goods_category', 0 ], - [ 'order', '' ], // 排序方式(综合:空,销量:sale_num,价格:price) - ]); - - return success(( new GoodsService() )->getGoodsComponents($data)); - } - - /** - * 猜你喜欢 - * @return \think\Response - */ - public function recommend() - { - return success(( new GoodsService() )->getRecommend()); - } - -} diff --git a/niucloud/addon/shop/app/api/controller/goods/GoodsBrowse.php b/niucloud/addon/shop/app/api/controller/goods/GoodsBrowse.php deleted file mode 100644 index 5e0e4a611..000000000 --- a/niucloud/addon/shop/app/api/controller/goods/GoodsBrowse.php +++ /dev/null @@ -1,59 +0,0 @@ -request->params([ - [ 'date', [] ], - ]); - return success(( new GoodsBrowseService() )->getMemberGoodsBrowse($data)); - } - - /** - * 增加足迹 - */ - public function addGoodsBrowse() - { - $data = $this->request->params([ - [ 'goods_id', 0 ], - ]); - return success(( new GoodsBrowseService() )->addGoodsBrowse($data)); - } - - /** - * 删除足迹 - */ - public function deleteGoodsBrowse() - { - $data = $this->request->params([ - [ 'goods_ids', [] ], - ]); - return success(( new GoodsBrowseService() )->deleteGoodsBrowse($data)); - } - -} diff --git a/niucloud/addon/shop/app/api/controller/goods/GoodsCategory.php b/niucloud/addon/shop/app/api/controller/goods/GoodsCategory.php deleted file mode 100644 index b6fcab7c1..000000000 --- a/niucloud/addon/shop/app/api/controller/goods/GoodsCategory.php +++ /dev/null @@ -1,54 +0,0 @@ -getGoodsCategoryConfig()); - } - - /** - * 获取商品分类树结构 - * @return \think\Response - */ - public function tree() - { - return success(( new GoodsCategoryService() )->getTree()); - } - - /** - * 获取商品分类列表 - * @return \think\Response - */ - public function lists() - { - $data = $this->request->params([ - [ "pid", "" ], - ]); - return success(( new GoodsCategoryService() )->getList($data)); - } - -} diff --git a/niucloud/addon/shop/app/api/controller/goods/GoodsCollect.php b/niucloud/addon/shop/app/api/controller/goods/GoodsCollect.php deleted file mode 100644 index e45b4314e..000000000 --- a/niucloud/addon/shop/app/api/controller/goods/GoodsCollect.php +++ /dev/null @@ -1,57 +0,0 @@ -getMemberGoodsCollectList()); - } - - /** - * 商品增加收藏 - */ - public function addGoodsCollect() - { - $data = $this->request->params([ - [ 'goods_id', 0 ], - ]); - return success(( new GoodsCollectService() )->addGoodsCollect($data)); - } - - /** - * 商品取消收藏 - */ - public function cancelGoodsCollect() - { - $data = $this->request->params([ - [ 'goods_ids', [] ], - ]); - ( new GoodsCollectService() )->cancelGoodsCollect($data); - return success('CANCEL_COLLECT_SUCCESS'); - } - -} diff --git a/niucloud/addon/shop/app/api/controller/goods/GoodsService.php b/niucloud/addon/shop/app/api/controller/goods/GoodsService.php deleted file mode 100644 index 5033cfdd2..000000000 --- a/niucloud/addon/shop/app/api/controller/goods/GoodsService.php +++ /dev/null @@ -1,37 +0,0 @@ -request->params([ - [ 'limit', 0 ] - ]); - return success(( new GoodsServiceService() )->getAll($data)); - } - -} diff --git a/niucloud/addon/shop/app/api/controller/goods/Rank.php b/niucloud/addon/shop/app/api/controller/goods/Rank.php deleted file mode 100644 index 3dc9155d3..000000000 --- a/niucloud/addon/shop/app/api/controller/goods/Rank.php +++ /dev/null @@ -1,73 +0,0 @@ -getGoodsRankConfig()); - } - - /** - * 获取榜单列表 - * @return \think\Response - */ - public function pages() - { - $data = $this->request->params([ - [ "name", "" ], - ]); - return success(( new RankService() )->getPage($data)); - } - - /** - * 获取商品列表 - * @return \think\Response - */ - public function goods() - { - $data = $this->request->params([ - [ 'rank_id', 0 ], - [ 'page', 0 ], - [ 'limit', 0 ], - ]); - return success(( new RankService() )->getGoodsPage($data)); - } - - /** - * 获取商品排行榜列表供组件调用 - * @return \think\Response - */ - public function components() - { - $data = $this->request->params([ - [ 'rank_id', 0 ], - [ 'limit', 3 ], - ]); - - return success(( new RankService() )->getRankComponents($data)); - } - -} diff --git a/niucloud/addon/shop/app/api/controller/marketing/Coupon.php b/niucloud/addon/shop/app/api/controller/marketing/Coupon.php deleted file mode 100644 index 29f50b98e..000000000 --- a/niucloud/addon/shop/app/api/controller/marketing/Coupon.php +++ /dev/null @@ -1,127 +0,0 @@ -request->params([ - [ 'goods_id', '' ], - [ 'category_id', '' ], - [ 'type', '' ], // 优惠券类型 - [ 'order', '' ], // 排序方式(综合:空,最新:create_time,价格:price) - [ 'sort', 'desc' ], // 升序:asc,降序:desc - ]); - return success(( new CouponService() )->getPage($data)); - } - - /** - * 优惠券详情 - * @param int $id - * @return Response - */ - public function detail(int $id) - { - return success(( new CouponService() )->getDetail($id)); - } - - /** - * 优惠券领取 - */ - public function receive() - { - $data = $this->request->params([ - [ 'coupon_id', '' ], - [ 'type', 'receive' ], - [ 'number', 1 ], - ]); - ( new CouponService() )->receive($data); - return success('COUPON_RECEIVE_SUCCESS'); - - } - - /** - * 会员已领取优惠券列表 - * @return Response - */ - public function memberCouponlists() - { - $data = $this->request->params([ - [ 'status', '' ], - [ 'type', 'all' ] - ]); - return success(( new CouponService() )->getMemberPage($data)); - } - - /** - * 会员优惠券按状态查询数量 - * @return Response - */ - public function memberCouponStatusCount() - { - return success(data:( new CouponService() )->getCouponCountByStatus()); - } - - /** - * 会员已领取优惠券数量(待使用) - * @return Response - */ - public function memberCouponCount() - { - $data = $this->request->params([ - [ 'status', '' ] - ]); - return success(data:( new CouponService() )->getMemberCount($data)); - } - - /** - * 获取优惠券列表供组件调用 - * @return Response - */ - public function components() - { - $data = $this->request->params([ - [ 'num', 0 ], - [ 'coupon_ids', '' ] - ]); - return success(( new CouponService() )->getCouponComponents($data)); - } - - /** - * 获取优惠券二维码 - * @param int $id - * @return Response - */ - public function qrcode(int $id) - { - return success(data:( new CouponService() )->getQrcode($id)); - } - - /** - * 获取优惠券类型 - * @return Response - */ - public function getCouponType() - { - return success(( new CouponService() )->getCouponType()); - } - -} diff --git a/niucloud/addon/shop/app/api/controller/marketing/Discount.php b/niucloud/addon/shop/app/api/controller/marketing/Discount.php deleted file mode 100644 index 870f1d784..000000000 --- a/niucloud/addon/shop/app/api/controller/marketing/Discount.php +++ /dev/null @@ -1,64 +0,0 @@ -getDiscountBannerConfig()); - } - - /** - * 获取商品列表 - * @return \think\Response - */ - public function goods() - { - $data = $this->request->params([ - [ 'keyword', '' ], // 搜索关键词 - [ "goods_category", "" ], // 商品分类 - [ "brand_id", "" ], // 品牌id - [ "label_ids", "" ], // 商品标签 - [ "start_price", "" ], // 价格开始区间 - [ "end_price", "" ], // 价格结束区间 - [ 'order', '' ], // 排序方式(综合:空,销量:sale_num,价格:price) - [ 'sort', 'desc' ], // 升序:asc,降序:desc - [ 'discount_id', 0 ], - ]); - - return success(( new DiscountService() )->getGoodsPage($data)); - } - - /** - * 获取限时折扣列表 - * @return \think\Response - */ - public function lists() - { - $data = $this->request->params([ - [ 'active_name', '' ], // 搜索关键词 - [ 'limit', 10 ], - ]); - - return success(( new DiscountService() )->getList($data)); - } - -} diff --git a/niucloud/addon/shop/app/api/controller/marketing/Manjian.php b/niucloud/addon/shop/app/api/controller/marketing/Manjian.php deleted file mode 100644 index 557457a8d..000000000 --- a/niucloud/addon/shop/app/api/controller/marketing/Manjian.php +++ /dev/null @@ -1,34 +0,0 @@ -request->params([ - [ 'goods_id', 0 ], - [ 'sku_id', 0 ] - ]); - return success(( new ManjianService() )->getManjianInfo($data)); - } - -} diff --git a/niucloud/addon/shop/app/api/controller/marketing/Newcomer.php b/niucloud/addon/shop/app/api/controller/marketing/Newcomer.php deleted file mode 100644 index 31a7f97ee..000000000 --- a/niucloud/addon/shop/app/api/controller/marketing/Newcomer.php +++ /dev/null @@ -1,62 +0,0 @@ -request->params([ - [ 'keyword', '' ], // 搜索关键词 - [ "goods_category", "" ], // 商品分类 - [ "brand_id", "" ], // 品牌id - [ "start_price", "" ], // 价格开始区间 - [ "end_price", "" ], // 价格结束区间 - [ 'order', '' ], // 排序方式(综合:空,销量:sale_num,价格:price) - [ 'sort', 'desc' ], // 升序:asc,降序:desc - ]); - - return success(( new NewcomerService() )->getGoodsPage($data)); - } - - /** - * 新人专享组件商品列表 - * @return Response - */ - public function componentsList() - { - $data = $this->request->params([ - [ 'limit', 0 ], - [ 'sku_ids', [] ] - ]); - return success(( new NewcomerService() )->getComponentsList($data)); - } - - /** - * 获取新人专享活动规则 - * @return Response - */ - public function config() - { - return success(data:( new NewcomerService() )->getConfig()); - } - -} diff --git a/niucloud/addon/shop/app/api/controller/order/Invoice.php b/niucloud/addon/shop/app/api/controller/order/Invoice.php deleted file mode 100644 index 8bbca26e6..000000000 --- a/niucloud/addon/shop/app/api/controller/order/Invoice.php +++ /dev/null @@ -1,116 +0,0 @@ -request->params([ - ['status', ''], - ]); - $data = (new InvoiceService())->pages($data); - return success($data); - } - - /** - * 发票列表 - * @return \think\Response - */ - public function info($id) - { - $data = (new InvoiceService())->detail($id); - return success($data); - } - - /** - * 申请开发票 - * @return \think\Response - */ - public function apply() - { - $data = $this->request->params([ - ['trade_ids', []], - ['header_type', ''], - ['header_name', ''], - ['type', ''], - ['name', ''], - ['tax_number', ''], - ['mobile', ''], - ['email', ''], - ['telephone', ''], - ['address', ''], - ['bank_name', ''], - ['bank_card_number', ''], - ['money', ''], - ['pay_voucher', ''], - ]); - (new InvoiceService())->apply($data); - return success("SUCCESS"); - } - - /** - * 计算发票金额 - * @param $trade_ids - * @return \think\Response - */ - public function calculate($trade_ids) - { - $info = (new OrderService())->calculateInvoiceMoney($trade_ids); - return success("SUCCESS", $info); - } - - /** - * 发票列表 - * @return \think\Response - */ - public function edit($id) - { - $data = $this->request->params([ - ['id', $id], - ['header_type', ''], - ['header_name', ''], - ['type', ''], - ['name', ''], - ['tax_number', ''], - ['mobile', ''], - ['email', ''], - ['telephone', ''], - ['address', ''], - ['bank_name', ''], - ['bank_card_number', ''], - ['money', ''], - ['pay_voucher', ''], - ]); - (new InvoiceService())->edit($data); - return success('EDIT_SUCCESS'); - } - - /** - * 取消发票 - * @return \think\Response - */ - public function cancel($id) - { - (new InvoiceService())->cancel($id); - return success('SUCCESS'); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/api/controller/order/Order.php b/niucloud/addon/shop/app/api/controller/order/Order.php deleted file mode 100644 index 678cedd37..000000000 --- a/niucloud/addon/shop/app/api/controller/order/Order.php +++ /dev/null @@ -1,98 +0,0 @@ -request->params([ - [ 'order_no', '' ], - [ 'status', '' ], - [ 'activity_type', '' ], - [ 'body', '' ], - ]); - return success(( new OrderService() )->getPage($data)); - } - - /** - * 订单详情 - * @param $order_id - * @return Response - */ - public function detail($order_id) - { - return success(( new OrderService() )->getDetail($order_id)); - } - - /** - * 获取订单状态 - * @return Response - */ - public function orderStatus() - { - return success(OrderDict::getStatus()); - } - - /** - * 订单关闭 - * @param $id - * @return Response - */ - public function orderClose($id) - { - return success(data:( new OrderService() )->close($id)); - } - - /** - * 订单完成 - * @param $id - * @return Response - */ - public function orderFinish($id) - { - return success(data:( new OrderService() )->finish($id)); - } - - public function getPackage() - { - $data = $this->request->params([ - [ 'id', '' ], - [ 'mobile', '' ], - ]); - return success(( new OrderService() )->getDeliveryPackage($data)); - } - - public function getNum() - { - return success(( new OrderService() )->num()); - } - - /** - * 订单设置 - * @return Response - */ - public function getConfig() - { - return success(( new ConfigService() )->getConfig()); - } -} diff --git a/niucloud/addon/shop/app/api/controller/order/OrderCreate.php b/niucloud/addon/shop/app/api/controller/order/OrderCreate.php deleted file mode 100644 index 5af21948f..000000000 --- a/niucloud/addon/shop/app/api/controller/order/OrderCreate.php +++ /dev/null @@ -1,110 +0,0 @@ -request->params([ -// ['cart_ids', []], -// ['sku_data', []], -// ['delivery_type', ''],//配送方式 -// -// ]); -// return success('SUCCESS', (new OrderCreateService())->confirm($data)); -// } - - /** - * 计算 - * @return Response - */ - public function calculate() - { - $data = $this->request->params([ - ['order_key', []], - ['cart_ids', []], - ['sku_data', []], - ['delivery', []], - ['is_need_recalculate', 0], -// ['member_remark', ''],//买家留言 - ['discount', []],//优惠 -// ['invoice', []],//发票 - ['extend_data', []],// 扩展数据 - ['impulse_buy_goods', []], // 顺买商品信息 - ['position', []],//用户位置信息 - ]); - - return success('SUCCESS', ( new OrderCreateService() )->calculate($data)); - } - - /** - * 订单创建 - * @return Response - */ - public function create() - { - $data = $this->request->params([ - ['order_key', []], - ['member_remark', ''],//买家留言 - ['delivery', []],//配送参数 -// ['discount', []],//优惠 - ['invoice', []],//发票 - ['form_data', []] // 万能表单数据 - ]); - return success('SUCCESS', (new OrderCreateService())->create($data)); - } - - /** - * 查询优惠券 - * @return Response - */ - public function getCoupon() - { - $data = $this->request->params([ - ['order_key', []], - ]); - return success('SUCCESS', (new OrderCreateService())->getCoupon($data)); - } - - /** - * 获取自提点 - * @return Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function getStore() - { - $data = $this->request->params([ - ['latlng', []], - ]); - return success('SUCCESS', (new OrderCreateService())->getStore($data['latlng'])); - } - - /** - * 获取同城配送配置项 - * @return Response - */ - public function getLocalDeliveryConfig() - { - return success(((new OrderCreateService())->getLocalDeliveryConfig())); - } -} diff --git a/niucloud/addon/shop/app/api/controller/refund/Refund.php b/niucloud/addon/shop/app/api/controller/refund/Refund.php deleted file mode 100644 index 2917d14be..000000000 --- a/niucloud/addon/shop/app/api/controller/refund/Refund.php +++ /dev/null @@ -1,170 +0,0 @@ -request->params([ - [ 'status', '' ], - ]); - return success(( new RefundService() )->getPage($data)); - } - - /** - * 订单详情 - * @param int $order_refund_no - * @return Response - */ - public function detail(string $order_refund_no) - { - return success(( new RefundService() )->getDetail($order_refund_no)); - } - - /** - * 发起退款 - * @return Response - */ - public function apply() - { - $data = $this->request->params([ - [ 'order_id', 0 ], - [ 'order_goods_id', 0 ], - [ 'refund_type', '' ], - [ 'apply_money', 0 ], - [ 'reason', '' ], - [ 'remark', '' ], - [ 'voucher', '' ], - ]); - ( new RefundActionService() )->apply($data); - return success(); - } - - /** - * 修改退款 - * @return Response - */ - public function edit($order_refund_no) - { - $data = $this->request->params([ - [ 'refund_type', '' ], - [ 'apply_money', 0 ], - [ 'reason', '' ], - [ 'remark', '' ], - [ 'voucher', '' ], - ]); - $data[ 'order_refund_no' ] = $order_refund_no; - ( new RefundActionService() )->edit($data); - return success(); - } - - /** - * 关闭退款 - * @return Response - */ - public function close($order_refund_no) - { - $data = $this->request->params([ - [ 'refund_type', '' ], - [ 'apply_money', 0 ], - [ 'reason', '' ], - [ 'remark', '' ], - [ 'voucher', '' ], - ]); - $data[ 'order_refund_no' ] = $order_refund_no; - ( new RefundActionService() )->close($data); - return success(); - } - - /** - * 买家退货 - * @return Response - */ - public function delivery($order_refund_no) - { - $data = $this->request->params([ - [ 'delivery', [] ],//{"express_number": 11, "express_company":4545, "remark":''} - ]); - $data[ 'order_refund_no' ] = $order_refund_no; - ( new RefundActionService() )->delivery($data); - return success(); - } - - /** - * 修改买家退货 - * @return Response - */ - public function editDelivery($order_refund_no) - { - $data = $this->request->params([ - [ 'delivery', [] ],//{"express_number": 11, "express_company":4545, "remark":''} - ]); - $data[ 'order_refund_no' ] = $order_refund_no; - ( new RefundActionService() )->editDelivery($data); - return success(); - } - - /** - * 退款原因 - * @return Response - */ - public function getRefundReason() - { - return success(( new RefundActionService() )->getRefundReason()); - } - - /** - * 获取退款方式 - * @return Response - */ - public function getRefundType() - { - return success(OrderRefundDict::getRefundType()); - } - - /** - * 获取可退款信息 - * @return void - */ - public function getRefundData() - { - $data = $this->request->params([ - [ 'order_goods_id', 0 ], - ]); - return success(data:( new RefundActionService() )->getRefundData($data)); - } - - /** - * 退款编辑可退款信息 - * @return Response - */ - public function getRefundDataByOrderRefundNo() - { - $data = $this->request->params([ - [ 'order_refund_no', '' ], - ]); - return success(data:( new RefundActionService() )->getRefundDataByOrderRefundNo($data)); - } -} - - diff --git a/niucloud/addon/shop/app/api/route/route.php b/niucloud/addon/shop/app/api/route/route.php deleted file mode 100644 index 34bb9d44b..000000000 --- a/niucloud/addon/shop/app/api/route/route.php +++ /dev/null @@ -1,312 +0,0 @@ -middleware(ApiChannel::class) - ->middleware(ApiCheckToken::class)//false表示不验证登录 - ->middleware(ApiLog::class); - - -Route::group('shop', function () { - - /***************************************************** 购物车 ****************************************************/ - - // 添加购物车 - Route::post('cart', 'addon\shop\app\api\controller\cart\Cart@add'); - - // 编辑购物车数量 - Route::put('cart', 'addon\shop\app\api\controller\cart\Cart@edit'); - - // 购物车删除 - Route::put('cart/delete', 'addon\shop\app\api\controller\cart\Cart@del'); - - // 清空购物车 - Route::delete('cart/clear', 'addon\shop\app\api\controller\cart\Cart@clear'); - - // 购物车列表 - Route::get('cart', 'addon\shop\app\api\controller\cart\Cart@lists'); - - // 购物车商品列表 - Route::get('cart/goods', 'addon\shop\app\api\controller\cart\Cart@goodsLists'); - - // 购物车数量 - Route::get('cart/sum', 'addon\shop\app\api\controller\cart\Cart@sum'); - - // 购物车计算 - Route::get('cart/calculate', 'addon\shop\app\api\controller\cart\Cart@calculate'); - - /***************************************************** 订单 ****************************************************/ - - //列表 - Route::get('order', 'addon\shop\app\api\controller\order\Order@lists'); - - //数量 - Route::get('order/num', 'addon\shop\app\api\controller\order\Order@getNum'); - - //详情 - Route::get('order/:order_id', 'addon\shop\app\api\controller\order\Order@detail'); - - //订单状态 - Route::get('order/status', 'addon\shop\app\api\controller\order\Order@orderStatus'); - - // 订单设置 - Route::get('order/config', 'addon\shop\app\api\controller\order\Order@getConfig'); - - //创建订单 - Route::post('order_create/create', 'addon\shop\app\api\controller\order\OrderCreate@create'); - - //计算 - Route::get('order_create/calculate', 'addon\shop\app\api\controller\order\OrderCreate@calculate'); - - //查询优惠券 - Route::get('order_create/coupon', 'addon\shop\app\api\controller\order\OrderCreate@getCoupon'); - - // 查询自提点 - Route::get('order_create/store', 'addon\shop\app\api\controller\order\OrderCreate@getStore'); - Route::get('order_create/local', 'addon\shop\app\api\controller\order\OrderCreate@getLocalDeliveryConfig'); - - // 获取同城配送轨迹 - Route::get('delivery/track_of_local', 'addon\shop\app\api\controller\delivery\Order@getTrackOfLocalDeliveryOrder'); - - //获取订单确认数据 - Route::get('confirm', 'addon\shop\app\api\controller\order\OrderCreate@confirm'); - - // 订单关闭 - Route::put('order/close/:id', 'addon\shop\app\api\controller\order\Order@orderClose'); - - // 订单完成 - Route::put('order/finish/:id', 'addon\shop\app\api\controller\order\Order@orderFinish'); - - //物流跟踪 - Route::get('order/logistics', 'addon\shop\app\api\controller\order\Order@getPackage'); - //发票相关 - Route::get('order/invoice/list', 'addon\shop\app\api\controller\order\Invoice@list'); - Route::get('order/invoice/:id', 'addon\shop\app\api\controller\order\Invoice@info'); - Route::post('order/invoice/apply', 'addon\shop\app\api\controller\order\Invoice@apply'); - Route::post('order/invoice/edit/:id', 'addon\shop\app\api\controller\order\Invoice@edit'); - Route::delete('order/invoice/cancel/:id', 'addon\shop\app\api\controller\order\Invoice@cancel'); - Route::post('order/invoice/calculate', 'addon\shop\app\api\controller\order\Invoice@calculate'); - - //添加优惠券 - Route::post('coupon', 'addon\shop\app\api\controller\marketing\Coupon@receive'); - - //优惠券列表 - Route::get('member/coupon', 'addon\shop\app\api\controller\marketing\Coupon@memberCouponlists'); - - //优惠券数量 - Route::get('member/coupon/count', 'addon\shop\app\api\controller\marketing\Coupon@memberCouponCount'); - - //优惠券状态数量 - Route::get('member/coupon/status_count', 'addon\shop\app\api\controller\marketing\Coupon@memberCouponStatusCount'); - - //商品收藏列表 - Route::get('goods/collect', 'addon\shop\app\api\controller\goods\GoodsCollect@getMemberGoodsCollectList'); - - //商品添加收藏 - Route::post('goods/collect/:goods_id', 'addon\shop\app\api\controller\goods\GoodsCollect@addGoodsCollect'); - - //商品取消收藏 - Route::put('goods/collect', 'addon\shop\app\api\controller\goods\GoodsCollect@cancelGoodsCollect'); - - //商品足迹 - Route::get('goods/browse', 'addon\shop\app\api\controller\goods\GoodsBrowse@getMemberGoodsBrowseList'); - - //商品足迹添加 - Route::post('goods/browse', 'addon\shop\app\api\controller\goods\GoodsBrowse@addGoodsBrowse'); - - //商品足迹删除 - Route::delete('goods/browse', 'addon\shop\app\api\controller\goods\GoodsBrowse@deleteGoodsBrowse'); - - //订单售后 列表 - Route::get('order/refund', 'addon\shop\app\api\controller\refund\Refund@lists'); - - //订单售后 列表 - Route::get('order/refund/:order_refund_no', 'addon\shop\app\api\controller\refund\Refund@detail'); - - // 查询订单项可退款信息 - Route::get('refund/refund_data', 'addon\shop\app\api\controller\refund\Refund@getRefundData'); - - // 查询订单项退款信息 - Route::get('refund/refund_data_by_no', 'addon\shop\app\api\controller\refund\Refund@getRefundDataByOrderRefundNo'); - - // 申请售后 - Route::post('refund/apply', 'addon\shop\app\api\controller\refund\Refund@apply'); - - // 修改退款申请 - Route::put('refund/:order_refund_no', 'addon\shop\app\api\controller\refund\Refund@edit'); - - // 售后退货 - Route::post('refund/delivery/:order_refund_no', 'addon\shop\app\api\controller\refund\Refund@delivery'); - - // 修改售后退货信息 - Route::put('refund/delivery/:order_refund_no', 'addon\shop\app\api\controller\refund\Refund@editDelivery'); - - // 取消售后 - Route::put('refund/close/:order_refund_no', 'addon\shop\app\api\controller\refund\Refund@close'); - - // 退款原因 - Route::get('refund/reason', 'addon\shop\app\api\controller\refund\Refund@getRefundReason'); - - // 退款方式 - Route::get('order/refund/type', 'addon\shop\app\api\controller\refund\Refund@getRefundType'); - - //积分商城订单计算 - Route::get('exchange_order/calculate', 'addon\shop\app\api\controller\exchange\OrderCreate@calculate'); - - //积分商城订单创建 - Route::post('exchange_order/create', 'addon\shop\app\api\controller\exchange\OrderCreate@create'); - - // 发票列表 - Route::get('invoice', 'addon\shop\app\api\controller\order\Invoice@lists'); - - // 发票详情 - Route::get('invoice/:id', 'addon\shop\app\api\controller\order\Invoice@info'); - - /***************************************************** 满减送 ****************************************************/ - - // 获取商品满减优惠信息 - Route::get('manjian/info', 'addon\shop\app\api\controller\marketing\Manjian@info'); - -})->middleware(ApiChannel::class) - ->middleware(ApiCheckToken::class, true)//表示验证登录 - ->middleware(ApiLog::class); diff --git a/niucloud/addon/shop/app/dict/active/ActiveDict.php b/niucloud/addon/shop/app/dict/active/ActiveDict.php deleted file mode 100644 index ce80ecbec..000000000 --- a/niucloud/addon/shop/app/dict/active/ActiveDict.php +++ /dev/null @@ -1,110 +0,0 @@ - get_lang('dict_shop_active_status.not_active'), - self::ACTIVE => get_lang('dict_shop_active_status.active'), - self::END => get_lang('dict_shop_active_status.end'), - self::CLOSE => get_lang('dict_shop_active_status.close'), - ]; - if ($status == '') return $list; - return $list[ $status ] ?? ''; - } - - /** - * 活动类别 - * @param $type - * @return array|mixed|string - */ - public static function getClass($type = '') - { - $list = [ - self::DISCOUNT => get_lang('dict_shop_active_class.discount'), - self::EXCHANGE => get_lang('dict_shop_active_class.exchange'), - self::MANJIANSONG => get_lang('dict_shop_active_class.manjiansong'), - self::NEWCOMER_DISCOUNT => get_lang('dict_shop_active_class.newcomer_discount'), - self::GIFTCARD => get_lang('dict_shop_active_class.newcomer_discount'), - self::PINTUAN => get_lang('dict_shop_active_class.newcomer_discount'), - ]; - if ($type == '') return $list; - return $list[ $type ] ?? ''; - } - - /** - * 活动类型 - * @param $type - * @return array|mixed|string - */ - public static function getType($type = '') - { - $list = [ - self::MEMBER => get_lang('dict_shop_active_type.member'), - self::GOODS => get_lang('dict_shop_active_type.goods'), - self::SHOP => get_lang('dict_shop_active_type.shop'), - ]; - if ($type == '') return $list; - return $list[ $type ] ?? ''; - } - - /** - * 活动商品类型 - * @param $type - * @return array|mixed|string - */ - public static function getGoodsType($type = '') - { - $list = [ - self::GOODS_SINGLE => get_lang('dict_shop_active_goods_type.single'), - self::GOODS_INDEPENDENT => get_lang('dict_shop_active_goods_type.independent'), - self::GOODS_SHOP => get_lang('dict_shop_active_goods_type.shop'), - ]; - if ($type == '') return $list; - return $list[ $type ] ?? ''; - } - -} diff --git a/niucloud/addon/shop/app/dict/active/DiscountDict.php b/niucloud/addon/shop/app/dict/active/DiscountDict.php deleted file mode 100644 index 80fa0744a..000000000 --- a/niucloud/addon/shop/app/dict/active/DiscountDict.php +++ /dev/null @@ -1,47 +0,0 @@ - get_lang('dict_shop_active_status.not_active'), - self::ACTIVE => get_lang('dict_shop_active_status.active'), - self::END => get_lang('dict_shop_active_status.end'), - self::CLOSE => get_lang('dict_shop_active_status.close'), - ]; - if ($status == '') return $list; - return $list[ $status ] ?? ''; - } - - - -} diff --git a/niucloud/addon/shop/app/dict/active/ExchangeDict.php b/niucloud/addon/shop/app/dict/active/ExchangeDict.php deleted file mode 100644 index c069539f1..000000000 --- a/niucloud/addon/shop/app/dict/active/ExchangeDict.php +++ /dev/null @@ -1,75 +0,0 @@ - get_lang('dict_shop_point_exchange_type.goods'), - self::COUPON => get_lang('dict_shop_point_exchange_type.coupon'), - self::BALANCE => get_lang('dict_shop_point_exchange_type.balance'), - ]; - if ($type == '') return $list; - return $list[ $type ] ?? ''; - } - - - /** - * 活动状态 - */ - public static function getStatus($status = '') - { - $list = [ - self::UP => '已上架', - self::DOWN => "已下架", - ]; - if ($status == '') return $list; - return $list[ $status ] ?? ''; - } - - - /** - * 活动类别 - * @param $type - * @return array|mixed|string - */ - public static function getClass($type = '') - { - $list = [ - self::DISCOUNT => get_lang('dict_shop_active_class.exchange'), - ]; - if ($type == '') return $list; - return $list[ $type ] ?? ''; - } - - -} diff --git a/niucloud/addon/shop/app/dict/active/ManjianDict.php b/niucloud/addon/shop/app/dict/active/ManjianDict.php deleted file mode 100644 index 6fd77647b..000000000 --- a/niucloud/addon/shop/app/dict/active/ManjianDict.php +++ /dev/null @@ -1,128 +0,0 @@ - get_lang('dict_shop_manjian_condition_type.over_n_yuan'), - self::OVER_N_PIECE => get_lang('dict_shop_manjian_condition_type.over_n_piece'), - ]; - if ($type == '') return $list; - return $list[ $type ] ?? ''; - } - - /** - * 参与类型 - * @param $type - * @return array|mixed|string - */ - public static function getGoodsType($type = '') - { - $list = [ - self::ALL_GOODS => get_lang('dict_shop_manjian_goods_type.all_goods'), - self::SELECTED_GOODS => get_lang('dict_shop_manjian_goods_type.selected_goods'), - self::SELECTED_GOODS_NOT => get_lang('dict_shop_manjian_goods_type.selected_goods_not'), - ]; - if ($type == '') return $list; - return $list[ $type ] ?? ''; - } - - /** - * 参与会员类型 - * @param $type - * @return array|mixed|string - */ - public static function getJoinMemberType($type = '') - { - $list = [ - self::ALL_MEMBER => get_lang('dict_shop_manjian_join_member_type.all_member'), - self::SELECTED_MEMBER_LEVEL => get_lang('dict_shop_manjian_join_member_type.selected_member_level'), - self::SELECTED_MEMBER_LABEL => get_lang('dict_shop_manjian_join_member_type.selected_member_label'), - ]; - if ($type == '') return $list; - return $list[ $type ] ?? ''; - } - - /** - * 优惠规格 - * @param $type - * @return array|mixed|string - */ - public static function getRuleType($type = '') - { - $list = [ - self::LADDER => get_lang('dict_shop_manjian_rule_type.ladder'), - self::CYCLE => get_lang('dict_shop_manjian_rule_type.cycle'), - ]; - if ($type == '') return $list; - return $list[ $type ] ?? ''; - } - - /** - * 状态 - * @param $type - * @return array|mixed|string - */ - public static function getStatus($type = '') - { - $data = [ - self::NOT_ACTIVE => get_lang('dict_shop_manjian_status.not_active'), // 未开始 - self::ACTIVE => get_lang('dict_shop_manjian_status.active'), // 进行中 - self::END => get_lang('dict_shop_manjian_status.end'), // 已结束 - self::CLOSE => get_lang('dict_shop_manjian_status.close'), // 已关闭 - ]; - if (!$type) { - return $data; - } - return $data[ $type ] ?? ''; - } - -} diff --git a/niucloud/addon/shop/app/dict/active/NewcomerDict.php b/niucloud/addon/shop/app/dict/active/NewcomerDict.php deleted file mode 100644 index 03579b4cc..000000000 --- a/niucloud/addon/shop/app/dict/active/NewcomerDict.php +++ /dev/null @@ -1,25 +0,0 @@ - get_lang('dict_shop_cart.normal'), - self::INVALID => get_lang('dict_shop_cart.invalid'), - ]; - if ($status == '') return $list; - return $list[ $status ] ?? ''; - } -} diff --git a/niucloud/addon/shop/app/dict/coupon/CouponDict.php b/niucloud/addon/shop/app/dict/coupon/CouponDict.php deleted file mode 100644 index 96eb59008..000000000 --- a/niucloud/addon/shop/app/dict/coupon/CouponDict.php +++ /dev/null @@ -1,142 +0,0 @@ - get_lang('dict_shop_coupon.all'), - self::CATEGORY => get_lang('dict_shop_coupon.category'), - self::GOODS => get_lang('dict_shop_coupon.goods'), - ]; - if ($type == '') return $list; - return $list[ $type ] ?? ''; - } - - /** - * 领取优惠券类型 - * @param $status - * @return array|mixed|string - */ - public static function getReceiveType($type = '') - { - $list = [ - self::USER => get_lang('dict_shop_coupon.user'), - self::GRANT => get_lang('dict_shop_coupon.grant'), - ]; - if ($type == '') return $list; - return $list[ $type ] ?? ''; - } - - - //未开始 - const WAIT_START = 0; - //进行中 - const NORMAL = 1; - //已过期 - const EXPIRE = 2; - //已失效 - const INVALID = 3; - - const SEND_RANGE_ALL = 'all'; - const SEND_RANGE_MEMBER = 'member'; - const SEND_RANGE_MEMBER_LEVEL = 'member_level'; - const SEND_RANGE_MEMBER_LABEL = 'member_label'; - - const SEND_STATUS_WAIT= 'wait'; - const SEND_STATUS_PROGRESS= 'progress'; - const SEND_STATUS_FINISH= 'finish'; - - /** - * 状态 - * @param $status - * @return array|mixed|string - */ - public static function getStatus($status = '') - { - $list = [ - self::WAIT_START => get_lang('dict_shop_coupon.wait_start'), - self::NORMAL => get_lang('dict_shop_coupon.normal'), - self::EXPIRE => get_lang('dict_shop_coupon.expire'), - self::INVALID => get_lang('dict_shop_coupon.invalid'), - ]; - if ($status == '') return $list; - return $list[ $status ] ?? ''; - } - - /** - * 发券范围 - * @param $status - * @return array|mixed|string - */ - public static function getSendCouponRangeType($range = '') - { - $list = [ - self::SEND_RANGE_ALL => get_lang('dict_shop_send_coupon_range.all'), - self::SEND_RANGE_MEMBER => get_lang('dict_shop_send_coupon_range.member'), - self::SEND_RANGE_MEMBER_LEVEL => get_lang('dict_shop_send_coupon_range.member_level'), - self::SEND_RANGE_MEMBER_LABEL => get_lang('dict_shop_send_coupon_range.member_label'), - ]; - if ($range == '') return $list; - return $list[ $range ] ?? ''; - } - - /** - * 发券范围描述 - * @param $status - * @return array|mixed|string - */ - public static function getSendCouponRangeTypeDesc($range = '') - { - $list = [ - self::SEND_RANGE_ALL => get_lang('dict_shop_send_coupon_range_type_desc.all'), - self::SEND_RANGE_MEMBER => get_lang('dict_shop_send_coupon_range_type_desc.member'), - self::SEND_RANGE_MEMBER_LEVEL => get_lang('dict_shop_send_coupon_range_type_desc.member_level'), - self::SEND_RANGE_MEMBER_LABEL => get_lang('dict_shop_send_coupon_range_type_desc.member_label'), - ]; - if ($range == '') return $list; - return $list[ $range ] ?? ''; - } - - /** - * 发券状态 - * @param $status - * @return array|mixed|string - */ - public static function getSendCouponStatus($range = '') - { - $list = [ - self::SEND_STATUS_WAIT => get_lang('dict_shop_send_coupon_status.wait'), - self::SEND_STATUS_PROGRESS => get_lang('dict_shop_send_coupon_status.progress'), - self::SEND_STATUS_FINISH => get_lang('dict_shop_send_coupon_status.finish'), - ]; - if ($range == '') return $list; - return $list[ $range ] ?? ''; - } - - -} diff --git a/niucloud/addon/shop/app/dict/coupon/CouponMemberDict.php b/niucloud/addon/shop/app/dict/coupon/CouponMemberDict.php deleted file mode 100644 index e85e9fa33..000000000 --- a/niucloud/addon/shop/app/dict/coupon/CouponMemberDict.php +++ /dev/null @@ -1,41 +0,0 @@ - get_lang('dict_shop_member_coupon.wait_use'), - self::USED => get_lang('dict_shop_member_coupon.used'), - self::EXPIRE => get_lang('dict_shop_member_coupon.expire'), - self::INVALID => get_lang('dict_shop_member_coupon.invalid'), - ]; - if ($status == '') return $list; - return $list[$status] ?? ''; - } -} diff --git a/niucloud/addon/shop/app/dict/delivery/DeliveryDict.php b/niucloud/addon/shop/app/dict/delivery/DeliveryDict.php deleted file mode 100644 index 71ea9a200..000000000 --- a/niucloud/addon/shop/app/dict/delivery/DeliveryDict.php +++ /dev/null @@ -1,100 +0,0 @@ - [ 'name' => '周一', 'type' => 1 ], - 2 => [ 'name' => '周二', 'type' => 2 ], - 3 => [ 'name' => '周三', 'type' => 3 ], - 4 => [ 'name' => '周四', 'type' => 4 ], - 5 => [ 'name' => '周五', 'type' => 5 ], - 6 => [ 'name' => '周六', 'type' => 6 ], - 0 => [ 'name' => '周日', 'type' => 0 ], - ]; - //时间间隔 单位 分钟 - const TIME_INTERVAL_30 = 30; - const TIME_INTERVAL_60 = 60; - const TIME_INTERVAL_90 = 90; - const TIME_INTERVAL_120 = 120; - - /** - * 获取配送方式(用于订单) - * @param string $type - * @return array|array[]|string - */ - public static function getType(string $type = '') - { - $data = [ - self::EXPRESS => get_lang('dict_shop_delivery_type.express'), - self::LOCAL_DELIVERY => get_lang('dict_shop_delivery_type.local_delivery'), - self::STORE => get_lang('dict_shop_delivery_type.store'), - ]; - - if ($type == '') { - return $data; - } - return $data[ $type ] ?? ''; - } - - /** - * 获取周列表 - * @param string $type - * @return array|array[]|string - */ - public static function getWeekList($week = '') - { - if ($week !== '') { - return self::WEEK_LIST[ $week ]; - } - return self::WEEK_LIST; - } - - public static function getTimeIntervalList($time_interval = '') - { - $list = [ - self::TIME_INTERVAL_30 => [ - 'type' => self::TIME_INTERVAL_30, - 'name' => get_lang('dict_shop_delivery_store_time_interval.30'), - ], - self::TIME_INTERVAL_60 => [ - 'type' => self::TIME_INTERVAL_60, - 'name' => get_lang('dict_shop_delivery_store_time_interval.60'), - ], - self::TIME_INTERVAL_90 => [ - 'type' => self::TIME_INTERVAL_90, - 'name' => get_lang('dict_shop_delivery_store_time_interval.90'), - ], - self::TIME_INTERVAL_120 => [ - 'type' => self::TIME_INTERVAL_120, - 'name' => get_lang('dict_shop_delivery_store_time_interval.120'), - ], - ]; - if ($time_interval == '') return $list; - return $list[ $time_interval ]; - } -} diff --git a/niucloud/addon/shop/app/dict/delivery/DeliveryLocalDict.php b/niucloud/addon/shop/app/dict/delivery/DeliveryLocalDict.php deleted file mode 100644 index 5b2656868..000000000 --- a/niucloud/addon/shop/app/dict/delivery/DeliveryLocalDict.php +++ /dev/null @@ -1,48 +0,0 @@ - [ - 'name' => '达达配送', - 'column' => [ 'app_secret', 'app_key', 'shop_id', 'shop_store_no' ], - 'encrypt_params' => [ 'app_secret', 'app_key', 'shop_id', 'shop_store_no' ] - ], - ]; - - if ($type == '') { - return $data; - } - return $data[ $type ] ?? ''; - } -} diff --git a/niucloud/addon/shop/app/dict/delivery/ElectronicSheetDict.php b/niucloud/addon/shop/app/dict/delivery/ElectronicSheetDict.php deleted file mode 100644 index 5620b3d42..000000000 --- a/niucloud/addon/shop/app/dict/delivery/ElectronicSheetDict.php +++ /dev/null @@ -1,53 +0,0 @@ - get_lang('dict_shop_delivery_electronic_sheet.cash_payment'), - 2 => get_lang('dict_shop_delivery_electronic_sheet.freight_collect'), - 3 => get_lang('dict_shop_delivery_electronic_sheet.monthly_statement') - ]; - if ($type == '') return $type_list; - return $type_list[ $type ] ?? ''; - } - - - /** - * 快递100 支付方式类型 - * @param $type - * @return string|string[] - */ - public static function getKd100PayType($type = '') - { - $type_list = [ - 1 =>"SHIPPER", - 2 =>"CONSIGNEE", - 3 =>"THIRDPARTY" - ]; - if ($type == '') return $type_list; - return $type_list[ $type ] ?? ''; - } - -} diff --git a/niucloud/addon/shop/app/dict/delivery/ShippingTemplateDict.php b/niucloud/addon/shop/app/dict/delivery/ShippingTemplateDict.php deleted file mode 100644 index 4792195a8..000000000 --- a/niucloud/addon/shop/app/dict/delivery/ShippingTemplateDict.php +++ /dev/null @@ -1,36 +0,0 @@ - get_lang('dict_shop_delivery.num'), - self::WEIGHT => get_lang('dict_shop_delivery.weight'), - self::VOLUME => get_lang('dict_shop_delivery.volume') - ]; - if ($type == '') return $type_list; - return $type_list[$type] ?? ''; - } -} diff --git a/niucloud/addon/shop/app/dict/delivery_store/DeliveryStoreDict.php b/niucloud/addon/shop/app/dict/delivery_store/DeliveryStoreDict.php deleted file mode 100644 index ef9d540d9..000000000 --- a/niucloud/addon/shop/app/dict/delivery_store/DeliveryStoreDict.php +++ /dev/null @@ -1,44 +0,0 @@ - get_lang('dict_shop_delivery_store_pick_up_type.local_delivery'), - self::STORE => get_lang('dict_shop_delivery_store_pick_up_type.store'), - ]; - if (!empty($type)) { - return $pick_up_type[$type] ?? ''; - } - return $pick_up_type; - } - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/dict/diy/components.php b/niucloud/addon/shop/app/dict/diy/components.php deleted file mode 100644 index 8e2e95165..000000000 --- a/niucloud/addon/shop/app/dict/diy/components.php +++ /dev/null @@ -1,1058 +0,0 @@ - [ - 'title' => get_lang('dict_diy.shop_component_type_basic'), - 'list' => [ - 'GoodsList' => [ - 'title' => '商品列表', - 'icon' => 'iconfont iconshangpinliebiaopc', - 'path' => 'edit-goods-list', - 'support_page' => [], - 'uses' => 0, - 'sort' => 10011, - 'value' => [ - 'style' => 'style-1', - 'source' => 'all', - 'num' => 10, - 'goods_category' => '', - "goods_category_name" => "请选择", - 'goods_ids' => [], - "sortWay" => "default", // 排序方式,default:综合,sale_num:销量,price:价格 - "goodsNameStyle" => [ - "color" => "#303133", - "control" => true, - "fontWeight" => 'normal', - "isShow" => true - ], - "mode" => "aspectFill", - "priceStyle" => [ - "color" => "#FF4142", - "control" => true, - "isShow" => true - ], - "saleStyle" => [ - "color" => "#999999", - "control" => true, - "isShow" => true - ], - "labelStyle" => [ - "control" => true, - "isShow" => true - ], - "btnStyle" => [ - "fontWeight" => false, - "padding" => 0, - "aroundRadius" => 25, - "cartEvent" => "detail", - "text" => "购买", - "textColor" => "#FFFFFF", - "startBgColor" => "#FF4142", - "endBgColor" => "#FF4142", - "style" => "button", - "control" => true - ], - "imgElementRounded" => 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" => 10,// 元素上圆角 - "bottomElementRounded" => 10, // 元素下圆角 - "margin" => [ - "top" => 0, // 上边距 - "bottom" => 0, // 下边距 - "both" => 10 // 左右边距 - ] - ] - ], - 'ShopSearch' => [ - 'title' => '搜索', - 'icon' => 'iconfont iconsousuopc-1', - 'path' => 'edit-shop-search', - 'support_page' => [], - 'uses' => 1, - 'sort' => 10012, - 'value' => [ - "searchStyle" => "style-1", - "searchLink" => [ - "name" => "" - ], - "text" => "请输入搜索关键词", - "iconType" => "img", - "icon" => "", - "imageUrl" => "" - ], - // 组件属性 - '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" => 10, // 上边距 - "bottom" => 10, // 下边距 - "both" => 10 // 左右边距 - ] - ] - ], - 'ManyGoodsList' => [ - 'title' => '多商品组', - 'icon' => 'iconfont iconduoshangpinzupc', - 'path' => 'edit-many-goods-list', - 'support_page' => [], - 'uses' => 0, - 'sort' => 10013, - 'value' => [ - 'style' => 'style-2', - 'num' => 6, - "mode" => "aspectFill", - "sortWay" => "default", // 排序方式,default:综合,sale_num:销量,price:价格 - "headStyle" => "style-1", - "aroundRadius" => 25, - "source" => "custom", - "goods_category" => '', - "goods_category_name" => '请选择', - "goodsNameStyle" => [ - "color" => "#303133", - "control" => true, - "fontWeight" => 'normal', - "isShow" => true - ], - "priceStyle" => [ - "color" => "#FF4142", - "control" => true, - "isShow" => true - ], - "saleStyle" => [ - "color" => "#999999", - "control" => true, - "isShow" => true - ], - "labelStyle" => [ - "control" => true, - "isShow" => true - ], - "btnStyle" => [ - "fontWeight" => false, - "padding" => 0, - "aroundRadius" => 25, - "cartEvent" => "detail", - "text" => "购买", - "textColor" => "#FFFFFF", - "startBgColor" => "#FF4142", - "endBgColor" => "#FF4142", - "style" => "button", - "control" => true - ], - "list" => [ - [ - "title" => "推荐", - "desc" => "猜你喜欢", - "source" => "all", - "goods_category" => '', - "goods_category_name" => '请选择', - "goods_ids" => [], - "imageUrl" => '' - ] - ], - "imgElementRounded" => 0 // 图片圆角 - ], - // 组件属性 - '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 // 左右边距 - ] - ] - ], - 'GoodsCoupon' => [ - 'title' => '优惠券', - 'icon' => 'iconfont iconyouhuiquanpc', - 'path' => 'edit-goods-coupon', - 'support_page' => [], - 'uses' => 0, - 'sort' => 10014, - 'value' => [ - 'style' => 'style-1', - "styleName" => "风格一", - 'source' => 'all', - 'num' => 6, - 'couponIds' => [], - "btnText" => "立即领取", - 'couponTitle' => '先领券 再购物', - 'couponSubTitle' => '领券下单 享购物优惠', - "titleColor" => "#ffffff", - "subTitleColor" => "#ffffff", - "couponItem" => [ - "bgColor" => "#ffffff", - "textColor" => "#333333", - "subTextColor" => "#666666", - "moneyColor" => "#333333", - "aroundRadius" => 12 - ] - ], - // 组件属性 - '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" => 12, // 组件上圆角 - "bottomRounded" => 12, // 组件下圆角 - "elementBgColor" => '', // 元素背景颜色 - "topElementRounded" => 0,// 元素上圆角 - "bottomElementRounded" => 0, // 元素下圆角 - "margin" => [ - "top" => 10, // 上边距 - "bottom" => 10, // 下边距 - "both" => 10 // 左右边距 - ] - ] - ], - 'ShopMemberInfo' => [ - 'title' => '会员信息', - 'icon' => 'iconfont iconhuiyuanqiandaopc', - 'path' => 'edit-shop-member-info', - 'support_page' => [ 'DIY_SHOP_MEMBER_INDEX', 'DIY_SHOP_GIFTCARD_MEMBER_INDEX' ], - 'uses' => 1, - 'sort' => 10015, - 'value' => [ - "style" => "style-1", - "styleName" => "风格1", - 'bgUrl' => '', - 'isShowAccount' => true, - 'uidTextColor' => '#666666', - 'accountTextColor' => '#666666' - ], - ], - 'ShopOrderInfo' => [ - 'title' => '订单中心', - 'icon' => 'iconfont icondingdanzhongxinPC-1', - 'path' => 'edit-shop-order-info', - 'support_page' => [ 'DIY_SHOP_MEMBER_INDEX' ], - 'uses' => 1, - 'sort' => 10016, - 'value' => [ - "textColor" => "#303133", - "fontSize" => 16, - "fontWeight" => "normal", - "text" => "订单中心", - "more" => [ - "text" => "全部订单", - "color" => "#999999", - ], - "item" => [ - "fontSize" => 12, - "fontWeight" => "normal", - "color" => "#303133" - ], - ] - ], - 'ShopExchangeInfo' => [ - 'title' => '积分兑换', - 'icon' => 'iconfont iconjifenpc', - 'path' => 'edit-shop-exchange-info', - 'support_page' => [], - 'uses' => 0, - 'sort' => 10017, - 'value' => [ - 'bgUrl' => 'addon/shop/diy/point/point_index_bg.jpg', - ], - ], - 'ShopExchangeGoods' => [ - 'title' => '积分商品', - 'icon' => 'iconfont iconjifenshangpinpc', - 'path' => 'edit-shop-exchange-goods', - 'support_page' => [], - 'uses' => 0, - 'sort' => 10018, - 'value' => [ - 'style' => 'style-2', - "mode" => "aspectFill", - 'source' => 'all', - 'num' => 10, - 'goods_category' => '', - "goods_category_name" => "请选择", - 'goods_ids' => [], - "sortWay" => "total_order_num", // 排序方式,total_order_num:综合,total_exchange_num:销量,price:价格 - "goodsNameStyle" => [ - "color" => "#333", - "control" => true, - "fontWeight" => 'normal' - ], - "priceStyle" => [ - "mainColor" => "#FF4142", - "mainControl" => true, - "lineColor" => "#999CA7", - "lineControl" => true - ], - "saleStyle" => [ - "color" => "#999999", - "control" => true - ], - "imgElementRounded" => 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 // 左右边距 - ], - ] - ], - 'ShopGoodsRecommend' => [ - 'title' => '商品推荐', - 'icon' => 'iconfont icona-shangpintuijianpc30', - 'path' => 'edit-shop-goods-recommend', - 'support_page' => [], - 'uses' => 0, - 'sort' => 10019, - 'value' => [ - "priceStyle" => [ - "mainColor" => "#333333", - ], - "mode" => "aspectFill", - 'source' => 'all', - "goods_ids" => [], - 'list' => [ - [ - "title" => [ - "text" => "今日推荐", - "textColor" => "#303133" - ], - "moreTitle" => [ - "text" => "精选", - "textColor" => "#FFFFFF", - "startColor" => "#FF7234", - "endColor" => "#FF213F", - ], - "listFrame" => [ - "startColor" => "#FFE5E5", - "endColor" => "#FFF5F0", - ], - "button" => [ - "text" => "首单", - "textColor" => "#FFFFFF", - "color" => "#FF1128", - ] - ], - [ - "title" => [ - "text" => "品质好物", - "textColor" => "#303133" - ], - "moreTitle" => [ - "text" => "精选", - "textColor" => "#FFFFFF", - "startColor" => "#F2C719", - "endColor" => "#FBBA08", - ], - "listFrame" => [ - "startColor" => "#FFEFBA", - "endColor" => "#FFF5D7", - ], - "button" => [ - "text" => "首单", - "textColor" => "#FFFFFF", - "color" => "#FF1128", - ] - ], - [ - "title" => [ - "text" => "热销爆款", - "textColor" => "#303133" - ], - "moreTitle" => [ - "text" => "精选", - "textColor" => "#FFFFFF", - "startColor" => "#FFA629", - "endColor" => "#FF8E1E", - ], - "listFrame" => [ - "startColor" => "#FFE4D9", - "endColor" => "#FFFBF9", - ], - "button" => [ - "text" => "首单", - "textColor" => "#FFFFFF", - "color" => "#FF1128", - ] - ] - ], - "imgElementRounded" => 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" => 10,// 元素上圆角 - "bottomElementRounded" => 10, // 元素下圆角 - "margin" => [ - "top" => 10, // 上边距 - "bottom" => 10, // 下边距 - "both" => 10 // 左右边距 - ], - ] - ], - 'SingleRecommend' => [ - 'title' => '精选推荐', - 'icon' => 'iconfont icona-jingxuantuijianpc30-12', - 'path' => 'edit-single-recommend', - 'support_page' => [], - 'uses' => 0, - 'sort' => 10019, - 'value' => [ - "mode" => "aspectFill", - "titleStyle" => [ - 'title' => '风格1', - 'value' => 'style-1' - ], - 'textImg' => 'addon/shop/diy/index/style3/single_recommend_text1.png', - "textLink" => [ - "name" => "" - ], - "titleColor" => "#999999", - "subTitle" => [ - "text" => "更多", - "textColor" => "#999999", - "link" => [ - "name" => "" - ] - ], - 'source' => 'all', - 'goods_ids' => [], - "imageHeight" => 250, - "list" => [ - [ - "link" => [ - "name" => "" - ], - "imageUrl" => "addon/shop/diy/index/style3/single_recommend_banner1.jpg", - "imgWidth" => 345, - "imgHeight" => 495 - ], - [ - "link" => [ - "name" => "" - ], - "imageUrl" => "addon/shop/diy/index/style3/single_recommend_banner2.jpg", - "imgWidth" => 345, - "imgHeight" => 495 - ] - ], - "goodsNameStyle" => [ - "color" => "#303133", - "control" => true, - "fontWeight" => 'normal' - ], - "priceStyle" => [ - "mainColor" => "#FF4142", - "mainControl" => true, - "lineColor" => "#999CA7", - "lineControl" => true - ], - "saleStyle" => [ - "color" => "#FF0000", - "control" => true - ], - 'topCarouselRounded' => 12, - 'bottomCarouselRounded' => 12, - 'indicatorColor' => 'rgba(255, 255, 255, 0.6)', - 'indicatorActiveColor' => '#ffffff', - ], - // 组件属性 - '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" => 10, // 上边距 - "bottom" => 10, // 下边距 - "both" => 10 // 左右边距 - ] - ] - ], - 'ShopNewcomer' => [ - 'title' => '新人专享', - 'icon' => 'iconfont icona-xinrenzhuanxiangpc30', - 'path' => 'edit-shop-newcomer', - 'support_page' => [], - 'uses' => 1, - 'sort' => 10020, - 'value' => [ - "mode" => "aspectFill", - "style" => [ - 'title' => '风格1', - 'value' => 'style-1' - ], - 'textImg' => 'addon/shop/diy/newcomer/style_title_01.png', - "subTitle" => [ - "text" => "查看更多", - "textColor" => "#FFFFFF", - "startColor" => "#FB792F", - "endColor" => "#F91700", - "link" => [ - "name" => "" - ], - ], - "countDown" => [ - "numberColor" => "rgba(255, 0, 0, 1)", - "numberBg" => [ - "startColor" => "rgba(255, 255, 255, 1)", - "endColor" => "" - ], - "otherColor" => "rgba(255, 255, 255, 1)" - ], - 'source' => 'all', - 'num' => 10, - 'goods_category' => '', - "goods_category_name" => "请选择", - 'goods_ids' => [], - "imgElementRounded" => 10 // 图片圆角 - ], - // 组件属性 - 'template' => [ - "textColor" => "#303133", // 文字颜色 - 'pageStartBgColor' => '', // 底部背景颜色(开始) - 'pageEndBgColor' => '', // 底部背景颜色(结束) - 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) - "componentStartBgColor" => '#ff6D1A', // 组件背景颜色(开始) - "componentEndBgColor" => 'rgba(255, 70, 56, 1)', // 组件背景颜色(结束) - "componentGradientAngle" => 'to right', // 渐变角度,上下(to bottom)、左右(to right) - "topRounded" => 12, // 组件上圆角 - "bottomRounded" => 12, // 组件下圆角 - "elementBgColor" => '', // 元素背景颜色 - "topElementRounded" => 10,// 元素上圆角 - "bottomElementRounded" => 10, // 元素下圆角 - "margin" => [ - "top" => 10, // 上边距 - "bottom" => 10, // 下边距 - "both" => 10 // 左右边距 - ] - ] - ], - 'ShopGoodsRanking' => [ - 'title' => '排行榜', - 'icon' => 'iconfont icona-paihangbangpc30', - 'path' => 'edit-shop-goods-ranking', - 'support_page' => [], - 'uses' => 0, - 'sort' => 10021, - 'value' => [ - "mode" => "aspectFill", - "list" => [ - [ - 'bgUrl' => 'addon/shop/rank/rank_bg_01.jpg', // 榜单背景图 - 'text' => '热销排行榜', - "textColor" => "#FFFFFF", - "imgUrl" => "addon/shop/rank/rank_trophy.png", // 图标 - 'subTitle' => [ - 'text' => '查看更多', - 'textColor' => '#FFFFFF', - 'link' => [ - 'name' => 'SHOP_GOODS_RANK', - "parent" => "SHOP_LINK", - 'title' => '商品排行榜', - 'url' => '/addon/shop/pages/goods/rank', - 'action' => '', - ] - ], - 'listFrame' => [ - 'startColor' => '#FEA715', - 'endColor' => '#FE1E00', - ], - 'source' => 'default', - 'rankIds' => [] - ], - [ - 'bgUrl' => 'addon/shop/rank/rank_bg_02.jpg', // 榜单背景图 - 'text' => '人气排行榜', - "textColor" => "#FFFFFF", - "imgUrl" => "addon/shop/rank/rank_top.png", // 图标 - 'subTitle' => [ - 'text' => '查看更多', - 'textColor' => '#FFFFFF', - 'link' => [ - 'name' => 'SHOP_GOODS_RANK', - "parent" => "SHOP_LINK", - 'title' => '商品排行榜', - 'url' => '/addon/shop/pages/goods/rank', - 'action' => '', - ] - ], - 'listFrame' => [ - 'startColor' => '#FEA715', - 'endColor' => '#FE1E00', - ], - 'source' => 'default', - 'rankIds' => [] - ] - ], - ], - // 组件属性 - '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" => 10,// 元素上圆角 - "bottomElementRounded" => 10, // 元素下圆角 - "margin" => [ - "top" => 10, // 上边距 - "bottom" => 10, // 下边距 - "both" => 10 // 左右边距 - ] - ] - ], - 'ShopGoodsHot' => [ - 'title' => '爆款商品', - 'icon' => 'iconfont iconjifenshangpinpc', - 'path' => 'edit-shop-goods-hot', - 'support_page' => [], - 'uses' => 0, - 'sort' => 10022, - 'value' => [ - "mode" => "aspectFill", - 'titleStyle' => [ - 'text' => '大牌直降', - 'textColor' => '#FFFFFF', - "fontWeight" => 'bold', - "fontSize" => 18, - 'imgUrl' => '', - 'way' => 'text', // 展示方式,text:文本,img:图片 - "link" => [ - "name" => "" - ] - ], - 'subTitleStyle' => [ - 'text' => '7月10日-29日', - 'textColor' => '#ffffff', - 'bgColor' => '#ff737a', - "rounded" => 6, - "fontSize" => 12 - ], - 'btnStyle' => [ - "text" => '立即抢购', - 'textColor' => '#ee695c', - "startBgColor" => "", - "endBgColor" => "", - "gradientType" => "radial", - "fontSize" => 12, - "link" => [ - "name" => "" - ] - ], - 'goodsStyle' => [ - 'bgColor' => '#ffffff', - 'labelText' => '大牌直降', - 'labelSize' => 10, - 'labelColor' => '#ffffff', - 'labelBgColor' => '#FF0000', - "rounded" => 8, - "imgRounded" => 7, - 'source' => 'all', // 商品来源方式 - 'num' => 10, - "goodsIds" => [] - ] - ], - // 组件属性 - 'template' => [ - "textColor" => "#303133", // 文字颜色 - 'pageStartBgColor' => '#FF0000', // 底部背景颜色(开始) - '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" => 12, // 上边距 - "bottom" => 12, // 下边距 - "both" => 10 // 左右边距 - ], - ] - ], - ] - ], - 'SHOP_GOODS_DETAIL_COMPONENT' => [ - 'title' => get_lang('dict_diy.shop_goods_detail_component_type_basic'), - 'list' => [ - 'ShopGoodsDetailBasicInfo' => [ - 'title' => '基础信息', - 'icon' => 'iconfont iconjichuxinxi', - 'path' => 'edit-shop-goods-detail-basic-info', - 'support_page' => [ 'DIY_SHOP_GOODS_DETAIL' ], - 'uses' => 1, - 'sort' => 10011, - 'position' => 'top_fixed', // 组件置顶标识,不能拖拽 - 'value' => [ - 'menuContent' => 'index,search,cart,member', - 'medium' => [ - 'type' => 'square_img', - 'indicator' => true - ], - 'priceRegion' => [ - 'showWay' => 'normal', - 'bgImg' => 'addon/shop/diy/goods_detail/style_01.jpg', - 'marketingBgImg' => 'addon/shop/diy/goods_detail/marketing_style_01.jpg', - 'goodsStyle' => [ - 'title' => '风格1', - 'value' => 'style-1' - ], - 'marketingStyle' => [ - 'title' => '风格1', - 'value' => 'style-1' - ] - ], - 'goodsInfo' => [ - 'titleColor' => '#333333', - 'subTitleColor' => '#999999', - 'saleInfoColor' => '#999999', - 'priceTopRounded' => 20, - 'priceBottomRounded' => 0, - 'topRounded' => 20, - 'bottomRounded' => 0, - "priceBgColor" => '', - "startBgColor" => '#ffffff', - "endBgColor" => '#f6f6f6', - "priceAboutMargin" => 0, - "priceTopMargin" => -22, - "topMargin" => -17, - "aboutMargin" => 0 - ], - 'saleInfo' => ['underlined_price','sales','stock'] - ], - // 组件属性 - '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" => 0 // 左右边距 - ] - ] - ], - 'ShopGoodsDetailPurchaseService' => [ - 'title' => '商品服务', - 'icon' => 'iconfont iconshangpinfuwu1', - 'path' => 'edit-shop-goods-detail-purchase-service', - 'support_page' => [ 'DIY_SHOP_GOODS_DETAIL' ], - 'uses' => 1, - 'sort' => 10012, - 'value' => [ - 'serviceConfig' => ['goods_service','spec_select','delivery_info','coupons','activity'] - ], - // 组件属性 - 'template' => [ - "textColor" => "#303133", // 文字颜色 - 'pageStartBgColor' => '', // 底部背景颜色(开始) - 'pageEndBgColor' => '', // 底部背景颜色(结束) - 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) - 'componentBgUrl' => '', // 组件背景图片 - 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 - "componentStartBgColor" => '#FFFFFF', // 组件背景颜色(开始) - "componentEndBgColor" => '', // 组件背景颜色(结束) - "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) - "topRounded" => 12, // 组件上圆角 - "bottomRounded" => 12, // 组件下圆角 - "elementBgColor" => '', // 元素背景颜色 - "topElementRounded" => 0,// 元素上圆角 - "bottomElementRounded" => 0, // 元素下圆角 - "margin" => [ - "top" => 12, // 上边距 - "bottom" => 0, // 下边距 - "both" => 10 // 左右边距 - ] - ] - ], - 'ShopGoodsDetailEvaluate' => [ - 'title' => '商品评价', - 'icon' => 'iconfont iconshangpinpingjia1', - 'path' => 'edit-shop-goods-detail-evaluate', - 'support_page' => [ 'DIY_SHOP_GOODS_DETAIL' ], - 'uses' => 1, - 'sort' => 10014, - 'value' => [ - 'isShow' => true - ], - // 组件属性 - 'template' => [ - "textColor" => "#303133", // 文字颜色 - 'pageStartBgColor' => '', // 底部背景颜色(开始) - 'pageEndBgColor' => '', // 底部背景颜色(结束) - 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) - 'componentBgUrl' => '', // 组件背景图片 - 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 - "componentStartBgColor" => '#FFFFFF', // 组件背景颜色(开始) - "componentEndBgColor" => '', // 组件背景颜色(结束) - "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) - "topRounded" => 12, // 组件上圆角 - "bottomRounded" => 12, // 组件下圆角 - "elementBgColor" => '', // 元素背景颜色 - "topElementRounded" => 0,// 元素上圆角 - "bottomElementRounded" => 0, // 元素下圆角 - "margin" => [ - "top" => 12, // 上边距 - "bottom" => 0, // 下边距 - "both" => 10 // 左右边距 - ] - ] - ], - 'ShopGoodsDetailAttr' => [ - 'title' => '商品属性', - 'icon' => 'iconfont iconshangpinshuxing', - 'path' => 'edit-shop-goods-detail-attr', - 'support_page' => [ 'DIY_SHOP_GOODS_DETAIL' ], - 'uses' => 1, - 'sort' => 10015, - 'value' => [ - 'isShow' => true - ], - // 组件属性 - 'template' => [ - "textColor" => "#303133", // 文字颜色 - 'pageStartBgColor' => '', // 底部背景颜色(开始) - 'pageEndBgColor' => '', // 底部背景颜色(结束) - 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) - 'componentBgUrl' => '', // 组件背景图片 - 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 - "componentStartBgColor" => '#FFFFFF', // 组件背景颜色(开始) - "componentEndBgColor" => '', // 组件背景颜色(结束) - "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) - "topRounded" => 12, // 组件上圆角 - "bottomRounded" => 12, // 组件下圆角 - "elementBgColor" => '', // 元素背景颜色 - "topElementRounded" => 0,// 元素上圆角 - "bottomElementRounded" => 0, // 元素下圆角 - "margin" => [ - "top" => 12, // 上边距 - "bottom" => 0, // 下边距 - "both" => 10 // 左右边距 - ] - ] - ], - 'ShopGoodsDetailDesc' => [ - 'title' => '商品详情', - 'icon' => 'iconfont iconshangpinxiangqing', - 'path' => 'edit-shop-goods-detail-desc', - 'support_page' => [ 'DIY_SHOP_GOODS_DETAIL' ], - 'uses' => 1, - 'sort' => 10016, - 'value' => [ - 'isShow' => true - ], - // 组件属性 - 'template' => [ - "textColor" => "#303133", // 文字颜色 - 'pageStartBgColor' => '', // 底部背景颜色(开始) - 'pageEndBgColor' => '', // 底部背景颜色(结束) - 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) - 'componentBgUrl' => '', // 组件背景图片 - 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 - "componentStartBgColor" => '#FFFFFF', // 组件背景颜色(开始) - "componentEndBgColor" => '', // 组件背景颜色(结束) - "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) - "topRounded" => 12, // 组件上圆角 - "bottomRounded" => 12, // 组件下圆角 - "elementBgColor" => '', // 元素背景颜色 - "topElementRounded" => 0,// 元素上圆角 - "bottomElementRounded" => 0, // 元素下圆角 - "margin" => [ - "top" => 12, // 上边距 - "bottom" => 20, // 下边距 - "both" => 10 // 左右边距 - ] - ] - ], - 'ShopGoodsDetailBottom' => [ - 'title' => '底部菜单', - 'icon' => 'iconfont icondibucaidan', - 'path' => 'edit-shop-goods-detail-bottom', - 'support_page' => [ 'DIY_SHOP_GOODS_DETAIL' ], - 'position' => 'bottom_fixed', // 组件置底标识,不能拖拽 - 'uses' => 1, - 'sort' => 10017, - 'value' => [ - 'menuContent' => ['index','service','cart'], - 'cartName' => '加入购物车', - 'buyName' => '立即购买', - 'cartIsShow' => true, - 'cartStyle' => [ - "textColor" => "#FFFFFF", // 文字颜色 - "fontSize" => 16, - "gradientAngle" => "to right", - "startColor" => "#FFB000", - "endColor" => "#FFA029" - ], - 'buyStyle' => [ - "textColor" => "#FFFFFF", // 文字颜色 - "fontSize" => 16, - "gradientAngle" => "to right", - "startColor" => "#FB7939", - "endColor" => "#FF4142" - ], - ], - // 组件属性 - 'template' => [ - "textColor" => "#303133", // 文字颜色 - 'pageStartBgColor' => '', // 底部背景颜色(开始) - 'pageEndBgColor' => '', // 底部背景颜色(结束) - 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) - 'componentBgUrl' => '', // 组件背景图片 - 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 - "componentStartBgColor" => '#FFFFFF', // 组件背景颜色(开始) - "componentEndBgColor" => '', // 组件背景颜色(结束) - "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) - "topRounded" => 0, // 组件上圆角 - "bottomRounded" => 0, // 组件下圆角 - "elementBgColor" => '', // 元素背景颜色 - "topElementRounded" => 0,// 元素上圆角 - "bottomElementRounded" => 0, // 元素下圆角 - "margin" => [ - "top" => 0, // 上边距 - "bottom" => 0, // 下边距 - "both" => 0 // 左右边距 - ] - ] - ], - 'ShopGoodsDetailSow' => [ - 'title' => '种草秀', - 'icon' => 'iconfont iconzhongcaoxiu', - 'path' => 'edit-shop-goods-detail-sow', - 'support_page' => [ 'DIY_SHOP_GOODS_DETAIL' ], - 'uses' => 0, - 'sort' => 10018, - 'value' => [ - 'isShow' => true - ], - // 组件属性 - 'template' => [ - "textColor" => "#303133", // 文字颜色 - 'pageStartBgColor' => '', // 底部背景颜色(开始) - 'pageEndBgColor' => '', // 底部背景颜色(结束) - 'pageGradientAngle' => 'to bottom', // 渐变角度,从上到下(to bottom)、从左到右(to right) - 'componentBgUrl' => '', // 组件背景图片 - 'componentBgAlpha' => 2, // 组件背景图片的透明度,0~10 - "componentStartBgColor" => '#FFFFFF', // 组件背景颜色(开始) - "componentEndBgColor" => '', // 组件背景颜色(结束) - "componentGradientAngle" => 'to bottom', // 渐变角度,上下(to bottom)、左右(to right) - "topRounded" => 12, // 组件上圆角 - "bottomRounded" => 12, // 组件下圆角 - "elementBgColor" => '', // 元素背景颜色 - "topElementRounded" => 0,// 元素上圆角 - "bottomElementRounded" => 0, // 元素下圆角 - "margin" => [ - "top" => 12, // 上边距 - "bottom" => 0, // 下边距 - "both" => 10 // 左右边距 - ] - ] - ] - ] - ], -]; diff --git a/niucloud/addon/shop/app/dict/diy/links.php b/niucloud/addon/shop/app/dict/diy/links.php deleted file mode 100644 index d6571cd4f..000000000 --- a/niucloud/addon/shop/app/dict/diy/links.php +++ /dev/null @@ -1,169 +0,0 @@ - [ - 'title' => get_lang('dict_diy.shop_link'), - 'type' => 'folder', // 类型,folder 表示文件夹,link 表示链接 - 'child_list' => [ - [ - 'name' => 'SHOP_LINK', - 'title' => get_lang('dict_diy.shop_link_basic'), - 'child_list' => [ - [ - 'name' => 'SHOP_INDEX', - 'title' => get_lang('dict_diy.shop_link_index'), - 'url' => '/addon/shop/pages/index', - 'is_share' => 1, - 'action' => 'decorate' - ], - [ - 'name' => 'SHOP_GOODS_CATEGORY', - 'title' => get_lang('dict_diy.shop_link_goods_category'), - 'url' => '/addon/shop/pages/goods/category', - 'is_share' => 1, - 'action' => '' - ], - [ - 'name' => 'SHOP_GOODS_LIST', - 'title' => get_lang('dict_diy.shop_link_goods_list'), - 'url' => '/addon/shop/pages/goods/list', - 'is_share' => 1, - 'action' => '' - ], - [ - 'name' => 'SHOP_GOODS_RANK', - 'title' => get_lang('dict_diy.shop_link_goods_rank'), - 'url' => '/addon/shop/pages/goods/rank', - 'is_share' => 1, - 'action' => '' - ], - [ - 'name' => 'SHOP_GOODS_SEARCH', - 'title' => get_lang('dict_diy.shop_link_goods_search'), - 'url' => '/addon/shop/pages/goods/search', - 'is_share' => 1, - 'action' => '' - ], - [ - 'name' => 'SHOP_GOODS_CART', - 'title' => get_lang('dict_diy.shop_link_goods_cart'), - 'url' => '/addon/shop/pages/goods/cart', - 'is_share' => 0, - 'action' => '' - ], - [ - 'name' => 'SHOP_COUPON_LIST', - 'title' => get_lang('dict_diy.shop_link_coupon_list'), - 'url' => '/addon/shop/pages/coupon/list', - 'is_share' => 1, - 'action' => '' - ], - [ - 'name' => 'SHOP_MEMBER_INDEX', - 'title' => get_lang('dict_diy.page_link_member_index'), - 'url' => '/addon/shop/pages/member/index', - 'is_share' => 1, - 'action' => 'decorate' - ], - [ - 'name' => 'SHOP_MY_COUPON', - 'title' => get_lang('dict_diy.shop_link_my_coupon'), - 'url' => '/addon/shop/pages/member/my_coupon', - 'is_share' => 0, - 'action' => '' - ], - [ - 'name' => 'SHOP_MY_GOODS_COLLECT', - 'title' => get_lang('dict_diy.shop_link_my_goods_collect'), - 'url' => '/addon/shop/pages/goods/collect', - 'is_share' => 0, - 'action' => '' - ], - [ - 'name' => 'SHOP_MY_GOODS_BROWSE', - 'title' => get_lang('dict_diy.shop_link_my_goods_browse'), - 'url' => '/addon/shop/pages/goods/browse', - 'is_share' => 0, - 'action' => '' - ], - [ - 'name' => 'SHOP_ORDER_LIST', - 'title' => get_lang('dict_diy.shop_link_order_list'), - 'url' => '/addon/shop/pages/order/list', - 'is_share' => 0, - 'action' => '' - ], - [ - 'name' => 'SHOP_REFUND_LIST', - 'title' => get_lang('dict_diy.shop_link_order_refund_list'), - 'url' => '/addon/shop/pages/refund/list', - 'is_share' => 0, - 'action' => '' - ], - [ - 'name' => 'SHOP_POINT_INDEX', - 'title' => get_lang('dict_diy.shop_link_point_index'), - 'url' => '/addon/shop/pages/point/index', - 'is_share' => 1, - 'action' => '' - ], - [ - 'name' => 'SHOP_POINT_LIST', - 'title' => get_lang('dict_diy.shop_link_point_list'), - 'url' => '/addon/shop/pages/point/list', - 'is_share' => 1, - 'action' => '' - ], - [ - 'name' => 'SHOP_POINT_ORDER_LIST', - 'title' => get_lang('dict_diy.shop_link_point_order_list'), - 'url' => '/addon/shop/pages/point/order_list', - 'is_share' => 0, - 'action' => '' - ], - [ - 'name' => 'SHOP_DISCOUNT_LIST', - 'title' => get_lang('dict_diy.shop_link_discount_list'), - 'url' => '/addon/shop/pages/discount/list', - 'is_share' => 1, - 'action' => '' - ], - [ - 'name' => 'SHOP_NEWCOMER_LIST', - 'title' => get_lang('dict_diy.shop_link_newcomer_list'), - 'url' => '/addon/shop/pages/newcomer/list', - 'is_share' => 1, - 'action' => '' - ], - [ - 'name' => 'SHOP_INVOICE_LIST', - 'title' => get_lang('dict_diy.shop_link_invoice_list'), - 'url' => '/addon/shop/pages/invoice/list', - 'is_share' => 1, - 'action' => '' - ], - ] - ], - [ - 'name' => 'SHOP_GOODS_SELECT', - 'title' => get_lang('dict_diy.shop_link_goods_select'), - 'component' => '/src/addon/shop/views/goods/components/goods-select-content.vue' - ], - [ - 'name' => 'SHOP_GOODS_CATEGORY_SELECT', - 'title' => get_lang('dict_diy.shop_link_goods_category_select'), - 'component' => '/src/addon/shop/views/goods/components/goods-category-select-content.vue' - ], - [ - 'name' => 'SHOP_COUPON_SELECT', - 'title' => get_lang('dict_diy.shop_link_coupon_select'), - 'component' => '/src/addon/shop/views/marketing/coupon/components/coupon-select-content.vue' - ], - [ - 'name' => 'SHOP_POINT_EXCHANGE_SELECT', - 'title' => get_lang('dict_diy.shop_link_point_exchange_select'), - 'component' => '/src/addon/shop/views/marketing/exchange/components/goods-select-content.vue' - ] - ], - ], -]; diff --git a/niucloud/addon/shop/app/dict/diy/pages.php b/niucloud/addon/shop/app/dict/diy/pages.php deleted file mode 100644 index 593e3d37b..000000000 --- a/niucloud/addon/shop/app/dict/diy/pages.php +++ /dev/null @@ -1,5637 +0,0 @@ - "3ilbpixhyia0", - "title" => "我的拼单", - "imageUrl" => "addon/pintuan/diy/member/style1/nav_my_spell.png", - "imgWidth" => 92, - "imgHeight" => 92, - "link" => [ - "parent" => "PINTUAN_LINK", - "title" => "我的拼单", - "url" => "/addon/pintuan/pages/order/list", - "name" => "PINTUAN_ORDER_LIST", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] -]; -$my_help = [ - "id" => "9tlbcgxsyihe", - "title" => "我的助力", - "imageUrl" => "addon/friend_help/diy/member/style1/nav_my_help.png", - "imgWidth" => 92, - "imgHeight" => 92, - "link" => [ - "parent" => "FRIEND_HELP_LINK", - "title" => "我的助力", - "url" => "/addon/friend_help/pages/my_help", - "name" => "FRIEND_HELP_MY_LIST", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] -]; - -$member_index_graphic_nav_list = [ - [ - "id" => "49kxbgr5lwue", - "title" => "签到", - "imageUrl" => "addon/shop/diy/member/style1/nav_sign_in.png", - "imgWidth" => 92, - "imgHeight" => 92, - "link" => [ - "name" => "MEMBER_MY_SIGN_IN", - "parent" => "MEMBER_LINK", - "title" => "我的签到", - "url" => "/app/pages/member/sign_in", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "title" => "我的余额", - "link" => [ - "parent" => "MEMBER_LINK", - "name" => "MEMBER_BALANCE", - "title" => "我的余额", - "url" => "/app/pages/member/balance", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/member/style1/nav_balance.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "2aqy33banse8", - "imgWidth" => 92, - "imgHeight" => 92 - ], - [ - "title" => "地址管理", - "link" => [ - "parent" => "MEMBER_LINK", - "name" => "MEMBER_ADDRESS", - "title" => "收货地址", - "url" => "/app/pages/member/address", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/member/style1/nav_address.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "hdk4145zk40", - "imgWidth" => 92, - "imgHeight" => 92 - ], - [ - "title" => "优惠券", - "link" => [ - "parent" => "SHOP_LINK", - "name" => "SHOP_MY_COUPON", - "title" => "我的优惠券", - "url" => "/addon/shop/pages/member/my_coupon", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/member/style1/nav_coupon.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "34t5xg9ik0i0", - "imgWidth" => 92, - "imgHeight" => 92 - ], - [ - "id" => "7dpefp0s9ew0", - "title" => "分销中心", - "imageUrl" => "addon/shop/diy/member/style1/nav_promote.png", - "imgWidth" => 92, - "imgHeight" => 92, - "link" => [ - "name" => "SHOP_FENXIAO_INDEX", - "parent" => "SHOP_FENXIAO_LINK", - "title" => "分销中心", - "url" => "/addon/shop_fenxiao/pages/index", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "title" => "积分兑换", - "link" => [ - "name" => "SHOP_LINK", - "parent" => "SHOP_FENXIAO_LINK", - "title" => "积分商城", - "url" => "/addon/shop/pages/point/index", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/member/style1/nav_point_change.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "692put4jerg0", - "imgWidth" => 92, - "imgHeight" => 92 - ], - [ - "id" => "78kxbgr4lipw", - "title" => "核销台", - "imageUrl" => "addon/shop/diy/member/style1/nav_verify_index.png", - "imgWidth" => 92, - "imgHeight" => 92, - "link" => [ - "name" => "MEMBER_VERIFY_INDEX", - "parent" => "MEMBER_LINK", - "title" => "核销台", - 'url' => '/app/pages/verify/index', - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "27kxbgr5lj3w", - "title" => "礼品卡", - "imageUrl" => "addon/shop/diy/member/style1/nav_giftcard.png", - "imgWidth" => 92, - "imgHeight" => 92, - "link" => [ - "name" => "SHOP_GIFTCARD_MY_CARD_LIST", - "parent" => "SHOP_GIFTCARD_LINK", - "title" => "我的卡包", - "url" => "/addon/shop_giftcard/pages/my_card_list", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "4o2q7yss59m0", - "title" => "我的等级", - "imageUrl" => "addon/shop/diy/member/style1/nav_my_level.png", - "imgWidth" => 92, - "imgHeight" => 92, - "link" => [ - "name" => "MEMBER_MY_LEVEL", - "parent" => "MEMBER_LINK", - "title" => "会员等级", - "url" => "/app/pages/member/level", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "78fnsh8cx5k0", - "title" => "我的收藏", - "imageUrl" => "addon/shop/diy/member/style1/nav_collect.png", - "imgWidth" => 92, - "imgHeight" => 92, - "link" => [ - "name" => "SHOP_MY_GOODS_COLLECT", - "parent" => "SHOP_LINK", - "title" => "商品收藏", - "url" => "/addon/shop/pages/goods/collect", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "38fqtyu8cx5k0", - "title" => "我的足迹", - "imageUrl" => "addon/shop/diy/member/style1/nav_browse.png", - "imgWidth" => 92, - "imgHeight" => 92, - "link" => [ - "name" => "SHOP_MY_GOODS_BROWSE", - "parent" => "SHOP_LINK", - "title" => "我的足迹", - "url" => "/addon/shop/pages/goods/browse", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], -]; - -$addon_service = new \app\service\admin\addon\AddonService(); -$site_addons = $addon_service->getInstallList(); -if(!empty($site_addons)) { - $site_addons = array_keys($site_addons); - if (in_array('pintuan', $site_addons)) { - $member_index_graphic_nav_list[] = $my_pintuan; - } - if (in_array('friend_help', $site_addons)) { - $member_index_graphic_nav_list[] = $my_help; - } -} -$member_index_graphic_nav_list[] = [ - "id" => "27kxbgr5ljbw", - "title" => "联系客服", - "imageUrl" => "addon/shop/diy/member/style1/nav_service.png", - "imgWidth" => 92, - "imgHeight" => 92, - "link" => [ - "name" => "MEMBER_CONTACT", - "parent" => "MEMBER_LINK", - "title" => "客服", - "url" => "/app/pages/member/contact", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] -]; - -return [ - 'DIY_SHOP_INDEX' => [ - 'shop_index_style2' => [ // 页面标识 - "title" => "商城首页1", // 页面名称 - 'cover' => '', // 页面封面图 - 'preview' => '', // 页面预览图 - 'desc' => '', // 页面描述 - 'mode' => 'diy', // 页面模式:diy:自定义,fixed:固定 - // 页面数据源 - "data" => [ - "global" => [ - "title" => "首页", - "pageStartBgColor" => "rgba(246, 246, 246, 1)", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "bgUrl" => "", - "bgHeightScale" => 100, - "imgWidth" => "", - "imgHeight" => "", - "topStatusBar" => [ - 'control' => true, - "isShow" => false, - "bgColor" => "#ffffff", - "rollBgColor" => "#ffffff", - "style" => "style-1", - "styleName" => "风格1", - "textColor" => "#333333", - "rollTextColor" => "#333333", - "textAlign" => "center", - "inputPlaceholder" => "请输入搜索关键词", - "imgUrl" => "", - "link" => [ - "name" => "" - ] - ], - "bottomTabBar" => [ - 'control' => true, - 'isShow' => true, - 'designNav' => [ - 'title' => '', - 'key' => '' - ] - ], - "copyright" => [ - 'control' => true, - 'isShow' => false, - 'textColor' =>'#ccc' - ], - "popWindow" => [ - "imgUrl" => "", - "imgWidth" => "", - "imgHeight" => "", - "count" => 'once', - "show" => 0, - "link" => [ - "name" => "" - ] - ], - "template" => [ - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ] - ] - ], - "value" => [ - [ - "path" => "edit-carousel-search", - "uses" => 1, - "position" => "top_fixed", - "id" => "6r6qw5679oo0", - "componentName" => "CarouselSearch", - "componentTitle" => "轮播搜索", - "ignore" => [ - "componentBgColor", - "componentBgUrl", - "marginTop", - "marginBottom", - "topRounded", - "bottomRounded", - "pageBgColor", - "marginBoth" - ], - "positionWay" => "fixed", - "fixedBgColor" => "", - "bgGradient" => false, - "search" => [ - "logo" => "addon/shop/diy/index/style3/logo.png", - "text" => "请输入搜索关键词", - "link" => [ - 'name' => 'SHOP_GOODS_SEARCH', - "parent" => "SHOP_LINK", - 'title' => '商品搜索', - 'url' => '/addon/shop/pages/goods/search', - 'action' => '', - ], - 'style' => 'style-2', - 'styleName' => '风格2', - "subTitle" => [ - "text" => "本地好价·优选生活", - "textColor" => "#000000", - "startColor" => "rgba(255,255,255,0.7)", - "endColor" => "", - ], - 'positionColor' => '#ffffff', - "hotWord" => [ - "interval" => 3, - "list" => [ - [ - 'text' => '新品推荐', - 'id' => '1l3juvqvimw0' - ], - [ - 'text' => '爆款', - 'id' => '2vejp61n1xk0' - ] - ] - ], - 'color' => '#999999', - 'btnColor' => '#ffffff', - 'bgColor' => '#ffffff', - 'btnBgColor' => '#ff3434' - ], - "tab" => [ - "control" => false, - "noColor" => "rgba(255, 255, 255, 0.7)", - "selectColor" => "rgba(255, 255, 255, 1)", - "fixedNoColor" => "rgba(255, 255, 255, 0.7)", - "fixedSelectColor" => "rgba(255, 255, 255, 1)", - "list" => [ - [ - "text" => "精选", - "source" => "diy_page", - "diy_id" => "", - "diy_title" => "", - "id" => "1wx7m1wykqbk" - ], - [ - "text" => "猜你喜欢", - "source" => "diy_page", - "diy_id" => "", - "diy_title" => "", - "id" => "1gfh1oc6fsjk" - ], - [ - "text" => "蔬菜", - "source" => "diy_page", - "diy_id" => "", - "diy_title" => "", - "id" => "25v390lfsd34" - ], - [ - "text" => "水果", - "source" => "diy_page", - "diy_id" => "", - "diy_title" => "", - "id" => "2zb1znvn5jc0" - ], - [ - "id" => "5acf7ab4f040", - "text" => "海鲜", - "source" => "diy_page", - "diy_id" => 0, - "diy_title" => "" - ], - [ - "id" => "37a9vwqt1r20", - "text" => "熟食", - "source" => "diy_page", - "diy_id" => 0, - "diy_title" => "" - ], - [ - "id" => "1en9w5jstvs0", - "text" => "米面", - "source" => "diy_page", - "diy_id" => 0, - "diy_title" => "" - ], - [ - "id" => "3ae14irgqoa0", - "text" => "粮油", - "source" => "diy_page", - "diy_id" => 0, - "diy_title" => " " - ] - ] - ], - "swiper" => [ - "control" => true, - "interval" => 5, - "indicatorColor" => "rgba(255, 255, 255, 1)", - "indicatorActiveColor" => "#FF0E0E", - "indicatorStyle" => "style-3", - "indicatorAlign" => "center", - "swiperStyle" => "style-3", - "imageHeight" => 274, - "topRounded" => 0, - "bottomRounded" => 0, - "list" => [ - [ - "imageUrl" => "addon/shop/diy/index/style3/banner1.jpg", - "imgWidth" => 750, - "imgHeight" => 580, - "link" => [ - "name" => "" - ], - "id" => "397htiaqung0", - "width" => 355, - "height" => 274.53 - ], - [ - "imageUrl" => "addon/shop/diy/index/style3/banner2.jpg", - "imgWidth" => 750, - "imgHeight" => 580, - "link" => [ - "name" => "" - ], - "id" => "6mrj3vwiamw0", - "width" => 355, - "height" => 274.53 - ] - ] - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ], - "pageStyle" => "padding-top:2rpx;padding-bottom:0rpx;padding-right:0rpx;padding-left:0rpx;" - ], - [ - "path" => "edit-horz-blank", - "uses" => 0, - "id" => "4wk9nzocm3c", - "componentName" => "HorzBlank", - "componentTitle" => "辅助空白", - "ignore" => [ - "pageBgColor", - "componentBgUrl" - ], - "height" => 22, - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "rgba(246, 246, 246, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 17, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => -21, - "bottom" => 0, - "both" => 0 - ], - "pageStyle" => "padding-top:2rpx;padding-bottom:0rpx;padding-right:0rpx;padding-left:0rpx;" - ], - [ - "path" => "edit-graphic-nav", - "uses" => 0, - "id" => "6h28ebyqqnk0", - "componentName" => "GraphicNav", - "componentTitle" => "图文导航", - "ignore" => [], - "layout" => "horizontal", - "mode" => "graphic", - "showStyle" => "fixed", - "rowCount" => 5, - "pageCount" => 2, - "carousel" => [ - "type" => "circle", - "color" => "#FFFFFF" - ], - "imageSize" => 40, - "aroundRadius" => 25, - "font" => [ - "size" => 12, - "weight" => "normal", - "color" => "#303133" - ], - "list" => [ - [ - "title" => "签到", - "link" => [ - "name" => "MEMBER_MY_SIGN_IN", - "parent" => "MEMBER_LINK", - "title" => "我的签到", - "url" => "/app/pages/member/sign_in", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/index/style3/nav_sign_in.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "1evjnc3zeb5s", - "imgWidth" => 180, - "imgHeight" => 180 - ], - [ - "title" => "分销管理", - "link" => [ - "name" => "SHOP_FENXIAO_INDEX", - "parent" => "SHOP_FENXIAO_LINK", - "title" => "分销中心", - "url" => "/addon/shop_fenxiao/pages/index", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/index/style3/nav_fenxiao.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "2ktzer8wrnc0", - "imgWidth" => 180, - "imgHeight" => 180 - ], - [ - "title" => "分销专区", - "link" => [ - "name" => "SHOP_FENXIAO_ZONE", - "parent" => "SHOP_FENXIAO_LINK", - "title" => "分销专区", - "url" => "/addon/shop_fenxiao/pages/zone", - "action" => "decorate" - ], - "imageUrl" => "addon/shop/diy/index/style3/nav_fenxiao_zone.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "4aixr8qu5ek0", - "imgWidth" => 180, - "imgHeight" => 180 - ], - [ - "title" => "领券中心", - "link" => [ - "name" => "SHOP_COUPON_LIST", - "parent" => "SHOP_LINK", - "title" => "优惠券列表", - "url" => "/addon/shop/pages/coupon/list", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/index/style3/nav_coupon.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "3bmtyrslxxy0", - "imgWidth" => 180, - "imgHeight" => 180 - ], - [ - "id" => "6iux9g1aojo0", - "title" => "新闻资讯", - "imageUrl" => "addon/shop/diy/index/style3/nav_news_info.png", - "imgWidth" => 180, - "imgHeight" => 180, - "link" => [ - "name" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "7jggy5euv3w0", - "title" => "限时折扣", - "imageUrl" => "addon/shop/diy/index/style3/nav_discount.png", - "imgWidth" => 180, - "imgHeight" => 180, - "link" => [ - "name" => "SHOP_DISCOUNT_LIST", - "parent" => "SHOP_LINK", - "title" => "限时折扣列表", - 'url' => '/addon/shop/pages/discount/list', - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "7bqpc6bjha80", - "title" => "积分商城", - "imageUrl" => "addon/shop/diy/index/style3/nav_point_index.png", - "imgWidth" => 180, - "imgHeight" => 180, - "link" => [ - "name" => "SHOP_POINT_INDEX", - "parent" => "SHOP_LINK", - "title" => "积分商城", - 'url' => '/addon/shop/pages/point/index', - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "tgo5qmjawnk", - "title" => "礼品卡", - "imageUrl" => "addon/shop/diy/index/style3/nav_giftcard.png", - "imgWidth" => 180, - "imgHeight" => 180, - "link" => [ - "name" => "SHOP_GIFTCARD_INDEX", - "parent" => "SHOP_GIFTCARD_LINK", - "title" => "礼品卡", - "url" => "/addon/shop_giftcard/pages/index", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "1fprven2cqrk", - "title" => "新人专享", - "imageUrl" => "addon/shop/diy/index/style3/nav_my_newcomer.png", - "imgWidth" => 180, - "imgHeight" => 180, - "link" => [ - "name" => "SHOP_NEWCOMER_LIST", - "parent" => "SHOP_LINK", - "title" => "新人专享", - "url" => "/addon/shop/pages/newcomer/list", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "2wggehpnako0", - "title" => "限时秒杀", - "imageUrl" => "addon/shop/diy/index/style3/nav_seckill.png", - "imgWidth" => 180, - "imgHeight" => 180, - "link" => [ - "parent" => "SECKILL_LINK", - "title" => "秒杀首页", - "url" => "/addon/seckill/pages/index", - "name" => "SECKILL_INDEX" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ] - ], - // 轮播图设置 - 'swiper' => [ - 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 - "indicatorActiveColor" => '#FF0E0E', - 'indicatorStyle' => 'style-1', - 'indicatorAlign' => 'center', - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => -10, - "bottom" => 10, - "both" => 10 - ], - "pageStyle" => "padding-top:2rpx;padding-bottom:0rpx;padding-right:0rpx;padding-left:0rpx;" - ], - [ - "path" => "edit-notice", - "uses" => 0, - "id" => "5ux60nfdm680", - "componentName" => "Notice", - "componentTitle" => "公告", - "ignore" => [], - "noticeType" => "img", - "imgType" => "diy", - "systemUrl" => "style_1", - "imageUrl" => "addon/shop/diy/index/style3/notice.png", - "showType" => "popup", - "scrollWay" => "upDown", - "fontSize" => 12, - "fontWeight" => "normal", - "noticeTitle" => "公告", - "list" => [ - [ - "text" => "最新公告:欢迎来到小店参观!", - "link" => [ - "name" => "" - ], - "id" => "1rz6s4buaxc0" - ], - [ - "id" => "2wksdax75fc0", - "text" => "最新公告:欢迎来到小店参观!", - "link" => [ - "name" => "" - ] - ] - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ], - "pageStyle" => "padding-top:2rpx;padding-bottom:0rpx;padding-right:20rpx;padding-left:20rpx;" - ], - [ - "path" => "edit-goods-coupon", - "uses" => 0, - "id" => "5zq2inzbmu00", - "componentName" => "GoodsCoupon", - "componentTitle" => "优惠券", - "ignore" => [ - "componentBgColor", - "componentBgUrl" - ], - "style" => "style-3", - "styleName" => "风格3", - "source" => "all", - "num" => 6, - "couponIds" => [], - "btnText" => "立即领取", - "couponTitle" => "每日省钱", - "couponSubTitle" => "先领券 再购物", - "titleColor" => "#ffffff", - "subTitleColor" => "#ffffff", - "couponItem" => [ - "bgColor" => "#ffffff", - "textColor" => "#333333", - "subTextColor" => "#666666", - "moneyColor" => "#333333", - "aroundRadius" => 12 - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 10, - "bottom" => null, - "both" => 10 - ], - "pageStyle" => "padding-top:20rpx;padding-bottom:0rpx;padding-right:20rpx;padding-left:20rpx;" - ], - [ - "path" => "edit-shop-goods-recommend", - "uses" => 0, - "id" => "2ezdal8ps1og", - "componentName" => "ShopGoodsRecommend", - "componentTitle" => "商品推荐", - "mode" => "aspectFill", - "ignore" => [], - "priceStyle" => [ - "mainColor" => "#333333" - ], - 'source' => 'all', - "goods_ids" => [], - "list" => [ - [ - "title" => [ - "text" => "今日推荐", - "textColor" => "#303133" - ], - "moreTitle" => [ - "text" => "精选", - "textColor" => "#FFFFFF", - "startColor" => "#FF7234", - "endColor" => "#FF213F" - ], - "listFrame" => [ - "startColor" => "#FFE5E5", - "endColor" => "#FFF5F0" - ], - "button" => [ - "text" => "首单", - "textColor" => "#FFFFFF", - "color" => "#FF1128" - ], - "id" => "6t9kv928d680" - ], - [ - "title" => [ - "text" => "品质好物", - "textColor" => "#303133" - ], - "moreTitle" => [ - "text" => "精选", - "textColor" => "#FFFFFF", - "startColor" => "#F2C719", - "endColor" => "#FBBA08" - ], - "listFrame" => [ - "startColor" => "#FFEFBA", - "endColor" => "#FFF5D7" - ], - "button" => [ - "text" => "首单", - "textColor" => "#FFFFFF", - "color" => "#FF1128" - ], - "id" => "4u1rv0e4qpo0" - ], - [ - "title" => [ - "text" => "热销爆款", - "textColor" => "#303133" - ], - "moreTitle" => [ - "text" => "精选", - "textColor" => "#FFFFFF", - "startColor" => "#FFA629", - "endColor" => "#FF8E1E" - ], - "listFrame" => [ - "startColor" => "#FFE4D9", - "endColor" => "#FFFBF9" - ], - "button" => [ - "text" => "首单", - "textColor" => "#FFFFFF", - "color" => "#FF1128" - ], - "id" => "4v1bhzhxay60" - ] - ], - "imgElementRounded" => 10, // 图片圆角 - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 10, - "bottomElementRounded" => 10, - "margin" => [ - "top" => 10, - "bottom" => 0, - "both" => 10 - ], - "pageStyle" => "padding-top:20rpx;padding-bottom:0rpx;padding-right:20rpx;padding-left:20rpx;" - ], - [ - "path" => "edit-active-cube", - "uses" => 0, - "id" => "3vmpaydr2a60", - "componentName" => "ActiveCube", - "componentTitle" => "活动魔方", - "ignore" => [], - "titleStyle" => [ - "title" => "风格5", - "value" => "style-5" - ], - "text" => "超值爆款", - "textLink" => [ - "name" => "" - ], - "titleColor" => "#F91700", - "subTitle" => [ - "text" => "为您精选爆款", - "textColor" => "rgba(153, 153, 153, 1)", - "startColor" => "rgba(255, 255, 255, 1)", - "endColor" => "rgba(255, 255, 255, 1)", - "link" => [ - "name" => "" - ] - ], - "blockStyle" => [ - "title" => "风格2", - "value" => "style-2", - "fontWeight" => "bold", - "btnText" => "italics" - ], - "list" => [ - [ - "title" => [ - "text" => "品质好物", - "textColor" => "#303133" - ], - "subTitle" => [ - "text" => "品质好物推荐", - "textColor" => "#999999", - "startColor" => "", - "endColor" => "" - ], - "moreTitle" => [ - "text" => "GO!", - "startColor" => "#FFC051", - "endColor" => "#FF9C00" - ], - "listFrame" => [ - "startColor" => "#FFF1DB", - "endColor" => "#FFFBF4" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/active_cube/active_cube_goods1.png", - "id" => "77tls7gaho80" - ], - [ - "title" => [ - "text" => "热销推荐", - "textColor" => "#303133" - ], - "subTitle" => [ - "text" => "本周热销商品", - "textColor" => "#999999", - "startColor" => "", - "endColor" => "" - ], - "moreTitle" => [ - "text" => "GO!", - "startColor" => "#A4E894", - "endColor" => "#45CC2A" - ], - "listFrame" => [ - "startColor" => "#E6F6E2", - "endColor" => "#F5FDF3" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/active_cube/active_cube_goods2.png", - "id" => "m4scwuc67do" - ], - [ - "title" => [ - "text" => "优惠好物", - "textColor" => "#303133" - ], - "subTitle" => [ - "text" => "领券后更优惠", - "textColor" => "#999999", - "startColor" => "", - "endColor" => "" - ], - "moreTitle" => [ - "text" => "GO!", - "startColor" => "#4BC2FF", - "endColor" => "#1F7DFF" - ], - "listFrame" => [ - "startColor" => "#E2F6FF", - "endColor" => "#F2FAFF" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/active_cube/active_cube_goods3.png", - "id" => "33nbfp8czea0" - ], - [ - "title" => [ - "text" => "今日推荐", - "textColor" => "#303133" - ], - "subTitle" => [ - "text" => "诚意推荐", - "textColor" => "#999999", - "startColor" => "", - "endColor" => "" - ], - "moreTitle" => [ - "text" => "GO!", - "startColor" => "#FB792F", - "endColor" => "#F91700" - ], - "listFrame" => [ - "startColor" => "#FFEAEA", - "endColor" => "#FFFCFB" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/active_cube/active_cube_goods4.png", - "id" => "49scoy4bgsg0" - ] - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "#FFFAF5", - "topElementRounded" => 10, - "bottomElementRounded" => 10, - "margin" => [ - "top" => 10, - "bottom" => 0, - "both" => 10 - ], - "textImg" => "static/resource/images/diy/active_cube/active_cube_text1.png", - "contentBtnTextStyle" => "italics", - "pageStyle" => "padding-top:20rpx;padding-bottom:0rpx;padding-right:20rpx;padding-left:20rpx;" - ], - [ - "path" => "edit-picture-show", - "uses" => 0, - "id" => "2o99dw6mytk0", - "componentName" => "PictureShow", - "componentTitle" => "图片展播", - "ignore" => [], - "moduleOne" => [ - "head" => [ - "textImg" => "static/resource/images/diy/picture_show/picture_show_head_text1.png", - "subText" => "每日上新", - "subTextColor" => "#666666" - ], - "list" => [ - [ - "btnTitle" => [ - "text" => "仅限今日", - "color" => "#ffffff", - "startColor" => "#F5443E", - "endColor" => "#F5443E" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/picture_show/picture_01.png" - ], - [ - "btnTitle" => [ - "text" => "超值上新", - "color" => "#ffffff", - "startColor" => "#F5443E", - "endColor" => "#F5443E" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/picture_show/picture_02.png" - ] - ], - "listFrame" => [ - "startColor" => "#FFDDDD", - "endColor" => "#FFEBED" - ] - ], - "moduleTwo" => [ - "head" => [ - "textImg" => "static/resource/images/diy/picture_show/picture_show_head_text2.png", - "subText" => "好物低至1折1", - "subTextColor" => "#666666" - ], - "list" => [ - [ - "btnTitle" => [ - "text" => "大牌直降", - "color" => "#ffffff", - "startColor" => "#F5443E", - "endColor" => "#F5443E" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/picture_show/picture_03.png" - ], - [ - "btnTitle" => [ - "text" => "天天底价", - "color" => "#ffffff", - "startColor" => "#F5443E", - "endColor" => "#F5443E" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/picture_show/picture_04.png" - ] - ], - "listFrame" => [ - "startColor" => "#E6E1FE", - "endColor" => "#F0EEFC" - ] - ], - "moduleRounded" => [ - "topRounded" => 10, - "bottomRounded" => 10 - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 10, - "bottom" => null, - "both" => 10 - ], - "pageStyle" => "padding-top:20rpx;padding-bottom:0rpx;padding-right:20rpx;padding-left:20rpx;" - ], - [ - "path" => "edit-picture-show", - "uses" => 0, - "id" => "3wz1r5bww3q0", - "componentName" => "PictureShow", - "componentTitle" => "图片展播", - "ignore" => [], - "moduleOne" => [ - "head" => [ - "textImg" => "static/resource/images/diy/picture_show/picture_show_head_text3.png", - "subText" => "最高补1200元", - "subTextColor" => "#666666" - ], - "list" => [ - [ - "btnTitle" => [ - "text" => "全网低价", - "color" => "#ffffff", - "startColor" => "#F5443E", - "endColor" => "#F5443E" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/picture_show/picture_05.png" - ], - [ - "btnTitle" => [ - "text" => "大牌特惠", - "color" => "#ffffff", - "startColor" => "#F5443E", - "endColor" => "#F5443E" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/picture_show/picture_06.png" - ] - ], - "listFrame" => [ - "startColor" => "rgba(212, 239, 255, 1)", - "endColor" => "rgba(235, 244, 250, 1)" - ] - ], - "moduleTwo" => [ - "head" => [ - "textImg" => "static/resource/images/diy/picture_show/picture_show_head_text4.png", - "subText" => "每日上新", - "subTextColor" => "#666666" - ], - "list" => [ - [ - "btnTitle" => [ - "text" => "人气爆款", - "color" => "#ffffff", - "startColor" => "#F5443E", - "endColor" => "#F5443E" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/picture_show/picture_07.png" - ], - [ - "btnTitle" => [ - "text" => "官方正品", - "color" => "#ffffff", - "startColor" => "#F5443E", - "endColor" => "#F5443E" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/picture_show/picture_08.png" - ] - ], - "listFrame" => [ - "startColor" => "rgba(255, 241, 212, 1)", - "endColor" => "rgba(249, 242, 229, 1)" - ] - ], - "moduleRounded" => [ - "topRounded" => 10, - "bottomRounded" => 10 - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 10, - "bottom" => null, - "both" => 10 - ], - "pageStyle" => "padding-top:20rpx;padding-bottom:0rpx;padding-right:20rpx;padding-left:20rpx;" - ], - [ - "path" => "edit-shop-newcomer", - "uses" => 1, - "id" => "2hjc1q7f7q80", - "componentName" => "ShopNewcomer", - "componentTitle" => "新人专享", - "mode" => "aspectFill", - "ignore" => [], - "style" => [ - "title" => "风格1", - "value" => "style-1" - ], - "textImg" => "addon/shop/diy/newcomer/style_title_01.png", - "subTitle" => [ - "text" => "查看更多", - "textColor" => "#FFFFFF", - "startColor" => "#FB792F", - "endColor" => "#F91700", - "link" => [ - "name" => "" - ] - ], - "countDown" => [ - "numberColor" => "rgba(255, 0, 0, 1)", - "numberBg" => [ - "startColor" => "rgba(255, 255, 255, 1)", - "endColor" => "" - ], - "otherColor" => "rgba(255, 255, 255, 1)" - ], - "imgElementRounded" => 10, // 图片圆角 - "source" => "all", - "num" => 10, - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "#ff6D1A", - "componentEndBgColor" => "rgba(255, 70, 56, 1)", - "componentGradientAngle" => "to right", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 10, - "bottomElementRounded" => 10, - "margin" => [ - "top" => 10, - "bottom" => 0, - "both" => 10 - ], - "pageStyle" => "padding-top:20rpx;padding-bottom:0rpx;padding-right:20rpx;padding-left:20rpx;" - ], - [ - "path" => "edit-single-recommend", - "uses" => 0, - "id" => "2mxsu6pbqpu0", - "componentName" => "SingleRecommend", - "mode" => "aspectFill", - "componentTitle" => "精选推荐", - "ignore" => [], - "titleStyle" => [ - "title" => "风格1", - "value" => "style-1" - ], - "textImg" => "addon/shop/diy/index/style3/single_recommend_text1.png", - "textLink" => [ - "name" => "" - ], - "titleColor" => "rgba(153, 153, 153, 1)", - "subTitle" => [ - "text" => "更多", - "textColor" => "rgba(153, 153, 153, 1)", - "link" => [ - "name" => "" - ] - ], - "source" => "all", - "goods_ids" => [], - "imageHeight" => "250", - "list" => [ - [ - "id" => "18o4pyaufktc", - "imageUrl" => "addon/shop/diy/index/style3/single_recommend_banner1.jpg", - "imgWidth" => 345, - "imgHeight" => 495, - "link" => [ - "name" => "" - ], - "width" => 355, - "height" => 509.3478260869565 - ], - [ - "id" => "18o8pyaufktc", - "imageUrl" => "addon/shop/diy/index/style3/single_recommend_banner2.jpg", - "imgWidth" => 345, - "imgHeight" => 495, - "link" => [ - "name" => "" - ], - "width" => 355, - "height" => 509.3478260869565 - ] - ], - "goodsNameStyle" => [ - "color" => "#303133", - "control" => true, - "fontWeight" => "normal" - ], - "priceStyle" => [ - "mainColor" => "#FF4142", - "mainControl" => true, - "lineColor" => "#999CA7", - "lineControl" => true - ], - "saleStyle" => [ - "color" => "rgba(255, 0, 0, 1)", - "control" => true - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => null, - "componentEndBgColor" => null, - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "rgba(255, 255, 255, 1)", - "topElementRounded" => 12, - "bottomElementRounded" => 12, - "margin" => [ - "top" => 15, - "bottom" => 0, - "both" => 10 - ], - "pageStyle" => "padding-top:20rpx;padding-bottom:20rpx;padding-right:20rpx;padding-left:20rpx;", - "topCarouselRounded" => 12, - "bottomCarouselRounded" => 12, - "indicatorColor" => "rgba(255, 255, 255, 0.6)", - "indicatorActiveColor" => "rgba(255, 255, 255, 1)" - ], - [ - "path" => "edit-image-ads", - "uses" => 0, - "id" => "1kfmhruhijgg", - "componentName" => "ImageAds", - "componentTitle" => "图片广告", - "ignore" => [ - - ], - "imageHeight" => 89, - "isSameScreen" => false, - "list" => [ - [ - "link" => [ - "name" => "" - ], - "imageUrl" => "addon/shop/diy/index/style3/discount_img.png", - "imgWidth" => 710, - "imgHeight" => 170, - "id" => "6eo9vdo9xtc0", - "width" => 375, - "height" => 89.78873239436619 - ] - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 10, - "bottom" => 10, - "both" => 10 - ] - ], - [ - "path" => "edit-many-goods-list", - "uses" => 0, - "id" => "37adfqtqe080", - "componentName" => "ManyGoodsList", - "componentTitle" => "多商品组", - "mode" => "aspectFill", - "ignore" => [ - "componentBgUrl" - ], - "style" => "style-2", - "num" => 6, - "sortWay" => "default", - "headStyle" => "style-4", - "aroundRadius" => 25, - "source" => "custom", - "goods_category" => "", - "goods_category_name" => "请选择", - "goodsNameStyle" => [ - "color" => "#303133", - "control" => true, - "fontWeight" => "normal", - "isShow" => true - ], - "priceStyle" => [ - "color" => "#FF4142", - "control" => true, - "isShow" => true - ], - "saleStyle" => [ - "color" => "#999999", - "control" => true, - "isShow" => true - ], - "labelStyle" => [ - "control" => true, - "isShow" => true - ], - "btnStyle" => [ - "fontWeight" => false, - "padding" => 0, - "aroundRadius" => 25, - "cartEvent" => "detail", - "text" => "购买", - "textColor" => "#FFFFFF", - "startBgColor" => "#FF4142", - "endBgColor" => "#FF4142", - "style" => "nc-icon-gouwuche1", - "control" => true - ], - "imgElementRounded" => 12, // 图片圆角 - "list" => [ - [ - "title" => "推荐", - "desc" => "猜你喜欢", - "source" => "all", - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [], - "imageUrl" => "", - "id" => "67pl1ysjhr40" - ], - [ - "id" => "6z59zcmk4jk0", - "title" => "衣鞋包饰", - "desc" => "分类描述", - "source" => "all", - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [], - "imageUrl" => "" - ], - [ - "id" => "1cfbll6wnmw0", - "title" => "居家百货", - "desc" => "分类描述", - "source" => "all", - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [], - "imageUrl" => "" - ], - [ - "id" => "49p79g5l5qs0", - "title" => "食品营养", - "desc" => "分类描述", - "source" => "all", - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [], - "imageUrl" => "" - ] - ], - "textColor" => "#303133", - "pageStartBgColor" => "rgba(255, 255, 255, 1)", - "pageEndBgColor" => "rgba(255, 255, 255, 0.4)", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => null, - "componentEndBgColor" => null, - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 12, - "bottomElementRounded" => 12, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ], - "pageStyle" => "background:linear-gradient(to bottom,rgba(255, 255, 255, 1),rgba(255, 255, 255, 0.4));padding-top:2rpx;padding-bottom:0rpx;padding-right:20rpx;padding-left:20rpx;" - ] - ] - ] - ], - 'shop_index_style1' => [ // 页面标识 - "title" => "商城首页2", // 页面名称 - 'cover' => 'addon/shop/diy/template/shop_index_one_cover.png', // 页面封面图 - 'preview' => '', // 页面预览图 - 'desc' => '', // 页面描述 - 'mode' => 'diy', // 页面模式:diy:自定义,fixed:固定 - // 页面数据源 - "data" => [ - "global" => [ - "title" => "首页", - 'pageStartBgColor' => 'rgba(246, 246, 246, 1)', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - "bgUrl" => "", - 'bgHeightScale' => 0, - "imgWidth" => "", - "imgHeight" => "", - "topStatusBar" => [ - 'control' => true, - 'isShow' => false, - 'bgColor' => "#ffffff", - 'rollBgColor' => "#ffffff", - 'style' => 'style-1', - 'styleName' => '风格1', - 'textColor' => "#333333", - 'rollTextColor' => "#333333", - 'textAlign' => 'center', - 'inputPlaceholder' => '请输入搜索关键词', - 'imgUrl' => '', - 'link' => [ - 'name' => "" - ] - ], - "bottomTabBar" => [ - 'control' => true, - 'isShow' => true, - 'designNav' => [ - 'title' => '', - 'key' => '' - ] - ], - "copyright" => [ - 'control' => true, - 'isShow' => false, - 'textColor' =>'#ccc' - ], - "popWindow" => [ - "imgUrl" => "", - "imgWidth" => "", - "imgHeight" => "", - "count" => 'once', - "show" => 0, - "link" => [ - "name" => "" - ] - ], - "template" => [ - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ] - ] - ], - "value" => [ - [ - "path" => "edit-carousel-search", - "uses" => 1, - "position" => "top_fixed", - "id" => "5wyf9s0k8jw0", - "componentName" => "CarouselSearch", - "componentTitle" => "轮播搜索", - "ignore" => [ - "componentBgColor", - "componentBgUrl", - "marginTop", - "marginBottom", - "topRounded", - "bottomRounded", - "pageBgColor", - "marginBoth" - ], - "positionWay" => "fixed", - "fixedBgColor" => "", - 'bgGradient' => true, - "search" => [ - "logo" => "addon/shop/diy/index/style2/logo.png", - "text" => "请输入搜索关键词", - "link" => [ - 'name' => 'SHOP_GOODS_SEARCH', - "parent" => "SHOP_LINK", - 'title' => '商品搜索', - 'url' => '/addon/shop/pages/goods/search', - 'action' => '', - ], - 'style' => 'style-1', - 'styleName' => '风格一', - "subTitle" => [ - "text" => "本地好价·优选生活", - "textColor" => "#000000", - "startColor" => "rgba(255,255,255,0.7)", - "endColor" => "", - ], - 'positionColor' => '#ffffff', - 'hotWord' => [ - "interval" => 3, - 'list' => [ - [ - 'text' => '新品推荐' - ], - [ - 'text' => '爆款' - ] - ] - ] - ], - "tab" => [ - "control" => true, - "noColor" => "rgba(255, 255, 255, 1)", - "selectColor" => "rgba(255, 255, 255, 1)", - "fixedNoColor" => "rgba(255, 255, 255, 1)", - "fixedSelectColor" => "rgba(255, 255, 255, 1)", - "list" => [ - [ - "text" => "精选", - "source" => "diy_page", - "diy_id" => 0, - "diy_title" => "", - "id" => "4tbvliuezhq0" - ], - [ - "text" => "猜你喜欢", - "source" => "diy_page", - "diy_id" => 0, - "diy_title" => "", - "id" => "1rpxkuehd03k" - ], - [ - "text" => "蔬菜", - "source" => "diy_page", - "diy_id" => 0, - "diy_title" => "", - "id" => "6d0zybcxzvc0" - ], - [ - "text" => "水果", - "source" => "diy_page", - "diy_id" => 0, - "diy_title" => "", - "id" => "17r58ld9i8xs" - ], - [ - "id" => "5acf7ab4f040", - "text" => "海鲜", - "source" => "diy_page", - "diy_id" => 0, - "diy_title" => "" - ], - [ - "id" => "37a9vwqt1r20", - "text" => "熟食", - "source" => "diy_page", - "diy_id" => 0, - "diy_title" => "" - ], - [ - "id" => "1en9w5jstvs0", - "text" => "米面", - "source" => "diy_page", - "diy_id" => 0, - "diy_title" => "" - ], - [ - "id" => "3ae14irgqoa0", - "text" => "粮油", - "source" => "diy_page", - "diy_id" => 0, - "diy_title" => " " - ] - ] - ], - "swiper" => [ - "control" => true, - "interval" => 5, - "indicatorColor" => "rgba(0, 0, 0, 0.3)", - "indicatorActiveColor" => "#FF0E0E", - 'indicatorStyle' => 'style-1', - 'indicatorAlign' => 'center', - 'swiperStyle' => 'style-1', - "imageHeight" => 158, - "topRounded" => 10, - "bottomRounded" => 10, - "list" => [ - [ - "imageUrl" => "addon/shop/diy/index/style2/banner1.png", - "imgWidth" => 630, - "imgHeight" => 290, - "link" => [ - "name" => "" - ], - "id" => "2ywogh006ai0", - "width" => 345, - "height" => 158.8095238095238 - ], - [ - "id" => "3p7wiewe0o00", - "imageUrl" => "addon/shop/diy/index/style2/banner2.png", - "imgWidth" => 630, - "imgHeight" => 290, - "link" => [ - "name" => "" - ] - ] - ] - ], - 'color' => '#999999', - 'btnColor' => '#ffffff', - 'bgColor' => '#ffffff', - 'btnBgColor' => '#ff3434', - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ] - ], - [ - "path" => "edit-graphic-nav", - "uses" => 0, - "id" => "6lvx8ztvquc0", - "componentName" => "GraphicNav", - "componentTitle" => "图文导航", - "ignore" => [], - "layout" => "horizontal", - "mode" => "graphic", - "showStyle" => "fixed", - "rowCount" => 5, - "pageCount" => 2, - "carousel" => [ - "type" => "circle", - "color" => "#FFFFFF" - ], - "imageSize" => 40, - "aroundRadius" => 25, - "font" => [ - "size" => 12, - "weight" => "normal", - "color" => "#303133" - ], - "list" => [ - [ - "title" => "签到", - "link" => [ - "name" => "MEMBER_MY_SIGN_IN", - "parent" => "MEMBER_LINK", - "title" => "我的签到", - "url" => "/app/pages/member/sign_in", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/index/style2/nav_sign_in.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "1evjnc3zeb5s", - "imgWidth" => 135, - "imgHeight" => 135 - ], - [ - "title" => "分销管理", - "link" => [ - "name" => "SHOP_FENXIAO_INDEX", - "parent" => "SHOP_FENXIAO_LINK", - "title" => "分销中心", - "url" => "/addon/shop_fenxiao/pages/index", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/index/style2/nav_fenxiao.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "2ktzer8wrnc0", - "imgWidth" => 180, - "imgHeight" => 180 - ], - [ - "title" => "分销专区", - "link" => [ - "name" => "SHOP_FENXIAO_ZONE", - "parent" => "SHOP_FENXIAO_LINK", - "title" => "分销专区", - "url" => "/addon/shop_fenxiao/pages/zone", - "action" => "decorate" - ], - "imageUrl" => "addon/shop/diy/index/style2/nav_fenxiao_zone.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "4aixr8qu5ek0", - "imgWidth" => 135, - "imgHeight" => 135 - ], - [ - "title" => "领券中心", - "link" => [ - "name" => "SHOP_COUPON_LIST", - "parent" => "SHOP_LINK", - "title" => "优惠券列表", - "url" => "/addon/shop/pages/coupon/list", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/index/style2/nav_coupon.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "3bmtyrslxxy0", - "imgWidth" => 180, - "imgHeight" => 180 - ], - [ - "id" => "6iux9g1aojo0", - "title" => "新闻资讯", - "imageUrl" => "addon/shop/diy/index/style2/nav_news_info.png", - "imgWidth" => 180, - "imgHeight" => 180, - "link" => [ - "name" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "7jggy5euv3w0", - "title" => "限时折扣", - "imageUrl" => "addon/shop/diy/index/style2/nav_discount.png", - "imgWidth" => 135, - "imgHeight" => 135, - "link" => [ - "name" => "SHOP_DISCOUNT_LIST", - "parent" => "SHOP_LINK", - "title" => "限时折扣列表", - 'url' => '/addon/shop/pages/discount/list', - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "7bqpc6bjha80", - "title" => "积分商城", - "imageUrl" => "addon/shop/diy/index/style2/nav_point_index.png", - "imgWidth" => 135, - "imgHeight" => 135, - "link" => [ - "name" => "SHOP_POINT_INDEX", - "parent" => "SHOP_LINK", - "title" => "积分商城", - 'url' => '/addon/shop/pages/point/index', - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "tgo5qmjawnk", - "title" => "礼品卡", - "imageUrl" => "addon/shop/diy/index/style2/nav_giftcard.png", - "imgWidth" => 180, - "imgHeight" => 180, - "link" => [ - "name" => "SHOP_GIFTCARD_INDEX", - "parent" => "SHOP_GIFTCARD_LINK", - "title" => "礼品卡", - "url" => "/addon/shop_giftcard/pages/index", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "1fprven2cqrk", - "title" => "我的余额", - "imageUrl" => "addon/shop/diy/index/style2/nav_my_balance.png", - "imgWidth" => 180, - "imgHeight" => 180, - "link" => [ - "name" => "MEMBER_BALANCE", - "parent" => "MEMBER_LINK", - "title" => "我的余额", - "url" => "/app/pages/member/balance", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "2wggehpnako0", - "title" => "地址管理", - "imageUrl" => "addon/shop/diy/index/style2/nav_my_address.png", - "imgWidth" => 180, - "imgHeight" => 180, - "link" => [ - "name" => "MEMBER_ADDRESS", - "parent" => "MEMBER_LINK", - "title" => "收货地址", - "url" => "/app/pages/member/address", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ] - ], - // 轮播图设置 - 'swiper' => [ - 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 - "indicatorActiveColor" => '#FF0E0E', - 'indicatorStyle' => 'style-1', - 'indicatorAlign' => 'center', - ], - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => -1, - "bottom" => 5, - "both" => 10 - ] - ], - [ - "path" => "edit-notice", - "uses" => 0, - "id" => "4m9g2ylz1di0", - "componentName" => "Notice", - "componentTitle" => "公告", - "ignore" => [], - "noticeType" => "img", - "imgType" => "system", - "systemUrl" => "style_2", - "imageUrl" => "", - "showType" => "popup", - "scrollWay" => "upDown", - "fontSize" => 12, - "fontWeight" => "normal", - "noticeTitle" => "公告", - "list" => [ - [ - "text" => "最新公告:欢迎来到小店参观!", - "link" => [ - "name" => "" - ], - "id" => "1rz6s4buaxc0" - ], - [ - "id" => "2wksdax75fc0", - "text" => "最新公告:欢迎来到小店参观!", - "link" => [ - "name" => "" - ] - ] - ], - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 5, - "bottom" => 5, - "both" => 10 - ] - ], - [ - "path" => "edit-goods-coupon", - "uses" => 0, - "id" => "52ldidxgpcg0", - "componentName" => "GoodsCoupon", - "componentTitle" => "优惠券", - "ignore" => [ - "componentBgColor", - "componentBgUrl" - ], - "style" => "style-1", - "styleName" => "风格一", - "source" => "all", - "num" => 6, - "couponIds" => [], - "btnText" => "立即领取", - "couponTitle" => "先领券 再购物", - "couponSubTitle" => "领券下单 享购物优惠", - "titleColor" => "#ffffff", - "subTitleColor" => "#ffffff", - "couponItem" => [ - "bgColor" => "#ffffff", - "textColor" => "#333333", - "subTextColor" => "#666666", - "moneyColor" => "#333333", - "aroundRadius" => 12 - ], - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 5, - "bottom" => 5, - "both" => 10 - ] - ], - [ - "path" => "edit-active-cube", - "uses" => 0, - "id" => "717m86hlcho0", - "componentName" => "ActiveCube", - "componentTitle" => "活动魔方", - "ignore" => [], - "titleStyle" => [ - "title" => "风格1", - "value" => "style-1" - ], - "text" => "超值爆款", - "textLink" => [ - "name" => "" - ], - "textImg" => "static/resource/images/diy/active_cube/active_cube_text1.png", - "titleColor" => "#F91700", - "subTitle" => [ - "text" => "为您精选爆款", - "textColor" => "#FFFFFF", - "startColor" => "#FB792F", - "endColor" => "#F91700", - "link" => [ - "name" => "" - ], - ], - "blockStyle" => [ - "title" => "风格4", - "value" => "style-4", - 'fontWeight' => 'bold', - 'btnText' => 'normal' - ], - "list" => [ - [ - "title" => [ - "text" => "今日推荐", - "textColor" => "#303133" - ], - "subTitle" => [ - "text" => "诚意推荐", - "textColor" => "rgba(237, 110, 0, 1)", - "startColor" => "rgba(243, 218, 197, 1)", - "endColor" => "rgba(255, 228, 217, 1)" - ], - "moreTitle" => [ - "text" => "去看看", - "startColor" => "#FEA715", - "endColor" => "#FE1E00", - ], - "listFrame" => [ - "startColor" => "rgba(255, 173, 77, 1)", - "endColor" => "rgba(249, 61, 2, 1)" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/active_cube/active_cube_goods1.png", - "id" => "bvn98cr8j1s" - ], - [ - "title" => [ - "text" => "优惠好物", - "textColor" => "#303133" - ], - "subTitle" => [ - "text" => "领券优惠", - "textColor" => "rgba(46, 89, 233, 1)", - "startColor" => "rgba(205, 217, 248, 1)", - "endColor" => "rgba(205, 217, 248, 1)" - ], - "moreTitle" => [ - "text" => "去看看", - "startColor" => "#FFBF50", - "endColor" => "#FF9E03" - ], - "listFrame" => [ - "startColor" => "rgba(124, 167, 244, 1)", - "endColor" => "rgba(43, 86, 233, 1)" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/active_cube/active_cube_goods2.png", - "id" => "6u24tqbyc780" - ], - [ - "title" => [ - "text" => "热销推荐", - "textColor" => "#303133" - ], - "subTitle" => [ - "text" => "热销商品", - "textColor" => "rgba(246, 47, 85, 1)", - "startColor" => "rgba(252, 216, 219, 1)", - "endColor" => "rgba(252, 216, 219, 1)" - ], - "moreTitle" => [ - "text" => "去看看", - "startColor" => "#A2E792", - "endColor" => "#49CD2D" - ], - "listFrame" => [ - "startColor" => "rgba(255, 127, 72, 1)", - "endColor" => "rgba(238, 51, 91, 1)" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/active_cube/active_cube_goods3.png", - "id" => "6dn1yt1j0as0" - ], - [ - "title" => [ - "text" => "书桌好物", - "textColor" => "#303133" - ], - "subTitle" => [ - "text" => "好物推荐", - "textColor" => "rgba(19, 155, 60, 1)", - "startColor" => "rgba(211, 241, 218, 1)", - "endColor" => "rgba(211, 241, 218, 1)" - ], - "moreTitle" => [ - "text" => "去看看", - "startColor" => "#4AC1FF", - "endColor" => "#1D7CFF", - ], - "listFrame" => [ - "startColor" => "rgba(144, 212, 140, 1)", - "endColor" => "rgba(41, 159, 79, 1)" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/active_cube/active_cube_goods4.png", - "id" => "4q9zphidqtm0" - ] - ], - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "#ffffff", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "#FFFAF5", - "topElementRounded" => 10, - "bottomElementRounded" => 10, - "margin" => [ - "top" => 5, - "bottom" => 5, - "both" => 10 - ] - ], - [ - "path" => "edit-active-cube", - "uses" => 0, - "id" => "3keeqqrkpxk0", - "componentName" => "ActiveCube", - "componentTitle" => "活动魔方", - "ignore" => [], - "titleStyle" => [ - "title" => "风格4", - "value" => "style-4" - ], - "text" => "数码产品", - "textImg" => "static/resource/images/diy/active_cube/active_cube_text1.png", - "textLink" => [ - "name" => "" - ], - "titleColor" => "rgba(255, 255, 255, 1)", - "subTitle" => [ - "text" => "去逛逛", - "textColor" => "#303133", - "startColor" => "rgba(255, 255, 255, 1)", - "endColor" => "rgba(255, 255, 255, 1)", - "link" => [ - "name" => "" - ], - ], - "blockStyle" => [ - "title" => "风格3", - "value" => "style-3", - 'fontWeight' => 'normal', - 'btnText' => 'normal' - ], - "list" => [ - [ - "title" => [ - "text" => "蓝牙耳机", - "textColor" => "#303133" - ], - "subTitle" => [ - "text" => "诚意推荐", - "textColor" => "#999999", - "startColor" => "", - "endColor" => "" - ], - "moreTitle" => [ - "text" => "去看看", - "startColor" => "#FEA715", - "endColor" => "#FE1E00" - ], - "listFrame" => [ - "startColor" => "", - "endColor" => "" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/active_cube/active_cube_goods5.png", - "id" => "5am2l07pkr00" - ], - [ - "title" => [ - "text" => "医用雾化", - "textColor" => "#303133" - ], - "subTitle" => [ - "text" => "领券更优惠", - "textColor" => "#999999", - "startColor" => "", - "endColor" => "" - ], - "moreTitle" => [ - "text" => "去看看", - "startColor" => "#FFBF50", - "endColor" => "#FF9E03" - ], - "listFrame" => [ - "startColor" => "", - "endColor" => "" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/active_cube/active_cube_goods6.png", - "id" => "2v4zusih9u80" - ], - [ - "title" => [ - "text" => "智能手表", - "textColor" => "#303133" - ], - "subTitle" => [ - "text" => "本周热销商品", - "textColor" => "#999999", - "startColor" => "", - "endColor" => "" - ], - "moreTitle" => [ - "text" => "去看看", - "startColor" => "#A2E792", - "endColor" => "#49CD2D" - ], - "listFrame" => [ - "startColor" => "", - "endColor" => "" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/active_cube/active_cube_goods7.png", - "id" => "va5dyomnq68" - ], - [ - "title" => [ - "text" => "甜心咖啡", - "textColor" => "#303133" - ], - "subTitle" => [ - "text" => "办公好物推荐", - "textColor" => "#999999", - "startColor" => "", - "endColor" => "" - ], - "moreTitle" => [ - "text" => "去看看", - "startColor" => "#4AC1FF", - "endColor" => "#1D7CFF" - ], - "listFrame" => [ - "startColor" => "", - "endColor" => "" - ], - "link" => [ - "name" => "" - ], - "imageUrl" => "static/resource/images/diy/active_cube/active_cube_goods8.png", - "id" => "4h16lw3ntsw0" - ] - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "static/resource/images/diy/active_cube/active_cube_bg.png", - "componentBgAlpha" => 7, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "#FFFAF5", - "topElementRounded" => 10, - "bottomElementRounded" => 10, - "margin" => [ - "top" => 5, - "bottom" => 5, - "both" => 10 - ] - ], - [ - "path" => "edit-horz-blank", - "uses" => 0, - "id" => "6nc7hkh3g100", - "componentName" => "HorzBlank", - "componentTitle" => "辅助空白", - "ignore" => [ - "pageBgColor", - "componentBgUrl" - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "rgba(255, 169, 97, 1)", - "componentEndBgColor" => "rgba(250, 61, 61, 1)", - "componentGradientAngle" => "to right", - "topRounded" => 12, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 5, - "bottom" => 0, - "both" => 10 - ], - "height" => 10 - ], - [ - "path" => "edit-text", - "uses" => 0, - "position" => "", - "id" => "7f1nc9pkntw0", - "componentName" => "Text", - "componentTitle" => "标题", - "ignore" => [], - "style" => "style-2", - "styleName" => "风格2", - "text" => "新人尝鲜价", - "link" => [ - "name" => "" - ], - "textColor" => "#FFFFFF", - "fontSize" => 15, - "fontWeight" => "normal", - "textAlign" => "center", - "subTitle" => [ - "text" => "数量有限 抢完为止", - "color" => "#FFFFFF", - "fontSize" => 12, - "control" => true, - "fontWeight" => "normal" - ], - "more" => [ - "text" => "查看更多", - "control" => true, - "isShow" => false, - "link" => [ - "name" => "" - ], - "color" => "#999999" - ], - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "rgba(255, 169, 97, 1)", - "componentEndBgColor" => "rgba(250, 61, 61, 1)", - "componentGradientAngle" => "to right", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ] - ], - [ - "path" => "edit-horz-blank", - "uses" => 0, - "id" => "1o6ptkjsnabk", - "componentName" => "HorzBlank", - "componentTitle" => "辅助空白", - "ignore" => [ - "pageBgColor", - "componentBgUrl" - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "rgba(255, 169, 97, 1)", - "componentEndBgColor" => "rgba(250, 61, 61, 1)", - "componentGradientAngle" => "to right", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ], - "height" => 10 - ], - [ - "path" => "edit-goods-list", - "uses" => 0, - "id" => "17uao387qdds", - "componentName" => "GoodsList", - "componentTitle" => "商品列表", - "mode" => "aspectFill", - "ignore" => [], - "style" => "style-3", - "source" => "all", - "num" => 10, - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [], - "sortWay" => "default", - "goodsNameStyle" => [ - "color" => "#303133", - "control" => true, - "fontWeight" => "normal", - "isShow" => true - ], - "priceStyle" => [ - "color" => "#FF4142", - "control" => true, - "isShow" => true - ], - "saleStyle" => [ - "color" => "#999999", - "control" => true, - "isShow" => true - ], - "labelStyle" => [ - "control" => true, - "isShow" => true - ], - "btnStyle" => [ - "fontWeight" => false, - "padding" => 0, - "aroundRadius" => 25, - "cartEvent" => "detail", - "text" => "购买", - "textColor" => "#FFFFFF", - "startBgColor" => "#FF4142", - "endBgColor" => "#FF4142", - "style" => "nc-icon-jiahaoV6xx", - "control" => true - ], - "imgElementRounded" => 10,// 图片圆角 - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "rgba(255, 169, 97, 1)", - "componentEndBgColor" => "rgba(250, 61, 61, 1)", - "componentGradientAngle" => "to right", - "topRounded" => 0, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 10, - "bottomElementRounded" => 10, - "margin" => [ - "top" => 0, - "bottom" => 9, - "both" => 10 - ] - ], - [ - "path" => "edit-horz-blank", - "uses" => 0, - "id" => "4z9jltfk8jc0", - "componentName" => "HorzBlank", - "componentTitle" => "辅助空白", - "ignore" => [ - "pageBgColor", - "componentBgUrl" - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "rgba(253, 41, 52, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 12, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 5, - "bottom" => 0, - "both" => 10 - ], - "height" => 10 - ], - [ - "path" => "edit-text", - "uses" => 0, - "position" => "", - "id" => "65qaokgbzg80", - "componentName" => "Text", - "componentTitle" => "标题", - "ignore" => [], - "style" => "style-2", - "styleName" => "风格2", - "text" => "今日疯抢", - "link" => [ - "name" => "" - ], - "textColor" => "#FFFFFF", - "fontSize" => 15, - "fontWeight" => "normal", - "textAlign" => "center", - "subTitle" => [ - "text" => "数量有限 抢完为止", - "color" => "#FFFFFF", - "fontSize" => 12, - "control" => true, - "fontWeight" => "normal" - ], - "more" => [ - "text" => "查看更多", - "control" => true, - "isShow" => false, - "link" => [ - "name" => "" - ], - "color" => "#999999" - ], - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "rgba(253, 41, 52, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ] - ], - [ - "path" => "edit-goods-list", - "uses" => 0, - "id" => "2u96wyrm79u0", - "componentName" => "GoodsList", - "componentTitle" => "商品列表", - "mode" => "aspectFill", - "ignore" => [], - "style" => "style-1", - "source" => "all", - "num" => 10, - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [], - "sortWay" => "default", - "goodsNameStyle" => [ - "color" => "#303133", - "control" => true, - "fontWeight" => "normal", - "isShow" => true - ], - "priceStyle" => [ - "color" => "#FF4142", - "control" => true, - "isShow" => true - ], - "saleStyle" => [ - "color" => "#999999", - "control" => true, - "isShow" => true - ], - "labelStyle" => [ - "control" => true, - "isShow" => true - ], - "btnStyle" => [ - "fontWeight" => false, - "padding" => 0, - "aroundRadius" => 25, - "cartEvent" => "detail", - "text" => "购买", - "textColor" => "#FFFFFF", - "startBgColor" => "#FF4142", - "endBgColor" => "#FF4142", - "style" => "button", - "control" => true - ], - "imgElementRounded" => 10,// 图片圆角 - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 10, - "bottomElementRounded" => 10, - "margin" => [ - "top" => 0, - "bottom" => 5, - "both" => 10 - ] - ], - [ - "path" => "edit-text", - "uses" => 0, - "position" => "", - "id" => "5izyn9jcz3k0", - "componentName" => "Text", - "componentTitle" => "标题", - "ignore" => [], - "style" => "style-1", - "styleName" => "风格1", - "text" => "精选推荐", - "link" => [ - "name" => "" - ], - "textColor" => "#303133", - "fontSize" => 15, - "fontWeight" => "normal", - "textAlign" => "center", - "subTitle" => [ - "text" => "副标题", - "color" => "#999999", - "fontSize" => 14, - "control" => false, - "fontWeight" => "normal" - ], - "more" => [ - "text" => "查看更多", - "control" => false, - "isShow" => true, - "link" => [ - "name" => "" - ], - "color" => "#999999" - ], - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 20, - "bottom" => 15, - "both" => 0 - ] - ], - [ - "path" => "edit-goods-list", - "uses" => 0, - "id" => "4y7mw7j2uko0", - "componentName" => "GoodsList", - "componentTitle" => "商品列表", - "mode" => "aspectFill", - "ignore" => [], - "style" => "style-2", - "source" => "all", - "num" => 10, - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [], - "sortWay" => "default", - "goodsNameStyle" => [ - "color" => "#303133", - "control" => true, - "fontWeight" => "normal", - "isShow" => true - ], - "priceStyle" => [ - "color" => "#FF4142", - "control" => true, - "isShow" => true - ], - "saleStyle" => [ - "color" => "#999999", - "control" => true, - "isShow" => true - ], - "labelStyle" => [ - "control" => true, - "isShow" => true - ], - "btnStyle" => [ - "fontWeight" => false, - "padding" => 0, - "aroundRadius" => 25, - "cartEvent" => "detail", - "text" => "购买", - "textColor" => "#FFFFFF", - "startBgColor" => "#FF4142", - "endBgColor" => "#FF4142", - "style" => "button", - "control" => true - ], - "imgElementRounded" => 12,// 图片圆角 - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 12, - "bottomElementRounded" => 12, - "margin" => [ - "top" => 5, - "bottom" => 5, - "both" => 10 - ] - ], - [ - "path" => "edit-many-goods-list", - "uses" => 0, - "id" => "65lv65b38ig0", - "componentName" => "ManyGoodsList", - "componentTitle" => "多商品组", - "mode" => "aspectFill", - "ignore" => ['componentBgUrl'], - "style" => "style-2", - "num" => 6, - "sortWay" => "default", - "headStyle" => "style-2", - "aroundRadius" => 25, - "source" => "custom", - "goodsNameStyle" => [ - "color" => "#303133", - "control" => true, - "fontWeight" => "normal", - "isShow" => true - ], - "priceStyle" => [ - "color" => "#FF4142", - "control" => true, - "isShow" => true - ], - "saleStyle" => [ - "color" => "#999999", - "control" => true, - "isShow" => true - ], - "labelStyle" => [ - "control" => true, - "isShow" => true - ], - "imgElementRounded" => 12, // 图片圆角 - "btnStyle" => [ - "fontWeight" => false, - "padding" => 0, - "aroundRadius" => 25, - "cartEvent" => "detail", - "text" => "购买", - "textColor" => "#FFFFFF", - "startBgColor" => "#FF4142", - "endBgColor" => "#FF4142", - "style" => "button", - "control" => true - ], - "list" => [ - [ - "title" => "推荐", - "desc" => "猜你喜欢", - "source" => "all", - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [], - "id" => "2iljdx2ajqg0" - ], - [ - "id" => "3a1x4kgbre40", - "title" => "衣鞋包饰", - "desc" => "分类描述", - "source" => "all", - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [] - ], - [ - "id" => "12ozjal2rfe8", - "title" => "居家百货", - "desc" => "分类描述", - "source" => "all", - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [] - ], - [ - "id" => "71kwrfxeoxw0", - "title" => "热卖好物", - "desc" => "分类描述", - "source" => "all", - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [] - ], - [ - "id" => "5tktk8897ag0", - "title" => "优品精选", - "desc" => "分类描述", - "source" => "all", - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [] - ] - ], - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 12, - "bottomElementRounded" => 12, - "margin" => [ - "top" => 10, - "bottom" => 10, - "both" => 10 - ] - ] - ] - ] - ], - 'shop_index' => [ // 页面标识 - "title" => "商城首页3", // 页面名称 - 'cover' => 'addon/shop/diy/template/shop_index_two_cover.png', // 页面封面图 - 'preview' => '', // 页面预览图 - 'desc' => '', // 页面描述 - 'mode' => 'diy', // 页面模式:diy:自定义,fixed:固定 - // 页面数据源 - "data" => [ - "global" => [ - "title" => "首页", - 'pageStartBgColor' => 'rgba(255, 255, 255, 1)', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - "bgUrl" => "addon/shop/diy/index/bg.png", - 'bgHeightScale' => 0, - "imgWidth" => 750, - "imgHeight" => 1485, - "bottomTabBar" => [ - 'control' => true, - 'isShow' => true, - 'designNav' => [ - 'title' => '', - 'key' => '' - ] - ], - "copyright" => [ - 'control' => true, - 'isShow' => false, - 'textColor' =>'#ccc' - ], - "template" => [ - 'textColor' => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ] - ], - 'topStatusBar' => [ - 'control' => true, - 'isShow' => true, - 'bgColor' => "#ffffff", - 'rollBgColor' => "#ffffff", - 'style' => 'style-1', - 'styleName' => '风格1', - 'textColor' => "#333333", - 'rollTextColor' => "#333333", - 'textAlign' => 'center', - 'inputPlaceholder' => '请输入搜索关键词', - 'imgUrl' => '', - 'link' => [ - 'name' => "" - ] - ], - 'popWindow' => [ - 'imgUrl' => "", - 'imgWidth' => '', - 'imgHeight' => '', - 'count' => 'once', - 'show' => 0, - 'link' => [ - 'name' => "" - ], - ] - ], - "value" => [ - [ - "path" => "edit-shop-search", - "uses" => 1, - "id" => "245qvzv4w8gw", - "componentName" => "ShopSearch", - "componentTitle" => "搜索", - "ignore" => [], - "searchStyle" => "style-1", - "searchLink" => [ - "name" => "" - ], - "text" => "请输入搜索关键词", - "iconType" => "img", - "icon" => "", - "imageUrl" => "", - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 20, - "bottom" => 15, - "both" => 10 - ] - ], - [ - "path" => "edit-image-ads", - "uses" => 0, - "id" => "6jdfnu4e36g0", - "componentName" => "ImageAds", - "componentTitle" => "图片广告", - "ignore" => [], - "imageHeight" => 160, - "isSameScreen" => false, - "list" => [ - [ - "link" => [ - "name" => "" - ], - "imageUrl" => "addon/shop/diy/index/banner.png", - "imgWidth" => 702, - "imgHeight" => 320, - "id" => "7ao3t56ug4o0", - "width" => 375, - "height" => 170.94 - ] - ], - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 10, - "both" => 10 - ] - ], - [ - "path" => "edit-notice", - "uses" => 0, - "id" => "1xpv3z7vvtds", - "componentName" => "Notice", - "componentTitle" => "公告", - "ignore" => [], - "noticeType" => "img", - "imgType" => "system", - "systemUrl" => "style_1", - "imageUrl" => "", - "showType" => "popup", - "scrollWay" => "upDown", - "fontSize" => 14, - "fontWeight" => "normal", - "noticeTitle" => "公告", - "list" => [ - [ - "id" => "1rz6s4buaxc0", - "link" => [ - "name" => "" - ], - "text" => "最新公告:欢迎来到小店参观!" - ] - ], - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 9, - "bottomRounded" => 9, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 10, - "both" => 10 - ], - ], - [ - "path" => "edit-graphic-nav", - "uses" => 0, - "id" => "5tnh9iiuxv40", - "componentName" => "GraphicNav", - "componentTitle" => "图文导航", - "ignore" => [], - "layout" => "horizontal", - "mode" => "graphic", - "showStyle" => "fixed", - "rowCount" => 5, - "pageCount" => 2, - "carousel" => [ - "type" => "circle", - "color" => "#FFFFFF" - ], - "imageSize" => 26, - "aroundRadius" => 0, - "font" => [ - "size" => 14, - "weight" => "normal", - "color" => "#303133" - ], - "list" => [ - [ - "title" => "首页", - "link" => [ - "parent" => "SYSTEM_LINK", - "title" => "首页", - "url" => "/app/pages/index/index", - "name" => "INDEX" - ], - "imageUrl" => "addon/shop/diy/index/nav_notice.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "5b46sybkhkg0", - "imgWidth" => 50, - "imgHeight" => 50 - ], - [ - "title" => "商品", - "link" => [ - "parent" => "SHOP_LINK", - "title" => "商品列表", - "url" => "/addon/shop/pages/goods/list", - "name" => "SHOP_GOODS_LIST" - ], - "imageUrl" => "addon/shop/diy/index/nav_supermarket.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "4dha169dzqe0", - "imgWidth" => 50, - "imgHeight" => 50 - ], - [ - "title" => "分类", - "link" => [ - "parent" => "SHOP_LINK", - "title" => "商品分类", - "url" => "/addon/shop/pages/goods/category", - "name" => "SHOP_GOODS_CATEGORY" - ], - "imageUrl" => "addon/shop/diy/index/nav_article.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "7eh2hqz0w900", - "imgWidth" => 50, - "imgHeight" => 50 - ], - [ - "id" => "7fu7atbr9bk0", - "title" => "领券", - "imageUrl" => "addon/shop/diy/index/nav_coupon.png", - "imgWidth" => 50, - "imgHeight" => 50, - "link" => [ - "parent" => "SHOP_LINK", - "title" => "优惠券列表", - "url" => "/addon/shop/pages/coupon/list", - "name" => "SHOP_COUPON_LIST" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "title" => "拼团", - "link" => [ - "name" => "" - ], - "imageUrl" => "addon/shop/diy/index/nav_pintuan.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "5q9ogqz2vjc0", - "imgWidth" => 50, - "imgHeight" => 50 - ], - [ - "id" => "2cc20cawafr4", - "title" => "秒杀", - "imageUrl" => "addon/shop/diy/index/nav_seckill.png", - "imgWidth" => 50, - "imgHeight" => 50, - "link" => [ - "parent" => "SECKILL_LINK", - "title" => "秒杀首页", - "url" => "/addon/seckill/pages/index", - "name" => "SECKILL_INDEX" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "532sx2po4do0", - "title" => "签到", - "imageUrl" => "addon/shop/diy/index/nav_signin.png", - "imgWidth" => 50, - "imgHeight" => 50, - "link" => [ - "name" => "MEMBER_MY_SIGN_IN", - "parent" => "MEMBER_LINK", - "title" => "我的签到", - "url" => "/app/pages/member/sign_in", - "action" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "13itkrdjqteo", - "title" => "邀请好友", - "imageUrl" => "addon/shop/diy/index/nav_invite_friends.png", - "imgWidth" => 50, - "imgHeight" => 50, - "link" => [ - "name" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "6sisp3zd0w80", - "title" => "公告", - "imageUrl" => "addon/shop/diy/index/nav_sys_message.png", - "imgWidth" => 50, - "imgHeight" => 50, - "link" => [ - "name" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "6qoc0ssgvhc0", - "title" => "积分", - "imageUrl" => "addon/shop/diy/index/nav_point.png", - "imgWidth" => 50, - "imgHeight" => 50, - "link" => [ - "name" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ] - ], - // 轮播图设置 - 'swiper' => [ - 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 - "indicatorActiveColor" => '#FF0E0E', - 'indicatorStyle' => 'style-1', - 'indicatorAlign' => 'center', - ], - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 0.87)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 9, - "bottomRounded" => 9, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 12, - "both" => 10 - ] - ], - [ - "path" => "edit-hot-area", - "uses" => 0, - "id" => "53fen2lf6l80", - "componentName" => "HotArea", - "componentTitle" => "热区", - "ignore" => [], - "imageUrl" => "addon/shop/diy/index/hot_area.png", - "imgWidth" => 698, - "imgHeight" => 466, - "heatMapData" => [], - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 12, - "both" => 10 - ] - ], - [ - "path" => "edit-text", - "uses" => 0, - "id" => "5lojzvbvg6o0", - "componentName" => "Text", - "componentTitle" => "标题", - "ignore" => [], - "style" => "style-1", - "styleName" => "风格1", - "text" => "商品推荐", - "link" => [ - "name" => "" - ], - "textColor" => "#303133", - "fontSize" => 16, - "fontWeight" => "normal", - "textAlign" => "center", - "subTitle" => [ - "text" => "副标题", - "color" => "#999999", - "fontSize" => 14, - "control" => false, - "fontWeight" => "normal" - ], - "more" => [ - "text" => "查看更多", - "control" => false, - "isShow" => true, - "link" => [ - "name" => "" - ], - "color" => "#999999" - ], - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 12, - "both" => 0 - ] - ], - [ - "path" => "edit-goods-list", - "uses" => 0, - "id" => "50pj7dmvbvo0", - "componentName" => "GoodsList", - "componentTitle" => "商品列表", - "mode" => "aspectFill", - "ignore" => [], - 'style' => 'style-1', - "source" => "all", - "num" => 10, - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [], - "sortWay" => "default", // 排序方式,default:综合,sale_num:销量,price:价格 - "goodsNameStyle" => [ - "color" => "#303133", - "control" => true, - "fontWeight" => 'bold', - "isShow" => true - ], - "priceStyle" => [ - "color" => "#FF4142", - "control" => true, - "isShow" => true - ], - "saleStyle" => [ - "color" => "#999999", - "control" => true, - "isShow" => true - ], - "labelStyle" => [ - "control" => true, - "isShow" => true - ], - "btnStyle" => [ - "fontWeight" => false, - "padding" => 0, - "aroundRadius" => 25, - "cartEvent" => "detail", - "text" => "购买", - "textColor" => "#FFFFFF", - "startBgColor" => "#FF4142", - "endBgColor" => "#FF4142", - "style" => "button", - "control" => true - ], - "imgElementRounded" => 0,// 图片圆角 - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ] - ] - ] - ] - ], - ], - 'DIY_SHOP_MEMBER_INDEX' => [ - 'shop_member_index_style1' => [ - "title" => "商城个人中心1", // 页面名称 - 'cover' => 'addon/shop/diy/template/member_index_cover.png', // 页面封面图 - 'preview' => '', // 页面预览图 - 'desc' => '个人中心', // 页面描述 - 'mode' => 'diy', // 页面模式:diy:自定义,fixed:固定 - 'data' => [ - "global" => [ - "title" => "个人中心", - "bgUrl" => "", - "imgWidth" => "", - "imgHeight" => "", - "bottomTabBar" => [ - 'control' => true, - 'isShow' => true, - 'designNav' => [ - 'title' => '', - 'key' => '' - ] - ], - "copyright" => [ - 'control' => true, - 'isShow' => false, - 'textColor' =>'#ccc' - ], - "template" => [ - "textColor" => "#303133", - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ], - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentGradientAngle" => "to bottom" - ], - "topStatusBar" => [ - 'control' => true, - 'isShow' => true, - 'bgColor' => "#ffffff", - 'rollBgColor' => "#ffffff", - 'style' => 'style-1', - 'styleName' => '风格1', - 'textColor' => "#333333", - 'rollTextColor' => "#333333", - 'textAlign' => 'center', - 'inputPlaceholder' => '请输入搜索关键词', - 'imgUrl' => '', - 'link' => [ - 'name' => "" - ] - ], - "popWindow" => [ - "imgUrl" => "", - "imgWidth" => "", - "imgHeight" => "", - "count" => 'once', - "show" => 0, - "link" => [ - "name" => "" - ] - ], - "pageStartBgColor" => "rgba(246, 246, 246, 1)", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "bgHeightScale" => 0 - ], - "value" => [ - [ - "path" => "edit-shop-member-info", - "id" => "3pt9pn9bvn20", - "componentName" => "ShopMemberInfo", - "componentTitle" => "会员信息", - "uses" => 1, - "ignore" => [ - "componentBgUrl" - ], - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "rgba(246, 246, 246, 0.1)", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ], - "textColor" => "#333333", - "uidTextColor" => "#666666", - 'accountTextColor' => '#666666', - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentGradientAngle" => "to bottom", - "style" => "style-1", - "styleName" => "风格1", - "bgUrl" => "", - "isShowAccount" => true - ], - [ - "path" => "edit-member-level", - "uses" => 1, - "id" => "533e6ynytmo0", - "componentName" => "MemberLevel", - "componentTitle" => "会员等级", - "ignore" => [ - "componentBgColor", - "componentBgUrl" - ], - "style" => "style-5", - "styleName" => "风格5", - "textColor" => "#303133", - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => -45, - "bottom" => 0, - "both" => 10 - ], - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentGradientAngle" => "to bottom" - ], - [ - "path" => "edit-shop-order-info", - "uses" => 1, - "id" => "2jmnqqhc8ri0", - "componentName" => "ShopOrderInfo", - "componentTitle" => "订单中心", - "ignore" => [], - "textColor" => "#303133", - "fontSize" => 15, - "fontWeight" => "normal", - "text" => "订单中心", - "more" => [ - "text" => "全部订单", - "color" => "#999999", - ], - "item" => [ - "fontSize" => 12, - "fontWeight" => "normal", - "color" => "#303133" - ], - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "topRounded" => 12, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 10, - "bottom" => 0, - "both" => 10 - ], - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentGradientAngle" => "to bottom" - ], - [ - "path" => "edit-horz-blank", - "uses" => 0, - "id" => "6cil3ipiis40", - "componentName" => "HorzBlank", - "componentTitle" => "辅助空白", - "ignore" => ['pageBgColor', 'componentBgUrl'], - "height" => 10, - "textColor" => "#303133", - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "topRounded" => 12, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 10, - "bottom" => 0, - "both" => 10 - ], - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentGradientAngle" => "to bottom" - ], - [ - "path" => "edit-text", - "uses" => 0, - "id" => "68gnubbygqg0", - "componentName" => "Text", - "componentTitle" => "标题", - "ignore" => [], - "textColor" => "#303133", - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ], - "fontSize" => 15, - "fontWeight" => "normal", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentGradientAngle" => "to bottom", - "position" => "", - "style" => "style-1", - "styleName" => "风格1", - "text" => "其他功能", - "link" => [ - "name" => "" - ], - "textAlign" => "left", - "subTitle" => [ - "text" => "副标题", - "color" => "#999999", - "fontSize" => 14, - "control" => false, - "fontWeight" => "normal" - ], - "more" => [ - "text" => "查看更多", - "control" => false, - "isShow" => true, - "link" => [ - "name" => "" - ], - "color" => "#999999" - ] - ], - [ - "path" => "edit-horz-blank", - "uses" => 0, - "id" => "5jx57rrjl940", - "componentName" => "HorzBlank", - "componentTitle" => "辅助空白", - "ignore" => ['pageBgColor', 'componentBgUrl'], - "height" => 8, - "textColor" => "#303133", - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ], - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentGradientAngle" => "to bottom" - ], - [ - "path" => "edit-graphic-nav", - "uses" => 0, - "id" => "5myxk1opz0c0", - "componentName" => "GraphicNav", - "componentTitle" => "图文导航", - "ignore" => [], - "textColor" => "#303133", - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "topRounded" => 0, - "bottomRounded" => 12, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 10, - "both" => 10 - ], - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentGradientAngle" => "to bottom", - "layout" => "horizontal", - "mode" => "graphic", - "showStyle" => "fixed", - "rowCount" => 4, - "pageCount" => 2, - "carousel" => [ - "type" => "circle", - "color" => "#FFFFFF" - ], - "imageSize" => 20, - "aroundRadius" => 0, - "font" => [ - "size" => 12, - "weight" => "normal", - "color" => "#303133" - ], - "list" => $member_index_graphic_nav_list, - // 轮播图设置 - 'swiper' => [ - 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 - "indicatorActiveColor" => '#FF0E0E', - 'indicatorStyle' => 'style-1', - 'indicatorAlign' => 'center', - ] - ] - ] - ] - ], - 'shop_member_index' => [ - "title" => "商城个人中心2", // 页面名称 - 'cover' => 'addon/shop/diy/template/member_index_cover.png', // 页面封面图 - 'preview' => '', // 页面预览图 - 'desc' => '个人中心', // 页面描述 - 'mode' => 'diy', // 页面模式:diy:自定义,fixed:固定 - 'data' => [ - "global" => [ - "title" => "个人中心", - 'pageStartBgColor' => 'rgba(246, 247, 252, 1)', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - "bgUrl" => "", - 'bgHeightScale' => 0, - "imgWidth" => "", - "imgHeight" => "", - "bottomTabBar" => [ - 'control' => true, - 'isShow' => true, - 'designNav' => [ - 'title' => '', - 'key' => '' - ] - ], - "copyright" => [ - 'control' => true, - 'isShow' => false, - 'textColor' =>'#ccc' - ], - "template" => [ - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ] - ], - "topStatusBar" => [ - 'control' => true, - 'isShow' => true, - 'bgColor' => "#ffffff", - 'rollBgColor' => "#ffffff", - 'style' => 'style-1', - 'styleName' => '风格1', - 'textColor' => "#333333", - 'rollTextColor' => "#333333", - 'textAlign' => 'center', - 'inputPlaceholder' => '请输入搜索关键词', - 'imgUrl' => '', - 'link' => [ - 'name' => "" - ] - ], - "popWindow" => [ - "imgUrl" => "", - "imgWidth" => "", - "imgHeight" => "", - "count" => 'once', - "show" => 0, - "link" => [ - "name" => "" - ] - ] - ], - "value" => [ - [ - "path" => "edit-member-info", - "id" => "40w5ay4dep00", - "componentName" => "MemberInfo", - "componentTitle" => "会员信息", - "uses" => 1, - "ignore" => [], - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ], - "textColor" => "#303133", - "style" => "style-1", - "styleName" => "风格1", - "bgUrl" => "", - "bgColorStart" => "", - "bgColorEnd" => "", - "isShowAccount" => true - ], - [ - "path" => "edit-horz-blank", - "uses" => 0, - "id" => "2da0xqyo8zms", - "componentName" => "HorzBlank", - "componentTitle" => "辅助空白", - "ignore" => [ - "pageBgColor", - "componentBgUrl" - ], - "height" => 10, - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 9, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ] - ], - [ - "path" => "edit-text", - "uses" => 0, - "position" => "", - "id" => "1puhgfus8www", - "componentName" => "Text", - "componentTitle" => "标题", - "ignore" => [], - "style" => "style-2", - "styleName" => "风格2", - "text" => "我的订单", - "link" => [ - "name" => "SHOP_ORDER_LIST", - "parent" => "SHOP_LINK", - "title" => "订单列表", - "url" => "/addon/shop/pages/order/list", - "action" => "" - ], - "textColor" => "#303133", - "fontSize" => 16, - "fontWeight" => "normal", - "textAlign" => "center", - "subTitle" => [ - "text" => "", - "color" => "#999999", - "fontSize" => 14, - "control" => true, - "fontWeight" => "normal" - ], - "more" => [ - "text" => "全部", - "control" => true, - "isShow" => true, - "link" => [ - "name" => "" - ], - "color" => "#999999" - ], - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ] - ], - [ - "path" => "edit-graphic-nav", - "uses" => 0, - "id" => "42bjn10l0ak0", - "componentName" => "GraphicNav", - "componentTitle" => "图文导航", - "ignore" => [], - "list" => [ - [ - "link" => [ - "parent" => "DIY_LINK", - "title" => "待付款", - "url" => "/addon/shop/pages/order/list?status=1", - "name" => "DIY_LINK" - ], - "imageUrl" => "addon/shop/diy/member/nav_wait_pay_order.png", - "imgWidth" => 40, - "imgHeight" => 40, - "id" => "ogkw2mqwvow", - "title" => "待付款", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "title" => "待发货", - "link" => [ - "parent" => "DIY_LINK", - "title" => "待发货", - "url" => "/addon/shop/pages/order/list?status=2", - "name" => "DIY_LINK" - ], - "imageUrl" => "addon/shop/diy/member/nav_wait_delivery_order.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "37hnqfvx5va0", - "imgWidth" => 40, - "imgHeight" => 40 - ], - [ - "title" => "待收货", - "link" => [ - "parent" => "DIY_LINK", - "title" => "待收货", - "url" => "/addon/shop/pages/order/list?status=3", - "name" => "DIY_LINK" - ], - "imageUrl" => "addon/shop/diy/member/nav_wait_take_order.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "63n62guoiug0", - "imgWidth" => 40, - "imgHeight" => 40 - ], - [ - "title" => "待评价", - "link" => [ - "parent" => "DIY_LINK", - "title" => "待评价", - "url" => "/addon/shop/pages/order/list?status=5", - "name" => "DIY_LINK" - ], - "imageUrl" => "addon/shop/diy/member/nav_wait_evaluate_order.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "4wblhzd14uw0", - "imgWidth" => 40, - "imgHeight" => 40 - ], - [ - "id" => "fl2bqfimnuo", - "title" => "售后退款", - "imageUrl" => "addon/shop/diy/member/nav_refund_order.png", - "imgWidth" => 40, - "imgHeight" => 40, - "link" => [ - "parent" => "SHOP_LINK", - "title" => "退款列表", - "url" => "/addon/shop/pages/refund/list", - "name" => "SHOP_REFUND_LIST" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ] - ], - // 轮播图设置 - 'swiper' => [ - 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 - "indicatorActiveColor" => '#FF0E0E', - 'indicatorStyle' => 'style-1', - 'indicatorAlign' => 'center', - ], - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 9, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 12, - "both" => 10 - ], - "layout" => "horizontal", - "mode" => "graphic", - "showStyle" => "fixed", - "rowCount" => 5, - "pageCount" => 2, - "carousel" => [ - "type" => "circle", - "color" => "#FFFFFF" - ], - "imageSize" => 20, - "aroundRadius" => 0, - "font" => [ - "size" => 14, - "weight" => "normal", - "color" => "rgba(32, 15, 51, 1)" - ] - ], - [ - "path" => "edit-horz-blank", - "uses" => 0, - "id" => "5fo173bx5840", - "componentName" => "HorzBlank", - "componentTitle" => "辅助空白", - "ignore" => [ - "pageBgColor", - "componentBgUrl" - ], - "height" => 10, - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 9, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ] - ], - [ - "path" => "edit-text", - "uses" => 0, - "position" => "", - "id" => "629cgb1ygcw0", - "componentName" => "Text", - "componentTitle" => "标题", - "ignore" => [], - "style" => "style-1", - "styleName" => "风格1", - "text" => "常用工具", - "link" => [ - "name" => "" - ], - "textColor" => "#303133", - "fontSize" => 16, - "fontWeight" => "normal", - "textAlign" => "left", - "subTitle" => [ - "text" => "", - "color" => "#999999", - "fontSize" => 14, - "control" => false, - "fontWeight" => "normal" - ], - "more" => [ - "text" => "查看更多", - "control" => false, - "isShow" => false, - "link" => [ - "name" => "" - ], - "color" => "#999999" - ], - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ] - ], - [ - "path" => "edit-graphic-nav", - "uses" => 0, - "id" => "1swylyl5fvb4", - "componentName" => "GraphicNav", - "componentTitle" => "图文导航", - "ignore" => [], - "list" => [ - [ - "title" => "签到", - "link" => [ - "name" => "MEMBER_MY_SIGN_IN", - "parent" => "MEMBER_LINK", - "title" => "我的签到", - "url" => "/app/pages/member/sign_in", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/member/nav_signin.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "imgWidth" => 58, - "imgHeight" => 58 - ], - [ - "title" => "个人资料", - "link" => [ - "parent" => "MEMBER_LINK", - "title" => "个人资料", - "url" => "/app/pages/member/personal", - "name" => "MEMBER_PERSONAL" - ], - "imageUrl" => "addon/shop/diy/member/nav_info.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "imgWidth" => 58, - "imgHeight" => 58 - ], - [ - "title" => "收货地址", - "link" => [ - "parent" => "MEMBER_LINK", - "title" => "收货地址", - "url" => "/app/pages/member/address", - "name" => "MEMBER_ADDRESS" - ], - "imageUrl" => "addon/shop/diy/member/nav_address.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "imgWidth" => 58, - "imgHeight" => 58 - ], - [ - "title" => "优惠券", - "link" => [ - "parent" => "SHOP_LINK", - "title" => "我的优惠券", - "url" => "/addon/shop/pages/member/my_coupon", - "name" => "SHOP_MY_COUPON" - ], - "imageUrl" => "addon/shop/diy/member/nav_coupon.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "imgWidth" => 58, - "imgHeight" => 58 - ], - [ - "id" => "su0vf82y200", - "title" => "我的拼单", - "imageUrl" => "addon/shop/diy/member/nav_my_pintuan.png", - "imgWidth" => 58, - "imgHeight" => 58, - "link" => [ - "name" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "6ba0yct2b3ct", - "title" => "我的助力", - "imageUrl" => "addon/shop/diy/member/nav_my_help.png", - "imgWidth" => 58, - "imgHeight" => 58, - "link" => [ - "name" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "2b0att2b3pq8", - "title" => "我的礼物", - "imageUrl" => "addon/shop/diy/member/nav_gift.png", - "imgWidth" => 58, - "imgHeight" => 58, - "link" => [ - "name" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "z8x7ci5wik0", - "title" => "我的足迹", - "imageUrl" => "addon/shop/diy/member/nav_footmark.png", - "imgWidth" => 58, - "imgHeight" => 58, - "link" => [ - "name" => "SHOP_MY_GOODS_BROWSE", - "parent" => "SHOP_LINK", - "title" => "我的足迹", - "url" => "/addon/shop/pages/goods/browse", - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ], - [ - "id" => "1sejr0g3h4zk", - "title" => "积分兑换", - "imageUrl" => "addon/shop/diy/member/nav_point_change.png", - "imgWidth" => 58, - "imgHeight" => 58, - "link" => [ - "name" => "" - ], - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ] - ] - ], - // 轮播图设置 - 'swiper' => [ - 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 - "indicatorActiveColor" => '#FF0E0E', - 'indicatorStyle' => 'style-1', - 'indicatorAlign' => 'center', - ], - "textColor" => "#303133", - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 9, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ], - "layout" => "horizontal", - "mode" => "graphic", - "showStyle" => "fixed", - "rowCount" => 4, - "pageCount" => 2, - "carousel" => [ - "type" => "circle", - "color" => "#FFFFFF" - ], - "imageSize" => 29, - "aroundRadius" => 0, - "font" => [ - "size" => 14, - "weight" => "normal", - "color" => "#303133" - ] - ] - ] - ] - ] - ], - 'DIY_SHOP_POINT_INDEX' => [ - 'shop_point_index_style1' => [ - "title" => "积分商城", - 'cover' => 'addon/shop/diy/template/shop_point_index_style1_cover.jpg', // 页面封面图 - 'preview' => '', // 页面预览图 - 'desc' => '', // 页面描述 - 'mode' => 'diy', // 页面模式:diy:自定义,fixed:固定 - // 页面数据源 - 'data' => [ - "global" => [ - "bgUrl" => "", - "imgWidth" => "", - "imgHeight" => "", - "title" => "积分商城", - "pageStartBgColor" => "#F6F6F6", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "bgHeightScale" => 0, - "topStatusBar" => [ - 'control' => true, - 'isShow' => false, - 'bgColor' => "#ffffff", - 'rollBgColor' => "#ffffff", - 'style' => 'style-1', - 'styleName' => '风格1', - 'textColor' => "#333333", - 'rollTextColor' => "#333333", - 'textAlign' => 'center', - 'inputPlaceholder' => '请输入搜索关键词', - 'imgUrl' => '', - 'link' => [ - 'name' => "" - ] - ], - "bottomTabBar" => [ - 'control' => true, - 'isShow' => true, - 'designNav' => [ - 'title' => '', - 'key' => '' - ] - ], - "copyright" => [ - 'control' => true, - 'isShow' => false, - 'textColor' =>'#ccc' - ], - "popWindow" => [ - "imgUrl" => "", - "imgWidth" => "", - "imgHeight" => "", - "count" => 'once', - "show" => 0, - "link" => [ - "name" => "" - ] - ], - "template" => [ - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ] - ] - ], - "value" => [ - [ - "id" => "d0ib6565eaw", - "componentName" => "ShopExchangeInfo", - "componentTitle" => "积分兑换", - "path" => "edit-shop-exchange-info", - "uses" => 0, - "ignore" => [], - "bgUrl" => "addon/shop/diy/point/point_index_bg.jpg", - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ], - ], - [ - "id" => "5lml3wp5tow0", - "componentName" => "GraphicNav", - "componentTitle" => "图文导航", - "path" => "edit-graphic-nav", - "uses" => 0, - "ignore" => [], - "layout" => "horizontal", - "mode" => "graphic", - "showStyle" => "fixed", - "rowCount" => 3, - "pageCount" => 2, - "carousel" => [ - "type" => "circle", - "color" => "#FFFFFF" - ], - "imageSize" => 40, - "aroundRadius" => 0, - "font" => [ - "size" => 13, - "weight" => "normal", - "color" => "#303133" - ], - "list" => [ - [ - "title" => "我的积分", - "link" => [ - "parent" => "MEMBER_LINK", - "name" => "MEMBER_POINT", - "title" => "我的积分", - "url" => "/app/pages/member/point", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/point/nav_point.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "4fll6n7lge40", - "imgWidth" => 140, - "imgHeight" => 140 - ], - [ - "title" => "我的兑换", - "link" => [ - "parent" => "SHOP_LINK", - "name" => "SHOP_POINT_ORDER_LIST", - "title" => "积分兑换记录", - "url" => "/addon/shop/pages/point/order_list", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/point/nav_my_exchange.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "4blja5zsv0m0", - "imgWidth" => 140, - "imgHeight" => 132 - ], - [ - "title" => "每日签到", - "link" => [ - "name" => "MEMBER_MY_SIGN_IN", - "parent" => "MEMBER_LINK", - "title" => "我的签到", - "url" => "/app/pages/member/sign_in", - "action" => "" - ], - "imageUrl" => "addon/shop/diy/point/nav_sign_in.png", - "label" => [ - "control" => false, - "text" => "热门", - "textColor" => "#FFFFFF", - "bgColorStart" => "#F83287", - "bgColorEnd" => "#FE3423" - ], - "id" => "6v4fptrqano0", - "imgWidth" => 134, - "imgHeight" => 132 - ] - ], - // 轮播图设置 - 'swiper' => [ - 'indicatorColor' => 'rgba(0, 0, 0, 0.3)', // 未选中颜色 - "indicatorActiveColor" => '#FF0E0E', - 'indicatorStyle' => 'style-1', - 'indicatorAlign' => 'center', - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "rgba(255, 255, 255, 1)", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "rgba(255, 255, 255, 1)", - "componentEndBgColor" => "rgba(255, 255, 255, 1)", - "componentGradientAngle" => "to bottom", - "topRounded" => 17, - "bottomRounded" => 17, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => -40, - "bottom" => 0, - "both" => 10 - ] - ], - [ - "id" => "6c7y9m3c99o0", - "componentName" => "HorzBlank", - "componentTitle" => "辅助空白", - "path" => "edit-horz-blank", - "uses" => 0, - "height" => 15, - "ignore" => [ - "pageBgColor", - "componentBgUrl" - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 10, - "bottom" => 0, - "both" => 10 - ] - ], - [ - "id" => "3h6ppt6s1jw0", - "componentName" => "Text", - "componentTitle" => "标题", - "path" => "edit-text", - "uses" => 0, - "fontSize" => 15, - "position" => "", - "ignore" => [], - "style" => "style-2", - "styleName" => "风格2", - "text" => "热门推荐", - "link" => [ - "name" => "" - ], - "textColor" => "#303133", - "fontWeight" => "normal", - "textAlign" => "center", - "subTitle" => [ - "text" => "", - "color" => "#999999", - "fontSize" => 13, - "control" => true, - "fontWeight" => "normal" - ], - "more" => [ - "text" => "更多", - "control" => true, - "isShow" => true, - "link" => [ - "parent" => "SHOP_LINK", - "name" => "SHOP_POINT_LIST", - "title" => "积分商品列表", - "url" => "/addon/shop/pages/point/list", - "action" => "" - ], - "color" => "#999999" - ], - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ] - ], - [ - "id" => "2jeafwoghdk0", - "componentName" => "HorzBlank", - "componentTitle" => "辅助空白", - "path" => "edit-horz-blank", - "uses" => 0, - "height" => 10, - "ignore" => [ - "pageBgColor", - "componentBgUrl" - ], - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ] - ], - [ - "id" => "76wf7oom00o0", - "componentName" => "ShopExchangeGoods", - "componentTitle" => "积分商品", - "mode" => "aspectFill", - "path" => "edit-shop-exchange-goods", - "uses" => 0, - "ignore" => [], - "style" => "style-2", - "source" => "all", - "num" => 10, - "goods_category" => "", - "goods_category_name" => "请选择", - "goods_ids" => [], - "sortWay" => "total_order_num", - "goodsNameStyle" => [ - "color" => "#333", - "control" => true, - "fontWeight" => "normal" - ], - "priceStyle" => [ - "mainColor" => "#FF4142", - "mainControl" => true, - "lineColor" => "#999CA7", - "lineControl" => true - ], - "saleStyle" => [ - "color" => "#999999", - "control" => true - ], - "imgElementRounded" => 0,// 图片圆角 - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 12, - "bottomElementRounded" => 12, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 10 - ] - ] - ] - ] - ] - ], - 'DIY_SHOP_GOODS_DETAIL' => [ - 'shop_goods_detail_style1' => [ - "title" => "商品详情", - 'cover' => '', // 页面封面图 - 'preview' => '', // 页面预览图 - 'desc' => '', // 页面描述 - 'mode' => 'diy', // 页面模式:diy:自定义,fixed:固定 - // 页面数据源 - 'data' => [ - 'global' => [ - 'title' => '商品详情', - 'completeLayout' => 'style-1', - 'completeAlign' => 'left', - 'borderControl' => true, - 'pageStartBgColor' => 'rgba(246, 246, 246, 1)', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'bgUrl' => '', - 'bgHeightScale' => 100, - 'imgWidth' => '', - 'imgHeight' => '', - 'topStatusBar' => [ - 'control' => false, - 'isShow' => false, - 'bgColor' => "#ffffff", - 'rollBgColor' => "#ffffff", - 'style' => 'style-1', - 'styleName' => '风格1', - 'textColor' => "#333333", - 'rollTextColor' => "#333333", - 'textAlign' => 'center', - 'inputPlaceholder' => '请输入搜索关键词', - 'imgUrl' => '', - 'link' => [ - 'name' => "" - ] - ], - 'bottomTabBar' => [ - 'control' => false, - 'isShow' => false, - 'designNav' => [ - 'title' => '', - 'key' => '' - ] - ], - "copyright" => [ - 'control' => true, - 'isShow' => false, - 'textColor' =>'#ccc' - ], - 'popWindow' => [ - 'imgUrl' => '', - 'imgWidth' => '', - 'imgHeight' => '', - 'count' => 'once', - 'show' => false, - 'link' => [ - 'name' => '' - ] - ], - 'template' => [ - 'textColor' => '#303133', - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - 'componentStartBgColor' => '', - 'componentEndBgColor' => '', - 'componentGradientAngle' => 'to bottom', - 'topRounded' => 0, - 'bottomRounded' => 0, - 'elementBgColor' => '', - 'topElementRounded' => 0, - 'bottomElementRounded' => 0, - 'margin' => [ - 'top' => 0, - 'bottom' => 0, - 'both' => 0 - ], - 'isHidden' => false - ] - ], - 'value' => [ - [ - 'path' => 'edit-shop-goods-detail-basic-info', - 'uses' => 1, - 'position' => 'top_fixed', - 'id' => 'j3hqu5tg1zk', - 'componentName' => 'ShopGoodsDetailBasicInfo', - 'componentTitle' => '基础信息', - 'ignore' => [ - 'pageBgColor', - 'componentBgUrl', - 'marginTop', - 'marginBottom', - 'marginBoth', - 'topRounded', - 'bottomRounded' - ], - 'menuContent' => 'index,search,cart,member', - 'medium' => [ - 'type' => 'square_img', - 'indicator' => true - ], - 'priceRegion' => [ - 'showWay' => 'normal', - 'bgImg' => 'addon/shop/diy/goods_detail/style_01.jpg', - 'marketingBgImg' => 'addon/shop/diy/goods_detail/marketing_style_01.jpg', - 'goodsStyle' => [ - 'title' => '风格1', - 'value' => 'style-1' - ], - 'marketingStyle' => [ - 'title' => '风格1', - 'value' => 'style-1' - ] - ], - 'goodsInfo' => [ - 'titleColor' => '#333333', - 'subTitleColor' => '#999999', - 'saleInfoColor' => '#999999', - 'priceTopRounded' => 17, - 'priceBottomRounded' => 0, - 'topRounded' => 12, - 'bottomRounded' => 0, - 'priceBgColor' => '', - "startBgColor" => '#ffffff', - "endBgColor" => 'rgba(254, 254, 254, 1)', - 'priceAboutMargin' => 0, - 'priceTopMargin' => -22, - 'topMargin' => -13, - 'aboutMargin' => 0 - ], - 'saleInfo' => ['underlined_price', 'sales', 'stock'], - 'textColor' => '#303133', - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - 'componentStartBgColor' => '', - 'componentEndBgColor' => '', - 'componentGradientAngle' => 'to bottom', - 'topRounded' => 0, - 'bottomRounded' => 0, - 'elementBgColor' => '', - 'topElementRounded' => 0, - 'bottomElementRounded' => 0, - 'margin' => [ - 'top' => 0, - 'bottom' => 0, - 'both' => 0 - ], - 'isHidden' => false - ], - [ - "path" => "edit-horz-blank", - "uses" => 0, - "id" => "7lc46dh86vw0", - "componentName" => "HorzBlank", - "componentTitle" => "辅助空白", - "ignore" => [ - "pageBgColor", - "componentBgUrl" - ], - "height" => 100, - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "rgba(253, 253, 253, 1)", - "componentEndBgColor" => "rgba(246, 246, 246, 1)", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => -100, - "both" => 0 - ], - "isHidden" => false - ], - [ - 'path' => 'edit-shop-goods-detail-purchase-service', - 'uses' => 1, - 'id' => 'c4wh1kcz3i0', - 'componentName' => 'ShopGoodsDetailPurchaseService', - 'componentTitle' => '商品服务', - 'ignore' => [], - 'serviceConfig' => ['goods_service', 'spec_select', 'delivery_info', 'coupons', 'activity'], - 'textColor' => '#303133', - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - 'componentStartBgColor' => '#FFFFFF', - 'componentEndBgColor' => '', - 'componentGradientAngle' => 'to bottom', - 'topRounded' => 12, - 'bottomRounded' => 12, - 'elementBgColor' => '', - 'topElementRounded' => 0, - 'bottomElementRounded' => 0, - 'margin' => [ - 'top' => 12, - 'bottom' => 0, - 'both' => 10 - ], - 'isHidden' => false - ], - [ - 'path' => 'edit-shop-goods-detail-sow', - 'uses' => 0, - 'id' => '1zi5tkyxurpc', - 'componentName' => 'ShopGoodsDetailSow', - 'componentTitle' => '种草秀', - 'ignore' => [], - 'isShow' => true, - 'textColor' => '#303133', - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - 'componentStartBgColor' => '#FFFFFF', - 'componentEndBgColor' => '', - 'componentGradientAngle' => 'to bottom', - 'topRounded' => 12, - 'bottomRounded' => 12, - 'elementBgColor' => '', - 'topElementRounded' => 0, - 'bottomElementRounded' => 0, - 'margin' => [ - 'top' => 12, - 'bottom' => 0, - 'both' => 10 - ], - 'isHidden' => false - ], - [ - 'path' => 'edit-shop-goods-detail-evaluate', - 'uses' => 1, - 'id' => '1jgv7ysvlh0g', - 'componentName' => 'ShopGoodsDetailEvaluate', - 'componentTitle' => '商品评价', - 'ignore' => [], - 'isShow' => true, - 'textColor' => '#303133', - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - 'componentStartBgColor' => '#FFFFFF', - 'componentEndBgColor' => '', - 'componentGradientAngle' => 'to bottom', - 'topRounded' => 12, - 'bottomRounded' => 12, - 'elementBgColor' => '', - 'topElementRounded' => 0, - 'bottomElementRounded' => 0, - 'margin' => [ - 'top' => 12, - 'bottom' => 0, - 'both' => 10 - ], - 'isHidden' => false - ], - [ - 'path' => 'edit-shop-goods-detail-attr', - 'uses' => 1, - 'id' => '19m7738ofq68', - 'componentName' => 'ShopGoodsDetailAttr', - 'componentTitle' => '商品属性', - 'ignore' => [], - 'isShow' => true, - 'textColor' => '#303133', - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - 'componentStartBgColor' => '#FFFFFF', - 'componentEndBgColor' => '', - 'componentGradientAngle' => 'to bottom', - 'topRounded' => 12, - 'bottomRounded' => 12, - 'elementBgColor' => '', - 'topElementRounded' => 0, - 'bottomElementRounded' => 0, - 'margin' => [ - 'top' => 12, - 'bottom' => 0, - 'both' => 10 - ], - 'isHidden' => false - ], - [ - 'path' => 'edit-shop-goods-detail-desc', - 'uses' => 1, - 'id' => '37i90so3cly0', - 'componentName' => 'ShopGoodsDetailDesc', - 'componentTitle' => '商品详情', - 'ignore' => [], - 'isShow' => true, - 'textColor' => '#303133', - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - 'componentStartBgColor' => '#FFFFFF', - 'componentEndBgColor' => '', - 'componentGradientAngle' => 'to bottom', - 'topRounded' => 12, - 'bottomRounded' => 12, - 'elementBgColor' => '', - 'topElementRounded' => 0, - 'bottomElementRounded' => 0, - 'margin' => [ - 'top' => 12, - 'bottom' => 20, - 'both' => 10 - ], - 'isHidden' => false - ], - [ - 'path' => 'edit-shop-goods-detail-bottom', - 'position' => 'bottom_fixed', - 'uses' => 1, - 'id' => 'p313pc2eduo', - 'componentName' => 'ShopGoodsDetailBottom', - 'componentTitle' => '底部菜单', - 'ignore' => [ - 'pageBgColor', - 'componentBgUrl', - 'marginTop', - 'marginBottom', - 'marginBoth', - 'topRounded', - 'bottomRounded' - ], - 'menuContent' => ['index', 'service', 'cart'], - 'cartName' => '加入购物车', - 'buyName' => '立即购买', - 'cartIsShow' => true, - 'cartStyle' => [ - 'textColor' => '#FFFFFF', - 'fontSize' => 12, - 'gradientAngle' => 'to right', - 'startColor' => '#FFB000', - 'endColor' => '#FFA029' - ], - 'buyStyle' => [ - 'textColor' => '#FFFFFF', - 'fontSize' => 12, - 'gradientAngle' => 'to right', - 'startColor' => '#FB7939', - 'endColor' => '#FF4142' - ], - 'textColor' => '#303133', - 'pageStartBgColor' => '', - 'pageEndBgColor' => '', - 'pageGradientAngle' => 'to bottom', - 'componentBgUrl' => '', - 'componentBgAlpha' => 2, - 'componentStartBgColor' => '#FFFFFF', - 'componentEndBgColor' => '', - 'componentGradientAngle' => 'to bottom', - 'topRounded' => 0, - 'bottomRounded' => 0, - 'elementBgColor' => '', - 'topElementRounded' => 0, - 'bottomElementRounded' => 0, - 'margin' => [ - 'top' => 0, - 'bottom' => 0, - 'both' => 0 - ], - 'isHidden' => false - ] - ] - ] - ] - ] -]; \ No newline at end of file diff --git a/niucloud/addon/shop/app/dict/diy/template.php b/niucloud/addon/shop/app/dict/diy/template.php deleted file mode 100644 index ea9fd60e3..000000000 --- a/niucloud/addon/shop/app/dict/diy/template.php +++ /dev/null @@ -1,49 +0,0 @@ - [ - 'title' => get_lang('dict_diy.page_shop_index'), - 'page' => '/addon/shop/pages/index', - 'action' => 'decorate', - 'type' => 'index' - ], - 'DIY_SHOP_MEMBER_INDEX' => [ - 'title' => get_lang('dict_diy.page_shop_member_index'), - 'page' => '/addon/shop/pages/member/index', - 'action' => 'decorate', - 'type' => 'member_index' - ], - 'DIY_SHOP_POINT_INDEX' => [ - 'title' => get_lang('dict_diy.page_shop_point_index'), - 'page' => '/addon/shop/pages/point/index', - 'action' => 'decorate', - 'type' => '' - ], - 'DIY_SHOP_GOODS_DETAIL' => [ - 'title' => get_lang('dict_diy.page_shop_detail'), - 'page' => '/addon/shop/pages/goods/detail', - 'action' => 'decorate', - 'type' => '', - 'ignoreComponents' => ['CarouselSearch'], // 忽略组件名单,商品详情不支持添加轮播搜索组件 - // 页面数据结构,初始化时覆盖 - 'global' => [ - 'topStatusBar' => [ - 'control' => false, // 隐藏顶部导航栏,禁止编辑 - ], - 'bottomTabBar' => [ - 'control' => false, // 隐藏底部导航,禁止编辑 - 'isShow' => false, - 'designNav' => [ - 'title' => '', - 'key' => '' - ] - ], - "copyright" => [ - 'control' => true, - 'isShow' => false, - 'textColor' =>'#ccc' - ], - ], - - ], -]; diff --git a/niucloud/addon/shop/app/dict/diy_form/components.php b/niucloud/addon/shop/app/dict/diy_form/components.php deleted file mode 100644 index ece5556d8..000000000 --- a/niucloud/addon/shop/app/dict/diy_form/components.php +++ /dev/null @@ -1,23 +0,0 @@ - [ -// 'title' => get_lang('dict_diy_form.shop_component_type_basic'), -// 'list' => [ -// 'GoodsInput' => [ -// 'title' => '商品文本', -// 'icon' => 'iconfont iconbiaotipc', -// 'path' => 'edit-goods-input', // 编辑组件属性名称 -// 'uses' => 0, // 最大添加数量 -// 'sort' => 10001, -// 'value' => [ -// 'label' => '商品文本', -// 'type' => 'text', // 文本、手机号、身份证号码、邮箱、数字、带小数点数字 -// 'placeholder' => '请输入文本内容', // 提示语 -// 'default' => '', -// 'required' => true // 这个是公共字段 -// ] -// ], -// ] -// ] -]; diff --git a/niucloud/addon/shop/app/dict/diy_form/template.php b/niucloud/addon/shop/app/dict/diy_form/template.php deleted file mode 100644 index f2b833e0c..000000000 --- a/niucloud/addon/shop/app/dict/diy_form/template.php +++ /dev/null @@ -1,437 +0,0 @@ - [ - 'shop_goods_detail_form_data' => [ // 页面标识 - "title" => "商品表单", // 页面名称 - 'cover' => '', // 页面封面图 - 'preview' => '', // 页面预览图 - 'desc' => '', // 页面描述 - // 页面数据源 - "data" => [ - "global" => [ - "title" => "商品表单", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "bgUrl" => "", - "bgHeightScale" => 100, - "imgWidth" => "", - "imgHeight" => "", - "topStatusBar" => [ - 'control' => true, - "isShow" => true, - "bgColor" => "#ffffff", - "style" => "style-1", - "textColor" => "#333333", - "textAlign" => "center", - "rollBgColor" => "#ffffff", - "styleName" => "风格1", - "rollTextColor" => "#333333", - "inputPlaceholder" => "请输入搜索关键词", - "imgUrl" => "", - "link" => [ - "name" => "" - ] - ], - "bottomTabBar" => [ - 'control' => true, - 'isShow' => true, - 'designNav' => [ - 'title' => '', - 'key' => '' - ] - ], - "copyright" => [ - 'control' => true, - 'isShow' => false, - 'textColor' =>'#ccc' - ], - "popWindow" => [ - "imgUrl" => "", - "imgWidth" => "", - "imgHeight" => "", - "count" => 'once', - "show" => 0, - "link" => [ - "name" => "" - ] - ], - "template" => [ - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ], - "isHidden" => false - ], - "completeLayout" => "style-2", - "completeAlign" => "left", - "borderControl" => false, - ], - "value" => [ - [ - "path" => "edit-form-input", - "uses" => 0, - "id" => "4n7ik4t1dsa0", - "componentName" => "FormInput", - "componentTitle" => "单行文本", - "ignore" => [ - "componentBgUrl" - ], - "textColor" => "#303133", - "pageStartBgColor" => "#FFFFFF", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ], - "fontSize" => 14, - "fontWeight" => "normal", - "position" => "", - "componentType" => "diy_form", - "field" => [ - "name" => "姓名", - "remark" => [ - "text" => "", - "color" => "#999999", - "fontSize" => 14 - ], - "required" => false, - "unique" => false, - "autofill" => false, - "privacyProtection" => false, - 'cache' => true, - "default" => "", - "value" => "" - ], - "placeholder" => "请输入姓名", - "componentStartBgColor" => "", - "isHidden" => false - ], - [ - "path" => "edit-form-mobile", - "uses" => 1, - "componentType" => "diy_form", - "id" => "1dufay5r2h7k", - "componentName" => "FormMobile", - "componentTitle" => "手机号", - "ignore" => [ - "componentBgUrl" - ], - "field" => [ - "name" => "联系电话", - "remark" => [ - "text" => "", - "color" => "#999999", - "fontSize" => 14 - ], - "required" => false, - "unique" => true, - "autofill" => false, - "privacyProtection" => false, - 'cache' => true, - "default" => "", - "value" => "" - ], - "placeholder" => "请输入联系电话", - "fontSize" => 14, - "fontWeight" => "normal", - "textColor" => "#303133", - "pageStartBgColor" => "#FFFFFF", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ], - "isHidden" => false - ], - [ - "path" => "edit-form-identity", - "uses" => 1, - "componentType" => "diy_form", - "id" => "46n4aaxy0uc0", - "componentName" => "FormIdentity", - "componentTitle" => "身份证号", - "ignore" => [ - "componentBgUrl" - ], - "field" => [ - "name" => "身份证号", - "remark" => [ - "text" => "", - "color" => "#999999", - "fontSize" => 14 - ], - "required" => false, - "unique" => false, - "autofill" => false, - "privacyProtection" => false, - 'cache' => true, - "default" => "", - "value" => "" - ], - "placeholder" => "请输入身份证号", - "fontSize" => 14, - "fontWeight" => "normal", - "textColor" => "#303133", - "pageStartBgColor" => "#FFFFFF", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ], - "isHidden" => false - ] - ] - ] - ], - ], - 'DIY_FROM_ORDER_PAYMENT' => [ - 'shop_order_form_data' => [ // 页面标识 - "title" => "待付款表单", // 页面名称 - 'cover' => '', // 页面封面图 - 'preview' => '', // 页面预览图 - 'desc' => '', // 页面描述 - // 页面数据源 - "data" => [ - "global" => [ - "title" => "待付款表单", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "bgUrl" => "", - "bgHeightScale" => 100, - "imgWidth" => "", - "imgHeight" => "", - "topStatusBar" => [ - 'control' => true, - "isShow" => true, - "bgColor" => "#ffffff", - "style" => "style-1", - "textColor" => "#333333", - "textAlign" => "center", - "rollBgColor" => "#ffffff", - "styleName" => "风格1", - "rollTextColor" => "#333333", - "inputPlaceholder" => "请输入搜索关键词", - "imgUrl" => "", - "link" => [ - "name" => "" - ] - ], - "bottomTabBar" => [ - 'control' => true, - 'isShow' => true, - 'designNav' => [ - 'title' => '', - 'key' => '' - ] - ], - "copyright" => [ - 'control' => true, - 'isShow' => false, - 'textColor' =>'#ccc' - ], - "popWindow" => [ - "imgUrl" => "", - "imgWidth" => "", - "imgHeight" => "", - "count" => 'once', - "show" => 0, - "link" => [ - "name" => "" - ] - ], - "template" => [ - "textColor" => "#303133", - "pageStartBgColor" => "", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 0, - "bottom" => 0, - "both" => 0 - ], - "isHidden" => false - ], - "completeLayout" => "style-2", - "completeAlign" => "left", - "borderControl" => false - ], - "value" => [ - [ - "path" => "edit-form-mobile", - "uses" => 1, - "id" => "pe5nd1wsn28", - "componentName" => "FormMobile", - "componentTitle" => "手机号", - "ignore" => [ - "componentBgUrl" - ], - "textColor" => "#303133", - "pageStartBgColor" => "#FFFFFF", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 1, - "bottom" => 0, - "both" => 0 - ], - "fontSize" => 14, - "fontWeight" => "normal", - "componentType" => "diy_form", - "field" => [ - "name" => "联系电话", - "remark" => [ - "text" => "", - "color" => "#999999", - "fontSize" => 14 - ], - "required" => false, - "unique" => false, - "autofill" => false, - "privacyProtection" => false, - 'cache' => true, - "default" => "", - "value" => "" - ], - "placeholder" => "请输入联系电话", - "componentStartBgColor" => "", - "isHidden" => false, - "sort" => 10008, - "pageStyle" => "background-color:#FFFFFF;padding-top:2rpx;padding-bottom:0rpx;padding-right:0rpx;padding-left:0rpx;" - ], - [ - "path" => "edit-form-date", - "uses" => 0, - "componentType" => "diy_form", - "id" => "2230h04r8za8", - "componentName" => "FormDate", - "componentTitle" => "日期", - "ignore" => [ - "componentBgUrl" - ], - "field" => [ - "name" => "配送日期", - "remark" => [ - "text" => "", - "color" => "#999999", - "fontSize" => 14 - ], - "required" => false, - "unique" => false, - "autofill" => false, - "privacyProtection" => false, - 'cache' => true, - "default" => [ - "date" => "2025-01-15", - "timestamp" => 1736913088.477 - ], - "value" => [ - "date" => "2025/01/15", - "timestamp" => 1736870400 - ] - ], - "placeholder" => "请选择", - "fontSize" => 14, - "fontWeight" => "normal", - "textColor" => "#303133", - "pageStartBgColor" => "#FFFFFF", - "pageEndBgColor" => "", - "pageGradientAngle" => "to bottom", - "componentBgUrl" => "", - "componentBgAlpha" => 2, - "componentStartBgColor" => "", - "componentEndBgColor" => "", - "componentGradientAngle" => "to bottom", - "topRounded" => 0, - "bottomRounded" => 0, - "elementBgColor" => "", - "topElementRounded" => 0, - "bottomElementRounded" => 0, - "margin" => [ - "top" => 1, - "bottom" => 0, - "both" => 0 - ], - "isHidden" => false, - "convert" => [], - "dateFormat" => "YYYY/MM/DD", - "dateWay" => "current", - "defaultControl" => true, - "pageStyle" => "background-color:#FFFFFF;padding-top:2rpx;padding-bottom:0rpx;padding-right:0rpx;padding-left:0rpx;" - ] - ] - ] - ] - ] -]; diff --git a/niucloud/addon/shop/app/dict/diy_form/type.php b/niucloud/addon/shop/app/dict/diy_form/type.php deleted file mode 100644 index 394ac0255..000000000 --- a/niucloud/addon/shop/app/dict/diy_form/type.php +++ /dev/null @@ -1,16 +0,0 @@ - [ - 'title' => get_lang('dict_diy_form.type_goods_detail'), - 'preview' => 'addon/shop/diy_form/goods_detail_preview.jpg', // 预览图 - 'sort' => 10005, - 'addon'=>'shop' - ], - 'DIY_FROM_ORDER_PAYMENT' => [ - 'title' => get_lang('dict_diy_form.type_order_payment'), - 'preview' => 'addon/shop/diy_form/order_payment_preview.jpg', // 预览图 - 'sort' => 10006, - 'addon'=>'shop' - ], -]; diff --git a/niucloud/addon/shop/app/dict/goods/EvaluateDict.php b/niucloud/addon/shop/app/dict/goods/EvaluateDict.php deleted file mode 100644 index 1e8b3910f..000000000 --- a/niucloud/addon/shop/app/dict/goods/EvaluateDict.php +++ /dev/null @@ -1,39 +0,0 @@ - get_lang('dict_shop_goods_evaluate.audit_no'), // 无需审核 - self::AUDIT => get_lang('dict_shop_goods_evaluate.audit'), // 待审核 - self::AUDIT_ADOPT => get_lang('dict_shop_goods_evaluate.audit_adopt'), // 审核通过 - self::AUDIT_REFUSE => get_lang('dict_shop_goods_evaluate.audit_refuse'), // 审核拒绝 - ]; - if (!$type) { - return $data; - } - return $data[ $type ] ?? ''; - } -} diff --git a/niucloud/addon/shop/app/dict/goods/GoodsDict.php b/niucloud/addon/shop/app/dict/goods/GoodsDict.php deleted file mode 100644 index 4d152f179..000000000 --- a/niucloud/addon/shop/app/dict/goods/GoodsDict.php +++ /dev/null @@ -1,143 +0,0 @@ - [ - 'type' => self::REAL, - 'name' => get_lang('dict_shop_goods.real'), - 'desc' => get_lang('dict_shop_goods.real_desc'), - 'path' => '/shop/goods/real_edit', - ], - self::VIRTUAL => [ - 'type' => self::VIRTUAL, - 'name' => get_lang('dict_shop_goods.virtual'), - 'desc' => get_lang('dict_shop_goods.virtual_desc'), - 'path' => '/shop/goods/virtual_edit', - ] - ]; - if ($type == '') return $list; - return $list[ $type ]; - } - - /** - * 批量设置 - * @param $type - * @return array|mixed|string - */ - public static function getBatchSetDict($type = '') - { - $data = [ - self::LABEL => get_lang('dict_shop_goods_batch_set.label'), - self::SERVICE => get_lang('dict_shop_goods_batch_set.service'), - self::VIRTUAL_SALE_NUM => get_lang('dict_shop_goods_batch_set.virtual_sale_num'), - self::CATEGORY => get_lang('dict_shop_goods_batch_set.category'), - self::BRAND => get_lang('dict_shop_goods_batch_set.brand'), - self::POSTER => get_lang('dict_shop_goods_batch_set.poster'), - self::GIFT => get_lang('dict_shop_goods_batch_set.gift'), - self::DELIVERY => get_lang('dict_shop_goods_batch_set.delivery'), - self::STOCK => get_lang('dict_shop_goods_batch_set.stock'), - self::MEMBER_DISCOUNT => get_lang('dict_shop_goods_batch_set.member_discount'), - self::DIY_FORM => get_lang('dict_shop_goods_batch_set.diy_form'), - self::DIY_DETAIL => get_lang('dict_shop_goods_batch_set.diy_detail'), - ]; - if (!$type) { - return $data; - } - return $data[ $type ] ?? ''; - } - - /** - * 商品排序展示配置 - * @param $sort_type - * @return array|mixed|string - */ - public static function getSortTypeConfig($sort_type = '') - { - $data = [ - self::SORT_TYPE_ASC => get_lang('dict_shop_goods_sort_config.asc'), - self::SORT_TYPE_DESC => get_lang('dict_shop_goods_sort_config.desc'), - ]; - if (!$sort_type) { - return $data; - } - return $data[ $sort_type ] ?? ''; - } - /** - * 商品排序展示配置 - * @param $sort_type - * @return array|mixed|string - */ - public static function getSortColumnConfig($sort_type = '') - { - $data = [ - self::SORT_COLUMN_SORT => get_lang('dict_shop_goods_sort_config.sort'), - self::SORT_COLUMN_PRICE => get_lang('dict_shop_goods_sort_config.price'), - self::SORT_COLUMN_SALE_NUM => get_lang('dict_shop_goods_sort_config.sale_num'), - self::SORT_COLUMN_CREATE_TIME => get_lang('dict_shop_goods_sort_config.create_time'), - ]; - if (!$sort_type) { - return $data; - } - return $data[ $sort_type ] ?? ''; - } -} diff --git a/niucloud/addon/shop/app/dict/goods/LabelDict.php b/niucloud/addon/shop/app/dict/goods/LabelDict.php deleted file mode 100644 index 6b112aa64..000000000 --- a/niucloud/addon/shop/app/dict/goods/LabelDict.php +++ /dev/null @@ -1,20 +0,0 @@ - get_lang('dict_shop_goods_rank_rank_type.day'), // 天 - self::WEEK => get_lang('dict_shop_goods_rank_rank_type.week'), // 周 - self::MONTH => get_lang('dict_shop_goods_rank_rank_type.month'), // 月 - self::QUARTER => get_lang('dict_shop_goods_rank_rank_type.quarter'), // 季度 - ]; - if (!$type) { - return $data; - } - return $data[ $type ] ?? ''; - } - - /** - * 来源类型 - * @param $type - * @return array|mixed|string - */ - public static function getGoodsSource($type = '') - { - $data = [ - self::ALL => get_lang('dict_shop_goods_rank_goods_source.all'), // 全部 - self::GOODS => get_lang('dict_shop_goods_rank_goods_source.goods'), // 指定商品 - self::CATEGORY => get_lang('dict_shop_goods_rank_goods_source.category'), // 指定分类 - self::BRAND => get_lang('dict_shop_goods_rank_goods_source.brand'), // 指定品牌 - self::LABEL => get_lang('dict_shop_goods_rank_goods_source.label'), // 指定标签 - ]; - if (!$type) { - return $data; - } - return $data[ $type ] ?? ''; - } - - /** - * 排序规则 - * @param $type - * @return array|mixed|string - */ - public static function getRuleType($type = '') - { - $data = [ - self::SALE => get_lang('dict_shop_goods_rank_rule_type.sale'), // 按销量 - self::COLLECT => get_lang('dict_shop_goods_rank_rule_type.collect'), // 按收藏数 - self::EVALUATE => get_lang('dict_shop_goods_rank_rule_type.evaluate'), // 按评价数 - self::ACCESS => get_lang('dict_shop_goods_rank_rule_type.access'), // 按浏览量 - ]; - if (!$type) { - return $data; - } - return $data[ $type ] ?? ''; - } -} diff --git a/niucloud/addon/shop/app/dict/goods/StatisticsDict.php b/niucloud/addon/shop/app/dict/goods/StatisticsDict.php deleted file mode 100644 index c51726865..000000000 --- a/niucloud/addon/shop/app/dict/goods/StatisticsDict.php +++ /dev/null @@ -1,48 +0,0 @@ -加入购物车数量 sale_num=商品销量(下单数)pay_num=支付件数 collect_num=收藏数量 pay_money=支付总金额 - const ACCESS_NUM = 'access_num'; - const CART_NUM = 'cart_num'; - const SALE_NUM = 'sale_num'; - const PAY_NUM = 'pay_num'; - const COLLECT_NUM = 'collect_num'; - const PAY_MONEY = 'pay_money'; - const GOODS_VISIT_MEMBER_COUNT = 'goods_visit_member_count'; - - /** - * 排行周期 - * @param $type - * @return array|mixed|string - */ - public static function getType($type = '') - { - $data = [ - self::ACCESS_NUM => get_lang('dict_shop_goods_statistics_type.access_num'), // 访问次数(浏览量) - self::GOODS_VISIT_MEMBER_COUNT => get_lang('dict_shop_goods_statistics_type.goods_visit_member_count'), // 访客数 - self::CART_NUM => get_lang('dict_shop_goods_statistics_type.cart_num'), // 加入购物车数量 - self::SALE_NUM => get_lang('dict_shop_goods_statistics_type.sale_num'), // 商品销量(下单数) - self::PAY_NUM => get_lang('dict_shop_goods_statistics_type.pay_num'), // 支付件数 - self::PAY_MONEY => get_lang('dict_shop_goods_statistics_type.pay_money'), // 支付总金额 - self::COLLECT_NUM => get_lang('dict_shop_goods_statistics_type.collect_num'), // 收藏数量 - ]; - if (!$type) { - return $data; - } - return $data[ $type ] ?? ''; - } - -} diff --git a/niucloud/addon/shop/app/dict/local_delivery/LocalDeliveryDict.php b/niucloud/addon/shop/app/dict/local_delivery/LocalDeliveryDict.php deleted file mode 100644 index a82f76077..000000000 --- a/niucloud/addon/shop/app/dict/local_delivery/LocalDeliveryDict.php +++ /dev/null @@ -1,56 +0,0 @@ - [ - 'name' => '商家配送', - 'key' => self::MERCHANT, - //配置参数 - 'params' => [], - 'component' => '', - 'business_list' => '', - 'extend_data' => [], - //商家配送标识 - 'is_merchant' => 1 - ], - ]; - - $extend = event('LocalDeliveryType'); - $type_list = array_merge($list, ...$extend); - if ($type == '') return $type_list; - return $type_list[$type]['name'] ?? ''; - } - - - //门店开通状态 - const OPEN_PASS = 1;//通过 - const OPEN_REFUND = 2;//未通过 - - //门店编辑状态 - const EDIT_PASS = 1;//编辑审核通过 - const EDIT_REFUND = 2;//编辑审核驳回 - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/dict/local_delivery/LocalDeliveryPreStatusDict.php b/niucloud/addon/shop/app/dict/local_delivery/LocalDeliveryPreStatusDict.php deleted file mode 100644 index 46dd5bccc..000000000 --- a/niucloud/addon/shop/app/dict/local_delivery/LocalDeliveryPreStatusDict.php +++ /dev/null @@ -1,30 +0,0 @@ - $service])); - return array_merge($list, ...$extend); - } - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/dict/local_delivery/LocalDeliveryStatusDict.php b/niucloud/addon/shop/app/dict/local_delivery/LocalDeliveryStatusDict.php deleted file mode 100644 index fc70ac803..000000000 --- a/niucloud/addon/shop/app/dict/local_delivery/LocalDeliveryStatusDict.php +++ /dev/null @@ -1,63 +0,0 @@ - get_lang('dict_shop_local_delivery_status.wait_release'), //预约待发布, - self::ORDER_ACCEPTED => get_lang('dict_shop_local_delivery_status.order_accepted'), //商家已接单, - self::PENDING_ACCEPTANCE => get_lang('dict_shop_local_delivery_status.pending_acceptance'), //待接单, - self::PENDING_PICKUP => get_lang('dict_shop_local_delivery_status.pending_pickup'), //待取货, - self::RIDER_ARRIVED => get_lang('dict_shop_local_delivery_status.rider_arrived'), //骑士到店, - self::IN_DELIVERY => get_lang('dict_shop_local_delivery_status.in_delivery'), //配送中, - self::COMPLETED => get_lang('dict_shop_local_delivery_status.completed'), //已完成, - self::DISPATCH_ORDER => get_lang('dict_shop_local_delivery_status.dispatch_order'), //指派单, - self::RETURN_IN_PROGRESS => get_lang('dict_shop_local_delivery_status.return_in_progress'), //妥投异常之物品返回中, - self::RETURN_COMPLETED => get_lang('dict_shop_local_delivery_status.return_completed'), //妥投异常之物品返回完成, - self::RETURN_RIDER_ARRIVED => get_lang('dict_shop_local_delivery_status.return_rider_arrived'), //售后取件单送达门店, - self::CREATE_ORDER_FAILED => get_lang('dict_shop_local_delivery_status.create_order_failed'), //创建运单失败, - self::CANCELED => get_lang('dict_shop_local_delivery_status.canceled'), //已取消, - ]; - if ($status == '' && $status !== 0) { - return $data; - } - return $data[$status] ?? ''; - } - -} diff --git a/niucloud/addon/shop/app/dict/local_delivery/OrderCancelReasonDict.php b/niucloud/addon/shop/app/dict/local_delivery/OrderCancelReasonDict.php deleted file mode 100644 index a25b4bb13..000000000 --- a/niucloud/addon/shop/app/dict/local_delivery/OrderCancelReasonDict.php +++ /dev/null @@ -1,33 +0,0 @@ - $service]))[0]; - if ($type == '') { - return $data; - } - return $data[$type] ?? ''; - } - -} diff --git a/niucloud/addon/shop/app/dict/local_delivery/OrderLogDict.php b/niucloud/addon/shop/app/dict/local_delivery/OrderLogDict.php deleted file mode 100644 index 1fdf72f69..000000000 --- a/niucloud/addon/shop/app/dict/local_delivery/OrderLogDict.php +++ /dev/null @@ -1,121 +0,0 @@ - get_lang('dict_shop_local_delivery_order_log.store'),//商家 - self::RIDER => get_lang('dict_shop_local_delivery_order_log.rider'),//骑手 - self::MEMBER => get_lang('dict_shop_local_delivery_order_log.member'),//会员 - self::SYSTEM => get_lang('dict_shop_local_delivery_order_log.system'),//系统 - ]; - if (!$type) { - return $data; - } - return $data[$type] ?? ''; - } - - const ORDER_ACCEPTED = 'order_accepted';//商家已接单 - const ORDER_CALL = 'order_call';//商家呼叫配送 - const DISPATCH_ORDER = 'dispatch_order';//商家指派骑手 - const RIDER_ACCEPTED = 'rider_accepted';//骑手已接单 - const RIDER_ARRIVED = 'rider_arrived';//骑手已到店 - const RIDER_PICKED_UP = 'rider_picked_up';//骑手已取货 - const ORDER_DELIVERED = 'order_delivered';//订单已送达 - const ORDER_CANCELED = 'order_canceled';//订单已取消 - const RETURN_APPLIED = 'return_applied';//物品返回申请 - const RETURN_COMPLETED = 'return_completed';//物品返回完成 - - /** - * 获取操作 - * @return array - */ - public static function getOperate($status) - { - switch ($status) { - case LocalDeliveryStatusDict::ORDER_ACCEPTED: - return [ - 'operate' => self::ORDER_ACCEPTED, - 'operate_desc' => get_lang('dict_shop_local_delivery_order_log.order_accepted') - ];// 商家已接单 - case LocalDeliveryStatusDict::PENDING_ACCEPTANCE: - return [ - 'operate' => self::ORDER_CALL, - 'operate_desc' => get_lang('dict_shop_local_delivery_order_log.order_call') - ];// 商家呼叫配送 - case LocalDeliveryStatusDict::DISPATCH_ORDER: - return [ - 'operate' => self::DISPATCH_ORDER, - 'operate_desc' => get_lang('dict_shop_local_delivery_order_log.dispatch_order') - ];// 商家指派骑手 - case LocalDeliveryStatusDict::PENDING_PICKUP: - return [ - 'operate' => self::RIDER_ACCEPTED, - 'operate_desc' => get_lang('dict_shop_local_delivery_order_log.rider_accepted') - ];// 骑手已接单 - case LocalDeliveryStatusDict::RIDER_ARRIVED: - return [ - 'operate' => self::RIDER_ARRIVED, - 'operate_desc' => get_lang('dict_shop_local_delivery_order_log.rider_arrived') - ];// 骑手已到店 - case LocalDeliveryStatusDict::IN_DELIVERY: - return [ - 'operate' => self::RIDER_PICKED_UP, - 'operate_desc' => get_lang('dict_shop_local_delivery_order_log.rider_picked_up') - ];// 骑手已取货 - case LocalDeliveryStatusDict::COMPLETED: - return [ - 'operate' => self::ORDER_DELIVERED, - 'operate_desc' => get_lang('dict_shop_local_delivery_order_log.order_delivered') - ];// 订单已送达 - case LocalDeliveryStatusDict::CANCELED: - return [ - 'operate' => self::ORDER_CANCELED, - 'operate_desc' => get_lang('dict_shop_local_delivery_order_log.order_canceled') - ];// 订单已取消 - case LocalDeliveryStatusDict::RETURN_IN_PROGRESS: - return [ - 'operate' => self::RETURN_APPLIED, - 'operate_desc' => get_lang('dict_shop_local_delivery_order_log.return_applied') - ];// 物品返回申请 - case LocalDeliveryStatusDict::RETURN_COMPLETED: - return [ - 'operate' => self::RETURN_COMPLETED, - 'operate_desc' => get_lang('dict_shop_local_delivery_order_log.return_completed') - ];// 物品返回完成 - } - return [ - 'operate' => '', - 'operate_desc' => '' - ]; - } - -} diff --git a/niucloud/addon/shop/app/dict/local_delivery/dada/DadaDeliveryStatusDict.php b/niucloud/addon/shop/app/dict/local_delivery/dada/DadaDeliveryStatusDict.php deleted file mode 100644 index a1a938e52..000000000 --- a/niucloud/addon/shop/app/dict/local_delivery/dada/DadaDeliveryStatusDict.php +++ /dev/null @@ -1,72 +0,0 @@ - [ - //兑换订单 - 'account_point_exchange_close' => [ - //名称 - 'name' => get_lang('dict_member.account_point_exchange_close'), - //是否增加 - 'inc' => 0, - //是否减少 - 'dec' => 1, - ], - //兑换订单关闭 - 'account_point_exchange_order' => [ - //名称 - 'name' => get_lang('dict_member.account_point_exchange_order'), - //是否增加 - 'inc' => 1, - //是否减少 - 'dec' => 0, - ], - //兑换订单售后 - 'account_point_exchange_refund' => [ - //名称 - 'name' => get_lang('dict_member.account_point_exchange_refund'), - //是否增加 - 'inc' => 1, - //是否减少 - 'dec' => 0, - ], - //消费奖励 - 'consume_reward' => [ - //名称 - 'name' => get_lang('dict_member.account_point_consume_reward'), - //是否增加 - 'inc' => 1, - //是否减少 - 'dec' => 0, - ], - //满减送活动赠品发放 - 'manjian_gift_give' => [ - //名称 - 'name' => get_lang('dict_member.account_point_manjian_gift_give'), - //是否增加 - 'inc' => 1, - //是否减少 - 'dec' => 0, - ], - //满减送活动赠品退还 - 'manjian_gift_back' => [ - //名称 - 'name' => get_lang('dict_member.account_point_manjian_gift_back'), - //是否增加 - 'inc' => 0, - //是否减少 - 'dec' => 1, - ], - //会员充值赠品发放 - 'recharge' => [ - //名称 - 'name' => get_lang('dict_member.recharge_point_give'), - //是否增加 - 'inc' => 1, - //是否减少 - 'dec' => 0, - //是否累增 - 'is_change_get' => 1, - ], - //种草奖励发放 - 'sow_community' => [ - //名称 - 'name' => get_lang('dict_member.account_point_sow_community_settle_reward'), - //是否增加 - 'inc' => 1, - //是否减少 - 'dec' => 0, - //是否累增 - 'is_change_get' => 1, - ] - ], - MemberAccountTypeDict::BALANCE => [ - //满减送活动赠品发放 - 'manjian_gift_give' => [ - //名称 - 'name' => get_lang('dict_member.account_balance_manjian_gift_give'), - //是否增加 - 'inc' => 1, - //是否减少 - 'dec' => 0, - ], - //满减送活动赠品退还 - 'manjian_gift_back' => [ - //名称 - 'name' => get_lang('dict_member.account_balance_manjian_gift_back'), - //是否增加 - 'inc' => 0, - //是否减少 - 'dec' => 1, - ], - //种草奖励发放 - 'sow_community' => [ - //名称 - 'name' => get_lang('dict_member.account_balance_sow_community_settle_reward'), - //是否增加 - 'inc' => 1, - //是否减少 - 'dec' => 0, - //是否累增 - 'is_change_get' => 1, - ] - ], - //成长值 - MemberAccountTypeDict::GROWTH => [ - 'shop_buy_goods' => [ - //名称 - 'name' => '购买产品', - //是否增加 - 'inc' => 1, - //是否减少 - 'dec' => 0, - ], - 'shop_buy_order' => [ - //名称 - 'name' => '完成下单', - //是否增加 - 'inc' => 1, - //是否减少 - 'dec' => 0, - ], - ] -]; diff --git a/niucloud/addon/shop/app/dict/member/benefits.php b/niucloud/addon/shop/app/dict/member/benefits.php deleted file mode 100644 index b48a429f6..000000000 --- a/niucloud/addon/shop/app/dict/member/benefits.php +++ /dev/null @@ -1,22 +0,0 @@ - [ - 'key' => 'shop_free_shipping', - 'name' => '包邮', // 权益名称 - 'desc' => '商品购买时可享受免邮服务', // 权益说明 - 'component' => '/src/addon/shop/views/member/components/benefits-free-shipping.vue', - "content" => [ - 'admin' => function($config) { - return '下单享受包邮'; - }, - 'member_level' => function($config) { - return [ - 'title' => '商品包邮', - 'desc' => '下单免运费', - 'icon' => '/static/resource/images/member/benefits/benefits_pinkage.png' - ]; - } - ] - ] -]; diff --git a/niucloud/addon/shop/app/dict/member/gift.php b/niucloud/addon/shop/app/dict/member/gift.php deleted file mode 100644 index 0dc7103e1..000000000 --- a/niucloud/addon/shop/app/dict/member/gift.php +++ /dev/null @@ -1,91 +0,0 @@ - [ - 'key' => 'shop_coupon', - 'name' => '优惠券', // 礼包名称 - 'desc' => '发放优惠券', // 礼包说明 - 'component' => '/src/addon/shop/views/member/components/gift-coupon.vue', - // 礼包发放调用方法 - 'grant' => function ($member_id, $config) { - if (!empty($config[ 'coupon_id' ])) { - $service = new \addon\shop\app\service\core\coupon\CoreCouponMemberService(); - foreach ($config[ 'coupon_id' ] as $coupon_id) { - if (!isset($config[ 'coupon_list' ][ 'id_' . $coupon_id ])) continue; - $service->sendCoupon($member_id, $coupon_id, $config[ 'coupon_list' ][ 'id_' . $coupon_id ]); - } - } - }, - "content" => [ - // 管理端 - 'admin' => function ($config) { - if (empty($config[ 'coupon_id' ])) { - return ''; - } - $content = []; - $model = ( new addon\shop\app\model\coupon\Coupon() ); - $coupon_list = $model->where([ [ 'id', 'in', $config[ 'coupon_id' ] ] ])->field('id,title')->select()->toArray(); - if (!empty($coupon_list)) { - foreach ($coupon_list as $item) { - $content[] = $item[ 'title' ] . '*' . $config[ 'coupon_list' ][ 'id_' . $item[ 'id' ] ]; - } - } - return implode(',', $content); - }, - // 会员等级 - 'member_level' => function ($config) { - if (empty($config[ 'coupon_id' ])) { - return ''; - } - $content = []; - $model = ( new addon\shop\app\model\coupon\Coupon() ); - $coupon_list = $model->where([ [ 'id', 'in', $config[ 'coupon_id' ] ] ])->field('id,price')->select()->toArray(); - if (!empty($coupon_list)) { - foreach ($coupon_list as $item) { - $content[] = [ - 'text' => round($item[ 'price' ]) . "元优惠券", - 'background' => '/addon/shop/gift/gift_coupon_bg.png' - ]; - } - } - return $content; - }, - // 会员签到(日签) - 'member_sign' => function ($config) { - if (empty($config[ 'coupon_id' ])) { - return []; - } - $content = []; - $model = ( new addon\shop\app\model\coupon\Coupon() ); - $coupon_list = $model->where([ [ 'id', 'in', $config[ 'coupon_id' ] ] ])->field('id,price')->select()->toArray(); - if (!empty($coupon_list)) { - foreach ($coupon_list as $item) { - $content[] = [ - 'text' => round($item[ 'price' ]) . "元优惠券", - 'icon' => '/addon/shop/sign/coupon.png' - ]; - } - } - return $content; - }, - // 会员签到(连签) - 'member_sign_continue' => function ($config) { - if (empty($config[ 'coupon_id' ])) { - return []; - } - $content = []; - $model = ( new addon\shop\app\model\coupon\Coupon() ); - $coupon_list = $model->where([ [ 'id', 'in', $config[ 'coupon_id' ] ] ])->field('id,price')->select()->toArray(); - if (!empty($coupon_list)) { - foreach ($coupon_list as $item) { - $content[] = [ - 'text' => round($item[ 'price' ]) . "元优惠券", - 'icon' => '/addon/shop/sign/coupon01.png' - ]; - } - } - return $content; - } - ] - ] -]; diff --git a/niucloud/addon/shop/app/dict/member/growth_rule.php b/niucloud/addon/shop/app/dict/member/growth_rule.php deleted file mode 100644 index 5f1c27dc8..000000000 --- a/niucloud/addon/shop/app/dict/member/growth_rule.php +++ /dev/null @@ -1,57 +0,0 @@ - [ - 'key' => 'shop_buy_goods', - 'name' => '购买商品', - 'desc' => '订单交易成功后按订单交易金额发放成长值', - 'component' => '/src/addon/shop/views/member/components/growth-rule-buygoods.vue', - 'calculate' => function (array $config, array $data) { - $order_money = (float)($data['order_money'] ?? 0); - if ($order_money <= 0) return 0; - $growth = ((float)$config['money'] * (float)$config['growth']); - if ($growth <= 0) return 0; - return (int) round($order_money / $config[ 'money' ] * $config[ 'growth' ]); - - }, - 'content' => [ - 'admin' => function ($config) { - return "购买商品可获得{$config['growth']}成长值/{$config['money']}元"; - }, - 'task' => function ($config) { - return [ - 'icon' => '/addon/shop/rule/growth-rule-cart.png', - 'title' => '购买商品', - 'desc' => "购买商品可获得{$config['growth']}成长值/{$config['money']}元", - 'button' => [ - 'text' => '去购买', - 'wap_redirect' => '/addon/shop/pages/index' - ] - ]; - } - ] - ], - 'shop_buy_order' => [ - 'key' => 'shop_buy_order', - 'name' => '完成下单', - 'desc' => '订单交易成功后发放成长值', - 'component' => '/src/addon/shop/views/member/components/growth-rule-buyorder.vue', - 'calculate' => '', // 计算成长值 可以是匿名函数 也可以是类 - 'content' => [ - 'admin' => function ($config) { - return "订单交易成功后可获得{$config['growth']}成长值/单"; - }, - 'task' => function ($config) { - return [ - 'icon' => '/addon/shop/rule/growth-rule-buy.png', - 'title' => '完成下单', - 'desc' => "订单交易成功后可获得{$config['growth']}成长值/单", - 'button' => [ - 'text' => '去下单', - 'wap_redirect' => '/addon/shop/pages/index' - ] - ]; - } - ] - ], -]; diff --git a/niucloud/addon/shop/app/dict/member/point_rule.php b/niucloud/addon/shop/app/dict/member/point_rule.php deleted file mode 100644 index 2820d3e64..000000000 --- a/niucloud/addon/shop/app/dict/member/point_rule.php +++ /dev/null @@ -1,48 +0,0 @@ - [ - 'shop_buy_goods' => [ - 'key' => 'shop_buy_goods', - 'name' => '购买商品', - 'desc' => '订单交易成功后按订单交易金额发放积分', - 'component' => '/src/addon/shop/views/member/components/point-rule-buygoods.vue', - 'calculate' => function (array $config, array $data) { - $order_money = (float)($data['order_money'] ?? 0); - if ($order_money <= 0) return 0; - $point = ((float)$config['money'] * (float)$config['point']); - if ($point <= 0) return 0; - return (int) round($order_money / $config[ 'money' ] * $config[ 'point' ]); - }, - 'content' => [ - 'admin' => function ($config) { - return "购买商品可获得{$config['point']}积分/{$config['money']}元"; - }, - 'task' => function ($config) { - return [ - 'icon' => '/addon/shop/rule/growth-rule-cart.png', - 'title' => '购买商品', - 'desc' => "每消费{$config['money']}元,可获得{$config['point']}积分", - 'button' => [ - 'text' => '去购买', - 'wap_redirect' => '/addon/shop/pages/index' - ] - ]; - } - ] - ], - ], - 'consume' => [ -// 'shop_order_deduction' => [ -// 'key' => 'shop_order_deduction', -// 'name' => '积分抵现', -// 'desc' => '订单交易时积分可抵部分现金', -// 'component' => '/src/addon/shop/views/member/components/point-rule-orderdeduction.vue', -// 'content' => [ -// 'admin' => function($config) { -// return "订单交易时{$config['point']}积分可抵{$config['money']}元"; -// } -// ] -// ] - ] -]; diff --git a/niucloud/addon/shop/app/dict/menu/admin.php b/niucloud/addon/shop/app/dict/menu/admin.php deleted file mode 100644 index c00909eca..000000000 --- a/niucloud/addon/shop/app/dict/menu/admin.php +++ /dev/null @@ -1,2545 +0,0 @@ - '商城系统', - 'menu_key' => 'shop', - 'menu_short_name' => '商城', - 'parent_key' => '', - 'menu_type' => '0', - 'icon' => 'iconfont iconshangchengshequ', - 'api_url' => '', - 'router_path' => 'shop/index', - 'view_path' => '', - 'methods' => '', - 'sort' => '110', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '概况', - 'menu_key' => 'shop_index', - 'menu_short_name' => '概况', - 'menu_type' => '1', - 'icon' => 'iconfont icongaikuang1', - 'api_url' => 'shop/index', - 'router_path' => 'shop/index', - 'view_path' => 'index/index', - 'methods' => 'get', - 'sort' => '100', - 'status' => '1', - 'is_show' => '1', - ], - [ - 'menu_name' => '商品管理', - 'menu_key' => 'shop_goods', - 'menu_short_name' => '商品', - 'menu_type' => '0', - 'icon' => 'iconfont iconshangpinguanli1', - 'api_url' => '', - 'router_path' => 'shop/goods/list', - 'view_path' => '', - 'methods' => 'get', - 'sort' => '95', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '商品列表', - 'menu_key' => 'shop_goods_list', - 'menu_short_name' => '商品列表', - 'menu_type' => '1', - 'icon' => 'iconfont iconshangpinliebiao1', - 'api_url' => 'shop/goods', - 'router_path' => 'shop/goods/list', - 'view_path' => 'goods/list', - 'methods' => 'get', - 'sort' => '100', - 'status' => '1', - 'is_show' => '1', - ], - [ - 'menu_name' => '商品分类', - 'menu_key' => 'shop_goods_category_list', - 'menu_short_name' => '商品分类', - 'menu_type' => '1', - 'icon' => 'iconfont iconshangpinfenlei', - 'api_url' => 'shop/goods/category', - 'router_path' => 'shop/goods/category', - 'view_path' => 'goods/category', - 'methods' => 'get', - 'sort' => '99', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '商品分类添加', - 'menu_key' => 'shop_goods_category_add', - 'menu_short_name' => '商品分类添加', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/category', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品分类编辑', - 'menu_key' => 'shop_goods_category_edit', - 'menu_short_name' => '商品分类编辑', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/category/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品分类删除', - 'menu_key' => 'shop_goods_category_delete', - 'menu_short_name' => '商品分类删除', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/category/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品分类拖拽排序', - 'menu_key' => 'shop_goods_category_sort', - 'menu_short_name' => '商品分类拖拽排序', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/category/update', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '分类设置', - 'menu_key' => 'shop_goods_category_config', - 'menu_short_name' => '分类设置', - 'menu_type' => '1', - 'icon' => 'iconfont iconfenleishezhi', - 'api_url' => '', - 'router_path' => 'shop/goods/category/config', - 'view_path' => 'goods/category_config', - 'methods' => '', - 'sort' => '88', - 'status' => '1', - 'is_show' => '0', - 'children' => [ - [ - 'menu_name' => '分类设置编辑', - 'menu_key' => 'shop_goods_category_config_set', - 'menu_short_name' => '分类设置编辑', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/category/config', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '商品标签分组', - 'menu_key' => 'shop_goods_label_group_list', - 'menu_short_name' => '商品标签分组', - 'menu_type' => '1', - 'icon' => 'iconfont iconshangpinbiaoqian', - 'api_url' => 'shop/goods/label/group', - 'router_path' => 'shop/goods/label/group', - 'view_path' => 'goods/label_group_list', - 'methods' => 'get', - 'sort' => '88', - 'status' => '1', - 'is_show' => '0', - 'children' => [ - [ - 'menu_name' => '商品标签分组添加', - 'menu_key' => 'shop_goods_label_group_add', - 'menu_short_name' => '商品标签分组添加', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/label/group', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品标签分组编辑', - 'menu_key' => 'shop_goods_label_group_edit', - 'menu_short_name' => '商品标签分组编辑', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/label/group/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品标签分组删除', - 'menu_key' => 'shop_goods_label_group_delete', - 'menu_short_name' => '商品标签分组删除', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/label/group/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '商品标签', - 'menu_key' => 'shop_goods_label_list', - 'menu_short_name' => '商品标签', - 'menu_type' => '1', - 'icon' => 'iconfont iconshangpinbiaoqian', - 'api_url' => 'shop/goods/label', - 'router_path' => 'shop/goods/label', - 'view_path' => 'goods/label_list', - 'methods' => 'get', - 'sort' => '98', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '商品标签添加', - 'menu_key' => 'shop_goods_label_add', - 'menu_short_name' => '商品标签添加', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/label', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品标签编辑', - 'menu_key' => 'shop_goods_label_edit', - 'menu_short_name' => '商品标签编辑', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/label/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品标签删除', - 'menu_key' => 'shop_goods_label_delete', - 'menu_short_name' => '商品标签删除', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/label/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品标签复制', - 'menu_key' => 'shop_goods_label_copy', - 'menu_short_name' => '商品标签复制', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/label/copy/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '商品品牌', - 'menu_key' => 'shop_goods_brand_list', - 'menu_short_name' => '商品品牌', - 'menu_type' => '1', - 'icon' => 'iconfont iconshangpinpinpai', - 'api_url' => 'shop/goods/brand', - 'router_path' => 'shop/goods/brand', - 'view_path' => 'goods/brand_list', - 'methods' => 'get', - 'sort' => '97', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '商品品牌添加', - 'menu_key' => 'shop_goods_brand_add', - 'menu_short_name' => '商品品牌添加', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/brand', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品品牌编辑', - 'menu_key' => 'shop_goods_brand_edit', - 'menu_short_name' => '商品品牌编辑', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/brand/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品品牌删除', - 'menu_key' => 'shop_goods_brand_delete', - 'menu_short_name' => '商品品牌删除', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/brand/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '商品服务', - 'menu_key' => 'shop_goods_service_list', - 'menu_short_name' => '商品服务', - 'menu_type' => '1', - 'icon' => 'iconfont iconshangpinfuwu', - 'api_url' => 'shop/goods/service', - 'router_path' => 'shop/goods/service', - 'view_path' => 'goods/service', - 'methods' => 'get', - 'sort' => '96', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '商品服务添加', - 'menu_key' => 'shop_goods_service_add', - 'menu_short_name' => '商品服务添加', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/service', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品服务编辑', - 'menu_key' => 'shop_goods_service_edit', - 'menu_short_name' => '商品服务编辑', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/service/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品服务删除', - 'menu_key' => 'shop_goods_service_delete', - 'menu_short_name' => '商品服务删除', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/service/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '参数模板', - 'menu_key' => 'shop_goods_attr_list', - 'menu_short_name' => '参数模板', - 'menu_type' => '1', - 'icon' => 'iconfont iconshangpinfuwu', - 'api_url' => 'shop/goods/attr', - 'router_path' => 'shop/goods/attr', - 'view_path' => 'goods/attr', - 'methods' => 'get', - 'sort' => '95', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '修改参数模板排序号', - 'menu_key' => 'shop_goods_attr_sort_edit', - 'menu_short_name' => '修改参数模板排序号', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/attr/sort', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '修改参数模板名称', - 'menu_key' => 'shop_goods_attr_name_edit', - 'menu_short_name' => '修改参数模板名称', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/attr/attr_name', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '修改参数模板值', - 'menu_key' => 'shop_goods_attr_value_edit', - 'menu_short_name' => '修改参数模板值', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/attr/attr_value', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '商品统计', - 'menu_key' => 'shop_stat_goods', - 'menu_short_name' => '商品统计', - 'menu_type' => '1', - 'icon' => 'iconfont icona-dingdanliebiao', - 'api_url' => 'stat/goods', - 'router_path' => 'shop/stat/goods', - 'view_path' => 'stat/goods', - 'methods' => 'get', - 'sort' => '94', - 'status' => '1', - 'is_show' => '1', - ], - [ - 'menu_name' => '商品设置', - 'menu_key' => 'shop_goods_search_config', - 'menu_short_name' => '搜索设置', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/goods/config/search', - 'router_path' => 'shop/goods/search_config', - 'view_path' => 'goods/search_config', - 'methods' => 'post', - 'sort' => '93', - 'status' => '1', - 'is_show' => '1', - ], - [ - 'menu_name' => '编码唯一性设置', - 'menu_key' => 'shop_goods_unique_config', - 'menu_short_name' => '编码唯一性设置', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/goods/config/unique', - 'router_path' => 'shop/goods/unique_config', - 'view_path' => 'goods/unique_config', - 'methods' => 'post', - 'sort' => '93', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品排序设置', - 'menu_key' => 'shop_goods_sort_config', - 'menu_short_name' => '排序设置', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/goods/config/sort', - 'router_path' => 'shop/goods/sort_config', - 'view_path' => 'goods/sort_config', - 'methods' => 'post', - 'sort' => '93', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '回收站', - 'menu_key' => 'shop_goods_recycle_list', - 'menu_short_name' => '回收站', - 'menu_type' => '1', - 'icon' => 'iconfont iconhuishouzhan', - 'api_url' => 'shop/goods/recycle', - 'router_path' => 'shop/goods/recycle', - 'view_path' => 'goods/recycle', - 'methods' => 'get', - 'sort' => '92', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '商品恢复', - 'menu_key' => 'shop_goods_recycle', - 'menu_short_name' => '商品恢复', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/recycle', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '商品添加', - 'menu_key' => 'shop_goods_virtual_add', - 'menu_short_name' => '商品添加', - 'parent_select_key' => 'shop_goods_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/goods/virtual', - 'router_path' => 'shop/goods/virtual_add', - 'view_path' => 'goods/virtual_edit', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品编辑', - 'menu_key' => 'shop_goods_virtual_edit', - 'menu_short_name' => '商品编辑', - 'parent_select_key' => 'shop_goods_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/goods/virtual/', - 'router_path' => 'shop/goods/virtual_edit', - 'view_path' => 'goods/virtual_edit', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品删除', - 'menu_key' => 'shop_goods_delete', - 'menu_short_name' => '商品删除', - 'parent_select_key' => 'shop_goods_list', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/delete', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品排序号修改', - 'menu_key' => 'shop_goods_sort_edit', - 'menu_short_name' => '商品排序号修改', - 'parent_select_key' => 'shop_goods_list', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/sort', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品上下架状态修改', - 'menu_key' => 'shop_goods_status_edit', - 'menu_short_name' => '商品上下架状态修改', - 'parent_select_key' => 'shop_goods_list', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/status', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品复制', - 'menu_key' => 'shop_goods_copy', - 'menu_short_name' => '商品复制', - 'parent_select_key' => 'shop_goods_list', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/copy/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品规格列表库存编辑', - 'menu_key' => 'shop_goods_sku_stock_edit', - 'menu_short_name' => '商品规格列表库存编辑', - 'parent_select_key' => 'shop_goods_list', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/sku/stock', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品规格列表价格编辑', - 'menu_key' => 'shop_goods_sku_price_edit', - 'menu_short_name' => '商品规格列表价格编辑', - 'parent_select_key' => 'shop_goods_list', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/sku/price', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品规格列表会员价格编辑', - 'menu_key' => 'shop_goods_sku_member_price_edit', - 'menu_short_name' => '商品规格列表会员价格编辑', - 'parent_select_key' => 'shop_goods_list', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/sku/member_price', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '删除参数模板', - 'menu_key' => 'shop_goods_attr_delete', - 'menu_short_name' => '删除参数模板', - 'parent_select_key' => 'shop_goods_attr_list', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/attr/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '编辑参数模板', - 'menu_key' => 'shop_goods_attr_edit', - 'menu_short_name' => '编辑参数模板', - 'parent_select_key' => 'shop_goods_attr_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/goods/attr/', - 'router_path' => 'shop/goods/attr_edit', - 'view_path' => 'goods/attr_edit', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '添加参数模板', - 'menu_key' => 'shop_goods_attr_add', - 'menu_short_name' => '添加参数模板', - 'parent_select_key' => 'shop_goods_attr_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/goods/attr', - 'router_path' => 'shop/goods/attr_edit', - 'view_path' => 'goods/attr_edit', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品添加', - 'menu_key' => 'shop_goods_real_add', - 'menu_short_name' => '商品添加', - 'parent_select_key' => 'shop_goods_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/goods', - 'router_path' => 'shop/goods/real_add', - 'view_path' => 'goods/real_edit', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品编辑', - 'menu_key' => 'shop_goods_real_edit', - 'menu_short_name' => '商品编辑', - 'parent_select_key' => 'shop_goods_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/goods/', - 'router_path' => 'shop/goods/real_edit', - 'view_path' => 'goods/real_edit', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '订单管理', - 'menu_key' => 'shop_order', - 'menu_short_name' => '订单', - 'menu_type' => '0', - 'icon' => 'iconfont icondingdanguanli', - 'api_url' => '', - 'router_path' => 'shop/order/index', - 'view_path' => '', - 'methods' => 'get', - 'sort' => '90', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '商城订单', - 'menu_key' => 'shop_order_list', - 'menu_short_name' => '商城订单', - 'menu_type' => '1', - 'icon' => 'iconfont icona-dingdanliebiao', - 'api_url' => 'shop/order/list', - 'router_path' => 'shop/order/index', - 'view_path' => 'order/list', - 'methods' => 'get', - 'sort' => '100', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '订单关闭', - 'menu_key' => 'shop_order_close', - 'menu_short_name' => '订单关闭', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/order/close/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '订单改价', - 'menu_key' => 'shop_order_edit_price', - 'menu_short_name' => '订单改价', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/order/edit_price', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '订单配送修改', - 'menu_key' => 'shop_order_edit_delivery', - 'menu_short_name' => '订单配送修改', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/order/edit_delivery', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '订单发货', - 'menu_key' => 'shop_order_delivery', - 'menu_short_name' => '订单发货', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/order/delivery', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '订单项发货', - 'menu_key' => 'shop_order_goods_delivery', - 'menu_short_name' => '订单项发货', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/order/goods/delivery/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商家留言', - 'menu_key' => 'shop_order_remark', - 'menu_short_name' => '商家留言', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/order/shop_remark', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '订单完成', - 'menu_key' => 'shop_order_finish', - 'menu_short_name' => '订单完成', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/order/finish/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '退款售后', - 'menu_key' => 'shop_order_refund', - 'menu_short_name' => '退款售后', - 'menu_type' => '1', - 'icon' => 'iconfont icondingdanweiquan', - 'api_url' => '', - 'router_path' => 'shop/order/refund', - 'view_path' => 'order/refund', - 'methods' => 'get', - 'sort' => '99', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '退款审核', - 'menu_key' => 'shop_order_refund_audit', - 'menu_short_name' => '退款审核', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/order/refund/audit/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '退款收货审核', - 'menu_key' => 'shop_order_refund_delivery', - 'menu_short_name' => '退款收货审核', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/order/refund/delivery/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '批量发货', - 'menu_key' => 'shop_order_batch_delivery', - 'menu_short_name' => '批量发货', - 'menu_type' => '1', - 'icon' => 'iconfont icona-dingdanliebiao', - 'api_url' => '', - 'router_path' => 'shop/order/batch/delivery', - 'view_path' => 'order/batch_delivery', - 'methods' => 'get', - 'sort' => '98', - 'status' => '1', - 'is_show' => '1', - ], - [ - 'menu_name' => '发票管理', - 'menu_key' => 'shop_invoice', - 'menu_short_name' => '发票管理', - 'menu_type' => '1', - 'icon' => 'iconfont iconfapiaoguanli', - 'api_url' => '', - 'router_path' => 'shop/order/invoice', - 'view_path' => 'order/invoice', - 'methods' => 'get', - 'sort' => '97', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '开票', - 'menu_key' => 'shop_invoice_open', - 'menu_short_name' => '开票', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/invoice/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '商品评价', - 'menu_key' => 'shop_goods_evaluate', - 'menu_short_name' => '商品评价', - 'menu_type' => '1', - 'icon' => 'iconfont iconshangpinpinglun', - 'api_url' => 'shop/goods/evaluate', - 'router_path' => 'shop/order/evaluate', - 'view_path' => 'goods/evaluate', - 'methods' => 'get', - 'sort' => '96', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '商品评价删除', - 'menu_key' => 'shop_goods_evaluate_delete', - 'menu_short_name' => '商品评价删除', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/evaluate/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品评价回复', - 'menu_key' => 'shop_goods_evaluate_reply', - 'menu_short_name' => '商品评价回复', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/evaluate/reply/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品评价通过', - 'menu_key' => 'shop_goods_evaluate_adopt', - 'menu_short_name' => '商品评价通过', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/evaluate/adopt/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品评价拒绝', - 'menu_key' => 'shop_goods_evaluate_refuse', - 'menu_short_name' => '商品评价拒绝', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/evaluate/refuse/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品评价置顶', - 'menu_key' => 'shop_goods_evaluate_topping', - 'menu_short_name' => '商品评价置顶', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/evaluate/topping/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '商品评价取消置顶', - 'menu_key' => 'shop_goods_evaluate_cancel_topping', - 'menu_short_name' => '商品评价取消置顶', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/evaluate/cancel_topping/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '订单设置', - 'menu_key' => 'shop_config_order', - 'menu_short_name' => '订单设置', - 'menu_type' => '1', - 'icon' => 'iconfont iconjiaoyishezhi', - 'api_url' => 'shop/order/config', - 'router_path' => 'shop/order/order/config', - 'view_path' => 'order/config', - 'methods' => '', - 'sort' => '95', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '订单设置编辑', - 'menu_key' => 'shop_config_order_set', - 'menu_short_name' => '订单设置编辑', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/order/config', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '添加评价', - 'menu_key' => 'shop_goods_evaluate_add', - 'menu_short_name' => '添加评价', - 'parent_select_key' => 'shop_goods_evaluate', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/goods/evaluate', - 'router_path' => 'shop/order/evaluate/add', - 'view_path' => 'goods/evaluate_edit', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '订单详情', - 'menu_key' => 'shop_order_detail', - 'menu_short_name' => '订单详情', - 'parent_select_key' => 'shop_order_list', - 'menu_type' => '1', - 'icon' => 'iconfont iconshangpinguanli', - 'api_url' => 'shop/order/detail/', - 'router_path' => 'shop/order/detail', - 'view_path' => 'order/detail', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '售后详情', - 'menu_key' => 'shop_order_refund_detail', - 'menu_short_name' => '售后详情', - 'parent_select_key' => 'shop_order_refund', - 'menu_type' => '1', - 'icon' => 'iconfont iconshangpinguanli', - 'api_url' => '', - 'router_path' => 'shop/order/refund/detail', - 'view_path' => 'order/refund_detail', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ] - ], - ], - [ - 'menu_name' => '配送管理', - 'menu_key' => 'shop_delivery_manage', - 'menu_short_name' => '配送', - 'menu_type' => '0', - 'icon' => 'nc-iconfont nc-icon-a-peisongguanliPC30', - 'api_url' => '', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'get', - 'sort' => '80', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '物流配送', - 'menu_key' => 'shop_logistics_manage', - 'menu_short_name' => '物流配送', - 'menu_type' => '0', - 'icon' => 'nc-iconfont nc-icon-a-wuliupeisongPC30', - 'api_url' => '', - 'router_path' => '', - 'view_path' => '', - 'methods' => '', - 'sort' => '100', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '物流公司', - 'menu_key' => 'shop_delivery_company', - 'menu_short_name' => '物流公司', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/delivery/company', - 'router_path' => 'shop/delivery/company', - 'view_path' => 'delivery/company', - 'methods' => 'get', - 'sort' => '100', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '物流公司删除', - 'menu_key' => 'shop_delivery_company_delete', - 'menu_short_name' => '物流公司删除', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/delivery/company/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '添加物流公司', - 'menu_key' => 'shop_delivery_company_add', - 'menu_short_name' => '添加物流公司', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/delivery/company', - 'router_path' => 'shop/delivery/company_add', - 'view_path' => 'delivery/company_edit', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '编辑物流公司', - 'menu_key' => 'shop_delivery_company_edit', - 'menu_short_name' => '编辑物流公司', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/delivery/company', - 'router_path' => 'shop/delivery/company_edit', - 'view_path' => 'delivery/company_edit', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '运费模板', - 'menu_key' => 'shop_delivery_shipping_template', - 'menu_short_name' => '运费模板', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/shipping/template', - 'router_path' => 'shop/shipping/template', - 'view_path' => 'delivery/template', - 'methods' => 'get', - 'sort' => '90', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '运费模板删除', - 'menu_key' => 'shop_delivery_shipping_template_delete', - 'menu_short_name' => '运费模板列表', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/shipping/template/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '运费模板添加/编辑', - 'menu_key' => 'shop_delivery_shipping_template_add_edit', - 'menu_short_name' => '运费模板添加/编辑', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => '', - 'router_path' => 'shop/shipping/template_edit', - 'view_path' => 'delivery/template_edit', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - 'children' => [ - [ - 'menu_name' => '运费模板添加', - 'menu_key' => 'shop_delivery_shipping_template_add', - 'menu_short_name' => '运费模板添加', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/shipping/template', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '运费模板编辑', - 'menu_key' => 'shop_delivery_shipping_template_edit', - 'menu_short_name' => '运费模板编辑', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/shipping/template/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '添加模板', - 'menu_key' => 'shop_delivery_electronic_sheet_add', - 'menu_short_name' => '添加电子面单模板', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/electronic_sheet', - 'router_path' => 'shop/delivery/electronic_sheet_add', - 'view_path' => 'delivery/electronic_sheet_edit', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '编辑模板', - 'menu_key' => 'shop_delivery_electronic_sheet_edit', - 'menu_short_name' => '编辑电子面单模板', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/electronic_sheet/', - 'router_path' => 'shop/delivery/electronic_sheet_edit', - 'view_path' => 'delivery/electronic_sheet_edit', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '电子面单', - 'menu_key' => 'shop_delivery_electronic_sheet', - 'menu_short_name' => '电子面单', - 'menu_type' => '1', - 'icon' => 'iconfont icondiscount', - 'api_url' => '', - 'router_path' => 'shop/delivery/electronic_sheet', - 'view_path' => 'delivery/electronic_sheet', - 'methods' => 'get', - 'sort' => '80', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '删除电子面单模板', - 'menu_key' => 'shop_delivery_electronic_sheet_del', - 'menu_short_name' => '删除电子面单模板', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/electronic_sheet', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '电子面单设置', - 'menu_key' => 'shop_delivery_electronic_sheet_config', - 'menu_short_name' => '电子面单设置', - 'menu_type' => '1', - 'icon' => 'iconfont icondiscount', - 'api_url' => 'shop/electronic_sheet/config', - 'router_path' => 'shop/delivery/electronic_sheet/config', - 'view_path' => 'delivery/electronic_sheet_config', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '物流跟踪', - 'menu_key' => 'shop_delivery_search', - 'menu_short_name' => '物流跟踪', - 'menu_type' => '1', - 'icon' => 'iconfont iconwuliugenzong', - 'api_url' => '', - 'router_path' => 'shop/delivery/search', - 'view_path' => 'delivery/search', - 'methods' => 'get', - 'sort' => '70', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '物流跟踪设置', - 'menu_key' => 'shop_delivery_search_set', - 'menu_short_name' => '物流跟踪设置', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/delivery/search', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ] - ] - ], - [ - 'menu_name' => '同城配送', - 'menu_key' => 'shop_local_delivery_manage', - 'menu_short_name' => '同城配送', - 'menu_type' => '0', - 'icon' => 'nc-iconfont nc-icon-a-tongchengpeisongPC30', - 'api_url' => '', - 'router_path' => '', - 'view_path' => '', - 'methods' => '', - 'sort' => '90', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '配送设置', - 'menu_key' => 'shop_delivery_local_config', - 'menu_short_name' => '配送设置', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => '', - 'router_path' => 'shop/delivery/local', - 'view_path' => 'delivery/local', - 'methods' => 'get', - 'sort' => '100', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '保存设置', - 'menu_key' => 'shop_delivery_local_config_set', - 'menu_short_name' => '保存设置', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/local', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '基础设置', - 'menu_key' => 'shop_delivery_local_base_config', - 'menu_short_name' => '基础设置', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => '', - 'router_path' => 'shop/delivery/local_config', - 'view_path' => 'delivery/local_config', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - 'children' => [ - [ - 'menu_name' => '保存设置', - 'menu_key' => 'shop_delivery_local_config_set', - 'menu_short_name' => '保存设置', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/local_delivery/base_config', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '配送平台', - 'menu_key' => 'shop_local_delivery_service', - 'menu_short_name' => '配送平台', - 'menu_type' => '1', - 'icon' => 'iconfont iconpaisongshezhi', - 'api_url' => 'delivery/local_delivery_service', - 'router_path' => 'shop/delivery/local_delivery_service', - 'view_path' => 'delivery/local_delivery_service', - 'methods' => 'get', - 'sort' => '90', - 'status' => '1', - 'is_show' => '1', - ], - [ - 'menu_name' => '配送记录', - 'menu_key' => 'shop_delivery_local_record', - 'menu_short_name' => '配送记录', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => '', - 'router_path' => 'shop/delivery/local/record', - 'view_path' => 'delivery/local_record', - 'methods' => 'get', - 'sort' => '80', - 'status' => '1', - 'is_show' => '1' - ], - ] - ], - [ - 'menu_name' => '商家配送', - 'menu_key' => 'shop_delivery_merchant_manage', - 'menu_short_name' => '商家配送', - 'menu_type' => '0', - 'icon' => 'nc-iconfont nc-icon-a-shangjiapeisongPC30', - 'api_url' => '', - 'router_path' => '', - 'view_path' => '', - 'methods' => '', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - 'children' => [ - [ - 'menu_name' => '配送员', - 'menu_key' => 'shop_delivery_staff', - 'menu_short_name' => '配送员', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => '', - 'router_path' => 'shop/delivery/staff', - 'view_path' => 'delivery/staff', - 'methods' => '', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - 'children' => [ - [ - 'menu_name' => '配送员添加', - 'menu_key' => 'shop_delivery_staff_add', - 'menu_short_name' => '配送员添加', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/delivery/staff', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '配送员编辑', - 'menu_key' => 'shop_delivery_staff_edit', - 'menu_short_name' => '配送员编辑', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/delivery/staff/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '配送员删除', - 'menu_key' => 'shop_delivery_staff_delete', - 'menu_short_name' => '配送员删除', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/delivery/staff/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '配送记录', - 'menu_key' => 'shop_delivery_merchant_record', - 'menu_short_name' => '配送记录', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => '', - 'router_path' => 'shop/delivery/merchant/record', - 'view_path' => 'delivery/merchant_record', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '1' - ], - ] - ], - [ - 'menu_name' => '商家地址库', - 'menu_key' => 'shop_address', - 'menu_short_name' => '商家地址库', - 'menu_type' => '1', - 'icon' => 'iconfont iconshangjiadizhiku', - 'api_url' => '', - 'router_path' => 'shop/address', - 'view_path' => 'address/list', - 'methods' => 'get', - 'sort' => '80', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '删除商家地址库', - 'menu_key' => 'shop_address_delete', - 'menu_short_name' => '删除商家地址库', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/shop_address/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '添加/编辑地址库', - 'menu_key' => 'shop_address_add_edit', - 'menu_short_name' => '添加/编辑地址库', - 'parent_select_key' => 'shop_address', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => '', - 'router_path' => 'shop/address/edit', - 'view_path' => 'address/edit', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - 'children' => [ - [ - 'menu_name' => '地址库添加', - 'menu_key' => 'shop_address_add', - 'menu_short_name' => '地址库添加', - 'parent_select_key' => 'shop_address', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/shop_address', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '地址库编辑', - 'menu_key' => 'shop_address_edit', - 'menu_short_name' => '地址库编辑', - 'parent_select_key' => 'shop_address', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/shop_address/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '提货点', - 'menu_key' => 'shop_delivery_store', - 'menu_short_name' => '提货点', - 'menu_type' => '1', - 'icon' => 'nc-iconfont nc-icon-dingweiV6xx-1', - 'api_url' => 'shop/delivery/store', - 'router_path' => 'shop/delivery_store', - 'view_path' => 'delivery_store/list', - 'methods' => 'get', - 'sort' => '70', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '删除提货点', - 'menu_key' => 'shop_delivery_store_delete', - 'menu_short_name' => '删除提货点', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/delivery/store/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '1', - ], - ], - ], - [ - 'menu_name' => '添加/编辑提货点', - 'menu_key' => 'shop_delivery_store_add_edit', - 'menu_short_name' => '添加/编辑提货点', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => '', - 'router_path' => 'shop/delivery_store/edit', - 'view_path' => 'delivery_store/edit', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - 'children' => [ - [ - 'menu_name' => '编辑提货点', - 'menu_key' => 'shop_delivery_store_edit', - 'menu_short_name' => '编辑提货点', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/delivery/store/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '添加提货点', - 'menu_key' => 'shop_delivery_store_add', - 'menu_short_name' => '添加提货点', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/delivery/store', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '服务商配送设置', - 'menu_key' => 'shop_delivery_store_delivery_set', - 'menu_short_name' => '服务商配送设置', - 'menu_type' => '1', - 'icon' => 'nc-iconfont nc-icon-shangjiadizhiku', - 'api_url' => '', - 'router_path' => 'shop/delivery_store/delivery_set', - 'view_path' => 'delivery_store/delivery_set', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - 'children' => [], - ], - [ - 'menu_name' => '配送设置', - 'menu_key' => 'shop_delivery_config', - 'menu_short_name' => '配送设置', - 'menu_type' => '1', - 'icon' => 'iconfont iconpaisongshezhi', - 'api_url' => '', - 'router_path' => 'shop/delivery/config', - 'view_path' => 'delivery/config', - 'methods' => '', - 'sort' => '60', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '配送设置编辑', - 'menu_key' => 'shop_delivery_config_set', - 'menu_short_name' => '配送设置编辑', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/delivery/setConfig', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - ] - ], - [ - 'menu_name' => '数据统计', - 'menu_key' => 'shop_stat', - 'menu_short_name' => '数据', - 'menu_type' => '0', - 'icon' => 'iconfont iconshujutongji', - 'api_url' => '', - 'router_path' => 'shop/stat/index', - 'view_path' => '', - 'methods' => 'get', - 'sort' => '85', - 'status' => '1', - 'is_show' => '0', - 'children' => [ - [ - 'menu_name' => '数据概况', - 'menu_key' => 'shop_stat_index', - 'menu_short_name' => '数据概况', - 'menu_type' => '1', - 'icon' => 'iconfont icona-dingdanliebiao', - 'api_url' => 'shop/stat/index', - 'router_path' => 'shop/stat/index', - 'view_path' => 'stat/index', - 'methods' => 'get', - 'sort' => '90', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '会员数据', - 'menu_key' => 'shop_stat_member', - 'menu_short_name' => '会员数据', - 'menu_type' => '1', - 'icon' => 'iconfont icona-dingdanliebiao', - 'api_url' => 'shop/stat/member', - 'router_path' => 'shop/stat/member', - 'view_path' => 'stat/member', - 'methods' => 'get', - 'sort' => '89', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '交易数据', - 'menu_key' => 'shop_stat_order', - 'menu_short_name' => '交易数据', - 'menu_type' => '1', - 'icon' => 'iconfont icona-dingdanliebiao', - 'api_url' => '', - 'router_path' => 'shop/stat/order', - 'view_path' => 'stat/order', - 'methods' => 'get', - 'sort' => '88', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '流量数据', - 'menu_key' => 'shop_stat_visit', - 'menu_short_name' => '流量数据', - 'menu_type' => '1', - 'icon' => 'iconfont icona-dingdanliebiao', - 'api_url' => 'shop/stat/visit', - 'router_path' => 'shop/stat/visit', - 'view_path' => 'stat/visit', - 'methods' => 'get', - 'sort' => '87', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - ], - ], - [ - 'menu_name' => '优惠券', - 'menu_key' => 'shop_goods_coupon', - 'menu_short_name' => '优惠券', - 'parent_key' => 'addon', - 'menu_type' => '0', - 'icon' => 'element Help', - 'api_url' => '', - 'router_path' => 'shop/marketing/coupon/list', - 'view_path' => '', - 'methods' => '', - 'sort' => '100', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '优惠券列表', - 'menu_key' => 'shop_goods_coupon_list', - 'menu_short_name' => '优惠券', - 'menu_type' => '1', - 'icon' => 'iconfont iconyouhuiquan', - 'api_url' => '', - 'router_path' => 'shop/marketing/coupon/list', - 'view_path' => 'marketing/coupon/list', - 'methods' => 'get', - 'sort' => '90', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '优惠券删除', - 'menu_key' => 'shop_goods_coupon_delete', - 'menu_short_name' => '优惠券删除', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/coupon/delete', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '优惠券设置状态', - 'menu_key' => 'shop_goods_coupon_set_status', - 'menu_short_name' => '优惠券设置状态', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/coupon/setstatus/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '发券记录', - 'menu_key' => 'shop_goods_coupon_send_list', - 'menu_short_name' => '发券记录', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/coupon/send/pages/', - 'router_path' => 'shop/marketing/coupon/send_list', - 'view_path' => 'marketing/coupon/send_list', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '发券', - 'menu_key' => 'shop_goods_coupon_send', - 'menu_short_name' => '发券', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/goods/coupon/send/', - 'router_path' => 'shop/marketing/coupon/send', - 'view_path' => 'marketing/coupon/send', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '优惠券添加', - 'menu_key' => 'shop_goods_coupon_add', - 'menu_short_name' => '优惠券添加', - 'parent_select_key' => 'shop_goods_coupon_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/goods/coupon', - 'router_path' => 'shop/marketing/coupon/add', - 'view_path' => 'marketing/coupon/add', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '优惠券编辑', - 'menu_key' => 'shop_goods_coupon_edit', - 'menu_short_name' => '优惠券编辑', - 'parent_select_key' => 'shop_goods_coupon_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/goods/coupon/edit/', - 'router_path' => 'shop/marketing/coupon/edit', - 'view_path' => 'marketing/coupon/edit', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '优惠券领取记录', - 'menu_key' => 'shop_goods_coupon_collection', - 'menu_short_name' => '优惠券领取记录', - 'parent_select_key' => 'shop_goods_coupon_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/goods/coupon/records', - 'router_path' => 'shop/marketing/coupon/collection', - 'view_path' => 'marketing/coupon/collection', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '满减送', - 'menu_key' => 'shop_goods_manjian', - 'menu_short_name' => '满减送', - 'parent_key' => 'addon', - 'menu_type' => '0', - 'icon' => 'element Help', - 'api_url' => '', - 'router_path' => 'shop/marketing/manjian/list', - 'view_path' => '', - 'methods' => '', - 'sort' => '99', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '满减送', - 'menu_key' => 'shop_goods_manjian_list', - 'menu_short_name' => '满减送', - 'menu_type' => '1', - 'icon' => 'iconfont icondiscount', - 'api_url' => 'shop/manjian', - 'router_path' => 'shop/marketing/manjian/list', - 'view_path' => 'marketing/manjian/list', - 'methods' => 'get', - 'sort' => '89', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '活动关闭', - 'menu_key' => 'shop_goods_manjian_close', - 'menu_short_name' => '活动关闭', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/manjian/close/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '活动删除', - 'menu_key' => 'shop_goods_manjian_delete', - 'menu_short_name' => '活动删除', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/manjian/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '活动详情', - 'menu_key' => 'shop_goods_manjian_detail', - 'menu_short_name' => '活动详情', - 'parent_select_key' => 'shop_goods_manjian_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/manjian/', - 'router_path' => 'shop/marketing/manjian/detail', - 'view_path' => 'marketing/manjian/detail', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '编辑满减送活动', - 'menu_key' => 'shop_goods_manjian_edit', - 'menu_short_name' => '编辑满减送活动', - 'parent_select_key' => 'shop_goods_manjian_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/manjian/', - 'router_path' => 'shop/marketing/manjian/edit', - 'view_path' => 'marketing/manjian/edit', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '添加满减送活动', - 'menu_key' => 'shop_goods_manjian_add', - 'menu_short_name' => '添加满减送活动', - 'parent_select_key' => 'shop_goods_manjian_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/manjian', - 'router_path' => 'shop/marketing/manjian/add', - 'view_path' => 'marketing/manjian/edit', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '限时折扣', - 'menu_key' => 'shop_goods_discount', - 'menu_short_name' => '限时折扣', - 'parent_key' => 'addon', - 'menu_type' => '0', - 'icon' => 'iconfont icondiscount', - 'api_url' => '', - 'router_path' => 'shop/marketing/discount/list', - 'view_path' => 'marketing/discount/list', - 'methods' => 'get', - 'sort' => '98', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '活动列表', - 'menu_key' => 'shop_goods_discount_list', - 'menu_short_name' => '活动列表', - 'menu_type' => '1', - 'icon' => 'iconfont icondiscount', - 'api_url' => 'shop/active/discount', - 'router_path' => 'shop/marketing/discount/list', - 'view_path' => 'marketing/discount/list', - 'methods' => 'get', - 'sort' => '90', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '活动关闭', - 'menu_key' => 'shop_goods_discount_close', - 'menu_short_name' => '活动关闭', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/active/discount/close/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '活动删除', - 'menu_key' => 'shop_goods_discount_delete', - 'menu_short_name' => '活动删除', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/active/discount/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '活动设置', - 'menu_key' => 'shop_goods_discount_config', - 'menu_short_name' => '活动设置', - 'menu_type' => '1', - 'icon' => 'iconfont icondiscount', - 'api_url' => '', - 'router_path' => 'shop/marketing/discount/config', - 'view_path' => 'marketing/discount/config', - 'methods' => 'get', - 'sort' => '80', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '活动设置编辑', - 'menu_key' => 'shop_goods_discount_config_set', - 'menu_short_name' => '活动设置编辑', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/active/discount/config', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '活动详情', - 'menu_key' => 'shop_goods_discount_detail', - 'menu_short_name' => '活动详情', - 'parent_select_key' => 'shop_goods_discount_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/active/discount/', - 'router_path' => 'shop/marketing/discount/detail', - 'view_path' => 'marketing/discount/detail', - 'methods' => 'get', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '编辑限时折扣', - 'menu_key' => 'shop_goods_discount_edit', - 'menu_short_name' => '编辑限时折扣', - 'parent_select_key' => 'shop_goods_discount_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/active/discount/', - 'router_path' => 'shop/marketing/discount/edit', - 'view_path' => 'marketing/discount/edit', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '添加限时折扣', - 'menu_key' => 'shop_goods_discount_add', - 'menu_short_name' => '添加限时折扣', - 'parent_select_key' => 'shop_goods_discount_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/active/discount', - 'router_path' => 'shop/marketing/discount/add', - 'view_path' => 'marketing/discount/add', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '积分商城', - 'menu_key' => 'shop_point_goods', - 'menu_short_name' => '积分商城', - 'parent_key' => 'addon', - 'menu_type' => '0', - 'icon' => 'iconfont iconpointshop', - 'api_url' => '', - 'router_path' => 'shop/marketing/exchange/goods_list', - 'view_path' => '', - 'methods' => 'get', - 'sort' => '97', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '积分商品', - 'menu_key' => 'shop_point_goods_list', - 'menu_short_name' => '积分商品', - 'menu_type' => '1', - 'icon' => 'iconfont iconpointgoods', - 'api_url' => 'shop/active/exchange', - 'router_path' => 'shop/marketing/exchange/goods_list', - 'view_path' => 'marketing/exchange/goods_list', - 'methods' => 'get', - 'sort' => '90', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '修改上下架状态', - 'menu_key' => 'shop_point_goods_status_edit', - 'menu_short_name' => '修改上下架状态', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/active/exchange/status/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '删除积分商品', - 'menu_key' => 'shop_point_goods_delete', - 'menu_short_name' => '删除积分商品', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/active/exchange/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '修改排序号', - 'menu_key' => 'shop_point_goods_sort_edit', - 'menu_short_name' => '修改排序号', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/active/exchange/sort/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '兑换记录', - 'menu_key' => 'shop_point_exchange_list', - 'menu_short_name' => '兑换记录', - 'parent_select_key' => 'shop_point_goods_list', - 'menu_type' => '1', - 'icon' => 'iconfont iconpointexchange', - 'api_url' => '', - 'router_path' => 'shop/marketing/exchange/order_list', - 'view_path' => 'marketing/exchange/order_list', - 'methods' => 'get', - 'sort' => '89', - 'status' => '1', - 'is_show' => '1', - ], - [ - 'menu_name' => '添加商品', - 'menu_key' => 'shop_point_goods_add', - 'menu_short_name' => '添加商品', - 'parent_select_key' => 'shop_point_goods_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/active/exchange', - 'router_path' => 'shop/marketing/exchange/goods_add', - 'view_path' => 'marketing/exchange/goods_add', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '编辑商品', - 'menu_key' => 'shop_point_goods_edit', - 'menu_short_name' => '编辑商品', - 'parent_select_key' => 'shop_point_goods_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/active/exchange/', - 'router_path' => 'shop/marketing/exchange/goods_edit', - 'view_path' => 'marketing/exchange/goods_edit', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '新人专享', - 'menu_key' => 'shop_goods_newcomer_discount', - 'menu_short_name' => '新人专享', - 'parent_key' => 'addon', - 'menu_type' => '0', - 'icon' => 'iconfont icondiscount', - 'api_url' => '', - 'router_path' => 'shop/marketing/newcomer/config', - 'view_path' => '', - 'methods' => 'get', - 'sort' => '96', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '新人设置', - 'menu_key' => 'shop_goods_newcomer_discount_config', - 'menu_short_name' => '新人设置', - 'menu_type' => '1', - 'icon' => 'iconfont icondiscount', - 'api_url' => 'shop/active/newcomer/config', - 'router_path' => 'shop/marketing/newcomer/config', - 'view_path' => 'marketing/newcomer/config', - 'methods' => 'put', - 'sort' => '90', - 'status' => '1', - 'is_show' => '1', - ], - [ - 'menu_name' => '购买记录', - 'menu_key' => 'shop_goods_newcomer_discount_order_list', - 'menu_short_name' => '购买记录', - 'menu_type' => '1', - 'icon' => 'iconfont icondiscount', - 'api_url' => 'shop/active/newcomer/order', - 'router_path' => 'shop/marketing/newcomer/order_list', - 'view_path' => 'marketing/newcomer/order_list', - 'methods' => 'get', - 'sort' => '80', - 'status' => '1', - 'is_show' => '1', - ], - ], - ], - [ - 'menu_name' => '商品榜单', - 'menu_key' => 'shop_goods_rank', - 'menu_short_name' => '商品榜单', - 'parent_key' => 'addon', - 'menu_type' => '0', - 'icon' => 'iconfont icondiscount', - 'api_url' => '', - 'router_path' => 'shop/marketing/goods_rank/config', - 'view_path' => '', - 'methods' => 'get', - 'sort' => '50', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '榜单设置', - 'menu_key' => 'shop_goods_rank_config', - 'menu_short_name' => '榜单设置', - 'menu_type' => '1', - 'icon' => 'iconfont icondiscount', - 'api_url' => 'shop/good/rank/config', - 'router_path' => 'shop/marketing/goods_rank/config', - 'view_path' => 'marketing/goods_rank/config', - 'methods' => 'get', - 'sort' => '90', - 'status' => '1', - 'is_show' => '1', - ], - [ - 'menu_name' => '榜单管理', - 'menu_key' => 'shop_goods_rank_list', - 'menu_short_name' => '榜单管理', - 'menu_type' => '1', - 'icon' => 'iconfont icondiscount', - 'api_url' => 'shop/good/rank', - 'router_path' => 'shop/marketing/goods_rank/list', - 'view_path' => 'marketing/goods_rank/list', - 'methods' => 'get', - 'sort' => '80', - 'status' => '1', - 'is_show' => '1', - 'children' => [ - [ - 'menu_name' => '删除榜单', - 'menu_key' => 'shop_goods_rank_delete', - 'menu_short_name' => '删除榜单', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/good/rank/', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'delete', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '批量删除榜单', - 'menu_key' => 'shop_goods_rank_batch_delete', - 'menu_short_name' => '批量删除榜单', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/good/rank/batchdelete', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '榜单排序号修改', - 'menu_key' => 'shop_goods_rank_sort_edit', - 'menu_short_name' => '榜单排序号修改', - 'menu_type' => '2', - 'icon' => '', - 'api_url' => 'shop/good/rank/sort', - 'router_path' => '', - 'view_path' => '', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], - [ - 'menu_name' => '榜单添加', - 'menu_key' => 'shop_goods_rank_add', - 'menu_short_name' => '榜单添加', - 'parent_select_key' => 'shop_goods_rank_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/good/rank', - 'router_path' => 'shop/marketing/goods_rank/edit', - 'view_path' => 'marketing/goods_rank/edit', - 'methods' => 'post', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - [ - 'menu_name' => '榜单编辑', - 'menu_key' => 'shop_goods_rank_edit', - 'menu_short_name' => '榜单编辑', - 'parent_select_key' => 'shop_goods_rank_list', - 'menu_type' => '1', - 'icon' => '', - 'api_url' => 'shop/good/rank/', - 'router_path' => 'shop/marketing/goods_rank/edit', - 'view_path' => 'marketing/goods_rank/edit', - 'methods' => 'put', - 'sort' => '0', - 'status' => '1', - 'is_show' => '0', - ], - ], - ], -]; diff --git a/niucloud/addon/shop/app/dict/notice/notice.php b/niucloud/addon/shop/app/dict/notice/notice.php deleted file mode 100644 index 9f5acebae..000000000 --- a/niucloud/addon/shop/app/dict/notice/notice.php +++ /dev/null @@ -1,58 +0,0 @@ - [ - 'addon' => 'shop', - 'key' => 'shop_order_pay', - 'receiver_type' => 1, - 'name' => '商城订单支付成功通知', - 'title' => '订单支付成功后发送', - 'async' => true, - 'variable' => [ - 'order_money' => '订单总额', - 'pay_time' => '支付时间', - 'create_time' => '支付时间', - 'body' => '订单内容', - 'order_no' => '订单编号', - 'url' => '订单链接' - ], - ], - 'shop_order_delivery' => [ - 'addon' => 'shop', - 'key' => 'shop_order_delivery', - 'receiver_type' => 1, - 'name' => '商城订单发货通知', - 'title' => '订单发货之后通知买家', - 'async' => true, - 'variable' => [ - 'delivery_time' => '发货时间', - 'order_money' => '订单总额', - 'body' => '订单内容', - 'order_no' => '订单编号', - 'url' => '订单链接' - ], - ], - 'shop_refund_agree' => [ - 'addon' => 'shop', - 'key' => 'shop_refund_agree', - 'receiver_type' => 1, - 'name' => '商城商家同意退款申请', - 'title' => '商家同意买家退款申请后发送', - 'async' => true, - 'variable' => [ - 'order_no' => '订单编号', - 'refund_money' => '退款金额', - ], - ], - 'shop_refund_refuse' => [ - 'addon' => 'shop', - 'key' => 'shop_refund_refuse', - 'receiver_type' => 1, - 'name' => '商城商家拒绝退款申请', - 'title' => '商家拒绝买家退款申请后发送', - 'async' => true, - 'variable' => [ - 'order_no' => '订单编号', - 'refund_money' => '退款金额', - ] - ] -]; diff --git a/niucloud/addon/shop/app/dict/notice/sms.php b/niucloud/addon/shop/app/dict/notice/sms.php deleted file mode 100644 index 67e3ed65c..000000000 --- a/niucloud/addon/shop/app/dict/notice/sms.php +++ /dev/null @@ -1,34 +0,0 @@ - [ - 'is_need_closure_content' => 1,//是否需要闭包处理content - 'content' => function ($data) { - $sms_type = $data['sms_type']; - if ($sms_type == SmsDict::NIUSMS) { - return "您的订单{order_no}已支付成功"; - } - return "您购买的“{body}”已支付成功。查看详情{url}"; - } - ], - 'shop_order_delivery' => [ - 'is_need_closure_content' => 1,//是否需要闭包处理content - 'content' => function ($data) { - $sms_type = $data['sms_type']; - if ($sms_type == SmsDict::NIUSMS) { - return "您的订单{order_no}已于{delivery_time}发货"; - } - return "您购买的“{body}”已于{delivery_time}发货。查看详情{url}"; - } - ], - 'shop_refund_agree' => [ - 'is_need_closure_content' => 0, - 'content' => '商家已同意您订单编号为{order_no}的退款申请,请关注具体的退款情况', - ], - 'shop_refund_refuse' => [ - 'is_need_closure_content' => 0, - 'content' => '很抱歉,您订单编号为{order_no}的退款申请未被同意,请您联系商家并修改申请', - ], -]; diff --git a/niucloud/addon/shop/app/dict/notice/weapp.php b/niucloud/addon/shop/app/dict/notice/weapp.php deleted file mode 100644 index 847949da9..000000000 --- a/niucloud/addon/shop/app/dict/notice/weapp.php +++ /dev/null @@ -1,49 +0,0 @@ - [ - 'tid' => '30808', - 'content' => [ - ['订单编号', '{order_no}', 'character_string1'], - ['下单时间', '{create_time}', 'time2'], - ['商品名称', '{body}', 'thing4'], - ['订单金额', '{order_money}', 'amount3'], - ], - 'kid_list' => [1, 2, 4, 3], - 'scene_desc' => '订单支付之后通知', - 'tips' => '使用该消息请在小程序的服务类目中添加类目:一级类目:商业服务 二级类目:软件/建站/技术开发' - ], - 'shop_order_delivery' => [ - 'tid' => '30766', - 'content' => [ - ['订单编号', '{order_no}', 'character_string2'], - ['商品名称', '{body}', 'thing1'], - ['订单金额', '{order_money}', 'amount7'], - ['发货时间', '{delivery_time}', 'date3'], - ], - 'kid_list' => [2, 1, 7, 3], - 'scene_desc' => '订单发货通知', - 'tips' => '使用该消息请在小程序的服务类目中添加类目:一级类目:商业服务 二级类目:软件/建站/技术开发' - ], - 'shop_refund_agree' => [ - 'tid' => '30825', - 'content' => [ - ['订单编号', '{order_no}', 'character_string3'], - ['退款金额', '{refund_money}', 'amount1'], - ['申请结果', '{result}', 'phrase7'], - ], - 'kid_list' => [3, 1, 7], - 'scene_desc' => '商家同意退款', - 'tips' => '使用该消息请在小程序的服务类目中添加类目:一级类目:商业服务 二级类目:软件/建站/技术开发' - ], - 'shop_refund_refuse' => [ - 'tid' => '30825', - 'content' => [ - ['订单编号', '{order_no}', 'character_string3'], - ['退款金额', '{refund_money}', 'amount1'], - ['申请结果', '{result}', 'phrase7'], - ], - 'kid_list' => [3, 1, 7], - 'scene_desc' => '商家拒绝退款', - 'tips' => '使用该消息请在小程序的服务类目中添加类目:一级类目:商业服务 二级类目:软件/建站/技术开发' - ] -]; diff --git a/niucloud/addon/shop/app/dict/notice/wechat.php b/niucloud/addon/shop/app/dict/notice/wechat.php deleted file mode 100644 index 578e794b8..000000000 --- a/niucloud/addon/shop/app/dict/notice/wechat.php +++ /dev/null @@ -1,42 +0,0 @@ - [ - 'temp_key' => '43216', - 'content' => [ - ['下单时间', '{create_time}', 'time4'], - ['订单编号', '{order_no}', 'character_string2'], - ['商品信息', '{body}', 'thing3'], - ['订单金额', '{order_money}', 'amount5'] - ], - 'keyword_name_list' => ["下单时间", "订单号", "商品名称", "支付金额"], - 'tips' => '使用该消息请将微信公众号服务类目选择为:生活服务——>百货/超市/便利店' - ], - 'shop_order_delivery' => [ - 'temp_key' => '42984', - 'content' => [ - ['订单编号', '{order_no}', 'character_string2'], - ['商品名称', '{body}', 'thing4'], - ['发货时间', '{delivery_time}', 'time12'] - ], - 'keyword_name_list' => ["订单编号", "商品名称", "发货时间"], - 'tips' => '使用该消息请将微信公众号服务类目选择为:生活服务——>百货/超市/便利店' - ], - 'shop_refund_agree' => [ - 'temp_key' => '48058', - 'content' => [ - ['订单编号', '{order_no}', 'character_string5'], - ['退款金额', '{refund_money}', 'amount2'], - ], - 'keyword_name_list' => ["订单编号", "退款金额"], - 'tips' => '使用该消息请将微信公众号服务类目选择为:商业服务——>软件/建站/技术开发' - ], - 'shop_refund_refuse' => [ - 'temp_key' => '49580', - 'content' => [ - ['订单编号', '{order_no}', 'character_string1'], - ['退款金额', '{refund_money}', 'amount2'] - ], - 'keyword_name_list' => ["订单编号", "退款金额"], - 'tips' => '使用该消息请将微信公众号服务类目选择为:商业服务——>软件/建站/技术开发' - ], -]; diff --git a/niucloud/addon/shop/app/dict/order/InvoiceDict.php b/niucloud/addon/shop/app/dict/order/InvoiceDict.php deleted file mode 100644 index cfe3a145b..000000000 --- a/niucloud/addon/shop/app/dict/order/InvoiceDict.php +++ /dev/null @@ -1,94 +0,0 @@ - get_lang('dict_shop_invoice.header_type_company'), - self::PERSON => get_lang('dict_shop_invoice.header_type_person'), - ]; - } - - public static function getType() - { - return [ - self::COMMON => get_lang('dict_shop_invoice.common'), - self::SPECIAL => get_lang('dict_shop_invoice.sprcial'), - ]; - } - - public static function getStatus() - { - return [ - self::WAIT_OPEN => get_lang('dict_shop_invoice.wait_open'), - self::OPEN => get_lang('dict_shop_invoice.open'), - ]; - } - - public static function getIsInvoice() - { - return [ - self::WAIT_INVOICE => get_lang('dict_shop_invoice.wait_invoice'), - self::INVOICED => get_lang('dict_shop_invoice.invoiced'), - self::WAIT_AUDIT => get_lang('dict_shop_invoice.wait_audit'), - ]; - } - -} diff --git a/niucloud/addon/shop/app/dict/order/OrderBatchDeliveryDict.php b/niucloud/addon/shop/app/dict/order/OrderBatchDeliveryDict.php deleted file mode 100644 index cd0bb478e..000000000 --- a/niucloud/addon/shop/app/dict/order/OrderBatchDeliveryDict.php +++ /dev/null @@ -1,63 +0,0 @@ - get_lang('dict_shop_batch_delivery_status.processing'), - self::FINISH => get_lang('dict_shop_batch_delivery_status.finish'), - self::FAIL => get_lang('dict_shop_batch_delivery_status.fail'), - ]; - - if ($status == '') { - return $data; - } - return $data[ $status ] ?? ''; - } - -} diff --git a/niucloud/addon/shop/app/dict/order/OrderDeliveryDict.php b/niucloud/addon/shop/app/dict/order/OrderDeliveryDict.php deleted file mode 100644 index e5cee270b..000000000 --- a/niucloud/addon/shop/app/dict/order/OrderDeliveryDict.php +++ /dev/null @@ -1,106 +0,0 @@ - [ - self::EXPRESS => get_lang('dict_shop_delivery_type.express'), - self::NONE_EXPRESS => get_lang('dict_shop_delivery_type.none_express') - ], - DeliveryDict::LOCAL_DELIVERY => [ - self::LOCAL_DELIVERY => get_lang('dict_shop_delivery_type.local_delivery') - ], - DeliveryDict::STORE => [ - self::STORE => get_lang('dict_shop_delivery_type.store') - ], - self::VIRTUAL => [ - self::VIRTUAL => get_lang('dict_shop_delivery_type.virtual'), - ], - ]; - - if ($type == '') { - return $data; - } - return $data[$type] ?? ''; - } - - const WAIT_DELIVERY = 'wait_delivery'; - const DELIVERYING = 'delivery'; - const DELIVERY_FINISH = 'delivery_finish'; - const TAKED = 'taked'; - - const EXPIRE = 'expire';//失效 - /** - * 配送状态(订单项) - * @param string $status - * @return array|mixed|string - */ - public static function getStatus(string $status = '') - { - $data = [ - self::WAIT_DELIVERY => get_lang('dict_shop_delivery_status.wait_delivery'), - self::DELIVERYING => get_lang('dict_shop_delivery_status.delivery'), - self::DELIVERY_FINISH => get_lang('dict_shop_delivery_status.delivery_finish'), - self::TAKED => get_lang('dict_shop_delivery_status.taked'), - ]; - - if ($status == '') { - return $data; - } - return $data[$status] ?? ''; - } - -} diff --git a/niucloud/addon/shop/app/dict/order/OrderDict.php b/niucloud/addon/shop/app/dict/order/OrderDict.php deleted file mode 100644 index 1b773bb95..000000000 --- a/niucloud/addon/shop/app/dict/order/OrderDict.php +++ /dev/null @@ -1,217 +0,0 @@ - self::TYPE, - 'name' => get_lang('dict_shop_order.order_type_shop') - ]; - }//买家主动关闭 - - public static function getStatus($status = '', $delivery_type = '') - { - $data = [ - self::WAIT_PAY => [ - 'name' => get_lang('dict_shop_order.status_wait_pay'),//待支付 - 'status' => self::WAIT_PAY, - 'is_refund' => 0, - 'action' => [], - 'member_action' => [ - [ - 'name' => '支付', - 'class' => '', - 'params' => '' - ], - ], - ], - self::WAIT_DELIVERY => [ - 'name' => $delivery_type == OrderDeliveryDict::STORE ? get_lang('dict_shop_order.status_wait_pickup') : get_lang('dict_shop_order.status_wait_shipping'),//待发货 - 'status' => self::WAIT_DELIVERY, - 'is_refund' => 0, - 'action' => [], - 'member_action' => [ - [ - 'name' => '支付', - 'class' => '', - 'params' => '' - ], - ], - ], - self::WAIT_TAKE => [ - 'name' => get_lang('dict_shop_order.status_wait_take'),//待收货 - 'status' => self::WAIT_TAKE, - 'is_refund' => 0, - 'action' => [], - 'member_action' => [ - [ - 'name' => '支付', - 'class' => '', - 'params' => '' - ], - ], - ], - self::FINISH => [ - 'name' => get_lang('dict_shop_order.status_finish'),//已完成 - 'status' => self::FINISH, - 'is_refund' => 0, - 'action' => [], - 'member_action' => [ - ], - ], - self::CLOSE => [ - 'name' => get_lang('dict_shop_order.status_close'),//已关闭 - 'status' => self::CLOSE, - 'is_refund' => 0, - 'action' => [], - 'member_action' => [ - ], - ] - - ]; - if ($status == '') { - return $data; - } - return $data[$status] ?? ''; - }//自动关闭 - - /** - * 订单操作类型 - * @param string $type - * @return array|mixed|string - */ - public static function getActionType(string $type = '') - { - $data = [ - self::ORDER_CREATE_ACTION => get_lang('dict_shop_order_action.order_create_action'), - self::ORDER_PAY_ACTION => get_lang('dict_shop_order_action.order_pay_action'), - self::ORDER_CLOSE_ACTION => get_lang('dict_shop_order_action.order_close_action'), - self::ORDER_DELIVERY_PART_ACTION => get_lang('dict_shop_order_action.order_part_delivery'), - self::ORDER_DELIVERY_ACTION => get_lang('dict_shop_order_action.order_delivery_action'), - self::ORDER_FINISH_ACTION => get_lang('dict_shop_order_action.order_finish_action'), - self::ORDER_REMARK_ACTION => get_lang('dict_shop_order_action.order_remark_action'), - self::ORDER_CLOSE_ALLOW_REFUND_ACTION => get_lang('dict_shop_order_action.order_close_allow_refund'), - self::ORDER_EDIT_PRICE_ACTION => get_lang('dict_shop_order_action.order_edit_price_action'), - ]; - if (!$type) { - return $data; - } - return $data[$type] ?? ''; - } - - /** - * 关闭方式 - * @param string $type - * @return array|mixed|string - */ - public static function getCloseType(string $type = '') - { - $data = [ - self::SHOP_CLOSE => get_lang('dict_shop_order_close_type.shop_close'), - self::BUYER_CLOSE => get_lang('dict_shop_order_close_type.buyer_close'), - self::AUTO_CLOSE => get_lang('dict_shop_order_close_type.auto_close'), - self::REFUND_CLOSE => get_lang('dict_shop_order_close_type.refund_close'), - ]; - if (!$type) { - return $data; - } - return $data[$type] ?? ''; - } - - /** - * @param $type - * @return string - */ - public static function getOrderActiveTypeName($type) - { - if (empty($type)) { - $type = self::TYPE; - } - $data = [ - 'pintuan' => '拼团', - 'seckill' => '秒杀', - self::TYPE => '商城', - 'exchange' => '兑换', - 'giftcard' => '礼品卡', - 'newcomer_discount' => '新人专享', - 'discount' => '限时折扣', - 'manjiansong' => '满减送', - 'friend_help' => '好友助力', - ]; - return $data[$type] ?? ''; - } -} diff --git a/niucloud/addon/shop/app/dict/order/OrderDiscountDict.php b/niucloud/addon/shop/app/dict/order/OrderDiscountDict.php deleted file mode 100644 index 465c435d8..000000000 --- a/niucloud/addon/shop/app/dict/order/OrderDiscountDict.php +++ /dev/null @@ -1,51 +0,0 @@ - get_lang('dict_shop_order_discount.type_discount'),//优惠 - self::GIFT => get_lang('dict_shop_order_discount.type_gift'),//礼物 - ]; - } - - /** - * 优惠类型 - * @return array - */ - public static function getDiscountType() - { - return [ - self::COUPON => get_lang('dict_shop_order_discount.discount_type_coupon'),//优惠券 - self::POINT => get_lang('dict_shop_order_discount.discount_type_point'),//积分 - ]; - } - -} diff --git a/niucloud/addon/shop/app/dict/order/OrderGoodsDict.php b/niucloud/addon/shop/app/dict/order/OrderGoodsDict.php deleted file mode 100644 index 3ec3eea83..000000000 --- a/niucloud/addon/shop/app/dict/order/OrderGoodsDict.php +++ /dev/null @@ -1,52 +0,0 @@ - get_lang('dict_shop_order_refund.normal'), - self::REFUNDING => get_lang('dict_shop_order_refund.refunding'), - self::REFUND_FINISH => get_lang('dict_shop_order_refund.refund_finish'), - ]; - if ($status == '') { - return $data; - } - return $data[$status] ?? ''; - } - - -} diff --git a/niucloud/addon/shop/app/dict/order/OrderLogDict.php b/niucloud/addon/shop/app/dict/order/OrderLogDict.php deleted file mode 100644 index c37c24cbb..000000000 --- a/niucloud/addon/shop/app/dict/order/OrderLogDict.php +++ /dev/null @@ -1,44 +0,0 @@ - get_lang('dict_shop_order_log.store'),//商家 - self::MEMBER => get_lang('dict_shop_order_log.member'),//会员 - self::SYSTEM => get_lang('dict_shop_order_log.system'),//系统 - ]; - if (!$type) { - return $data; - } - return $data[$type] ?? ''; - } - -} diff --git a/niucloud/addon/shop/app/dict/order/OrderRefundDict.php b/niucloud/addon/shop/app/dict/order/OrderRefundDict.php deleted file mode 100644 index d9c8f54aa..000000000 --- a/niucloud/addon/shop/app/dict/order/OrderRefundDict.php +++ /dev/null @@ -1,160 +0,0 @@ - get_lang('dict_shop_order_refund_status.buyer_apply_wait_store'), - self::STORE_AGREE_REFUND_GOODS_APPLY_WAIT_BUYER => get_lang('dict_shop_order_refund_status.store_agree_refund_goods_apply_wait_buyer'), - self::STORE_REFUSE_REFUND_GOODS_APPLY_WAIT_BUYER => get_lang('dict_shop_order_refund_status.store_refuse_refund_goods_apply_wait_buyer'), - self::BUYER_REFUND_GOODS_WAIT_STORE => get_lang('dict_shop_order_refund_status.buyer_refund_goods_wait_store'), - self::STORE_REFUSE_TAKE_REFUND_GOODS_WAIT_BUYER => get_lang('dict_shop_order_refund_status.store_refuse_take_refund_goods_wait_buyer'), - self::STORE_AGREE_REFUND_WAIT_TRANSFER => get_lang('dict_shop_order_refund_status.store_agree_refund_wait_transfer'), - self::STORE_REFUND_TRANSFERING => get_lang('dict_shop_order_refund_status.store_refund_transfering'), - self::FINISH => get_lang('dict_shop_order_refund_status.finish'), - self::CLOSE => get_lang('dict_shop_order_refund_status.close'), - self::SHOP_ACTIVE_CLOSE_REFUND => get_lang('dict_shop_order_refund_status.shop_active_close_refund'), - ]; - if ($status == '') { - return $data; - } - return $data[$status] ?? []; - }//卖家拒绝退货 - - public static function getRefundType(string $type = '') - { - $data = [ - self::ONLY_REFUND => get_lang('dict_shop_order_refund_type.only_refund'), - self::RETURN_AND_REFUND_GOODS => get_lang('dict_shop_order_refund_type.return_and_refund_goods'), - ]; - if (!$type) { - return $data; - } - return $data[$type] ?? []; - }//卖家主动退款 - - /** - * 退款来源方式 - * @param string $type - * @return array|mixed - */ - public static function getSource(string $type = '') - { - $data = [ - self::APPLY => get_lang('dict_shop_order_refund_source.apply'), - self::ACTIVE_REFUND => get_lang('dict_shop_order_refund_source.active_refund'), - ]; - if (!$type) { - return $data; - } - return $data[$type] ?? []; - }//退款完成 - - /** - * 拒绝理由 - * @return array - */ - public static function getRefundReason() - { - return [ - get_lang('dict_shop_order_refund_reason.delivery_timeout'),//未按约定时间发货 - get_lang('dict_shop_order_refund_reason.buy_more_or_dislike'),//拍错/多拍/不喜欢 - get_lang('dict_shop_order_refund_reason.negotiation_completed'),//协商一致退款 - get_lang('dict_shop_order_refund_reason.other'),//其他 - ]; - }//关闭退款 - - /** - * 退款操作类型 - * @param string $type - * @return array|mixed|string - */ - public static function getActionType(string $type = '') - { - $data = [ - self::APPLY_ACTION => get_lang('dict_shop_order_refund_action.apply'), - self::EDIT_APPLY_ACTION => get_lang('dict_shop_order_refund_action.edit_apply'), - self::CLOSE_ACTION => get_lang('dict_shop_order_refund_action.close'), - self::DELIVERY_ACTION => get_lang('dict_shop_order_refund_action.delivery'), - self::EDIT_DELIVERY_ACTION => get_lang('dict_shop_order_refund_action.edit_delivery'), - self::AGREE_AUDIT_APPLY_ACTION => get_lang('dict_shop_order_refund_action.agree_audit_apply'), - self::REFUSE_AUDIT_APPLY_ACTION => get_lang('dict_shop_order_refund_action.refuse_audit_apply_action'), - self::AGREE_AUDIT_REFUND_GOODS_ACTION => get_lang('dict_shop_order_refund_action.agree_audit_refund_goods'), - self::REFUSE_AUDIT_REFUND_GOODS_ACTION => get_lang('dict_shop_order_refund_action.refuse_audit_refund_goods'), - self::FINISH_ACTION => get_lang('dict_shop_order_refund_action.finish'), - self::ACTIVE_REFUND_ACTION => get_lang('dict_shop_order_refund_action.active_refund'), - self::SHOP_ACTIVE_REFUND_ACTION => get_lang('dict_shop_order_refund_action.shop_active_refund'), - ]; - if (!$type) { - return $data; - } - return $data[$type] ?? ''; - } -} diff --git a/niucloud/addon/shop/app/dict/order/OrderRefundLogDict.php b/niucloud/addon/shop/app/dict/order/OrderRefundLogDict.php deleted file mode 100644 index 714961b02..000000000 --- a/niucloud/addon/shop/app/dict/order/OrderRefundLogDict.php +++ /dev/null @@ -1,44 +0,0 @@ - get_lang('dict_shop_order_log.store'),//商家 - self::MEMBER => get_lang('dict_shop_order_log.member'),//会员 - self::SYSTEM => get_lang('dict_shop_order_log.system'),//系统 - ]; - if (!$type) { - return $data; - } - return $data[$type] ?? ''; - } - -} diff --git a/niucloud/addon/shop/app/dict/poster/components.php b/niucloud/addon/shop/app/dict/poster/components.php deleted file mode 100644 index b6a2141f2..000000000 --- a/niucloud/addon/shop/app/dict/poster/components.php +++ /dev/null @@ -1,72 +0,0 @@ - [ - 'title' => get_lang('dict_diy_poster.shop_goods_component_type_basic'), - 'support' => [ 'fenxiao_goods', 'shop_point_goods'], // 支持的插件 - 'list' => [ - 'GoodsImage' => [ - 'title' => "商品图片", - 'type' => 'image', - 'icon' => "iconfont iconshangpintupian", - 'path' => "goods-image", // 属性编辑 - 'uses' => 1, - 'sort' => 10006, - 'relate' => 'goods_img', // 关联字段,空为不处理 - 'value' => '', - 'template' => [ - "width" => 400, // 宽度 - 'height' => 400, // 高度 - 'minWidth' => 60, // 最小宽度 - 'minHeight' => 60, // 最小高度 - ], - ], - 'GoodsName' => [ - 'title' => "商品名称", - 'type' => 'text', - 'icon' => "iconfont icona-Group13", - 'path' => "goods-name", - 'uses' => 1, - 'sort' => 10007, - 'relate' => 'goods_name', // 关联字段,空为不处理 - 'value' => '', - 'template' => [ - "width" => 164, // 宽度 - 'height' => 55, // 高度 - ] - - ], - 'GoodsPrice' => [ - 'title' => "销售价", - 'type' => 'text', - 'icon' => "iconfont iconshoujia", - 'path' => "goods-price", - 'uses' => 1, - 'sort' => 10008, - 'relate' => 'goods_price', // 关联字段,空为不处理 - 'value' => '', - 'template' => [ - "fontFamily" => 'static/font/OPLUSSANS3-REGULAR.ttf', // 字体 - 'width' => 151, // 宽度 - 'height' => 49, // 高度 - ], - ], - 'GoodsMarketPrice' => [ - 'title' => "划线价", - 'type' => 'text', - 'icon' => "iconfont iconhuajiaqian", - 'path' => "goods-market-price", - 'uses' => 1, - 'sort' => 10009, - 'relate' => 'goods_market_price', // 关联字段,空为不处理 - 'value' => '', - 'template' => [ - "fontFamily" => 'static/font/OPLUSSANS3-REGULAR.ttf', // 字体 - 'width' => 170, // 宽度 - 'height' => 48, // 高度 - ], - ] - ] - ], - -]; \ No newline at end of file diff --git a/niucloud/addon/shop/app/dict/poster/template.php b/niucloud/addon/shop/app/dict/poster/template.php deleted file mode 100644 index f18dbc465..000000000 --- a/niucloud/addon/shop/app/dict/poster/template.php +++ /dev/null @@ -1,349 +0,0 @@ - "商品模板", // 海报模板名称 - 'type' => 'shop_goods', // 海报类型 - "data" => [ - "global" => [ - "bgType" => "color", - "bgColor" => "#ffffff", - "bgUrl" => "", - "width" => 720, - "height" => 1280 - ], - "value" => [ - [ - "id" => "2v1nc497xhc0", - "componentName" => "GoodsImage", - "componentTitle" => "商品图片", - "type" => "image", - "path" => "goods-image", - "uses" => 1, - "relate" => "goods_img", - "value" => "", - "width" => 720, - "height" => 720, - "minWidth" => 60, - "minHeight" => 60, - "x" => 0, - "y" => 0, - "angle" => 0, - "zIndex" => 1 - ], - [ - "id" => "29f3czpuw134", - "componentName" => "GoodsName", - "componentTitle" => "商品名称", - "type" => "text", - "path" => "goods-name", - "uses" => 1, - "relate" => "goods_name", - "value" => "", - "width" => 640, - "height" => 94, - "minWidth" => 120, - "minHeight" => 44, - "x" => 40, - "y" => 760, - "angle" => 0, - "zIndex" => 2, - "fontFamily" => "", - "fontSize" => 44, - "weight" => false, - "space" => 0, - "lineHeight" => 1, - "fontColor" => "#303133" - ], - [ - "id" => "2vmf9ovhene0", - "componentName" => "GoodsPrice", - "componentTitle" => "商品价格", - "type" => "text", - "path" => "goods-price", - "uses" => 1, - "relate" => "goods_price", - "value" => "", - "width" => 330, - "height" => 60, - "minWidth" => 120, - "minHeight" => 44, - "x" => 40, - "y" => 940, - "weight" => false, - "space" => 0, - "lineHeight" => 0, - "angle" => 0, - "zIndex" => 3, - "fontFamily" => "static/font/OPLUSSANS3-REGULAR.ttf", - "fontSize" => 44, - "fontColor" => "#E4163F" - ], - [ - "id" => "2vef9ovhene9", - "componentName" => "GoodsMarketPrice", - "componentTitle" => "划线价", - "type" => "text", - 'path' => "goods-market-price", - "uses" => 1, - 'relate' => 'goods_market_price', - "value" => "", - "width" => 330, - "height" => 54, - "minWidth" => 120, - "minHeight" => 44, - "x" => 40, - "y" => 1040, - "angle" => 0, - "zIndex" => 4, - "fontFamily" => "static/font/OPLUSSANS3-REGULAR.ttf", - "fontSize" => 36, - "weight" => false, - "space" => 0, - "lineHeight" => 0, - "fontColor" => "#999999" - ], - [ - "id" => "2rlojy3o60i0", - "componentName" => "Qrcode", - "componentTitle" => "二维码", - "type" => "qrcode", - "path" => "qrcode", - "uses" => 1, - "relate" => "url", - "value" => "", - "width" => 200, - "height" => 200, - "minWidth" => 60, - "minHeight" => 60, - "x" => 480, - "y" => 940, - "angle" => 0, - "zIndex" => 5 - ], - [ - "id" => "7a18udv7t950", - "componentName" => "draw", - "componentTitle" => "绘画", - "type" => "draw", - "path" => "draw", - "uses" => 1, - "relate" => "draw", - "value" => "", - "width" => 720, - "height" => 70, - "minWidth" => 60, - "minHeight" => 60, - "x" => 0, - "y" => 1206, - "angle" => 0, - "zIndex" => 6, - "drawType" => "Polygon", - "bgColor" => "#eeeeee", - "points" => [ - [ - 0, - 1206 - ], - [ - 720, - 1206 - ], - [ - 720, - 1280 - ], - [ - 0, - 1280 - ] - ] - ], - [ - "id" => "6hlj5l3as0w0", - "componentName" => "Text", - "componentTitle" => "文本", - "type" => "text", - "path" => "text", - "uses" => 0, - "relate" => "", - "value" => "长按识别图中的二维码查看商品详情", - "width" => 512, - "height" => 48, - "minWidth" => 120, - "minHeight" => 44, - "x" => 110, - "y" => 1230, - "angle" => 0, - "zIndex" => 7, - "weight" => false, - "space" => 0, - "lineHeight" => 0, - "fontFamily" => "", - "fontSize" => 32, - "fontColor" => "#666666" - ], - ] - ] - ], - [ - "name" => "积分商品模板", // 海报模板名称 - 'type' => 'shop_point_goods', // 海报类型 - "data" => [ - "global" => [ - "bgType" => "color", - "bgColor" => "#ffffff", - "bgUrl" => "", - "width" => 720, - "height" => 1280 - ], - "value" => [ - [ - "id" => "2v1nc497xhc0", - "componentName" => "GoodsImage", - "componentTitle" => "商品图片", - "type" => "image", - "path" => "goods-image", - "uses" => 1, - "relate" => "goods_img", - "value" => "", - "width" => 720, - "height" => 720, - "minWidth" => 60, - "minHeight" => 60, - "x" => 0, - "y" => 0, - "angle" => 0, - "zIndex" => 1 - ], - [ - "id" => "29f3czpuw134", - "componentName" => "GoodsName", - "componentTitle" => "商品名称", - "type" => "text", - "path" => "goods-name", - "uses" => 1, - "relate" => "goods_name", - "value" => "", - "width" => 640, - "height" => 94, - "minWidth" => 120, - "minHeight" => 44, - "x" => 40, - "y" => 760, - "angle" => 0, - "zIndex" => 2, - "fontFamily" => "", - "fontSize" => 44, - "weight" => false, - "space" => 0, - "lineHeight" => 0, - "fontColor" => "#303133" - ], - [ - "id" => "2vmf9ovhene0", - "componentName" => "GoodsPrice", - "componentTitle" => "商品价格", - "type" => "text", - "path" => "goods-price", - "uses" => 1, - "relate" => "goods_price", - "value" => "", - "width" => 330, - "height" => 60, - "minWidth" => 120, - "minHeight" => 44, - "x" => 40, - "y" => 940, - "angle" => 0, - "zIndex" => 3, - "fontFamily" => "", - "fontSize" => 40, - "weight" => false, - "space" => 0, - "lineHeight" => 0, - "fontColor" => "#E4163F" - ], - [ - "id" => "2rlojy3o60i0", - "componentName" => "Qrcode", - "componentTitle" => "二维码", - "type" => "qrcode", - "path" => "qrcode", - "uses" => 1, - "relate" => "url", - "value" => "", - "width" => 200, - "height" => 200, - "minWidth" => 60, - "minHeight" => 60, - "x" => 480, - "y" => 940, - "angle" => 0, - "zIndex" => 5 - ], - [ - "id" => "7a18udv7t950", - "componentName" => "draw", - "componentTitle" => "绘画", - "type" => "draw", - "path" => "draw", - "uses" => 1, - "relate" => "draw", - "value" => "", - "width" => 720, - "height" => 70, - "minWidth" => 60, - "minHeight" => 60, - "x" => 0, - "y" => 1206, - "angle" => 0, - "zIndex" => 6, - "drawType" => "Polygon", - "bgColor" => "#eeeeee", - "points" => [ - [ - 0, - 1206 - ], - [ - 720, - 1206 - ], - [ - 720, - 1280 - ], - [ - 0, - 1280 - ] - ] - ], - [ - "id" => "6hlj5l3as0w0", - "componentName" => "Text", - "componentTitle" => "文本", - "type" => "text", - "path" => "text", - "uses" => 0, - "relate" => "", - "value" => "长按识别图中的二维码查看商品详情", - "width" => 512, - "height" => 48, - "minWidth" => 120, - "minHeight" => 44, - "x" => 110, - "y" => 1230, - "angle" => 0, - "zIndex" => 7, - "fontFamily" => "", - "fontSize" => 32, - "weight" => false, - "space" => 0, - "lineHeight" => 0, - "fontColor" => "#666666" - ], - ] - ] - ] -]; \ No newline at end of file diff --git a/niucloud/addon/shop/app/dict/printer/type.php b/niucloud/addon/shop/app/dict/printer/type.php deleted file mode 100644 index 549a114c8..000000000 --- a/niucloud/addon/shop/app/dict/printer/type.php +++ /dev/null @@ -1,290 +0,0 @@ -getDeliveryList(); -$print_delivery_list = []; -foreach ($delivery_list as $k => $v) { - $print_delivery_list[] = [ - 'name' => $v[ 'name' ], - 'value' => $v[ 'key' ] - ]; -} - -return [ - [ - 'key' => 'shopGoodsOrder', - 'title' => '商品订单', // 模板类型名称 - 'sort' => 10000, - // 触发打印时机,定义何时触发调用 - 'trigger' => [ - 'pay_after' => '付款后', - 'take_delivery' => '收货后', - 'manual' => '手动' - ], - // 根据业务可自行扩展筛选条件 - 'condition' => [ - [ - 'key' => 'print_delivery_type', - 'title' => '配送方式', - 'type' => 'checkbox', - 'list' => $print_delivery_list - ], - // todo 后续如果需要商品类型、订单类型,可以扩展 - ], - 'path' => 'preview-goods-order', // 实时预览组件名称 - // 模板内容 - 'template' => [ - [ - 'key' => 'head_info', - 'title' => '票头', - 'list' => [ - [ - 'key' => 'ticket_name', - 'label' => '小票名称', - 'value' => '小票名称', // 存储的初始值,可以是字符串、数组格式 - 'placeholder' => '', // 输入框占位符 - 'type' => 'input', // 类型,空:无需设置,input:输入框、checkbox:复选框,select:下拉框 - 'status' => 1, // 状态(1:显示,0:隐藏) - 'disabled' => false, // 是否禁止操作显示隐藏 - 'fontSize' => 'normal', // 字号,normal:正常,small:,big:大 - 'fontWeight' => 'normal', // 粗细,normal:正常,weight:加粗 - 'remark' => '', // 说明 - ], - [ - 'key' => 'shop_name', - 'label' => '商城名称', - 'value' => '', - 'type' => '', - 'status' => 1, - 'disabled' => false, - 'fontSize' => 'big', - 'fontWeight' => 'bold', - 'remark' => '', - ], - ] - ], - [ - 'key' => 'order_info', - 'title' => '订单信息', - 'list' => [ - [ - 'key' => 'order_item', - 'label' => '', - 'value' => [ 'order_no', 'order_from', 'pay_type', 'order_status', 'delivery_type', 'create_time', 'pay_time', 'goods_money', 'discount_money', 'delivery_money', 'order_money' ], - 'type' => 'checkbox', - 'status' => 1, - 'fontSize' => '', - 'fontWeight' => '', - 'disabled' => false, - 'remark' => '', - 'list' => [ - 'order_no' => '订单编号', - 'order_from' => '订单来源', - 'order_status' => '订单状态', - 'pay_type' => '支付方式', - 'delivery_type' => '配送方式', - 'create_time' => '下单时间', - 'pay_time' => '付款时间', - 'goods_money' => '商品总额', - 'delivery_money' => '配送金额', - 'discount_money' => '优惠金额', - ] - ], - [ - 'key' => 'order_money', - 'label' => '实付金额', - 'value' => '', - 'type' => '', - 'status' => 1, - 'fontSize' => 'big', - 'fontWeight' => 'bold', - 'remark' => '', - ], - [ - 'key' => 'shop_remark', - 'label' => '商家备注', - 'value' => '', - 'type' => '', - 'status' => 1, - 'disabled' => false, - 'fontSize' => 'normal', - 'fontWeight' => 'bold', - 'remark' => '', - ], - ] - ], - [ - 'key' => 'goods_info', - 'title' => '商品信息', - 'list' => [ - [ - 'key' => 'goods_name', - 'label' => '商品名称', - 'value' => '', - 'type' => '', - 'status' => 1, - 'disabled' => true, - 'fontSize' => 'normal', - 'fontWeight' => 'normal', - 'remark' => '', - ], - [ - 'key' => 'goods_num', - 'label' => '商品数量', - 'value' => '', - 'type' => '', - 'status' => 1, - 'disabled' => true, - 'fontSize' => '', - 'fontWeight' => '', - 'remark' => '', - ], - [ - 'key' => 'goods_price', - 'label' => '商品金额', - 'value' => '', - 'type' => '', - 'status' => 1, - 'disabled' => false, - 'fontSize' => 'normal', - 'fontWeight' => 'normal', - 'remark' => '', - ], - ] - ], - [ - 'key' => 'buyer_info', - 'title' => '买家/收货信息', - 'list' => [ - [ - 'key' => 'member_basic_info', - 'label' => '', - 'value' => [ 'nickname', 'account_balance', 'account_point' ], - 'type' => 'checkbox', - 'status' => 1, - 'disabled' => false, - 'fontSize' => '', - 'fontWeight' => '', - 'remark' => '', - 'list' => [ - 'nickname' => '买家昵称', - 'account_balance' => '账户余额', - 'account_point' => '账户积分', - ] - ], - [ - 'key' => 'buyer_mobile', - 'label' => '买家手机号', - 'value' => 'yes', - 'type' => 'select', - 'status' => 1, - 'disabled' => false, - 'fontSize' => 'normal', - 'fontWeight' => 'normal', - 'remark' => '手机号脱敏可以有效保护用户隐私', - 'text' => '脱敏', - 'list' => [ - 'yes' => '是', - 'no' => '否' - ] - ], - [ - 'key' => 'taker_name', - 'label' => '收货人姓名', - 'value' => '', - 'type' => '', - 'status' => 1, - 'disabled' => false, - 'fontSize' => 'big', - 'fontWeight' => 'bold', - 'remark' => '', - ], - [ - 'key' => 'taker_mobile', - 'label' => '收货人手机号', - 'value' => 'yes', - 'type' => 'select', - 'status' => 1, - 'disabled' => false, - 'fontSize' => 'big', - 'fontWeight' => 'bold', - 'remark' => '手机号脱敏可以有效保护用户隐私', - 'text' => '脱敏', - 'list' => [ - 'yes' => '是', - 'no' => '否' - ] - ], - [ - 'key' => 'taker_full_address', - 'label' => '收货人地址', - 'value' => '', - 'type' => '', - 'status' => 1, - 'disabled' => false, - 'fontSize' => 'big', - 'fontWeight' => 'bold', - 'remark' => '', - ], - [ - 'key' => 'member_remark', - 'label' => '买家备注', - 'value' => '', - 'type' => '', - 'status' => 1, - 'disabled' => false, - 'fontSize' => 'normal', - 'fontWeight' => 'normal', - 'remark' => '', - ], - ] - ], - [ - 'key' => 'bottom_info', - 'title' => '底部信息', - 'list' => [ - [ - 'key' => 'qrcode', - 'label' => '二维码', - 'placeholder' => '二维码内容', - 'value' => '', - 'type' => 'input', - 'status' => 1, - 'disabled' => false, - 'fontSize' => '', - 'fontWeight' => '', - 'remark' => '', - ], - [ - 'key' => 'ticket_print_time', - 'label' => '小票打印时间', - 'value' => '', - 'type' => '', - 'status' => 1, - 'disabled' => false, - 'fontSize' => '', - 'fontWeight' => '', - 'remark' => '', - ], - [ - 'key' => 'bottom_remark', - 'label' => '底部信息', - 'value' => '谢谢惠顾,欢迎下次光临!', - 'placeholder' => '', - 'type' => 'input', - 'status' => 1, - 'disabled' => false, - 'fontSize' => '', - 'fontWeight' => '', - 'remark' => '', - ], - - ] - ] - - ], - ], -]; \ No newline at end of file diff --git a/niucloud/addon/shop/app/dict/recharge/package_gift.php b/niucloud/addon/shop/app/dict/recharge/package_gift.php deleted file mode 100644 index 1df68b790..000000000 --- a/niucloud/addon/shop/app/dict/recharge/package_gift.php +++ /dev/null @@ -1,12 +0,0 @@ - [ - 'name' => '赠送优惠券', - 'value' => [], - //用于充值编辑 - 'edit_component'=>'/src/addon/shop/views/member/components/recharge-gift-coupon.vue', - //用于充值详情展示 - 'detail_component' => '/src/addon/shop/views/member/components/recharge-detail-coupon.vue', - 'sort' => 3 - ], -]; diff --git a/niucloud/addon/shop/app/dict/schedule/schedule.php b/niucloud/addon/shop/app/dict/schedule/schedule.php deleted file mode 100644 index 43fe29844..000000000 --- a/niucloud/addon/shop/app/dict/schedule/schedule.php +++ /dev/null @@ -1,162 +0,0 @@ - 'shop_order_close', - 'name' => '未支付订单自动关闭', - 'desc' => '', - 'time' => [ - 'type' => 'min', - 'min' => 1 - ], - 'class' => 'addon\shop\app\job\order\OrderClose', - 'function' => '' - ], - [ - 'key' => 'shop_order_close_allow_refund', - 'name' => '订单完成自动关闭售后', - 'desc' => '', - 'time' => [ - 'type' => 'min', - 'min' => 1 - ], - 'class' => 'addon\shop\app\job\order\OrderCloseAllowRefund', - 'function' => '' - ], - [ - 'key' => 'shop_order_finish', - 'name' => '待收货订单自动完成', - 'desc' => '', - 'time' => [ - 'type' => 'min', - 'min' => 1 - ], - 'class' => 'addon\shop\app\job\order\OrderFinish', - 'function' => '' - ], - [ - 'key' => 'shop_coupon_member_expire', - 'name' => '优惠券到期自动过期', - 'desc' => '', - 'time' => [ - 'type' => 'min', - 'min' => 1 - ], - 'class' => 'addon\shop\app\job\marketing\CouponMemberExpire', - 'function' => '' - ], - [ - 'key' => 'shop_coupon_start', - 'name' => '优惠券限时自动开启', - 'desc' => '', - 'time' => [ - 'type' => 'min', - 'min' => 1 - ], - 'class' => 'addon\shop\app\job\marketing\CouponStart', - 'function' => '' - ], - [ - 'key' => 'shop_coupon_end', - 'name' => '优惠券限时自动结束', - 'desc' => '', - 'time' => [ - 'type' => 'min', - 'min' => 1 - ], - 'class' => 'addon\shop\app\job\marketing\CouponEnd', - 'function' => '' - ], - [ - 'key' => 'shop_coupon_send', - 'name' => '优惠券自动发放', - 'desc' => '', - 'time' => [ - 'type' => 'min', - 'min' => 1 - ], - 'class' => 'addon\shop\app\job\marketing\CouponSend', - 'function' => '', - 'params'=>['record_id'=>''] - ], - [ - 'key' => 'shop_active_start', - 'name' => '营销活动自动开启', - 'desc' => '', - 'time' => [ - 'type' => 'min', - 'min' => 1 - ], - 'class' => 'addon\shop\app\job\marketing\ActiveStart', - 'function' => '' - ], - [ - 'key' => 'shop_active_end', - 'name' => '营销活动自动结束', - 'desc' => '', - 'time' => [ - 'type' => 'min', - 'min' => 1 - ], - 'class' => 'addon\shop\app\job\marketing\ActiveEnd', - 'function' => '' - ], - [ - 'key' => 'shop_manjiansong_start', - 'name' => '满减送自动开始', - 'desc' => '', - 'time' => [ - 'type' => 'min', - 'min' => 1 - ], - 'class' => 'addon\shop\app\job\marketing\ManjianStart', - 'function' => '' - ], - [ - 'key' => 'shop_manjiansong_end', - 'name' => '满减送自动结束', - 'desc' => '', - 'time' => [ - 'type' => 'min', - 'min' => 1 - ], - 'class' => 'addon\shop\app\job\marketing\ManjianEnd', - 'function' => '' - ], - [ - 'key' => 'shop_goods_statistical_update', - 'name' => '商品统计更新', - 'desc' => '', - 'time' => [ - 'type' => 'day', - 'day' => 1, - 'min' => 1, - 'hour' => 0 - ], - 'class' => 'addon\shop\app\job\goods\GoodsStatisticalUpdate', - 'function' => '' - ], - [ - 'key' => 'shop_discount_start', - 'name' => '限时折扣自动开启', - 'desc' => '', - 'time' => [ - 'type' => 'min', - 'min' => 1 - ], - 'class' => 'addon\shop\app\job\marketing\DiscountStart', - 'function' => '' - ], - [ - 'key' => 'shop_discount_end', - 'name' => '限时折扣自动结束', - 'desc' => '', - 'time' => [ - 'type' => 'min', - 'min' => 1 - ], - 'class' => 'addon\shop\app\job\marketing\DiscountEnd', - 'function' => '' - ], - -]; diff --git a/niucloud/addon/shop/app/dict/shop_delivery/ShopDeliveryDict.php b/niucloud/addon/shop/app/dict/shop_delivery/ShopDeliveryDict.php deleted file mode 100644 index 0cfb964c2..000000000 --- a/niucloud/addon/shop/app/dict/shop_delivery/ShopDeliveryDict.php +++ /dev/null @@ -1,42 +0,0 @@ - [ - 'name' => '商家配送', - 'key' => self::MERCHANT, - //配置参数 - 'params' => [], - 'component' => '', - 'business_list' => '', - 'extend_data' => [], - //商家配送标识 - 'is_merchant' => 1 - ], - ]; - return $system; - } - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/dict/shop_delivery/ShopDeliveryStatusDict.php b/niucloud/addon/shop/app/dict/shop_delivery/ShopDeliveryStatusDict.php deleted file mode 100644 index 6763f752a..000000000 --- a/niucloud/addon/shop/app/dict/shop_delivery/ShopDeliveryStatusDict.php +++ /dev/null @@ -1,58 +0,0 @@ - get_lang('dict_shop_local_delivery_status.in_delivery'), //配送中, - self::COMPLETED => get_lang('dict_shop_local_delivery_status.completed'), //已完成, - self::CANCELED => get_lang('dict_shop_local_delivery_status.canceled'), //已取消, - ]; - } - - - /** - * 转换配送状态 - * @param $status - * @return int - */ - public static function convertStatus($status) - { - switch ($status) { - case self::IN_DELIVERY: - return LocalDeliveryStatusDict::IN_DELIVERY;// 配送中 - case self::COMPLETED: - return LocalDeliveryStatusDict::COMPLETED;//已完成 - case self::CANCELED: - return LocalDeliveryStatusDict::CANCELED;//已取消 - } - return 0; - } -} diff --git a/niucloud/addon/shop/app/dict/sow_community/package_gift.php b/niucloud/addon/shop/app/dict/sow_community/package_gift.php deleted file mode 100644 index 86ca9f8d7..000000000 --- a/niucloud/addon/shop/app/dict/sow_community/package_gift.php +++ /dev/null @@ -1,10 +0,0 @@ - [ - 'name' => '赠送优惠券', - 'value' => [], - //用于编辑 - 'edit_component'=>'/src/addon/shop/views/sow_community/components/sow-community-gift-coupon.vue', - 'sort' => 3 - ], -]; diff --git a/niucloud/addon/shop/app/event.php b/niucloud/addon/shop/app/event.php deleted file mode 100644 index db092d64a..000000000 --- a/niucloud/addon/shop/app/event.php +++ /dev/null @@ -1,209 +0,0 @@ - [ - - ], - 'listen' => [ - // 手机端初始化加载事件 - 'initWap' => [ - 'addon\shop\app\listener\config\initWapListener' - ], - - // 添加/编辑商品之后的事件 - 'AfterGoodsEdit' => [ - 'addon\shop\app\listener\point_exchange\AfterGoodsEdit' - ], - // 订单创建 - 'ShopOrderCreate' => [ - 'addon\shop\app\listener\order\ShopOrderCreate', - ], - //订单创建时 优惠抵扣减免业务 - 'ShopOrderDiscountCreate' => [ - 'addon\shop\app\listener\point_exchange\ShopOrderDiscountCreate' //积分商城兑换 - ], - //订单创建后 - 'AfterShopOrderCreate' => [ - 'addon\shop\app\listener\order\AfterShopOrderCreate', - 'addon\shop\app\listener\point_exchange\AfterShopOrderCreate', - ], - - //订单支付后 - 'AfterShopOrderPay' => [ - 'addon\shop\app\listener\order\AfterShopOrderPay', - ], - //订单发货后 - 'AfterShopOrderDelivery' => ['addon\shop\app\listener\order\AfterShopOrderDelivery'], - //订单收货后 - 'AfterShopOrderFinish' => ['addon\shop\app\listener\order\AfterShopOrderFinish'], - //订单编辑价格后 - 'AfterShopOrderEditPrice' => ['addon\shop\app\listener\order\AfterShopOrderEditPrice'], - //订单关闭后 - 'AfterShopOrderClose' => [ - 'addon\shop\app\listener\order\AfterShopOrderClose', - 'addon\shop\app\listener\point_exchange\AfterShopOrderClose', //积分商城业务 - ], - //计算活动信息 - 'ShopGoodsMarketCalculate' => [ - 'addon\shop\app\listener\marketing\ShopNewcomerCalculate', //新人专享 - ], - /***************************************************** 退款 start *****************************************************/ - 'AfterShopOrderRefundApply' => ['addon\shop\app\listener\refund\AfterShopOrderRefundApply'], - 'AfterShopOrderRefundAuditApply' => ['addon\shop\app\listener\refund\AfterShopOrderRefundAuditApply'], - 'AfterShopOrderRefundAuditRefundGoods' => ['addon\shop\app\listener\refund\AfterShopOrderRefundAuditRefundGoods'], - 'AfterShopOrderRefundClose' => ['addon\shop\app\listener\refund\AfterShopOrderRefundClose'], - 'AfterShopOrderRefundDelivery' => ['addon\shop\app\listener\refund\AfterShopOrderRefundDelivery'], - 'AfterShopOrderRefundEdit' => ['addon\shop\app\listener\refund\AfterShopOrderRefundEdit'], - 'AfterShopOrderRefundEditDelivery' => ['addon\shop\app\listener\refund\AfterShopOrderRefundEditDelivery'], - 'AfterShopOrderRefundFinish' => [ - 'addon\shop\app\listener\refund\AfterShopOrderRefundFinish', - ], - 'AfterShopOrderRefundActiveCreate' => ['addon\shop\app\listener\refund\AfterShopOrderRefundActiveCreate'], - /***************************************************** 退款 end *****************************************************/ - - 'ShopPromotion' => ['addon\shop\app\listener\app\ShopPromotionListener'], - 'WapIndex' => ['addon\shop\app\listener\WapIndexListener'], - 'BottomNavigation' => ['addon\shop\app\listener\BottomNavigationListener'], - - //支付 - 'PayCreate' => ['addon\shop\app\listener\pay\PayCreateListener'], - 'PaySuccess' => ['addon\shop\app\listener\pay\PaySuccessListener'], - 'PayTradeInfo' => ['addon\shop\app\listener\order\ShopOrderTradeInfoListener'], //订单交易信息 - 'RefundSuccess' => ['addon\shop\app\listener\pay\RefundSuccessListener'], - - 'NoticeData' => [ - 'addon\shop\app\listener\notice_template\OrderPay', - 'addon\shop\app\listener\notice_template\OrderPayRemind', - 'addon\shop\app\listener\notice_template\OrderDelivery', - 'addon\shop\app\listener\notice_template\RefundAgree', - 'addon\shop\app\listener\notice_template\RefundRefuse', - ], - //优惠券 - 'CouponReceiveType' => ['addon\shop\app\listener\coupon\CouponReceiveListener'], - 'CouponCheck' => ['addon\shop\app\listener\coupon\CouponCheckListener'], - - //获取海报数据 - 'GetPosterType' => ['addon\shop\app\listener\poster\ShopPosterType'], - 'GetPosterData' => ['addon\shop\app\listener\poster\ShopPoster'], - - //导出数据类型 - 'ExportDataType' => [ - //订单列表导出 - 'addon\shop\app\listener\order_export\ShopOrderExportTypeListener', - //订单项导出 - 'addon\shop\app\listener\order_export\ShopOrderGoodsExportTypeListener', - //退款售后导出 - 'addon\shop\app\listener\refund_export\ShopOrderRefundExportTypeListener', - //发票列表导出 - 'addon\shop\app\listener\order_export\ShopInvoiceExportTypeListener', - ], - //导出数据源 - 'ExportData' => [ - //订单列表导出 - 'addon\shop\app\listener\order_export\ShopOrderExportDataListener', - //订单项导出 - 'addon\shop\app\listener\order_export\ShopOrderGoodsExportDataListener', - //退款售后导出 - 'addon\shop\app\listener\refund_export\ShopOrderRefundExportDataListener', - //发票列表导出 - 'addon\shop\app\listener\order_export\ShopInvoiceExportDataListener', - ], - //商城统计执行 - 'StatExecute' => ['addon\shop\app\listener\stat\StatExecuteListener'], - //商城统计字段 - 'StatField' => ['addon\shop\app\listener\stat\StatFieldListener'], - //核销 - 'VerifyType' => ['addon\shop\app\listener\verify\VerifyTypeListener'], - 'VerifyCreate' => ['addon\shop\app\listener\verify\VerifyCreateListener'], - 'Verify' => ['addon\shop\app\listener\verify\VerifyListener'], - 'VerifyInfo' => ['addon\shop\app\listener\verify\VerifyInfoListener'], - 'VerifyCheck' => ['addon\shop\app\listener\verify\VerifyCheckListener'], - - 'GetGoodsJoinInfo' => [ - 'addon\shop\app\listener\marketing\GetGoodsJoinInfo', -// 'addon\pintuan\app\listener\GetGoodsJoinInfo' - ], - 'ActiveSaveAfter' => [ - 'addon\shop\app\listener\marketing\ShopActiveSaveAfter' - ], - //通过支付信息获取手机端订单详情路径 - 'WapOrderDetailPath' => [ - 'addon\shop\app\listener\order\WapOrderDetailPathListener', - ], - - 'PrinterContent' => [ - 'addon\shop\app\listener\printer\PrinterContentListener' - ], - - //新人专享 - 'NewcomerActiveJoin' => ['addon\shop\app\listener\marketing\NewcomerActiveJoinListener'], - //会员登录后事件 - 'MemberLoginAfter' => ['addon\shop\app\listener\MemberLoginAfterListener'], - - // 会员充值 赠送内容 - 'RechargeGiftContent' => ['addon\shop\app\listener\recharge\GiftContentListener'], - // 会员充值成功后的事件 - 'RechargeAfterListener' => ['addon\shop\app\listener\recharge\RechargeAfterListener'], - - //获取宝贝数据 - 'TreasureType' => ['addon\shop\app\listener\treasure\TreasureTypeListener'], - 'TreasureData' => ['addon\shop\app\listener\treasure\TreasureDataListener'], - - //主题色 - 'ThemeColor' => ['addon\shop\app\listener\diy\ThemeColorListener'], - //万能表单删除前 - 'BeforeFormDelete' => ['addon\shop\app\listener\diy\BeforeFormDeleteListener'], - //查询营销列表 - 'ShowMarketing' => [ - 'addon\shop\app\listener\system\ShowMarketingListener' - ], - 'ShowCustomer' => [ - 'addon\shop\app\listener\system\ShowCustomerListener' - ], - //获取商品展示价格 - 'GoodsShowPrice' => ['addon\shop\app\listener\goods\GoodsShowPriceListener'], - - // 种草奖励发放优惠券 - 'SettleRewardListener' => ['addon\shop\app\listener\sow_community\SettleRewardListener'], - - // 种草奖励优惠券 - 'RuleContentListener' => ['addon\shop\app\listener\sow_community\RuleContentListener'], - - - //三方插件对接 - //第三方通用插件订单备份 - //同步订单到商城 - 'ThirdAddonOrderBackUp' => ['addon\shop\app\listener\third_addon\order\BackUpThirdOrderListener'], - //获取订单后续操作路径 退款 服务 - 'ThirdAddonOrderPath' => ['addon\shop\app\listener\third_addon\order\OrderServicePathListener'], - //输出当前插件/应用名称及标识 - 'ThirdAddonOutputSource' => ['addon\shop\app\listener\third_addon\SupportAddonListener'], - 'ThirdAddonOutputData' => ['addon\shop\app\listener\third_addon\goods\GoodsOutPutDataListener'], - 'ThirdAddonOutputWhere' => ['addon\shop\app\listener\third_addon\goods\GoodsOutPutWhereInitListener'], - //商品详情 - 'ThirdAddonOutputDataInfo' => ['addon\shop\app\listener\third_addon\goods\GoodsOutPutDataInfoListener' ], - //三方订单附加费用 - 'ThirdAddonOrderAmount' => ['addon\shop\app\listener\third_addon\order\OrderAmountServiceListener'], - - - //获取商品配送费用 - 'ThirdAddonOrderDelivery' => ['addon\shop\app\listener\third_addon\order\OrderDeliveryServiceListener'], - - /***************************************************** 同城配送 start *****************************************************/ - //配送方式 - 'LocalDeliveryType' => ['addon\shop\app\listener\local_delivery\dada\local_delivery_type\LocalDeliveryTypeListener'], - //订单取消原因 - 'OrderCancelReason' => ['addon\shop\app\listener\local_delivery\dada\order\OrderCancelReasonListener'], - //配送订单操作前置状态 - 'DeliveryOrderPreStatus' => [ - 'addon\shop\app\listener\local_delivery\dada\order\OrderPreStatusListener', - 'addon\shop\app\listener\shop_delivery\OrderPreStatusListener' - ], - //获取同城配送轨迹 - 'GetLocalDeliveryTrack' => ['addon\shop\app\listener\local_delivery\dada\order\GetLocalDeliveryTrack'], - - /***************************************************** 同城配送 end *****************************************************/ - ], - 'subscribe' => [ - ], -]; diff --git a/niucloud/addon/shop/app/job/delivery/DeliveryShopEditJob.php b/niucloud/addon/shop/app/job/delivery/DeliveryShopEditJob.php deleted file mode 100644 index e04b917a9..000000000 --- a/niucloud/addon/shop/app/job/delivery/DeliveryShopEditJob.php +++ /dev/null @@ -1,27 +0,0 @@ -batchDeliveryShopEdit($id); - return true; - } -} diff --git a/niucloud/addon/shop/app/job/goods/GoodsEvaluateStat.php b/niucloud/addon/shop/app/job/goods/GoodsEvaluateStat.php deleted file mode 100644 index 395fc9639..000000000 --- a/niucloud/addon/shop/app/job/goods/GoodsEvaluateStat.php +++ /dev/null @@ -1,38 +0,0 @@ -updateGoodsEvaluateNumBach($evaluate_ids); - return true; - } catch (\Exception $e) { - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/goods/GoodsStatisticalUpdate.php b/niucloud/addon/shop/app/job/goods/GoodsStatisticalUpdate.php deleted file mode 100644 index 4b4023965..000000000 --- a/niucloud/addon/shop/app/job/goods/GoodsStatisticalUpdate.php +++ /dev/null @@ -1,37 +0,0 @@ -syncStatGoods(); - return true; - } catch (\Exception $e) { - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/marketing/ActiveEnd.php b/niucloud/addon/shop/app/job/marketing/ActiveEnd.php deleted file mode 100644 index b9a1998b7..000000000 --- a/niucloud/addon/shop/app/job/marketing/ActiveEnd.php +++ /dev/null @@ -1,48 +0,0 @@ -where([ - [ 'active_status', '=', ActiveDict::ACTIVE ], - ])->whereBetweenTime('end_time', 1, time())->column('active_id');//过滤end_time=0的情况,0表示活动永久有效 - - foreach ($ids as $k => $v) { - ( new CoreActiveService() )->end($v); - } - - return true; - } catch (\Exception $e) { - Log::write('活动自动关闭error' . $e->getMessage() . $e->getFile() . $e->getLine()); - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/marketing/ActiveEndAfter.php b/niucloud/addon/shop/app/job/marketing/ActiveEndAfter.php deleted file mode 100644 index c5ef8fa78..000000000 --- a/niucloud/addon/shop/app/job/marketing/ActiveEndAfter.php +++ /dev/null @@ -1,36 +0,0 @@ -where([ ['active_id', '=', $active_id] ])->findOrEmpty()->toArray(); - event('ActiveEndAfter', $info); - return true; - } catch (\Exception $e) { - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/marketing/ActiveStart.php b/niucloud/addon/shop/app/job/marketing/ActiveStart.php deleted file mode 100644 index 688242cc7..000000000 --- a/niucloud/addon/shop/app/job/marketing/ActiveStart.php +++ /dev/null @@ -1,49 +0,0 @@ -where([ - ['active_status', '=', ActiveDict::NOT_ACTIVE], - ['start_time', '<=', time()] - ])->column('active_id'); - - foreach($ids as $k => $v){ - (new CoreActiveService())->start($v); - } - - return true; - } catch (\Exception $e) { - Log::write('活动自动开启error'.$e->getMessage().$e->getFile().$e->getLine()); - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/marketing/ActiveStartAfter.php b/niucloud/addon/shop/app/job/marketing/ActiveStartAfter.php deleted file mode 100644 index b18eb91f6..000000000 --- a/niucloud/addon/shop/app/job/marketing/ActiveStartAfter.php +++ /dev/null @@ -1,36 +0,0 @@ -where([ ['active_id', '=', $active_id] ])->findOrEmpty()->toArray(); - event('ActiveStartAfter', $info); - return true; - } catch (\Exception $e) { - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/marketing/CouponEnd.php b/niucloud/addon/shop/app/job/marketing/CouponEnd.php deleted file mode 100644 index 3da0f2b12..000000000 --- a/niucloud/addon/shop/app/job/marketing/CouponEnd.php +++ /dev/null @@ -1,48 +0,0 @@ -where([ - ['status', '=', CouponDict::NORMAL], - ['start_time', '>', 0], - ['end_time', '>', 0], - ['end_time', '<=', time()] - ])->column('id'); - if(!empty($ids)){ - //修改状态 - (new CoreCouponService())->couponExpire($ids); - } - return true; - } catch (\Exception $e) { - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/marketing/CouponMemberExpire.php b/niucloud/addon/shop/app/job/marketing/CouponMemberExpire.php deleted file mode 100644 index 022939ef1..000000000 --- a/niucloud/addon/shop/app/job/marketing/CouponMemberExpire.php +++ /dev/null @@ -1,44 +0,0 @@ -where([ - ['status', '=', CouponMemberDict::WAIT_USE], - ['expire_time', '<=', time()] - ])->column('id'); - if(!empty($ids)){ - //过期 - (new CoreCouponMemberService())->expire($ids); - } - return true; - } catch (\Exception $e) { - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/marketing/CouponSend.php b/niucloud/addon/shop/app/job/marketing/CouponSend.php deleted file mode 100644 index ee6fa8f38..000000000 --- a/niucloud/addon/shop/app/job/marketing/CouponSend.php +++ /dev/null @@ -1,104 +0,0 @@ -where([ - ['id', '=', $record_id] - ])->update([ - 'status' => CouponDict::SEND_STATUS_PROGRESS, - ]); - Db::startTrans(); - try { - $records_info = (new CouponSendRecord())->where([ - ['id', '=', $record_id] - ])->findOrEmpty()->toArray(); - $memberIds = $this->getMemberIds($records_info['range_type'], $records_info['range_param']); - Log::write("CouponSend 发送优惠券id {$record_id} 会员id数组:" . json_encode($memberIds, 256)); - $success_num = (new CoreCouponMemberService())->sendCoupon( $memberIds, $records_info['coupon_id'], $records_info['send_num']); - (new CouponSendRecord())->where([['id', '=', $record_id]])->update([ - 'status' => CouponDict::SEND_STATUS_FINISH, - 'success_num' => $success_num, - 'end_time' => time(), - 'update_time' => time() - ]); - Db::commit(); - return true; - } catch (\Exception $e) { - Log::error('CouponSend 发送优惠券失败' . $e->getMessage() . $e->getLine()); - Db::rollback(); - return false; - } - } - - /** - * 获取发送用户数量 - * @param $range_type - * @param $range_param - * @return array - * @throws \think\db\exception\DbException - */ - public function getMemberIds($range_type, $range_param) - { - switch ($range_type) { - case CouponDict::SEND_RANGE_ALL: - $member_ids = (new Member())->where([ - ['member_id', '>', 0] - ])->column('member_id'); - break; - case CouponDict::SEND_RANGE_MEMBER: - $member_ids = $range_param['member_ids']; - break; - case CouponDict::SEND_RANGE_MEMBER_LEVEL: - $member_level = $range_param['member_level']; - $member_ids = (new Member())->where([ - ['member_level', 'in', implode(',', $member_level)] - ])->column('member_id'); - break; - case CouponDict::SEND_RANGE_MEMBER_LABEL: - $member_label = $range_param['member_label']; - $member_ids = (new Member())->where([ - ['member_id', '>', 0] - ])->withSearch(['member_label'], ['member_label' => $member_label])->column('member_id'); - break; - default: - $member_ids = 0; - break; - } - return array_values($member_ids ?? []) ?? []; - } -} diff --git a/niucloud/addon/shop/app/job/marketing/CouponStart.php b/niucloud/addon/shop/app/job/marketing/CouponStart.php deleted file mode 100644 index 5c2b3ffe7..000000000 --- a/niucloud/addon/shop/app/job/marketing/CouponStart.php +++ /dev/null @@ -1,48 +0,0 @@ -where([ - ['status', '=', CouponDict::WAIT_START], - ['start_time', '>', 0], - ['start_time', '<=', time()], - ['end_time', '>', time()] - ])->column('id'); - if(!empty($ids)){ - //修改状态 - (new CoreCouponService())->couponNormal($ids); - } - return true; - } catch (\Exception $e) { - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/marketing/DiscountEnd.php b/niucloud/addon/shop/app/job/marketing/DiscountEnd.php deleted file mode 100644 index 427c34449..000000000 --- a/niucloud/addon/shop/app/job/marketing/DiscountEnd.php +++ /dev/null @@ -1,51 +0,0 @@ -where([ - ['status', '=', DiscountDict::ACTIVE], - ])->whereBetweenTime('end_time', 1, time())->column('discount_id');//过滤end_time=0的情况,0表示活动永久有效 - - (new Discount())->where([['discount_id', 'in', $ids], ['status', '=', DiscountDict::ACTIVE], ['end_time', '<=', time()]])->update(['status' => DiscountDict::END]); - (new DiscountGoods())->where([['discount_id', 'in', $ids]])->update(['status' => DiscountDict::END]); - (new DiscountService())->discountEndAfter($ids); - return true; - } catch (\Exception $e) { - Log::error('DiscountEnd 限时折扣自动关闭error' . $e->getMessage() . $e->getFile() . $e->getLine()); - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/marketing/DiscountStart.php b/niucloud/addon/shop/app/job/marketing/DiscountStart.php deleted file mode 100644 index bd98a482a..000000000 --- a/niucloud/addon/shop/app/job/marketing/DiscountStart.php +++ /dev/null @@ -1,48 +0,0 @@ -where([ - ['status', '=', DiscountDict::NOT_ACTIVE], - ['start_time', '<=', time()] - ])->column('discount_id'); - (new Discount())->where([ ['discount_id', 'in', $ids], ['status', '=', DiscountDict::NOT_ACTIVE], ['start_time', '<=', time()] ])->update([ 'status' => DiscountDict::ACTIVE ]); - (new DiscountGoods())->where([ ['discount_id', 'in', $ids]])->update([ 'status' => DiscountDict::ACTIVE ]); - ( new DiscountService() )->discountStartAfter($ids); - return true; - } catch (\Exception $e) { - Log::write('限时折扣自动开启error'.$e->getMessage().$e->getFile().$e->getLine()); - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/marketing/ManjianEnd.php b/niucloud/addon/shop/app/job/marketing/ManjianEnd.php deleted file mode 100644 index 87b18a265..000000000 --- a/niucloud/addon/shop/app/job/marketing/ManjianEnd.php +++ /dev/null @@ -1,45 +0,0 @@ -where([ - ['status', '=', ManjianDict::ACTIVE], - ])->whereBetweenTime('end_time', 1, time())->column('manjian_id');//过滤end_time=0的情况,0表示活动永久有效 - (new Manjian())->where([['manjian_id', 'in', $ids], ['status', '=', ManjianDict::ACTIVE], ['end_time', '<=', time()]])->update(['status' => ManjianDict::END]); - (new ManjianGoods())->where([['manjian_id', 'in', $ids]])->update(['status' => ManjianDict::END]); - return true; - } catch (\Exception $e) { - Log::write('满减送自动关闭error' . $e->getMessage() . $e->getFile() . $e->getLine()); - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/marketing/ManjianStart.php b/niucloud/addon/shop/app/job/marketing/ManjianStart.php deleted file mode 100644 index 61493ef8e..000000000 --- a/niucloud/addon/shop/app/job/marketing/ManjianStart.php +++ /dev/null @@ -1,46 +0,0 @@ -where([ - ['status', '=', ManjianDict::NOT_ACTIVE], - ['start_time', '<=', time()] - ])->column('manjian_id'); - (new Manjian())->where([['manjian_id', 'in', $ids], ['status', '=', ManjianDict::NOT_ACTIVE], ['start_time', '<=', time()]])->update(['status' => ManjianDict::ACTIVE]); - (new ManjianGoods())->where([['manjian_id', 'in', $ids]])->update(['status' => ManjianDict::ACTIVE]); - return true; - } catch (\Exception $e) { - Log::write('满减送自动开启error' . $e->getMessage() . $e->getFile() . $e->getLine()); - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/marketing/NewcomerSaveAfter.php b/niucloud/addon/shop/app/job/marketing/NewcomerSaveAfter.php deleted file mode 100644 index 242a42470..000000000 --- a/niucloud/addon/shop/app/job/marketing/NewcomerSaveAfter.php +++ /dev/null @@ -1,38 +0,0 @@ -afterSave(); - return true; - } catch (\Exception $e) { - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/order/OrderClose.php b/niucloud/addon/shop/app/job/order/OrderClose.php deleted file mode 100644 index f8ffd0e5c..000000000 --- a/niucloud/addon/shop/app/job/order/OrderClose.php +++ /dev/null @@ -1,53 +0,0 @@ -where([ - ['status', '=', OrderDict::WAIT_PAY], - ['timeout', '<=', time()], - ['timeout', '>', 0] - ])->select(); - if(!$list->isEmpty()){ - foreach($list as $v){ - $data['order_id'] = $v['order_id']; - try { - (new CoreOrderCloseService())->close($data); - } catch (\Throwable $e) { - Log::write(date('Y-m-d H:i:s'). ',订单自动关闭失败:'. $e->getMessage(). '_'. $e->getFile(). '_'. $e->getLine()); - } - } - } - return true; - } - -} diff --git a/niucloud/addon/shop/app/job/order/OrderCloseAllowRefund.php b/niucloud/addon/shop/app/job/order/OrderCloseAllowRefund.php deleted file mode 100644 index a0540e96a..000000000 --- a/niucloud/addon/shop/app/job/order/OrderCloseAllowRefund.php +++ /dev/null @@ -1,70 +0,0 @@ -where([ - [ 'status', '=', OrderDict::FINISH ], - [ 'timeout', '<=', time() ], - [ 'is_enable_refund', '=', 1 ] - ])->select(); - if (!$list->isEmpty()) { - //订单设置 - $list->update([ 'is_enable_refund' => 0, 'timeout' => 0 ]); - $order_ids = array_column($list->toArray(), 'order_id'); - //订单项设置 - ( new OrderGoods() )->where([ - [ 'order_id', 'in', $order_ids ] - ])->update([ 'is_enable_refund' => 0 ]); - //写日志 - $log_data = []; - $lot_template = [ - 'status' => OrderDict::FINISH, - 'main_type' => $main_type,//todo 可以是传入的 - 'main_id' => $main_id, - 'type' => OrderDict::ORDER_CLOSE_ALLOW_REFUND_ACTION, - 'content' => '', - 'create_time' => time() - ]; - foreach ($list as $v) { - $lot_template[ 'order_id' ] = $v[ 'order_id' ]; - $log_data[] = $lot_template; - } - ( new CoreOrderLogService() )->addAll($log_data); - } - - return true; - } catch (\Exception $e) { - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/order/OrderFinish.php b/niucloud/addon/shop/app/job/order/OrderFinish.php deleted file mode 100644 index bdf97225a..000000000 --- a/niucloud/addon/shop/app/job/order/OrderFinish.php +++ /dev/null @@ -1,52 +0,0 @@ -where([ - ['status', '=', OrderDict::WAIT_TAKE], - ['timeout', '<=', time()], - ['timeout', '>', 0] - ])->select(); - if(!$list->isEmpty()){ - foreach($list as $v){ - $data['order_id'] = $v['order_id']; - try { - (new CoreOrderFinishService())->finish($data); - } catch (\Throwable $e) { - Log::write(date('Y-m-d H:i:s'). ',订单自动收货完成失败:'. $e->getMessage(). '_'. $e->getFile(). '_'. $e->getLine()); - } - } - } - return true; - } - -} diff --git a/niucloud/addon/shop/app/job/order/OrderPayRemind.php b/niucloud/addon/shop/app/job/order/OrderPayRemind.php deleted file mode 100644 index 849cef916..000000000 --- a/niucloud/addon/shop/app/job/order/OrderPayRemind.php +++ /dev/null @@ -1,36 +0,0 @@ -send('shop_order_pay_remind', ['order_id' => $order_id ]); - return true; - } catch (\Exception $e) { - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/order_event/OrderBatchDeliveryJob.php b/niucloud/addon/shop/app/job/order_event/OrderBatchDeliveryJob.php deleted file mode 100644 index f933084d3..000000000 --- a/niucloud/addon/shop/app/job/order_event/OrderBatchDeliveryJob.php +++ /dev/null @@ -1,35 +0,0 @@ -execute($id); - return true; - } catch (\Exception $e) { - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/job/order_event/OrderCloseAfter.php b/niucloud/addon/shop/app/job/order_event/OrderCloseAfter.php deleted file mode 100644 index 65b03bd13..000000000 --- a/niucloud/addon/shop/app/job/order_event/OrderCloseAfter.php +++ /dev/null @@ -1,31 +0,0 @@ -$key($addon); - return true; - } - - /** - * 订单统计 - * @param $addon - * @return void - */ - public function shopOrder($addon) - { -// ['addon' =>, 'date' => ['year' => , 'month'=> , 'day' => , 'hour' => ], 'data' => ['shop_order_money' => 12, 'member' => 12]] - $orderModel = new Order(); - $order_money = $orderModel->where([ [ 'status', '>', 0 ] ])->sum('order_money'); - $param = [ - 'addon' => $addon, - 'date' => [ - 'year' => date('Y'), - 'month' => date('m'), - 'day' => date('d'), - 'hour' => date('H'), - ], - 'data' => [ - 'order_money' => $order_money - ] - ]; - ( new CoreStatService() )->add($param); - - } - - /** - * @param $addon - * @return void - */ - public function shopRechargeOrder($addon) - { - - } - -} diff --git a/niucloud/addon/shop/app/lang/en/api.php b/niucloud/addon/shop/app/lang/en/api.php deleted file mode 100644 index 6dd355233..000000000 --- a/niucloud/addon/shop/app/lang/en/api.php +++ /dev/null @@ -1,4 +0,0 @@ - '订单不存在', - 'SHOP_ORDER_IS_INVALID' => '订单已失效', - 'SHOP_ONLY_WAIT_TAKE_CAN_BE_TAKE' => '只有待收货的订单才可以收货', - 'SHOP_ONLY_WAIT_DELIVERY_CAN_BE_DELIVERY' => '只有待发货的订单才可以发货', - 'SHOP_ONLY_WAIT_PAY_CAN_BE_PAY' => '只有待支付的订单可以支付', - 'SHOP_GOODS_CATEGORY_NOT_EXIST' => '分类不存在', - 'SHOP_GOODS_CATEGORY_EXIST_CHILD' => '当前分类存在下级,不可修改为该上级', - 'SHOP_GOODS_CATEGORY_EXIST_GOODS' => '当前分类下存在商品,不可删除', - 'SHOP_GOODS_NOT_EXIST' => '商品不存在', - 'SHOP_GOODS_LABEL_NAME_REPEAT'=>'标签名称重复', - 'SHOP_GOODS_LABEL_IN_USE'=>'该标签正在使用中', - 'NOT_SUPPORT_DELIVERY_TYPE' => '不支持选择的配送方式', - 'NOT_SELECT_STORE' => '请选择自提点', - 'EXIST_ORDER_NOT_DELETE_GOODS' => '存在未完成的订单,无法删除商品', - 'EXIST_ORDER_NOT_EDIT_GOODS' => '存在未完成的订单,无法编辑商品', - 'COUPON_STOCK_INSUFFICIENT' => '优惠券已领完', - 'COUPON_NOT_EXIST' => '优惠券不存在', - 'COUPON_INVALID' => '优惠券已失效', - 'COUPON_CAN_NOT_MANUAL_RECEIVE' => '该优惠券不可手动领取', - 'COUPON_RECEIVE_NOT_TIME' => '优惠券不在领取时间范围内', - 'COUPON_RECEIVE_EXCESS' => '已领取数量超过限制领取数量,不可领取', - 'COUPON_RECEIVE_TYPE_NOT_EXIST' => '优惠券领取方式有误', - 'COUPON_RECEIVE_SUCCESS' => '领取成功', - 'MEMBER_ALREADY_COLLECT' => '已收藏,不可重复收藏', - 'CANCEL_COLLECT_SUCCESS' => '取消收藏成功', - 'CANCEL_SUCCESS' => '取消成功', - - 'SHOP_COUPON_IS_USED_OR_EXIST' => '优惠券不存在或已使用', - 'SHOP_COUPON_VALID_END_TIME_NOT_ALLOW_LT_START_TIME' => '优惠券的有效期结束时间不能小于当前时间', - 'SHOP_COUPON_IN_USE_NOT_ALLOW_EDIT' => '优惠券正在参与营销活动,禁止修改', - 'SHOP_COUPON_IN_USE_NOT_ALLOW_DEL' => '优惠券已有用户领取,禁止删除', - 'SHOP_GOODS_NOT_HAS_DEFAULT_SPEC' => '商品缺少默认规格', - 'SHOP_GOODS_DELISTED' => '此商品已下架', - 'SHOP_GOODS_EVALUATE_SUCCESS' => '评价成功', - 'SHOP_GOODS_PARTICIPATE_IN_ACTIVE_DISABLED_EDIT' => '商品正在参与营销活动,禁止修改', - 'SELECT_AUDIT_EVALUATE' => '请选择待审核评价', - - - 'SHOP_THE_LINE_ITEM_SUBTOTAL_CAN_T_BE_LESS_THAN_0' => '订单项小计总额不能小于0', - 'SHOP_THE_SHIPPING_FEE_CANNOT_BE_LESS_THAN_0' => '运费不能小于0', - 'SHOP_ONLY_PENDING_ORDERS_CAN_BE_REPRICED' => '只有待支付的订单可以改价', - 'SHOP_THE_AVAILABLE_SHIPPING_RATES_AREN_T_CONFIGURED' => '未配置可用的运费模板', - - 'SHOP_ONLY_PENDING_ORDERS_EDIT_TAKER' => '只有待支付或待发货的订单可以修改配送地址', - 'SHOP_VIRTUAL_ORDERS_EDIT_TAKER' => '虚拟商品订单不可以修改配送地址', - 'EXPRESS_FIELD_EMPTY' => '地址信息有误', - 'GOODS_NOT_DELIVERY_TYPE' => '当前商品不支持该配送方式', - - 'SHOP_THE_ITEM_IS_BEING_REFUNDED_OR_HAS_BEEN_REFUNDED' => '当前商品项存在退款', - - 'NOT_GET_SET_TYPE' => '未获取到设置类型', - 'NOT_GET_SHOP_INFO' => '未获取到商品信息', - - /********************************************* 订单相关 start ****************************************************/ - 'SHOP_ORDER_HAS_REFUNDING_NOT_ALLOW_FINISH' => '订单中存在退款,无法收货', - 'SHOP_ORDER_IS_PAY_FINISH' => '订单已支付', - 'SHOP_ORDER_IS_CLOSED' => '订单已关闭', - 'SHOP_ORDER_STATUS_NOT_SUPPORT_ACTION' => '当前的操作与订单状态不符', - 'SHOP_ORDER_COUPON_EXPIRE_OR_NOT_FOUND' => '优惠券已使用或已过期', - 'SHOP_ORDER_COUPON_EXPIRE' => '当前优惠券已过期', - 'SHOP_ORDER_COUPON_NOT_SUPPORT_GOODS' => '当前优惠券在本单不可用', - 'SHOP_ORDER_COUPON_NOT_SUPPORT_MIN_MONEY' => '未达到当前优惠券的最低使用条件', - 'SHOP_ORDER_PLEASE_SELECT_DELIVERY_TYPE' => '请选择正确的配送方式', - 'SHOP_ORDER_PLEASE_SELECT_DELIVERY_EMPTY_LNG_LAT' => '所选同城配送没有设置地图定位', - 'SHOP_ORDER_CARTS_EXPIRE' => '购物车数据已过期', - 'SHOP_ORDER_BUYER_NOT_FOUND' => '找不到买家', - 'SHOP_ORDER_BUYER_LOCKED' => '该会员已被锁定,请联系商家', - 'SHOP_ORDER_DELIVERY_NOT_ALLOW_REFUND_OR_DELIVERY_FINISH' => '存在退款或已发货的商品不能发货', - 'SHOP_ORDER_DELIVERY_ALLOW_ONE_GOODS_TYPE' => '一次发货只能存在一种商品类型的订单项', - 'SHOP_ORDER_DELIVERY_VIRTUAL_ALLOW_VIRTUAL_DELIVERY' => '虚拟商品只支持虚拟发货', - 'SHOP_ORDER_DELIVERY_TYPE_NOT_ORDER_DELIVERY_TYPE' => '发货方式需要与订单的配送方式相匹配', - 'SHOP_ORDER_COUPON_SUPPORT_GOODS' => '没有适用的商品', - 'SHOP_ORDER_COUPON_NOT_CONDITION' => '未达到最低可使用金额', - 'SHOP_ORDER_DELIVERY_SUCCESS' => '发货成功', - 'SHOP_ORDER_DELIVERY_EXPRESS_NUMBER_EXITS' => '物流单号不能重复', - 'NOT_CONFIGURED_LOCAL_DELIVERY' => '商家未配置同城配送', - 'NOT_CONFIGURED_DELIVERY_TYPE' => '商家尚未配置配送方式', - 'NOT_CONFIGURED_DELIVERY_KD100' => '快递100配送接口参数未配置', - - 'SHOP_ELECTRONIC_SHEET_API_EMPTY' => '未配置电子面单接口', - 'SHOP_ELECTRONIC_SHEET_TEMPLATE_FOUND' => '电子面单模板不存在', - - 'SHOP_ADDRESS_DEFAULT_EMPTY' => '商家未设置默认地址', - - 'SHOP_ORDER_GOODS_INSUFFICIENT' => '商品库存不足', - 'SHIPPING_TEMPLATE_IN_USE' => '运费模板有商品正在使用中不能删除', - - //虚拟订单 - 'SHOP_ORDER_ITEM_HAS_BEEN_WRITTEN_OFF_OR_EXPIRED' => '商品已核销或已过期', - 'SHOP_ORDER_HAS_BEEN_CLOSED_OR_COMPLETED' => '订单已关闭或已完成!', - 'SHOP_GOODS_CURRENT_PRODUCT_DOES_NOT_SUPPORT_WRITE_OFF' => '当前商品不支持核销', - 'SHOP_ORDER_MAXIMUM_NUMBER_OF_WRITE_OFFS_HAS_BEEN_REACHED' => '已达到最大核销次数', - 'SHOP_ORDER_ITEM_HAS_EXPIRED' => '商品已过期', - /********************************************* 订单相关 end ****************************************************/ - /********************************************* 订单退款 start ****************************************************/ - 'SHOP_ORDER_REFUND_IS_INVALID' => '退款已失效', - 'SHOP_ORDER_REFUND_IS_INVALID_OR_FINISH' => '退款已完成或已关闭', - 'SHOP_ORDER_REFUND_WAIT_PAY_OR_CLOSE' => '退款未支付或已关闭', - 'SHOP_ORDER_REFUND_IS_REFUND_FINISH' => '订单已退款或存在未完成的退款', - 'SHOP_ORDER_REFUND_MONEY_GT_ORDER_MONEY' => '退款金额不能大于可退款总额', - 'SHOP_ORDER_REFUND_MONEY_LESS_THAN_ZERO' => '退款金额不能小于0', - 'SHOP_ORDER_REFUND_STATUS_NOT_SUPPORT_ACTION' => '当前的操作与退款状态不符', - 'SHOP_ORDER_IS_NOT_ENABLE_REFUND' => '订单不允许退款', - 'SHOP_ORDER_REFUND_SELECT_ADDRESS' => '请选择退货地址', - 'SHOP_ORDER_REFUND_IS_ONLY_WAIT_REFUND_GOODS' => '只有待确认退货请求才可以审核', - 'SHOP_ORDER_REFUND_IS_ONLY_WAIT_REFUND' => '只有待确认退款请求才可以审核', - 'SHOP_ORDER_BUYER_APPLY_REFUND' => '买家申请退款', - 'SHOP_ORDER_STORE_ACTIVE_REFUND' => '卖家主动退款', - 'SHOP_ORDER_REFUND_DELIVERY_NOT_ALLOW_REFUND_GOODS' => '待发货的商品项不允许退货退款', - 'SHOP_ORDER_DELETE_STATUS_ERROR' => '删除订单中有未关闭订单:%s', - /********************************************* 订单退款 end ****************************************************/ - - - 'INVOICE_NOT_EXIST' => '发票不存在', - 'INVOICE_IS_EXIST' => '发票已存在', - 'INVOICED' => '已开票', - 'INVOICE_CANCEL_ERROR' => '取消申请失败', - 'INVOICE_HAS_ORDER_APPLY' => '当前选择订单中已有订单开具发票', - - - /********************************************* 活动start ****************************************************/ - 'END_TIME_NOT_LESS_CURRENT_TIME' => '活动结束时间不能小于当前时间', - 'ACTIVE_GOODS_NOT_EMPTY' => '请选择参与活动商品', - 'ACTIVE_GOODS_SKU_NOT_EMPTY' => '商品规格不能为空', - 'ACTIVE_NOT_FOUND' => '活动未找到', - 'ACTIVE_NOT_EDIT' => '活动不可编辑', - 'ACTIVE_GOODS_NOT_REPEAR' => '同一商品在一个时间段内只能参加一个限时折扣活动', - 'ACTIVE_NOT_DELETE' => '进行中活动不能直接删除', - 'ACTIVE_GOODS_DISCOUNT_TYPE_NOT_EMPTY' => '折扣类型不能为空', - 'ACTIVE_GOODS_DISCOUNT_TYPE_ERROR' => '折扣类型错误', - 'ACTIVE_GOODS_DISCOUNT_PRICE_NOT_EMPTY' => '折扣价格discount_price不能为空', - 'ACTIVE_GOODS_SPECIFY_PRICE_NOT_EMPTY' => '促销价不能为空', - 'ACTIVE_GOODS_DISCOUNT_RATE_NOT_EMPTY' => '打折折扣不能为空', - 'ACTIVE_GOODS_REDUCE_MONEY_NOT_EMPTY' => '减钱金额不能为空', - 'ACTIVE_IS_ENABLED_NOT_EMPTY' => 'is_enabled必传', - /********************************************* 活动end ****************************************************/ - - /********************************************* 积分商城start ****************************************************/ - 'EXCHANGE_GOODS_CONFIRM_TYPE' => '请确认兑换的类型', - 'EXCHANGE_GOODS_POINT_GREATER_THAN_ZERO' => '商品兑换积分要大于零', - 'EXCHANGE_GOODS_STOCK_GREATER_THAN_ZERO' => '商品兑换库存要大于零', - 'EXCHANGE_GOODS_NOT_EMPTY' => '请选择参与活动商品', - 'EXCHANGE_COUPON_NOT_EMPTY' => '请选择要参与的优惠券', - 'EXCHANGE_COUPON_NOT_EXIST' => '优惠券不存在', - 'EXCHANGE_BALANCE_GREATER_THAN_ZERO' => '商品兑换余额要大于零', - 'EXCHANGE_DATA_NOT_FOUND' => '积分信息活动未找到', - 'EXCHANGE_ACTIVITY_REMOVE' => '此积分商品已经下架', - 'EXCHANGE_GOODS_ACTIVITY_EXISTING' => '此商品已经参与积分兑换活动了', - 'EXIST_NOT_DOWN_ACTIVE' => '存在未下架活动', - /********************************************* 积分商城end ****************************************************/ - - /********************************************* 订单业务 *****************************************************/ - 'SHOP_ORDER_EXCHANGE_EXCEEDING_LIMIT' => '此积分商品超出单次限购数量', - 'SHOP_ORDER_EXCHANGE_INSUFFICIENT_EXCHANGE_QUANTITY' => '此积分商品可兑换数量不足', - 'SHOP_ORDER_EXCHANGE_POINT_INSUFFICIENT' => '账户积分不足', - - /********************************************* 新人专享start ****************************************************/ - 'ACTIVE_GOODS_NEWCOMER_PRICE_NOT_EMPTY' => '新人价不能为空', - /********************************************* 新人专享end ****************************************************/ - - /********************************************* 商品排行榜start ****************************************************/ - 'SHOP_RANK_NOT_EXIST' => '商品榜单不存在', - /********************************************* 商品排行榜end ****************************************************/ - - /********************************************* 满减送start ****************************************************/ - 'MANJIANSONG_GOODS_NOT_REPEAR' => '同一商品在一个时间段内只能参加一个满减送活动', - 'MANJIANSONG_ALL_GOODS_EXIT' => '当前时间段已存在类型为全部商品参与的满减送活动,不可再添加其它满减送活动', - 'MANJIANSONG_CLOSED' => '满减送活动已关闭', - 'MANJIANSONG_NOT_FOUND' => '满减送活动未找到', - 'MANJIAN_TIME_HINT' => '已有互斥类型活动存在(仅针对指定商品参与的类型活动,同一时间段内可以同时有多个开展。)', - /********************************************* 满减送end ****************************************************/ - - /********************************************* 限时折扣start ****************************************************/ - 'DISCOUNT_END_TIME_NOT_LESS_CURRENT_TIME' => '活动结束时间不能小于当前时间', - 'DISCOUNT_GOODS_NOT_EMPTY' => '请选择参与活动商品', - 'DISCOUNT_GOODS_SKU_NOT_EMPTY' => '商品规格不能为空', - 'DISCOUNT_NOT_FOUND' => '活动未找到', - 'DISCOUNT_NOT_EDIT' => '活动不可编辑', - 'DISCOUNT_GOODS_NOT_REPEAR' => '同一商品在一个时间段内只能参加一个限时折扣活动', - 'DISCOUNT_NOT_DELETE' => '进行中活动不能直接删除', - 'DISCOUNT_GOODS_DISCOUNT_TYPE_NOT_EMPTY' => '折扣类型不能为空', - 'DISCOUNT_GOODS_DISCOUNT_TYPE_ERROR' => '折扣类型错误', - 'DISCOUNT_GOODS_DISCOUNT_PRICE_NOT_EMPTY' => '折扣价格discount_price不能为空', - 'DISCOUNT_GOODS_SPECIFY_PRICE_NOT_EMPTY' => '促销价不能为空', - 'DISCOUNT_GOODS_DISCOUNT_RATE_NOT_EMPTY' => '打折折扣不能为空', - 'DISCOUNT_GOODS_REDUCE_MONEY_NOT_EMPTY' => '减钱金额不能为空', - 'DISCOUNT_IS_ENABLED_NOT_EMPTY' => 'is_enabled必传', - /********************************************* 限时折扣end ****************************************************/ - - /************************************************************ 配送相关 *********************************************/ - 'DELIVERY_SUCCESS' => '发货成功', - 'EXPRESS_COMPANY_NOT_EXIST' => '物流公司不存在', - 'NOT_SUPPORT_DELIVERY_ADDRESS' => '所选的收货地址不支持配送', - 'NOT_SELECT_ADDRESS' => '需要先选择收货地址', - 'NOT_SELECT_PICK_UP_STORE' => '请选择提货点', - 'NOT_SELECT_LOCAL_DELIVERY_STORE' => '请选择配送门店', - 'NOT_NEED_DELIVERY_START_PRICE' => '未达到起送费用', - 'LOCAL_DELIVERY_ORDER_EXIST' => '该订单已存在正在进行中的配送订单', - 'ELECTRONIC_SHEET_API_EMPTY' => '未配置电子面单接口', - 'ELECTRONIC_SHEET_TEMPLATE_FOUND' => '电子面单模板不存在', - 'LOCAL_DELIVERY_TYPE_NOT_EXIST' => '配送服务商类型不存在', - 'LOCAL_DELIVERY_OPEN_AT_LEAST_ONE_LOCAL_DELIVERY_STORE' => '同城配送已开启,至少需保留一个提货类型包含同城配送的提货点', - 'STORE_OPEN_AT_LEAST_ONE_PICK_UP_STORE' => '门店自提已开启,至少需保留一个提货类型包含门店自提的提货点', - 'LOCAL_DELIVERY_NOT_SET' => '同城配送未配置,请先完成配置', - 'NOT_SET_LOCAL_DELIVERY_STORE' => '未配置配送门店', - 'NOT_SET_PICK_UP_STORE' => '未配置提货点', - 'DELIVERY_ORDER_NOT_EXIT' => '配送订单不存在', - 'DELIVERY_SERVICE_NOT_SELECT' => '请选择配送平台', - 'DELIVERY_STORE_NOT_EXIST' => '提货点不存在', - 'DELIVERY_TYPE_NOT_OPEN' => '商家未开启该配送方式', - 'GOODS_NOT_SUPPORT_LOCAL_DELIVERY' => '该商品不支持同城配送', - 'GOODS_NOT_SUPPORT_EXPRESS' => '该商品不支持物流配送', - 'GOODS_NOT_SUPPORT_STORE' => '该商品不支持门店自提', - 'NOT_SUPPORT_DELIVERY_RANGE' => '不在配送范围内', - 'SHOP_NOT_SET_LOCAL_DELIVERY_STORE' => '商家未设置配送门店', - 'SHOP_NOT_SET_PICK_UP_STORE' => '商家未设置提货点', - 'STORE_NOT_SET_DELIVERY_RANGE' => '该门店未设置配送范围', - 'STORE_NOT_SUPPORT_LOCAL_DELIVERY' => '该门店不支持同城配送', - 'STORE_NOT_SUPPORT_PICK_UP' => '该门店不支持门店自提', - 'DELIVERY_WEAPP_SHIPPING_NOT_FOUND' => '小程序发货信息不存在', - -]; \ No newline at end of file diff --git a/niucloud/addon/shop/app/lang/zh-cn/dict.php b/niucloud/addon/shop/app/lang/zh-cn/dict.php deleted file mode 100644 index afdc0fc32..000000000 --- a/niucloud/addon/shop/app/lang/zh-cn/dict.php +++ /dev/null @@ -1,407 +0,0 @@ - [ - 'num' => '按件', - 'weight' => '按重量', - 'volume' => '按体积' - ], - 'dict_shop_goods' => [ - 'real' => '实物商品', - 'real_desc' => '物流发货', - 'virtual' => '虚拟商品', - 'virtual_desc' => '无需物流' - ], - 'dict_shop_app_manage' => [ - 'coupon' => '优惠券', - 'marketing' => '营销活动', - ], - 'dict_shop_order' => [ - 'status_wait_pay' => '待支付', - 'status_wait_shipping' => '待发货', - 'status_wait_pickup' => '待提货', - 'status_wait_take' => '待收货', - 'status_finish' => '已完成', - 'status_close' => '已关闭' - ], - 'dict_shop_delivery_type' => [ - 'express' => '物流配送', - 'local_delivery' => '同城配送', - 'store' => '门店自提', - 'virtual' => '虚拟发货', - 'none_express' => '无需物流' - ], - 'dict_shop_delivery_store_time_interval' => [ - '30' => '30分钟', - '60' => '1小时', - '90' => '90分钟', - '120' => '2小时', - ], - 'dict_shop_delivery_store_pick_up_type' => [ - 'local_delivery' => '同城配送', - 'store' => '门店自提', - ], - 'dict_shop_local_delivery_status' => [ - 'wait_release' => '预约待发布', - 'order_accepted' => '商家已接单', - 'pending_acceptance' => '待接单', - 'pending_pickup' => '待取货', - 'rider_arrived' => '骑士到店', - 'in_delivery' => '配送中', - 'completed' => '已完成', - 'dispatch_order' => '指派单', - 'return_in_progress' => '妥投异常之物品返回中', - 'return_completed' => '妥投异常之物品返回完成', - 'return_rider_arrived' => '售后取件单送达门店', - 'create_order_failed' => '创建运单失败', - 'canceled' => '已取消', - ], - 'dict_shop_local_delivery_order_log' => [ - 'store' => '商家', - 'rider' => '骑手', - 'member' => '会员', - 'system' => '系统', - - 'order_accepted' => '商家已接单', - 'order_call' => '商家呼叫配送', - 'dispatch_order' => '商家指派骑手', - 'rider_accepted' => '骑手已接单', - 'rider_arrived' => '骑手已到店', - 'rider_picked_up' => '骑手已取货', - 'order_delivered' => '订单已送达', - 'order_canceled' => '订单已取消', - 'return_applied' => '物品返回申请', - 'return_completed' => '物品返回完成', - ], - 'dict_shop_local_delivery_order_cancel' => [ - 'no_rider' => '没有配送员接单', - 'no_rider_pickup' => '配送员没来取货', - 'rider_bad_attitude' => '配送员态度太差', - 'customer_cancel' => '顾客取消订单', - 'order_write_error' => '订单填写错误', - 'rider_cancel' => '配送员让我取消此单', - 'rider_unwill' => '配送员不愿上门取货', - 'rider_unnecessary' => '我不需要配送了', - 'rider_cannot_complete' => '配送员以各种理由表示无法完成订单', - 'other_reason' => '其他', - ], - - 'dict_shop_coupon' => [ - 'user' => '手动领取', - 'grant' => '后台或活动发放', - 'all' => '通用券', - 'category' => '品类券', - 'goods' => '商品券', - 'wait_start' => '未开始', - 'normal' => '进行中', - 'expire' => '已过期', - 'invalid' => '已失效', - ], - 'dict_shop_member_coupon' => [ - 'wait_use' => '待使用', - 'used' => '已使用', - 'expire' => '已过期', - 'invalid' => '已失效', - 'send' => '后台发放', - 'receive' => '用户手动领取' - ], - 'dict_shop_send_coupon_range' => [//后台发送优惠券范围类型 - 'all' => '全部会员', - 'member' => '选择会员', - 'member_level' => '按会员等级', - 'member_label' => '按会员标签', - ], - 'dict_shop_send_coupon_range_type_desc' => [//后台发送优惠券范围类型描述 - 'all' => '全部会员', - 'member' => '指定会员', - 'member_level' => '指定会员等级', - 'member_label' => '指定会员标签', - ], - 'dict_shop_send_coupon_status' => [//后台发送优惠券状态 - 'wait' => '待发放', - 'progress' => '发放中', - 'finish' => '发放完成', - ], - 'dict_wap_index' => [ - 'shop' => '商城', - 'shop_desc' => '商品购买,配送' - ], - 'dict_shop_order_log' => [ - 'store' => '商家', - 'member' => '会员', - 'system' => '系统' - ], - 'dict_shop_goods_evaluate' => [ - 'audit_no' => '无需审核', - 'audit' => '待审核', - 'audit_adopt' => '审核通过', - 'audit_refuse' => '审核拒绝' - ], - 'dict_shop_order_action' => [ - 'order_create_action' => '订单创建', - 'order_pay_action' => '订单支付', - 'order_close_action' => '订单关闭', - 'order_delivery_action' => '订单发货', - 'order_finish_action' => '订单完成', - 'order_remark_action' => '订单商家备注', - 'order_close_allow_refund' => '订单自动关闭售后', - 'order_edit_price_action' => '订单改价', - ], - 'dict_shop_invoice' => [ - 'header_type_company' => '企业', - 'header_type_person' => '个人', - 'common' => '普票', - 'sprcial' => '专票', - 'wait_open' => '未生效', - 'wait_audit' => '待审核', - 'open' => '已生效', - 'wait_invoice' => '待开票', - 'invoiced' => '已开票', - ], - 'dict_shop_order_refund_status' => [ - 'buyer_apply_wait_store' => '买家申请售后', - 'store_agree_refund_goods_apply_wait_buyer' => '商家同意售后', - 'store_refuse_refund_goods_apply_wait_buyer' => '商家拒绝售后', - 'buyer_refund_goods_wait_store' => '买家已退货', - 'store_refuse_take_refund_goods_wait_buyer' => '商家拒绝收货', - 'store_agree_refund_wait_transfer' => '同意售后申请', - 'store_refund_transfering' => '转账中', - 'finish' => '退款成功', - 'close' => '退款关闭', - 'shop_active_close_refund' => '商家关闭售后' - ], - 'dict_shop_order_close_type' => [ - 'shop_close' => '后台关闭', - 'buyer_close' => '用户关闭', - 'auto_close' => '未支付自动关闭', - 'refund_close' => '退款完成关闭', - ], - 'dict_diy' => [ - 'shop_component_type_basic' => '商城组件', - 'shop_goods_detail_component_type_basic' => '商品详情组件', - 'page_shop_index' => '商城首页', - 'page_shop_member_index' => '商城个人中心', - 'page_shop_point_index' => '积分商城', - 'page_shop_detail' => '商品详情', - - 'shop_title' => '商城', - 'shop_link' => '商城系统', - 'shop_link_basic' => '商城链接', - 'shop_link_index' => '商城首页', - 'shop_link_goods_category' => '商品分类', - 'shop_link_goods_list' => '商品列表', - 'shop_link_goods_rank' => '商品排行榜', - 'shop_link_goods_search' => '商品搜索', - 'shop_link_goods_cart' => '购物车', - 'page_link_member_index' => '商城个人中心', - 'shop_link_coupon_list' => '优惠券列表', - 'shop_link_my_coupon' => '我的优惠券', - 'shop_link_my_goods_collect' => '商品收藏', - 'shop_link_my_goods_browse' => '我的足迹', - 'shop_link_order_list' => '订单列表', - 'shop_link_order_refund_list' => '退款列表', - 'shop_link_point_index' => '积分商城', - 'shop_link_point_list' => '积分商品列表', - 'shop_link_point_order_list' => '积分兑换记录', - 'shop_link_discount_list' => '限时折扣列表', - 'shop_link_newcomer_list' => '新人专享', - 'shop_link_goods_select' => '选择商品', - 'shop_link_goods_category_select' => '商品分类', - 'shop_link_coupon_select' => '优惠券', - 'shop_link_point_exchange_select' => '积分商品', - 'shop_link_goods_rank_select' => '商品榜单', - 'shop_link_invoice_list' => '发票列表' - ], - 'dict_diy_poster' => [ - 'shop_goods_component_type_basic' => '商品组件', - ], - 'dict_diy_form' => [ - 'shop_component_type_basic' => '商城表单组件', - 'type_goods_detail' => '商品表单', - 'type_order_payment' => '待付款表单', - ], - 'dict_shop_delivery_status' => [ - 'wait_delivery' => '待发货', - 'delivery' => '配送中', - 'delivery_finish' => '已发货', - 'taked' => '已收货' - ], - 'dict_shop_order_refund_action' => [ - 'apply' => '买家申请退款', - 'edit_apply' => '买家修改退款', - 'delivery' => '买家退货', - 'edit_delivery' => '买家修改退货', - 'agree_audit_apply' => '卖家同意退款', - 'refuse_audit_apply_action' => '卖家拒绝退款申请', - 'agree_audit_refund_goods' => '卖家同意退货', - 'refuse_audit_refund_goods' => '卖家拒绝退货', - 'active_refund' => '卖家主动退款', - 'shop_active_refund' => '商家主动退款', - 'finish' => '退款完成', - 'close' => '关闭退款' - ], - - 'dict_shop_order_refund_reason' => [ - 'delivery_timeout' => '未按约定时间发货', - 'buy_more_or_dislike' => '拍错/多拍/不喜欢', - 'negotiation_completed' => '协商一致退款', - 'other' => '其他', - ], - - - 'dict_shop_order_refund_type' => [ - 'only_refund' => '仅退款', - 'return_and_refund_goods' => '退款退货' - ], - 'dict_shop_order_refund' => [ - 'normal' => '正常', - 'refunding' => '退款中', - 'refund_finish' => '退款完成' - ], - - 'dict_shop_active_status' => [ - 'not_active' => '未开始', - 'active' => '进行中', - 'end' => '已结束', - 'close' => '已关闭' - ], - 'dict_shop_active_class' => [ - 'discount' => '限时折扣', - 'exchange' => '积分商城', - 'manjiansong' => '满减送', - 'newcomer_discount' => '新人专享', - 'giftcard' => '礼品卡', - 'pintuan' => '拼团' - ], - 'dict_shop_active_type' => [ - 'shop' => '店铺活动', - 'goods' => '商品活动', - 'member' => '会员活动', - ], - 'dict_shop_active_goods_type' => [ - 'single' => '单品', - 'independent' => '独立商品', - 'shop' => '店铺整体商品', - ], - - 'dict_shop_point_exchange_type' => [ - 'goods' => '商品', - 'coupon' => '优惠券', - 'balance' => '余额', - ], - - 'dict_shop_manjian_condition_type' => [ - 'over_n_yuan' => '满N元', - 'over_n_piece' => '满N件' - ], - - 'dict_shop_manjian_goods_type' => [ - 'all_goods' => '全部商品参与', - 'selected_goods' => '指定商品参与', - 'selected_goods_not' => '指定商品不参与' - ], - - 'dict_shop_manjian_join_member_type' => [ - 'all_member' => '所有会员参与', - 'selected_member_level' => '指定会员等级', - 'selected_member_label' => '指定会员标签' - ], - - 'dict_shop_manjian_rule_type' => [ - 'ladder' => '阶梯优惠', - 'cycle' => '循环优惠', - ], - - 'dict_shop_manjian_status' => [ - 'not_active' => '未开始', - 'active' => '进行中', - 'end' => '已结束', - 'close' => '已关闭', - ], - - 'dict_member' => [ - 'account_point_exchange_close' => '兑换订单关闭', - 'account_point_exchange_order' => '兑换订单消费', - 'account_point_exchange_refund' => '兑换订单售后', - 'account_point_consume_reward' => '下单奖励', - 'account_point_manjian_gift_give' => '满减送活动赠品发放', - 'account_point_manjian_gift_back' => '满减送活动赠品退还', - 'account_balance_manjian_gift_give' => '满减送活动赠品发放', - 'account_balance_manjian_gift_back' => '满减送活动赠品退还', - 'recharge_point_give' => '会员充值积分发放', - 'account_point_sow_community_settle_reward' => '种草奖励发放', - 'account_balance_sow_community_settle_reward' => '种草奖励发放', - ], - - 'dict_shop_delivery_electronic_sheet' => [ - 'cash_payment' => '现付', - 'freight_collect' => '到付', - 'monthly_statement' => '月结' - ], - - 'dict_shop_batch_delivery_status' => [ - 'processing' => '处理中', - 'finish' => '已完成', - 'fail' => '任务失败' - ], - 'dict_shop_batch_delivery_type' => [ - 'delivery' => '批量导入发货', - ], - - // 商品排行榜单 - 'dict_shop_goods_rank_rank_type' => [ - 'day' => '天', - 'week' => '周', - 'month' => '月', - 'quarter' => '季度' - ], - 'dict_shop_goods_rank_goods_source' => [ - 'goods' => '指定商品', - 'category' => '指定分类', - 'brand' => '指定品牌', - 'label' => '指定标签', - 'all' => '全部', - ], - - 'dict_shop_goods_rank_rule_type' => [ - 'sale' => '按销量', - 'collect' => '按收藏数', - 'evaluate' => '按评价数', - 'access' => '按浏览量' - ], - - //商品统计 - 'dict_shop_goods_statistics_type' => [ - 'access_num' => '访问次数', - 'cart_num' => '加入购物车数量', - 'sale_num' => '商品销量', - 'pay_num' => '支付件数', - 'collect_num' => '收藏数量', - 'pay_money' => '支付总金额', - 'goods_visit_member_count' => '访客数', - ], - - //批量设置 - 'dict_shop_goods_batch_set' => [ - 'label' => '商品标签', - 'service' => '商品服务', - 'virtual_sale_num' => '虚拟销量', - 'category' => '商品分类', - 'brand' => '商品品牌', - 'poster' => '商品海报', - 'gift' => '是否赠品', - 'delivery' => '配送设置', - 'stock' => '商品库存', - 'member_discount' => '会员折扣', - 'diy_detail' => '商品模版', - 'diy_form' => '万能表单', - ], - 'dict_shop_goods_sort_config' => [ - 'asc' => '正序排序', - 'desc' => '倒序排序', - 'price' => '价格', - 'sort' => '排序号', - 'sale_num' => '销量', - 'create_time' => '创建时间', - ], -]; diff --git a/niucloud/addon/shop/app/lang/zh-cn/validate.php b/niucloud/addon/shop/app/lang/zh-cn/validate.php deleted file mode 100644 index 7e1d52067..000000000 --- a/niucloud/addon/shop/app/lang/zh-cn/validate.php +++ /dev/null @@ -1,7 +0,0 @@ - [ - 'mobile' => '手机号格式有误', - ], -]; diff --git a/niucloud/addon/shop/app/listener/BottomNavigationListener.php b/niucloud/addon/shop/app/listener/BottomNavigationListener.php deleted file mode 100644 index 4e9be6d35..000000000 --- a/niucloud/addon/shop/app/listener/BottomNavigationListener.php +++ /dev/null @@ -1,91 +0,0 @@ -getAddonConfig($key); - - return [ - 'key' => $key, - 'info' => $addon_info, - 'value' => [ - 'backgroundColor' => '#ffffff', - 'textColor' => '#333333', - 'textHoverColor' => '#FF4500', - 'type' => '1', - 'list' => [ - [ - "text" => "首页", - "link" => [ - "parent" => "SHOP_LINK", - "name" => "SHOP_INDEX", - "title" => get_lang('dict_diy.shop_link_index'), - "url" => "/addon/shop/pages/index" - ], - "iconPath" => "addon/shop/diy/tabbar/system-home.png", - "iconSelectPath" => "addon/shop/diy/tabbar/system-home-selected.png" - ], - [ - "text" => "商品分类", - "link" => [ - "parent" => "SHOP_LINK", - "name" => "SHOP_GOODS_CATEGORY", - "title" => "商品分类", - "url" => "/addon/shop/pages/goods/category" - ], - "iconPath" => "addon/shop/diy/tabbar/system-category.png", - "iconSelectPath" => "addon/shop/diy/tabbar/system-category-selected.png" - ], - [ - "text" => "购物车", - "link" => [ - "parent" => "SHOP_LINK", - "name" => "SHOP_GOODS_CART", - "title" => "购物车", - "url" => "/addon/shop/pages/goods/cart" - ], - "iconPath" => "addon/shop/diy/tabbar/system-cart.png", - "iconSelectPath" => "addon/shop/diy/tabbar/system-cart-selected.png" - ], - [ - "text" => "我的", - "link" => [ - "parent" => "SHOP_LINK", - "name" => "SHOP_MEMBER_INDEX", - "title" => get_lang('dict_diy.member_index'), - "url" => "/addon/shop/pages/member/index" - ], - "iconPath" => "addon/shop/diy/tabbar/system-my.png", - "iconSelectPath" => "addon/shop/diy/tabbar/system-my-selected.png" - ] - ] - ] - ]; - } -} diff --git a/niucloud/addon/shop/app/listener/MemberLoginAfterListener.php b/niucloud/addon/shop/app/listener/MemberLoginAfterListener.php deleted file mode 100644 index bd47a28c5..000000000 --- a/niucloud/addon/shop/app/listener/MemberLoginAfterListener.php +++ /dev/null @@ -1,32 +0,0 @@ -checkIfNewcomer($params[ 'member_id' ]); - return true; - } -} diff --git a/niucloud/addon/shop/app/listener/WapIndexListener.php b/niucloud/addon/shop/app/listener/WapIndexListener.php deleted file mode 100644 index eee1c7b27..000000000 --- a/niucloud/addon/shop/app/listener/WapIndexListener.php +++ /dev/null @@ -1,31 +0,0 @@ - 'shop', - "title" => get_lang("dict_wap_index.shop"), - 'desc' => get_lang("dict_wap_index.shop_desc"), - "url" => "/addon/shop/pages/index", - 'icon' => 'addon/shop/icon.png' - ], - ]; - } -} diff --git a/niucloud/addon/shop/app/listener/app/ShopPromotionListener.php b/niucloud/addon/shop/app/listener/app/ShopPromotionListener.php deleted file mode 100644 index 5b9f0e8fe..000000000 --- a/niucloud/addon/shop/app/listener/app/ShopPromotionListener.php +++ /dev/null @@ -1,46 +0,0 @@ - [ - [ - "key" => "marketing", - "name" => get_lang('dict_app_manage.marketing'), - "sort" => 10 - ], - ], - [ - "addon" => "shop", - "title" => get_lang('dict_shop_app_manage.coupon'), - "category" => "marketing", - "desc" => get_lang('dict_shop_app_manage.message_manage'), - "icon" => "addon/shop/coupon.png", - "cover" => "addon/shop/coupon.png", - "url" => "/shop/marketing/coupon/list" - ], - ]; - } - return []; - } -} diff --git a/niucloud/addon/shop/app/listener/config/initWapListener.php b/niucloud/addon/shop/app/listener/config/initWapListener.php deleted file mode 100644 index ea0be4624..000000000 --- a/niucloud/addon/shop/app/listener/config/initWapListener.php +++ /dev/null @@ -1,26 +0,0 @@ -addStat([ 'access_sum' => 1 ]); - } -} diff --git a/niucloud/addon/shop/app/listener/coupon/CouponCheckListener.php b/niucloud/addon/shop/app/listener/coupon/CouponCheckListener.php deleted file mode 100644 index 133a7bf57..000000000 --- a/niucloud/addon/shop/app/listener/coupon/CouponCheckListener.php +++ /dev/null @@ -1,45 +0,0 @@ -field('id,status,remain_count') - ->where([ [ 'id', 'in', $data['coupon_id'] ] ]) - ->select()->toArray(); - foreach ($coupon_data as $coupon) { - //检测优惠券状态和剩余数量 - if ($coupon['status'] == CouponDict::NORMAL && ($coupon[ 'remain_count' ] == '-1' || $coupon[ 'remain_count' ] >= $old_coupon_list[ 'id_' . $coupon['id']])) { - $coupon_id[] = $coupon['id']; - $coupon_list[] = 'id_' . $coupon['id']; - } - } - return [ - 'coupon_id' => $coupon_id, - 'coupon_list' => $coupon_list, - ]; - } -} diff --git a/niucloud/addon/shop/app/listener/coupon/CouponReceiveListener.php b/niucloud/addon/shop/app/listener/coupon/CouponReceiveListener.php deleted file mode 100644 index 969d7707a..000000000 --- a/niucloud/addon/shop/app/listener/coupon/CouponReceiveListener.php +++ /dev/null @@ -1,34 +0,0 @@ - "send", - "title" => get_lang('dict_shop_member_coupon.send'), - ], - [ - "name" => "receive", - "title" => get_lang('dict_shop_member_coupon.receive'), - ], - ]; - } -} diff --git a/niucloud/addon/shop/app/listener/diy/BeforeFormDeleteListener.php b/niucloud/addon/shop/app/listener/diy/BeforeFormDeleteListener.php deleted file mode 100644 index 96a845ad2..000000000 --- a/niucloud/addon/shop/app/listener/diy/BeforeFormDeleteListener.php +++ /dev/null @@ -1,42 +0,0 @@ -getConfig(); - if (!empty($config) && $config[ 'form_id' ] == $form_id) { - $allow_operate = false; - } - $goods = ( new Goods() )->where([['form_id', '=', $form_id]])->findOrEmpty()->toArray(); - if (!empty($goods)) { - $allow_operate = false; - } - return [ - 'allow_operate' => $allow_operate - ]; - } -} diff --git a/niucloud/addon/shop/app/listener/diy/ThemeColorListener.php b/niucloud/addon/shop/app/listener/diy/ThemeColorListener.php deleted file mode 100644 index e60bc27e2..000000000 --- a/niucloud/addon/shop/app/listener/diy/ThemeColorListener.php +++ /dev/null @@ -1,125 +0,0 @@ - [ - [ - 'title' => '热情红', - 'name' => 'red', - 'theme' => [ - '--page-bg-color' => "#F6F6F6",//页面背景色 - '--price-text-color' => "#FF4142",//价格颜色 - '--primary-color' => "#FF4142",//主色调 - '--primary-color-light' => "#FFEAEA",//主色调浅色(淡) - '--primary-color-light2' => "#FFF7F7",//主色调深色(深) - '--primary-help-color1' => "#FFB000",//辅色调1 - '--primary-help-color2' => "#FB7939",//辅色调2 - '--primary-help-color3' => "#F26F3E",//辅色调3 - '--primary-help-color4' => "#FFB397",//辅色调4 - '--primary-help-color5' => "#FFA029",//辅色调5 - '--primary-color-dark' => "#999999",//灰色调 - '--primary-color-disabled' => "#CCCCCC",//禁用色 - ], - ], - ], - // 主题颜色字段,前端展示用,字段中的value值颜色为添加自定义颜色的默认值,默认黑色风格 - 'theme_field' => [ - [ - 'title' => '页面背景色', - 'label' => "--page-bg-color", - 'value' => "#F6F6F6", - 'tip' => "页面背景色在uniapp中使用:var(--page-bg-color)", - ], - [ - 'title' => '价格颜色', - 'label' => "--price-text-color", - 'value' => "#FF4142", - 'tip' => "价格颜色在uniapp中使用:var(--price-text-color)", - ], - [ - 'title' => '主色调', - 'label' => "--primary-color", - 'value' => "rgba(51, 51, 51, 1)", - 'tip' => "主色调在uniapp中使用:var(--primary-color)", - ], - [ - 'title' => '主色调浅色(淡)', - 'label' => "--primary-color-light", - 'value' => "rgba(51, 51, 51, 0.1)", - 'tip' => "主色调浅色(淡)在uniapp中使用:var(--primary-color-light)", - ], - [ - 'title' => '主色调深色(深)', - 'label' => "--primary-color-light2", - 'value' => "rgba(51, 51, 51, 0.8)", - 'tip' => "主色调深色(深)在uniapp中使用:var(--primary-color-light2)", - ], - [ - 'title' => '辅色调1', - 'label' => "--primary-help-color1", - 'value' => "rgba(51, 51, 51, 1)", - 'tip' => "辅色调1在uniapp中使用:var(--primary-help-color1)", - ], - [ - 'title' => '辅色调2', - 'label' => "--primary-help-color2", - 'value' => "rgba(51, 51, 51, 1)", - 'tip' => "辅色调2在uniapp中使用:var(--primary-help-color2)", - ], - [ - 'title' => '辅色调3', - 'label' => "--primary-help-color3", - 'value' => "rgba(51, 51, 51, 1)", - 'tip' => "辅色调3在uniapp中使用:var(--primary-help-color3)", - ], - [ - 'title' => '辅色调4', - 'label' => "--primary-help-color4", - 'value' => "rgba(51, 51, 51, 1)", - 'tip' => "辅色调4在uniapp中使用:var(--primary-help-color4)", - ], - [ - 'title' => '辅色调5', - 'label' => "--primary-help-color5", - 'value' => "rgba(51, 51, 51, 1)", - 'tip' => "辅色调5在uniapp中使用:var(--primary-help-color5)", - ], - [ - 'title' => '灰色调', - 'label' => "--primary-color-dark", - 'value' => "#999999", - 'tip' => "灰色调在uniapp中使用:var(--primary-color-dark)", - ], - [ - 'title' => '禁用色', - 'label' => "--primary-color-disabled", - 'value' => "#CCCCCC", - 'tip' => "禁用色在uniapp中使用:var(--primary-color-disabled)", - ], - ] - ]; - } - } -} diff --git a/niucloud/addon/shop/app/listener/goods/GoodsShowPriceListener.php b/niucloud/addon/shop/app/listener/goods/GoodsShowPriceListener.php deleted file mode 100644 index 6723d899d..000000000 --- a/niucloud/addon/shop/app/listener/goods/GoodsShowPriceListener.php +++ /dev/null @@ -1,30 +0,0 @@ -getShowPrice($sku_info,$member_id); - } -} diff --git a/niucloud/addon/shop/app/listener/local_delivery/dada/local_delivery_type/LocalDeliveryTypeListener.php b/niucloud/addon/shop/app/listener/local_delivery/dada/local_delivery_type/LocalDeliveryTypeListener.php deleted file mode 100644 index a3faa069f..000000000 --- a/niucloud/addon/shop/app/listener/local_delivery/dada/local_delivery_type/LocalDeliveryTypeListener.php +++ /dev/null @@ -1,43 +0,0 @@ - [ - 'name' => '达达秒送', - 'key' => 'dada', - //配置参数 - 'params' => [ - 'app_key' => 'APP_KEY', - 'app_secret' => 'APP_SECRET', - 'source_id' => '商户SourceID', - 'shop_no' => '门店编号', - ], - 'encrypt_params' => ['app_key', 'app_secret', 'source_id', 'shop_no'], - 'component' => '/src/addon/shop/views/delivery/components/local-delivery-service-dada.vue', - 'business_list' => json_decode(file_get_contents(root_path() . '/addon/shop/app/dict/local_delivery/dada/json/shop_catetory_dict.json'), true), - 'extend_data' => [], - //商家配送标识 - 'is_merchant' => 0 - ], - ]; - } -} diff --git a/niucloud/addon/shop/app/listener/local_delivery/dada/order/GetLocalDeliveryTrack.php b/niucloud/addon/shop/app/listener/local_delivery/dada/order/GetLocalDeliveryTrack.php deleted file mode 100644 index 2eb4726db..000000000 --- a/niucloud/addon/shop/app/listener/local_delivery/dada/order/GetLocalDeliveryTrack.php +++ /dev/null @@ -1,155 +0,0 @@ -where([['member_id', '=', $member_id]])->findOrEmpty()->toArray(); - if (empty($member_info)) throw new CommonException('MEMBER_NOT_EXIST'); - $headimg = empty($member_info['headimg']) ? 'static/resource/images/default_headimg.png' : $member_info['headimg']; - - if (in_array($status, [LocalDeliveryStatusDict::PENDING_PICKUP, LocalDeliveryStatusDict::IN_DELIVERY])) { - $config = (new CoreLocalDeliveryService())->getConfig($delivery_service); - $loader = new LocalDeliveryLoader($delivery_service, $config); - $data = [ - 'delivery_no' => $delivery_no, - ]; - $response_data = $loader->getTransporterPosition($data); - } - - switch ($status) { - case LocalDeliveryStatusDict::ORDER_ACCEPTED: - case LocalDeliveryStatusDict::PENDING_ACCEPTANCE: - return [ - [ - 'points_type' => 'shop', - 'latitude' => $params['delivery_start_lat'], - 'longitude' => $params['delivery_start_lng'], - 'icon_path' => 'addon/shop/local_delivery/in_stock.png', - 'callout' => [ - 'content' => '备货中', - ], - ], - [ - 'points_type' => 'member', - 'latitude' => $params['delivery_end_lat'], - 'longitude' => $params['delivery_end_lng'], - 'icon_path' => $headimg, - 'callout' => [ - 'content' => '', - ], - ] - ]; - case LocalDeliveryStatusDict::PENDING_PICKUP: - if (!empty($response_data['rider_latitude']) && !empty($response_data['rider_longitude'])) { - return [ - [ - 'points_type' => 'rider', - 'latitude' => $response_data['rider_latitude'], - 'longitude' => $response_data['rider_longitude'], - 'icon_path' => 'addon/shop/local_delivery/in_delivery.png', - 'callout' => [ - 'content' => '骑手正赶往商家', - ], - ], - [ - 'points_type' => 'shop', - 'latitude' => $params['delivery_start_lat'], - 'longitude' => $params['delivery_start_lng'], - 'icon_path' => 'addon/shop/local_delivery/in_stock.png', - 'callout' => [ - 'content' => '', - ], - ] - ]; - } else { - return [ - [ - 'points_type' => 'shop', - 'latitude' => $params['delivery_start_lat'], - 'longitude' => $params['delivery_start_lng'], - 'icon_path' => 'addon/shop/local_delivery/in_stock.png', - 'callout' => [ - 'content' => '骑手正赶往商家', - ], - ] - ]; - } - case LocalDeliveryStatusDict::RIDER_ARRIVED: - return [ - [ - 'points_type' => 'rider_arrived', - 'latitude' => $params['delivery_start_lat'], - 'longitude' => $params['delivery_start_lng'], - 'icon_path' => 'addon/shop/local_delivery/picking_up.png', - 'callout' => [ - 'content' => '骑手到店取餐中', - ], - ], - [ - 'points_type' => 'member', - 'latitude' => $params['delivery_end_lat'], - 'longitude' => $params['delivery_end_lng'], - 'icon_path' => $headimg, - 'callout' => [ - 'content' => '', - ], - ] - ]; - case LocalDeliveryStatusDict::IN_DELIVERY: - return [ - [ - 'points_type' => 'rider', - 'latitude' => $response_data['rider_latitude'] ?? $params['delivery_start_lat'], - 'longitude' => $response_data['rider_longitude'] ?? $params['delivery_start_lng'], - 'icon_path' => 'addon/shop/local_delivery/in_delivery.png', - 'callout' => [ - 'content' => '骑手正在送餐', - ], - ], - [ - 'points_type' => 'member', - 'latitude' => $params['delivery_end_lat'], - 'longitude' => $params['delivery_end_lng'], - 'icon_path' => $headimg, - 'callout' => [ - 'content' => '', - ], - ] - ]; - default: - return []; - } - } - } -} diff --git a/niucloud/addon/shop/app/listener/local_delivery/dada/order/OrderCancelReasonListener.php b/niucloud/addon/shop/app/listener/local_delivery/dada/order/OrderCancelReasonListener.php deleted file mode 100644 index ea2d4e165..000000000 --- a/niucloud/addon/shop/app/listener/local_delivery/dada/order/OrderCancelReasonListener.php +++ /dev/null @@ -1,42 +0,0 @@ - get_lang('dict_shop_local_delivery_order_cancel.no_rider'), //没有配送员接单, - 2 => get_lang('dict_shop_local_delivery_order_cancel.no_rider_pickup'), //配送员没来取货, - 3 => get_lang('dict_shop_local_delivery_order_cancel.rider_bad_attitude'), //配送员态度太差, - 4 => get_lang('dict_shop_local_delivery_order_cancel.customer_cancel'), //顾客取消订单, - 5 => get_lang('dict_shop_local_delivery_order_cancel.order_write_error'), //订单填写错误, - 34 => get_lang('dict_shop_local_delivery_order_cancel.rider_cancel'), //配送员让我取消此单, - 35 => get_lang('dict_shop_local_delivery_order_cancel.rider_unwill'), //配送员不愿上门取货, - 36 => get_lang('dict_shop_local_delivery_order_cancel.rider_unnecessary'), //我不需要配送了, - 37 => get_lang('dict_shop_local_delivery_order_cancel.rider_cannot_complete'), //配送员以各种理由表示无法完成订单, - 10000 => get_lang('dict_shop_local_delivery_order_cancel.other_reason'), //其他, - ]; - } - } -} diff --git a/niucloud/addon/shop/app/listener/local_delivery/dada/order/OrderPreStatusListener.php b/niucloud/addon/shop/app/listener/local_delivery/dada/order/OrderPreStatusListener.php deleted file mode 100644 index 1ec4a9726..000000000 --- a/niucloud/addon/shop/app/listener/local_delivery/dada/order/OrderPreStatusListener.php +++ /dev/null @@ -1,51 +0,0 @@ - [ - LocalDeliveryStatusDict::WAIT_RELEASE, - LocalDeliveryStatusDict::PENDING_ACCEPTANCE, - LocalDeliveryStatusDict::PENDING_PICKUP, - LocalDeliveryStatusDict::RIDER_ARRIVED, - ], //取消订单 - 'sync' => [ - LocalDeliveryStatusDict::ORDER_ACCEPTED, - LocalDeliveryStatusDict::PENDING_ACCEPTANCE, - LocalDeliveryStatusDict::PENDING_PICKUP, - LocalDeliveryStatusDict::RIDER_ARRIVED, - LocalDeliveryStatusDict::IN_DELIVERY, - LocalDeliveryStatusDict::COMPLETED, - LocalDeliveryStatusDict::DISPATCH_ORDER, - LocalDeliveryStatusDict::RETURN_IN_PROGRESS, - LocalDeliveryStatusDict::RETURN_COMPLETED, - LocalDeliveryStatusDict::RETURN_RIDER_ARRIVED, - LocalDeliveryStatusDict::CREATE_ORDER_FAILED, - LocalDeliveryStatusDict::CANCELED, - ], //同步订单 - ]; - } - } -} diff --git a/niucloud/addon/shop/app/listener/marketing/GetGoodsJoinInfo.php b/niucloud/addon/shop/app/listener/marketing/GetGoodsJoinInfo.php deleted file mode 100644 index ff788783a..000000000 --- a/niucloud/addon/shop/app/listener/marketing/GetGoodsJoinInfo.php +++ /dev/null @@ -1,106 +0,0 @@ -getBatchAllQuery($params['where'], $goods_ids); - $example_goods_ids = $query->column('goods.goods_id'); - $condition[] = ['goods_id', 'in', $example_goods_ids]; - } else { - $condition[] = ['goods_id', 'in', $goods_ids]; - } - $return = []; - - $query = (new ActiveGoods())->where([ - ['active_goods_status', '=', 'active'], - ['active_goods_type', 'in', [ActiveDict::GOODS_SINGLE, ActiveDict::GOODS_INDEPENDENT]], - ['active_class', '<>', ActiveDict::DISCOUNT] - ])->where($condition)->with([ - 'active' => function ($query) { - $query->withField('active_id,active_name, active_desc, start_time, end_time'); - } - ]); - $discount_query = (new DiscountGoods())->where([ - ['status', '=', 'active'] - ])->where($condition)->with([ - 'discount' => function ($query) { - $query->withField('discount_id,name'); - } - ]); - $manjian_query = (new ManjianGoods())->where([ - ['status', '=', ManjianDict::ACTIVE] - ])->where($condition)->with([ - 'manjian' => function ($query) { - $query->withField('manjian_id,manjian_name'); - } - ]); - - - if ($is_get_count == 1) { - return $query->count() + $discount_query->count() + $manjian_query->count(); - } - $common_active_dict_arr = CommonActiveDict::getActiveShort(); - - $active_goods_list = $query->group('goods_id,active_id')->select()->toArray(); - foreach ($active_goods_list as $item) { - $return[$item['goods_id']]['active_' . $item['active_id']] = [ - 'join_id' => $item['active_id'], - 'join_type' => 'active_' . $item['active_class'], - 'short' => $common_active_dict_arr[$item['active_class']], - 'name' => $item['active']['active_name'] ?? $common_active_dict_arr[$item['active_class']]['active_name'], - ]; - } - // 折扣商品条件 - $discount_goods_list = $discount_query->group('goods_id,discount_id')->select()->toArray(); - $short_info = $common_active_dict_arr['discount']; - foreach ($discount_goods_list as $item) { - $return[$item['goods_id']]['discount_' . $item['discount_id']] = [ - 'join_id' => $item['discount_id'], - 'join_type' => 'discount', - 'short' => $short_info, - 'name' => $item['discount']['name'] ?? $short_info['active_name'], - ]; - } - // 满减送商品条件 - $manjian_goods_list = $manjian_query->group('goods_id,manjian_id')->select()->toArray(); - $manjian_short_info = $common_active_dict_arr['manjiansong']; - foreach ($manjian_goods_list as $item) { - $return[$item['goods_id']]['manjian_' . $item['manjian_id']] = [ - 'join_id' => $item['manjian_id'], - 'join_type' => 'manjian', - 'short' => $manjian_short_info, - 'name' => $item['manjian']['name'] ?? $manjian_short_info['active_name'], - ]; - } - return $return; - } -} diff --git a/niucloud/addon/shop/app/listener/marketing/NewcomerActiveJoinListener.php b/niucloud/addon/shop/app/listener/marketing/NewcomerActiveJoinListener.php deleted file mode 100644 index bc1d12ff7..000000000 --- a/niucloud/addon/shop/app/listener/marketing/NewcomerActiveJoinListener.php +++ /dev/null @@ -1,58 +0,0 @@ -getConfig(); - if (isset($params[ 'is_join' ]) && $config[ 'active_status' ] == ActiveDict::ACTIVE) { - if ($params[ 'is_join' ] == 1) { - $newcomer_records_model->where([ - [ 'member_id', '=', $params[ 'member_id' ] ] - ])->update([ - 'is_join' => $params[ 'is_join' ], - 'order_id' => $params[ 'order_id' ], - 'goods_ids' => $params[ 'goods_ids' ], - 'sku_ids' => $params[ 'sku_ids' ], - 'update_time' => time() - ]); - } else { - $newcomer_records_model->where([ - [ 'member_id', '=', $params[ 'member_id' ] ], - [ 'order_id', '=', $params[ 'order_id' ] ] - ])->update([ - 'is_join' => $params[ 'is_join' ], - 'order_id' => 0, - 'goods_ids' => '', - 'sku_ids' => '', - 'update_time' => time() - ]); - } - } - return true; - } -} diff --git a/niucloud/addon/shop/app/listener/marketing/ShopActiveSaveAfter.php b/niucloud/addon/shop/app/listener/marketing/ShopActiveSaveAfter.php deleted file mode 100644 index 91cca7e9b..000000000 --- a/niucloud/addon/shop/app/listener/marketing/ShopActiveSaveAfter.php +++ /dev/null @@ -1,34 +0,0 @@ -extend_data) && $sku_info && $sku_info[ 'goods' ][ 'is_discount' ] && $order_obj->extend_data[ 'activity_type' ] == ActiveDict::DISCOUNT) { - - $discount_goods_info = ( new DiscountGoods() )->where([ [ 'discount_goods.goods_id', '=', $sku_info[ 'goods_id' ] ], [ 'discount_goods.sku_id', '=', $sku_info[ 'sku_id' ] ] ]) - ->withJoin([ 'discount' => function($query) { - $query->where([ - [ 'discount.status', '=', DiscountDict::ACTIVE ], - ]); - } ])->findOrEmpty()->toArray(); - if ($discount_goods_info && $discount_goods_info[ 'discount' ][ 'status' ] == DiscountDict::ACTIVE) { - - if ($discount_goods_info[ 'is_enabled' ]){ - $order_obj->discount[ ActiveDict::DISCOUNT ] = $order_obj->discountFormat( - [ $sku_info[ 'sku_id' ] ], - OrderDiscountDict::DISCOUNT, - $sku_info[ 'num' ], - number_format($sku_info[ 'price' ] - $sku_info[ 'sale_price' ], '2', '.'), - ActiveDict::DISCOUNT, - $discount_goods_info[ 'discount_id' ], - '限时折扣', - $discount_goods_info[ 'discount' ][ 'remark' ] ?? '' - ); - $sku_info[ 'price' ] = $sku_info[ 'sale_price' ]; - $sku_info[ 'goods_money' ] = $sku_info[ 'price' ] * $sku_info[ 'num' ];//小计 - return [ - 'sku_info' => $sku_info, - 'relate_id' => $discount_goods_info[ 'discount_id' ], - 'activity_type' => ActiveDict::DISCOUNT - ]; - } - - } - - } - } -} diff --git a/niucloud/addon/shop/app/listener/marketing/ShopNewcomerCalculate.php b/niucloud/addon/shop/app/listener/marketing/ShopNewcomerCalculate.php deleted file mode 100644 index d144a2c10..000000000 --- a/niucloud/addon/shop/app/listener/marketing/ShopNewcomerCalculate.php +++ /dev/null @@ -1,80 +0,0 @@ -checkIfNewcomer($order_obj->member_id); - - if (!empty($order_obj->extend_data) && $sku_info && $order_obj->extend_data[ 'activity_type' ] == ActiveDict::NEWCOMER_DISCOUNT && $is_newcomer) { - - //查询新人专享活动 - $newcomer_goods_info = ( new ActiveGoods() )->field('active_id,active_goods_value')->where([ - [ 'goods_id', '=', $sku_info[ 'goods_id' ] ], - [ 'sku_id', '=', $sku_info[ 'sku_id' ] ], - [ 'active_class', '=', ActiveDict::NEWCOMER_DISCOUNT ] - ])->with([ - 'active' => function($query) { - $query->field('active_id,active_desc,active_status,active_value'); - } - ])->findOrEmpty()->toArray(); - - if (!empty($newcomer_goods_info) && $newcomer_goods_info[ 'active' ][ 'active_status' ] == ActiveDict::ACTIVE) { - $newcomer_price = json_decode($newcomer_goods_info[ 'active_goods_value' ], true)[ 'newcomer_price' ]; - $sku_info[ 'newcomer_price' ] = $newcomer_price; - $sku_info[ 'is_newcomer' ] = 1; - $sku_info[ 'extend' ] = [ 'is_newcomer' => 1, 'newcomer_price' => $newcomer_price ]; - $order_obj->discount[ ActiveDict::NEWCOMER_DISCOUNT ] = $order_obj->discountFormat( - [ $sku_info[ 'sku_id' ] ], - OrderDiscountDict::DISCOUNT, - 1, - number_format($sku_info[ 'price' ] - $newcomer_price, '2', '.'), - ActiveDict::NEWCOMER_DISCOUNT, - $newcomer_goods_info[ 'active_id' ], - '新人专享', - $newcomer_goods_info[ 'active' ][ 'active_desc' ] ?? '' - ); - if ($sku_info[ 'num' ] == 1) { - $sku_info[ 'price' ] = $newcomer_price; - $sku_info[ 'goods_money' ] = $sku_info[ 'price' ] * $sku_info[ 'num' ];//只有一个商品时使用新人价计算 - } else { - // 超出数量按照正常价格计算(原价/会员价) - $sku_info[ 'goods_money' ] = $newcomer_price * 1 + $sku_info[ 'member_price' ] * ( intval($sku_info[ 'num' ]) - 1 ); - } - - return [ - 'sku_info' => $sku_info, - 'relate_id' => $newcomer_goods_info[ 'active_id' ], - 'activity_type' => ActiveDict::NEWCOMER_DISCOUNT - ]; - } - - } - } -} diff --git a/niucloud/addon/shop/app/listener/notice_template/OrderDelivery.php b/niucloud/addon/shop/app/listener/notice_template/OrderDelivery.php deleted file mode 100644 index 653ec8f0f..000000000 --- a/niucloud/addon/shop/app/listener/notice_template/OrderDelivery.php +++ /dev/null @@ -1,40 +0,0 @@ -key == $params['key']) { - $order = (new CoreOrderService())->getInfo($params['data']['order_id']); - if (!empty($order)) { - $order_data = $params['data']; - $wap_domain = get_wap_domain(); - return $this->toReturn( - [ - '__wechat_page' => $wap_domain . '/addon/shop/pages/order/detail?order_id=' . $order_data['order_id'],//模板消息链接 - '__weapp_page' => 'addon/shop/pages/order/detail?order_id=' . $order_data['order_id'],//小程序链接 - 'body' => str_sub($order_data['body']), - 'order_no' => $order_data['order_no'], - 'delivery_time' => $order_data['delivery_time'], - 'order_money' => $order_data['order_money'], - 'url' => $wap_domain . '/addon/shop/pages/order/detail?order_id=' . $order_data['order_id'] - ], - [ - 'member_id' => $order_data['member_id'] - ] - ); - } - } - } -} diff --git a/niucloud/addon/shop/app/listener/notice_template/OrderPay.php b/niucloud/addon/shop/app/listener/notice_template/OrderPay.php deleted file mode 100644 index 18a375ed3..000000000 --- a/niucloud/addon/shop/app/listener/notice_template/OrderPay.php +++ /dev/null @@ -1,40 +0,0 @@ -key == $params['key']) { - $order = (new CoreOrderService())->getInfo($params['data']['order_id']); - if (!empty($order)) { - $wap_domain = get_wap_domain(); - return $this->toReturn( - [ - '__wechat_page' => $wap_domain . '/addon/shop/pages/order/detail?order_id=' . $order['order_id'],//模板消息链接 - '__weapp_page' => 'addon/shop/pages/order/detail?order_id=' . $order['order_id'],//小程序链接 - 'body' => str_sub($order['body']), - 'order_no' => $order['order_no'], - 'order_money' => $order['order_money'], //交易流水号 - 'create_time' => $order['create_time'], - 'pay_time' => $order['pay_time'], - 'url' => $wap_domain . '/addon/shop/pages/order/detail?order_id=' . $order['order_id'] - ], - [ - 'member_id' => $order['member_id'] - ] - ); - } - } - } -} diff --git a/niucloud/addon/shop/app/listener/notice_template/OrderPayRemind.php b/niucloud/addon/shop/app/listener/notice_template/OrderPayRemind.php deleted file mode 100644 index 24a45aa86..000000000 --- a/niucloud/addon/shop/app/listener/notice_template/OrderPayRemind.php +++ /dev/null @@ -1,40 +0,0 @@ -key == $params['key']) { - $order = (new CoreOrderService())->getInfo($params['data']['order_id']); - if (!empty($order) && $order['status'] == OrderDict::WAIT_PAY) { - $wap_domain = get_wap_domain(); - return $this->toReturn( - [ - '__wechat_page' => $wap_domain . '/addon/shop/pages/order/detail?order_id=' . $order['order_id'],//模板消息链接 - '__weapp_page' => 'addon/shop/pages/order/detail?order_id=' . $order['order_id'],//小程序链接 - 'body' => $order['body'], - 'order_no' => $order['order_no'], - 'order_money' => $order['order_money'], //交易流水号 - 'timeout' => $order['timeout'], - 'url' => $wap_domain . '/addon/shop/pages/order/detail?order_id=' . $order['order_id'] - ], - [ - 'member_id' => $order['member_id'] - ] - ); - } - } - } -} diff --git a/niucloud/addon/shop/app/listener/notice_template/RefundAgree.php b/niucloud/addon/shop/app/listener/notice_template/RefundAgree.php deleted file mode 100644 index 33c7a90f2..000000000 --- a/niucloud/addon/shop/app/listener/notice_template/RefundAgree.php +++ /dev/null @@ -1,35 +0,0 @@ -key == $params['key']) { - $refund = (new CoreRefundService())->getInfo($params['data']['order_refund_no']); - if (!empty($refund)) { - return $this->toReturn( - [ - 'order_refund_no' => $refund['order_refund_no'], - 'order_no' => $refund['order_main']['order_no'], - 'refund_money' => $refund['apply_money'], - 'result' => '已通过申请' - ], - [ - 'member_id' => $refund['member_id'] - ] - ); - } - } - } -} diff --git a/niucloud/addon/shop/app/listener/notice_template/RefundRefuse.php b/niucloud/addon/shop/app/listener/notice_template/RefundRefuse.php deleted file mode 100644 index 539928dd7..000000000 --- a/niucloud/addon/shop/app/listener/notice_template/RefundRefuse.php +++ /dev/null @@ -1,35 +0,0 @@ -key == $params['key']) { - $refund = (new CoreRefundService())->getInfo($params['data']['order_refund_no']); - if (!empty($refund)) { - return $this->toReturn( - [ - 'order_refund_no' => $refund['order_refund_no'], - 'order_no' => $refund['order_main']['order_no'], - 'refund_money' => $refund['apply_money'], - 'result' => '未通过申请' - ], - [ - 'member_id' => $refund['member_id'] - ] - ); - } - } - } -} diff --git a/niucloud/addon/shop/app/listener/order/AfterShopOrderClose.php b/niucloud/addon/shop/app/listener/order/AfterShopOrderClose.php deleted file mode 100644 index 849efa918..000000000 --- a/niucloud/addon/shop/app/listener/order/AfterShopOrderClose.php +++ /dev/null @@ -1,122 +0,0 @@ -where($order_discount_where)->select(); - - if (!$order_discount->isEmpty()) { - $recover_list = []; - foreach ($order_discount as $v) { - $item_discount_type = $v['discount_type']; - $recover_list[$item_discount_type][] = $v['discount_type_id']; - - } - - foreach ($recover_list as $item_discount_type => $discount_type_ids) { - switch ($item_discount_type) { - case 'coupon'://优惠券 - (new CoreCouponMemberService())->recover($discount_type_ids); - break; - } - } - } - $order_goods_where = array( - ['order_id', '=', $order_data['order_id']], - ['is_gift', '=', 0], - ); - $order_goods_data = (new OrderGoods())->where($order_goods_where)->select()->toArray(); - - //返还商品库存 - $core_goods_stock_service = new CoreGoodsStockService(); - $inc_data = []; - foreach ($order_goods_data as $v) { - $stock = $v['num']; - $inc_data['goods'][] = [ - 'stock' => Db::raw("stock+" . $stock), - 'goods_id' => $v['goods_id'] - ]; - $inc_data['sku'][] = [ - 'stock' => Db::raw(" stock+" . $stock), - 'sku_id' => $v['sku_id'] - ]; - } - $core_goods_stock_service->batchUpdateStock($inc_data); - //商品累计销量 - //累减销量 - $dec_data = []; - $core_goods_sale_num_service = new CoreGoodsSaleNumService(); - foreach ($order_goods_data as $v) { - // 商品销量累减 - 下单数(不剔除退款订单) - if (empty($order_data['pay_time'])) { - //商品累计销量 - $stock = $v['num']; - $dec_data['goods'][] = [ - 'sale_num' => Db::raw("sale_num-" . $stock), - 'goods_id' => $v['goods_id'] - ]; - $dec_data['sku'][] = [ - 'sale_num' => Db::raw(" sale_num-" . $stock), - 'sku_id' => $v['sku_id'] - ]; - //TODO::可以优化 后置 - CoreGoodsStatService::decStat(['goods_id' => $v['goods_id'], 'time' => $order_data['create_time'], 'sale_num' => $v['num']]); - } - } - $core_goods_sale_num_service->batchUpdateSaleNum($dec_data); - - - //发票改变状态........ - (new CoreInvoiceService())->close($order_data['invoice_id']); - //发布日志 - $main_type = $data['main_type']; - $main_id = $data['main_id'] ?? 0; - (new CoreOrderLogService())->add([ - 'order_id' => $order_data['order_id'], - 'status' => OrderDict::CLOSE, - 'main_type' => $main_type,//todo 可以是传入的 - 'main_id' => $main_id, - 'type' => OrderDict::ORDER_CLOSE_ACTION, - 'content' => '' - ]); - //todo 消息发送 - - //新人专享活动退还参与资格 - if ($order_data['activity_type'] == ActiveDict::NEWCOMER_DISCOUNT) { - event("NewcomerActiveJoin", ['member_id' => $order_data['member_id'], 'is_join' => 0, 'order_id' => $order_data['order_id']]); - } - } catch (\Exception $e) { - Log::write('订单AfterShopOrderClose失败' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - } -} diff --git a/niucloud/addon/shop/app/listener/order/AfterShopOrderCreate.php b/niucloud/addon/shop/app/listener/order/AfterShopOrderCreate.php deleted file mode 100644 index 7f5e021be..000000000 --- a/niucloud/addon/shop/app/listener/order/AfterShopOrderCreate.php +++ /dev/null @@ -1,155 +0,0 @@ - Db::raw('stock-' . $v[ 'num' ]), - 'goods_id' => $v[ 'goods_id' ], - ]; - $dec_data['sku'][] =[ - 'stock' => Db::raw('stock-' . $v[ 'num' ]), - 'sku_id' => $v[ 'sku_id' ], - ]; - } - $core_goods_stock_service->batchUpdateStock($dec_data); -// Db::commit(); -// } catch (\Exception $e) { -// Db::rollback(); -// throw new CommonException($e->getMessage()); -// } - - //购物车删除 - $cart_ids = $data[ 'cart_ids' ] ?? []; - if ($cart_ids) { - ( new CoreCartService() )->deleteByCartIds($cart_ids); - } - - //累增销量 - $core_goods_sale_num_service = new CoreGoodsSaleNumService(); - $inc_data = []; - foreach ($order_goods_data as $v) { - //商品累计销量 - $inc_data['goods'][] =[ - 'sale_num' => Db::raw('sale_num+' . $v[ 'num' ]), - 'goods_id' => $v[ 'goods_id' ], - ]; - $inc_data['sku'][] =[ - 'sale_num' => Db::raw('sale_num+' . $v[ 'num' ]), - 'sku_id' => $v[ 'sku_id' ], - ]; - // todo 可以优化 逻辑较多 后置 - // 商品销量统计 - 下单数 - CoreGoodsStatService::addStat([ 'goods_id' => $v[ 'goods_id' ], 'sale_num' => $v[ 'num' ] ]); - } - $core_goods_sale_num_service->batchUpdateSaleNum($inc_data); - //写入发票 - $invoice = $basic[ 'invoice' ] ?? []; - if (!empty($invoice)) { - $invoice_id = ( new CoreInvoiceService() )->add([ - 'type' => $invoice[ 'type' ] ?? '', - 'name' => $invoice[ 'name' ], - 'header_type' => $invoice[ 'header_type' ], - 'header_name' => $invoice[ 'header_name' ], - 'tax_number' => $invoice[ 'tax_number' ], - 'mobile' => $invoice[ 'mobile' ], - 'email' => $invoice[ 'email' ], - 'telephone' => $invoice[ 'telephone' ], - 'address' => $invoice[ 'address' ], - 'bank_name' => $invoice[ 'bank_name' ], - 'bank_card_number' => $invoice[ 'bank_card_number' ], - 'money' => $order_data[ 'order_money' ], - 'status' => InvoiceDict::WAIT_OPEN, - 'member_id' => $order_data[ 'member_id' ], - 'trade_type' => $order_data[ 'order_type' ], - 'trade_id' => $order_data[ 'order_id' ], - ]); - //修改订单发票id - ( new Order() )->where([ - [ 'order_id', '=', $order_data[ 'order_id' ] ] - ])->update([ 'invoice_id' => $invoice_id ]); - } - - //发布日志 - $main_type = $data[ 'main_type' ] ?? OrderLogDict::MEMBER; - $main_id = $data[ 'main_id' ] ?? $order_data[ 'member_id' ]; - ( new CoreOrderLogService() )->add([ - 'order_id' => $order_data[ 'order_id' ], - 'status' => OrderDict::WAIT_PAY, - 'main_type' => $main_type,//todo 可以是传入的 - 'main_id' => $main_id, - 'type' => OrderDict::ORDER_CREATE_ACTION, - 'content' => '' - ]); - - //消息发送 - - //创建定时关闭任务 - $core_order_config_service = new CoreOrderConfigService(); - $order_config = $core_order_config_service->orderClose(); - if ($order_config[ 'is_close' ] == 1) { - if ($order_config[ 'close_length' ] > 0) { - ( new Order() )->where([ [ 'order_id', '=', $order_data[ 'order_id' ] ] ])->update([ - 'timeout' => $data[ 'time' ] + $order_config[ 'close_length' ] * 60 - ]); -// OrderClose::dispatch(['order_id' => $order_data['order_id'] ], secs: $order_config['close_length'] * 60); - } - } - //增加统计数据 - CoreStatService::addStat([ 'order_num' => 1 ]); - - //新人专享活动扣除参与资格 - $goods_ids = [];//参与商品id集合 - $sku_ids = [];//参与商品规格id集合 - foreach ($order_goods_data as $v) { - //判断商品是否享受新人专享活动 - if (isset($v[ 'extend' ]) && !empty($v[ 'extend' ]) && isset($v[ 'extend' ][ 'is_newcomer' ]) && $v[ 'extend' ][ 'is_newcomer' ]) { - $goods_ids[] = $v[ 'goods_id' ]; - $sku_ids[] = $v[ 'sku_id' ]; - } - } - if ($order_data[ 'activity_type' ] == ActiveDict::NEWCOMER_DISCOUNT) { - event("NewcomerActiveJoin", [ 'member_id' => $order_data[ 'member_id' ], 'is_join' => 1, 'order_id' => $order_data[ 'order_id' ], 'goods_ids' => $goods_ids, 'sku_ids' => $sku_ids ]); - } - } catch (\Exception $e) { - Log::write('订单AfterShopOrderCreate失败' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - // 订单催付通知 - OrderPayRemind::dispatch([ 'order_id' => $order_data[ 'order_id' ] ], secs: 1800); - } -} diff --git a/niucloud/addon/shop/app/listener/order/AfterShopOrderDelivery.php b/niucloud/addon/shop/app/listener/order/AfterShopOrderDelivery.php deleted file mode 100644 index 46935a5f4..000000000 --- a/niucloud/addon/shop/app/listener/order/AfterShopOrderDelivery.php +++ /dev/null @@ -1,80 +0,0 @@ -add([ - 'order_id' => $order_data[ 'order_id' ], - 'status' => OrderDict::WAIT_TAKE, - 'main_type' => $main_type, - 'main_id' => $main_id, - 'type' => OrderDict::ORDER_DELIVERY_ACTION, - 'content' => '' - ]); - - //消息发送 - if ($order_data[ 'status' ] == OrderDict::WAIT_TAKE) { - ( new NoticeService() )->send('shop_order_delivery', $order_data); - } - - //写入定时收货任务 - $order_goods_list = ( new OrderGoods() )->where([ [ 'order_id', '=', $order_data[ 'order_id' ] ] ])->select()->toArray(); - //判断是否是核销商品 - if (count($order_goods_list) == 1 && $order_goods_list[ 0 ][ 'is_verify' ] == 1) { - if (!empty($order_goods_list[ 0 ][ 'verify_expire_time' ])) { - $timeout = strtotime($order_goods_list[ 0 ][ 'verify_expire_time' ]); - } - } else { - $core_order_config_service = new CoreOrderConfigService(); - $order_config = $core_order_config_service->orderConfirm(); - if ($order_config[ 'is_finish' ] == 1) { - if ($order_config[ 'finish_length' ] > 0) { - $timeout = strtotime($order_data[ 'delivery_time' ]) + $order_config[ 'finish_length' ] * 86400; - } - } - } - if (!empty($timeout)) { - ( new Order() )->where([ [ 'order_id', '=', $order_data[ 'order_id' ] ] ])->update([ - 'timeout' => $timeout - ]); - } - - // 微信小程序 发货信息录入接口 - ( new CoreOrderDeliveryService() )->orderShippingUploadShippingInfo([ 'order_id' => $order_data[ 'order_id' ] ]); -// $core_order_config_service = new CoreOrderConfigService(); -// $order_config = $core_order_config_service->orderConfirm(); -// if ($order_config['is_finish'] == 1) { -// if ($order_config['finish_length'] > 0) { -// (new Order())->where([['order_id', '=', $order_data['order_id']]])->update([ -// 'timeout' => strtotime($order_data['delivery_time']) + $order_config['finish_length'] * 86400 -// ]); -//// OrderFinish::dispatch(['order_id' => $order_data['order_id'] ], secs: $order_config['finish_length'] * 86400); -// } -// } - } catch (\Exception $e) { - Log::write('订单AfterShopOrderDelivery失败' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - } -} diff --git a/niucloud/addon/shop/app/listener/order/AfterShopOrderEditPrice.php b/niucloud/addon/shop/app/listener/order/AfterShopOrderEditPrice.php deleted file mode 100644 index 4ee4a7df4..000000000 --- a/niucloud/addon/shop/app/listener/order/AfterShopOrderEditPrice.php +++ /dev/null @@ -1,41 +0,0 @@ -add([ - 'order_id' => $order_data['order_id'], - 'status' => OrderDict::WAIT_PAY, - 'main_type' => $main_type, - 'main_id' => $main_id, - 'type' => OrderDict::ORDER_EDIT_PRICE_ACTION, - 'content' => $content - ]); - - //todo 发送消息提醒..... - } catch ( \Exception $e ) { - Log::write('订单AfterShopOrderEditPrice失败' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - } -} diff --git a/niucloud/addon/shop/app/listener/order/AfterShopOrderFinish.php b/niucloud/addon/shop/app/listener/order/AfterShopOrderFinish.php deleted file mode 100644 index 8f08cb08c..000000000 --- a/niucloud/addon/shop/app/listener/order/AfterShopOrderFinish.php +++ /dev/null @@ -1,75 +0,0 @@ -add([ - 'order_id' => $order_data[ 'order_id' ], - 'status' => OrderDict::FINISH, - 'main_type' => $main_type, - 'main_id' => $main_id, - 'type' => OrderDict::ORDER_FINISH_ACTION, - 'content' => '' - ]); - //消息发送 - - //定时关闭订单允许退款开关 - $core_order_config_service = new CoreOrderConfigService(); - $order_config = $core_order_config_service->orderRefund(); //确认收货后售后,1.开启,2.关闭 - if ($order_config[ 'no_allow_refund' ] == 2) {//等于2,不支持确认收货后售后,此时要关闭退款,否则不关闭 - ( new OrderGoods() )->where([ [ 'order_id', '=', $order_data[ 'order_id' ] ] ])->update([ - 'is_enable_refund' => 0 - ]); - } else { - if ($order_config[ 'refund_length' ] > 0) { - ( new Order() )->where([ [ 'order_id', '=', $order_data[ 'order_id' ] ] ])->update([ - 'is_enable_refund' => 1, - 'timeout' => $order_data[ 'finish_time' ] + $order_config[ 'refund_length' ] * 86400 //确认收货后售后,单位为天 - ]); -// OrderCloseAllowRefund::dispatch(['order_id' => $order_data['order_id'] ], secs: $order_config['refund_length'] * 86400); - } - } - - // 订单完成发放积分成长值 - CoreMemberService::sendGrowth($order_data[ 'member_id' ], 'shop_buy_goods', array_merge($order_data, [ 'from_type' => 'shop_buy_goods', 'related_id' => $order_data[ 'order_id' ] ])); - CoreMemberService::sendGrowth($order_data[ 'member_id' ], 'shop_buy_order',['from_type'=>'shop_buy_order','related_id'=>$order_data[ 'order_id' ] ]); - CoreMemberService::sendPoint($order_data[ 'member_id' ], 'shop_buy_goods', array_merge($order_data, [ 'from_type' => 'consume_reward', 'related_id' => $order_data[ 'order_id' ] ])); - - // 微信小程序 发送 确认收货提醒消息 - ( new CoreOrderFinishService() )->orderShippingNotifyConfirmReceive($order_data); - - // 小票打印,订单收货之后 - return ( new CorePrinterService() )->printTicket([ - "type" => "shopGoodsOrder", - "trigger" => "take_delivery", - 'business' => [ - 'order_id' => $order_data[ 'order_id' ] - ] - ]); - } catch (\Exception $e) { - Log::write('订单AfterShopOrderFinish失败' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - } -} diff --git a/niucloud/addon/shop/app/listener/order/AfterShopOrderPay.php b/niucloud/addon/shop/app/listener/order/AfterShopOrderPay.php deleted file mode 100644 index 9247e60da..000000000 --- a/niucloud/addon/shop/app/listener/order/AfterShopOrderPay.php +++ /dev/null @@ -1,103 +0,0 @@ -open($order_data['invoice_id']); - //商城专用统计 - CoreStatService::addStat([ 'sale_money' => $order_data['order_money']]); - //日志 - $main_type = $data['main_type'] ?? OrderLogDict::MEMBER; - $main_id = $data['main_id'] ?? $order_data['member_id']; - (new CoreOrderLogService())->add([ - 'order_id' => $order_data['order_id'], - 'status' => OrderDict::WAIT_DELIVERY, - 'main_type' => $main_type, - 'main_id' => $main_id, - 'type' => OrderDict::ORDER_PAY_ACTION, - 'content' => '' - ]); - //虚拟商品自动发货 - $order_goods_list = (new OrderGoods())->where(['order_id' => $data['order_id']])->select(); - if (!empty($order_goods_list)) { - $goods_column = (new Goods())->where([['goods_id', 'in', array_column($order_goods_list->toArray(), 'goods_id')]])->column('*', 'goods_id'); - $virtual_order_goods_ids = []; - foreach ($order_goods_list as $v) { - //根据商品配置判断下一步配送操作 - $temp_goods_type = $v['goods_type']; - //读取虚拟商品配置 - if ($temp_goods_type == GoodsDict::VIRTUAL) { - $temp_goods = $goods_column[$v['goods_id']] ?? []; - if (empty($temp_goods)) continue; - //是否自动发货 - if ($temp_goods['virtual_auto_delivery'] == 1) { - //调用订单项发货 - $virtual_order_goods_ids[] = $v['order_goods_id']; - } - } - } - if ($virtual_order_goods_ids) { - $delivery_data = []; - $delivery_data['main_type'] = OrderLogDict::SYSTEM; - $delivery_data['main_id'] = 0; - $delivery_data['order_id'] = $order_data['order_id']; - $delivery_data['delivery_type'] = OrderDeliveryDict::VIRTUAL; - $delivery_data['order_goods_ids'] = $virtual_order_goods_ids; - (new CoreOrderDeliveryService())->delivery($delivery_data); - } - - } - - //消息发送 - if ($send_notice == 1) { - (new NoticeService())->send('shop_order_pay', ['order_id' => $order_data['order_id']]); - } - - (new DiscountService())->orderPayAfter($order_data); - - (new CoreGoodsStatService())->saveGoodsPayNumAndMoneyByOrderId($order_data); // 商品支付数量 金额统计数据 - - //满减送订单支付后赠品发放 - (new CoreManjianService())->giftGrant($order_data); - - // 小票打印,订单付款之后 - return (new CorePrinterService())->printTicket([ - "type" => "shopGoodsOrder", - "trigger" => "pay_after", - 'business' => [ - 'order_id' => $order_data['order_id'] - ] - ]); - - } catch (\Exception $e) { - Log::write('订单AfterShopOrderPay失败' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - } -} diff --git a/niucloud/addon/shop/app/listener/order/ShopOrderCreate.php b/niucloud/addon/shop/app/listener/order/ShopOrderCreate.php deleted file mode 100644 index 0a3ca0f6a..000000000 --- a/niucloud/addon/shop/app/listener/order/ShopOrderCreate.php +++ /dev/null @@ -1,36 +0,0 @@ -orderClose(); - if ($order_config[ 'is_close' ] == 1) { - if ($order_config[ 'close_length' ] > 0) { - ( new Order() )->where([ [ 'order_id', '=', $order_data[ 'order_id' ] ] ])->update([ - 'timeout' => $data[ 'time' ] + $order_config[ 'close_length' ] * 60 - ]); -// OrderClose::dispatch(['order_id' => $order_data['order_id'] ], secs: $order_config['close_length'] * 60); - } - } - - //满减赠送记录 - ( new CoreManjianService() )->addGiveRecords($data); - } -} diff --git a/niucloud/addon/shop/app/listener/order/ShopOrderTradeInfoListener.php b/niucloud/addon/shop/app/listener/order/ShopOrderTradeInfoListener.php deleted file mode 100644 index 17fc94720..000000000 --- a/niucloud/addon/shop/app/listener/order/ShopOrderTradeInfoListener.php +++ /dev/null @@ -1,54 +0,0 @@ -where([ [ 'order_id', '=', $params[ 'trade_id' ] ] ])->field('order_id') - ->with([ - 'order_goods' => function($query) { - $query->field('order_id,goods_name,sku_name,sku_image,price,num')->append([ 'sku_image_thumb_mid' ]); - } - ])->findOrEmpty()->toArray(); - $info = []; - $item = []; - if (!empty($order_info)) { - if ($order_info[ 'order_goods' ]) { - foreach ($order_info[ 'order_goods' ] as $k => $v) { - $item[ $k ][ 'item_image' ] = empty($v[ 'sku_image_thumb_mid' ]) ? $v[ 'sku_image' ] : $v[ 'sku_image_thumb_mid' ];//订单项图片 - $item[ $k ][ 'item_name' ] = $v[ 'goods_name' ];//订单项名称 - $item[ $k ][ 'item_sub_name' ] = $v[ 'sku_name' ];//订单项副标题 - $item[ $k ][ 'item_price' ] = $v[ 'price' ];//订单项金额 - $item[ $k ][ 'item_num' ] = $v[ 'num' ];//订单项数量 - } - $info[ 'item_list' ] = $item;//订单项列表 - $info[ 'item_total' ] = '共' . count($order_info[ 'order_goods' ]) . '种商品';//订单项总计 - $info[ 'detail_url' ] = '/addon/shop/pages/order/detail?order_id=' . $params[ 'trade_id' ];//订单详情跳转路径 - } - } - return $info; - } - } -} diff --git a/niucloud/addon/shop/app/listener/order/WapOrderDetailPathListener.php b/niucloud/addon/shop/app/listener/order/WapOrderDetailPathListener.php deleted file mode 100644 index 72cf008c5..000000000 --- a/niucloud/addon/shop/app/listener/order/WapOrderDetailPathListener.php +++ /dev/null @@ -1,34 +0,0 @@ -getInfo($params[ 'trade_id' ]); - if (empty($order_info)) return 'addon/shop/pages/order/list'; - return 'addon/shop/pages/order/detail?order_id=' . $order_info[ 'order_id' ]; - } - } -} diff --git a/niucloud/addon/shop/app/listener/order_export/ShopInvoiceExportDataListener.php b/niucloud/addon/shop/app/listener/order_export/ShopInvoiceExportDataListener.php deleted file mode 100644 index 8aa8fa59f..000000000 --- a/niucloud/addon/shop/app/listener/order_export/ShopInvoiceExportDataListener.php +++ /dev/null @@ -1,61 +0,0 @@ -withSearch(["header_name", "create_time", "invoice_time"], $param['where']) - ->with([ - 'member' => function ($query) { - $query->field('member_id, nickname'); - }, - 'shop_order' => function ($query) { - $query->field('order_id, order_no, order_money'); - } - ]) - ->where([['status', '=', InvoiceDict::OPEN]])->append(['header_type_name', 'type_name', 'is_invoice_name'])->field('*')->order($order); - if ($param['page']['page'] > 0 && $param['page']['limit'] > 0) { - $data = $search_model->page($param['page']['page'], $param['page']['limit'])->select()->toArray(); - } else { - $data = $search_model->select()->toArray(); - } - foreach ($data as $key => $val) { - $data[$key]['order_no'] = !empty($val['shop_order']) ? $val['shop_order']['order_no']."\t" : ''; - $data[$key]['order_money'] = !empty($val['shop_order']) ? $val['shop_order']['order_money'] : ''; - $data[$key]['nickname'] = !empty($val['member']) ? $val['member']['nickname'] : ''; - $data[$key]['header_name'] = $val['header_name']."\t"; - $data[$key]['tax_number'] = $val['tax_number']."\t"; - $data[$key]['bank_card_number'] = $val['bank_card_number']."\t"; - $data[$key]['invoice_number'] = $val['invoice_number']."\t"; - $data[$key]['create_time'] = !empty($val['create_time']) ? $val['create_time'] : ''; - $data[$key]['invoice_time'] = !empty($val['invoice_time']) ? $val['invoice_time'] : ''; - } - } - return $data; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/order_export/ShopInvoiceExportTypeListener.php b/niucloud/addon/shop/app/listener/order_export/ShopInvoiceExportTypeListener.php deleted file mode 100644 index 9ec9ebbe4..000000000 --- a/niucloud/addon/shop/app/listener/order_export/ShopInvoiceExportTypeListener.php +++ /dev/null @@ -1,49 +0,0 @@ - [ - 'name' => '发票列表', - 'column' => [ - 'order_no' => [ 'name' => '订单号'], - 'nickname' => [ 'name' => '会员昵称'], - 'order_money' => [ 'name' => '订单金额'], - 'header_name' => [ 'name' => '发票抬头'], - 'header_type_name' => [ 'name' => '抬头类型'], - 'type_name' => [ 'name' => '发票类型'], - 'tax_number' => [ 'name' => '纳税人识别号'], - 'bank_name' => [ 'name' => '开户银行'], - 'bank_card_number' => [ 'name' => '银行账号'], - 'address' => [ 'name' => '注册地址'], - 'name' => [ 'name' => '发票内容'], - 'money' => [ 'name' => '开票金额'], - 'invoice_number' => [ 'name' => '发票代码'], - 'remark' => [ 'name' => '备注'], - 'create_time' => [ 'name' => '申请时间'], - 'invoice_time' => [ 'name' => '开票时间'], - 'is_invoice_name' => [ 'name' => '开票状态'], - ], - ] - ]; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/order_export/ShopOrderExportDataListener.php b/niucloud/addon/shop/app/listener/order_export/ShopOrderExportDataListener.php deleted file mode 100644 index 90627d18b..000000000 --- a/niucloud/addon/shop/app/listener/order_export/ShopOrderExportDataListener.php +++ /dev/null @@ -1,152 +0,0 @@ -', Db::raw("pay.from_main_id")], - ['pay.from_main_id', '>', 0], - ['pay.status', '=', PayDict::STATUS_FINISH] - ]; - } else { - $pay_where[] = ['pay.type', '=', $param[ 'where' ]['pay_type']]; - } - } - $member_where = []; - if ($param['where']['keyword'] != '') { - $member_where = [ - ['member.member_no|member.nickname|member.username|member.mobile', 'like', "%" . $param[ 'where' ]['keyword'] . "%"], - ]; - } - //查询导出订单项数据 - $order_ids = $model->where([ [ 'order.order_id', '>', 0 ] ]) - ->withSearch([ 'search_type', 'order_from', 'join_status', 'create_time', 'join_pay_time' ], $param[ 'where' ]) - ->withJoin([ - 'pay' => function(Query $query) use ($pay_where) { - $query->where($pay_where); - }, - 'member' => function (Query $query) use ($member_where) { - $query->where($member_where); - }, - ], 'left') - ->field('order_id')->order('order.create_time desc')->column('order_id'); - - $order_goods_field = 'extend,order_goods_id,order_id,member_id,goods_id,sku_id,delivery_id,goods_name,sku_name,goods_image,sku_image,price,num,goods_money,is_enable_refund,goods_type,delivery_status,status'; - $search_model = $orderGoodsModel->where([ [ 'order_id', 'in', $order_ids ] ]) - ->with([ - 'order_delivery' => function($query) { - $query->field('id, express_company_id, express_number')->with('company'); - } - ]) - ->field($order_goods_field)->append([ 'status_name', 'delivery_status_name', 'goods_type_name' ]); - if ($param[ 'page' ][ 'page' ] > 0 && $param[ 'page' ][ 'limit' ] > 0) { - $data = $search_model->page($param[ 'page' ][ 'page' ], $param[ 'page' ][ 'limit' ])->select()->toArray(); - } else { - $data = $search_model->select()->toArray(); - } - - $encountered = array(); - foreach ($data as $key => $val) { - - if (isset($encountered[ $val[ 'order_id' ] ])) { - $is_first = false; - } else { - $encountered[ $val[ 'order_id' ] ] = true; - $is_first = true; - } - $order_field = 'order_id,invoice_id,order_no,order_type,order_from,out_trade_no,status,member_id,ip,goods_money,delivery_money,order_money,point,discount_money,create_time,pay_time,delivery_type,delivery_time,take_time,finish_time,close_time,taker_name,taker_mobile,taker_full_address,take_store_id,is_enable_refund,member_remark,shop_remark,close_remark'; - $order_data = $model - ->where([ [ 'order_id', '=', $val[ 'order_id' ] ] ])->field($order_field) - ->withJoin([ 'pay' ], 'left') - ->with([ - 'member' => function($query) { - $query->field('member_id, nickname, mobile, member_no'); - }, - 'store' => function($query) { - $query->field('store_id, store_name, store_mobile'); - }, - 'invoice' => function($query) { - $query->where([ [ 'status', '=', InvoiceDict::OPEN ] ])->field('id,header_name,tax_number,type')->append([ 'type_name' ]); - } - ])->order('order.create_time desc')->append([ 'order_from_name', 'order_type_name', 'status_name', 'delivery_type_name' ])->findOrEmpty(); - - $pay = $order_data[ 'pay' ]; - if (!empty($pay)) { - $pay->append([ 'type_name' ]); - } - $order_data = $order_data->toArray(); - - $data[ $key ][ 'order_no' ] = $is_first ? $order_data[ 'order_no' ] . "\t" : ''; - $data[ $key ][ 'order_from_name' ] = $is_first ? $order_data[ 'order_from_name' ] : ''; - $data[ $key ][ 'goods_total_money' ] = $is_first ? $order_data[ 'goods_money' ] : ''; - $data[ $key ][ 'delivery_money' ] = $is_first ? $order_data[ 'delivery_money' ] : ''; - $data[ $key ][ 'discount_money' ] = $is_first ? $order_data[ 'discount_money' ] : ''; - $data[ $key ][ 'order_money' ] = $is_first ? $order_data[ 'order_money' ] : ''; - $data[ $key ][ 'point' ] = $is_first ? $order_data[ 'point' ] : ''; - $data[ $key ][ 'taker_name' ] = $is_first ? $order_data[ 'taker_name' ] : ''; - $data[ $key ][ 'taker_mobile' ] = $is_first ? $order_data[ 'taker_mobile' ] . "\t" : ''; - $data[ $key ][ 'taker_full_address' ] = $is_first ? $order_data[ 'taker_full_address' ] : ''; - $data[ $key ][ 'delivery_type_name' ] = $is_first ? $order_data[ 'delivery_type_name' ] : ''; - $data[ $key ][ 'create_time' ] = $is_first ? $order_data[ 'create_time' ] : ''; - $data[ $key ][ 'pay_time' ] = $is_first ? $order_data[ 'pay_time' ] : ''; - $data[ $key ][ 'delivery_time' ] = $is_first ? $order_data[ 'delivery_time' ] : ''; - $data[ $key ][ 'finish_time' ] = $is_first ? $order_data[ 'finish_time' ] : ''; - $data[ $key ][ 'member_remark' ] = $is_first ? $order_data[ 'member_remark' ] : ''; - $data[ $key ][ 'shop_remark' ] = $is_first ? $order_data[ 'shop_remark' ] : ''; - $data[ $key ][ 'close_remark' ] = $is_first ? $order_data[ 'close_remark' ] : ''; - $data[ $key ][ 'out_trade_no' ] = $is_first ? $order_data[ 'out_trade_no' ] . "\t" : ''; - - $data[ $key ][ 'status_name' ] = $is_first ? $order_data[ 'status_name' ][ 'name' ] : ''; - $data[ $key ][ 'nickname' ] = $is_first ? ( !empty($order_data[ 'member' ]) ? $order_data[ 'member' ][ 'nickname' ] : '' ) : ''; - $data[ $key ][ 'mobile' ] = $is_first ? ( !empty($order_data[ 'member' ]) ? $order_data[ 'member' ][ 'mobile' ] . "\t" : '' ) : ''; - $data[ $key ][ 'member_no' ] = $is_first ? ( !empty($order_data[ 'member' ]) ? $order_data[ 'member' ][ 'member_no' ] . "\t" : '' ) : ''; - $data[ $key ][ 'pay_type' ] = $is_first ? ( !empty($order_data[ 'pay' ]) ? $order_data[ 'pay' ][ 'type_name' ] : '' ) : ''; - $data[ $key ][ 'invoice_type' ] = $is_first ? ( !empty($order_data[ 'invoice' ]) ? $order_data[ 'invoice' ][ 'type_name' ] : '' ) : ''; - $data[ $key ][ 'header_name' ] = $is_first ? ( !empty($order_data[ 'invoice' ]) ? $order_data[ 'invoice' ][ 'header_name' ] . "\t" : '' ) : ''; - $data[ $key ][ 'tax_number' ] = $is_first ? ( !empty($order_data[ 'invoice' ]) ? $order_data[ 'invoice' ][ 'tax_number' ] . "\t" : '' ) : ''; - $data[ $key ][ 'store_name' ] = $is_first ? ( !empty($order_data[ 'store' ]) ? $order_data[ 'store' ][ 'store_name' ] : '' ) : ''; - $data[ $key ][ 'pay_time' ] = $is_first ? ( !empty($order_data[ 'pay_time' ]) ? $order_data[ 'pay_time' ] : '' ) : ''; - $data[ $key ][ 'delivery_time' ] = $is_first ? ( !empty($order_data[ 'delivery_time' ]) ? $order_data[ 'delivery_time' ] : '' ) : ''; - $data[ $key ][ 'finish_time' ] = $is_first ? ( !empty($order_data[ 'finish_time' ]) ? $order_data[ 'finish_time' ] : '' ) : ''; - - $data[ $key ][ 'express_number' ] = !empty($val[ 'order_delivery' ]) ? $val[ 'order_delivery' ][ 'express_number' ] . "\t" : ''; - $data[ $key ][ 'company_name' ] = !empty($val[ 'order_delivery' ]) ? ( !empty($val[ 'order_delivery' ][ 'company' ]) ? $val[ 'order_delivery' ][ 'company' ][ 'company_name' ] : '' ) : ''; - - } - } - return $data; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/order_export/ShopOrderExportTypeListener.php b/niucloud/addon/shop/app/listener/order_export/ShopOrderExportTypeListener.php deleted file mode 100644 index 2c51e6b52..000000000 --- a/niucloud/addon/shop/app/listener/order_export/ShopOrderExportTypeListener.php +++ /dev/null @@ -1,67 +0,0 @@ - [ - 'name' => '订单列表', - 'column' => [ - 'order_no' => ['name' => '订单编号'], - 'member_no' => ['name' => '会员编号'], - 'nickname' => ['name' => '买家昵称'], - 'mobile' => ['name' => '买家手机号'], - 'goods_name' => ['name' => '商品名称'], - 'sku_name' => ['name' => '商品规格'], - 'num' => ['name' => '商品数量'], - 'price' => ['name' => '商品售价'], - 'goods_money' => ['name' => '商品小计'], - 'order_from_name' => ['name' => '订单来源'], - 'goods_total_money' => ['name' => '商品总价'], - 'delivery_money' => ['name' => '配送金额'], - 'discount_money' => ['name' => '优惠金额'], - 'order_money' => ['name' => '订单金额'], - 'point' => [ 'name' => '积分'], - 'taker_name' => ['name' => '收货人姓名'], - 'taker_mobile' => ['name' => '收货人手机号'], - 'taker_full_address' => ['name' => '收货地址'], - 'delivery_type_name' => ['name' => '配送方式'], - 'status_name' => ['name' => '订单状态'], - 'create_time' => ['name' => '订单创建时间'], - 'pay_time' => ['name' => '订单支付时间'], - 'delivery_time' => ['name' => '订单发货时间'], - 'finish_time' => ['name' => '订单完成时间'], - 'member_remark' => ['name' => '买家留言'], - 'shop_remark' => ['name' => '商家备注'], - 'close_remark' => ['name' => '关闭原因'], - 'out_trade_no' => ['name' => '支付流水号'], - 'pay_type' => ['name' => '支付方式'], - 'store_name' => ['name' => '自提门店'], - 'express_number' => ['name' => '物流单号'], - 'company_name' => ['name' => '物流公司'], - 'invoice_type' => ['name' => '发票类型'], - 'header_name' => ['name' => '发票抬头'], - 'tax_number' => ['name' => '发票税号'], - ] - ] - ]; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/order_export/ShopOrderGoodsExportDataListener.php b/niucloud/addon/shop/app/listener/order_export/ShopOrderGoodsExportDataListener.php deleted file mode 100644 index cb9981d06..000000000 --- a/niucloud/addon/shop/app/listener/order_export/ShopOrderGoodsExportDataListener.php +++ /dev/null @@ -1,122 +0,0 @@ -', Db::raw("pay.from_main_id")], - ['pay.from_main_id', '>', 0], - ['pay.status', '=', PayDict::STATUS_FINISH] - ]; - } else { - $pay_where[] = ['pay.type', '=', $param[ 'where' ]['pay_type']]; - } - } - $member_where = []; - if ($param['where']['keyword'] != '') { - $member_where = [ - ['member.member_no|member.nickname|member.username|member.mobile', 'like', "%" . $param[ 'where' ]['keyword'] . "%"], - ]; - } - //查询导出订单项数据 - $order_ids = $model->where([ [ 'order.order_id', '>', 0 ] ]) - ->withSearch([ 'search_type', 'order_from', 'join_status', 'create_time', 'join_pay_time' ], $param[ 'where' ]) - ->withJoin([ - 'pay' => function(Query $query) use ($pay_where) { - $query->where($pay_where); - }, - 'member' => function (Query $query) use ($member_where) { - $query->where($member_where); - }, - ], 'left') - ->field('order_id')->order('order.create_time desc')->column('order_id'); - - $order_goods_field = 'order_goods_id,order_id,member_id,delivery_id,goods_name,sku_name,price,num,goods_money,discount_money,order_refund_no,order_goods_money,goods_type,delivery_status,status'; - $order_field = 'order_id,order_no,order_from,taker_name,taker_mobile,taker_full_address,create_time,pay_time,delivery_money,delivery_type,delivery_time,finish_time,member_remark,shop_remark,out_trade_no,status'; - $search_model = $orderGoodsModel->where([['order_id', 'in', $order_ids]]) - ->with([ - 'order_delivery' => function($query) { - $query->field('id, express_company_id, express_number')->with('company'); - }, - 'orderMain' =>function ($query) use($order_field) { - $query->field($order_field)->with(['pay'])->append([ 'order_from_name', 'status_name', 'delivery_type_name' ]); - }, - 'member' => function($query) { - $query->field('member_id, nickname, mobile, member_no'); - }, - ]) - ->field($order_goods_field)->append(['status_name', 'delivery_status_name', 'goods_type_name']); - - $page = intval($param['page']['page']); - $limit = intval($param['page']['limit']); - if ($page > 0 && $limit > 0) { - $data = $search_model->page($page, $limit)->select(); - } else { - $data = $search_model->select(); - } - foreach ($data as $key => $val){ - $pay = $val['orderMain']['pay']; - if(!empty($pay)){ - $pay->append(['type_name']); - } - $data[$key]['order_no'] = $val['orderMain']['order_no']."\t"; - $data[$key]['nickname'] = !empty($val['member']) ? $val['member']['nickname'] : ''; - $data[$key]['mobile'] = !empty($val['member']) ? $val['member']['mobile'] . "\t" : ''; - $data[$key]['member_no'] = !empty($val['member']) ? $val['member']['member_no'] . "\t" : ''; - $data[$key]['order_from_name'] = $val['orderMain']['order_from_name']; - $data[$key]['taker_name'] = $val['orderMain']['taker_name']; - $data[$key]['taker_mobile'] = $val['orderMain']['taker_mobile']; - $data[$key]['taker_full_address'] = $val['orderMain']['taker_full_address']; - $data[$key]['delivery_type_name'] = $val['orderMain']['delivery_type_name']; - $data[$key]['delivery_money'] = $val['orderMain']['delivery_money']; - $data[$key]['order_status_name'] = $val['orderMain']['status_name']['name']; - $data[$key]['create_time'] = $val['orderMain']['create_time']; - $data[$key]['pay_time'] = !empty($val['orderMain']['pay_time']) ? $val['orderMain']['pay_time'] : ''; - $data[$key]['delivery_time'] = !empty($val['orderMain']['delivery_time']) ? $val['orderMain']['delivery_time'] : ''; - $data[$key]['finish_time'] = !empty($val['orderMain']['finish_time']) ? $val['orderMain']['finish_time'] : ''; - $data[$key]['member_remark'] = $val['orderMain']['member_remark']; - $data[$key]['shop_remark'] = $val['orderMain']['shop_remark']; - $data[$key]['out_trade_no'] = $val['orderMain']['out_trade_no']."\t"; - $data[$key]['pay_type'] = !empty($val['orderMain']['pay']) ? $val['orderMain']['pay']['type_name'] : ''; - $data[$key]['order_refund_no'] = $val['order_refund_no']."\t"; - $data[$key]['express_number'] = !empty($val['order_delivery']) ? $val['order_delivery']['express_number']."\t" : ''; - $data[$key]['company_name'] = !empty($val['order_delivery']) ? (!empty($val['order_delivery']['company']) ? $val['order_delivery']['company']['company_name'] : '') : ''; - } - $data = $data->toArray(); - } - return $data; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/order_export/ShopOrderGoodsExportTypeListener.php b/niucloud/addon/shop/app/listener/order_export/ShopOrderGoodsExportTypeListener.php deleted file mode 100644 index 43365bf95..000000000 --- a/niucloud/addon/shop/app/listener/order_export/ShopOrderGoodsExportTypeListener.php +++ /dev/null @@ -1,67 +0,0 @@ - [ - 'name' => '订单项列表', - 'column' => [ - 'order_no' => ['name' => '订单编号'], - 'order_goods_id' => ['name' => '子订单编号'], - 'goods_name' => [ 'name' => '商品名称'], - 'sku_name' => [ 'name' => '商品规格名称'], - 'member_no' => ['name' => '会员编号'], - 'nickname' => ['name' => '买家昵称'], - 'mobile' => ['name' => '买家手机号'], - 'price' => [ 'name' => '商品单价'], - 'num' => [ 'name' => '购买数量'], - 'goods_money' => [ 'name' => '商品总价'], - 'discount_money' => [ 'name' => '优惠金额'], - 'order_goods_money' => [ 'name' => '订单项实付金额'], - 'order_from_name' => ['name' => '订单来源'], - 'goods_type_name' => [ 'name' => '商品类型'], - 'taker_name' => ['name' => '收货人姓名'], - 'taker_mobile' => ['name' => '收货人手机号'], - 'taker_full_address' => ['name' => '收货地址'], - 'delivery_type_name' => ['name' => '配送方式'], - 'delivery_status_name' => [ 'name' => '配送状态'], - 'delivery_money' => ['name' => '配送金额'], - 'express_number' => [ 'name' => '物流单号'], - 'company_name' => [ 'name' => '物流公司'], - - 'order_status_name' => ['name' => '订单状态'], - 'create_time' => ['name' => '订单创建时间'], - 'pay_time' => ['name' => '订单支付时间'], - 'delivery_time' => ['name' => '订单发货时间'], - 'finish_time' => ['name' => '订单完成时间'], - 'member_remark' => ['name' => '买家留言'], - 'shop_remark' => ['name' => '商家备注'], - 'out_trade_no' => ['name' => '支付流水号'], - 'pay_type' => ['name' => '支付方式'], - - 'order_refund_no' => [ 'name' => '退款单号'], - 'status_name' => [ 'name' => '退款状态'] - ], - ] - ]; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/pay/PayCreateListener.php b/niucloud/addon/shop/app/listener/pay/PayCreateListener.php deleted file mode 100644 index 293eebbfa..000000000 --- a/niucloud/addon/shop/app/listener/pay/PayCreateListener.php +++ /dev/null @@ -1,42 +0,0 @@ -getInfo($params['trade_id']); - if ($order_info['status'] != OrderDict::WAIT_PAY) throw new CommonException('SHOP_ONLY_WAIT_PAY_CAN_BE_PAY'); - //添加订单支付表 - return [ - 'main_type' => PayDict::MEMBER, - 'main_id' => $order_info['member_id'],//买家id - 'money' => $order_info['order_money'],//订单金额 - 'trade_type' => $trade_type,//业务类型 - 'trade_id' => $params['trade_id'], - 'body' => $order_info['body'], - ]; - } - } -} diff --git a/niucloud/addon/shop/app/listener/pay/PaySuccessListener.php b/niucloud/addon/shop/app/listener/pay/PaySuccessListener.php deleted file mode 100644 index ec69fc5e9..000000000 --- a/niucloud/addon/shop/app/listener/pay/PaySuccessListener.php +++ /dev/null @@ -1,28 +0,0 @@ -pay($pay_info); - } - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/pay/RefundSuccessListener.php b/niucloud/addon/shop/app/listener/pay/RefundSuccessListener.php deleted file mode 100644 index 9c9f63779..000000000 --- a/niucloud/addon/shop/app/listener/pay/RefundSuccessListener.php +++ /dev/null @@ -1,34 +0,0 @@ -transferSuccess([ - 'refund_no' => $params[ 'refund_no' ], - 'order_refund_no' => $params[ 'trade_id' ], - ]); - return true; - } - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/point_exchange/AfterGoodsEdit.php b/niucloud/addon/shop/app/listener/point_exchange/AfterGoodsEdit.php deleted file mode 100644 index 34971e22b..000000000 --- a/niucloud/addon/shop/app/listener/point_exchange/AfterGoodsEdit.php +++ /dev/null @@ -1,32 +0,0 @@ -getInfo($where); - if (!empty($exchange_goods_info)) { - $sku_list = (new GoodsSku())->where([['goods_id', '=', $where['goods_id']]])->field('sku_id,stock')->select()->toArray(); - $sku_list = array_column($sku_list, null, 'sku_id'); - (new ExchangeService)->afterGoodsEdit($exchange_goods_info, $data['goods_data']['status'], $sku_list); - } - } catch (\Exception $e) { - Log::write('订单AfterShopOrderClose失败' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - } -} diff --git a/niucloud/addon/shop/app/listener/point_exchange/AfterShopOrderClose.php b/niucloud/addon/shop/app/listener/point_exchange/AfterShopOrderClose.php deleted file mode 100644 index c7f68b79d..000000000 --- a/niucloud/addon/shop/app/listener/point_exchange/AfterShopOrderClose.php +++ /dev/null @@ -1,98 +0,0 @@ -where($order_goods_where)->select()->toArray(); - //减去商品主体库存 - $core_goods_stock_service = new CoreGoodsStockService(); - foreach ($order_goods_data as $v) { - // todo 可以优化 暂不处理 - $core_goods_stock_service->inc([ - 'num' => $v['num'], - 'goods_id' => $v['goods_id'], - 'sku_id' => $v['sku_id'], - ]); - } - //销量 + 兑换数量 +累积分消费 返还 - $core_goods_sale_num_service = new CoreGoodsSaleNumService(); - $dec_data = []; - foreach ($order_goods_data as $v) { - //商品累计销量 -// $core_goods_sale_num_service->dec([ -// 'num' => $v['num'], -// 'goods_id' => $v['goods_id'], -// 'sku_id' => $v['sku_id'], -// 'id' => $order_data['relate_id'], -// 'point' => $order_data['point'], -// 'goods_money' => $v['goods_money'], -// ]); - - $dec_data[] = [ - 'total_exchange_num' => Db::raw('total_exchange_num-' . $v['num']), - 'total_member_num' => Db::raw('total_member_num-1'), - 'total_point_num' => Db::raw('total_point_num-' . $order_data['point']), - 'total_price_num' => Db::raw('total_price_num-' . $v['goods_money']), - 'total_order_num' => Db::raw('total_order_num-1'), - 'update_time'=>time(), -// 'goods_id' => $v['goods_id'], -// 'sku_id' => $v['sku_id'], - 'id' => $order_data['relate_id'], - ]; - - - } - $core_goods_sale_num_service->batchUpdate($dec_data); - $point = 0; - foreach ($order_goods_data as $v) { - if (empty($v['order_refund_no'])) { - $point = ($v['extend']['point'] ?? 0) * $v['num']; - $from_type = 'account_point_exchange_close'; - $memo = '积分商城订单关闭积分返还'; - } else { - $order_refund_info = (new OrderRefund)->where([ - ['order_refund_no', '=', $v['order_refund_no']] - ])->findOrEmpty(); - if ($order_refund_info->isEmpty()) throw new CommonException('SHOP_ORDER_REFUND_IS_INVALID');//退款已失效 -// if ($order_refund_info['money'] == $v['order_goods_money']) { - $point = ($v['extend']['point'] ?? 0) * $v['num']; - $from_type = 'account_point_exchange_refund'; - $memo = '积分商城订单售后成功积分返还'; -// } - } - if ($point > 0) { - (new CoreMemberAccountService())->addLog($order_data['member_id'], 'point', $order_data['point'], $from_type, $memo ?? ''); - } - } - } - } catch ( Exception $e ) { - Log::write('订单AfterShopOrderClose失败' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - } -} diff --git a/niucloud/addon/shop/app/listener/point_exchange/AfterShopOrderCreate.php b/niucloud/addon/shop/app/listener/point_exchange/AfterShopOrderCreate.php deleted file mode 100644 index aa55c4937..000000000 --- a/niucloud/addon/shop/app/listener/point_exchange/AfterShopOrderCreate.php +++ /dev/null @@ -1,73 +0,0 @@ -dec([ - 'num' => $v['num'], - 'goods_id' => $v['goods_id'], - 'sku_id' => $v['sku_id'] - ]); - } - - //累增销量 + 兑换数量 +累积分消费.. - $core_goods_sale_num_service = new CoreGoodsSaleNumService(); - $inc_data = []; - foreach ($order_goods_data as $v) { - //商品累计销量 -// $core_goods_sale_num_service->inc([ -// 'num' => $v[ 'num' ], -// 'goods_id' => $v[ 'goods_id' ], -// 'sku_id' => $v[ 'sku_id' ], -// 'id' => $order_data[ 'relate_id' ], -// 'point' => $order_data[ 'point' ], -// 'goods_money' => $v[ 'goods_money' ], -// ]); - $inc_data[] = [ - 'total_exchange_num' => Db::raw('total_exchange_num+' . $v['num']), - 'total_member_num' => Db::raw('total_member_num+1'), - 'total_point_num' => Db::raw('total_point_num+' . $order_data['point']), - 'total_price_num' => Db::raw('total_price_num+' . $v['goods_money']), - 'total_order_num' => Db::raw('total_order_num+1'), - 'update_time' => time(), -// 'goods_id' => $v['goods_id'], -// 'sku_id' => $v['sku_id'], - 'id' => $order_data['relate_id'], - ]; - } - $core_goods_sale_num_service->batchUpdate($inc_data); - } - } catch (\Exception $e) { - Log::write('订单AfterShopOrderCreate失败' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - } -} diff --git a/niucloud/addon/shop/app/listener/point_exchange/ShopOrderDiscountCreate.php b/niucloud/addon/shop/app/listener/point_exchange/ShopOrderDiscountCreate.php deleted file mode 100644 index b0cbc868c..000000000 --- a/niucloud/addon/shop/app/listener/point_exchange/ShopOrderDiscountCreate.php +++ /dev/null @@ -1,26 +0,0 @@ -addLog($data['order_object']->member_id, 'point', -$data['order_object']->basic['point_sum'], 'account_point_exchange_order', '积分商城消费扣款积分'); - } - } catch (\Exception $e) { - throw new CommonException($e->getMessage()); - } - } -} diff --git a/niucloud/addon/shop/app/listener/poster/ShopPoster.php b/niucloud/addon/shop/app/listener/poster/ShopPoster.php deleted file mode 100644 index 4b32048cd..000000000 --- a/niucloud/addon/shop/app/listener/poster/ShopPoster.php +++ /dev/null @@ -1,271 +0,0 @@ - 'sku_id', 'value' => $sku_id ] - ]; - $return_data = [ - 'nickname' => '会员昵称', - 'headimg' => 'static/resource/images/default_headimg.png', - 'goods_name' => '商品名称', - 'goods_price' => '¥369.00', - 'goods_market_price' => '¥3690.00', - 'goods_img' => 'addon/shop/goods_template.png', - 'url' => [ - 'url' => ( new CoreSysConfigService() )->getSceneDomain()[ 'wap_url' ], - 'page' => 'addon/shop/pages/goods/detail', - 'data' => $url_data, - ], - ]; - return $return_data; - } - - // 查询sku信息 - $sku = ( new GoodsSku() )->where([ [ 'sku_id', '=', $sku_id ] ])->findOrEmpty(); - - if ($sku->isEmpty()) return []; - - $goods_id = $sku[ 'goods_id' ]; - $goods = ( new Goods() )->where([ [ 'goods_id', '=', $goods_id ] ])->findOrEmpty(); - if ($goods->isEmpty()) return []; - - $goods_name = $goods[ 'goods_name' ] . $sku[ 'sku_name' ]; -// if (mb_strlen($goods_name, 'UTF-8') > 14) { -// $goods_name = mb_substr($goods_name, 0, 14, 'UTF-8') . '...'; -// } - -// $service_ids = $goods['service_ids']; -// if(!empty($service_ids)){ -// // 商品服务 -// $goods_service_model = new Service(); -// $services = $goods_service_model->where([ -// [ 'service_id', 'in', $service_ids ] -// ])->column('service_name'); -// $services = implode('·', $services); -// } - - $sku_img = $sku[ 'sku_image' ]; - if (empty($sku_img)) { - $sku_img = $goods[ 'goods_cover' ]; - } - if (empty($sku_img)) { - $sku_img = 'addon/shop/goods_template.png'; - } - $market_price_text = $sku[ 'market_price' ] > 0 ? '¥' . $sku[ 'market_price' ] : ''; - $url_data = [ - [ 'key' => 'sku_id', 'value' => $sku_id ] - ]; - - $member_info = []; - $show_price_data[] = $sku[ 'sale_price' ]; - - switch ($active){ - case ActiveDict::NEWCOMER_DISCOUNT: - if ($member_id > 0){ - //查询新人专享活动 - $newcomer_goods_info = ( new ActiveGoods() )->field('active_id,active_goods_value')->where([ - [ 'goods_id', '=', $goods_id ], - [ 'sku_id', '=', $sku_id ], - [ 'active_class', '=', ActiveDict::NEWCOMER_DISCOUNT ] - ])->with([ - 'active' => function($query) { - $query->field('active_id,active_desc,active_status,active_value'); - } - ])->findOrEmpty()->toArray(); - - if (!empty($newcomer_goods_info) && $newcomer_goods_info[ 'active' ][ 'active_status' ] == ActiveDict::ACTIVE) { -// $url_data[] = [ 'key' => 'type', 'value' => 'newcomer_discount' ]; - $url_data[] = [ 'key' => 'type', 'value' => 'nd' ]; - $newcomer_price = json_decode($newcomer_goods_info[ 'active_goods_value' ], true)[ 'newcomer_price' ]; - if ($newcomer_price > 0) $show_price_data[] = $newcomer_price; - } - } - break; - case ActiveDict::DISCOUNT: - //查看商品是否参加限时折扣活动 - $discount = (new DiscountGoods())->where([ - [ 'goods_id', '=', $goods_id ], - [ 'sku_id', '=', $sku_id ], - [ 'status', '=', DiscountDict::ACTIVE ], - [ 'is_enabled', '=', DiscountDict::YES ], - ])->findOrEmpty(); - if (!$discount->isEmpty()){ - $discount_price = $sku[ 'sale_price' ] ?? 0; - if ($discount_price >= 0) $show_price_data[] = $discount_price; - } - break; - default: - if ($member_id > 0) { - $url_data[] = [ 'key' => 'mid', 'value' => $member_id ]; - - //查询会员信息 - $member_info = ( new Member() )->where([ [ 'member_id', '=', $member_id ] ])->findOrEmpty(); - - if (!empty($member_info)) { - if (empty($member_info[ 'headimg' ])) { - $member_info[ 'headimg' ] = 'static/resource/images/default_headimg.png'; - } - } - - // 查询会员价 - $goods_service = new GoodsService(); - - $member_price = $goods_service->getMemberPrice($goods_service->getMemberInfo(), $goods[ 'member_discount' ], $sku[ 'member_price' ], $sku[ 'price' ]); - if ($member_price > 0) $show_price_data[] = $member_price; - } - - //查看商品是否参加限时折扣活动 - $discount = (new DiscountGoods())->where([ - [ 'goods_id', '=', $goods_id ], - [ 'sku_id', '=', $sku_id ], - [ 'status', '=', DiscountDict::ACTIVE ], - [ 'is_enabled', '=', DiscountDict::YES ], - ])->findOrEmpty(); - if (!$discount->isEmpty()){ - $discount_price = $sku[ 'sale_price' ] ?? 0; - if ($discount_price >= 0) $show_price_data[] = $discount_price; - } - - } - $show_price = min($show_price_data); - $max_length = 35; - if (mb_strlen($goods_name, 'UTF-8') > $max_length) { - $goods_name = mb_substr($goods_name, 0, $max_length, 'UTF-8') . '...'; - } - $return_data = [ - 'goods_name' => $goods_name, -// 'services' => $services, - 'goods_price' => '¥' . $show_price, - 'goods_market_price' => $market_price_text, - 'goods_img' => $sku_img, - 'url' => [ - 'url' => ( new CoreSysConfigService() )->getSceneDomain()[ 'wap_url' ], - 'page' => 'addon/shop/pages/goods/detail', - 'data' => $url_data, - ], - ]; - if (!empty($member_info)) { - $return_data[ 'nickname' ] = mb_strlen($member_info[ 'nickname' ]) > 10 ? mb_substr($member_info[ 'nickname' ], 0, 7, 'utf-8') . '...' : $member_info[ 'nickname' ]; - $return_data[ 'headimg' ] = $member_info[ 'headimg' ]; - } - Log::write('海报数据'.json_encode($return_data,256)); - return $return_data; - } elseif ($type == 'shop_point_goods') { - - // 积分商品 海报模板数据 - - $param = $data[ 'param' ]; - $id = $param[ 'id' ] ?? 0; - $member_id = $param[ 'member_id' ] ?? 0; - $mode = $param[ 'mode' ] ?? ''; - - if ($mode == 'preview') { - // 预览模式 - $url_data = [ - [ 'key' => 'id', 'value' => $id ] - ]; - $return_data = [ - 'nickname' => '会员昵称', - 'headimg' => 'static/resource/images/default_headimg.png', - 'goods_name' => '商品名称', - 'goods_price' => '积分100+¥369.00', - 'goods_img' => 'addon/shop/goods_template.png', - 'url' => [ - 'url' => ( new CoreSysConfigService() )->getSceneDomain()[ 'wap_url' ], - 'page' => 'addon/shop/pages/point/detail', - 'data' => $url_data, - ], - ]; - return $return_data; - } - - // 查询sku信息 - $exchange_info = ( new Exchange() )->withSearch([ 'ids' ], [ 'ids' => $id ])->findOrEmpty(); - if ($exchange_info->isEmpty()) return []; - $goods_name = $exchange_info[ 'names' ]; -// if (mb_strlen($goods_name, 'UTF-8') > 14) { -// $goods_name = mb_substr($goods_name, 0, 14, 'UTF-8') . '...'; -// } - $sku_img = explode(',', $exchange_info[ 'image' ])[ 0 ]; - if (empty($sku_img)) { - $sku_img = 'addon/shop/goods_template.png'; - } - $url_data = [ - [ 'key' => 'id', 'value' => $id ] - ]; - - $member_info = []; - - if ($member_id > 0) { - $url_data[] = [ 'key' => 'mid', 'value' => $member_id ]; - - //查询会员信息 - $member_info = ( new Member() )->where([ [ 'member_id', '=', $member_id ] ])->findOrEmpty(); - - if (!empty($member_info)) { - if (empty($member_info[ 'headimg' ])) { - $member_info[ 'headimg' ] = 'static/resource/images/default_headimg.png'; - } - } - } - $price = $exchange_info[ 'price' ] <= 0 ? '' : '+¥' . $exchange_info[ 'price' ]; - $return_data = [ - 'goods_name' => $goods_name, - 'goods_price' => "积分:" . $exchange_info[ 'point' ] . $price, - 'goods_img' => $sku_img, - 'url' => [ - 'url' => ( new CoreSysConfigService() )->getSceneDomain()[ 'wap_url' ], - 'page' => 'addon/shop/pages/point/detail', - 'data' => $url_data, - ], - ]; - - if (!empty($member_info)) { - $return_data[ 'nickname' ] = mb_strlen($member_info[ 'nickname' ]) > 10 ? mb_substr($member_info[ 'nickname' ], 0, 7, 'utf-8') . '...' : $member_info[ 'nickname' ]; - $return_data[ 'headimg' ] = $member_info[ 'headimg' ]; - } - return $return_data; - - } - } -} diff --git a/niucloud/addon/shop/app/listener/poster/ShopPosterType.php b/niucloud/addon/shop/app/listener/poster/ShopPosterType.php deleted file mode 100644 index e128b938d..000000000 --- a/niucloud/addon/shop/app/listener/poster/ShopPosterType.php +++ /dev/null @@ -1,37 +0,0 @@ - 'shop_goods', - 'addon' => 'shop', - 'name' => '商品海报', - 'desc' => '推广商品,分享后进入商品详情页', - 'icon' => 'addon/shop/poster/type_shop_goods.png' - ], - [ - 'type' => 'shop_point_goods', - 'addon' => 'shop', - 'name' => '积分商品海报', - 'desc' => '推广积分商品,分享后进入积分商品详情页', - 'icon' => 'addon/shop/poster/type_shop_goods.png' - ], - ]; - - } -} diff --git a/niucloud/addon/shop/app/listener/printer/PrinterContentListener.php b/niucloud/addon/shop/app/listener/printer/PrinterContentListener.php deleted file mode 100644 index 1b9e785f6..000000000 --- a/niucloud/addon/shop/app/listener/printer/PrinterContentListener.php +++ /dev/null @@ -1,648 +0,0 @@ -getList([ - [ 'status', '=', 1 ], - [ 'template_type', 'like', [ '%shopGoodsOrder%' ], 'or' ], - [ 'trigger', 'like', [ '%shopGoodsOrder_trigger_pay_after%', '%shopGoodsOrder_trigger_take_delivery%', '%shopGoodsOrder_trigger_manual%' ], 'or' ], - ], 'printer_id,brand,printer_name,printer_code,printer_key,open_id,apikey,value'); - - if (empty($printer_list)) { - return [ - 'code' => -1, - 'message' => '未找到小票打印机' - ]; - } - - // 查询订单信息 - $order_model = new Order(); - $field = 'order_id, order_no, order_from, out_trade_no, status, member_id,taker_name, taker_mobile, goods_money, delivery_money, discount_money, order_money, create_time, pay_time, finish_time, delivery_type, take_store_id, taker_name, taker_mobile, taker_full_address, member_remark, shop_remark'; - $order_info = $order_model->where([ [ 'order_id', '=', $params[ 'business' ][ 'order_id' ] ] ])->field($field) - ->with( - [ - 'order_goods' => function($query) { - $query->field('order_goods_id, order_id, goods_id, sku_id, goods_name, sku_name, price, num, goods_money, discount_money, status, order_goods_money, original_price')->append([ 'status_name' ]); - }, - 'member' => function($query) { - $query->field('member_id,nickname,mobile,balance,point'); - } - ])->append([ 'order_from_name', 'status_name', 'delivery_type_name' ])->findOrEmpty()->toArray(); - - if (empty($order_info)) { - return [ - 'code' => -1, - 'message' => '未找到订单信息' - ]; - } - - if ($order_info[ 'out_trade_no' ]) { - $order_info[ 'pay' ] = ( new Pay() )->where([ [ 'out_trade_no', '=', $order_info[ 'out_trade_no' ] ] ]) - ->field('out_trade_no, type, pay_time')->append([ 'type_name' ])->findOrEmpty()->toArray(); - } - - $res_data = []; - - $printer_template_model = new SysPrinterTemplate(); - - // 拼装打印内容 - foreach ($printer_list as $k => $v) { - - if (!empty($v[ 'value' ] [ $params[ 'type' ] ]) && !empty($v[ 'value' ] [ $params[ 'type' ] ] [ 'trigger_' . $params[ 'trigger' ] ])) { - $info = $v[ 'value' ] [ $params[ 'type' ] ] [ 'trigger_' . $params[ 'trigger' ] ]; - - // 过滤不符合条件的模板 - if (in_array($order_info[ 'delivery_type' ], $info[ 'print_delivery_type' ]) == false) { - continue; - } - - // 查询小票模板内容 - $template_info = $printer_template_model->field('value')->where([ - [ 'template_id', "=", $info[ 'template_id' ] ], - [ 'template_type', '=', $params[ 'type' ] ] - ])->findOrEmpty()->toArray(); - - if (empty($template_info) && empty($template_info[ 'value' ])) { - continue; - } - - $template_info_value = $template_info[ 'value' ]; - - $content = "" . $info[ 'print_num' ] . ""; - - // 获取 票头信息内容 - $content .= $this->getTicketHeadContent($template_info_value[ 'head_info' ]); - - // 获取 订单信息内容 - $content .= $this->getOrderInfoContent($template_info_value[ 'order_info' ], $order_info); - - // 获取 商品信息内容 - $content .= $this->getGoodsInfoContent($template_info_value[ 'goods_info' ], $order_info); - - // 获取 买家/收货信息内容 - $content .= $this->getMemberInfoContent($template_info_value[ 'buyer_info' ], $order_info); - - // 获取 底部信息内容 - $content .= $this->getBottomInfoContent($template_info_value[ 'bottom_info' ]); - - $item = [ - 'printer_info' => $v, - 'origin_id' => $order_info[ 'order_no' ], // 内部订单号(32位以内) - 'content' => $content - ]; - - $res_data[] = $item; - - } - - } - - return [ - 'code' => 0, - 'message' => '', - 'data' => $res_data - ]; - } - - /** - * 获取票头信息内容 - * @param $data - * @return string - */ - private function getTicketHeadContent($data) - { - - $content = ''; - - // 小票名称 - if ($data[ 'ticket_name' ][ 'status' ] == 1 && !empty($data[ 'ticket_name' ][ 'value' ])) { - - // 文字大小 - if ($data[ 'ticket_name' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - // 文字加粗 - if ($data[ 'ticket_name' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - $content .= "
"; - $content .= $data[ 'ticket_name' ][ 'value' ]; - $content .= "
"; - - if ($data[ 'ticket_name' ][ 'fontWeight' ] == 'bold') { - $content .= "
"; - } - - // 文字大小 - if ($data[ 'ticket_name' ][ 'fontSize' ] == 'big') { - $content .= "
"; - } - - $content .= str_repeat('.', 32); - } - - $site_info = ( new ConfigService() )->getWebSite(); - - // 商城名称 - if ($data[ 'shop_name' ][ 'status' ] == 1 && !empty($site_info[ 'site_name' ])) { - - // 文字大小 - if ($data[ 'shop_name' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - // 文字加粗 - if ($data[ 'shop_name' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - $content .= "
"; - $content .= $site_info[ 'site_name' ]; - $content .= "
"; - - if ($data[ 'shop_name' ][ 'fontWeight' ] == 'bold') { - $content .= "
"; - } - - // 文字大小 - if ($data[ 'shop_name' ][ 'fontSize' ] == 'big') { - $content .= "
"; - } - - $content .= str_repeat('.', 32); - } - - return $content; - } - - /** - * 获取订单信息内容 - * @param $data - * @param $order_info - * @return string - */ - private function getOrderInfoContent($data, $order_info) - { - $content = ''; - - // 订单基础信息 - if ($data[ 'order_item' ][ 'status' ] == 1 && !empty($data[ 'order_item' ][ 'value' ])) { - - // 订单编号 - if (in_array('order_no', $data[ 'order_item' ][ 'value' ])) { - $content .= '订单编号:' . $order_info[ 'order_no' ] . "\n"; - } - - // 订单来源 - if (in_array('order_from', $data[ 'order_item' ][ 'value' ])) { - $content .= '订单来源:' . $order_info[ 'order_from_name' ] . "\n"; - } - - // 订单状态 - if (in_array('order_status', $data[ 'order_item' ][ 'value' ])) { - $content .= '订单状态:' . $order_info[ 'status_name' ][ 'name' ] . "\n"; - } - - // 支付方式 - if (in_array('pay_type', $data[ 'order_item' ][ 'value' ])) { - $content .= '支付方式:' . $order_info[ 'pay' ][ 'type_name' ] . "\n"; - } - - // 配送方式 - if (in_array('delivery_type', $data[ 'order_item' ][ 'value' ])) { - $content .= '配送方式:' . $order_info[ 'delivery_type_name' ] . "\n"; - } - - // 下单时间 - if (in_array('create_time', $data[ 'order_item' ][ 'value' ])) { - $content .= '下单时间:' . $order_info[ 'create_time' ] . "\n"; - } - - // 付款时间 - if (in_array('pay_time', $data[ 'order_item' ][ 'value' ])) { - $content .= '付款时间:' . $order_info[ 'pay_time' ] . "\n"; - } - - // 商品总额 - if (in_array('goods_money', $data[ 'order_item' ][ 'value' ]) && $order_info[ 'goods_money' ] > 0) { - $content .= '商品总额:¥' . $order_info[ 'goods_money' ] . "\n"; - } - - // 优惠金额 - if (in_array('discount_money', $data[ 'order_item' ][ 'value' ]) && $order_info[ 'discount_money' ] > 0) { - $content .= '优惠金额:¥' . $order_info[ 'discount_money' ] . "\n"; - } - - // 配送金额 - if (in_array('delivery_money', $data[ 'order_item' ][ 'value' ]) && $order_info[ 'delivery_money' ] > 0) { - $content .= '配送金额:¥' . $order_info[ 'delivery_money' ] . "\n"; - } - - } - - // 实付金额 - if ($data[ 'order_money' ][ 'status' ] == 1) { - - // 文字大小 - if ($data[ 'order_money' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - // 文字加粗 - if ($data[ 'order_money' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - $content .= '实付金额:¥' . $order_info[ 'order_money' ]; - - if ($data[ 'order_money' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - // 文字大小 - if ($data[ 'order_money' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - $content .= "\n"; - } - - // 商家备注 - if ($data[ 'shop_remark' ][ 'status' ] == 1 && !empty($order_info[ 'shop_remark' ])) { - - // 文字大小 - if ($data[ 'shop_remark' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - // 文字加粗 - if ($data[ 'shop_remark' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - $content .= '商家备注:' . $order_info[ 'shop_remark' ] . "\n"; - - if ($data[ 'shop_remark' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - // 文字大小 - if ($data[ 'shop_remark' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - } - - if ($data[ 'order_item' ][ 'status' ] == 1 || $data[ 'order_money' ][ 'status' ] == 1 || $data[ 'shop_remark' ][ 'status' ] == 1) { - $content .= str_repeat('.', 32); - } - - return $content; - } - - /** - * 获取 商品信息内容 - * @param $data - * @param $order_info - * @return string - */ - private function getGoodsInfoContent($data, $order_info) - { - $content = ''; - - $content .= ""; - $content .= ""; - - $content .= ""; - $content .= ""; - $content .= ""; - - if ($data[ 'goods_price' ][ 'status' ] == 1) { - $content .= ""; - } - - $content .= ""; - $content .= "
商品名称数量金额
\n"; - - $content .= ""; - foreach ($order_info[ 'order_goods' ] as $goods_k => $goods_v) { - - $content .= ""; - - $content .= ""; - - $content .= ""; - $content .= ""; - - if ($data[ 'goods_price' ][ 'status' ] == 1) { - $content .= ""; - } - $content .= ""; - - } - - $content .= "
"; - - // 文字大小 - if ($data[ 'goods_name' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - // 文字加粗 - if ($data[ 'goods_name' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - $content .= $goods_v[ 'goods_name' ] . ' ' . $goods_v[ 'sku_name' ]; - - // 文字加粗 - if ($data[ 'goods_name' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - // 文字大小 - if ($data[ 'goods_name' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - $content .= "x" . $goods_v[ 'num' ] . ""; - - // 文字大小 - if ($data[ 'goods_price' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - // 文字加粗 - if ($data[ 'goods_price' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - $content .= "¥" . $goods_v[ 'price' ]; - - // 文字加粗 - if ($data[ 'goods_price' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - // 文字大小 - if ($data[ 'goods_price' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - $content .= "
\n"; - $content .= str_repeat('.', 32); - return $content; - } - - /** - * 获取 买家/收货信息内容 - * @param $data - * @param $order_info - * @return string - */ - private function getMemberInfoContent($data, $order_info) - { - $content = ''; - - // 会员基础信息 - if ($data[ 'member_basic_info' ][ 'status' ] == 1) { - - // 买家昵称 - if (in_array('nickname', $data[ 'member_basic_info' ][ 'value' ])) { - $content .= '会员昵称:' . $order_info[ 'member' ][ 'nickname' ] . "\n"; - } - - // 账户余额 - if (in_array('account_balance', $data[ 'member_basic_info' ][ 'value' ])) { - $content .= '账户余额:¥' . $order_info[ 'member' ][ 'balance' ] . "\n"; - } - - // 账户积分 - if (in_array('account_point', $data[ 'member_basic_info' ][ 'value' ])) { - $content .= '账户积分:' . $order_info[ 'member' ][ 'point' ] . "\n"; - } - - } - - // 买家手机号 - if ($data[ 'buyer_mobile' ][ 'status' ] == 1 && !empty($order_info[ 'member' ][ 'mobile' ])) { - - // 文字大小 - if ($data[ 'buyer_mobile' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - // 文字加粗 - if ($data[ 'buyer_mobile' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - if ($data[ 'buyer_mobile' ][ 'value' ] == 'yes') { - $content .= '会员手机号:' . substr($order_info[ 'member' ][ 'mobile' ], 0, 3) . '****' . substr($order_info[ 'member' ][ 'mobile' ], 6 + 1); - } else { - $content .= '会员手机号:' . $order_info[ 'member' ][ 'mobile' ]; - } - - if ($data[ 'buyer_mobile' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - // 文字大小 - if ($data[ 'buyer_mobile' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - $content .= "\n"; - - $content .= str_repeat('.', 32); - } - - // 收货人姓名 - if ($data[ 'taker_name' ][ 'status' ] == 1 && !empty($order_info[ 'taker_name' ])) { - - // 文字大小 - if ($data[ 'taker_name' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - // 文字加粗 - if ($data[ 'taker_name' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - $content .= '收货人:' . $order_info[ 'taker_name' ]; - - if ($data[ 'taker_name' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - // 文字大小 - if ($data[ 'taker_name' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - $content .= "\n"; - - } - - // 收货人手机号 - if ($data[ 'taker_mobile' ][ 'status' ] == 1) { - - // 文字大小 - if ($data[ 'taker_mobile' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - // 文字加粗 - if ($data[ 'taker_mobile' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - if ($data[ 'taker_mobile' ][ 'value' ] == 'yes') { - $content .= '联系方式:' . substr($order_info[ 'taker_mobile' ], 0, 3) . '****' . substr($order_info[ 'taker_mobile' ], 6 + 1); - } else { - $content .= '联系方式:' . $order_info[ 'taker_mobile' ]; - } - - if ($data[ 'taker_mobile' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - // 文字大小 - if ($data[ 'taker_mobile' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - $content .= "\n"; - - } - - // 收货人地址 - if ($data[ 'taker_full_address' ][ 'status' ] == 1) { - - // 文字大小 - if ($data[ 'taker_full_address' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - // 文字加粗 - if ($data[ 'taker_full_address' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - $content .= '收货地址:' . $order_info[ 'taker_full_address' ]; - - if ($data[ 'taker_full_address' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - // 文字大小 - if ($data[ 'taker_full_address' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - $content .= "\n"; - - } - - // 买家备注 - if ($data[ 'member_remark' ][ 'status' ] == 1 && !empty($order_info[ 'member_remark' ])) { - - // 文字大小 - if ($data[ 'member_remark' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - // 文字加粗 - if ($data[ 'member_remark' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - $content .= '买家备注:' . $order_info[ 'member_remark' ]; - - if ($data[ 'member_remark' ][ 'fontWeight' ] == 'bold') { - $content .= ""; - } - - // 文字大小 - if ($data[ 'member_remark' ][ 'fontSize' ] == 'big') { - $content .= ""; - } - - $content .= "\n"; - } - - if ($data[ 'member_basic_info' ][ 'status' ] == 1 || $data[ 'buyer_mobile' ][ 'status' ] == 1 || - $data[ 'taker_name' ][ 'status' ] == 1 || $data[ 'taker_mobile' ][ 'status' ] == 1 || - $data[ 'taker_full_address' ][ 'status' ] == 1 || $data[ 'member_remark' ][ 'status' ] == 1) { - $content .= "\n"; - } - - return $content; - } - - /** - * 获取 底部信息内容 - * @param $data - * @return string - */ - private function getBottomInfoContent($data) - { - $content = ''; - - // 二维码 - if ($data[ 'qrcode' ][ 'status' ] == 1) { - $content .= "" . $data[ 'qrcode' ][ 'value' ] . "\n\n"; - } - - // 小票打印时间 - if ($data[ 'ticket_print_time' ][ 'status' ] == 1) { - $content .= '
打印时间:' . date('Y-m-d H:i:s', time()) . "
\n"; - } - - // 底部信息 - if ($data[ 'bottom_remark' ][ 'status' ] == 1) { - $content .= "
" . $data[ 'bottom_remark' ][ 'value' ] . "
\n"; - } - - return $content; - } - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/recharge/GiftContentListener.php b/niucloud/addon/shop/app/listener/recharge/GiftContentListener.php deleted file mode 100644 index c5b82080e..000000000 --- a/niucloud/addon/shop/app/listener/recharge/GiftContentListener.php +++ /dev/null @@ -1,34 +0,0 @@ - $v) { - $data[ 'detail' ][] = $v[ 'num' ] . '张 ' . ( isset($v[ 'title' ]) ? $v[ 'title' ] : '' ); - } - } - return $data; - } -} diff --git a/niucloud/addon/shop/app/listener/recharge/RechargeAfterListener.php b/niucloud/addon/shop/app/listener/recharge/RechargeAfterListener.php deleted file mode 100644 index 275fe65fa..000000000 --- a/niucloud/addon/shop/app/listener/recharge/RechargeAfterListener.php +++ /dev/null @@ -1,42 +0,0 @@ - $value) { - if ($key == 'coupon') { - Log::write('会员充值赠送优惠券开始', json_encode($value[ 'value' ])); - foreach ($value[ 'value' ] as $v) { - try { - ( new CoreCouponMemberService() )->sendCoupon($member_id, $v[ 'coupon_id' ], $v[ 'num' ]); - } catch (CommonException $e) { - Log::write('会员充值赠送优惠券“' . $v[ 'coupon_id' ] . '”发放失败,错误原因:' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - } - } - } - } -} diff --git a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundActiveCreate.php b/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundActiveCreate.php deleted file mode 100644 index 8d9859fc3..000000000 --- a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundActiveCreate.php +++ /dev/null @@ -1,48 +0,0 @@ -add([ - 'order_refund_no' => $refund_data[ 'order_refund_no' ], - 'status' => $refund_data[ 'status' ], - 'main_type' => $main_type,//todo 可以是传入的 - 'main_id' => $main_id, - 'type' => OrderRefundDict::SHOP_ACTIVE_REFUND_ACTION, - 'content' => '商品【'.$order_goods_info['goods_name'].' '.$order_goods_info['sku_name'].'】商家主动退款,退款金额:'.$refund_data['money'].'元,退款说明:'.$refund_data['remark'] - ]); - - //todo 消息发送 - - if ($refund_data[ 'status' ] == OrderRefundDict::STORE_AGREE_REFUND_WAIT_TRANSFER) { - if ($refund_data['money'] > 0) { - //订单到达待付款 - (new CoreRefundService())->toTransfer($refund_data, $main_type, $main_id); - } else { - (new CoreRefundService())->finish([ - 'order_refund_no' => $refund_data['order_refund_no'], - 'main_type' => $main_type, - 'main_id' => $main_id - ]); - } - } - } -} diff --git a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundApply.php b/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundApply.php deleted file mode 100644 index cd3841249..000000000 --- a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundApply.php +++ /dev/null @@ -1,41 +0,0 @@ -where([ [ 'order_id', '=', $refund_data[ 'order_id' ] ] ])->findOrEmpty(); - //通知三方应用更新订单状态 - if(!empty($order['relate_source'])){ - (new CoreOrderNoticeService())->sendRefundApplyNotice($refund_data,$order['relate_source'],$order['relate_order_id']); - } - //日志 - (new CoreRefundLogService())->add([ - 'order_refund_no' => $refund_data['order_refund_no'], - 'status' => $refund_data['status'], - 'main_type' => $main_type,//todo 可以是传入的 - 'main_id' => $main_id, - 'type' => OrderRefundDict::APPLY_ACTION, - 'content' => '' - ]); - //消息发送 - - } -} diff --git a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundAuditApply.php b/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundAuditApply.php deleted file mode 100644 index 211591462..000000000 --- a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundAuditApply.php +++ /dev/null @@ -1,55 +0,0 @@ -add([ - 'order_refund_no' => $refund_data[ 'order_refund_no' ], - 'status' => $refund_data[ 'status' ], - 'main_type' => $main_type,//todo 可以是传入的 - 'main_id' => $main_id, - 'type' => $log_type, - 'content' => '' - ]); - - //消息发送 - $message_key = $refund_data[ 'status' ] == OrderRefundDict::STORE_REFUSE_REFUND_GOODS_APPLY_WAIT_BUYER ? 'shop_refund_refuse' : 'shop_refund_agree'; - ( new NoticeService() )->send($message_key, [ 'order_refund_no' => $refund_data[ 'order_refund_no' ] ]); - if ($refund_data[ 'status' ] == OrderRefundDict::STORE_AGREE_REFUND_WAIT_TRANSFER) { - if ($refund_data[ 'money' ] > 0) { - //订单到达待付款 - ( new CoreRefundService() )->toTransfer($refund_data, $main_type, $main_id); - } else { - ( new CoreRefundService() )->finish([ - 'order_refund_no' => $refund_data[ 'order_refund_no' ], - 'main_type' => $main_type, - 'main_id' => $main_id - ]); - } - } - - } -} diff --git a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundAuditRefundGoods.php b/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundAuditRefundGoods.php deleted file mode 100644 index 80696e211..000000000 --- a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundAuditRefundGoods.php +++ /dev/null @@ -1,52 +0,0 @@ -add([ - 'order_refund_no' => $refund_data['order_refund_no'], - 'status' => $refund_data['status'], - 'main_type' => $main_type,//todo 可以是传入的 - 'main_id' => $main_id, - 'type' => $log_type, - 'content' => '' - ]); - //消息发送 - - if($refund_data['status'] == OrderRefundDict::STORE_AGREE_REFUND_WAIT_TRANSFER){ - if($refund_data['money'] > 0){ - //订单到达待付款 - (new CoreRefundService())->toTransfer($refund_data, $main_type, $main_id); - }else{ - (new CoreRefundService())->finish([ - 'order_refund_no' => $refund_data['order_refund_no'], - 'main_type' => $main_type, - 'main_id' => $main_id - ]); - } - } - - } -} diff --git a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundClose.php b/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundClose.php deleted file mode 100644 index b6b4973af..000000000 --- a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundClose.php +++ /dev/null @@ -1,50 +0,0 @@ -where([['order_id', '=', $refund_data['order_id']]])->findOrEmpty(); - if(!$order->isEmpty()){ - if($order['status'] == OrderDict::WAIT_DELIVERY) { - //校验一下订单项是否全部发货 - (new CoreOrderDeliveryService())->checkFinish( - ['order_id' => $refund_data['order_id']] - ); - } - } - $main_type = $data['main_type'] ?? OrderRefundLogDict::MEMBER; - $main_id = $data['main_id'] ?? $refund_data['member_id']; - //通知三方应用更新订单状态 - if(!empty($order['relate_source'])){ - (new CoreOrderNoticeService())->sendRefundCloseNotice($refund_data,$order['relate_source'],$order['relate_order_id']); - } - //日志 - (new CoreRefundLogService())->add([ - 'order_refund_no' => $refund_data['order_refund_no'], - 'status' => $refund_data['status'], - 'main_type' => $main_type,//todo 可以是传入的 - 'main_id' => $main_id, - 'type' => OrderRefundDict::CLOSE_ACTION, - 'content' => '' - ]); - - } -} diff --git a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundDelivery.php b/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundDelivery.php deleted file mode 100644 index bdddc8133..000000000 --- a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundDelivery.php +++ /dev/null @@ -1,32 +0,0 @@ -add([ - 'order_refund_no' => $refund_data['order_refund_no'], - 'status' => $refund_data['status'], - 'main_type' => $main_type,//todo 可以是传入的 - 'main_id' => $main_id, - 'type' => OrderRefundDict::DELIVERY_ACTION, - 'content' => '' - ]); - //消息发送 - } -} diff --git a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundEdit.php b/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundEdit.php deleted file mode 100644 index f0a951e0d..000000000 --- a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundEdit.php +++ /dev/null @@ -1,32 +0,0 @@ -add([ - 'order_refund_no' => $refund_data['order_refund_no'], - 'status' => $refund_data['status'], - 'main_type' => $main_type, - 'main_id' => $main_id, - 'type' => OrderRefundDict::EDIT_APPLY_ACTION, - 'content' => '' - ]); - //消息发送 - } -} diff --git a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundEditDelivery.php b/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundEditDelivery.php deleted file mode 100644 index 354a2d8e3..000000000 --- a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundEditDelivery.php +++ /dev/null @@ -1,32 +0,0 @@ -add([ - 'order_refund_no' => $refund_data['order_refund_no'], - 'status' => $refund_data['status'], - 'main_type' => $main_type, - 'main_id' => $main_id, - 'type' => OrderRefundDict::EDIT_DELIVERY_ACTION, - 'content' => '' - ]); - //消息发送 - } -} diff --git a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundFinish.php b/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundFinish.php deleted file mode 100644 index 8856febef..000000000 --- a/niucloud/addon/shop/app/listener/refund/AfterShopOrderRefundFinish.php +++ /dev/null @@ -1,71 +0,0 @@ -where([ [ 'order_id', '=', $refund_data[ 'order_id' ] ] ])->findOrEmpty(); - - //满减送订单退款完成后退还赠品 - ( new CoreManjianService() )->refundGift($refund_data); - - if (!$order->isEmpty()) { - if ($order[ 'status' ] == OrderDict::WAIT_DELIVERY) { - //校验一下订单项是否全部发货 - ( new CoreOrderDeliveryService() )->checkFinish( - [ 'order_id' => $refund_data[ 'order_id' ] ] - ); - } - //校验一下是否全部退款 - if ($order[ 'status' ] != OrderDict::CLOSE) { - ( new CoreOrderCloseService() )->checkAllClose([ 'order_id' => $refund_data[ 'order_id' ] ]); - } - } - //商城统计 - CoreStatService::addStat([ 'refund_money' => $refund_data[ 'money' ] ]); - - ( new CoreGoodsStatService() )->saveGoodsRefundNumAndMoneyByOrderId($refund_data); // 商品退款数量 金额统计数据 - - //日志 - $main_type = $data[ 'main_type' ] ?? OrderRefundLogDict::SYSTEM; - $main_id = $data[ 'main_id' ] ?? 0; - //日志 - ( new CoreRefundLogService() )->add([ - 'order_refund_no' => $refund_data[ 'order_refund_no' ], - 'status' => $refund_data[ 'status' ], - 'main_type' => $main_type, - 'main_id' => $main_id, - 'type' => OrderRefundDict::FINISH_ACTION, - 'content' => '', - 'create_time'=>time()+1 - ]); - //消息发送 - - //通知三方应用更新订单状态 - if(!empty($order['relate_source'])){ - (new CoreOrderNoticeService())->sendRefundFinishNotice($refund_data,$order['relate_source'],$order['relate_order_id']); - } - } -} diff --git a/niucloud/addon/shop/app/listener/refund_export/ShopOrderRefundExportDataListener.php b/niucloud/addon/shop/app/listener/refund_export/ShopOrderRefundExportDataListener.php deleted file mode 100644 index 1e54abe65..000000000 --- a/niucloud/addon/shop/app/listener/refund_export/ShopOrderRefundExportDataListener.php +++ /dev/null @@ -1,68 +0,0 @@ -withSearch([ 'order_refund_no', 'status', 'create_time' ], $param['where']) - ->field($field) - ->with( - [ - 'order_goods' => function($query) { - $query->field('order_goods_id, order_id, member_id, goods_id, sku_id, goods_name, sku_name, goods_image, sku_image, price, num, goods_money,discount_money, is_enable_refund, goods_type')->append([ 'goods_image_thumb_small' ]); - }, - 'member' => function($query) { - $query->field('member_id, nickname'); - } - ])->order($order)->append([ 'status_name', 'refund_type_name' ]); - if ($param['page']['page'] > 0 && $param['page']['limit'] > 0) { - $data = $search_model->page($param['page']['page'], $param['page']['limit'])->select()->toArray(); - } else { - $data = $search_model->select()->toArray(); - } - foreach ($data as $key => $val) { - $data[$key]['nickname'] = $val['member']['nickname'] ?? ""; - } - foreach ($data as $key => $val) { - $data[$key]['order_refund_no'] = $val['order_refund_no']."\t"; - $data[$key]['nickname'] = !empty($val['member']) ? $val['member']['nickname'] : ''; - $data[$key]['goods_info'] = $val['order_goods']['goods_name'].' '.$val['order_goods']['sku_name']; - $data[$key]['refund_num'] = $val['order_goods']['num']; - $data[$key]['create_time'] = !empty($val['create_time']) ? $val['create_time'] : ''; - $data[$key]['transfer_time'] = !empty($val['transfer_time']) ? $val['transfer_time'] : ''; - $data[$key]['refund_no'] = $val['refund_no']."\t"; - $data[$key]['contact_name'] = !empty($val['refund_address']) ? $val['refund_address']['contact_name'] : ''; - $data[$key]['refund_address'] = !empty($val['refund_address']) ? $val['refund_address']['full_address'] : ''; - $data[$key]['express_number'] = !empty($val['delivery']) ? $val['delivery']['express_number'] : ''; - $data[$key]['express_company'] = !empty($val['delivery']) ? $val['delivery']['express_company'] : ''; - } - } - return $data; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/refund_export/ShopOrderRefundExportTypeListener.php b/niucloud/addon/shop/app/listener/refund_export/ShopOrderRefundExportTypeListener.php deleted file mode 100644 index 4f26d189b..000000000 --- a/niucloud/addon/shop/app/listener/refund_export/ShopOrderRefundExportTypeListener.php +++ /dev/null @@ -1,48 +0,0 @@ - [ - 'name' => '退款售后', - 'column' => [ - 'order_refund_no' => [ 'name' => '退款单号'], - 'nickname' => [ 'name' => '会员昵称'], - 'refund_type_name' => [ 'name' => '退款方式'], - 'apply_money' => [ 'name' => '申请退款金额'], - 'goods_info' => [ 'name' => '退货商品信息'], - 'refund_num' => [ 'name' => '退货数量'], - 'money' => [ 'name' => '实际退款金额'], - 'status_name' => [ 'name' => '退款状态'], - 'create_time' => [ 'name' => '申请时间'], - 'transfer_time' => [ 'name' => '转账时间'], - 'refund_no' => [ 'name' => '退款交易号'], - 'reason' => [ 'name' => '退款原因'], - 'shop_reason' => [ 'name' => '拒绝原因'], - 'contact_name' => [ 'name' => '退货联系人'], - 'refund_address' => [ 'name' => '退货地址'], - 'express_number' => [ 'name' => '退货物流单号'], - 'express_company' => [ 'name' => '退货物流公司'], - ] - ] - ]; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/seckill/SeckillOrderCreateListener.php b/niucloud/addon/shop/app/listener/seckill/SeckillOrderCreateListener.php deleted file mode 100644 index 0267e2e0b..000000000 --- a/niucloud/addon/shop/app/listener/seckill/SeckillOrderCreateListener.php +++ /dev/null @@ -1,30 +0,0 @@ -checkGoods($params); - } - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/seckill/SeckillOrderPushListener.php b/niucloud/addon/shop/app/listener/seckill/SeckillOrderPushListener.php deleted file mode 100644 index e25d9d734..000000000 --- a/niucloud/addon/shop/app/listener/seckill/SeckillOrderPushListener.php +++ /dev/null @@ -1,59 +0,0 @@ -$params['order_from'] ?? '', - 'member_id'=>$params['member_id'], - 'extend_data'=>[ - 'relate_id'=>$params['seckill_id'], - 'relate_order_id'=>$params['id'], - 'relate_source'=>'seckill' - ], - 'delivery'=>[ - 'delivery_type'=>'express', - ], - 'take_address'=>[ - 'taker_name' => $params[ 'taker_name' ], - 'taker_mobile' => $params[ 'taker_mobile' ], - 'taker_province' => $params[ 'taker_province' ], - 'taker_city' => $params[ 'taker_city' ], - 'taker_district' => $params[ 'taker_district' ], - 'taker_address' => $params[ 'taker_address' ], - 'taker_full_address' => $params[ 'taker_full_address' ], - 'taker_longitude' => $params[ 'taker_longitude' ] ?? '', - 'taker_latitude' => $params[ 'taker_latitude' ] ?? '', - ], - 'sku_data'=>[ - [ - 'sku_id'=>$params['source_sku_id'], - 'num'=>$params['num'], - 'seckill_price'=>$params['goods_price'] - ] - ], - 'pay'=>$params['pay'] - ]; - return $order_model->create($data); - } - }catch (\Exception $e){ - Log::write("订单创建出错".$e->getMessage().'行号:'.$e->getLine()); - return false; - } - } - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/seckill/SeckillSupportAddonListener.php b/niucloud/addon/shop/app/listener/seckill/SeckillSupportAddonListener.php deleted file mode 100644 index 47a016b23..000000000 --- a/niucloud/addon/shop/app/listener/seckill/SeckillSupportAddonListener.php +++ /dev/null @@ -1,30 +0,0 @@ - 'shop', - 'name' => '商城' - ], - ]; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/seckill/SeckillSupportGoodsInfoListener.php b/niucloud/addon/shop/app/listener/seckill/SeckillSupportGoodsInfoListener.php deleted file mode 100644 index 141cb0d80..000000000 --- a/niucloud/addon/shop/app/listener/seckill/SeckillSupportGoodsInfoListener.php +++ /dev/null @@ -1,30 +0,0 @@ -getOfferGoodsInfo($params); - } - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/seckill/SeckillSupportGoodsListener.php b/niucloud/addon/shop/app/listener/seckill/SeckillSupportGoodsListener.php deleted file mode 100644 index c72e4c9ad..000000000 --- a/niucloud/addon/shop/app/listener/seckill/SeckillSupportGoodsListener.php +++ /dev/null @@ -1,32 +0,0 @@ -getOfferGoodsList($params); - } - } - - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/shop_delivery/OrderPreStatusListener.php b/niucloud/addon/shop/app/listener/shop_delivery/OrderPreStatusListener.php deleted file mode 100644 index 17f3e8883..000000000 --- a/niucloud/addon/shop/app/listener/shop_delivery/OrderPreStatusListener.php +++ /dev/null @@ -1,37 +0,0 @@ - [ - LocalDeliveryStatusDict::IN_DELIVERY - ], //完成订单 - 'cancel' => [ - LocalDeliveryStatusDict::IN_DELIVERY - ], //取消订单 - ]; - } - } -} diff --git a/niucloud/addon/shop/app/listener/sow_community/RuleContentListener.php b/niucloud/addon/shop/app/listener/sow_community/RuleContentListener.php deleted file mode 100644 index f3bc6f51e..000000000 --- a/niucloud/addon/shop/app/listener/sow_community/RuleContentListener.php +++ /dev/null @@ -1,34 +0,0 @@ - $v) { - $data[ 'detail' ][] = $v[ 'num' ] . '张 ' . $v[ 'title' ]; - } - } - return $data; - } -} diff --git a/niucloud/addon/shop/app/listener/sow_community/SettleRewardListener.php b/niucloud/addon/shop/app/listener/sow_community/SettleRewardListener.php deleted file mode 100644 index b123d7105..000000000 --- a/niucloud/addon/shop/app/listener/sow_community/SettleRewardListener.php +++ /dev/null @@ -1,38 +0,0 @@ -sendCoupon($member_id, $value[ 'coupon_id' ], $value[ 'num' ]); - } catch (CommonException $e) { - Log::write('种草赠送优惠券“' . $value[ 'coupon_id' ] . '”发放失败,错误原因:' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - } - } -} diff --git a/niucloud/addon/shop/app/listener/stat/StatExecuteListener.php b/niucloud/addon/shop/app/listener/stat/StatExecuteListener.php deleted file mode 100644 index 17dd94111..000000000 --- a/niucloud/addon/shop/app/listener/stat/StatExecuteListener.php +++ /dev/null @@ -1,24 +0,0 @@ - [ - 'name' => '商城订单', - ], - 'shopRechargeOrder' => [ - 'name' => '商城会员充值', - ], - ]; - } -} diff --git a/niucloud/addon/shop/app/listener/system/ShowCustomerListener.php b/niucloud/addon/shop/app/listener/system/ShowCustomerListener.php deleted file mode 100644 index c4abbffe4..000000000 --- a/niucloud/addon/shop/app/listener/system/ShowCustomerListener.php +++ /dev/null @@ -1,87 +0,0 @@ - [ - - ], - // 营销工具 - MenuDict::ADDON_CHILD_MENU_DICT_MARKING_TOOL => [ - [ - 'title' => '商品榜单', - 'desc' => '展示热销商品排行榜', - 'icon' => 'static/resource/images/marketing/goods_rank.png', - 'key' => 'shop_goods_rank', - 'url' => '/shop/marketing/goods_rank/config', - ], - ], - // 营销活动 - MenuDict::ADDON_CHILD_MENU_DICT_MARKING_ACTIVE => [ - [ - 'title' => '优惠券', - 'desc' => '设置商家优惠券', - 'icon' => 'static/resource/images/marketing/coupon.png', - 'key' => 'shop_goods_coupon', - 'url' => '/shop/marketing/coupon/list', - ], - [ - 'title' => '满减送', - 'desc' => '购满指定金额享受优惠', - 'icon' => 'static/resource/images/marketing/manjian.png', - 'key' => 'shop_goods_manjian', - 'url' => '/shop/marketing/manjian/list', - ], - [ - 'title' => '限时折扣', - 'desc' => '商品限时促销打折', - 'icon' => 'static/resource/images/marketing/discount.png', - 'key' => 'shop_goods_discount', - 'url' => '/shop/marketing/discount/list', - ], - [ - 'title' => '积分商城', - 'desc' => '客户积分兑换更多好物', - 'icon' => 'static/resource/images/marketing/exchange.png', - 'key' => 'shop_point_goods', - 'url' => '/shop/marketing/exchange/goods_list', - ], - [ - 'title' => '新人专享', - 'desc' => '新人专属优惠活动', - 'icon' => 'static/resource/images/marketing/newcomer.png', - 'key' => 'shop_goods_newcomer_discount', - 'url' => '/shop/marketing/newcomer/config', - ], - ] - ]; - } -} diff --git a/niucloud/addon/shop/app/listener/system/ShowMarketingListener.php b/niucloud/addon/shop/app/listener/system/ShowMarketingListener.php deleted file mode 100644 index a8bd23988..000000000 --- a/niucloud/addon/shop/app/listener/system/ShowMarketingListener.php +++ /dev/null @@ -1,81 +0,0 @@ - [ - - ], - // 工具 - 'tool' => [ - [ - 'title' => '商品榜单', - 'desc' => '展示热销商品排行榜', - 'icon' => 'static/resource/images/marketing/goods_rank.png', - 'key' => 'shop_goods_rank', - 'url' => '/shop/marketing/goods_rank/config', - ], - ], - // 营销 - 'marketing' => [ - [ - 'title' => '优惠券', - 'desc' => '设置商家优惠券', - 'icon' => 'static/resource/images/marketing/coupon.png', - 'key' => 'shop_goods_coupon', - 'url' => '/shop/marketing/coupon/list', - ], - [ - 'title' => '满减送', - 'desc' => '购满指定金额享受优惠', - 'icon' => 'static/resource/images/marketing/manjian.png', - 'key' => 'shop_goods_manjian', - 'url' => '/shop/marketing/manjian/list', - ], - [ - 'title' => '限时折扣', - 'desc' => '商品限时促销打折', - 'icon' => 'static/resource/images/marketing/discount.png', - 'key' => 'shop_goods_discount', - 'url' => '/shop/marketing/discount/list', - ], - [ - 'title' => '积分商城', - 'desc' => '客户积分兑换更多好物', - 'icon' => 'static/resource/images/marketing/exchange.png', - 'key' => 'shop_point_goods', - 'url' => '/shop/marketing/exchange/goods_list', - ], - [ - 'title' => '新人专享', - 'desc' => '新人专属优惠活动', - 'icon' => 'static/resource/images/marketing/newcomer.png', - 'key' => 'shop_goods_newcomer_discount', - 'url' => '/shop/marketing/newcomer/config', - ], - ] - ]; - } -} diff --git a/niucloud/addon/shop/app/listener/third_addon/SupportAddonListener.php b/niucloud/addon/shop/app/listener/third_addon/SupportAddonListener.php deleted file mode 100644 index 7729063c1..000000000 --- a/niucloud/addon/shop/app/listener/third_addon/SupportAddonListener.php +++ /dev/null @@ -1,35 +0,0 @@ - 'shop', - 'name' => '商城' - ]; - $data = [ - 'friend_help' => $shop_arr, - 'seckill' => $shop_arr, - 'pintuan' => $shop_arr, - 'relay' => $shop_arr - ]; - return [$data[$source]] ?? []; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/third_addon/goods/GoodsOutPutDataInfoListener.php b/niucloud/addon/shop/app/listener/third_addon/goods/GoodsOutPutDataInfoListener.php deleted file mode 100644 index f85ce2776..000000000 --- a/niucloud/addon/shop/app/listener/third_addon/goods/GoodsOutPutDataInfoListener.php +++ /dev/null @@ -1,21 +0,0 @@ -getOfferGoodsInfo($params); - } - } - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/third_addon/goods/GoodsOutPutDataListener.php b/niucloud/addon/shop/app/listener/third_addon/goods/GoodsOutPutDataListener.php deleted file mode 100644 index 37eb2a5cf..000000000 --- a/niucloud/addon/shop/app/listener/third_addon/goods/GoodsOutPutDataListener.php +++ /dev/null @@ -1,21 +0,0 @@ -getOfferGoodsList($params); - } - } - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/third_addon/goods/GoodsOutPutWhereInitListener.php b/niucloud/addon/shop/app/listener/third_addon/goods/GoodsOutPutWhereInitListener.php deleted file mode 100644 index d0f7811f9..000000000 --- a/niucloud/addon/shop/app/listener/third_addon/goods/GoodsOutPutWhereInitListener.php +++ /dev/null @@ -1,21 +0,0 @@ -getWhereInit(); - } - } - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/third_addon/order/BackUpThirdOrderListener.php b/niucloud/addon/shop/app/listener/third_addon/order/BackUpThirdOrderListener.php deleted file mode 100644 index 316675a27..000000000 --- a/niucloud/addon/shop/app/listener/third_addon/order/BackUpThirdOrderListener.php +++ /dev/null @@ -1,65 +0,0 @@ - $data['source_id'] ?? 0, - 'order_count' => isset($data['order_data']) ? count($data['order_data']) : 0 - ])); - - try { - $return = []; - switch ($source) { - case 'relay': - Log::write("SHOP-RELAYBackUpThirdOrder 开始处理接龙订单"); - $return = (new CoreCreateOrderService())->relayCreateOrder($data); - Log::write("SHOP-RELAYBackUpThirdOrder 接龙订单处理完成"); - break; - case 'pintuan': - Log::write("SHOP-PINTUANBackUpThirdOrder 开始处理拼团订单"); - $return = (new CoreCreateOrderService())->pintuanCreateOrder($data); - Log::write("SHOP-PINTUANBackUpThirdOrder 拼团订单处理完成"); - break; - case 'friend_help': - Log::write("SHOP-FRIEND_HELPBackUpThirdOrder 开始处理好友助力订单"); - $return = (new CoreCreateOrderService())->friendHelpCreateOrder($data); - Log::write("SHOP-FRIEND_HELPBackUpThirdOrder 好友助力订单处理完成"); - break; - case 'seckill': - $order_model = new CoreSeckillOrderCreateService(); - return $order_model->create($data); - default: - Log::write("SHOP-PINTUANBackUpThirdOrder 未知订单来源: {$source}"); - } - - Log::write("SHOP-PINTUANBackUpThirdOrder 订单处理流程正常结束,来源: {$source}"); - return $return; - } catch (\Exception $e) { - // 合并异常日志:包含消息和堆栈 - Log::error("PINTUAN-BackUpThirdOrder 订单处理异常(来源: {$source}): {$e->getMessage()}\n堆栈: {$e->getTraceAsString()}"); - throw $e; - } - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/third_addon/order/OrderAmountServiceListener.php b/niucloud/addon/shop/app/listener/third_addon/order/OrderAmountServiceListener.php deleted file mode 100644 index 52ab54f6c..000000000 --- a/niucloud/addon/shop/app/listener/third_addon/order/OrderAmountServiceListener.php +++ /dev/null @@ -1,68 +0,0 @@ - '配送费', -// 'key' => 'delivery_money', -// 'amount' => 20 -// ] -// ]; - $this->getDeliveryMoney($data); - if (!empty($this->return)) { - return $this->return; - } - } - } catch (CommonException $e) { - throw new CommonException($e->getMessage()); - } - } - - private function getDeliveryMoney($data) - { - //必要参数,不传地址将获取用户默认地址 - $data = [ - 'member_id' => $data['member_id'], - 'province_id' => $data['address_info']['province_id'] ?? '', - 'city_id' => $data['address_info']['city_id'] ?? '', - 'district_id' => $data['address_info']['district_id'] ?? '', - 'source_sku_id' => $data['source_sku_id'],//商品skuID - 'num' => $data['num'], //购买数量 - ]; - $order_model = new CoreOrderDeliveryService(); - //计算运费 - $delivery_money = $order_model->calculate($data); - if ($delivery_money > 0) { - $this->return[] = [ - 'name' => '配送费', - 'key' => 'delivery_money', - 'amount' => $delivery_money - ]; - } - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/third_addon/order/OrderDeliveryServiceListener.php b/niucloud/addon/shop/app/listener/third_addon/order/OrderDeliveryServiceListener.php deleted file mode 100644 index e70ee04f1..000000000 --- a/niucloud/addon/shop/app/listener/third_addon/order/OrderDeliveryServiceListener.php +++ /dev/null @@ -1,57 +0,0 @@ - 0, - 'msg' => '商品参数不完整' - ]; - } - if(empty($data['member_id'])){ - return [ - 'code' => 0, - 'msg' => '会员ID为空' - ]; - } - //必要参数,不传地址将获取用户默认地址 - $data = [ - 'member_id'=>$data['member_id'], - 'province_id'=>$data['province_id'] ?? '', - 'city_id' => $data['city_id'] ?? '', - 'district_id'=>$data['district_id'] ?? '', - 'source_sku_id'=>$data['source_sku_id'],//商品skuID - 'num'=>$data['num'] //购买数量 - ]; - $order_model = new CoreOrderDeliveryService(); - //计算运费 - $delivery_money = $order_model->calculate($data); - return [ - 'code' => 1, - 'delivery_money'=>$delivery_money - ]; - } - return []; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/third_addon/order/OrderServicePathListener.php b/niucloud/addon/shop/app/listener/third_addon/order/OrderServicePathListener.php deleted file mode 100644 index c82cdd979..000000000 --- a/niucloud/addon/shop/app/listener/third_addon/order/OrderServicePathListener.php +++ /dev/null @@ -1,68 +0,0 @@ -whereNotIn('status', [OrderRefundDict::CLOSE, OrderRefundDict::SHOP_ACTIVE_CLOSE_REFUND])->where('order_id', $order_id)->findOrEmpty(); - if ($refund_info->isEmpty()) { - $refund_path = sprintf($this->refund_apply_path, $order_goods_id, $order_id); - } else { - $refund_path = sprintf($this->refund_detail_path, $refund_info['order_refund_no']); - } - $order_info = (new Order())->findOrEmpty($order_id)->toArray(); - if ($order_info['is_enable_refund'] == 0){//特殊处理 商城的订单已完成就不允许售后了(配置项),拼团是允许的则 商城不允许退款之后就直接返回空地址,这样拼团就不展示售后按钮了 - $refund_path = ''; - } - - $detail_path = sprintf($this->detail_path, $order_id); - $admin_detail_path = sprintf($this->admin_detail_path, $order_id); - return [ - 'refund' => ['name' => '商城-退款相关地址', 'url' => $refund_path], - 'detail' => ['name' => '查看关联订单', 'url' => $detail_path], - 'admin_detail' => ['name' => '查看关联订单', 'url' => $admin_detail_path], - ]; - } - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/treasure/TreasureDataListener.php b/niucloud/addon/shop/app/listener/treasure/TreasureDataListener.php deleted file mode 100644 index 88757076e..000000000 --- a/niucloud/addon/shop/app/listener/treasure/TreasureDataListener.php +++ /dev/null @@ -1,83 +0,0 @@ -field($field) - ->withJoin([ - 'goodsSku' => [ 'goods_id', 'sku_name', 'price' ] - ])->where($sku_where)->order($order)->append([ 'goods_cover_thumb_mid' ]); - $treasure_list = []; - if (!empty($params[ 'page' ])) { - $list = $search_model->paginate([ - 'list_rows' => $params[ 'page' ][ 'limit' ], - 'page' => $params[ 'page' ][ 'page' ], - ])->toArray(); - if (!empty($list[ 'data' ])) { - $data = []; - foreach ($list[ 'data' ] as $k => $v) { - $data[ $k ][ 'treasure_name' ] = $v[ 'goods_name' ]; // 宝贝名称 - $data[ $k ][ 'treasure_sub_name' ] = $v[ 'sub_title' ]; // 宝贝副标题 - $data[ $k ][ 'treasure_image' ] = empty($v[ 'goods_cover_thumb_mid' ]) ? $v[ 'goods_cover' ] : $v[ 'goods_cover_thumb_mid' ]; // 宝贝图片 - $data[ $k ][ 'treasure_price' ] = $v[ 'goodsSku' ][ 'price' ]; // 宝贝价格 - $data[ $k ][ 'treasure_url' ] = '/addon/shop/pages/goods/detail?goods_id=' . $v[ 'goods_id' ]; // 宝贝跳转链接 - $data[ $k ][ 'relate_id' ] = $v[ 'goods_id' ]; // 关联业务id - $data[ $k ][ 'relate_type' ] = 'shop'; // 关联业务类型 - } - $list[ 'data' ] = $data; - } - $treasure_list = $list; - } else { - $list = $search_model->select()->toArray(); - foreach ($list as $k => $v) { - $treasure_list[ $k ][ 'treasure_name' ] = $v[ 'goods_name' ]; // 宝贝名称 - $treasure_list[ $k ][ 'treasure_sub_name' ] = $v[ 'sub_title' ]; // 宝贝副标题 - $treasure_list[ $k ][ 'treasure_image' ] = empty($v[ 'goods_cover_thumb_mid' ]) ? $v[ 'goods_cover' ] : $v[ 'goods_cover_thumb_mid' ]; // 宝贝图片 - $treasure_list[ $k ][ 'treasure_price' ] = $v[ 'goodsSku' ][ 'price' ]; // 宝贝价格 - $treasure_list[ $k ][ 'treasure_url' ] = '/addon/shop/pages/goods/detail?goods_id=' . $v[ 'goods_id' ]; // 宝贝跳转链接 - $treasure_list[ $k ][ 'relate_id' ] = $v[ 'goods_id' ]; // 关联业务id - $treasure_list[ $k ][ 'relate_type' ] = 'shop'; // 关联业务类型 - } - } - return $treasure_list; - } - } -} diff --git a/niucloud/addon/shop/app/listener/treasure/TreasureTypeListener.php b/niucloud/addon/shop/app/listener/treasure/TreasureTypeListener.php deleted file mode 100644 index 2bac1b987..000000000 --- a/niucloud/addon/shop/app/listener/treasure/TreasureTypeListener.php +++ /dev/null @@ -1,28 +0,0 @@ - '商品' - ]; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/listener/verify/VerifyCheckListener.php b/niucloud/addon/shop/app/listener/verify/VerifyCheckListener.php deleted file mode 100644 index 0523e3a42..000000000 --- a/niucloud/addon/shop/app/listener/verify/VerifyCheckListener.php +++ /dev/null @@ -1,88 +0,0 @@ -where([['order_goods_id', '=', $order_goods_id]])->with([ - 'goods' => function ($q) { - $q->field('goods_id,status'); - } - ])->findOrEmpty()->toArray(); - $un_use_msg = ''; - if (in_array($order_goods_info['delivery_status'], [OrderDeliveryDict::TAKED, OrderDeliveryDict::EXPIRE])) { - $params['un_use_msg'][] = get_lang('SHOP_ORDER_ITEM_HAS_BEEN_WRITTEN_OFF_OR_EXPIRED'); - $params['is_can_use'] = 0; - $un_use_msg = get_lang('SHOP_ORDER_ITEM_HAS_BEEN_WRITTEN_OFF_OR_EXPIRED'); - } else if (in_array($order_goods_info['status'], [OrderGoodsDict::REFUNDING, OrderGoodsDict::REFUND_FINISH])) { - $params['un_use_msg'][] = get_lang('SHOP_THE_ITEM_IS_BEING_REFUNDED_OR_HAS_BEEN_REFUNDED'); - $params['is_can_use'] = 0; - $un_use_msg = get_lang('SHOP_THE_ITEM_IS_BEING_REFUNDED_OR_HAS_BEEN_REFUNDED'); - } else if ($order_goods_info['goods']['status'] != 1) { - $params['un_use_msg'][] = '商品已下架'; - $params['is_can_use'] = 0; - $un_use_msg = '商品已下架'; - } - $params['value']['list'][0]['un_use_msg'] = $un_use_msg; - return $params; - } else if ($params['type'] == 'shopPickUpOrder') {//自提订单 - $order_id = $data['order_id'] ?? 0; - //todo 订单存在退款 - $order_goods_list = (new OrderGoods())->where([['order_id', '=', $order_id]])->with([ - 'goods' => function ($q) { - $q->field('goods_id,status,goods_name'); - } - ])->select()->toArray(); - $verify_list = $params['value']['list']; - foreach ($verify_list as &$value) { - $value['un_use_msg'] = ''; - foreach ($order_goods_list as $order_goods_info) { - if ($value['order_goods_id'] == $order_goods_info['order_goods_id']) { - if (in_array($order_goods_info['status'], [OrderGoodsDict::REFUNDING, OrderGoodsDict::REFUND_FINISH])) { - $params['un_use_msg'][] = get_lang('SHOP_THE_ITEM_IS_BEING_REFUNDED_OR_HAS_BEEN_REFUNDED'); - $params['is_can_use'] = 0; - $value['un_use_msg'] = get_lang('SHOP_THE_ITEM_IS_BEING_REFUNDED_OR_HAS_BEEN_REFUNDED'); - continue; - } - if ($order_goods_info['goods']['status'] != 1) { - $params['un_use_msg'][] = $order_goods_info['goods']['goods_name'] . '已下架'; - $params['is_can_use'] = 0; - $value['un_use_msg'] = '商品已下架'; - } - } - } - } - $params['value']['list'] = $verify_list; - return $params; - } - - } -} diff --git a/niucloud/addon/shop/app/listener/verify/VerifyCreateListener.php b/niucloud/addon/shop/app/listener/verify/VerifyCreateListener.php deleted file mode 100644 index 06301f29b..000000000 --- a/niucloud/addon/shop/app/listener/verify/VerifyCreateListener.php +++ /dev/null @@ -1,163 +0,0 @@ -where([['order_goods_id', '=', $order_goods_id], ['member_id', '=', $member_id]])->findOrEmpty(); - if ($order_goods_info->isEmpty()) throw new CommonException('SHOP_ORDER_NOT_FOUND'); - if (in_array($order_goods_info[ 'delivery_status' ], [ OrderDeliveryDict::TAKED, OrderDeliveryDict::EXPIRE ])) throw new CommonException('SHOP_ORDER_ITEM_HAS_BEEN_WRITTEN_OFF_OR_EXPIRED'); - //todo 判断订单项状态(已收货 已核销 核销已过期) - $order_info = ( new Order() )->where([ [ 'order_id', '=', $order_goods_info[ 'order_id' ] ], [ 'member_id', '=', $member_id ] ])->findOrEmpty(); - if ($order_info->isEmpty()) throw new CommonException('SHOP_ORDER_NOT_FOUND'); - if (in_array($order_info[ 'status' ], [ OrderDict::FINISH, OrderDict::CLOSE ])) throw new CommonException('SHOP_ORDER_HAS_BEEN_CLOSED_OR_COMPLETED'); - $goods_id = $order_goods_info[ 'goods_id' ]; - $goods_info = ( new Goods() )->findOrEmpty($goods_id); - if ($goods_info->isEmpty()) throw new CommonException('SHOP_GOODS_NOT_EXIST'); - $virtual_receive_type = $goods_info[ 'virtual_receive_type' ]; - if ($virtual_receive_type != 'verify') throw new CommonException('SHOP_GOODS_CURRENT_PRODUCT_DOES_NOT_SUPPORT_WRITE_OFF'); - - $count = $order_goods_info['num'] - $order_goods_info['verify_count']; - return [ - 'count' => $count, - 'relate_tag' => $order_goods_id, - 'body' => $order_goods_info[ 'goods_name' ] . $order_goods_info[ 'sku_name' ], - 'expire_time' => empty($order_goods_info[ 'verify_expire_time' ]) ? 0 : strtotime($order_goods_info[ 'verify_expire_time' ]), - 'data' => [ - 'list' => [ - [ - 'name' => $order_goods_info['goods_name'], - 'sub_name' => $order_goods_info['sku_name'], - 'cover' => $order_goods_info['goods_image'], - 'num' => $order_goods_info['num'], - 'verify_num' => 1,//虚拟核销商品单词核销一个 - ] - ], - 'content' => [ - 'fixed' => [ - - ], - 'diy' => [ - [ - 'title' => '订单信息', - 'list' => [ - [ - 'title' => '订单编号', - 'value' => $order_info[ 'order_no' ], - ], - [ - 'title' => '支付时间', - 'value' => $order_info[ 'pay_time' ], - ], - ] - ], - ] - ] - ] - ]; - - } else if ($params[ 'type' ] == 'shopPickUpOrder') {//自提订单 - $data = $params[ 'data' ] ?? []; - $member_id = $params[ 'member_id' ]; - $order_id = $data[ 'order_id' ] ?? 0; - $list = []; - $order_info = (new Order())->where([['order_id', '=', $order_id], ['member_id', '=', $member_id]])->findOrEmpty(); - if ($order_info->isEmpty()) throw new CommonException('SHOP_ORDER_NOT_FOUND'); - //TODO:: 非自提订单 提示语待修正 - if ($order_info[ 'delivery_type' ] != DeliveryDict::STORE) throw new CommonException('SHOP_ORDER_HAS_BEEN_CLOSED_OR_COMPLETED'); - - if (in_array($order_info[ 'status' ], [ OrderDict::FINISH, OrderDict::CLOSE ])) throw new CommonException('SHOP_ORDER_HAS_BEEN_CLOSED_OR_COMPLETED'); - - $order_goods_list = (new OrderGoods())->where([['order_id', '=', $order_id], ['member_id', '=', $member_id]])->select()->toArray(); - $expire_time = 0; - $body = []; - foreach ($order_goods_list as $order_goods_info) { - //todo 判断订单项状态(已收货 已核销 核销已过期) - if (in_array($order_goods_info[ 'delivery_status' ], [ OrderDeliveryDict::TAKED, OrderDeliveryDict::EXPIRE ])) { - continue; - } - $list[] = [ - 'order_goods_id' => $order_goods_info['order_goods_id'], - 'name' => $order_goods_info['goods_name'], - 'sub_name' => $order_goods_info['sku_name'], - 'cover' => $order_goods_info['goods_image'], - 'num' => $order_goods_info['num'], - 'verify_num'=>$order_goods_info['num']//自提订单统一进行核销 - ]; - - $temp_expire_time = empty($order_goods_info[ 'verify_expire_time' ]) ? 0 : strtotime($order_goods_info[ 'verify_expire_time' ]); - if ($temp_expire_time > $expire_time) { - $expire_time = $temp_expire_time; - } - $body[] = $order_goods_info[ 'goods_name' ] . $order_goods_info[ 'sku_name' ]; - } - - return [ - 'count' => 1, - 'relate_tag' => $order_id, - 'body' => mb_substr(implode(',', $body), 0, 100), - 'expire_time' => $expire_time, - 'data' => [ - 'list' => $list, - 'taker_info' => [ - 'taker_name' => $order_info[ 'taker_name' ] ?? "",//自提人姓名 - 'taker_mobile' => $order_info[ 'taker_mobile' ] ?? "",//自提人手机号 - 'buyer_ask_delivery_time' => $order_info[ 'buyer_ask_delivery_time' ] ?? "",//自提人期望的时间 - ], - 'content' => [ - 'fixed' => [ - - ], - 'diy' => [ - [ - 'title' => '订单信息', - 'list' => [ - [ - 'title' => '订单编号', - 'value' => $order_info[ 'order_no' ], - ], - [ - 'title' => '支付时间', - 'value' => $order_info[ 'pay_time' ], - ], - ] - ], - ] - ] - ] - ]; - } - - } -} diff --git a/niucloud/addon/shop/app/listener/verify/VerifyInfoListener.php b/niucloud/addon/shop/app/listener/verify/VerifyInfoListener.php deleted file mode 100644 index a16b64c68..000000000 --- a/niucloud/addon/shop/app/listener/verify/VerifyInfoListener.php +++ /dev/null @@ -1,51 +0,0 @@ -where([ [ 'order_goods_id', '=', $order_goods_id ], [ 'is_verify', '=', 1 ] ])->findOrEmpty()->toArray(); - if ($order_goods_info) { - $info = [ - [ - 'name' => '核销次数/总次数', - 'value' => $order_goods_info[ 'verify_count' ] . '/' . $order_goods_info[ 'num' ] - ] - ]; - } - } else if ($params[ 'type' ] == 'shopPickUpOrder') { - // todo 自提订单核销 后续做了拆分处理再添加逻辑 - $info = [ - [ - 'name' => '核销次数/总次数', - 'value' => '1/1' - ] - ]; - } - return $info; - } -} diff --git a/niucloud/addon/shop/app/listener/verify/VerifyListener.php b/niucloud/addon/shop/app/listener/verify/VerifyListener.php deleted file mode 100644 index ce2ab48ee..000000000 --- a/niucloud/addon/shop/app/listener/verify/VerifyListener.php +++ /dev/null @@ -1,86 +0,0 @@ -where([[ 'order_goods_id', '=', $order_goods_id ] ])->findOrEmpty(); - if ($order_goods_info->isEmpty()) throw new CommonException('SHOP_ORDER_NOT_FOUND'); - - if (in_array($order_goods_info[ 'delivery_status' ], [ OrderDeliveryDict::TAKED, OrderDeliveryDict::EXPIRE ])) throw new CommonException('SHOP_ORDER_ITEM_HAS_BEEN_WRITTEN_OFF_OR_EXPIRED'); - if (in_array($order_goods_info[ 'status' ], [ OrderGoodsDict::REFUNDING, OrderGoodsDict::REFUND_FINISH ])) throw new CommonException('SHOP_THE_ITEM_IS_BEING_REFUNDED_OR_HAS_BEEN_REFUNDED'); - if (strtotime($order_goods_info[ 'verify_expire_time' ]) > 0 && strtotime($order_goods_info[ 'verify_expire_time' ]) < time()) throw new CommonException('SHOP_ORDER_ITEM_HAS_EXPIRED'); - if ($order_goods_info[ 'verify_count' ] >= $order_goods_info[ 'num' ]) throw new CommonException('SHOP_ORDER_MAXIMUM_NUMBER_OF_WRITE_OFFS_HAS_BEEN_REACHED'); - - //todo 判断订单项状态(已收货 已核销 核销已过期) - $order_info = ( new Order() )->where([ [ 'order_id', '=', $order_goods_info[ 'order_id' ] ] ])->findOrEmpty(); - if ($order_info->isEmpty()) throw new CommonException('SHOP_ORDER_NOT_FOUND'); - if (in_array($order_info[ 'status' ], [ OrderDict::FINISH, OrderDict::CLOSE ])) throw new CommonException('SHOP_ORDER_HAS_BEEN_CLOSED_OR_COMPLETED'); - //核销次数累加1,达到最大核销次数后订单自动完成 - $order_goods_info->save([ - 'verify_count' => $order_goods_info[ 'verify_count' ] + 1, - ]); - //核销完成,顺便订单完成 - if ($order_goods_info[ 'verify_count' ] >= $order_goods_info[ 'num' ]) { - ( new CoreOrderFinishService() )->finish([ - 'main_type' => OrderLogDict::SYSTEM, - 'main_id' => 0, - 'order_id' => $order_goods_info[ 'order_id' ], - ]); - } - //存库 - } else if ($params[ 'type' ] == 'shopPickUpOrder') { - $param = $params[ 'data' ];//订单信息 - $order_id = $param[ 'order_id' ]; - $order_info = ( new Order() )->where([ [ 'order_id', '=', $order_id ] ])->findOrEmpty(); - if ($order_info->isEmpty()) throw new CommonException('SHOP_ORDER_NOT_FOUND'); - if (in_array($order_info[ 'status' ], [ OrderDict::FINISH, OrderDict::CLOSE ])) throw new CommonException('SHOP_ORDER_HAS_BEEN_CLOSED_OR_COMPLETED'); - $order_goods_list = ( new OrderGoods() )->where([ - [ 'order_id', '=', $order_id ], - ])->select()->toArray(); - foreach ($order_goods_list as $order_goods_info) { - if (in_array($order_goods_info[ 'delivery_status' ], [ OrderDeliveryDict::TAKED, OrderDeliveryDict::EXPIRE ])) throw new CommonException('SHOP_ORDER_ITEM_HAS_BEEN_WRITTEN_OFF_OR_EXPIRED'); - if (in_array($order_goods_info[ 'status' ], [ OrderGoodsDict::REFUNDING, OrderGoodsDict::REFUND_FINISH ])) throw new CommonException('SHOP_THE_ITEM_IS_BEING_REFUNDED_OR_HAS_BEEN_REFUNDED'); - } - //暂时自提订单核销为统一核销 故校验完数据后直接结束该自提订单 - ( new CoreOrderFinishService() )->finish([ - 'main_type' => OrderLogDict::SYSTEM, - 'main_id' => 0, - 'order_id' => $order_id, - ]); - } - return; - } -} diff --git a/niucloud/addon/shop/app/listener/verify/VerifyTypeListener.php b/niucloud/addon/shop/app/listener/verify/VerifyTypeListener.php deleted file mode 100644 index 7f3d5a04b..000000000 --- a/niucloud/addon/shop/app/listener/verify/VerifyTypeListener.php +++ /dev/null @@ -1,34 +0,0 @@ - [ - 'name' => '商城虚拟商品' - ], - 'shopPickUpOrder' => [ - 'name' => '商城自提订单' - ], - ]; - } -} diff --git a/niucloud/addon/shop/app/model/ShopStat.php b/niucloud/addon/shop/app/model/ShopStat.php deleted file mode 100644 index c6d3374e5..000000000 --- a/niucloud/addon/shop/app/model/ShopStat.php +++ /dev/null @@ -1,43 +0,0 @@ - 'timestamp', - ]; - -} diff --git a/niucloud/addon/shop/app/model/active/Active.php b/niucloud/addon/shop/app/model/active/Active.php deleted file mode 100644 index 25fed41a0..000000000 --- a/niucloud/addon/shop/app/model/active/Active.php +++ /dev/null @@ -1,172 +0,0 @@ - 'timestamp', - 'end_time' => 'timestamp', - 'create_time' => 'timestamp', - 'update_time' => 'timestamp', - ]; - - // 设置json类型字段 - protected $json = [ 'active_goods_info', 'active_value']; - - // 设置JSON数据返回数组 - protected $jsonAssoc = true; - - /** - * 活动商品项 - * @return \think\model\relation\HasMany - */ - public function activeGoods() - { - return $this->hasMany(ActiveGoods::class, 'active_id', 'active_id'); - } - - /** - * 活动状态 - * @param $value - * @param $data - * @return mixed|string - */ - public function getActiveStatusNameAttr($value, $data) - { - if (empty($data['active_status'])) - { - return ''; - } - return ActiveDict::getStatus()[$data['active_status']] ?? ''; - } - - /** - * 活动类型 - * @param $value - * @param $data - * @return mixed|string - */ - public function getActiveTypeNameAttr($value, $data) - { - if (empty($data['active_type'])) - { - return ''; - } - return ActiveDict::getType()[$data['active_type']] ?? ''; - } - - /** - * 活动商品类型 - * @param $value - * @param $data - * @return mixed|string - */ - public function getActiveGoodsTypeNameAttr($value, $data) - { - if (empty($data['active_goods_type'])) - { - return ''; - } - return ActiveDict::getGoodsType()[$data['active_goods_type']] ?? ''; - } - - /** - * 活动类别 - * @param $value - * @param $data - * @return mixed|string - */ - public function getActiveClassNameAttr($value, $data) - { - if (empty($data['active_class'])) - { - return ''; - } - return ActiveDict::getClass()[$data['active_class']] ?? ''; - } - - /** - * 搜索器:标题 - * @param $value - * @param $data - */ - public function searchActiveNameAttr($query, $value, $data) - { - if ($value != '') { - $query->where("active_name", 'like', '%' . $this->handelSpecialCharacter($value) . '%'); - } - } - - /** - * 搜索器:活动类型 - * @param $value - * @param $data - */ - public function searchActiveTypeAttr($query, $value, $data) - { - if ($value) { - $query->where("active_type", '=', $value); - } - } - - /** - * 搜索器:状态 - * @param $value - * @param $data - */ - public function searchActiveStatusAttr($query, $value, $data) - { - if ($value) { - $query->where("active_status", '=', $value); - } - } - - /** - * 活动结束时间搜索器 - * @param Query $query - * @param $value - * @param $data - */ - public function searchEndTimeAttr(Query $query, $value, $data) - { - $start_time = empty($value[0]) ? 0 : strtotime($value[0]); - $end_time = empty($value[1]) ? 0 : strtotime($value[1]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('end_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([['end_time', '>=', $start_time]]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([['end_time', '<=', $end_time]]); - } - } -} diff --git a/niucloud/addon/shop/app/model/active/ActiveGoods.php b/niucloud/addon/shop/app/model/active/ActiveGoods.php deleted file mode 100644 index 69324d8bb..000000000 --- a/niucloud/addon/shop/app/model/active/ActiveGoods.php +++ /dev/null @@ -1,92 +0,0 @@ -hasOne(Goods::class, 'goods_id', 'goods_id'); - } - - /** - * 关联默认商品规格 - * @return \think\model\relation\HasOne - */ - public function goodsSku() - { - return $this->hasOne(GoodsSku::class, 'goods_id', 'goods_id'); - } - - /** - * 关联默认商品规格 - * @return \think\model\relation\HasOne - */ - public function goodsSkuOne() - { - return $this->hasOne(GoodsSku::class, 'sku_id', 'sku_id'); - } - - /** - * 优惠券商品项 - * @return \think\model\relation\HasOne - */ - public function active() - { - return $this->hasOne(Active::class, 'active_id', 'active_id'); - } - - /** - * 活动状态 - * @param $value - * @param $data - * @return mixed|string - */ - public function getActiveGoodsStatusNameAttr($value, $data) - { - if (empty($data['active_goods_status'])) - { - return ''; - } - return ActiveDict::getStatus()[$data['active_goods_status']] ?? ''; - } -} diff --git a/niucloud/addon/shop/app/model/cart/Cart.php b/niucloud/addon/shop/app/model/cart/Cart.php deleted file mode 100644 index c41f780ed..000000000 --- a/niucloud/addon/shop/app/model/cart/Cart.php +++ /dev/null @@ -1,178 +0,0 @@ -where("id", $value); - } - } - - /** - * 搜索器:购物车会员ID - * @param $value - * @param $data - */ - public function searchMemberIdAttr($query, $value, $data) - { - if ($value) { - $query->where("member_id", $value); - } - } - - /** - * 搜索器:购物车商品ID - * @param $value - * @param $data - */ - public function searchGoodsIdAttr($query, $value, $data) - { - if ($value) { - $query->where("goods_id", $value); - } - } - - /** - * 搜索器:购物车sku id - * @param $value - * @param $data - */ - public function searchSkuIdAttr($query, $value, $data) - { - if ($value) { - $query->where("sku_id", $value); - } - } - - /** - * 搜索器:购物车活动类型 - * @param $value - * @param $data - */ - public function searchMarketTypeAttr($query, $value, $data) - { - if ($value) { - $query->where("market_type", $value); - } - } - - /** - * 搜索器:购物车活动id - * @param $value - * @param $data - */ - public function searchMarketTypeIdAttr($query, $value, $data) - { - if ($value) { - $query->where("market_type_id", $value); - } - } - - /** - * 搜索器:购物车添加时间 - * @param $value - * @param $data - */ - public function searchCreateTimeAttr($query, $value, $data) - { - if ($value) { - $query->where("create_time", $value); - } - } - - /** - * 搜索器:购物车商品状态 - * @param $value - * @param $data - */ - public function searchStatusAttr($query, $value, $data) - { - if ($value) { - $query->where("status", $value); - } - } - - /** - * 搜索器:购物车失效原因 - * @param $value - * @param $data - */ - public function searchInvalidRemarkAttr($query, $value, $data) - { - if ($value) { - $query->where("invalid_remark", $value); - } - } - - /** - * 关联商品主表 - * @return \think\model\relation\HasOne - */ - public function goods() - { - return $this->hasOne(Goods::class, 'goods_id', 'goods_id') - ->joinType('inner')->withTrashed(); - } - - /** - * 关联商品规格 - * @return \think\model\relation\HasOne - */ - public function goodsSku() - { - return $this->hasOne(GoodsSku::class, 'sku_id', 'sku_id')->joinType('inner'); - } - - /** - * 关联商品规格列表 - * @return \think\model\relation\HasMany - */ - public function goodsSpec() - { - return $this->hasMany(GoodsSpec::class, 'goods_id', 'goods_id'); - } - -} diff --git a/niucloud/addon/shop/app/model/coupon/Coupon.php b/niucloud/addon/shop/app/model/coupon/Coupon.php deleted file mode 100644 index 534c40f07..000000000 --- a/niucloud/addon/shop/app/model/coupon/Coupon.php +++ /dev/null @@ -1,207 +0,0 @@ - 'timestamp', - 'end_time' => 'timestamp', - 'valid_start_time' => 'timestamp', - 'valid_end_time' => 'timestamp', - ]; - /** - * 优惠券商品项 - * @return \think\model\relation\HasMany - */ - public function goods() - { - return $this->hasMany(CouponGoods::class, 'coupon_id', 'id'); - } - - /** - * 关联商品项 - * @param $value - * @param $data - * @return CouponGoods[]|array|\think\Collection - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ -// public function getGoodsDataAttr($value, $data) -// { -// $coupon_id = $data['id'] ?? 0; -// $list = []; -// if($coupon_id > 0) { -// $coupon_id = $data['id']; -// $list = (new CouponGoods())->where([['coupon_id', '=', $coupon_id]])->select(); -// } -// return $list; -// } - - - public function getCouponPriceAttr($value, $data) - { - if (empty($data['price'])) - { - return 0; - } - return rtrim(rtrim($data['price'], '0'), '.'); - - } - - public function getCouponMinPriceAttr($value, $data) - { - if (empty($data['min_condition_money'])) - { - return 0; - } - return rtrim(rtrim($data['min_condition_money'], '0'), '.'); - - } - - /** - * 搜索器:标题 - * @param $value - * @param $data - */ - public function searchTitleAttr($query, $value, $data) - { - if ($value != '') { - $query->where("title", 'like', '%' . $this->handelSpecialCharacter($value) . '%'); - } - } - - /** - * 搜索器:状态 - * @param $value - * @param $data - */ - public function searchStatusAttr($query, $value, $data) - { - if ($value != '') { - $query->where("status",'=',$value); - } - } - - - /** - * 类型 - * @param $value - * @param $data - * @return string - */ - public function getTypeNameAttr($value, $data) - { - if (empty($data['type'])) - return ''; - return CouponDict::getType()[$data['type']] ?? ''; - } - - /** - * 领取类型 - * @param $value - * @param $data - * @return string - */ - public function getReceiveTypeNameAttr($value, $data) - { - if (empty($data['receive_type'])) - return ''; - return CouponDict::getReceiveType()[$data['receive_type']] ?? ''; - } - - /** - * 优惠券状态 - * @param $value - * @param $data - * @return string - */ - public function getStatusNameAttr($value, $data) - { - return CouponDict::getStatus()[$data['status']] ?? ''; - } - - /** - * 发券按钮是否展示 - * @param $value - * @param $data - * @return string - */ - public function getIsShowSendAttr($value, $data) - { - if($data['status'] != CouponDict::NORMAL){ - return 0; - } - return 1; - } - - - /** - * 活动开始时间搜索器 - * @param Query $query - * @param $value - * @param $data - */ - public function searchStartTimeAttr(Query $query, $value, $data) - { - $start_time = empty($value[0]) ? 0 : strtotime($value[0]); - $end_time = empty($value[1]) ? 0 : strtotime($value[1]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('start_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([['start_time', '>=', $start_time]]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([['start_time', '<=', $end_time]]); - } - } - - /** - * 活动结束时间搜索器 - * @param Query $query - * @param $value - * @param $data - */ - public function searchEndTimeAttr(Query $query, $value, $data) - { - $start_time = empty($value[0]) ? 0 : strtotime($value[0]); - $end_time = empty($value[1]) ? 0 : strtotime($value[1]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('end_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([['end_time', '>=', $start_time]]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([['end_time', '<=', $end_time]]); - } - } -} diff --git a/niucloud/addon/shop/app/model/coupon/CouponGoods.php b/niucloud/addon/shop/app/model/coupon/CouponGoods.php deleted file mode 100644 index ad6188929..000000000 --- a/niucloud/addon/shop/app/model/coupon/CouponGoods.php +++ /dev/null @@ -1,41 +0,0 @@ -hasOne(Goods::class , 'goods_id', 'goods_id'); - } - -} diff --git a/niucloud/addon/shop/app/model/coupon/CouponMember.php b/niucloud/addon/shop/app/model/coupon/CouponMember.php deleted file mode 100644 index 0ff7fccd8..000000000 --- a/niucloud/addon/shop/app/model/coupon/CouponMember.php +++ /dev/null @@ -1,121 +0,0 @@ - 'timestamp', - 'use_time' => 'timestamp', - ]; - - public function coupon() - { - return $this->hasOne(Coupon::class, 'id', 'coupon_id')->joinType('left') - ->withField('title, price, min_condition_money, type'); - } - - public function member() - { - return $this->hasOne(Member::class, 'member_id', 'member_id')->joinType('left') - ->withField('member_id,member_no, username, mobile, nickname'); - } - - /** - * 优惠券商品项 - * @return \think\model\relation\HasMany - */ - public function goods() - { - return $this->hasMany(CouponGoods::class, 'coupon_id', 'coupon_id'); - } - - public function getStatusNameAttr($value, $data) - { - if (empty($data[ 'status' ])) - return ''; - $temp = CouponMemberDict::getStatus()[ $data[ 'status' ] ] ?? []; - return $temp ?? ''; - - } - - public function getReceiveTypeNameAttr($value, $data) - { - - if (empty($data[ 'receive_type' ])) - return ''; - $receive_type = event('CouponReceiveType', []); - if (empty($receive_type)) { - return []; - } - foreach ($receive_type as &$value) { - foreach ($value as $v) { - $type[] = $v[ 'name' ]; - $info[] = $v; - } - } - - $key = array_search($data[ 'receive_type' ], $type); - - $temp = $info[ $key ][ 'title' ] ?? []; - return $temp ?? ''; - - } - - public function getCouponPriceAttr($value, $data) - { - if (empty($data[ 'price' ])) { - return 0; - } - return rtrim(rtrim($data[ 'price' ], '0'), '.'); - - } - - public function getCouponMinPriceAttr($value, $data) - { - if (empty($data[ 'min_condition_money' ])) { - return 0; - } - return rtrim(rtrim($data[ 'min_condition_money' ], '0'), '.'); - - } - - public function getTypeNameAttr($value, $data) - { - if (empty($data[ 'type' ])) - return ''; - return CouponDict::getType()[ $data[ 'type' ] ] ?? ''; - } -} diff --git a/niucloud/addon/shop/app/model/coupon/CouponSendRecord.php b/niucloud/addon/shop/app/model/coupon/CouponSendRecord.php deleted file mode 100644 index 9c81f7bd9..000000000 --- a/niucloud/addon/shop/app/model/coupon/CouponSendRecord.php +++ /dev/null @@ -1,122 +0,0 @@ - 'timestamp', - 'create_time' => 'timestamp', - 'update_time' => 'timestamp', - ]; - protected $json = ['range_param']; - - // 设置JSON数据返回数组 - protected $jsonAssoc = true; - - /** - * 关联优惠券 - * @return \think\model\relation\HasOne - */ - public function coupon() - { - return $this->hasOne(Coupon::class, 'id', 'coupon_id'); - } - - /** - * 获取范围名称 - * @param $value - * @param $data - * @return array|mixed|string - */ - public function getRangeTypeNameAttr($value, $data) - { - if (empty($data[ 'range_type' ])) - return ''; - return CouponDict::getSendCouponRangeTypeDesc($data[ 'range_type' ]) ?? ''; - } - - /** - * 获取状态 - * @param $value - * @param $data - * @return array|mixed|string - */ - public function getStatusNameAttr($value, $data) - { - if (empty($data['status'])) - return ''; - return CouponDict::getSendCouponStatus($data['status']) ?? ''; - } - - /** - * 获取参数值 - * @param $value - * @param $data - * @return array|string - */ - public function getRangeParamValueAttr($value, $data) - { - if (empty($data['range_type'])) - return ''; - if ($data['range_type'] == CouponDict::SEND_RANGE_MEMBER_LEVEL){ - return $data['range_param']['level_name'] ??""; - } - if ($data['range_type'] == CouponDict::SEND_RANGE_MEMBER_LABEL){ - return $data['range_param']['label_name'] ??""; - } - if ($data['range_type'] == CouponDict::SEND_RANGE_MEMBER){ - return $data['range_param']['member_ids'] ?? []; - } - return '全体会员'; - } - - /** - * 创建时间搜索器 - * @param $query - * @param $value - * @param $data - */ - public function searchCreateTimeAttr($query, $value, $data) - { - $start_time = empty($value[ 0 ]) ? 0 : strtotime($value[ 0 ]); - $end_time = empty($value[ 1 ]) ? 0 : strtotime($value[ 1 ]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('create_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([ [ 'create_time', '>=', $start_time ] ]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([ [ 'create_time', '<=', $end_time ] ]); - } - } -} diff --git a/niucloud/addon/shop/app/model/delivery/Company.php b/niucloud/addon/shop/app/model/delivery/Company.php deleted file mode 100644 index eff961e43..000000000 --- a/niucloud/addon/shop/app/model/delivery/Company.php +++ /dev/null @@ -1,79 +0,0 @@ -where("company_id", $value); - } - } - - /** - * 搜索器:物流公司名称 - * @param $value - * @param $data - */ - public function searchCompanyNameAttr($query, $value, $data) - { - if ($value != '') { - $query->where("company_name", 'like', '%' . $value . '%'); - } - } - - /** - * 搜索器:是否支持电子面单(0:不支持,1:支持) - * @param $value - * @param $data - */ - public function searchElectronicSheetSwitchAttr($query, $value, $data) - { - if ($value !== '') { - $query->where("electronic_sheet_switch", $value); - } - } - -} diff --git a/niucloud/addon/shop/app/model/delivery/Deliver.php b/niucloud/addon/shop/app/model/delivery/Deliver.php deleted file mode 100644 index 72e990f31..000000000 --- a/niucloud/addon/shop/app/model/delivery/Deliver.php +++ /dev/null @@ -1,63 +0,0 @@ -where("deliver_name", 'like', '%' . $value . '%'); - } - } - - /** - * 搜索器:配送员手机号 - * @param $value - * @param $data - */ - public function searchDeliverMobileAttr($query, $value) - { - if ($value != '') { - $query->where("deliver_mobile", 'like', '%' . $value . '%'); - - } - } -} diff --git a/niucloud/addon/shop/app/model/delivery/ElectronicSheet.php b/niucloud/addon/shop/app/model/delivery/ElectronicSheet.php deleted file mode 100644 index 71655b2ef..000000000 --- a/niucloud/addon/shop/app/model/delivery/ElectronicSheet.php +++ /dev/null @@ -1,135 +0,0 @@ -hasOne(Company::class, 'company_id', 'express_company_id'); - } - - /** - * 搜索器:电子面单 - * @param $value - * @param $data - */ - public function searchIdAttr($query, $value, $data) - { - if ($value) { - $query->where("id", $value); - } - } - - /** - * 搜索器:电子面单模板名称 - * @param $value - * @param $data - */ - public function searchTemplateNameAttr($query, $value, $data) - { - if ($value != '') { - $query->where("template_name", 'like', '%' . $this->handelSpecialCharacter($value) . '%'); - } - } - - /** - * 搜索器:电子面单物流公司id - * @param $value - * @param $data - */ - public function searchExpressCompanyIdAttr($query, $value, $data) - { - if ($value) { - $query->where("express_company_id", $value); - } - } - - /** - * 搜索器:电子面单快递员上门揽件(0:否,1:是) - * @param $value - * @param $data - */ - public function searchIsNoticeAttr($query, $value, $data) - { - if ($value) { - $query->where("is_notice", $value); - } - } - - /** - * 搜索器:电子面单状态(1:开启,0:关闭) - * @param $value - * @param $data - */ - public function searchStatusAttr($query, $value, $data) - { - if ($value !== '') { - $query->where("status", $value); - } - } - - public function getKdbirdConfigAttr($value, $data) - { - if(!empty($data['interface_data'])){ - $interface_data = json_decode($data['interface_data'], true); - return is_array($interface_data) && $interface_data['kdbird'] ? $interface_data['kdbird'] : []; - } - } - - public function getKd100ConfigAttr($value, $data) - { - if(!empty($data['interface_data'])){ - $interface_data = json_decode($data['interface_data'], true); - return is_array($interface_data) && $interface_data['kd100'] ? $interface_data['kd100'] : []; - } - } - - - -} diff --git a/niucloud/addon/shop/app/model/delivery/Local.php b/niucloud/addon/shop/app/model/delivery/Local.php deleted file mode 100644 index bd1eecfa4..000000000 --- a/niucloud/addon/shop/app/model/delivery/Local.php +++ /dev/null @@ -1,42 +0,0 @@ - 'json', - 'area' => 'json', - 'delivery_type' => 'json', - 'delivery_time' => 'json' - ]; -} diff --git a/niucloud/addon/shop/app/model/delivery/ShippingTemplate.php b/niucloud/addon/shop/app/model/delivery/ShippingTemplate.php deleted file mode 100644 index 8bc4d7e38..000000000 --- a/niucloud/addon/shop/app/model/delivery/ShippingTemplate.php +++ /dev/null @@ -1,53 +0,0 @@ -where([ [ 'template_name', 'like', "%$value%" ] ]); - } - } - - /** - * 获取计费类型 - * @param $value - * @param $data - * @return array|mixed|string - */ - public function getFeeTypeNameAttr($value, $data) - { - if (isset($data[ 'fee_type' ])) return ShippingTemplateDict::getFeeType($data[ 'fee_type' ]); - } -} diff --git a/niucloud/addon/shop/app/model/delivery/ShippingTemplateItem.php b/niucloud/addon/shop/app/model/delivery/ShippingTemplateItem.php deleted file mode 100644 index a66849fa2..000000000 --- a/niucloud/addon/shop/app/model/delivery/ShippingTemplateItem.php +++ /dev/null @@ -1,46 +0,0 @@ - 'float', - 'xprice' => 'float' - ]; - - /** - * 模型名称 - * @var string - */ - protected $name = 'shop_delivery_shipping_template_item'; - - public function getAreaIdsAttr($value, $data) - { - return explode(',', $value); - } -} diff --git a/niucloud/addon/shop/app/model/delivery/Store.php b/niucloud/addon/shop/app/model/delivery/Store.php deleted file mode 100644 index 71a26ef64..000000000 --- a/niucloud/addon/shop/app/model/delivery/Store.php +++ /dev/null @@ -1,138 +0,0 @@ - 'timestamp', - 'update_time' => 'timestamp', - ]; - protected $json = ['time_week','trade_time_json','area','support_delivery', 'extend_data']; - protected $jsonAssoc = true; - - /** - * 搜索器:关键字 - * @param $query - * @param $value - * @param $data - */ - public function searchKeywordAttr($query, $value, $data) - { - if ($value != '') { - $query->where('store_name|mobile|full_address', 'like', '%' . $value . '%'); - } - } - - /** - * 搜索器:自提门店门店名称 - * @param $value - * @param $data - */ - public function searchStoreNameAttr($query, $value, $data) - { - if ($value != '') { - $query->where("store_name", "like", "%" . $value . "%"); - } - } - - /** - * 搜索器:支持的提货类型 - * @param $query - * @param $value - * @param $data - */ - public function searchPickUpTypeAttr($query, $value, $data) - { - if (!empty($data['pick_up_type'])) { - switch ($data['pick_up_type']) { - case DeliveryDict::LOCAL_DELIVERY: - $query->where('support_local_delivery', '=', 1); - break; - case DeliveryDict::STORE: - $query->where('support_store', '=', 1); - break; - } - } - } - - /** - * 搜索器:提货点状态 - * @param $query - * @param $value - * @param $data - */ - public function searchStatusAttr($query, $value, $data) - { - if ($value != '') { - $query->where('status', $value); - } - } - - /** - * 创建时间搜索器 - * @param $value - */ - public function searchCreateTimeAttr(Query $query, $value, $data) - { - $start_time = empty($value[ 0 ]) ? 0 : strtotime($value[ 0 ]); - $end_time = empty($value[ 1 ]) ? 0 : strtotime($value[ 1 ]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('create_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([ [ 'create_time', '>=', $start_time ] ]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([ [ 'create_time', '<=', $end_time ] ]); - } - } - - /** - * 提货类型 - * @param $value - * @param $data - * @return array - */ - public function getPickUpTypeNameAttr($value, $data) - { - $pick_up_type = []; - if (isset($data[ 'support_local_delivery' ]) && $data[ 'support_local_delivery' ] == 1) { - $pick_up_type[] = DeliveryStoreDict::getPickUpType(DeliveryDict::LOCAL_DELIVERY); - } - if (isset($data[ 'support_store' ]) && $data[ 'support_store' ] == 1) { - $pick_up_type[] = DeliveryStoreDict::getPickUpType(DeliveryDict::STORE); - } - return $pick_up_type; - } -} diff --git a/niucloud/addon/shop/app/model/discount/Discount.php b/niucloud/addon/shop/app/model/discount/Discount.php deleted file mode 100644 index 0252370c0..000000000 --- a/niucloud/addon/shop/app/model/discount/Discount.php +++ /dev/null @@ -1,103 +0,0 @@ - 'timestamp', - 'end_time' => 'timestamp', - 'create_time' => 'timestamp', - 'update_time' => 'timestamp', - ]; - - - /** - * 活动商品项 - * @return \think\model\relation\HasMany - */ - public function activeGoods() - { - return $this->hasMany(DiscountGoods::class, 'discount_id', 'discount_id'); - } - - /** - * 状态 - * @param $value - * @param $data - * @return mixed|string - */ - public function getStatusNameAttr($value, $data) - { - if (empty($data['status'])) - { - return ''; - } - return DiscountDict::getStatus()[$data['status']] ?? ''; - } - - /** - * 搜索器:标题 - * @param $value - * @param $data - */ - public function searchNameAttr($query, $value, $data) - { - if ($value != '') { - $query->where("name", 'like', '%' . $this->handelSpecialCharacter($value) . '%'); - } - } - /** - * 搜索器:状态 - * @param $value - * @param $data - */ - public function searchStatusAttr($query, $value, $data) - { - if ($value) { - $query->where("status", '=', $value); - } - } - - /** - * 搜索器:id - * @param $value - * @param $data - */ - public function searchActiveIdAttr($query, $value, $data) - { - if (!empty($value)) { - $query->where("discount_id", 'in', $value); - } - } -} diff --git a/niucloud/addon/shop/app/model/discount/DiscountGoods.php b/niucloud/addon/shop/app/model/discount/DiscountGoods.php deleted file mode 100644 index 7426fbd5e..000000000 --- a/niucloud/addon/shop/app/model/discount/DiscountGoods.php +++ /dev/null @@ -1,95 +0,0 @@ - 'timestamp', - 'update_time' => 'timestamp', - ]; - - /** - * 限时折扣 - * @return \think\model\relation\HasOne - */ - public function discount() - { - return $this->hasOne(Discount::class, 'discount_id', 'discount_id'); - } - - /** - * 商品 - * @return \think\model\relation\HasOne - */ - public function goods() - { - return $this->hasOne(Goods::class, 'goods_id', 'goods_id'); - } - - /** - * 商品规格 - * @return \think\model\relation\HasOne - */ - public function goodsSku() - { - return $this->hasOne(GoodsSku::class, 'sku_id', 'sku_id'); - } - - /** - * 获取封面缩略图(小) - */ - public function getGoodsCoverThumbSmallAttr($value, $data) - { - if (isset($data[ 'goods_cover' ]) && $data[ 'goods_cover' ] != '') { - return get_thumb_images($data[ 'goods_cover' ], FileDict::SMALL); - } - return []; - } - - /** - * 状态字段转化 - * @param $value - * @param $data - * @return mixed - */ - public function getGoodsTypeNameAttr($value, $data) - { - if (!empty($data[ 'goods_type' ])) { - return GoodsDict::getType($data[ 'goods_type' ])[ 'name' ] ?? ''; - } - return ''; - } - -} diff --git a/niucloud/addon/shop/app/model/exchange/Exchange.php b/niucloud/addon/shop/app/model/exchange/Exchange.php deleted file mode 100644 index 7040c970a..000000000 --- a/niucloud/addon/shop/app/model/exchange/Exchange.php +++ /dev/null @@ -1,315 +0,0 @@ - 'timestamp', - 'update_time' => 'timestamp', - ]; - - // 设置json类型字段 - protected $json = ['product_detail']; - - // 设置JSON数据返回数组 - protected $jsonAssoc = true; - - protected $autoWriteTimestamp = false; - - - - /** - * 搜索器商品名称 - * @param $value - * @param $data - */ - public function searchNamesAttr($query, $value, $data) - { - if ($value != '') { - $query->where("names", 'like', '%' . $this->handelSpecialCharacter($value) . '%'); - } - } - - /** - * 搜索器ids - * @param $value - * @param $data - */ - public function searchIdsAttr($query, $value, $data) - { - if ($value) { - $query->where("id", 'in', $value); - } - } - - /** - * 搜索器商品sku 查询订单使用 - * @param $value - * @param $data - */ - public function searchProductDetailAttr($query, $value, $data) - { - if ($value) { - $query->where("product_detail", 'like', '%' . $value . '%'); - } - } - - /** - * 搜索器商品sku 查询sku - * @param $value - * @param $data - */ - public function searchSkuIdAttr($query, $value, $data) - { - - if ($value) { - $query->where('product_detail', 'like', '%' . '"sku_id":' . $value . ',' . '%'); - } - } - - /** - * 搜索器商品sku 查询sku - * @param $value - * @param $data - */ - public function searchGoodsIdAttr($query, $value, $data) - { - if ($value) { - $query->where('product_detail', 'like', '%' . '"goods_id":' . $value . ',' . '%'); - } - } - - /** - * 创建时间搜索器 - * @param Query $query - * @param $value - * @param $data - */ - public function searchCreateTimeAttr(Query $query, $value, $data) - { - $start_time = empty($value[0]) ? 0 : strtotime($value[0]); - $end_time = empty($value[1]) ? 0 : strtotime($value[1]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('create_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([['create_time', '>=', $start_time]]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([['create_time', '<=', $end_time]]); - } - } - - /** - * 搜索器:状态 - * @param $value - * @param $data - */ - public function searchStatusAttr($query, $value, $data) - { - if ($value != '') { - $query->where("status", '=', $value); - } - } - - /** - * 搜索器:ID in 查询 - * @param $value - * @param $data - */ - public function searchIdAttr($query, $value, $data) - { - if ($value) { - $query->where("id", 'in', $value); - } - } - - /** - * 活动商品类型 - * @param $value - * @param $data - * @return mixed|string - */ - public function getTypeNameAttr($value, $data) - { - if (empty($data['type'])) { - return ''; - } - return ExchangeDict::getType()[$data['type']] ?? ''; - } - - /** - * 活动状态 - * @param $value - * @param $data - * @return mixed|string - */ - public function getStatusNameAttr($value, $data) - { - if (empty($data['status']) && $data['status'] != 0) { - return ''; - } - return ExchangeDict::getStatus()[$data['status']] ?? ''; - } - - /** - * 获取封面缩略图(小) - */ - public function getGoodsCoverThumbSmallAttr($value, $data) - { - $data['goods_cover'] = explode(',', $data['image'])[0]; - if (isset($data['goods_cover']) && $data['goods_cover'] != '') { - return get_thumb_images($data['goods_cover'], FileDict::SMALL); - } - return []; - } - - /** - * 获取封面缩略图(中) - */ - public function getGoodsCoverThumbMidAttr($value, $data) - { - $data['goods_cover'] = explode(',', $data['image'])[0]; - if (isset($data['goods_cover']) && $data['goods_cover'] != '') { - return get_thumb_images($data['goods_cover'], FileDict::MID); - } - return []; - } - - /** - * 获取封面缩略图(大) - */ - public function getGoodsCoverThumbBigAttr($value, $data) - { - $data['goods_cover'] = explode(',', $data['image'])[0]; - if (isset($data['goods_cover']) && $data['goods_cover'] != '') { - return get_thumb_images($data['goods_cover'], FileDict::BIG); - } - return []; - } - - /** - * 获取商品图片缩略图(小) - */ - public function getGoodsImageThumbSmallAttr($value, $data) - { - if (isset($data['image']) && $data['image'] != '') { - $goods_image = explode(',', $data['image']); - $img_arr = []; - foreach ($goods_image as $k => $v) { - $img = get_thumb_images($v, FileDict::SMALL); - if (!empty($img)) { - $img_arr[] = $img; - } - } - return $img_arr; - } - return []; - } - - /** - * 获取商品图片缩略图(中) - */ - public function getGoodsImageThumbMidAttr($value, $data) - { - if (isset($data['image']) && $data['image'] != '') { - $goods_image = explode(',', $data['image']); - $img_arr = []; - foreach ($goods_image as $k => $v) { - $img = get_thumb_images($v, FileDict::MID); - if (!empty($img)) { - $img_arr[] = $img; - } - } - return $img_arr; - } - return []; - } - - /** - * 获取商品图片缩略图(大) - */ - public function getGoodsImageThumbBigAttr($value, $data) - { - if (isset($data['image']) && $data['image'] != '') { - $goods_image = explode(',', $data['image']); - $img_arr = []; - foreach ($goods_image as $k => $v) { - $img = get_thumb_images($v, FileDict::BIG); - if (!empty($img)) { - $img_arr[] = $img; - } - } - return $img_arr; - } - return []; - } - - public function getGoodsBrandAttr($value, $data) - { - $product_detail = !is_array($data['product_detail']) ? json_decode($data['product_detail'], true) : $data['product_detail']; - $goods_id = $product_detail[0]['goods_id']; - $brand_id = (new Goods())->where([ - ['goods_id', '=', $goods_id], - ])->value('brand_id') ?? 0; - $brand = (new Brand())->where([['brand_id', '=', $brand_id]])->field('brand_name,brand_id,color_json,logo')->findOrEmpty(); - return $brand->isEmpty() ? null : $brand->toArray(); - } - - public function getGoodsLabelAttr($value, $data) - { - $product_detail = !is_array($data['product_detail']) ? json_decode($data['product_detail'], true) : $data['product_detail']; - $goods_id = $product_detail[0]['goods_id']; - $label_ids = (new Goods())->where([ - ['goods_id', '=', $goods_id], - ])->value('label_ids') ?? []; - return (new Label())->where([ ['label_id', 'in', $label_ids]])->field('label_id,label_name,color_json,style_type,icon')->select()->toArray(); - - } - - /** - * 搜索器:id - * @param $value - * @param $data - */ - public function searchActiveIdAttr($query, $value, $data) - { - if (!empty($value)) { - $query->where("id", 'in', $value); - } - } - -} diff --git a/niucloud/addon/shop/app/model/goods/Attr.php b/niucloud/addon/shop/app/model/goods/Attr.php deleted file mode 100644 index 3e827622a..000000000 --- a/niucloud/addon/shop/app/model/goods/Attr.php +++ /dev/null @@ -1,74 +0,0 @@ -where("attr_id", $value); - } - } - - - /** - * 搜索器:商品参数商品参数id - * @param $value - * @param $data - */ - public function searchAttrIdArrAttr($query, $value, $data) - { - if ($value) { - $query->where("attr_id", 'in', $value); - } - } - - /** - * 搜索器:商品参数参数名称 - * @param $value - * @param $data - */ - public function searchAttrNameAttr($query, $value, $data) - { - if ($value != '') { - $query->where("attr_name", 'like', '%' . $this->handelSpecialCharacter($value) . '%'); - } - } - -} diff --git a/niucloud/addon/shop/app/model/goods/Brand.php b/niucloud/addon/shop/app/model/goods/Brand.php deleted file mode 100644 index 69ba41a4f..000000000 --- a/niucloud/addon/shop/app/model/goods/Brand.php +++ /dev/null @@ -1,55 +0,0 @@ -where("brand_name", "like", "%" . $this->handelSpecialCharacter($value) . "%"); - } - } - -} diff --git a/niucloud/addon/shop/app/model/goods/Browse.php b/niucloud/addon/shop/app/model/goods/Browse.php deleted file mode 100644 index 5400c0884..000000000 --- a/niucloud/addon/shop/app/model/goods/Browse.php +++ /dev/null @@ -1,57 +0,0 @@ - 'timestamp', - ]; - /** - * 商品信息 - * @return HasOne - */ - public function goods() - { - return $this->hasOne(Goods::class, 'goods_id', 'goods_id')->joinType('left')->withField('goods_id, goods_name,goods_cover,status')->append([ 'goods_cover_thumb_mid' ])->bind([ 'goods_name', 'goods_cover_thumb_mid','member_discount','status' ]); - } - - /** - * 关联默认商品规格 - * @return HasOne - */ - public function goodsSku() - { - return $this->hasOne(GoodsSku::class, 'sku_id', 'sku_id')->bind(['price','market_price','member_price','sale_price']); - } - -} diff --git a/niucloud/addon/shop/app/model/goods/Category.php b/niucloud/addon/shop/app/model/goods/Category.php deleted file mode 100644 index 8a6e58e79..000000000 --- a/niucloud/addon/shop/app/model/goods/Category.php +++ /dev/null @@ -1,72 +0,0 @@ -where("category_name", "like", "%" . $value . "%"); - } - } - - /** - * 搜索器:商品分类id - * @param $value - * @param $data - */ - public function searchCategoryIdAttr($query, $value, $data) - { - if ($value) { - $query->where("category_id", "=", $value ); - } - } - - /** - * 搜索器:pid - * @param $value - * @param $data - */ - public function searchPidAttr($query, $value, $data) - { - if ($value) { - $query->where("pid", "=", $value ); - } - } - -} diff --git a/niucloud/addon/shop/app/model/goods/Evaluate.php b/niucloud/addon/shop/app/model/goods/Evaluate.php deleted file mode 100644 index 659a7b88d..000000000 --- a/niucloud/addon/shop/app/model/goods/Evaluate.php +++ /dev/null @@ -1,154 +0,0 @@ -hasOne(Goods::class, 'goods_id', 'goods_id')->withField('goods_id, goods_name, goods_cover') - ->append([ 'goods_cover_thumb_small', 'goods_cover_thumb_mid' ]); - } - - public function orderGoods() - { - return $this->hasOne(OrderGoods::class, 'order_goods_id', 'order_goods_id'); - } - - /** - * 审核状态转换 - * @param $value - * @param $data - * @return mixed|string - */ - public function getAuditNameAttr($value, $data) - { - return EvaluateDict::getStatus()[ $data[ 'is_audit' ] ] ?? ''; - } - - /** - * 缩略图生成-小图 - * @param $value - * @param $data - * @return array|mixed - * @throws \Exception - */ - public function getImageSmallAttr($value, $data) - { - if (!empty($data[ 'images' ])) { - $small_arr = []; - foreach ($data[ 'images' ] as $k => $v) { - $small_arr[] = get_thumb_images($v, FileDict::SMALL); - } - return $small_arr; - } - return []; - } - - /** - * 缩略图生成-大图 - * @param $value - * @param $data - * @return array|mixed - * @throws \Exception - */ - public function getImageBigAttr($value, $data) - { - if (!empty($data[ 'images' ])) { - $small_arr = []; - foreach ($data[ 'images' ] as $k => $v) { - $small_arr[] = get_thumb_images($v, FileDict::BIG); - } - return $small_arr; - } - return []; - } - - /** - * 缩略图生成-中图 - * @param $value - * @param $data - * @return array|mixed - * @throws \Exception - */ - public function getImageMidAttr($value, $data) - { - if (!empty($data[ 'images' ])) { - $small_arr = []; - foreach ($data[ 'images' ] as $k => $v) { - $small_arr[] = get_thumb_images($v, FileDict::MID); - } - return $small_arr; - } - return []; - } - - /** - * 评分搜索器 - * @param $query - * @param $value - * @param $data - */ - public function searchScoresAttr($query, $value, $data) - { - if ($value) { - $query->where("scores", "in", $value); - } - } - - public function searchGoodsIdAttr($query, $value, $data) - { - if ($value) { - $query->where("goods_id", "=", $value); - } - } - - public function getMemberNameAttr($value, $data) - { - if (isset($data[ 'is_anonymous' ]) && $data[ 'is_anonymous' ] == 1) { - return '匿名买家'; - } - return $value; - } -} diff --git a/niucloud/addon/shop/app/model/goods/Goods.php b/niucloud/addon/shop/app/model/goods/Goods.php deleted file mode 100644 index 1f083127f..000000000 --- a/niucloud/addon/shop/app/model/goods/Goods.php +++ /dev/null @@ -1,500 +0,0 @@ -getDeliveryConfig(); - $configKeys = array_keys($deliver_list); // 缓存配置数组的键 - $result = []; - - // 筛选可用的配送方式并按配置顺序排序 - foreach ($data[ 'delivery_type' ] as $type) { - if (isset($deliver_list[ $type ]) && $deliver_list[ $type ][ 'status' ] === 1) { - $position = array_search($type, $configKeys); - $result[ $position ] = [ $type => $deliver_list[ $type ] ]; - } - } - // 按键排序(保持配置中的原始顺序) - ksort($result); - // 转换为一维数组(保持原始代码的输出结构) - return array_merge([], ...array_values($result)); - } - return []; - } - - /** - * 获取封面缩略图(小) - */ - public function getGoodsCoverThumbSmallAttr($value, $data) - { - if (isset($data[ 'goods_cover' ]) && $data[ 'goods_cover' ] != '') { - return get_thumb_images($data[ 'goods_cover' ], FileDict::SMALL); - } - return []; - } - - /** - * 获取封面缩略图(中) - */ - public function getGoodsCoverThumbMidAttr($value, $data) - { - if (isset($data[ 'goods_cover' ]) && $data[ 'goods_cover' ] != '') { - return get_thumb_images($data[ 'goods_cover' ], FileDict::MID); - } - return []; - } - - /** - * 获取封面缩略图(大) - */ - public function getGoodsCoverThumbBigAttr($value, $data) - { - if (isset($data[ 'goods_cover' ]) && $data[ 'goods_cover' ] != '') { - return get_thumb_images($data[ 'goods_cover' ], FileDict::BIG); - } - return []; - } - - /** - * 获取商品图片缩略图(小) - */ - public function getGoodsImageThumbSmallAttr($value, $data) - { - if (isset($data[ 'goods_image' ]) && $data[ 'goods_image' ] != '') { - $goods_image = explode(',', $data[ 'goods_image' ]); - $img_arr = []; - foreach ($goods_image as $k => $v) { - $img = get_thumb_images($v, FileDict::SMALL); - if (!empty($img)) { - $img_arr[] = $img; - } - } - return $img_arr; - } - return []; - } - - /** - * 获取商品图片缩略图(中) - */ - public function getGoodsImageThumbMidAttr($value, $data) - { - if (isset($data[ 'goods_image' ]) && $data[ 'goods_image' ] != '') { - $goods_image = explode(',', $data[ 'goods_image' ]); - $img_arr = []; - foreach ($goods_image as $k => $v) { - $img = get_thumb_images($v, FileDict::MID); - if (!empty($img)) { - $img_arr[] = $img; - } - } - return $img_arr; - } - return []; - } - - /** - * 获取商品图片缩略图(大) - */ - public function getGoodsImageThumbBigAttr($value, $data) - { - if (isset($data[ 'goods_image' ]) && $data[ 'goods_image' ] != '') { - $goods_image = explode(',', $data[ 'goods_image' ]); - $img_arr = []; - foreach ($goods_image as $k => $v) { - $img = get_thumb_images($v, FileDict::BIG); - if (!empty($img)) { - $img_arr[] = $img; - } - } - return $img_arr; - } - return []; - } - - /** - * 获取商品分类 - */ - public function getGoodsCategoryAttr($value, $data) - { - if (!is_array($value)) { - $value = json_decode($value, true); - } - if (!empty($value)) { - return array_map(function ($item) { - return (int) $item; - }, $value); - } - return []; - } - - public function getGoodsLabelNameAttr($value, $data) - { - if (isset($data[ 'label_ids' ]) && !empty($data[ 'label_ids' ])) { - $goods_label_model = new Label(); - return $goods_label_model->where([ - [ 'label_id', 'in', $data[ 'label_ids' ] ], - [ 'status', '=', 1 ] - ])->field('label_id, label_name, style_type,color_json,icon')->order('sort desc,label_id desc')->select()->toArray(); - } - - } - - public function getGoodsBrandAttr($value, $data) - { - if (isset($data[ 'brand_id' ]) && !empty($data[ 'brand_id' ])) { - $goods_brand_model = new Brand(); - $info = $goods_brand_model->where([ - [ 'brand_id', '=', $data[ 'brand_id' ] ], - ])->field('brand_id,brand_name,logo,color_json') - ->findOrEmpty()->toArray(); - return $info; - } - } - - /** - * 状态字段转化 - * @param $value - * @param $data - * @return mixed - */ - public function getDiscountStatusNameAttr($value, $data) - { - if (!empty($data[ 'discount_status' ])) { - return DiscountDict::getStatus($data[ 'discount_status' ]) ?? ''; - } - return ''; - } - - /** - * 搜索器:商品商品id - * @param $value - * @param $data - */ - public function searchGoodsIdAttr($query, $value, $data) - { - if ($value) { - $query->where("goods_id", $value); - } - } - - /** - * 搜索器:商品商品名称 - * @param $value - * @param $data - */ - public function searchGoodsNameAttr($query, $value, $data) - { - if ($value != '') { - $query->where("goods_name", "like", "%" . $this->handelSpecialCharacter($value) . "%"); - } - } - - /** - * 搜索器:商品副标题 - * @param $value - * @param $data - */ - public function searchSubTitleAttr($query, $value, $data) - { - if ($value != '') { - $query->where("sub_title", "like", "%" . $value . "%"); - } - } - - /** - * 搜索器:商品商品类型 - * @param $value - * @param $data - */ - public function searchGoodsTypeAttr($query, $value, $data) - { - if ($value) { - $query->where("goods_type", $value); - } - } - - /** - * 搜索器:商品商品品牌id - * @param $value - * @param $data - */ - public function searchBrandIdAttr($query, $value, $data) - { - if ($value) { - $query->where("brand_id", $value); - } - } - - /** - * 搜索器:商品商品分类 - * @param $value - * @param $data - */ - public function searchGoodsCategoryAttr(Query $query, $value, $data) - { - if ($value) { - if (is_array($value)) { - $temp_where = array_map(function ($item) { - return '%"' . $item . '"%'; - }, $value); - } else { - $temp_where = [ '%"' . $value . '"%' ]; - } - $query->where('goods_category', 'like', $temp_where, 'or'); - } - } - - /** - * 搜索器:商品标签组 - * @param $value - * @param $data - */ - public function searchLabelIdsAttr($query, $value, $data) - { - if ($value) { - if (is_array($value)) { - $temp_where = array_map(function ($item) { - return '%"' . $item . '"%'; - }, $value); - } else { - $temp_where = [ '%"' . $value . '"%' ]; - } - $query->where('label_ids', 'like', $temp_where, 'or'); - } - } - - /** - * 搜索器:商品服务 - * @param $value - * @param $data - */ - public function searchServiceIdsAttr($query, $value, $data) - { - if ($value) { - if (is_array($value)) { - $temp_where = array_map(function ($item) { - return '%"' . $item . '"%'; - }, $value); - } else { - $temp_where = [ '%"' . $value . '"%' ]; - } - $query->where('service_ids', 'like', $temp_where, 'or'); - } - } - - /** - * 搜索器:商品支持的配送方式 - * @param $value - * @param $data - */ - public function searchDeliveryTypeAttr($query, $value, $data) - { - if ($value) { - if (gettype($value) == 'array') { - $like_arr = []; - foreach ($value as $k => $v) { - $like_arr[] = "%" . $v . "%"; - } - $query->where("delivery_type", "like", $like_arr, 'or'); - } else { - $query->where("delivery_type", "like", '%' . $value . '%'); - } - } - } - - /** - * 搜索器:商品销量 - * @param $value - * @param $data - */ - public function searchSaleNumAttr($query, $value, $data) - { - if (!empty($data[ 'start_sale_num' ]) && !empty($data[ 'end_sale_num' ])) { - $money = [ $data[ 'start_sale_num' ], $data[ 'end_sale_num' ] ]; - sort($money); - $query->where('goods.sale_num', 'between', $money); - } else if (!empty($data[ 'start_sale_num' ])) { - $query->where('goods.sale_num', '>=', $data[ 'start_sale_num' ]); - } else if (!empty($data[ 'end_sale_num' ])) { - $query->where('goods.sale_num', '<=', $data[ 'end_sale_num' ]); - } - - } - - /** - * 搜索器:商品商品状态(1.正常0下架) - * @param $value - * @param $data - */ - public function searchStatusAttr($query, $value, $data) - { - if ($value !== '') { - $query->where("status", $value); - } - } - - /** - * 搜索器:供应商id - * @param $value - * @param $data - */ - public function searchSupplierIdAttr($query, $value, $data) - { - if ($value) { - $query->where("supplier_id", $value); - } - } - - /** - * 关联默认商品规格 - * @return \think\model\relation\HasOne - */ - public function goodsSku() - { - return $this->hasOne(GoodsSku::class, 'goods_id', 'goods_id'); - } - - /** - * 关联活动 - * @return \think\model\relation\HasOne - */ - public function activeGoods() - { - return $this->hasOne(ActiveGoods::class, 'goods_id', 'goods_id'); - } - - /** - * 关联活动 - * @return \think\model\relation\hasOne - */ - public function discountGoods() - { - return $this->hasOne(discountGoods::class, 'goods_id', 'goods_id'); - } - - /** - * 关联商品规格列表 - * @return \think\model\relation\HasMany - */ - public function skuList() - { - return $this->hasMany(GoodsSku::class, 'goods_id', 'goods_id'); - } - - /** - * 关联商品规格列表 - * @return \think\model\relation\HasMany - */ - public function goodsSpec() - { - return $this->hasMany(GoodsSpec::class, 'goods_id', 'goods_id'); - } - - /** - * 关联商品品牌 - * @return \think\model\relation\HasOne - */ - public function brand() - { - return $this->hasOne(Brand::class, 'brand_id', 'brand_id') - ->joinType('left') - ->withField('brand_id, brand_name, logo, desc'); - } - -} diff --git a/niucloud/addon/shop/app/model/goods/GoodsCollect.php b/niucloud/addon/shop/app/model/goods/GoodsCollect.php deleted file mode 100644 index 78d0b3480..000000000 --- a/niucloud/addon/shop/app/model/goods/GoodsCollect.php +++ /dev/null @@ -1,56 +0,0 @@ -hasOne(Goods::class, 'goods_id', 'goods_id')->joinType('left')->withField('goods_id, goods_name,goods_cover,status')->append([ 'goods_cover_thumb_mid' ])->bind([ 'goods_name', 'goods_cover_thumb_mid','status' ]); - } - - /** - * 关联默认商品规格 - * @return \think\model\relation\HasOne - */ - public function goodsSku() - { - return $this->hasOne(GoodsSku::class, 'goods_id', 'goods_id')->joinType('left')->withField('goods_id,sku_id,sku_name,price,member_price,sale_price')->bind([ 'sku_id', 'sku_name', 'price', 'member_price', 'sale_price' ]); - } - -} diff --git a/niucloud/addon/shop/app/model/goods/GoodsSku.php b/niucloud/addon/shop/app/model/goods/GoodsSku.php deleted file mode 100644 index 5445bbbf4..000000000 --- a/niucloud/addon/shop/app/model/goods/GoodsSku.php +++ /dev/null @@ -1,300 +0,0 @@ -where("sku_id", $value); - } - } - - /** - * 搜索器:商品规格商品sku名称 - * @param $value - * @param $data - */ - public function searchSkuNameAttr($query, $value, $data) - { - if ($value != '') { - $query->where("sku_name", "like", "%" . $value . "%"); - } - } - - /** - * 搜索器:商品规格商品sku编码 - * @param $value - * @param $data - */ - public function searchSkuNoAttr($query, $value, $data) - { - if ($value != '') { - $query->where("sku_no", "like", "%" . $value . "%"); - } - } - - /** - * 搜索器:商品规格商品id - * @param $value - * @param $data - */ - public function searchGoodsIdAttr($query, $value, $data) - { - if ($value) { - $query->where("goods_id", 'in', $value); - } - } - - /** - * 搜索器:商品规格sku规格格式 - * @param $value - * @param $data - */ - public function searchSkuSpecFormatAttr($query, $value, $data) - { - if ($value) { - $query->where("sku_spec_format", $value); - } - } - - /** - * 搜索器:商品规格sku单价 - * @param $value - * @param $data - */ - public function searchPriceAttr($query, $value, $data) - { - if ($value) { - $query->where("price", $value); - } - } - - /** - * 搜索器:商品规格划线价 - * @param $value - * @param $data - */ - public function searchMarketPriceAttr($query, $value, $data) - { - if ($value) { - $query->where("market_price", $value); - } - } - - /** - * 搜索器:商品规格实际卖价(有活动显示活动价,默认原价) - * @param $value - * @param $data - */ - public function searchSalePriceAttr($query, $value, $data) - { - if ($value) { - $query->where("sale_price", $value); - } - } - - /** - * 搜索器:商品规格sku成本价 - * @param $value - * @param $data - */ - public function searchCostPriceAttr($query, $value, $data) - { - if ($value) { - $query->where("cost_price", $value); - } - } - - /** - * 搜索器:商品规格商品sku库存 - * @param $value - * @param $data - */ - public function searchStockAttr($query, $value, $data) - { - if ($value) { - $query->where("stock", $value); - } - } - - /** - * 搜索器:商品规格重量(单位kg) - * @param $value - * @param $data - */ - public function searchWeightAttr($query, $value, $data) - { - if ($value) { - $query->where("weight", $value); - } - } - - /** - * 搜索器:商品规格体积(单位立方米) - * @param $value - * @param $data - */ - public function searchVolumeAttr($query, $value, $data) - { - if ($value) { - $query->where("volume", $value); - } - } - - /** - * 搜索器:商品规格销量 - * @param $value - * @param $data - */ - public function searchSaleNumAttr($query, $value, $data) - { - if ($value) { - $query->where("sale_num", $value); - } - } - - /** - * 搜索器:商品规格sku主图 - * @param $value - * @param $data - */ - public function searchSkuImageAttr($query, $value, $data) - { - if ($value) { - $query->where("sku_image", $value); - } - } - - /** - * 搜索器:商品规格是否默认 - * @param $value - * @param $data - */ - public function searchIsDefaultAttr($query, $value, $data) - { - if ($value) { - $query->where("is_default", $value); - } - } - - /** - * 关联商品主表 - * @return \think\model\relation\HasOne - */ - public function goods() - { - return $this->hasOne(Goods::class, 'goods_id', 'goods_id') - ->joinType('left') - ->withField('goods_id, is_discount, goods_name, goods_type, sub_title, goods_cover, goods_image,goods_desc,brand_id,label_ids,service_ids, unit, stock, sale_num + virtual_sale_num as sale_num, is_limit, limit_type, max_buy, min_buy, status, is_free_shipping, fee_type, delivery_type, delivery_money, delivery_template_id, goods_category,attr_ids,attr_format,member_discount,is_discount,form_id') - ->append([ 'goods_type_name', 'goods_cover_thumb_small', 'goods_cover_thumb_mid', 'delivery_type_list', 'goods_image_thumb_small', 'goods_image_thumb_mid', 'goods_image_thumb_big' ]); - } - - /** - * 关联商品主表(自定义字段) - * @return \think\model\relation\HasOne - */ - public function goodsSingle() - { - return $this->hasOne(Goods::class, 'goods_id', 'goods_id')->joinType('left'); - } - - /** - * 关联商品规格列表 - * @return \think\model\relation\HasMany - */ - public function skuList() - { - return $this->hasMany(GoodsSku::class, 'goods_id', 'goods_id'); - } - - /** - * 关联商品规格列表 - * @return \think\model\relation\HasMany - */ - public function goodsSpec() - { - return $this->hasMany(GoodsSpec::class, 'goods_id', 'goods_id'); - } - - /** - * 关联商品主表 - * @return \think\model\relation\HasOne - */ - public function goodsInfo() - { - return $this->hasOne(Goods::class, 'goods_id', 'goods_id') - ->joinType('left'); - } - -} diff --git a/niucloud/addon/shop/app/model/goods/GoodsSpec.php b/niucloud/addon/shop/app/model/goods/GoodsSpec.php deleted file mode 100644 index 58f7f58d8..000000000 --- a/niucloud/addon/shop/app/model/goods/GoodsSpec.php +++ /dev/null @@ -1,86 +0,0 @@ -where("spec_id", $value); - } - } - - /** - * 搜索器:商品规格值关联商品id - * @param $value - * @param $data - */ - public function searchGoodsIdAttr($query, $value, $data) - { - if ($value) { - $query->where("goods_id", $value); - } - } - - /** - * 搜索器:商品规格值规格项名称 - * @param $value - * @param $data - */ - public function searchSpecNameAttr($query, $value, $data) - { - if ($value) { - $query->where("spec_name", $value); - } - } - - /** - * 搜索器:商品规格值规格值名称,多个逗号隔开 - * @param $value - * @param $data - */ - public function searchSpecValuesAttr($query, $value, $data) - { - if ($value) { - $query->where("spec_values", $value); - } - } - -} diff --git a/niucloud/addon/shop/app/model/goods/Label.php b/niucloud/addon/shop/app/model/goods/Label.php deleted file mode 100644 index 48817d143..000000000 --- a/niucloud/addon/shop/app/model/goods/Label.php +++ /dev/null @@ -1,74 +0,0 @@ -where("label_name", "like", "%" . $this->handelSpecialCharacter($value) . "%"); - } - } - - /** - * 搜索器:商品标签分组id - * @param $value - * @param $data - */ - public function searchGroupIdAttr($query, $value, $data) - { - if ($value) { - $query->where("group_id", "=", $value); - } - } - - /** - * 关联商品标签分组 - * @return \think\model\relation\HasOne - */ - public function group() - { - return $this->hasOne(LabelGroup::class, 'group_id', 'group_id'); - } - -} diff --git a/niucloud/addon/shop/app/model/goods/LabelGroup.php b/niucloud/addon/shop/app/model/goods/LabelGroup.php deleted file mode 100644 index 2380ff349..000000000 --- a/niucloud/addon/shop/app/model/goods/LabelGroup.php +++ /dev/null @@ -1,46 +0,0 @@ -where("group_name", "like", "%" . $this->handelSpecialCharacter($value) . "%"); - } - } -} diff --git a/niucloud/addon/shop/app/model/goods/Rank.php b/niucloud/addon/shop/app/model/goods/Rank.php deleted file mode 100644 index c7db56ecb..000000000 --- a/niucloud/addon/shop/app/model/goods/Rank.php +++ /dev/null @@ -1,111 +0,0 @@ -where("name", "like", "%" . $this->handelSpecialCharacter($value) . "%"); - } - } - - /** - * 搜索器:排行榜名称 - * @param $value - * @param $data - */ - public function searchRankTypeAttr($query, $value, $data) - { - if ($value) { - $query->where("rank_type", '=', $value); - } - } - - /** - * 排行周期 - * @param $value - * @param $data - * @return mixed|string - */ - public function getRankTypeNameAttr($value, $data) - { - if (empty($data['rank_type'])) - { - return ''; - } - return RankDict::getRankType()[$data['rank_type']] ?? ''; - } - - /** - * 来源类型 - * @param $value - * @param $data - * @return mixed|string - */ - public function getGoodsSourceNameAttr($value, $data) - { - if (empty($data['goods_source'])) - { - return ''; - } - return RankDict::getGoodsSource()[$data['goods_source']] ?? ''; - } - - /** - * 排序规则 - * @param $value - * @param $data - * @return mixed|string - */ - public function getRuleTypeNameAttr($value, $data) - { - if (empty($data['rule_type'])) - { - return ''; - } - return RankDict::getRuleType()[$data['rule_type']] ?? ''; - } - -} diff --git a/niucloud/addon/shop/app/model/goods/Service.php b/niucloud/addon/shop/app/model/goods/Service.php deleted file mode 100644 index 2a31e6b2a..000000000 --- a/niucloud/addon/shop/app/model/goods/Service.php +++ /dev/null @@ -1,60 +0,0 @@ -where("service_id", $value); - } - } - - /** - * 搜索器:商品服务服务名称 - * @param $value - * @param $data - */ - public function searchServiceNameAttr($query, $value, $data) - { - if ($value != '') { - $query->where("service_name", "like", "%" . $this->handelSpecialCharacter($value) . "%"); - } - } - -} diff --git a/niucloud/addon/shop/app/model/goods/Stat.php b/niucloud/addon/shop/app/model/goods/Stat.php deleted file mode 100644 index 1c61ebd59..000000000 --- a/niucloud/addon/shop/app/model/goods/Stat.php +++ /dev/null @@ -1,63 +0,0 @@ - 'timestamp', - ]; - - /** - * 关联默认商品 - * @return \think\model\relation\HasOne - */ - public function goods() - { - return $this->hasOne(Goods::class, 'goods_id', 'goods_id'); - } - - /** - * 获取封面缩略图(小) - */ - public function getGoodsCoverThumbSmallAttr($value, $data) - { - if (isset($data[ 'goods_cover' ]) && $data[ 'goods_cover' ] != '') { - return get_thumb_images($data[ 'goods_cover' ], FileDict::SMALL); - } - return []; - } - -} diff --git a/niucloud/addon/shop/app/model/local_delivery/Local.php b/niucloud/addon/shop/app/model/local_delivery/Local.php deleted file mode 100644 index 2fd08a57a..000000000 --- a/niucloud/addon/shop/app/model/local_delivery/Local.php +++ /dev/null @@ -1,42 +0,0 @@ - 'json', - 'area' => 'json', - 'delivery_type' => 'json', - 'delivery_time' => 'json' - ]; -} diff --git a/niucloud/addon/shop/app/model/local_delivery/LocalDeliveryOrder.php b/niucloud/addon/shop/app/model/local_delivery/LocalDeliveryOrder.php deleted file mode 100644 index ec6126a20..000000000 --- a/niucloud/addon/shop/app/model/local_delivery/LocalDeliveryOrder.php +++ /dev/null @@ -1,161 +0,0 @@ - 'timestamp', - 'cancel_time' => 'timestamp' - ]; - - /** - * 搜索器:交易单号 - * @param $query - * @param $value - */ - public function searchTradeNoAttr($query, $value) - { - if ($value != '') { - $query->where('trade_no', 'like', '%' . $value . '%'); - } - } - - /** - * 搜索器:交易类型 - * @param $query - * @param $value - */ - public function searchTradeTypeAttr($query, $value) - { - if ($value != '') { - $query->where('trade_type', $value); - } - } - - /** - * 搜索器:配送单号 - * @param $query - * @param $value - */ - public function searchDeliveryNoAttr($query, $value) - { - if ($value != '') { - $query->where('delivery_no', 'like', '%' . $value . '%'); - } - } - - /** - * 搜索器:配送状态 - * @param $query - * @param $value - */ - public function searchStatusAttr($query, $value) - { - if ($value != '') { - $query->where('status', $value); - } - } - - /** - * 搜索器:创建时间 - * @param $query - * @param $value - * @param $data - */ - public function searchCreateTimeAttr($query, $value, $data) - { - $start_time = empty($value[0]) ? 0 : strtotime($value[0]); - $end_time = empty($value[1]) ? 0 : strtotime($value[1]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('create_time', $start_time, $end_time); - } elseif ($start_time > 0 && $end_time == 0) { - $query->where([['create_time', '>=', $start_time]]); - } elseif ($start_time == 0 && $end_time > 0) { - $query->where([['create_time', '<=', $end_time]]); - } - } - - /** - * 转化配送状态 - */ - public function getStatusNameAttr($value, $data) - { - if ($data['status'] == '') return ''; - return LocalDeliveryStatusDict::getStatus($data['status']); - } - - public function getPreStatusNameAttr($value, $data) - { - if (!empty($data['delivery_service'])) { - return LocalDeliveryPreStatusDict::getStatus($data['delivery_service']); - } - return ''; - } - - /** - * 转化配送服务商名称 - */ - public function getDeliveryServiceNameAttr($value, $data) - { - if (!empty($data['delivery_service'])) { - return LocalDeliveryDict::getType($data['delivery_service']); - } - return ''; - } - - /** - * 转化配送服务商名称 - */ -// public function getTradeTypeNameAttr($value, $data) -// { -// if (!empty($data['trade_type'])) { -// return TradeDict::getTradeType()[$data['trade_type']] ?? ''; -// } -// return ''; -// } - - /** - * 日志 - */ - public function orderLog() - { - return $this->hasMany(LocalDeliveryOrderLog::class, 'order_id', 'id')->append(['main_type_name']); - } -} diff --git a/niucloud/addon/shop/app/model/local_delivery/LocalDeliveryOrderLog.php b/niucloud/addon/shop/app/model/local_delivery/LocalDeliveryOrderLog.php deleted file mode 100644 index a0b343315..000000000 --- a/niucloud/addon/shop/app/model/local_delivery/LocalDeliveryOrderLog.php +++ /dev/null @@ -1,58 +0,0 @@ -hasOne(LocalDeliveryOrder::class, 'id', 'order_id'); - } -} diff --git a/niucloud/addon/shop/app/model/local_delivery/LocalDeliveryService.php b/niucloud/addon/shop/app/model/local_delivery/LocalDeliveryService.php deleted file mode 100644 index d2c1eb8de..000000000 --- a/niucloud/addon/shop/app/model/local_delivery/LocalDeliveryService.php +++ /dev/null @@ -1,53 +0,0 @@ -where('name', 'like', '%' . $value . '%'); - } - } -} diff --git a/niucloud/addon/shop/app/model/manjian/Manjian.php b/niucloud/addon/shop/app/model/manjian/Manjian.php deleted file mode 100644 index 2104e96bd..000000000 --- a/niucloud/addon/shop/app/model/manjian/Manjian.php +++ /dev/null @@ -1,136 +0,0 @@ - 'timestamp', - 'end_time' => 'timestamp', - ]; - - // 设置json类型字段 - protected $json = [ 'rule_json', 'goods_ids', 'level_ids', 'label_ids' ]; - - // 设置JSON数据返回数组 - protected $jsonAssoc = true; - - /** - * 活动商品项 - * @return \think\model\relation\HasMany - */ - public function activeGoods() - { - return $this->hasMany(ManjianGoods::class, 'manjian_id', 'manjian_id'); - } - - /** - * 活动状态 - * @param $value - * @param $data - * @return mixed|string - */ - public function getStatusNameAttr($value, $data) - { - return ManjianDict::getStatus()[ $data[ 'status' ] ] ?? ''; - } - - /** - * 参与商品 - * @param $value - * @param $data - * @return mixed|string - */ - public function getGoodsTypeNameAttr($value, $data) - { - if (empty($data[ 'goods_type' ])) { - return ''; - } - return ManjianDict::getGoodsType()[ $data[ 'goods_type' ] ] ?? ''; - } - - /** - * 搜索器:标题 - * @param $value - * @param $data - */ - public function searchManjianNameAttr($query, $value, $data) - { - if ($value != '') { - $query->where("manjian_name", 'like', '%' . $this->handelSpecialCharacter($value) . '%'); - } - } - - /** - * 搜索器:状态 - * @param $value - * @param $data - */ - public function searchStatusAttr($query, $value, $data) - { - if ($value != '') { - $query->where("status", '=', $value); - } - } - - /** - * 活动结束时间搜索器 - * @param Query $query - * @param $value - * @param $data - */ - public function searchCreateTimeAttr(Query $query, $value, $data) - { - $start_time = empty($value[ 0 ]) ? 0 : strtotime($value[ 0 ]); - $end_time = empty($value[ 1 ]) ? 0 : strtotime($value[ 1 ]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('end_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([ [ 'end_time', '>=', $start_time ] ]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([ [ 'end_time', '<=', $end_time ] ]); - } - } - - /** - * 搜索器:id - * @param $value - * @param $data - */ - public function searchActiveIdAttr($query, $value, $data) - { - if (!empty($value)) { - $query->where("manjian_id", 'in', $value); - } - } -} diff --git a/niucloud/addon/shop/app/model/manjian/ManjianGiveRecords.php b/niucloud/addon/shop/app/model/manjian/ManjianGiveRecords.php deleted file mode 100644 index b9aeb631f..000000000 --- a/niucloud/addon/shop/app/model/manjian/ManjianGiveRecords.php +++ /dev/null @@ -1,54 +0,0 @@ -hasOne(Order::class, 'order_id', 'order_id'); - } -} diff --git a/niucloud/addon/shop/app/model/manjian/ManjianGoods.php b/niucloud/addon/shop/app/model/manjian/ManjianGoods.php deleted file mode 100644 index 06f4f5607..000000000 --- a/niucloud/addon/shop/app/model/manjian/ManjianGoods.php +++ /dev/null @@ -1,77 +0,0 @@ -hasOne(Goods::class, 'goods_id', 'goods_id'); - } - - /** - * 关联默认商品规格 - * @return \think\model\relation\HasOne - */ - public function goodsSku() - { - return $this->hasOne(GoodsSku::class, 'goods_id', 'goods_id'); - } - - /** - * 关联默认商品规格 - * @return \think\model\relation\HasOne - */ - public function goodsSkuOne() - { - return $this->hasOne(GoodsSku::class, 'sku_id', 'sku_id'); - } - - /** - * 关联满减活动 - * @return \think\model\relation\HasOne - */ - public function manjian() - { - return $this->hasOne(Manjian::class, 'manjian_id', 'manjian_id'); - } -} diff --git a/niucloud/addon/shop/app/model/newcomer/NewcomerRecords.php b/niucloud/addon/shop/app/model/newcomer/NewcomerRecords.php deleted file mode 100644 index 2bc6e4e1f..000000000 --- a/niucloud/addon/shop/app/model/newcomer/NewcomerRecords.php +++ /dev/null @@ -1,43 +0,0 @@ - 'timestamp', - ]; - - /** - * 创建时间搜索器 - * @param Query $query - * @param $value - * @param $data - */ - public function searchCreateTimeAttr(Query $query, $value, $data) - { - $start_time = empty($value[ 0 ]) ? 0 : strtotime($value[ 0 ]); - $end_time = empty($value[ 1 ]) ? 0 : strtotime($value[ 1 ]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('create_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([ [ 'create_time', '>=', $start_time ] ]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([ [ 'create_time', '<=', $end_time ] ]); - } - } - - /** - * 开票时间 - * @param Query $query - * @param $value - * @param $data - * @return void - */ - public function searchInvoiceTimeAttr(Query $query, $value, $data) - { - $start_time = empty($value[ 0 ]) ? 0 : strtotime($value[ 0 ]); - $end_time = empty($value[ 1 ]) ? 0 : strtotime($value[ 1 ]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('invoice_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([ [ 'invoice_time', '>=', $start_time ] ]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([ [ 'invoice_time', '<=', $end_time ] ]); - } - } - - /** - * 是否已开票 - * @param Query $query - * @param $value - * @param $data - * @return void - */ - public function searchIsInvoiceAttr(Query $query, $value, $data) - { - if ($value != 'all') $query->where([ [ 'is_invoice', '=', $value ] ]); - } - - /** - * 通过抬头类型搜索 - * @param Query $query - * @param $value - * @param $data - * @return void - */ - public function searchHeaderTypeAttr(Query $query, $value, $data) - { - if ($value != 'all') $query->where([ [ 'header_type', '=', $value ] ]); - } - - /** - * 抬头内容 - * @param Query $query - * @param $value - * @param $data - * @return void - */ - public function searchHeaderNameAttr(Query $query, $value, $data) - { - if ($value != '') $query->where([ [ 'header_name', 'like', "%" . $this->handelSpecialCharacter($value) . "%" ] ]); - } - - /** - * @param $value - * @param $data - * @return mixed|string - */ - public function getHeaderTypeNameAttr($value, $data) - { - return InvoiceDict::getHeaderType()[ $data[ 'header_type' ] ] ?? ''; - } - - public function getTypeNameAttr($value, $data) - { - return InvoiceDict::getType()[ $data[ 'type' ] ] ?? ''; - } - - /** - * 获取开票状态 - * @param $value - * @param $data - * @return mixed|string - */ - public function getIsInvoiceNameAttr($value, $data) - { - return InvoiceDict::getIsInvoice()[ $data[ 'is_invoice' ] ] ?? ''; - } - /** - * 获取开票状态 - * @param $value - * @param $data - * @return mixed|string - */ - public function getInvoiceTypeNameAttr($value, $data) - { - return InvoiceDict::getIsInvoice()[ $data[ 'is_invoice' ] ] ?? ''; - } - - /** - * 开票会员 - * @return HasOne - */ - public function member() - { - return $this->hasOne(Member::class, 'member_id', 'member_id'); - } - - /** - * 开票订单 - * @return HasOne - */ - public function shopOrder() - { - return $this->hasOne(Order::class, 'order_id', 'trade_id'); - } - - /** - * 开票订单 - * @return \think\model\relation\HasMany - */ - public function orderList() - { - return $this->hasMany(Order::class, 'invoice_id', 'id'); - } - - /** - * 获取商品图片缩略图(小) - */ - public function getPayVoucherThumbSmallAttr($value, $data) - { - if (isset($data[ 'pay_voucher' ]) && $data[ 'pay_voucher' ] != '') { - $pay_voucher = explode(',', $data[ 'pay_voucher' ]); - $img_arr = []; - foreach ($pay_voucher as $k => $v) { - $img = get_thumb_images($v, FileDict::SMALL); - if (!empty($img)) { - $img_arr[] = $img; - } - } - return $img_arr; - } - return []; - } - - /** - * 获取商品图片缩略图(中) - */ - public function getPayVoucherThumbMidAttr($value, $data) - { - if (isset($data[ 'pay_voucher' ]) && $data[ 'pay_voucher' ] != '') { - $pay_voucher = explode(',', $data[ 'pay_voucher' ]); - $img_arr = []; - foreach ($pay_voucher as $k => $v) { - $img = get_thumb_images($v, FileDict::MID); - if (!empty($img)) { - $img_arr[] = $img; - } - } - return $img_arr; - } - return []; - } - - /** - * 获取商品图片缩略图(大) - */ - public function getPayVoucherThumbBigAttr($value, $data) - { - if (isset($data[ 'pay_voucher' ]) && $data[ 'pay_voucher' ] != '') { - $pay_voucher = explode(',', $data[ 'pay_voucher' ]); - $img_arr = []; - foreach ($pay_voucher as $k => $v) { - $img = get_thumb_images($v, FileDict::BIG); - if (!empty($img)) { - $img_arr[] = $img; - } - } - return $img_arr; - } - return []; - } - - /** - * 获取封面缩略图(小) - */ - public function getInvoiceVoucherThumbSmallAttr($value, $data) - { - if (isset($data[ 'invoice_voucher' ]) && $data[ 'invoice_voucher' ] != '') { - return get_thumb_images($data[ 'invoice_voucher' ], FileDict::SMALL); - } - return []; - } - - /** - * 获取封面缩略图(中) - */ - public function getInvoiceVoucherThumbMidAttr($value, $data) - { - if (isset($data[ 'invoice_voucher' ]) && $data[ 'invoice_voucher' ] != '') { - return get_thumb_images($data[ 'invoice_voucher' ], FileDict::MID); - } - return []; - } - - /** - * 获取封面缩略图(大) - */ - public function getInvoiceVoucherThumbBigAttr($value, $data) - { - if (isset($data[ 'invoice_voucher' ]) && $data[ 'invoice_voucher' ] != '') { - return get_thumb_images($data[ 'invoice_voucher' ], FileDict::BIG); - } - return []; - } -} diff --git a/niucloud/addon/shop/app/model/order/Order.php b/niucloud/addon/shop/app/model/order/Order.php deleted file mode 100644 index 00f2c6a96..000000000 --- a/niucloud/addon/shop/app/model/order/Order.php +++ /dev/null @@ -1,374 +0,0 @@ - 'timestamp', - 'close_time' => 'timestamp', - - 'delivery_time' => 'timestamp', - 'take_time' => 'timestamp', - 'finish_time' => 'timestamp', - ]; - - // 设置json类型字段 - protected $json = [ 'has_goods_types' ]; - - // 设置JSON数据返回数组 - protected $jsonAssoc = true; - - /** - * 定义软删除标记字段. - * @var string - */ - protected $deleteTime = 'delete_time'; - - protected $defaultSoftDelete = 0; - - /** - * 订单项 - * @return HasMany - */ - public function orderGoods() - { - return $this->hasMany(OrderGoods::class, 'order_id', 'order_id'); - } - - /** - * 订单会员 - * @return HasOne - */ - public function member() - { - return $this->hasOne(Member::class, 'member_id', 'member_id'); - } - - /** - * 支付 - * @return HasOne - */ - public function pay() - { - return $this->hasOne(Pay::class, 'out_trade_no', 'out_trade_no'); - } - - /** - * 日志 - */ - public function orderLog() - { - return $this->hasMany(OrderLog::class, 'order_id', 'order_id'); - } - - /** - * 自提点 - * @return HasOne - */ - public function store() - { - return $this->hasOne(Store::class, 'store_id', 'take_store_id'); - } - - /** - * 包裹 - * @return hasMany - */ - public function orderDelivery() - { - return $this->hasMany(OrderDelivery::class, 'order_id', 'order_id'); - } - - /** - * 优惠表 - * @return HasOne - */ - public function shopOrderDiscount() - { - return $this->hasOne(OrderDiscounts::class, 'order_id', 'order_id'); - } - - /** - * 优惠表 - * @return hasMany - */ - public function orderDiscount() - { - return $this->hasMany(OrderDiscounts::class, 'order_id', 'order_id'); - } - - /** - * 发票 - * @return HasOne - */ - public function invoice() - { - return $this->hasOne(Invoice::class, 'id', 'invoice_id'); - } - - /** - * 来源渠道 - * @param $value - * @param $data - * @return mixed|string|void - */ - public function getOrderFromNameAttr($value, $data) - { - if (empty($data[ 'order_from' ])) - return ''; - $order_from_list = ChannelDict::getType(); - $from_event_list = array_filter(event('OrderFromList')) ?? []; - foreach ($from_event_list as $item) { - $order_from_list = array_merge($order_from_list, $item); - } - return $order_from_list[ $data[ 'order_from' ] ] ?? ''; - } - - /** - * 订单类型 - * @param $value - * @param $data - * @return mixed|string - */ - public function getOrderTypeNameAttr($value, $data) - { - if (empty($data[ 'order_type' ])) - return ''; -// return OrderDict::getOrderType($data['order_type']) ?? ''; - } - /** - * 订单类型 - * @param $value - * @param $data - * @return mixed|string - */ - public function getActivityTypeNameAttr($value, $data) - { - return OrderDict::getOrderActiveTypeName($data['activity_type']); - } - - /** - * 订单状态 - * @param $value - * @param $data - * @return mixed|string - */ - public function getStatusNameAttr($value, $data) - { - if (empty($data[ 'status' ])) - return ''; - return OrderDict::getStatus($data[ 'status' ],$data['delivery_type'])?? ''; - } - - /** - * 配送方式 - * @param $value - * @param $data - * @return mixed|string - */ - public function getDeliveryTypeNameAttr($value, $data) - { - if (empty($data[ 'delivery_type' ])) - return ''; - return OrderDeliveryDict::getType()[ $data[ 'delivery_type' ] ] ?? ''; - } - - /** - * 搜索器:订单编号 - * @param $value - * @param $data - */ - public function searchOrderNoAttr($query, $value, $data) - { - if ($value != '') { - $query->where("order_no", "like", "%$value%"); - } - } - - /** - * 搜索器:订单内容 - * @param $value - * @param $data - */ - public function searchBodyAttr($query, $value, $data) - { - if ($value != '') { - $query->where("body", "like", "%$value%"); - } - } - - /** - * 搜索器:订单状态 - * @param $value - * @param $data - */ - public function searchStatusAttr($query, $value, $data) - { - if ($value) { - $query->where("status", $value); - } - } - - - /** - * 搜索器:营销类型 - * @param $value - * @param $data - */ - public function searchActivityTypeAttr($query, $value, $data) - { - if ($value) { - $query->where("activity_type", $value); - } - } - - - /** - * 连表搜索器 - * @param $query - * @param $value - * @param $data - */ - public function searchJoinStatusAttr($query, $value, $data) - { - if ($data[ 'status' ]) { - $query->where("order.status", $data[ 'status' ]); - } - } - - /** - * 支付时间搜索器 - * @param Query $query - * @param $value - * @param $data - */ - public function searchPayTimeAttr(Query $query, $value, $data) - { - $start_time = empty($value[ 0 ]) ? 0 : strtotime($value[ 0 ]); - $end_time = empty($value[ 1 ]) ? 0 : strtotime($value[ 1 ]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('pay_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([ [ 'pay_time', '>=', $start_time ] ]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([ [ 'pay_time', '<=', $end_time ] ]); - } - } - - /** - * 支付时间搜索器 - * @param Query $query - * @param $value - * @param $data - */ - public function searchJoinPayTimeAttr(Query $query, $value, $data) - { - $start_time = empty($data[ 'pay_time' ][ 0 ]) ? 0 : strtotime($data[ 'pay_time' ][ 0 ]); - $end_time = empty($data[ 'pay_time' ][ 1 ]) ? 0 : strtotime($data[ 'pay_time' ][ 1 ]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('order.pay_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([ [ 'order.pay_time', '>=', $start_time ] ]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([ [ 'order.pay_time', '<=', $end_time ] ]); - } - } - - /** - * 创建时间搜索器 - * @param Query $query - * @param $value - * @param $data - */ - public function searchCreateTimeAttr(Query $query, $value, $data) - { - $start_time = empty($value[ 0 ]) ? 0 : strtotime($value[ 0 ]); - $end_time = empty($value[ 1 ]) ? 0 : strtotime($value[ 1 ]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('order.create_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([ [ 'order.create_time', '>=', $start_time ] ]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([ [ 'order.create_time', '<=', $end_time ] ]); - } - } - - /** - * 搜索器:订单状态 - * @param $value - * @param $data - */ - public function searchSearchTypeAttr($query, $value, $data) - { - if ($value && isset($data[ 'search_name' ]) && $data[ 'search_name' ] != '') { - $search_name = $this->handelSpecialCharacter($data[ 'search_name' ]); - if ($value == 'order_no') $query->where("order_no", "like", "%$search_name%"); - if ($value == 'out_trade_no') $query->where("order.out_trade_no", "like", "%$search_name%"); - if ($value == 'goods_name') $query->where("order.body", "like", "%$search_name%"); - } - } - - /** - * 搜索器:订单状态 - * @param $value - * @param $data - */ - public function searchOrderFromAttr($query, $value, $data) - { - if ($value) { - $query->where("order_from", $value); - } - } - - /** - * 搜索器:收货人|收货人手机号 - * @param $value - * @param $data - */ - public function searchKeywordAttr($query, $value, $data) - { - if ($value != '') { - $query->whereLike("taker_name|taker_mobile", "%" . $this->handelSpecialCharacter($value) . "%"); - } - } -} diff --git a/niucloud/addon/shop/app/model/order/OrderBatchDelivery.php b/niucloud/addon/shop/app/model/order/OrderBatchDelivery.php deleted file mode 100644 index 36938bdf8..000000000 --- a/niucloud/addon/shop/app/model/order/OrderBatchDelivery.php +++ /dev/null @@ -1,137 +0,0 @@ - 'timestamp', - ]; - // 设置json类型字段 - protected $json = [ 'data' ]; - - // 设置JSON数据返回数组 - protected $jsonAssoc = true; - - /** - * 管理员 - * @return \think\model\relation\HasOne - */ - public function user() - { - return $this->hasOne(SysUser::class, 'uid', 'main_id'); - } - - /** - * 状态 - * @param $value - * @param $data - * @return string - */ - public function getStatusNameAttr($value, $data) - { - if (empty($data[ 'status' ])) return ''; - return OrderBatchDeliveryDict::getStatus()[ $data[ 'status' ] ] ?? ''; - } - - /** - * 操作类型 - * @return mixed|string - */ - public function getTypeNameAttr($value, $data) - { - if (empty($data[ 'type' ])) - return ''; - return OrderBatchDeliveryDict::getType()[ $data[ 'type' ] ] ?? ''; - } - - - /** - * 退款状态搜索 - * @param $query - * @param $value - * @param $data - */ - public function searchStatusAttr($query, $value, $data) - { - if ($value) { - $query->where("status", $value); - } - } - - /** - * 类型搜索 - * @param $query - * @param $value - * @param $data - */ - public function searchTypeAttr($query, $value, $data) - { - if ($value) { - $query->where("type", $value); - } - } - - /** - * 操作人搜索 - * @param $query - * @param $value - * @param $data - */ - public function searchMainIdAttr($query, $value, $data) - { - if ($value) { - $query->where("main_id", $value); - } - } - - /** - * 创建时间搜索器 - * @param $query - * @param $value - * @param $data - */ - public function searchCreateTimeAttr($query, $value, $data) - { - $start_time = empty($value[ 0 ]) ? 0 : strtotime($value[ 0 ]); - $end_time = empty($value[ 1 ]) ? 0 : strtotime($value[ 1 ]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('create_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([ [ 'create_time', '>=', $start_time ] ]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([ [ 'create_time', '<=', $end_time ] ]); - } - } - -} diff --git a/niucloud/addon/shop/app/model/order/OrderDelivery.php b/niucloud/addon/shop/app/model/order/OrderDelivery.php deleted file mode 100644 index ec6baf000..000000000 --- a/niucloud/addon/shop/app/model/order/OrderDelivery.php +++ /dev/null @@ -1,65 +0,0 @@ -hasOne(Company::class, 'company_id', 'express_company_id'); - } - - public function getExpressCompanyNameAttr($value, $data) - { - return (new Company())->find($data['express_company_id'])->company_name ?? ''; - } - - public function orderGoods() - { - return $this->hasMany(OrderGoods::class, 'delivery_id', 'id'); - } - public function getThirdDeliveryNameAttr($value, $data) - { - return DeliveryLocalDict::getType($data['third_delivery'])['name'] ?? ""; - } - - public function localDeliveryOrder() - { - return $this->hasOne(LocalDeliveryOrder::class, 'delivery_no', 'local_delivery_order_id')->append(['status_name','delivery_service_name'])->bind(['local_delivery_status' => 'status','local_delivery_status_name' => 'status_name','delivery_service','delivery_service_name','rider_name','rider_mobile']); - } -} diff --git a/niucloud/addon/shop/app/model/order/OrderDiscounts.php b/niucloud/addon/shop/app/model/order/OrderDiscounts.php deleted file mode 100644 index b3c3d6f97..000000000 --- a/niucloud/addon/shop/app/model/order/OrderDiscounts.php +++ /dev/null @@ -1,47 +0,0 @@ -hasOne(Order::class, 'order_id', 'order_id'); - } - -} diff --git a/niucloud/addon/shop/app/model/order/OrderGoods.php b/niucloud/addon/shop/app/model/order/OrderGoods.php deleted file mode 100644 index 6c4910316..000000000 --- a/niucloud/addon/shop/app/model/order/OrderGoods.php +++ /dev/null @@ -1,220 +0,0 @@ - 'timestamp', - ]; - - - // 设置json类型字段 - protected $json = ['extend']; - - // 设置JSON数据返回数组 - protected $jsonAssoc = true; - - /** - * 定义软删除标记字段. - * @var string - */ - protected $deleteTime = 'delete_time'; - - protected $defaultSoftDelete = 0; - - /** - * 包裹 - * @return HasOne - */ - public function orderDelivery() - { - return $this->hasOne(OrderDelivery::class, 'id', 'delivery_id'); - } - - /** - * 商品 - * @return HasOne - */ - public function goods() - { - return $this->hasOne(Goods::class, 'goods_id', 'goods_id'); - } - /** - * 商品 - * @return HasOne - */ - public function sku() - { - return $this->hasOne(GoodsSku::class, 'sku_id', 'sku_id'); - } - - /** - * 订单主表 - * @return BaseModel|HasOne - */ - public function orderMain() - { - return $this->hasOne(Order::class, 'order_id', 'order_id'); - } - - /** - * 会员 - * @return HasOne - */ - public function member() - { - return $this->hasOne(Member::class, 'member_id', 'member_id'); - } /** - * 会员 - * @return HasOne - */ - public function deliveryInfo() - { - return $this->hasOne(OrderDelivery::class, 'id', 'delivery_id')->append(['express_company_name']); - } - - /** - * 缩略图生成-大图 - * @param $value - * @param $data - * @return array|mixed - * @throws Exception - */ - public function getGoodsImageThumbBigAttr($value, $data) - { - if (!empty($data['goods_image'])) { - return get_thumb_images($data['goods_image'], FileDict::BIG); - } - return ''; - } - - /** - * 缩略图生成-中图 - * @param $value - * @param $data - * @return array|mixed - * @throws Exception - */ - public function getGoodsImageThumbMidAttr($value, $data) - { - if (!empty($data['goods_image'])) { - return get_thumb_images($data['goods_image'], FileDict::MID); - } - return ''; - } - - /** - * 缩略图生成-小图 - * @param $value - * @param $data - * @return array|mixed - * @throws Exception - */ - public function getGoodsImageThumbSmallAttr($value, $data) - { - if (!empty($data['goods_image'])) { - return get_thumb_images($data['goods_image'], FileDict::SMALL); - } - return ''; - } - - /** - * 缩略图生成-中图 - * @param $value - * @param $data - * @return array|mixed - * @throws Exception - */ - public function getSkuImageThumbMidAttr($value, $data) - { - if (!empty($data['sku_image'])) { - return get_thumb_images($data['sku_image'], FileDict::MID); - } - return ''; - } - - /** - * 转化发货状态 - */ - public function getDeliveryStatusNameAttr($value, $data) - { - if (!empty($data['delivery_status'])) { - return OrderDeliveryDict::getStatus($data['delivery_status']); - } - return ''; - } - - /** - * 转化订单项状态 - */ - public function getStatusNameAttr($value, $data) - { - if (!empty($data['status'])) { - return OrderGoodsDict::getRefundStatus($data['status']); - } - return ''; - } - - /** - * 转化订单项商品类型 - */ - public function getGoodsTypeNameAttr($value, $data) - { - if (!empty($data['goods_type'])) { - return GoodsDict::getType($data['goods_type'])['name']; - } - return ''; - } - - public function getImpulseBuyInfoAttr($value, $data) - { - if(!empty($data['extend']) && isset($data['extend']['is_impulse_buy']) && $data['extend']['is_impulse_buy'] == 1){ - $impulse_buy_price = $data['extend']['impulse_buy_price']/$data['extend']['impulse_buy_goods_num']; - $is_impulse_buy = 1; - } - return [ - 'is_impulse_buy'=>$is_impulse_buy ?? 0 , - 'impulse_buy_price'=>$impulse_buy_price ?? 0 , - ]; - } - -} diff --git a/niucloud/addon/shop/app/model/order/OrderLog.php b/niucloud/addon/shop/app/model/order/OrderLog.php deleted file mode 100644 index 3427d9696..000000000 --- a/niucloud/addon/shop/app/model/order/OrderLog.php +++ /dev/null @@ -1,84 +0,0 @@ - 'timestamp' - ]; - - /** - * 来源渠道 - * @param $value - * @param $data - * @return mixed|string|void - */ - public function getMainTypeNameAttr($value, $data) - { - if (empty($data[ 'main_type' ])) - return ''; - return OrderLogDict::getMainType() [ $data[ 'main_type' ] ] ?? ''; - } - - /** - * 操作类型转换 - * @param $value - * @param $data - * @return mixed|string|void - */ - public function getTypeNameAttr($value, $data) - { - if (empty($data[ 'type' ])) - return ''; - return OrderDict::getActionType() [ $data[ 'type' ] ] ?? ''; - } - - /** - * 获取操作人 - * @param $value - * @param $data - */ - public function getMainNameAttr($value, $data) - { - $main_name = ''; - if (!empty($data[ 'main_type' ]) && !empty($data[ 'main_id' ])) { - if ($data[ 'main_type' ] == OrderLogDict::MEMBER) $main_name = ( Member::find([ 'member_id' => $data[ 'main_id' ] ]) )->nickname; - if ($data[ 'main_type' ] == OrderLogDict::STORE) $main_name = ( SysUser::find([ 'uid' => $data[ 'main_id' ] ]) )->username; - } - return $main_name; - } -} diff --git a/niucloud/addon/shop/app/model/order/OrderRefund.php b/niucloud/addon/shop/app/model/order/OrderRefund.php deleted file mode 100644 index 572e8bfdc..000000000 --- a/niucloud/addon/shop/app/model/order/OrderRefund.php +++ /dev/null @@ -1,172 +0,0 @@ - 'timestamp', - ]; - - // 设置json类型字段 - protected $json = ['delivery', 'voucher', 'refund_address']; - - // 设置JSON数据返回数组 - protected $jsonAssoc = true; - - /** - * 定义软删除标记字段. - * @var string - */ - protected $deleteTime = 'delete_time'; - - protected $defaultSoftDelete = 0; - - /** - * 关联订单项 - * @return HasOne - */ - public function orderGoods() - { - return $this->hasOne(OrderGoods::class, 'order_goods_id', 'order_goods_id'); - } - - /** - * 订单主表 - * @return BaseModel|HasOne - */ - public function orderMain() - { - return $this->hasOne(Order::class, 'order_id', 'order_id'); - } - - /** - * 关联退款日志表 - * @return \think\model\relation\HasMany - */ - public function refundLog() - { - return $this->hasMany(OrderRefundLog::class, 'order_refund_no', 'order_refund_no'); - } - - /** - * 关联会员表 - */ - public function member() - { - return $this->hasOne(Member::class, 'member_id', 'member_id'); - } - - /** - * 关联退款表 - */ - public function payRefund() - { - return $this->hasOne(Refund::class, 'refund_no', 'refund_no'); - } - - /** - * 获取退款状态 - * @param $value - * @param $data - * @return array|mixed|string - */ - public function getStatusNameAttr($value, $data) - { - if ($data['status']) { - return OrderRefundDict::getRefundStatus($data['status']); - } - } - - /** - * 退款类型 - * @param $value - * @param $data - * @return array|mixed|string - */ - public function getRefundTypeNameAttr($value, $data) - { - if ($data['refund_type']) { - return OrderRefundDict::getRefundType($data['refund_type']); - } - } - - /** - * 退款编号搜索 - * @param $query - * @param $value - * @param $data - */ - public function searchOrderRefundNoAttr($query, $value, $data) - { - if ($value != '') { - $query->where("order_refund_no", "like", "%" . $this->handelSpecialCharacter($value) . "%"); - } - } - - /** - * 退款状态搜索 - * @param $query - * @param $value - * @param $data - */ - public function searchStatusAttr($query, $value, $data) - { - if ($value) { - $query->where("status", $value); - } - } - - /** - * 创建时间搜索器 - * @param $query - * @param $value - * @param $data - */ - public function searchCreateTimeAttr($query, $value, $data) - { - $start_time = empty($value[0]) ? 0 : strtotime($value[0]); - $end_time = empty($value[1]) ? 0 : strtotime($value[1]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('create_time', $start_time, $end_time); - } else if ($start_time > 0 && $end_time == 0) { - $query->where([['create_time', '>=', $start_time]]); - } else if ($start_time == 0 && $end_time > 0) { - $query->where([['create_time', '<=', $end_time]]); - } - } -} diff --git a/niucloud/addon/shop/app/model/order/OrderRefundLog.php b/niucloud/addon/shop/app/model/order/OrderRefundLog.php deleted file mode 100644 index ec7d032ac..000000000 --- a/niucloud/addon/shop/app/model/order/OrderRefundLog.php +++ /dev/null @@ -1,82 +0,0 @@ - $data[ 'main_id' ] ]) )->nickname; - if ($data[ 'main_type' ] == OrderRefundLogDict::STORE) $main_name = ( SysUser::find([ 'uid' => $data[ 'main_id' ] ]) )->username; - } - return $main_name; - } - -} diff --git a/niucloud/addon/shop/app/model/shop_address/ShopAddress.php b/niucloud/addon/shop/app/model/shop_address/ShopAddress.php deleted file mode 100644 index ca510a870..000000000 --- a/niucloud/addon/shop/app/model/shop_address/ShopAddress.php +++ /dev/null @@ -1,60 +0,0 @@ -where("mobile", "like", "%" . $this->handelSpecialCharacter($value) . "%"); - } - } - - /** - * 搜索器:商家地址库地址 - * @param $value - * @param $data - */ - public function searchFullAddressAttr($query, $value, $data) - { - if ($value != '') { - $query->where("full_address", "like", "%" . $this->handelSpecialCharacter($value) . "%"); - } - } - -} diff --git a/niucloud/addon/shop/app/model/shop_delivery/Deliver.php b/niucloud/addon/shop/app/model/shop_delivery/Deliver.php deleted file mode 100644 index 4c53bd6bd..000000000 --- a/niucloud/addon/shop/app/model/shop_delivery/Deliver.php +++ /dev/null @@ -1,63 +0,0 @@ -where("deliver_name", 'like', '%' . $value . '%'); - } - } - - /** - * 搜索器:配送员手机号 - * @param $value - * @param $data - */ - public function searchDeliverMobileAttr($query, $value) - { - if ($value != '') { - $query->where("deliver_mobile", 'like', '%' . $value . '%'); - - } - } -} diff --git a/niucloud/addon/shop/app/model/shop_delivery/ShopDeliveryOrder.php b/niucloud/addon/shop/app/model/shop_delivery/ShopDeliveryOrder.php deleted file mode 100644 index ca3b50013..000000000 --- a/niucloud/addon/shop/app/model/shop_delivery/ShopDeliveryOrder.php +++ /dev/null @@ -1,146 +0,0 @@ - 'timestamp', - 'cancel_time' => 'timestamp' - ]; - - /** - * 搜索器:交易单号 - * @param $query - * @param $value - */ - public function searchTradeNoAttr($query, $value) - { - if ($value != '') { - $query->where('trade_no', 'like', '%' . $value . '%'); - } - } - - /** - * 搜索器:交易类型 - * @param $query - * @param $value - */ - public function searchTradeTypeAttr($query, $value) - { - if ($value != '') { - $query->where('trade_type', $value); - } - } - - /** - * 搜索器:配送单号 - * @param $query - * @param $value - */ - public function searchDeliveryNoAttr($query, $value) - { - if ($value != '') { - $query->where('delivery_no', 'like', '%' . $value . '%'); - } - } - - /** - * 搜索器:配送状态 - * @param $query - * @param $value - */ - public function searchStatusAttr($query, $value) - { - if ($value != '') { - $query->where('status', $value); - } - } - - /** - * 搜索器:创建时间 - * @param $query - * @param $value - * @param $data - */ - public function searchCreateTimeAttr($query, $value, $data) - { - $start_time = empty($value[0]) ? 0 : strtotime($value[0]); - $end_time = empty($value[1]) ? 0 : strtotime($value[1]); - if ($start_time > 0 && $end_time > 0) { - $query->whereBetweenTime('create_time', $start_time, $end_time); - } elseif ($start_time > 0 && $end_time == 0) { - $query->where([['create_time', '>=', $start_time]]); - } elseif ($start_time == 0 && $end_time > 0) { - $query->where([['create_time', '<=', $end_time]]); - } - } - - /** - * 转化配送状态 - */ - public function getStatusNameAttr($value, $data) - { - if (!empty($data['status'])) { - return LocalDeliveryStatusDict::getStatus($data['status']); - } - return ''; - } - - public function getPreStatusNameAttr($value, $data) - { - return LocalDeliveryPreStatusDict::getStatus(ShopDeliveryDict::MERCHANT); - } - - /** - * 关联配送员 - * @return HasOne - */ - public function deliver() - { - return $this->hasOne(Deliver::class, 'deliver_id', 'deliver_id'); - } - - /** - * 日志 - */ - public function orderLog() - { - return $this->hasMany(ShopDeliveryOrderLog::class, 'order_id', 'id')->append(['main_type_name']); - } -} diff --git a/niucloud/addon/shop/app/model/shop_delivery/ShopDeliveryOrderLog.php b/niucloud/addon/shop/app/model/shop_delivery/ShopDeliveryOrderLog.php deleted file mode 100644 index 958067644..000000000 --- a/niucloud/addon/shop/app/model/shop_delivery/ShopDeliveryOrderLog.php +++ /dev/null @@ -1,58 +0,0 @@ -hasOne(ShopDeliveryOrder::class, 'id', 'order_id'); - } -} diff --git a/niucloud/addon/shop/app/service/admin/StatService.php b/niucloud/addon/shop/app/service/admin/StatService.php deleted file mode 100644 index 9c7e1dacd..000000000 --- a/niucloud/addon/shop/app/service/admin/StatService.php +++ /dev/null @@ -1,56 +0,0 @@ -getStat($start_date, $end_date); - } - - /** - * 获取区间统计数据 - * @param string $start_date - * @param string $end_date - * @return array|null - */ - public function getStatData(string $start_date, string $end_date) - { - return ( new CoreStatService() )->getStatData($start_date, $end_date); - } - - /** - * 获取某天统计数据 - * @param string $start_date - * @param string $end_date - * @return array|null - */ - public function getHourStatData(string $date) - { - return ( new CoreStatService() )->getHourStatData($date); - } -} diff --git a/niucloud/addon/shop/app/service/admin/delivery/CompanyService.php b/niucloud/addon/shop/app/service/admin/delivery/CompanyService.php deleted file mode 100644 index 412b54b2b..000000000 --- a/niucloud/addon/shop/app/service/admin/delivery/CompanyService.php +++ /dev/null @@ -1,108 +0,0 @@ -model = new Company(); - } - - /** - * 获取物流公司分页列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'company_id,company_name,logo,url,express_no,express_no_electronic_sheet,electronic_sheet_switch,print_style,exp_type,create_time,kd100_express_no'; - $order = 'create_time desc'; - - $search_model = $this->model->where([ [ 'company_id', '>', 0 ] ])->withSearch([ "company_name", 'electronic_sheet_switch' ], $where)->field($field)->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取物流公司列表 - * @param array $where - * @param string $field - * @return array - */ - public function getList(array $where = [], $field = 'company_id,company_name,logo,url,express_no,express_no_electronic_sheet,electronic_sheet_switch,print_style,exp_type,create_time') - { - $order = 'create_time desc'; - - return $this->model->where([ [ 'company_id', '>', 0 ] ])->withSearch([ "company_name", 'electronic_sheet_switch' ], $where)->field($field)->order($order)->select()->toArray(); - } - - /** - * 获取物流公司信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'company_id,company_name,logo,url,express_no,express_no_electronic_sheet,electronic_sheet_switch,print_style,exp_type,create_time,kd100_express_no'; - - $info = $this->model->field($field)->where([ [ 'company_id', '=', $id ] ])->findOrEmpty()->toArray(); - return $info; - } - - /** - * 添加物流公司 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $data[ 'create_time' ] = time(); - $res = $this->model->create($data); - return $res->company_id; - } - - /** - * 物流公司编辑 - * @param int $id - * @param array $data - * @return bool - */ - public function edit(int $id, array $data) - { - $data[ 'update_time' ] = time(); - $this->model->where([ [ 'company_id', '=', $id ] ])->update($data); - return true; - } - - /** - * 删除物流公司 - * @param int $id - * @return bool - */ - public function del(int $id) - { - $res = $this->model->where([ [ 'company_id', '=', $id ] ])->delete(); - return $res; - } - -} diff --git a/niucloud/addon/shop/app/service/admin/delivery/DeliverySearchConfigService.php b/niucloud/addon/shop/app/service/admin/delivery/DeliverySearchConfigService.php deleted file mode 100644 index b17825e4f..000000000 --- a/niucloud/addon/shop/app/service/admin/delivery/DeliverySearchConfigService.php +++ /dev/null @@ -1,44 +0,0 @@ -setDeliverySearchConfig($data); - } - - /** - * 获取物流跟踪查询配置 - * @return array - */ - public function getConfig() - { - return $info = ( new CoreConfigService() )->getDeliverySearchConfig(); - } -} diff --git a/niucloud/addon/shop/app/service/admin/delivery/DeliveryService.php b/niucloud/addon/shop/app/service/admin/delivery/DeliveryService.php deleted file mode 100644 index dfdb26ed9..000000000 --- a/niucloud/addon/shop/app/service/admin/delivery/DeliveryService.php +++ /dev/null @@ -1,61 +0,0 @@ -core_delivery_config_service = new CoreDeliveryService(); - } - - /** - * 设置名称 - * @param $key - * @param $data - * @return array|true - */ - public function setConfig($data) - { - return $this->core_delivery_config_service->setConfig('SHOP_DELIVERY_CONFIG', $data); - } - - /** - * 获取配置信息 - */ - public function getDeliveryConfigList() - { - return $this->core_delivery_config_service->getDeliveryList(); - } - - /** - * 获取配置信息 - */ - public function getDeliveryList() - { - return $this->core_delivery_config_service->getDeliveryConfig(); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/delivery/ElectronicSheetService.php b/niucloud/addon/shop/app/service/admin/delivery/ElectronicSheetService.php deleted file mode 100644 index 3981cc92d..000000000 --- a/niucloud/addon/shop/app/service/admin/delivery/ElectronicSheetService.php +++ /dev/null @@ -1,234 +0,0 @@ -model = new ElectronicSheet(); - } - - /** - * 获取电子面单分页列表 - * @param array $where - * @param string $field - * @return array - * @throws \think\db\exception\DbException - */ - public function getPage(array $where = [], $field = 'id,template_name,express_company_id,customer_name,customer_pwd,send_site,send_staff,month_code,pay_type,is_notice,status,exp_type,print_style,is_default,create_time') - { - $order = 'is_default desc,create_time desc'; - - $search_model = $this->model->where([ [ 'electronic_sheet.id', '>', 0 ] ]) - ->withSearch([ 'id', 'template_name', 'express_company_id', 'pay_type', 'is_notice', 'status', 'is_default' ], $where) - ->field($field) - ->withJoin([ - 'company' => [ 'company_name', 'express_no_electronic_sheet' ] - ]) - ->order($order)->append([ 'pay_type_name' ]); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取电子面单列表 - * @param array $where - * @param array $field - * @return array - */ - public function getList(array $where = [], $field = 'id,template_name,express_company_id,customer_name,customer_pwd,send_site,send_staff,month_code,pay_type,is_notice,status,exp_type,print_style,is_default,create_time') - { - $order = 'is_default desc,create_time desc'; - return $this->model->where([ [ 'id', '>', 0 ] ])->withSearch([ 'id', 'template_name', 'express_company_id', 'pay_type', 'is_notice', 'status', 'is_default' ], $where)->field($field)->order($order)->select()->toArray(); - } - - /** - * 获取电子面单信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'id,template_name,express_company_id,customer_name,customer_pwd,send_site,send_staff,month_code,pay_type,is_notice,status,exp_type,print_style,is_default'; - - $info = $this->model->field($field)->where([ [ 'id', '=', $id ] ])->findOrEmpty()->toArray(); - return $info; - } - - /** - * 添加电子面单 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - // 将同类型页面的默认值改为0,默认页面只有一个 - if (!empty($data[ 'is_default' ])) { - $this->model->where([ [ 'id', '>', 0 ] ])->update([ 'is_default' => 0 ]); - } - - $interface_data = [ - 'kdbird'=>[ - 'customer_name'=>$data['customer_pwd'], - 'customer_pwd'=>$data['customer_pwd'], - 'send_site'=>$data['send_site'], - 'send_staff'=>$data['send_staff'], - 'month_code'=>$data['month_code'], - 'pay_type'=>$data['pay_type'], - 'is_notice'=>$data['is_notice'], - 'print_style'=>$data['print_style'] - ], -// 'kd100'=>[ -// 'customer_name'=>$data['kd100_customer_pwd'], -// 'customer_pwd'=>$data['kd100_customer_pwd'], -// 'send_site'=>$data['kd100_send_site'], -// 'send_staff'=>$data['kd100_send_staff'], -// 'month_code'=>$data['kd100_month_code'], -// 'pay_type'=>$data['kd100_pay_type'], -// ] - ]; - $data['interface_data'] = json_encode($interface_data); - $res = $this->model->create($data); - return $res->id; - } - - /** - * 电子面单编辑 - * @param int $id - * @param array $data - * @return bool - */ - public function edit(int $id, array $data) - { - // 将同类型页面的默认值改为0,默认页面只有一个 - if (!empty($data[ 'is_default' ])) { - $this->model->where([ [ 'id', '>', 0 ] ])->update([ 'is_default' => 0 ]); - } - - $interface_data = [ - 'kdbird'=>[ - 'customer_name'=>$data['customer_pwd'], - 'customer_pwd'=>$data['customer_pwd'], - 'send_site'=>$data['send_site'], - 'send_staff'=>$data['send_staff'], - 'month_code'=>$data['month_code'], - 'pay_type'=>$data['pay_type'], - 'is_notice'=>$data['is_notice'], - 'print_style'=>$data['print_style'] - ], -// 'kd100'=>[ -// 'customer_name'=>$data['kd100_customer_pwd'], -// 'customer_pwd'=>$data['kd100_customer_pwd'], -// 'send_site'=>$data['kd100_send_site'], -// 'send_staff'=>$data['kd100_send_staff'], -// 'month_code'=>$data['kd100_month_code'], -// 'pay_type'=>$data['kd100_pay_type'], -// ] - ]; - $data['interface_data'] = json_encode($interface_data); - $this->model->where([ [ 'id', '=', $id ] ])->update($data); - return true; - } - - /** - * 删除电子面单 - * @param int $id - * @return bool - */ - public function del(int $id) - { - $model = $this->model->where([ [ 'id', '=', $id ] ])->find(); - $res = $model->delete(); - return $res; - } - - /** - * 设置默认电子面单模板 - * @param int $id - * @return bool - */ - public function setDefault(int $id) - { - try { - $info = $this->getInfo($id); - if (empty($info)) { - return false; - } - Db::startTrans(); - $this->model->where([ [ 'id', '>', 0 ] ])->update([ 'is_default' => 0, 'update_time' => time() ]); - $this->model->where([ [ 'id', '=', $id ] ])->update([ 'is_default' => 1, 'update_time' => time() ]); - Db::commit(); - return true; - } catch (Exception $e) { - Db::rollback(); - throw new AdminException($e->getMessage()); - } - return true; - } - - /** - * 设置 电子面单配置 - * @param $data - * @return bool - */ - public function setConfig($data) - { - ( new CoreElectronicSheetService() )->setElectronicSheetConfig( $data); - return true; - } - - /** - * 获取 电子面单设置 - * @return array|mixed - */ - public function getConfig() - { - return ( new CoreElectronicSheetService() )->getElectronicSheetConfig(); - } - - /** - * 获取邮费支付方式类型 - * @return array|mixed|string - */ - public function getPayType() - { - return ElectronicSheetDict::getPayType(); - } - - /** - * 打印电子面单 - * @param array $data - * @return mixed - */ - public function printElectronicSheet($data = []) - { - $res = ( new CoreElectronicSheetService() )->printElectronicSheet($data); - return $res; - } - -} diff --git a/niucloud/addon/shop/app/service/admin/delivery/ShippingTemplateService.php b/niucloud/addon/shop/app/service/admin/delivery/ShippingTemplateService.php deleted file mode 100644 index 15cc11fc7..000000000 --- a/niucloud/addon/shop/app/service/admin/delivery/ShippingTemplateService.php +++ /dev/null @@ -1,181 +0,0 @@ -create([ - 'template_name' => $data[ 'template_name' ], - 'fee_type' => $data[ 'fee_type' ], - 'create_time' => time(), - 'no_delivery' => $data[ 'no_delivery' ], - 'is_free_shipping' => $data[ 'is_free_shipping' ] - ]); - - $template_item = []; - foreach ($data[ 'area' ] as $item) { - $template_item[] = [ - 'template_id' => $create_res->template_id, - 'city_id' => $item[ 'city_id' ], - 'fee_type' => $data[ 'fee_type' ], - 'snum' => round(floatval($item[ 'snum' ] ?? 0), 2), - 'sprice' => round(floatval($item[ 'sprice' ] ?? 0), 2), - 'xnum' => round(floatval($item[ 'xnum' ] ?? 0), 2), - 'xprice' => round(floatval($item[ 'xprice' ] ?? 0), 2), - 'fee_area_ids' => $item[ 'fee_area_ids' ] ?? '', - 'fee_area_names' => $item[ 'fee_area_names' ] ?? '', - 'no_delivery' => $data[ 'no_delivery' ], - 'no_delivery_area_ids' => $item[ 'no_delivery_area_ids' ] ?? '', - 'no_delivery_area_names' => $item[ 'no_delivery_area_names' ] ?? '', - 'is_free_shipping' => $data[ 'is_free_shipping' ], - 'free_shipping_area_ids' => $item[ 'free_shipping_area_ids' ] ?? '', - 'free_shipping_area_names' => $item[ 'free_shipping_area_names' ] ?? '', - 'free_shipping_price' => $item[ 'free_shipping_price' ] ?? 0, - 'free_shipping_num' => $item[ 'free_shipping_num' ] ?? 0, - ]; - } - ( new ShippingTemplateItem() )->saveAll($template_item); - - Db::commit(); - return $create_res->template_id; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 编辑运费模板 - * @param array $data - * @return true - */ - public function edit(int $template_id, array $data) - { - Db::startTrans(); - try { - ( new ShippingTemplate() )->update([ - 'template_name' => $data[ 'template_name' ], - 'fee_type' => $data[ 'fee_type' ], - 'update_time' => time(), - 'no_delivery' => $data[ 'no_delivery' ], - 'is_free_shipping' => $data[ 'is_free_shipping' ] - ], [ 'template_id' => $template_id ]); - - ( new ShippingTemplateItem() )->where([ 'template_id' => $template_id ])->delete(); - $template_item = []; - foreach ($data[ 'area' ] as $item) { - $template_item[] = [ - 'template_id' => $template_id, - 'city_id' => $item[ 'city_id' ], - 'fee_type' => $data[ 'fee_type' ], - 'snum' => round(floatval($item[ 'snum' ] ?? 0), 2), - 'sprice' => round(floatval($item[ 'sprice' ] ?? 0), 2), - 'xnum' => round(floatval($item[ 'xnum' ] ?? 0), 2), - 'xprice' => round(floatval($item[ 'xprice' ] ?? 0), 2), - 'fee_area_ids' => $item[ 'fee_area_ids' ] ?? '', - 'fee_area_names' => $item[ 'fee_area_names' ] ?? '', - 'no_delivery' => $data[ 'no_delivery' ], - 'no_delivery_area_ids' => $item[ 'no_delivery_area_ids' ] ?? '', - 'no_delivery_area_names' => $item[ 'no_delivery_area_names' ] ?? '', - 'is_free_shipping' => $data[ 'is_free_shipping' ], - 'free_shipping_area_ids' => $item[ 'free_shipping_area_ids' ] ?? '', - 'free_shipping_area_names' => $item[ 'free_shipping_area_names' ] ?? '', - 'free_shipping_price' => $item[ 'free_shipping_price' ] ?? 0, - 'free_shipping_num' => $item[ 'free_shipping_num' ] ?? 0, - ]; - } - ( new ShippingTemplateItem() )->saveAll($template_item); - - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 删除运费模板 - * @param int $template_id - * @return true - */ - public function delete(int $template_id) - { - if ((new Goods())->where([ ['delivery_template_id', '=', $template_id]])->count()) throw new CommonException('SHIPPING_TEMPLATE_IN_USE'); - ( new ShippingTemplate() )->where([ 'template_id' => $template_id ])->delete(); - ( new ShippingTemplateItem() )->where([ 'template_id' => $template_id ])->delete(); - return true; - } - - /** - * 查询运费模板列表 - * @param array $where - * @return array - */ - public function getPage(array $where) - { - $field = 'template_id, template_name, fee_type, create_time, no_delivery, is_free_shipping'; - $search_model = ( new ShippingTemplate() )->where([ ['template_id', '>', 0] ])->withSearch([ 'template_name' ], $where)->field($field)->order('create_time desc')->append([ 'fee_type_name' ]); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取运费模板列表 - * @param array $where - * @param string $field - * @return array - */ - public function getList(array $where = [], $field = 'template_id, template_name, fee_type, create_time, no_delivery, is_free_shipping') - { - $order = "create_time desc"; - return ( new ShippingTemplate() )->where([ ['template_id', '>', 0] ])->withSearch([ "template_name" ], $where)->field($field)->order($order)->select()->toArray(); - } - - /** - * 查询运费模板详情 - * @return array - */ - public function getInfo(int $template_id) - { - $field = 'template_id, template_name, fee_type, create_time, no_delivery, is_free_shipping'; - $detail = ( new ShippingTemplate() )->where([ [ 'template_id', '=', $template_id ] ])->field($field)->append([ 'fee_type_name' ])->findOrEmpty()->toArray(); - if (!empty($detail)) { - $detail[ 'fee_data' ] = ( new ShippingTemplateItem() )->where([ [ 'template_id', '=', $template_id ], [ 'fee_area_ids', '<>', '' ] ])->field('fee_area_ids as area_ids,fee_area_names,snum,sprice,xnum,xprice')->group('fee_area_ids')->select()->toArray(); - $detail[ 'no_delivery_data' ] = ( new ShippingTemplateItem() )->where([ [ 'template_id', '=', $template_id ], [ 'no_delivery_area_ids', '<>', '' ] ])->field('no_delivery_area_ids as area_ids,no_delivery_area_names')->group('no_delivery_area_ids')->select()->toArray(); - $detail[ 'free_shipping_data' ] = ( new ShippingTemplateItem() )->where([ [ 'template_id', '=', $template_id ], [ 'free_shipping_area_ids', '<>', '' ] ])->field('free_shipping_area_ids as area_ids,free_shipping_area_names,free_shipping_price,free_shipping_num')->group('free_shipping_area_ids')->select()->toArray(); - } - return $detail; - } -} diff --git a/niucloud/addon/shop/app/service/admin/delivery_store/DeliveryServiceService.php b/niucloud/addon/shop/app/service/admin/delivery_store/DeliveryServiceService.php deleted file mode 100644 index ba9ac1d29..000000000 --- a/niucloud/addon/shop/app/service/admin/delivery_store/DeliveryServiceService.php +++ /dev/null @@ -1,55 +0,0 @@ -deliveryServiceList($id); - } - - /** - * 配送门店开通配送服务 - * @return true - */ - public function deliveryServiceOpen(int $id, array $data) - { - return (new CoreDeliveryServiceService())->deliveryServiceOpen($id, $data); - } - - /** - * 配送门店品类修改 - * @return true - */ - public function deliveryServiceEdit(int $id, array $data) - { - return (new CoreDeliveryServiceService())->deliveryServiceEdit($id, $data); - } -} diff --git a/niucloud/addon/shop/app/service/admin/delivery_store/DeliveryStoreService.php b/niucloud/addon/shop/app/service/admin/delivery_store/DeliveryStoreService.php deleted file mode 100644 index e528a802c..000000000 --- a/niucloud/addon/shop/app/service/admin/delivery_store/DeliveryStoreService.php +++ /dev/null @@ -1,262 +0,0 @@ -model = new Store(); - } - - /** - * 获取提货点列表 - * @param array $where - * @return array - * @throws DbException - */ - public function getPage(array $where = []) - { - $field = 'store_id,store_no,store_name,store_logo,contact_name,store_mobile,province_id,city_id,district_id,address,full_address,longitude,latitude,trade_time,time_week,trade_time_json,time_interval,support_local_delivery,support_store,status,create_time'; - $order = 'create_time desc'; - - $search_model = $this->model->where([ [ 'store_id', '>', 0 ] ])->withSearch(['store_name', 'pick_up_type', 'create_time'], $where)->field($field)->append([ 'pick_up_type_name' ])->order($order); - return $this->pageQuery($search_model); - } - - /** - * 获取提货点信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'store_id,store_no,store_name,store_logo,contact_name,store_mobile,province_id,city_id,district_id,address,full_address,longitude,latitude,trade_time,time_week,trade_time_json,time_interval,create_time,support_local_delivery,support_store,status,area,time_is_open'; - $info = $this->model->field($field)->where([ [ 'store_id', '=', $id ] ])->append([ 'pick_up_type_name' ])->findOrEmpty()->toArray(); - $pick_up_type = []; - if ($info[ 'support_local_delivery' ] == 1) { - $pick_up_type[] = DeliveryDict::LOCAL_DELIVERY; - } - if ($info[ 'support_store' ] == 1) { - $pick_up_type[] = DeliveryDict::STORE; - } - $info[ 'pick_up_type' ] = $pick_up_type; - if (empty($info[ 'time_interval' ])) $info[ 'time_interval' ] = DeliveryDict::TIME_INTERVAL_30; - return $info; - } - - public function getInitInfo() - { - return [ - 'week_list' => DeliveryDict::getWeekList(), - 'time_interval_list' => DeliveryDict::getTimeIntervalList(), - 'local_delivery_config' => (new LocalService())->getLocal() - ]; - } - - /** - * 添加提货点 - * @param array $data - * @return mixed - * @throws \Exception - */ - public function add(array $data) - { - $data[ 'create_time' ] = time(); - $data[ 'update_time' ] = time(); - - $store_no = create_no();//生成门店编号 - $data[ 'store_no' ] = $store_no; - if (!empty($data['pick_up_type'])) { - if (in_array(DeliveryDict::LOCAL_DELIVERY, $data[ 'pick_up_type' ])) { - $data[ 'support_local_delivery' ] = 1; - } else { - $data[ 'support_local_delivery' ] = 0; - } - if (in_array(DeliveryDict::STORE, $data[ 'pick_up_type' ])) { - $data[ 'support_store' ] = 1; - } else { - $data[ 'support_store' ] = 0; - } - } else { - $data[ 'support_local_delivery' ] = 0; - $data[ 'support_store' ] = 0; - } - unset($data['pick_up_type']); - $res = $this->model->create($data); - return $res->store_id; - } - - /** - * 提货点编辑 - * @param int $id - * @param array $data - * @return bool - */ - public function edit(int $id, array $data) - { - $data[ 'update_time' ] = time(); - $check = $this->storeCheck($id); - $local_delivery_store_count = $check['local_delivery_store_count']; - $current_local_delivery_store_count = $check['current_local_delivery_store_count']; - $local_delivery_config = $check['local_delivery_config']; - $pick_up_store_count = $check['pick_up_store_count']; - $current_pick_up_store_count = $check['current_pick_up_store_count']; - $pick_up_config = $check['pick_up_config']; - - if ($local_delivery_store_count == 1 && $current_local_delivery_store_count == 1 && !in_array(DeliveryDict::LOCAL_DELIVERY, $data[ 'pick_up_type' ]) && $local_delivery_config['status'] == 1) { - throw new AdminException('LOCAL_DELIVERY_OPEN_AT_LEAST_ONE_LOCAL_DELIVERY_STORE');//同城配送已开启,至少需保留一个同城配送门店 - } - if ($pick_up_store_count == 1 && $current_pick_up_store_count == 1 && !in_array(DeliveryDict::STORE, $data[ 'pick_up_type' ]) && $pick_up_config['status'] == 1) { - throw new AdminException('STORE_OPEN_AT_LEAST_ONE_PICK_UP_STORE');//门店自提已开启,至少需保留一个自提门店 - } - if (!empty($data['pick_up_type'])) { - if (in_array(DeliveryDict::LOCAL_DELIVERY, $data[ 'pick_up_type' ])) { - $data[ 'support_local_delivery' ] = 1; - } else { - $data[ 'support_local_delivery' ] = 0; - } - if (in_array(DeliveryDict::STORE, $data[ 'pick_up_type' ])) { - $data[ 'support_store' ] = 1; - } else { - $data[ 'support_store' ] = 0; - } - } else { - $data[ 'support_local_delivery' ] = 0; - $data[ 'support_store' ] = 0; - } - unset($data['pick_up_type']); - $this->model->where([ [ 'store_id', '=', $id ] ])->update($data); - //批量更新服务商门店信息 - DeliveryShopEditJob::dispatch([ 'id' => $id ]); - return true; - } - - /** - * 删除提货点 - * @param int $id - * @return bool - */ - public function del(int $id) - { - $check = $this->storeCheck($id); - $local_delivery_store_count = $check['local_delivery_store_count']; - $current_local_delivery_store_count = $check['current_local_delivery_store_count']; - $local_delivery_config = $check['local_delivery_config']; - $pick_up_store_count = $check['pick_up_store_count']; - $current_pick_up_store_count = $check['current_pick_up_store_count']; - $pick_up_config = $check['pick_up_config']; - - if ($local_delivery_store_count == 1 && $current_local_delivery_store_count == 1 && $local_delivery_config['status'] == 1) { - throw new AdminException('LOCAL_DELIVERY_OPEN_AT_LEAST_ONE_LOCAL_DELIVERY_STORE');//同城配送已开启,至少需保留一个同城配送门店 - } - if ($pick_up_store_count == 1 && $current_pick_up_store_count == 1 && $pick_up_config['status'] == 1) { - throw new AdminException('STORE_OPEN_AT_LEAST_ONE_PICK_UP_STORE');//门店自提已开启,至少需保留一个自提门店 - } - - $res = $this->model->where([ [ 'store_id', '=', $id ] ])->delete(); - return $res; - } - - /** - * 获取提货点列表 - * @param array $where - * @return array - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function getList(array $where = []) - { - $field = 'store_id,store_name,contact_name,store_mobile,province_id,city_id,district_id,address,full_address,longitude,latitude,area,trade_time,create_time'; - $order = 'create_time desc'; - return $this->model->where([ [ 'status', '=', 1 ] ])->withSearch(['keyword', 'pick_up_type'], $where)->field($field)->order($order)->select()->toArray(); - } - - /** - * 获取提货点提货类型 - * @return array - */ - public function getPickUpType() - { - return DeliveryStoreDict::getPickUpType(); - } - - /** - * 修改提货点状态 - * @param array $data - * @return bool - */ - public function modifyStatus(array $data) - { - $this->model->where([ [ 'store_id', '=', $data[ 'store_id' ] ] ])->update([ 'status' => $data[ 'status' ] ]); - return true; - } - - /** - * 提货点检测 - * @param int $id - * @return array - * @throws DbException - */ - public function storeCheck(int $id) - { - //同城配送门店检测 - $local_delivery_store_count = $this->model->withSearch([ 'pick_up_type' ], [ 'pick_up_type' => DeliveryDict::LOCAL_DELIVERY ])->count(); - $current_local_delivery_store_count = $this->model->where([ [ 'store_id', '=', $id ] ])->withSearch([ 'pick_up_type' ], [ 'pick_up_type' => DeliveryDict::LOCAL_DELIVERY ])->count(); - $local_delivery_config = (new CoreDeliveryService())->getDeliveryConfig()['local_delivery']; - - //自提门店检测 - $pick_up_store_count = $this->model->withSearch([ 'pick_up_type' ], [ 'pick_up_type' => DeliveryDict::STORE ])->count(); - $current_pick_up_store_count = $this->model->where([ [ 'store_id', '=', $id ] ])->withSearch([ 'pick_up_type' ], [ 'pick_up_type' => DeliveryDict::STORE ])->count(); - $pick_up_config = (new CoreDeliveryService())->getDeliveryConfig()['store']; - return [ - 'local_delivery_store_count' => $local_delivery_store_count, - 'current_local_delivery_store_count' => $current_local_delivery_store_count, - 'local_delivery_config' => $local_delivery_config, - 'pick_up_store_count' => $pick_up_store_count, - 'current_pick_up_store_count' => $current_pick_up_store_count, - 'pick_up_config' => $pick_up_config, - ]; - } - - /** - * 修改提货点配送区域 - * @param int $id - * @param array $area_data - * @return bool - */ - public function editArea(int $id, array $area_data) - { - $this->model->where([[ 'store_id', '=', $id ]])->update(['area' => $area_data]); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/admin/goods/AttrService.php b/niucloud/addon/shop/app/service/admin/goods/AttrService.php deleted file mode 100644 index 55b7c63cf..000000000 --- a/niucloud/addon/shop/app/service/admin/goods/AttrService.php +++ /dev/null @@ -1,148 +0,0 @@ -model = new Attr(); - } - - /** - * 获取商品参数分页列表 - * @param array $where - * @param string $field - * @param string $order - * @return array - * @throws \think\db\exception\DbException - */ - public function getPage(array $where = [], $field = 'attr_id,attr_name,sort') - { - $order = 'attr_id desc'; - if (!empty($where[ 'order' ])) { - $order = $where[ 'order' ] . ' ' . $where[ 'sort' ]; - } - $search_model = $this->model->where([ [ 'attr_id', ">", 0 ] ])->withSearch([ "attr_id_arr", "attr_id", "attr_name" ], $where)->field($field)->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取商品参数列表 - * @param array $where - * @param string $field - * @return mixed - */ - public function getList(array $where = [], $field = 'attr_id,attr_name,attr_value_format,sort') - { - $order = 'sort desc,attr_id desc'; - if (!empty($where[ 'order' ])) { - $order = $where[ 'order' ] . ' ' . $where[ 'sort' ]; - } - return $this->model->where([ [ 'attr_id', ">", 0 ] ])->withSearch([ "attr_id_arr", "attr_id", "attr_name" ], $where)->field($field)->order($order)->select()->toArray(); - } - - /** - * 获取商品参数信息 - * @param int $id - * @param string $field - * @return mixed - */ - public function getInfo(int $id, $field = 'attr_id,attr_name,attr_value_format,sort') - { - $info = $this->model->field($field)->where([ [ 'attr_id', "=", $id ] ])->findOrEmpty()->toArray(); - return $info; - } - - /** - * 添加商品参数 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $res = $this->model->create($data); - return $res->attr_id; - } - - /** - * 商品参数编辑 - * @param int $id - * @param array $data - * @return bool - */ - public function edit(int $id, array $data) - { - $this->model->where([ [ 'attr_id', '=', $id ] ])->update($data); - return true; - } - - /** - * 删除商品参数 - * @param int $id - * @return bool - */ - public function del(int $id) - { - $model = $this->model->where([ [ 'attr_id', '=', $id ] ])->find(); - $res = $model->delete(); - return $res; - } - - /** - * 修改商品参数排序号 - * @param $data - * @return mixed - */ - public function modifySort($data) - { - return $this->model->where([ - [ 'attr_id', '=', $data[ 'attr_id' ] ], - ])->update([ 'sort' => $data[ 'sort' ] ]); - } - - /** - * 修改商品参数名称 - * @param $data - * @return mixed - */ - public function modifyAttrName($data) - { - return $this->model->where([ - [ 'attr_id', '=', $data[ 'attr_id' ] ], - ])->update([ 'attr_name' => $data[ 'attr_name' ] ]); - } - - /** - * 修改商品参数值 - * @param $data - * @return mixed - */ - public function modifyAttrValueFormat($data) - { - return $this->model->where([ - [ 'attr_id', '=', $data[ 'attr_id' ] ], - ])->update([ 'attr_value_format' => $data[ 'attr_value_format' ] ]); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/goods/BrandService.php b/niucloud/addon/shop/app/service/admin/goods/BrandService.php deleted file mode 100644 index b3a74f84c..000000000 --- a/niucloud/addon/shop/app/service/admin/goods/BrandService.php +++ /dev/null @@ -1,132 +0,0 @@ -model = new Brand(); - } - - /** - * 获取商品品牌列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'brand_id,brand_name,logo,color_json,desc,sort,create_time'; - $order = 'brand_id desc'; - if (!empty($where[ 'order' ])) { - $order = $where[ 'order' ] . ' ' . $where[ 'sort' ]; - } - - $search_model = $this->model->where([ [ 'brand_id', '>', 0 ] ])->withSearch([ "brand_name" ], $where)->field($field)->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取商品品牌列表 - * @param array $where - * @param string $field - * @return array - */ - public function getList(array $where = [], $field = 'brand_id,brand_name,logo,color_json,desc,sort,create_time') - { - $order = 'create_time desc'; - return $this->model->where([ [ 'brand_id', '>', 0 ] ])->withSearch([ "brand_name" ], $where)->field($field)->limit(10)->order($order)->select()->toArray(); - } - - /** - * 获取商品品牌信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'brand_id,brand_name,logo,color_json,desc,sort,create_time'; - $info = $this->model->field($field)->where([ [ 'brand_id', '=', $id ] ])->findOrEmpty()->toArray(); - return $info; - } - - /** - * 添加商品品牌 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $data[ 'create_time' ] = time(); - $brandInfo = $this->model->where([ [ 'brand_name', '=', $data[ 'brand_name' ] ] ])->findOrEmpty()->toArray(); - if ($brandInfo) { - throw new AdminException('品牌已存在,请检查'); - } - $res = $this->model->create($data); - return $res->brand_id; - - } - - /** - * 商品品牌编辑 - * @param int $id - * @param array $data - * @return bool - */ - public function edit(int $id, array $data) - { - $data[ 'update_time' ] = time(); - $brandInfo = $this->model->where([ [ 'brand_name', '=', $data[ 'brand_name' ] ] ])->findOrEmpty()->toArray(); - if ($brandInfo && $brandInfo[ 'brand_id' ] != $id) { - throw new AdminException('品牌已存在,请检查'); - } - $this->model->where([ [ 'brand_id', '=', $id ] ])->update($data); - return true; - } - - /** - * 删除商品品牌 - * @param int $id - * @return bool - */ - public function del(int $id) - { - $model = $this->model->where([ [ 'brand_id', '=', $id ] ])->find(); - $res = $model->delete(); - return $res; - } - - /** - * 修改排序 - * @param $data - * @return Brand - */ - public function modifySort($data) - { - return $this->model->where([ - [ 'brand_id', '=', $data[ 'brand_id' ] ], - ])->update([ 'sort' => $data[ 'sort' ] ]); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/goods/CategoryService.php b/niucloud/addon/shop/app/service/admin/goods/CategoryService.php deleted file mode 100644 index f88e030f6..000000000 --- a/niucloud/addon/shop/app/service/admin/goods/CategoryService.php +++ /dev/null @@ -1,241 +0,0 @@ -model = new Category(); - } - - /** - * 获取商品分级查询分类列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'category_id,category_name,image,level,pid,category_full_name,is_show,sort'; - $order = 'create_time desc'; - - $search_model = $this->model->where([ [ 'category_id', '>', 0 ] ])->withSearch([ "category_name" ], $where)->field($field)->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取商品分类列表 - * @param array $where - * @param string $field - * @return array - */ - public function getList(array $where = [], $field = 'category_id,category_name,image,level,pid,category_full_name,is_show,sort') - { - $order = 'sort desc,create_time desc'; - return $this->model->where([ [ 'category_id', '>', 0 ] ])->withSearch([ "category_name", 'level' ], $where)->field($field)->order($order)->select()->toArray(); - } - - /** - * 查询商品分类树结构 - * @param string $field - * @param string $order - * @return array - */ - public function getTree() - { - return ( new CoreGoodsCategoryService() )->getTree([ [ 'category_id', '>', 0 ] ]); - } - - /** - * 获取商品分类信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'category_id,category_name,image,level,pid,category_full_name,is_show,sort'; - $info = $this->model->field($field)->where([ [ 'category_id', '=', $id ] ])->findOrEmpty()->toArray(); - if (!empty($info)) { - $info[ 'child_count' ] = 0; - if ($info[ 'level' ] == 1) { - $info[ 'child_count' ] = $this->model->where([ [ 'pid', '=', $info[ 'category_id' ] ] ])->count(); - } - } - return $info; - } - /** - * 获取商品分类信息 - * @param int $id - * @return array - */ - public function checkCategoryValid($ids) - { - return $this->model->where([ [ 'category_id', 'in', $ids ] ])->column('category_id'); - } - - /** - * 添加商品分类 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $data[ 'category_full_name' ] = $data[ 'category_name' ]; - $data[ 'level' ] = 1; - - $condition = [ - [ 'category_name', '=', $data[ 'category_name' ] ] - ]; - if ($data[ 'pid' ] > 0) { - $condition[] = [ 'pid', '=', $data[ 'pid' ] ]; - } else { - $condition[] = [ 'level', '=', 1 ]; - } - - $categoryInfo = $this->model->where($condition)->findOrEmpty()->toArray(); - if ($categoryInfo) { - throw new AdminException('分类已存在,请检查'); - } - if ($data[ 'pid' ] > 0) { - $info = $this->model->field("category_id, category_name")->where([ [ 'category_id', '=', $data[ 'pid' ] ] ])->findOrEmpty(); - if ($info->isEmpty()) throw new CommonException('SHOP_GOODS_CATEGORY_NOT_EXIST'); - $data[ 'category_full_name' ] = $info->category_name . '/' . $data[ 'category_name' ]; - $data[ 'level' ] = 2; - } - - $data[ 'create_time' ] = time(); - $res = $this->model->create($data); - return $res->category_id; - } - - /** - * 商品分类编辑 - * @param int $id - * @param array $data - * @return bool - */ - public function edit(int $id, array $data) - { - $category_info = $this->getInfo($id); - if ($category_info && $category_info[ 'category_id' ] != $id) { - throw new AdminException('分类已存在,请检查'); - } - if ($category_info[ 'level' ] == 1 && $category_info[ 'pid' ] != $data[ 'pid' ] && $category_info[ 'child_count' ] > 0) { - throw new CommonException('SHOP_GOODS_CATEGORY_EXIST_CHILD'); - } - - $data[ 'category_full_name' ] = $data[ 'category_name' ]; - $data[ 'level' ] = 1; - if ($data[ 'pid' ] > 0) { - $info = $this->model->field("category_id, category_name")->where([ [ 'category_id', '=', $data[ 'pid' ] ] ])->findOrEmpty(); - if ($info->isEmpty()) throw new CommonException('SHOP_GOODS_CATEGORY_NOT_EXIST'); - $data[ 'category_full_name' ] = $info->category_name . '/' . $data[ 'category_name' ]; - $data[ 'level' ] = 2; - } - $data[ 'update_time' ] = time(); - try { - (new GoodsService())->batchUpdateCategory($id,$category_info['pid'],$data['pid']); - $this->model->where([ [ 'category_id', '=', $id ] ])->update($data); - return true; - }catch (AdminException $e) { - throw new AdminException($e->getMessage()); - } - - } - - /** - * 删除商品分类 - * @param int $id - * @return bool - */ - public function del(int $id) - { - $count = ( new Goods() )->withSearch([ 'goods_category' ], [ 'goods_category' => $id ])->count(); - if ($count) { - throw new AdminException('SHOP_GOODS_CATEGORY_EXIST_GOODS'); - } - - $field = 'category_id,level,pid'; - $info = $this->model->field($field)->where([ [ 'category_id', '=', $id ] ])->findOrEmpty()->toArray(); - if (!empty($info[ 'level' ] == 1)) { - // 删除子级分类 - $this->model->where([ [ 'pid', '=', $id ] ])->delete(); - } - $res = $this->model->where([ [ 'category_id', '=', $id ] ])->delete(); - return $res; - } - - /** - * 拖拽商品分类 - * @param $id - * @param $data - */ - public function updateCategory($data) - { - foreach ($data[ 'category_sort_array' ] as $key => $val) { - $info = $this->model->field("category_id, category_name")->where([ [ 'category_id', '=', $val[ 'category_id' ] ] ])->findOrEmpty(); - if (!$info->isEmpty()) { - $data[ 'update_time' ] = time(); - $this->model->where([ [ 'category_id', '=', $val[ 'category_id' ] ] ])->update([ 'sort' => $val[ 'sort' ] ]); - } - } - return true; - } - - /** - * 设置商品分类配置 - * @param array $params - * @return array - */ - public function setGoodsCategoryConfig(array $params = []) - { - return ( new CoreGoodsCategoryService() )->setGoodsCategoryConfig($params); - } - - /** - * 获取商品分类配置 - * @return array - */ - public function getGoodsCategoryConfig() - { - return ( new CoreGoodsCategoryService() )->getGoodsCategoryConfig(); - } - - /** - * 获取商品分类树结构供弹框调用 - * @param string $field - * @param string $order - * @return array - */ - public function getTreeComponents() - { - return ( new CoreGoodsCategoryService() )->getTree([ - [ 'is_show', '=', 1 ], - ], 'category_id,category_name,image,level,pid'); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/goods/ConfigService.php b/niucloud/addon/shop/app/service/admin/goods/ConfigService.php deleted file mode 100644 index b923d2296..000000000 --- a/niucloud/addon/shop/app/service/admin/goods/ConfigService.php +++ /dev/null @@ -1,151 +0,0 @@ -model = new SysConfig(); - $this->core_goods_config_service = new CoreGoodsConfigService(); - } - - /** - * 获取商品搜索配置 - * @return array - */ - public function getSearchConfig() - { - return $this->core_goods_config_service->getSearchConfig(); - } - - /** - * 设置商品搜索配置 - * @param $data - * @return SysConfig|bool|\think\Model - */ - public function setSearchConfig($data) - { - return $this->core_goods_config_service->setSearchConfig($data); - } - - /** - * 获取商品编码唯一值配置 - * @return array - */ - public function getUniqueConfig() - { - return $this->core_goods_config_service->getUniqueConfig(); - } - - /** - * 设置商品编码唯一值配置 - * @param $data - * @return SysConfig|bool|\think\Model - */ - public function setUniqueConfig($data) - { - return $this->core_goods_config_service->setUniqueConfig($data); - } - - /** - * 验证商品编码是否重复 - * @param $params - */ - public function verifySkuNo($params) - { - $config_info = $this->core_goods_config_service->getUniqueConfig(); - if ($config_info['is_enable'] == 0) { - return true; - } - - if (empty($params['sku_no'])) { - throw new AdminException("缺少参数sku_no"); - } - - $sku_no_arr = explode(',', $params['sku_no']); - foreach ($sku_no_arr as $k=>$sku_no) { - if (empty($sku_no)){ - unset($sku_no_arr[$k]); - } - } - if (empty($sku_no_arr)){ - return true; - } - //判断传参中的sku_no是否有重复的 - if (count($sku_no_arr) > 1) { - $counts = array_count_values($sku_no_arr); - $duplicates = array_filter($counts, function ($count) { - return $count > 1; - }); - // 获取所有重复的值 - $duplicateValues = array_keys($duplicates); - if (!empty($duplicateValues)) { - throw new AdminException("商品编码[{$duplicateValues[0]}]已存在"); - } - } - $sql_arr = []; - foreach ($sku_no_arr as $sku_no) { - $sql_arr[] = "FIND_IN_SET('{$sku_no}', sku_no)"; - } - $condition = [ - ['', 'exp', Db::raw(join(' or ', $sql_arr))], - ]; - if (!empty($params['goods_id'])) { - $condition[] = ['goods_id', '<>', $params['goods_id']]; - } - $goods_sku_model = new GoodsSku(); - $info = $goods_sku_model->where($condition)->find(); - if (!empty($info)) { - $exist_sku_no_arr = array_intersect($sku_no_arr, explode(',', $info['sku_no'])); - $exist_sku_no_arr = array_values($exist_sku_no_arr); - throw new AdminException("商品编码[{$exist_sku_no_arr[0]}]已存在"); - } - return true; - } - - /** - * 获取商品排序配置 - * @return array|int[]|mixed - */ - public function getSortConfig() - { - return $this->core_goods_config_service->getSortConfig(); - } - - /** - * 设置商品排序配置 - * @param $data - * @return \addon\shop\app\service\core\goods\SysConfig|bool|\think\Model - */ - public function setSortConfig($data) - { - return $this->core_goods_config_service->setSortConfig($data); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/goods/EvaluateService.php b/niucloud/addon/shop/app/service/admin/goods/EvaluateService.php deleted file mode 100644 index aa101cc7e..000000000 --- a/niucloud/addon/shop/app/service/admin/goods/EvaluateService.php +++ /dev/null @@ -1,293 +0,0 @@ -model = new Evaluate(); - } - - /** - * 获取商品评价列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'evaluate_id,order_id,order_goods_id,goods_id,member_id,content,images,is_anonymous,scores,is_audit,explain_first,create_time,topping'; - $order = 'create_time desc'; - - $goods_where =$evaluate_where = []; - $evaluate_where[] = [ - [ 'evaluate.evaluate_id', '>', 0 ] - ]; - if (isset($where[ 'goods_name' ]) && $where[ 'goods_name' ] != '') { - $goods_where[] = [ 'goods.goods_name', 'like', '%' . $this->model->handelSpecialCharacter($where[ 'goods_name' ]) . '%' ]; - } - if (isset($where[ 'status' ]) && $where[ 'status' ] != '') { - $evaluate_where[] = [ 'evaluate.is_audit', '=', $where[ 'status' ] ]; - } - - $search_model = $this->model - // ->withSearch(["goods_name"], $where) - ->where($evaluate_where) - ->field($field) - ->withJoin([ - 'goods' => function(Query $query) use ($goods_where) { - $query->where($goods_where); - }, - ]) - ->order($order)->append([ 'audit_name', 'image_small', 'image_mid' ]); - $list = $this->pageQuery($search_model, function($item, $key) { - $item_goods = $item[ 'goods' ]; - if (!empty($item_goods)) { - $item_goods->append([ 'goods_cover_thumb_small', 'goods_cover_thumb_mid' ]); - } - - }); - return $list; - } - - /** - * 获取商品评价信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'evaluate_id,order_id,order_goods_id,goods_id,member_id,content,images,is_anonymous,scores,is_audit,explain_first,create_time'; - - $info = $this->model->field($field)->where([ [ 'evaluate_id', '=', $id ] ])->findOrEmpty()->toArray(); - return $info; - } - - /** - * 添加商品评价 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $data[ 'is_audit' ] = EvaluateDict::AUDIT_NO; - return ( new CoreGoodsEvaluateService )->addEvaluate($data); - } - - /** - * 删除商品评价 - * @param int $id - * @return bool - */ - public function del(int $evaluate_id) - { - $model = $this->model->where([ [ 'evaluate_id', '=', $evaluate_id ] ])->find(); - if (empty($model))return false; - $res = $model->delete(); - - CoreGoodsStatService::addStat([ 'goods_id' => $model->goods_id, 'evaluate_num' => -1 ]); - ( new Goods() )->where([ [ 'goods_id', '=', $model->goods_id ] ])->dec('evaluate_num', 1)->update(); - return $res; - } - - /** - * 审核通过 - * @param $evaluate_id - * @return bool - */ - public function auditAdopt($evaluate_id) - { - $this->model->where([ [ 'evaluate_id', '=', $evaluate_id ] ])->update([ 'is_audit' => EvaluateDict::AUDIT_ADOPT ]); - - $goods_id = $this->model->where('evaluate_id', '=', $evaluate_id)->value('goods_id'); - if (empty($goods_id)) return false; - CoreGoodsStatService::addStat([ 'goods_id' => $goods_id, 'evaluate_num' => 1 ]); - ( new Goods() )->where([ [ 'goods_id', '=', $goods_id ] ])->inc('evaluate_num', 1)->update(); - return true; - } - - /** - * 审核拒绝 - * @param $evaluate_id - * @return bool - */ - public function auditRefuse($evaluate_id) - { - $this->model->where([ [ 'evaluate_id', '=', $evaluate_id ] ])->update([ 'is_audit' => EvaluateDict::AUDIT_REFUSE ]); - return true; - } - - /** - * 评价回复 - * @param $evaluate_id - * @param $data - * @return bool - */ - public function reply($evaluate_id, $data) - { - $this->model->where([ [ 'evaluate_id', '=', $evaluate_id ] ])->update($data); - return true; - } - - /** - * 置顶 - * @param $evaluate_id - * @return bool - */ - public function topping($evaluate_id) - { - $data = [ - 'topping' => 1, - 'update_time' => time() - ]; - $this->model->where([ [ 'evaluate_id', '=', $evaluate_id ] ])->update($data); - return true; - } - - /** - * 取消置顶 - */ - public function cancelTopping($evaluate_id) - { - $data = [ - 'topping' => 0, - 'update_time' => 0 - ]; - $this->model->where([ [ 'evaluate_id', '=', $evaluate_id ] ])->update($data); - return true; - } - - /** - * 审核批量修改 - * @return bool - */ - public function auditEditBatch() - { - // 查询待审核的id - $evaluate_ids = $this->model->where([ [ 'is_audit', '=', EvaluateDict::AUDIT ] ])->column('evaluate_id'); - if (!empty($evaluate_ids)) { - GoodsEvaluateStat::dispatch([ 'evaluate_ids' => $evaluate_ids ]); - } - - $this->model->where([ [ 'is_audit', '=', EvaluateDict::AUDIT ] ])->update([ 'is_audit' => EvaluateDict::AUDIT_NO ]); - return true; - } - - /** - * 批量设置评论审核状态后,更新评价统计数据 - * @param $evaluate_ids - */ - public function updateGoodsEvaluateNumBach($evaluate_ids) - { - $list = $this->model->where([ [ 'evaluate_id', 'in', $evaluate_ids ] ])->chunk(50, function($evaluate) { - foreach ($evaluate as $item) { - $goods_id = $this->model->where('goods_id', '=', $item[ 'goods_id' ])->value('goods_id'); - if (!empty($goods_id)){ - CoreGoodsStatService::addStat([ 'goods_id' => $item[ 'goods_id' ], 'evaluate_num' => 1 ]); - ( new Goods() )->where([ [ 'goods_id', '=', $item[ 'goods_id' ] ] ])->inc('evaluate_num', 1)->update(); - } - } - }); - return true; - } - - /** - * 批量通过 - * @param $evaluate_ids - * @return bool - */ - public function batchAdopt($evaluate_ids) - { - $evaluate_list = $this->model->where([ [ 'evaluate_id', 'in', $evaluate_ids ], [ 'is_audit', '=', EvaluateDict::AUDIT ] ])->column('evaluate_id, goods_id'); - $goods_ids = array_column($evaluate_list, 'goods_id'); - $evaluate_ids = array_column($evaluate_list, 'evaluate_id'); - Db::startTrans(); - try { - if (!empty($evaluate_list)){ - $this->model->where([ [ 'evaluate_id', 'in', $evaluate_ids ] ])->update([ 'is_audit' => EvaluateDict::AUDIT_ADOPT ]); - foreach ($goods_ids as $value){ - CoreGoodsStatService::addStat([ 'goods_id' => $value, 'evaluate_num' => 1 ]); - ( new Goods() )->where([ [ 'goods_id', '=', $value ] ])->inc('evaluate_num', 1)->update(); - } - } - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 批量拒绝 - * @param $evaluate_ids - * @return bool - */ - public function batchRefuse($evaluate_ids) - { - $evaluate_list = $this->model->where([ ['evaluate_id', 'in', $evaluate_ids], [ 'is_audit', '=', EvaluateDict::AUDIT ]])->column('evaluate_id, is_audit'); - if (!empty($evaluate_list)){ - $this->model->where([ ['evaluate_id', 'in', $evaluate_ids]])->update(['is_audit' => EvaluateDict::AUDIT_REFUSE]); - } - return true; - } - - /** - * 批量删除 - * @param $evaluate_ids - * @return bool - */ - public function batchDel($evaluate_ids) - { - $evaluate_list = $this->model->where([ [ 'evaluate_id', 'in', $evaluate_ids ] ])->column('is_audit, goods_id'); - - Db::startTrans(); - try { - $this->model->where([ ['evaluate_id', 'in', $evaluate_ids]])->delete(); - - foreach ($evaluate_list as $value){ - switch ($value[ 'is_audit' ]){ - case EvaluateDict::AUDIT_NO: - case EvaluateDict::AUDIT_ADOPT: - CoreGoodsStatService::addStat([ 'goods_id' => $value[ 'goods_id' ], 'evaluate_num' => -1 ]); - ( new Goods() )->where([ [ 'goods_id', '=', $value[ 'goods_id' ] ] ])->dec('evaluate_num', 1)->update(); - break; - } - } - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - - } -} diff --git a/niucloud/addon/shop/app/service/admin/goods/GoodsService.php b/niucloud/addon/shop/app/service/admin/goods/GoodsService.php deleted file mode 100644 index cdae305fd..000000000 --- a/niucloud/addon/shop/app/service/admin/goods/GoodsService.php +++ /dev/null @@ -1,1869 +0,0 @@ -model = new Goods(); - } - - /** - * 获取商品添加/编辑数据 - * @param array $params - * @return array - */ - public function getInit(array $params = []) - { - - $res = []; - - $addon_service = new AddonService(); - $res['addon_shop_supplier'] = $addon_service->getInfoByKey('shop_supplier'); - - if (!empty($params['goods_id'])) { - // 查询商品信息,用于编辑 - $field = 'goods_id,goods_name,sub_title,goods_type,goods_cover,goods_image,goods_video,goods_desc,brand_id,goods_category,label_ids,service_ids,unit,stock,virtual_sale_num,is_limit,limit_type,max_buy,min_buy,status,sort,delivery_type,is_free_shipping,fee_type,delivery_money,delivery_template_id,supplier_id,attr_ids,attr_format,member_discount,poster_id,is_gift,form_id,diy_detail_id'; - $goods_info = $this->model->field($field)->where([['goods_id', '=', $params['goods_id']]])->findOrEmpty()->toArray(); - if (!empty($goods_info)) { - - if (!empty($goods_info['goods_category'])) { - $goods_category = array_values($goods_info['goods_category']); - $category_service = new CategoryService(); - $goods_info['goods_category'] = $category_service->checkCategoryValid($goods_category); - } - - // 商品品牌,处理数据类型 - if (empty($goods_info['brand_id'])) { - $goods_info['brand_id'] = ''; - } else { - $brand_count = (new Brand())->where([['brand_id', '=', $goods_info['brand_id']]])->count(); - if ($brand_count == 0) $goods_info['brand_id'] = ''; - } - - // 供应商,处理数据类型 - if (empty($goods_info['supplier_id'])) { - $goods_info['supplier_id'] = ''; - } - - // 标签组 - if (empty($goods_info['label_ids'])) { - $goods_info['label_ids'] = []; - } else { - $goods_info['label_ids'] = array_map(function ($item) { - return (int)$item; - }, $goods_info['label_ids']); - } - - // 商品服务 - if (empty($goods_info['service_ids'])) { - $goods_info['service_ids'] = []; - } else { - $goods_info['service_ids'] = array_map(function ($item) { - return (int)$item; - }, $goods_info['service_ids']); - } - - // 商品参数,处理数据类型 - if (empty($goods_info['attr_ids'])) { - $goods_info['attr_ids'] = []; - } else { - $goods_info['attr_ids'] = array_map(function ($item) { - return (int)$item; - }, $goods_info['attr_ids']); - } - - // 商品海报id,处理数据类型 - if (empty($goods_info['poster_id'])) { - $goods_info['poster_id'] = ''; - } - - // 自定义商品详情模板id,处理数据类型 - if (!empty($goods_info['diy_detail_id'])) { - $diy_model = new Diy(); - $diy_count = $diy_model->where([ - ['id', '=', $goods_info['diy_detail_id']] - ])->count(); - if ($diy_count == 0) { - $goods_info['diy_detail_id'] = ''; - } - } else { - $goods_info['diy_detail_id'] = ''; - } - - // 万能表单id,处理数据类型 - if (!empty($goods_info['form_id'])) { - $diy_form_model = new DiyForm(); - $diy_form_count = $diy_form_model->where([ - ['form_id', '=', $goods_info['form_id']] - ])->count(); - if ($diy_form_count == 0) { - $goods_info['form_id'] = ''; - } - } else { - $goods_info['form_id'] = ''; - } - - // 配送方式 - if (empty($goods_info['delivery_type'])) { - $goods_info['delivery_type'] = []; - } - - $goods_info['status'] = (string)$goods_info['status']; - - // 运费模板,处理数据类型 - if (empty($goods_info['delivery_template_id'])) { - $goods_info['delivery_template_id'] = ''; - } - - $goods_sku_model = new GoodsSku(); - - $sku_field = 'sku_id,sku_name,sku_image,sku_no,goods_id,sku_spec_format,price,market_price,cost_price,stock,weight,volume,is_default'; - $sku_order = 'sku_id asc'; - $goods_info['sku_list'] = $goods_sku_model->withSearch(["goods_id"], ['goods_id' => $params['goods_id']])->field($sku_field)->order($sku_order)->select()->toArray(); - - $temp_sku_data = array_filter(array_column($goods_info['sku_list'], 'sku_spec_format')); - $goods_info['spec_type'] = 'single'; - if (!empty($temp_sku_data)) { - // 多规格 - $goods_info['spec_type'] = 'multi'; - - $goods_spec_model = new GoodsSpec(); - $spec_field = 'spec_id,goods_id,spec_name,spec_values'; - $spec_order = 'spec_id asc'; - $goods_info['spec_list'] = $goods_spec_model->withSearch(["goods_id"], ['goods_id' => $params['goods_id']])->field($spec_field)->order($spec_order)->select()->toArray(); - - } - - // 查询商品参与营销活动的数量 - $goods_info['active_goods_count'] = $this->getActiveGoodsCount($goods_info['goods_id']); - - $res['goods_info'] = $goods_info; - } - - } - $res['default_sort'] = (new CoreGoodsConfigService())->getDefaultSort(); - - return $res; - } - - /** - * 获取商品列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'goods_id,goods_name,goods_type,goods_cover,stock,sale_num,status,sort,create_time,member_discount,is_gift'; - $order = 'create_time desc'; - $sku_where = [ - ['goodsSku.is_default', '=', 1], - ]; - - if (!empty($where['start_price']) && !empty($where['end_price'])) { - $money = [$where['start_price'], $where['end_price']]; - sort($money); - $sku_where[] = ['goodsSku.price', 'between', $money]; - } else if (!empty($where['start_price'])) { - $sku_where[] = ['goodsSku.price', '>=', $where['start_price']]; - } else if (!empty($where['end_price'])) { - $sku_where[] = ['goodsSku.price', '<=', $where['end_price']]; - } - if (!empty($where['order'])) { - $order = $where['order'] . ' ' . $where['sort']; - } - $search_model = $this->model->where([['goods.goods_id', '>', 0]])->withSearch(["goods_name", "goods_type", "brand_id", "goods_category", "label_ids", 'service_ids', "sale_num", "status"], $where) - ->field($field) - ->withJoin([ - 'goodsSku' => ['sku_id', 'goods_id', 'price', 'member_price'] - ])->where($sku_where)->order($order)->append(['goods_type_name', 'goods_edit_path', 'goods_cover_thumb_small']); - $list = $this->pageQuery($search_model); - $list['data'] = $this->formatGoodsJoinActive($list['data']); - return $list; - } - - /** - * 处理商品参与的活动数据 - * @param $goods_data - * @return mixed - */ - private function formatGoodsJoinActive($goods_data) - { - $goods_ids = array_column($goods_data, 'goods_id'); - $join_list = event('GetGoodsJoinInfo', [ - 'goods_ids' => $goods_ids, - ]); - $goods_join = []; - foreach ($join_list as $item) { - if (empty($item)) { - continue; - } - foreach ($item as $goods_id => $value) { - if (!isset($goods_join[$goods_id])) { - { - $goods_join[$goods_id] = []; - } - } - $goods_join[ $goods_id ] = array_merge($goods_join[ $goods_id ], array_values($value)); - } - } - if (!empty($goods_join)) { - $active_tips = []; - foreach ($goods_join as $goods_id => $join_active) { - foreach ($join_active as $k => $v) { - $join_type = $v[ 'join_type' ]; - if (!isset($active_tips[ $goods_id ][ $join_type ][ 'name' ])) { - $active_tips[ $goods_id ][ $join_type ][ 'name' ] = ''; - } - if (isset($v[ 'short' ])) { - $active_tips[ $goods_id ][ $join_type ][ 'short' ] = $v[ 'short' ]; - if(($v['short']['is_need_params']??0) == 1){ - $active_tips[ $goods_id ][ $join_type ][ 'jump_url' ] = ($v[ 'short' ]['jump_url'] ?? '')."?active_id=".$join_active[0]['join_id']; - }else{ - $active_tips[ $goods_id ][ $join_type ][ 'jump_url' ] = $v[ 'short' ]['jump_url'] ?? ''; - } - unset($v[ 'short' ]); - $active_tips[ $goods_id ][ $join_type ][ 'list' ][] = $v; - $active_tips[ $goods_id ][ $join_type ][ 'name' ] .= $v[ 'name' ] . PHP_EOL; - } else { - // 防止未知数据 - unset($active_tips[ $goods_id ][ $join_type ]); - } - } - } - foreach ($goods_data as &$item) { - $item[ 'active' ] = $active_tips[ $item[ 'goods_id' ] ] ?? []; - } - } - return $goods_data; - } - - /** - * 获取商品信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'goods_id,goods_name,sub_title,goods_type,goods_cover,goods_image,goods_video,goods_desc,brand_id,goods_category,label_ids,service_ids,unit,stock,sale_num,virtual_sale_num,is_limit,limit_type,max_buy,min_buy,status,sort,delivery_type,is_free_shipping,fee_type,delivery_money,delivery_template_id,supplier_id,create_time,update_time,member_discount,poster_id,form_id,diy_detail_id'; - $info = $this->model->field($field)->where([ [ 'goods_id', '=', $id ] ])->findOrEmpty()->toArray(); - return $info; - } - - /** - * 添加商品 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - try { - Db::startTrans(); - $goods_sku_model = new GoodsSku(); - $goods_spec_model = new GoodsSpec(); - $goods_stat_model = new Stat(); - - // 商品封面 - if (!empty($data[ 'goods_image' ])) $data[ 'goods_cover' ] = explode(',', $data[ 'goods_image' ])[ 0 ]; - - $goods_data = [ - 'goods_name' => $data[ 'goods_name' ], - 'sub_title' => $data[ 'sub_title' ], - 'goods_type' => $data[ 'goods_type' ], - 'goods_cover' => $data[ 'goods_cover' ], - 'goods_image' => $data[ 'goods_image' ], - 'goods_image_width' => $data[ 'goods_image_width' ] ?? 0, - 'goods_image_height' => $data[ 'goods_image_height' ] ?? 0, - 'goods_video' => $data[ 'goods_video' ], - 'goods_category' => array_map(function ($item) { - return (string) $item; - }, $data[ 'goods_category' ]), - 'goods_desc' => $data[ 'goods_desc' ], - 'brand_id' => $data[ 'brand_id' ], - 'label_ids' => array_map(function ($item) { - return (string) $item; - }, $data[ 'label_ids' ]), - 'service_ids' => array_map(function ($item) { - return (string) $item; - }, $data[ 'service_ids' ]), - 'unit' => $data[ 'unit' ], - 'stock' => $data[ 'stock' ], - 'virtual_sale_num' => $data[ 'virtual_sale_num' ], - 'is_limit' => $data[ 'is_limit' ], - 'limit_type' => $data[ 'limit_type' ], - 'max_buy' => $data[ 'max_buy' ], - 'min_buy' => $data[ 'min_buy' ], - 'is_gift' => $data[ 'is_gift' ], - 'status' => $data[ 'status' ], - 'sort' => $data[ 'sort' ], - 'attr_ids' => $data[ 'attr_ids' ], - 'attr_format' => $data[ 'attr_format' ], - 'delivery_type' => $data[ 'delivery_type' ], - 'is_free_shipping' => $data[ 'is_free_shipping' ], - 'fee_type' => $data[ 'fee_type' ], - 'delivery_money' => $data[ 'delivery_money' ], - 'delivery_template_id' => $data[ 'delivery_template_id' ], - 'supplier_id' => $data[ 'supplier_id' ], - 'member_discount' => $data[ 'member_discount' ], - 'poster_id' => $data[ 'poster_id' ], - 'form_id' => $data[ 'form_id' ], - 'diy_detail_id' => $data[ 'diy_detail_id' ], - 'create_time' => time() - ]; - $res = $this->model->create($goods_data); - - $sku_data = []; - if ($data[ 'spec_type' ] == 'single') { - if (!empty($data[ 'sku_no' ])) { - ( new ConfigService() )->verifySkuNo([ 'sku_no' => $data[ 'sku_no' ] ]); - } - // 单规格 - $sku_data = [ - 'sku_name' => '', - 'sku_image' => $data[ 'goods_cover' ], - 'sku_no' => $data[ 'sku_no' ], - 'goods_id' => $res->goods_id, - 'sku_spec_format' => '', // sku规格格式 - 'price' => $data[ 'price' ], - 'market_price' => $data[ 'market_price' ], - 'sale_price' => $data[ 'price' ], - 'cost_price' => $data[ 'cost_price' ], - 'stock' => $data[ 'stock' ], - 'weight' => $data[ 'weight' ], - 'volume' => $data[ 'volume' ], - 'is_default' => 1 - ]; - $goods_sku_model->save($sku_data); - - } elseif ($data[ 'spec_type' ] == 'multi') { - $sku_no = implode(',', array_column($data[ 'goods_sku_data' ] ?? [], 'sku_no')); - if (!empty($sku_no)) { - ( new ConfigService() )->verifySkuNo([ 'sku_no' => $sku_no ]); - } - // 多规格数据 - $default_spec_count = 0; - foreach ($data[ 'goods_sku_data' ] as $k => $v) { - $sku_spec_format = []; - foreach ($v[ 'sku_spec' ] as $ck => $cv) { - $sku_spec_format[] = $cv[ 'spec_value_name' ]; - } - $sku_data[] = [ - 'sku_name' => $v[ 'spec_name' ], - 'sku_image' => !empty($v[ 'sku_image' ]) ? $v[ 'sku_image' ] : $data[ 'goods_cover' ], - 'sku_no' => $v[ 'sku_no' ], - 'goods_id' => $res->goods_id, - 'sku_spec_format' => implode(',', $sku_spec_format), // sku规格格式 - 'price' => $v[ 'price' ], - 'market_price' => $v[ 'market_price' ], - 'sale_price' => $v[ 'price' ], - 'cost_price' => $v[ 'cost_price' ], - 'stock' => $v[ 'stock' ], - 'weight' => $v[ 'weight' ], - 'volume' => $v[ 'volume' ], - 'is_default' => $v[ 'is_default' ] - ]; - if ($v[ 'is_default' ] == 1) $default_spec_count++; - } - - if ($default_spec_count == 0) throw new AdminException('SHOP_GOODS_NOT_HAS_DEFAULT_SPEC'); - - $goods_sku_model->insertAll($sku_data); - - // 商品规格值 - $spec_data = []; - foreach ($data[ 'goods_spec_format' ] as $k => $v) { - $spec_values = []; - foreach ($v[ 'values' ] as $ck => $cv) { - $spec_values[] = $cv[ 'spec_value_name' ]; - } - $spec_data[] = [ - 'goods_id' => $res->goods_id, - 'spec_name' => $v[ 'spec_name' ], - 'spec_values' => implode(',', $spec_values) - ]; - } - $goods_spec_model->insertAll($spec_data); - - } - - //添加商品统计表数据 - $goods_stat_data = [ - 'date' => date('Y-m-d'), - 'date_time' => strtotime(date('Y-m-d')), - 'goods_id' => $res->goods_id, - ]; - $goods_stat_model->create($goods_stat_data); - - Db::commit(); - - event('AfterGoodsEdit', [ - 'goods_id' => $res->goods_id, - 'goods_data' => $goods_data, - 'sku_data' => $sku_data - ]); - - return $res->goods_id; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 商品编辑 - * @param int $goods_id - * @param array $data - * @return bool - */ - public function edit(int $goods_id, array $data) - { - try { - Db::startTrans(); - - $goods_sku_model = new GoodsSku(); - $goods_spec_model = new GoodsSpec(); - $order_goods_model = new OrderGoods(); - $goods_price = 0; - // 查询商品参与营销活动的数量 - $active_goods_count = $this->getActiveGoodsCount($goods_id); - if ($data[ 'status' ] == 0) { - if ($active_goods_count > 0) { - throw new AdminException('SHOP_GOODS_PARTICIPATE_IN_ACTIVE_DISABLED_EDIT'); - } - } - - // 商品封面 - if (!empty($data[ 'goods_image' ])) $data[ 'goods_cover' ] = explode(',', $data[ 'goods_image' ])[ 0 ]; - - $goods_data = [ - 'goods_name' => $data[ 'goods_name' ], - 'sub_title' => $data[ 'sub_title' ], - 'goods_type' => $data[ 'goods_type' ], - 'goods_cover' => $data[ 'goods_cover' ], - 'goods_image' => $data[ 'goods_image' ], - 'goods_image_width' => $data[ 'goods_image_width' ] ?? 0, - 'goods_image_height' => $data[ 'goods_image_height' ] ?? 0, - 'goods_video' => $data[ 'goods_video' ], - 'goods_category' => array_map(function ($item) { - return (string) $item; - }, $data[ 'goods_category' ]), - 'goods_desc' => $data[ 'goods_desc' ], - 'brand_id' => $data[ 'brand_id' ], - 'label_ids' => array_map(function ($item) { - return (string) $item; - }, $data[ 'label_ids' ]), - 'service_ids' => array_map(function ($item) { - return (string) $item; - }, $data[ 'service_ids' ]), - 'unit' => $data[ 'unit' ], - 'stock' => $data[ 'stock' ], - 'virtual_sale_num' => $data[ 'virtual_sale_num' ], - 'is_limit' => $data[ 'is_limit' ], - 'limit_type' => $data[ 'limit_type' ], - 'max_buy' => $data[ 'max_buy' ], - 'min_buy' => $data[ 'min_buy' ], - 'is_gift' => $data[ 'is_gift' ], - 'status' => $data[ 'status' ], - 'sort' => $data[ 'sort' ], - 'attr_ids' => $data[ 'attr_ids' ], - 'attr_format' => $data[ 'attr_format' ], - 'delivery_type' => $data[ 'delivery_type' ], - 'is_free_shipping' => $data[ 'is_free_shipping' ], - 'fee_type' => $data[ 'fee_type' ], - 'delivery_money' => $data[ 'delivery_money' ], - 'delivery_template_id' => $data[ 'delivery_template_id' ], - 'supplier_id' => $data[ 'supplier_id' ], - 'member_discount' => $data[ 'member_discount' ], - 'poster_id' => $data[ 'poster_id' ], - 'form_id' => $data[ 'form_id' ], - 'diy_detail_id' => $data[ 'diy_detail_id' ], - 'update_time' => time() - ]; - - $this->model->where([ [ 'goods_id', '=', $goods_id ] ])->update($goods_data); - $sku_data = []; - if ($data[ 'spec_type' ] == 'single') { - if (!empty($data[ 'sku_no' ])) { - $check = [ 'sku_no' => $data[ 'sku_no' ], 'goods_id' => $goods_id ]; - ( new ConfigService() )->verifySkuNo($check); - } - // 单规格 - $sku_data = [ - 'sku_name' => '', - 'sku_image' => $data[ 'goods_cover' ], - 'sku_no' => $data[ 'sku_no' ], - 'goods_id' => $goods_id, - 'sku_spec_format' => '', // sku规格格式 - 'market_price' => $data[ 'market_price' ], - 'cost_price' => $data[ 'cost_price' ], - 'weight' => $data[ 'weight' ], - 'volume' => $data[ 'volume' ], - 'stock' => $data[ 'stock' ], - 'is_default' => 1 - ]; - - // 未参与营销活动,则允许修改 原价、销售价 - if ($active_goods_count == 0) { - $sku_data[ 'price' ] = $data[ 'price' ]; - $sku_data[ 'sale_price' ] = $data[ 'price' ]; - } - - $sku_count = $goods_sku_model->where([ [ 'goods_id', '=', $goods_id ] ])->count(); - if ($sku_count > 1) { - - // 规格项发生变化,删除旧规格,添加新规格重新生成 - $goods_sku_model->where([ [ 'goods_id', '=', $goods_id ] ])->delete(); - - // 防止存在遗留规格项,删除旧规格 - $goods_spec_model->where([ [ 'goods_id', '=', $goods_id ] ])->delete(); - - // 新增规格 - $goods_sku_model->create($sku_data); - - } else { - - $goods_sku_model->where([ [ 'goods_id', '=', $goods_id ] ])->update($sku_data); - - // 防止存在遗留规格项,删除旧规格 - $goods_spec_model->where([ [ 'goods_id', '=', $goods_id ] ])->delete(); - } - $goods_price = $sku_data['price'] ?? $goods_sku_model->price; - } elseif ($data[ 'spec_type' ] == 'multi') { - $sku_no = implode(',', array_column($data[ 'goods_sku_data' ] ?? [], 'sku_no')); - if (!empty($sku_no)) { - $check = [ 'sku_no' => $sku_no, 'goods_id' => $goods_id ]; - ( new ConfigService() )->verifySkuNo($check); - } - // 多规格数据 - $first_sku_data = reset($data[ 'goods_sku_data' ]); - - // 商品正在参与营销活动,禁止修改规格 - if ($active_goods_count > 0 && empty($first_sku_data[ 'sku_id' ])) { - throw new AdminException('SHOP_GOODS_PARTICIPATE_IN_ACTIVE_DISABLED_EDIT'); - } - - // 检测规格项是否发生变化 - if (!empty($first_sku_data[ 'sku_id' ])) { - // 规格项没有变化,修改/新增规格数据 - - $sku_id_arr = []; - $default_spec_count = 0; - foreach ($data[ 'goods_sku_data' ] as $k => $v) { - $sku_spec_format = []; - foreach ($v[ 'sku_spec' ] as $ck => $cv) { - $sku_spec_format[] = $cv[ 'spec_value_name' ]; - } - $sku_data = [ - 'sku_name' => $v[ 'spec_name' ], - 'sku_image' => !empty($v[ 'sku_image' ]) ? $v[ 'sku_image' ] : $data[ 'goods_cover' ], - 'sku_no' => $v[ 'sku_no' ], - 'goods_id' => $goods_id, - 'sku_spec_format' => implode(',', $sku_spec_format), // sku规格格式 - 'market_price' => $v[ 'market_price' ], - 'cost_price' => $v[ 'cost_price' ], - 'weight' => $v[ 'weight' ], - 'volume' => $v[ 'volume' ], - 'stock' => $v[ 'stock' ], - 'is_default' => $v[ 'is_default' ] - ]; - - // 未参与营销活动,则允许修改 原价、销售价 - if ($active_goods_count == 0) { - $sku_data[ 'price' ] = $v[ 'price' ]; - $sku_data[ 'sale_price' ] = $v[ 'price' ]; - } - - if (!empty($v[ 'sku_id' ])) { - // 修改规格 - $sku_id_arr[] = $v[ 'sku_id' ]; - $goods_sku_model->where([ [ 'sku_id', '=', $v[ 'sku_id' ] ], [ 'goods_id', '=', $goods_id ] ])->update($sku_data); - } else { - // 新增规格 - $sku_model = $goods_sku_model->create($sku_data); - $sku_id_arr[] = $sku_model->sku_id; - } - if ($v[ 'is_default' ] == 1) { - - $goods_price = $v[ 'price' ] ?? $goods_sku_model->price; - $default_spec_count++; - } - } - - // 校验默认必须存在默认规格 - if ($default_spec_count == 0) throw new AdminException('SHOP_GOODS_NOT_HAS_DEFAULT_SPEC'); - - $spec_id_list = $goods_spec_model->withSearch([ "goods_id" ], [ 'goods_id' => $goods_id ])->field('spec_id')->select()->toArray(); - $spec_id_list = array_column($spec_id_list, 'spec_id'); - - // 商品规格值 - foreach ($data[ 'goods_spec_format' ] as $k => $v) { - $spec_values = []; - foreach ($v[ 'values' ] as $ck => $cv) { - $spec_values[] = $cv[ 'spec_value_name' ]; - } - $spec_data = [ - 'goods_id' => $goods_id, - 'spec_name' => $v[ 'spec_name' ], - 'spec_values' => implode(',', $spec_values) - ]; - if (!empty($v[ 'spec_id' ])) { - // 修改规格值 - $goods_spec_model->where([ [ 'goods_id', '=', $goods_id ], [ 'spec_id', '=', $v[ 'spec_id' ] ] ])->update($spec_data); - foreach ($spec_id_list as $ck => $cv) { - if ($v[ 'spec_id' ] == $cv) { - unset($spec_id_list[ $ck ]); - } - } - - } else { - // 添加规格值 - $goods_spec_model->save($spec_data); - } - } - - // 移除不存在的规格项 - if (!empty($spec_id_list)) { - $goods_spec_model->where([ [ 'spec_id', 'in', implode(',', $spec_id_list) ] ])->delete(); - } - - // 移除不存在的商品SKU - $sku_id_list = $goods_sku_model->withSearch([ "goods_id" ], [ 'goods_id' => $goods_id ])->field('sku_id')->select()->toArray(); - $sku_id_list = array_column($sku_id_list, 'sku_id'); - foreach ($sku_id_list as $k => $v) { - foreach ($sku_id_arr as $ck => $cv) { - if ($v == $cv) { - unset($sku_id_list[ $k ]); - } - } - } - $sku_id_list = array_values($sku_id_list); - - if (!empty($sku_id_list)) { - - // 检测订单是否存在要删除的商品 - $order_where = [ - [ 'orderMain.status', 'in', [ OrderDict::NORMAL, OrderDict::WAIT_DELIVERY, OrderDict::WAIT_TAKE ] ], // 排除已完成、已关闭状态 - [ 'goods_id', '=', $goods_id ], - [ 'sku_id', 'in', $sku_id_list ] - ]; - $order_goods_count = $order_goods_model - ->withJoin([ 'orderMain' ]) - ->where($order_where)->count(); - - if ($order_goods_count > 0) { - Db::rollback(); - throw new CommonException('EXIST_ORDER_NOT_DELETE_GOODS'); - } - - $goods_sku_model->where([ [ 'sku_id', 'in', implode(',', $sku_id_list) ] ])->delete(); - } - - } else { - - // 检测订单是否存在要删除的商品 - $order_where = [ - [ 'orderMain.status', 'in', [ 1, 2, 3 ] ], // 排除已完成、已关闭状态 - [ 'goods_id', '=', $goods_id ] - ]; - $order_goods_count = $order_goods_model - ->withJoin([ 'orderMain' ]) - ->where($order_where)->count(); - - if ($order_goods_count > 0) { - Db::rollback(); - throw new CommonException('EXIST_ORDER_NOT_EDIT_GOODS'); - } - - // 规格项发生变化,删除旧规格,添加新规格重新生成 - $goods_sku_model->where([ [ 'goods_id', '=', $goods_id ] ])->delete(); - $goods_spec_model->where([ [ 'goods_id', '=', $goods_id ] ])->delete(); - - $default_spec_count = 0; - foreach ($data[ 'goods_sku_data' ] as $k => $v) { - $sku_spec_format = []; - foreach ($v[ 'sku_spec' ] as $ck => $cv) { - $sku_spec_format[] = $cv[ 'spec_value_name' ]; - } - $sku_data[] = [ - 'sku_name' => $v[ 'spec_name' ], - 'sku_image' => !empty($v[ 'sku_image' ]) ? $v[ 'sku_image' ] : $data[ 'goods_cover' ], - 'sku_no' => $v[ 'sku_no' ], - 'goods_id' => $goods_id, - 'sku_spec_format' => implode(',', $sku_spec_format), // sku规格格式 - 'price' => $v[ 'price' ], - 'sale_price' => $v[ 'price' ], - 'market_price' => $v[ 'market_price' ], - 'cost_price' => $v[ 'cost_price' ], - 'stock' => $v[ 'stock' ], - 'weight' => $v[ 'weight' ], - 'volume' => $v[ 'volume' ], - 'is_default' => $v[ 'is_default' ] - ]; - if ($v[ 'is_default' ] == 1) $default_spec_count++; - } - - // 校验默认必须存在默认规格 - if ($default_spec_count == 0) throw new AdminException('SHOP_GOODS_NOT_HAS_DEFAULT_SPEC'); - - $goods_sku_model->saveAll($sku_data); - - // 商品规格值 - $spec_data = []; - foreach ($data[ 'goods_spec_format' ] as $k => $v) { - $spec_values = []; - foreach ($v[ 'values' ] as $ck => $cv) { - $spec_values[] = $cv[ 'spec_value_name' ]; - } - $spec_data[] = [ - 'goods_id' => $goods_id, - 'spec_name' => $v[ 'spec_name' ], - 'spec_values' => implode(',', $spec_values) - ]; - } - $goods_spec_model->saveAll($spec_data); - - } - - } - - Db::commit(); - - event('AfterGoodsEdit', [ - 'goods_id' => $goods_id, - 'goods_data' => $goods_data, - 'sku_data' => $sku_data - ]); - event('TreasureDataSync',[ - 'relate_id'=>$goods_id, - 'relate_type'=>'shop', - 'treasure_name'=>$data['goods_name'], - 'treasure_sub_name'=>$data['sub_title'], - 'treasure_image'=>$data['goods_image'], - 'treasure_price'=>$goods_price, - ]); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 删除商品 - * @param $goods_ids - * @return bool - */ - public function del($data) - { - $is_all = $data[ 'is_all' ]; - $goods_ids = $data[ 'goods_ids' ]; - $where = $data[ 'where' ]; - // 查询商品参与营销活动的数量 - $active_goods_count = $this->getActiveGoodsCount($goods_ids, $is_all); - if ($active_goods_count > 0) { - throw new AdminException('SHOP_GOODS_PARTICIPATE_IN_ACTIVE_DISABLED_EDIT'); - } - // 查询商品是否参与礼品卡活动 - $is_connected = event('GoodsIsConnectedCard', [ 'is_all' => $is_all, 'where' => $where, 'goods_ids' => $goods_ids ]); - if (!empty($is_connected) && isset($is_connected[ 0 ]) && $is_connected[ 0 ]) { - throw new AdminException('GOODS_PARTICIPATE_IN_ACTIVE_DISABLED_DELETE'); - } - - // 删除之前下架商品 - if (!$is_all) { - $query = $this->model->where([ - [ 'goods_id', 'in', $goods_ids ] - ]); - $update = [ 'status' => 0, 'delete_time' => time() ]; - } else { - $query = $this->getBatchAllQuery($data[ 'where' ], $goods_ids); - $update = [ 'goods.status' => 0, 'goods.delete_time' => time() ]; - } - return $query->update($update); - } - - /** - * 恢复商品 - * @param $goods_ids - * @return bool - */ - public function recycle($goods_ids) - { - $res = $this->model->restore([ [ 'goods_id', 'in', $goods_ids ] ]); - return $res; - } - - /** - * 获取商品类型 - * @return array|mixed|string - */ - public function getType() - { - return GoodsDict::getType(); - } - - /** - * 修改商品排序号 - * @param array $data - * @return Goods|bool - */ - public function editSort($data) - { - return $this->model->where([ [ 'goods_id', '=', $data[ 'goods_id' ] ] ])->update([ 'sort' => $data[ 'sort' ] ]); - } - - /** - * 修改商品上下架状态 - * @param $data - * @return Goods - */ - public function editStatus($data) - { - $is_all = $data[ 'is_all' ]; - $explode_goods_ids = []; - if ($data[ 'status' ] == 0) { - // 查询商品参与营销活动的数量 - $explode_goods_ids = $this->getActiveGoodsIds($data[ 'goods_ids' ], $is_all, $data[ 'where' ]); - - } - if (!$is_all) { - $res = $this->model->where([ - [ 'goods_id', 'in', $data[ 'goods_ids' ] ] - ])->whereNotIn('goods_id', $explode_goods_ids)->update([ 'status' => $data[ 'status' ] ]); - } else { - $explode_goods_ids = array_merge($explode_goods_ids, $data[ 'goods_ids' ]); - $res = $this->getBatchAllQuery($data[ 'where' ], $explode_goods_ids)->update([ 'goods.status' => $data[ 'status' ] ]); - } - return $res; - } - - /** - * 修改商品上下架状态(单商品) - * @param $data - * @return bool - */ - public function editSingleStatus($data) - { - if ($data[ 'status' ] == 0) { - // 查询商品参与营销活动的数量 - $explode_goods_ids = $this->getActiveGoodsIds($data[ 'goods_id' ]); - } - if (!empty($explode_goods_ids)) throw new AdminException('SHOP_GOODS_PARTICIPATE_IN_ACTIVE_DISABLED_EDIT'); - - $this->model->where([ - [ 'goods_id', '=', $data[ 'goods_id' ] ] - ])->update([ 'status' => $data[ 'status' ] ]); - return true; - } - - /** - * 复制商品 - * @param int $goods_id - * @return mixed - */ - public function copy(int $goods_id) - { - try { - Db::startTrans(); - $goods_sku_model = new GoodsSku(); - $goods_spec_model = new GoodsSpec(); - - // 查询商品信息 - $field = 'goods_name,sub_title,goods_type,goods_cover,goods_image,goods_video,goods_desc,brand_id,goods_category,label_ids,service_ids,unit,stock,virtual_sale_num,is_limit,limit_type,max_buy,min_buy,status,sort,delivery_type,is_free_shipping,fee_type,delivery_money,delivery_template_id,supplier_id,attr_ids,attr_format,virtual_auto_delivery,virtual_receive_type,virtual_verify_type,virtual_indate,poster_id,form_id'; - - $goods_data = $this->model->field($field)->where([ [ 'goods_id', '=', $goods_id ] ])->findOrEmpty()->toArray(); - if (empty($goods_data)) { - throw new AdminException('SHOP_GOODS_NOT_EXIST'); - } - - // 初始化数据 - $goods_data[ 'goods_name' ] .= '_副本'; - $goods_data[ 'sale_num' ] = 0; - $goods_data[ 'create_time' ] = time(); - $goods_data[ 'sort' ] = 0; - $goods_data[ 'status' ] = 0; - - // 添加商品 - $res = $this->model->create($goods_data); - - // 查询商品规格信息 - $sku_field = 'sku_id,sku_name,sku_image,sku_no,goods_id,sku_spec_format,price,market_price,cost_price,stock,weight,volume,is_default'; - - $sku_order = 'sku_id asc'; - $goods_sku_list = $goods_sku_model->withSearch([ "goods_id" ], [ 'goods_id' => $goods_id ])->field($sku_field)->order($sku_order)->select()->toArray(); - - // 添加商品规格 - foreach ($goods_sku_list as $k => $v) { - unset($goods_sku_list[ $k ][ 'sku_id' ]); - $goods_sku_list[ $k ][ 'sale_num' ] = 0; - $goods_sku_list[ $k ][ 'goods_id' ] = $res->goods_id; - } - $goods_sku_model->saveAll($goods_sku_list); - - // 查询规格值信息 - $spec_field = 'spec_id,goods_id,spec_name,spec_values'; - $spec_order = 'spec_id asc'; - $spec_list = $goods_spec_model->withSearch([ "goods_id" ], [ 'goods_id' => $goods_id ])->field($spec_field)->order($spec_order)->select()->toArray(); - - // 添加规格项/值 - if (!empty($spec_list)) { - foreach ($spec_list as $k => $v) { - unset($spec_list[ $k ][ 'spec_id' ]); - $spec_list[ $k ][ 'goods_id' ] = $res->goods_id; - } - $goods_spec_model->saveAll($spec_list); - } - - Db::commit(); - return $res->goods_id; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 查询回收站商品分页列表 - * @param array $where - * @return array - * @throws \think\db\exception\DbException - */ - public function getRecyclePage(array $where = []) - { - $field = 'goods_id,goods_name,goods_type,goods_cover,goods_category,unit,stock,sale_num,virtual_sale_num,status,create_time,update_time'; - $order = 'create_time desc'; - $sku_where = [ - [ 'goodsSku.is_default', '=', 1 ], - ]; - if (!empty($where[ 'order' ])) { - $order = $where[ 'order' ] . ' ' . $where[ 'sort' ]; - } - - $search_model = $this->model->onlyTrashed()->withSearch([ "goods_id", "goods_name", "goods_type", "goods_category" ], $where) - ->field($field)->withJoin([ - 'goodsSku' => [ 'sku_id', 'sku_name', 'goods_id', 'price', 'stock' ], - ])->where($sku_where)->order($order)->append([ 'goods_type_name', 'goods_edit_path', 'goods_cover_thumb_small' ]); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取商品选择分页列表 - * @param array $where - * @return array - */ - public function getSelectPage(array $where = []) - { - $field = 'goods_id, goods_name, goods_type, goods_cover,goods_image, stock,sub_title,goods_desc,is_gift'; - $order = 'sort desc,create_time desc'; - - $sku_where = [ - [ 'goodsSku.is_default', '=', 1 ], - ]; - if (!empty($where[ 'start_price' ]) && !empty($where[ 'end_price' ])) { - $money = [ $where[ 'start_price' ], $where[ 'end_price' ] ]; - sort($money); - $sku_where[] = [ 'goodsSku.price', 'between', $money ]; - } else if (!empty($where[ 'start_price' ])) { - $sku_where[] = [ 'goodsSku.price', '>=', $where[ 'start_price' ] ]; - } else if (!empty($where[ 'end_price' ])) { - $sku_where[] = [ 'goodsSku.price', '<=', $where[ 'end_price' ] ]; - } - - if (isset($where[ 'is_gift' ]) && $where[ 'is_gift' ] == GoodsDict::IS_GIFT) { - $sku_where[] = [ 'goods.is_gift', 'in', [ GoodsDict::NOT_IS_GIFT, GoodsDict::IS_GIFT ] ]; - } else { - $sku_where[] = [ 'goods.is_gift', '=', GoodsDict::NOT_IS_GIFT ]; - } - - if (!empty($where[ 'keyword' ])) { - $sku_where[] = [ 'goods_name|sub_title', 'like', '%' . $where[ 'keyword' ] . '%' ]; - } - - // 查询已选的 - if (!empty($where[ 'sku_ids' ])) { - $goods_sku_model = new GoodsSku(); - $goods_ids = $goods_sku_model->where([ - [ 'sku_id', 'in', $where[ 'sku_ids' ] ] - ])->field('goods_id')->select()->toArray(); - if (!empty($goods_ids)) { - $goods_ids = array_column($goods_ids, 'goods_id'); - } - } - - if (!empty($goods_ids) && empty($where[ 'goods_ids' ])) { - $where[ 'goods_ids' ] = $goods_ids; - } - if (!empty($where[ 'goods_type' ])) { - $sku_where[] = [ 'goods.goods_type', '=', $where[ 'goods_type' ] ]; - } - - if ($where[ 'select_type' ] == 'all') { - $sku_where[] = [ 'goods.stock', '>', 0 ]; - $sku_where[] = [ 'status', '=', 1 ]; - } - if ($where[ 'select_type' ] == 'selected') { - $sku_where[] = [ 'goods.goods_id', 'in', $where[ 'goods_ids' ] ]; - } - - $verify_goods_ids = []; - $verify_sku_ids = []; - // 检测商品id集合是否存在,移除不存在的商品id,纠正数据准确性 - if (!empty($where[ 'verify_goods_ids' ])) { - $verify_goods_ids = $this->model->where([ - [ 'goods_id', 'in', $where[ 'verify_goods_ids' ] ], - [ 'status', '=', 1 ] - ])->field('goods_id')->select()->toArray(); - - if (!empty($verify_goods_ids)) { - $verify_goods_ids = array_column($verify_goods_ids, 'goods_id'); - } - } - - // 检测商品id集合是否存在,移除不存在的商品id,纠正数据准确性 - if (!empty($where[ 'verify_sku_ids' ])) { - $goods_sku_model = new GoodsSku(); - $verify_sku_ids = $goods_sku_model->where([ - [ 'sku_id', 'in', $where[ 'verify_sku_ids' ] ] - ])->field('sku_id')->select()->toArray(); - - if (!empty($verify_sku_ids)) { - $verify_sku_ids = array_column($verify_sku_ids, 'sku_id'); - } - } - - $search_model = $this->model - ->withSearch([ "goods_category", "goods_type" ], $where) - ->field($field) - ->withJoin([ - 'goodsSku' => [ 'sku_id', 'sku_name', 'goods_id', 'price', 'stock', 'sku_spec_format' ], - ]) - ->with([ - 'skuList' - ]) - ->where($sku_where)->order($order)->append([ 'goods_type_name', 'goods_cover_thumb_small', 'goods_cover_thumb_mid' ]); - $list = $this->pageQuery($search_model); - - $list[ 'verify_goods_ids' ] = $verify_goods_ids; - $list[ 'verify_sku_ids' ] = $verify_sku_ids; - - return $list; - } - - /** - * 获取商品选择分页列表 - * @param array $where - * @return array - */ - public function getSelectSku(array $where = []) - { - $field = 'goods_id, goods_name, goods_type, goods_cover, stock,is_gift'; - $order = 'sort desc,create_time desc'; - - $select_goods_list = [];// 已选商品列表 - - if (isset($where[ 'is_gift' ]) && $where[ 'is_gift' ] == GoodsDict::IS_GIFT) { - $sku_where[] = [ 'goods.is_gift', 'in', [ GoodsDict::NOT_IS_GIFT, GoodsDict::IS_GIFT ] ]; - } else { - $sku_where[] = [ 'goods.is_gift', '=', GoodsDict::NOT_IS_GIFT ]; - } - - // 检测商品id集合是否存在,移除不存在的商品id,纠正数据准确性 - if (!empty($where[ 'verify_goods_ids' ])) { - $verify_goods_ids = $this->model->where([ - [ 'goods_id', 'in', $where[ 'verify_goods_ids' ] ], - [ 'status', '=', 1 ] - ])->field('goods_id')->select()->toArray(); - - if (!empty($verify_goods_ids)) { - $verify_goods_ids = array_column($verify_goods_ids, 'goods_id'); - } - - $select_goods_list = $this->model - ->field($field) - ->withJoin([ - 'goodsSku' => [ 'sku_id', 'sku_name', 'goods_id', 'price', 'stock', 'sku_spec_format' ], - ]) - ->with([ - 'skuList' - ]) - ->where([ - [ 'goodsSku.is_default', '=', 1 ], - [ 'goods.goods_id', 'in', $verify_goods_ids ] - ]) - ->where($sku_where) - ->order($order)->append([ 'goods_type_name', 'goods_cover_thumb_small', 'goods_cover_thumb_mid' ]) - ->select()->toArray(); - } - - // 检测商品id集合是否存在,移除不存在的商品id,纠正数据准确性 - if (!empty($where[ 'verify_sku_ids' ])) { - $goods_sku_model = new GoodsSku(); - $verify_sku_ids = $goods_sku_model->where([ - [ 'sku_id', 'in', $where[ 'verify_sku_ids' ] ] - ])->field('sku_id')->select()->toArray(); - - if (!empty($verify_sku_ids)) { - $verify_sku_ids = array_column($verify_sku_ids, 'sku_id'); - } - - $goods_ids = $goods_sku_model->where([ - [ 'sku_id', 'in', $verify_sku_ids ] - ])->field('goods_id')->select()->toArray(); - if (!empty($goods_ids)) { - $goods_ids = array_column($goods_ids, 'goods_id'); - $goods_ids = array_unique($goods_ids); - } - - $select_goods_list = $this->model - ->field($field) - ->withJoin([ - 'goodsSku' => [ 'sku_id', 'sku_name', 'goods_id', 'price', 'stock', 'sku_spec_format' ], - ]) - ->with([ - 'skuList' - ]) - ->where([ - [ 'goodsSku.is_default', '=', 1 ], - [ 'goods.goods_id', 'in', $goods_ids ] - ]) - ->where($sku_where) - ->order($order)->append([ 'goods_type_name', 'goods_cover_thumb_small', 'goods_cover_thumb_mid' ]) - ->select()->toArray(); - } - - return $select_goods_list; - } - - /** - * 获取商品选择分页列表(代客下单专用) - * @param array $where - * @return array - */ - public function getBuyGoodsSelect(array $where = []) - { - $field = 'goods_id, goods_name, goods_type, goods_cover,goods_image, stock,sub_title,goods_desc,is_limit,limit_type,max_buy,min_buy,member_discount'; - $order = 'sort desc,create_time desc'; - - $sku_where = [ - [ 'goodsSku.is_default', '=', 1 ], - [ 'goods.stock', '>', 0 ], - [ 'status', '=', 1 ], - [ 'goods.is_gift', '=', GoodsDict::NOT_IS_GIFT ] - ]; - - if (!empty($where[ 'keyword' ])) { - $sku_where[] = [ 'goods_name|sub_title', 'like', '%' . $where[ 'keyword' ] . '%' ]; - } - - $search_model = $this->model - ->withSearch([ "goods_category", "goods_type" ], $where) - ->field($field) - ->withJoin([ - 'goodsSku' => [ 'sku_id', 'sku_name', 'goods_id', 'price', 'stock', 'sku_spec_format', 'market_price', 'sale_price', 'member_price' ], - ]) - ->where($sku_where)->order($order)->append([ 'goods_type_name', 'goods_cover_thumb_small', 'goods_cover_thumb_mid' ]); - $list = $this->pageQuery($search_model); - if (!empty($where[ 'member_id' ])) { - $member_info = $this->getMemberInfo($where[ 'member_id' ]); - foreach ($list[ 'data' ] as $k => &$v) { - if (!empty($v[ 'goodsSku' ])) { - $v[ 'goodsSku' ][ 'member_price' ] = $this->getMemberPrice($member_info, $v[ 'member_discount' ], $v[ 'goodsSku' ][ 'member_price' ], $v[ 'goodsSku' ][ 'price' ]); - } - // 限购查询当前会员已购数量 - $has_buy = ( new CoreGoodsLimitBuyService() )->getGoodsHasBuyNumber($where[ 'member_id' ], $v[ 'goods_id' ]); - $v[ 'has_buy' ] = $has_buy; - // 满减活动 - $manjian_info = ( new ManjianService() )->getManjianInfo([ 'goods_id' => $v[ 'goods_id' ], 'sku_id' => $v[ 'goodsSku' ][ 'sku_id' ], 'member_id' => $where[ 'member_id' ] ]); - $v[ 'manjian_info' ] = $manjian_info; - } - } - return $list; - } - - /** - * 获取已选商品分页列表(代客下单专用) - * @param array $where - * @return array - */ - public function getBuyGoodsSelected(array $where = []) - { - $field = 'sku_id, goods_id, sku_name, sku_image, price, stock, member_price, sale_price'; - $goods_sku_model = new GoodsSku(); - $select_goods_list = $goods_sku_model->where([ - [ 'sku_id', 'in', $where[ 'sku_ids' ] ] - ])->with([ 'goods' ])->field($field)->append([ 'goods_cover_thumb_small', 'goods_cover_thumb_mid' ])->select()->toArray(); - if (!empty($where[ 'member_id' ])) { - $member_info = $this->getMemberInfo($where[ 'member_id' ]); - foreach ($select_goods_list as $k => &$v) { - if (!empty($v[ 'goods' ])) { - $v[ 'member_price' ] = $this->getMemberPrice($member_info, $v[ 'goods' ][ 'member_discount' ], $v[ 'member_price' ], $v[ 'price' ]); - } - // 限购查询当前会员已购数量 - $has_buy = ( new CoreGoodsLimitBuyService() )->getGoodsHasBuyNumber($where[ 'member_id' ], $v[ 'goods_id' ]); - $v[ 'has_buy' ] = $has_buy; - // 满减活动 - $manjian_info = ( new ManjianService() )->getManjianInfo([ 'goods_id' => $v[ 'goods_id' ], 'sku_id' => $v[ 'sku_id' ], 'member_id' => $where[ 'member_id' ] ]); - $v[ 'manjian_info' ] = $manjian_info; - } - } - return $select_goods_list; - } - - /** - * 获取商品规格信息,切换规格(代客下单专用) - * @param array $data - * @return array - */ - public function getBuySkuSelect(array $data) - { - - $field = 'sku_id, sku_name, sku_image, sku_no, goods_id, sku_spec_format, price, market_price, sale_price, stock, weight, volume, sale_num, is_default,member_price'; - - $goods_sku_model = new GoodsSku(); - - $info = $goods_sku_model->where([ [ 'sku_id', '=', $data[ 'sku_id' ] ] ]) - ->field($field) - ->with([ - // 商品主表 - 'goods' => function ($query) { - $query->withField('goods_id, goods_name, goods_type, sub_title, goods_cover, unit, stock, sale_num + virtual_sale_num as sale_num, status,member_discount,is_discount') - ->append([ 'goods_type_name', 'goods_cover_thumb_small', 'goods_cover_thumb_mid', 'goods_cover_thumb_big' ]); - }, - // 商品规格列表 - 'skuList' => function ($query) { - $query->field('sku_id, sku_name, sku_image, sku_no, goods_id, sku_spec_format, price, market_price, sale_price, stock, weight, volume, is_default,member_price'); - }, - // 商品规格项/规格值列表 - 'goodsSpec' => function ($query) { - $query->field('spec_id, goods_id, spec_name, spec_values'); - }, - ]) - ->append([ 'sku_image_thumb_small', 'sku_image_thumb_mid', 'sku_image_thumb_big' ]) - ->findOrEmpty()->toArray(); - if (!empty($info) && !empty($data[ 'member_id' ])) { - $member_info = $this->getMemberInfo($data[ 'member_id' ]); - - $info[ 'member_price' ] = $this->getMemberPrice($member_info, $info[ 'goods' ][ 'member_discount' ], $info[ 'member_price' ], $info[ 'price' ]); - - $this->getMemberPriceByList($member_info, $info[ 'goods' ][ 'member_discount' ], $info[ 'skuList' ]); - // 限购查询当前会员已购数量 - $has_buy = ( new CoreGoodsLimitBuyService() )->getGoodsHasBuyNumber($data[ 'member_id' ], $info[ 'goods_id' ]); - $info[ 'has_buy' ] = $has_buy; - // 满减活动 - $manjian_info = ( new ManjianService() )->getManjianInfo([ 'goods_id' => $info[ 'goods_id' ], 'sku_id' => $info[ 'sku_id' ], 'member_id' => $data[ 'member_id' ] ]); - $info[ 'manjian_info' ] = $manjian_info; - } - - return $info; - } - - /** - * 查询商品SKU规格列表 - * @param $params - * @return array - */ - public function getSkuList($params) - { - $goods_sku_model = new GoodsSku(); - - $field = 'sku_id, sku_name, sku_image,sku_no, goods_id, sku_spec_format, price, market_price, sale_price, cost_price, stock, weight, volume,member_price'; - $order = 'sku_id asc'; - $list = $goods_sku_model->where([ [ 'sku_id', '>', 0 ] ])->withSearch([ "goods_id" ], [ 'goods_id' => $params[ 'goods_id' ] ])->with([ 'goods' ])->field($field)->order($order)->select()->toArray(); - return $list; - } - - /** - * 商品数统计 - * @return int[] - * @throws \think\db\exception\DbException - */ - public function getGoodsCount() - { - $data = [ - "sale_goods_num" => 0, //销售 - "warehouse_goods_num" => 0, //仓库 - ]; - - $data[ 'sale_goods_num' ] = $this->model->where([ [ 'status', '=', 1 ] ])->count(); - $data[ 'warehouse_goods_num' ] = $this->model->where([ [ 'status', '=', 0 ] ])->count(); - return $data; - } - - /** - * 编辑商品规格列表库存 - * @param $params - * @return array|bool - */ - public function editGoodsListStock($params) - { - try { - Db::startTrans(); - - $goods_info = $this->model->where([ - [ 'goods_id', '=', $params[ 'goods_id' ] ], - ])->field('goods_type')->findOrEmpty()->toArray(); - - if (empty($goods_info)) { - throw new CommonException('SHOP_GOODS_NOT_EXIST'); - } - - $sku_list = $params[ 'sku_list' ]; - if (!empty($sku_list)) { - $goods_stock = 0; // 总库存 - $goods_sku_model = new GoodsSku(); - foreach ($sku_list as $k => $v) { - $goods_stock += (int) $v[ 'stock' ]; - - $update_data = [ - 'stock' => $v[ 'stock' ], - ]; - - $goods_sku_model->where([ - [ 'goods_id', '=', $params[ 'goods_id' ] ], - [ 'sku_id', '=', $v[ 'sku_id' ] ] - ])->update($update_data); - } - $this->model->where([ - [ 'goods_id', '=', $params[ 'goods_id' ] ] - ])->update([ - 'stock' => $goods_stock, - ]); - } - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 编辑商品规格列表价格 - * @param $params - * @return array|bool - */ - public function editGoodsListPrice($params) - { - try { - Db::startTrans(); - - $goods_info = $this->model->where([ - [ 'goods_id', '=', $params[ 'goods_id' ] ], - ])->field('goods_id,goods_type')->findOrEmpty()->toArray(); - - if (empty($goods_info)) { - throw new CommonException('SHOP_GOODS_NOT_EXIST'); - } - - // 查询商品参与营销活动的数量 - $active_goods_count = $this->getActiveGoodsCount($goods_info[ 'goods_id' ]); - - $sku_list = $params[ 'sku_list' ]; - if (!empty($sku_list)) { - $goods_sku_model = new GoodsSku(); - foreach ($sku_list as $k => $v) { - $update_data = [ - 'cost_price' => $v[ 'cost_price' ], - 'market_price' => $v[ 'market_price' ], - ]; - - if ($active_goods_count == 0) { - $update_data[ 'price' ] = $v[ 'price' ]; - $update_data[ 'sale_price' ] = $v[ 'price' ]; - } - - $goods_sku_model->where([ - [ 'goods_id', '=', $params[ 'goods_id' ] ], - [ 'sku_id', '=', $v[ 'sku_id' ] ] - ])->update($update_data); - } - } - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 编辑商品规格列表会员价格 - * @param $params - * @return array|bool - */ - public function editGoodsListMemberPrice($params) - { - try { - Db::startTrans(); - - $goods_info = $this->model->where([ - [ 'goods_id', '=', $params[ 'goods_id' ] ], - ])->field('goods_type')->findOrEmpty()->toArray(); - - if (empty($goods_info)) { - throw new CommonException('SHOP_GOODS_NOT_EXIST'); - } - - // 修改商品的会员等级折扣 - $this->model->where([ - [ 'goods_id', '=', $params[ 'goods_id' ] ], - ])->update([ - 'member_discount' => $params[ 'member_discount' ] - ]); - - $sku_list = $params[ 'sku_list' ]; - if (!empty($sku_list)) { - $goods_sku_model = new GoodsSku(); - foreach ($sku_list as $k => $v) { - $update_data = [ - 'member_price' => json_encode($v[ 'member_price' ]), - ]; - - $goods_sku_model->where([ - [ 'goods_id', '=', $params[ 'goods_id' ] ], - [ 'sku_id', '=', $v[ 'sku_id' ] ] - ])->update($update_data); - } - } - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage() . ',Line:' . $e->getLine() . ',File:' . $e->getFile()); - } - } - - /** - * 查询商品参与营销活动的数量 - * @param $goods_id - * @return mixed - */ - public function getActiveGoodsCount($goods_id, $is_all = 0, $where = []) - { - // 判断 $goods_id 类型 - if (!is_array($goods_id)) { - $goods_id = [ $goods_id ]; - } - - $join_list = event('GetGoodsJoinInfo', [ - 'goods_ids' => $goods_id, - 'is_get_count' => 1, - 'is_all' => $is_all, - 'where' => $where, - ]); - return array_sum($join_list); - } - - /** - * 查询商品参与营销活动的数量 - * @param $goods_id - * @return mixed - */ - public function getActiveGoodsIds($goods_id, $is_all = 0, $where = []) - { - // 判断 $goods_id 类型 - if (!is_array($goods_id)) { - $goods_id = [ $goods_id ]; - } - - $join_list = event('GetGoodsJoinInfo', [ - 'goods_ids' => $goods_id, - 'is_get_count' => 0, - 'is_all' => $is_all, - 'where' => $where, - ]); - $goods_ids = []; - foreach ($join_list as $item) { - $goods_ids = array_merge($goods_ids, array_keys($item)); - } - return $goods_ids; - } - - public function getMemberInfo($member_id) - { - $member_model = new Member(); - $member_field = 'member_level'; - $member_info = $member_model->where([ - [ 'member_id', '=', $member_id ] - ])->field($member_field) - ->with([ - // 会员等级 - 'memberLevelData' => function ($query) { - $query->field('level_id, level_name, status, level_benefits, level_gifts'); - }, - ]) - ->findOrEmpty()->toArray(); - return $member_info; - } - - /** - * 查询商品的会员价 - * @param $member_info - * @param string $member_discount 会员等级折扣,不参与:空,会员折扣:discount,指定会员价:fixed_price - * @param string $member_price 会员价,json格式,指定会员价,数据结构为:{"level_12":"92.00","level_13":"72.00","level_14":"66.00","level_15":"45.00"} - * @param $price - * @return int|string - */ - public function getMemberPrice($member_info, $member_discount, $member_price, $price) - { - if (empty($member_discount)) { - return $price; - } - - // 未找到会员,排除 - if (empty($member_info)) { - return $price; - } - - // 没有会员等级,排除 - if (!empty($member_info) && empty($member_info[ 'member_level' ])) { - return $price; - } - - if ($member_discount == 'discount') { - // 按照会员等级折扣计算 - - // 默认按会员享受折扣计算 - if (!empty($member_info[ 'memberLevelData' ][ 'level_benefits' ]) - && !empty($member_info[ 'memberLevelData' ][ 'level_benefits' ][ 'discount' ]) - && !empty($member_info[ 'memberLevelData' ][ 'level_benefits' ][ 'discount' ][ 'is_use' ])) { - - $price = number_format($price * $member_info[ 'memberLevelData' ][ 'level_benefits' ][ 'discount' ][ 'discount' ] / 10, 2, '.', ''); - } - - } elseif ($member_discount == 'fixed_price') { - // 指定会员价 - if (!empty($member_price)) { - $member_price = json_decode($member_price, true); - if (!empty($member_price[ 'level_' . $member_info[ 'member_level' ] ])) { - $member_level_price = $member_price[ 'level_' . $member_info[ 'member_level' ] ]; - $price = number_format($member_level_price, 2, '.', ''); - } - } - } - - return $price; - - } - - /** - * 查询商品的会员价 - * @param $member_info - * @param string $member_discount 会员等级折扣,不参与:空,会员折扣:discount,指定会员价:fixed_price - * @param $sku_list - * @return int - */ - public function getMemberPriceByList($member_info, $member_discount, &$sku_list) - { - - // 是否按照原价返回 - $is_default = false; - - if (empty($member_discount)) { - $is_default = true; - } - - // 未找到会员,排除 - if (empty($member_info)) { - $is_default = true; - } - - // 没有会员等级,排除 - if (!empty($member_info) && empty($member_info[ 'member_level' ])) { - $is_default = true; - } - - foreach ($sku_list as $k => &$v) { - - if ($is_default) { - $v[ 'member_price' ] = $v[ 'price' ]; - } else { - if ($member_discount == 'discount') { - // 按照会员等级折扣计算 - - // 默认按会员享受折扣计算 - if (!empty($member_info[ 'memberLevelData' ][ 'level_benefits' ]) - && !empty($member_info[ 'memberLevelData' ][ 'level_benefits' ][ 'discount' ]) - && !empty($member_info[ 'memberLevelData' ][ 'level_benefits' ][ 'discount' ][ 'is_use' ])) { - $v[ 'member_price' ] = number_format($v[ 'price' ] * $member_info[ 'memberLevelData' ][ 'level_benefits' ][ 'discount' ][ 'discount' ] / 10, 2, '.', ''); - } else { - $v[ 'member_price' ] = $v[ 'price' ]; - } - - } elseif ($member_discount == 'fixed_price') { - // 指定会员价 - if (!empty($v[ 'member_price' ])) { - $member_price = json_decode($v[ 'member_price' ], true); // 会员价,json格式,指定会员价 - if (!empty($member_price[ 'level_' . $member_info[ 'member_level' ] ])) { - $member_level_price = $member_price[ 'level_' . $member_info[ 'member_level' ] ]; - $v[ 'member_price' ] = number_format($member_level_price, 2, '.', ''); - } else { - $v[ 'member_price' ] = $v[ 'price' ]; - } - } - } - } - } - - return $sku_list; - } - - /** - * 批量设置商品 - * @param $data - * @return mixed - */ - public function batchSet($data) - { - $is_all = $data[ 'is_all' ]; - $goods_ids = $data[ 'goods_ids' ]; - if (empty($data[ 'set_type' ])) throw new AdminException('NOT_GET_SET_TYPE'); - if (!$is_all && empty($goods_ids)) throw new AdminException('NOT_GET_SHOP_INFO'); - $save_data = $filed_data = $sku_save_data = []; - switch ($data[ 'set_type' ]) { - case GoodsDict::LABEL : - $filed_data[ 'label' ][ 'label_ids' ] = array_map(function ($item) { - return (string) $item; - }, $data[ 'set_value' ][ 'label_ids' ]); - break; - case GoodsDict::SERVICE : - $filed_data[ 'service' ][ 'service_ids' ] = array_map(function ($item) { - return (string) $item; - }, $data[ 'set_value' ][ 'service_ids' ]); - break; - case GoodsDict::VIRTUAL_SALE_NUM : - $filed_data[ 'virtual_sale_num' ][ 'virtual_sale_num' ] = $data[ 'set_value' ][ 'virtual_sale_num' ]; - break; - case GoodsDict::CATEGORY : - if (!isset($data[ 'set_value' ][ 'goods_category' ]) || empty($data[ 'set_value' ][ 'goods_category' ])) break; - $filed_data[ 'category' ][ 'goods_category' ] = array_map(function ($item) { - return (string) $item; - }, $data[ 'set_value' ][ 'goods_category' ]); - break; - case GoodsDict::BRAND : - $filed_data[ 'brand' ][ 'brand_id' ] = $data[ 'set_value' ][ 'brand_id' ]; - break; - case GoodsDict::POSTER : - $filed_data[ 'poster' ][ 'poster_id' ] = $data[ 'set_value' ][ 'poster_id' ]; - break; - case GoodsDict::DIY_FORM : - $filed_data[ 'diy_form' ][ 'form_id' ] = $data[ 'set_value' ][ 'form_id' ]; - break; - case GoodsDict::GIFT : - if (!isset($data[ 'set_value' ][ 'is_gift' ]) || !in_array($data[ 'set_value' ][ 'is_gift' ], [ GoodsDict::IS_GIFT, GoodsDict::NOT_IS_GIFT ])) break; - $filed_data[ 'gift' ][ 'is_gift' ] = $data[ 'set_value' ][ 'is_gift' ]; - break; - case GoodsDict::DELIVERY : - if (!isset($data[ 'set_value' ][ 'delivery_type' ]) || empty($data[ 'set_value' ][ 'delivery_type' ])) break; - $filed_data[ 'delivery' ][ 'delivery_type' ] = array_map(function ($item) { - return (string) $item; - }, $data[ 'set_value' ][ 'delivery_type' ] ?? []); - $filed_data[ 'delivery' ][ 'is_free_shipping' ] = $data[ 'set_value' ][ 'is_free_shipping' ] ?? 1; - $filed_data[ 'delivery' ][ 'fee_type' ] = $data[ 'set_value' ][ 'fee_type' ] ?? 'template'; - $filed_data[ 'delivery' ][ 'delivery_money' ] = $data[ 'set_value' ][ 'delivery_money' ] ?? 0; - $filed_data[ 'delivery' ][ 'delivery_template_id' ] = $data[ 'set_value' ][ 'delivery_template_id' ] ?? 0; - break; - case GoodsDict::MEMBER_DISCOUNT : - $filed_data[ 'member_discount' ][ 'member_discount' ] = $data[ 'set_value' ][ 'member_discount' ]; - break; - case GoodsDict::DIY_DETAIL : - $filed_data[ 'diy_detail' ][ 'diy_detail_id' ] = $data[ 'set_value' ][ 'diy_detail_id' ]; - break; - case GoodsDict::STOCK : - if (!isset($data[ 'set_value' ][ 'stock_type' ]) || empty($data[ 'set_value' ][ 'stock_type' ]) || !isset($data[ 'set_value' ][ 'stock' ]) || $data[ 'set_value' ][ 'stock' ] <= 0) break; - $update_stock = (int) $data[ 'set_value' ][ 'stock' ]; - - if ($data[ 'set_value' ][ 'stock_type' ] == 'inc') { - if ($is_all) { - $query = $this->getBatchAllQuery($data[ 'where' ], $goods_ids); - } else { - $query = GoodsSku::alias('goodsSku') - ->join(( new Goods() )->getTable() . ' goods', 'goods.goods_id = goodsSku.goods_id') - ->whereIn('goods.goods_id', $goods_ids); - } - $query->update([ - 'goodsSku.stock' => Db::raw("goodsSku.stock + {$update_stock}"), - ]); - } else { - if ($is_all) { - $query = $this->getBatchAllQuery($data[ 'where' ], $goods_ids); - } else { - $query = GoodsSku::alias('goodsSku') - ->join(( new Goods() )->getTable() . ' goods', 'goods.goods_id = goodsSku.goods_id') // 使用INNER JOIN更安全 - ->whereIn('goods.goods_id', $goods_ids); - } - $query->update([ - 'goodsSku.stock' => Db::raw("CASE WHEN goodsSku.stock >= $update_stock THEN goodsSku.stock - $update_stock ELSE 0 END"), - ]); - } - - if ($is_all) { - $query = $this->getBatchAllQuery($data[ 'where' ], $goods_ids); - $query->update([ - 'goods.stock' => Db::raw("(SELECT COALESCE(SUM(stock), 0) FROM " . ( new GoodsSku() )->getTable() . " WHERE goods_id = goods.goods_id )") - ]); - } else { - $query = Goods::alias('goods'); - $query = $query->whereIn('goods.goods_id', $goods_ids); - $query->update([ - 'stock' => Db::raw("(SELECT COALESCE(SUM(stock), 0) FROM " . ( new GoodsSku() )->getTable() . " WHERE goods_id = goods.goods_id )") - ]); - } - - return true; - } - - if (!empty($filed_data)) { - $field = array_keys($filed_data)[ 0 ]; - if ($is_all) { - $update = $filed_data[ $field ]; - $update_data = []; - foreach ($update as $column => $value) { - $update_data[ 'goods.' . $column ] = is_array($value) ? json_encode($value) : $value; - } - $query = $this->getBatchAllQuery($data[ 'where' ], $goods_ids); - if ($data[ 'set_type' ] == GoodsDict::DELIVERY) { - $query = $query->where([ [ 'goods_type', '=', GoodsDict::REAL ] ]); - } - $res = $query->update($update_data); - if ($data[ 'set_type' ] == GoodsDict::MEMBER_DISCOUNT) { - $goods_ids = $query->column('goods.goods_id'); - } - } else { - if ($data[ 'set_type' ] == GoodsDict::DELIVERY) { - $goods_ids = $this->model->where([ [ 'goods_id', 'in', $goods_ids ], [ 'goods_type', '=', GoodsDict::REAL ] ])->column('goods_id'); - } - foreach ($goods_ids as $k => $v) { - $save_data[ $k ] = $filed_data[ $field ]; - $save_data[ $k ][ 'goods_id' ] = $v; - } - $this->model->saveAll($save_data); - } - if ($data[ 'set_type' ] == GoodsDict::MEMBER_DISCOUNT && !empty($goods_ids)) { - ( new GoodsSku() )->where([ [ 'goods_id', 'in', $goods_ids ] ])->update([ 'member_price' => '' ]); - } - } - - return true; - } - - public function getBatchAllQuery($where, $example_goods_ids = []) - { - $sku_where = [ - [ 'goodsSku.is_default', '=', 1 ], - ]; - - if (!empty($where[ 'start_price' ]) && !empty($where[ 'end_price' ])) { - $money = [ $where[ 'start_price' ], $where[ 'end_price' ] ]; - sort($money); - $sku_where[] = [ 'goodsSku.price', 'between', $money ]; - } else if (!empty($where[ 'start_price' ])) { - $sku_where[] = [ 'goodsSku.price', '>=', $where[ 'start_price' ] ]; - } else if (!empty($where[ 'end_price' ])) { - $sku_where[] = [ 'goodsSku.price', '<=', $where[ 'end_price' ] ]; - } - - return Goods::alias('goods')->where([ [ 'goods.goods_id', '>', 0 ] ])->withSearch([ "goods_name", "goods_type", "brand_id", "goods_category", "label_ids", 'service_ids', "sale_num", "status" ], $where) - ->withJoin([ 'goodsSku' ])->where($sku_where)->whereNotIn('goods.goods_id', $example_goods_ids); - } - - /** - * 获取商品排行榜统计类型 - * @return array - */ - public function getBatchSetDict() - { - $list = GoodsDict::getBatchSetDict(); - return $list; - } - - /** - * 分类调整时使用(分类登记变化) 数据较多时需优化 Job - * @return void - */ - public function batchUpdateCategory($category_id, $old_pid, $new_pid) - { - $goods_category = []; - - $category_goods_list = ( new Goods() )->withSearch([ 'goods_category' ], [ - 'goods_category' => $category_id - ])->select()->toArray(); - if ($old_pid != 0 && $new_pid == 0) { - - foreach ($category_goods_list as $item) { - - $goods_category = array_map(function ($value) { - return (string) $value; - }, $goods_category); - ( new Goods() )->where([ - [ 'goods_id', '=', $item[ 'goods_id' ] ] - ])->update([ - 'goods_category' => array_values($goods_category) - ]); - - } - } - - foreach ($category_goods_list as $item) { - //将无二级分类的顶级分类调整为二级分类 - $item_category = $item[ 'goods_category' ]; - if ($old_pid == 0 && $new_pid != 0) { - $item_category[] = $new_pid; - } else - if ($old_pid != 0 && $new_pid == 0) { //将二级分类调整为顶级分类 - foreach ($item_category as $k => $value) { - if ($value == $old_pid) { - unset($item_category[ $k ]); - } - } - } - $item_category = array_map(function ($value) { - return (string) $value; - }, $item_category); - ( new Goods() )->where([ - [ 'goods_id', '=', $item[ 'goods_id' ] ] - ])->update([ - 'goods_category' => array_values($item_category) - ]); - } - } - -} diff --git a/niucloud/addon/shop/app/service/admin/goods/LabelGroupService.php b/niucloud/addon/shop/app/service/admin/goods/LabelGroupService.php deleted file mode 100644 index 8f19deffe..000000000 --- a/niucloud/addon/shop/app/service/admin/goods/LabelGroupService.php +++ /dev/null @@ -1,143 +0,0 @@ -model = new LabelGroup(); - } - - /** - * 获取商品标签分组列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'group_id, group_name, sort, create_time, update_time'; - $order = 'group_id desc'; - if (!empty($where[ 'order' ])) { - $order = $where[ 'order' ] . ' ' . $where[ 'sort' ]; - } - - $search_model = $this->model->where([ [ 'group_id', '>', 0 ] ])->withSearch([ "group_name" ], $where)->field($field)->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取商品标签分组列表 - * @param array $where - * @param string $field - * @return array - */ - public function getList(array $where = [], $field = 'group_id, group_name, sort, create_time, update_time') - { - $order = 'sort desc,group_id desc'; - return $this->model->where([ [ 'group_id', '>', 0 ] ])->withSearch([ "group_name" ], $where)->field($field)->order($order)->select()->toArray(); - } - - /** - * 获取商品标签分组信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'group_id, group_name, sort, create_time, update_time'; - - $info = $this->model->field($field)->where([ [ 'group_id', '=', $id ] ])->findOrEmpty()->toArray(); - return $info; - } - - /** - * 添加商品标签分组 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $data[ 'create_time' ] = time(); - $brandInfo = $this->model->where([ [ 'group_name', '=', $data[ 'group_name' ] ] ])->findOrEmpty()->toArray(); - if ($brandInfo) { - throw new AdminException('标签分组已存在,请检查'); - } - $res = $this->model->create($data); - return $res->group_id; - } - - /** - * 商品标签分组编辑 - * @param int $id - * @param array $data - * @return bool - */ - public function edit(int $id, array $data) - { - $data[ 'update_time' ] = time(); - $labelInfo = $this->model->where([ [ 'group_name', '=', $data[ 'group_name' ] ] ])->findOrEmpty()->toArray(); - if ($labelInfo && $labelInfo[ 'group_id' ] != $id) { - throw new AdminException('标签分组已存在,请检查'); - } - - $this->model->where([ [ 'group_id', '=', $id ] ])->update($data); - return true; - } - - /** - * 删除商品标签分组 - * @param int $id - * @return bool - */ - public function del(int $id) - { - // 检测商品标签分组是否被使用 - $label_model = new Label(); - $label_count = $label_model->where([ - [ 'group_id', '=', $id ] - ])->count(); - if ($label_count) { - throw new AdminException('该标签分组正在使用中,无法删除'); - } - - $model = $this->model->where([ [ 'group_id', '=', $id ] ])->find(); - $res = $model->delete(); - return $res; - } - - /** - * 修改排序 - * @param $data - * @return mixed - */ - public function modifySort($data) - { - return $this->model->where([ - [ 'group_id', '=', $data[ 'group_id' ] ], - ])->update([ 'sort' => $data[ 'sort' ] ]); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/goods/LabelService.php b/niucloud/addon/shop/app/service/admin/goods/LabelService.php deleted file mode 100644 index e5a8f58af..000000000 --- a/niucloud/addon/shop/app/service/admin/goods/LabelService.php +++ /dev/null @@ -1,186 +0,0 @@ -model = new Label(); - } - - /** - * 获取商品标签列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'label_id, label_name, group_id, style_type, color_json, icon, status, memo, sort, create_time, update_time'; - $order = 'label_id desc'; - if (!empty($where[ 'order' ])) { - $order = $where[ 'order' ] . ' ' . $where[ 'sort' ]; - } - - $search_model = $this->model->where([ [ 'label_id', '>', 0 ]])->withSearch([ "label_name", 'group_id' ], $where)->field($field) - ->with([ - 'group' => function($query) { - $query->field('group_id, group_name'); - }, - ]) - ->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取商品标签列表 - * @param array $where - * @param string $field - * @return array - */ - public function getList(array $where = [], $field = 'label_id, label_name, group_id, style_type, color_json, icon, status, memo, sort, create_time, update_time') - { - $order = 'sort desc,label_id desc'; - return $this->model->where([ ['status','=',LabelDict::ENABLE]])->withSearch([ "label_name" ], $where)->field($field) - ->with([ - 'group' => function($query) { - $query->field('group_id, group_name'); - }, - ])->order($order)->select()->toArray(); - } - - /** - * 获取商品标签信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'label_id, label_name, group_id, style_type, color_json, icon, status, memo, sort, create_time, update_time'; - - $info = $this->model->field($field)->where([ [ 'label_id', '=', $id ] ]) - ->with([ - 'group' => function($query) { - $query->field('group_id, group_name'); - }, - ])->findOrEmpty()->toArray(); - return $info; - } - - /** - * 添加商品标签 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $data[ 'create_time' ] = time(); - $brandInfo = $this->model->where([ [ 'label_name', '=', $data[ 'label_name' ] ] ])->findOrEmpty()->toArray(); - if ($brandInfo) { - throw new AdminException('SHOP_GOODS_LABEL_NAME_REPEAT'); - } - $res = $this->model->create($data); - return $res->label_id; - } - - /** - * 商品标签编辑 - * @param int $id - * @param array $data - * @return bool - */ - public function edit(int $id, array $data) - { - $data[ 'update_time' ] = time(); - $labelInfo = $this->model->where([ [ 'label_name', '=', $data[ 'label_name' ] ] ])->findOrEmpty()->toArray(); - if ($labelInfo && $labelInfo[ 'label_id' ] != $id) { - throw new AdminException('SHOP_GOODS_LABEL_NAME_REPEAT'); - } - - $this->model->where([ [ 'label_id', '=', $id ] ])->update($data); - return true; - } - - /** - * 删除商品标签 - * @param int $id - * @return bool - */ - public function del(int $id) - { - // 检测商品标签分组是否被使用 - $goods_model = new Goods(); - $count = $goods_model->where([ [ 'goods_id', '>', 0 ] ])->withSearch([ 'label_ids' ], [ 'label_ids' => $id ])->count(); - if ($count) { - throw new AdminException('SHOP_GOODS_LABEL_IN_USE'); - } - $model = $this->model->where([ [ 'label_id', '=', $id ] ])->find(); - $res = $model->delete(); - return $res; - } - - /** - * 修改排序 - * @param $data - * @return Label - */ - public function modifySort($data) - { - return $this->model->where([ - [ 'label_id', '=', $data[ 'label_id' ] ] - ])->update([ 'sort' => $data[ 'sort' ] ]); - } - - /** - * 修改状态 - * @param $data - * @return Label - */ - public function modifyStatus($data) - { - return $this->model->where([ - [ 'label_id', '=', $data[ 'label_id' ] ] - ])->update([ 'status' => $data[ 'status' ] ]); - } - - /** - * 复制商品标签 - * @param int $id - * @return Label|\think\Model - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function copy(int $id) - { - $field = 'label_name, group_id, style_type, color_json, icon, memo, sort'; - $label_info = $this->model->field($field)->where('label_id',$id)->find()->toArray(); - $label_info['label_name'] =$label_info['label_name'].'_副本'; - $label_info['status'] =0; - return $this->model->create($label_info); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/goods/OfferGoodsService.php b/niucloud/addon/shop/app/service/admin/goods/OfferGoodsService.php deleted file mode 100644 index f5c910b66..000000000 --- a/niucloud/addon/shop/app/service/admin/goods/OfferGoodsService.php +++ /dev/null @@ -1,180 +0,0 @@ -model = new Goods(); - } - - /** - * 获取输出商品初始化数据 - * @return array - */ - public function getWhereInit() - { - return [ - 'label_list' => (new LabelService())->getList(), - 'brand_list' => (new BrandService())->getList(), - 'category_list' => (new CategoryService())->getTree(), - 'type_list' => (new GoodsService())->getType(), - ]; - } - - /** - * 输出商品列表 - * @param $param - * @return array - * @throws \think\db\exception\DbException - */ - public function getOfferGoodsList($param) - { - $field = 'goods_id,goods_name,sub_title,goods_image,unit,goods_video,goods_desc,goods_id as source_id,goods_cover,stock'; - $order = 'create_time desc'; - $where = [ - 'status' => 1, - 'goods_name' => $param['goods_name'] ?? '', - 'goods_type' => $param['goods_type'] ?? '', - 'brand_id' => $param['brand_id'] ?? '', - 'goods_category' => $param['goods_category'] ?? '', - 'label_ids' => $param['label_ids'] ?? '', - ]; - $search_model = $this->model - ->withSearch(["goods_name", 'goods_type', 'brand_id', 'goods_category', 'label_ids', "status"], $where) - ->field($field) - ->with([ - 'sku_list' => function (Query $query) { - $query->field(['goods_id', 'sku_id', 'is_default', 'sku_name', 'sku_image', 'price', 'is_default', 'sku_spec_format', 'sku_id as source_sku_id', 'stock'])->order('is_default desc'); - }, - 'goods_spec' => function (Query $query) { - $query->field(['goods_id', 'spec_name', 'spec_values']); - }, - ]) - ->hidden(['goods_id', 'sku_list' => ['goods_id', 'sku_id']]) - ->append(['goods_cover_thumb_small']) - ->order($order); - $list = $this->pageQuery($search_model, function (&$item, $key) { - $item = $item->toArray(); - $temp_sku_data = array_filter(array_column($item['sku_list'], 'sku_spec_format')); - $item['spec_type'] = 'single'; - if (!empty($temp_sku_data)) { - // 多规格 - $item['spec_type'] = 'multi'; - } - return $item; - }); - return $list; - } - - - /** - * 商品详情 - * @param $param - * @return array - */ - public function getOfferGoodsInfo($param) - { - - $field = 'goods_id,goods_name,sub_title,goods_image,goods_video,goods_desc,goods_id as source_id'; - $order = 'create_time desc'; - $where = [ - 'status' => 1, - 'goods_id' => $param['goods_id'] ?? '', - ]; - - $info = $this->model - ->withSearch(["goods_id", "status"], $where) - ->field($field) - ->with([ - 'sku_list' => function (Query $query) { - $query->field(['goods_id', 'sku_id', 'sku_name', 'sku_image', 'price', 'is_default', 'sku_spec_format', 'sku_id as source_sku_id']); - }, - 'goods_spec' => function (Query $query) { - $query->field(['goods_id', 'spec_name', 'spec_values']); - }, - ]) - ->hidden(['goods_id', 'sku_list' => ['goods_id', 'sku_id']]) - ->append(['goods_cover_thumb_small']) - ->order($order) - ->findOrEmpty() - ->toArray(); - - if (!empty($info)) { - $temp_sku_data = array_filter(array_column($info['sku_list'], 'sku_spec_format')); - $info['spec_type'] = 'single'; - if (!empty($temp_sku_data)) { - // 多规格 - $info['spec_type'] = 'multi'; - } - } - return $info; - } - - - /** - * 下单前商品效验 - * @return array - */ - public function checkGoods($param) - { - - $goods_id = $param['goods_id']; - $sku_id = $param['sku_id']; - $goods_num = $param['num']; - $goods_info = $this->model - ->where([['goods_id', '=', $goods_id], ['status', '=', 1]]) - ->with([ - 'goodsSku' => function (Query $query) { - $query->field(['goods_id', 'sku_id', 'stock']); - }, - ]) - ->hasWhere('goodsSku', function (Query $query) use ($sku_id) { - $query->where('sku_id', '=', $sku_id); - }) - ->findOrEmpty() - ->toArray(); - - if (empty($goods_info)) { - return [ - 'code' => -1, - 'message' => '商品不存在或已下架' - ]; - } - if ($goods_info['goodsSku']['stock'] < $goods_num) { - return [ - 'code' => -1, - 'message' => '商品库存不足' - ]; - } - return [ - 'code' => 1, - 'message' => '成功' - ]; - } - - -} diff --git a/niucloud/addon/shop/app/service/admin/goods/RankService.php b/niucloud/addon/shop/app/service/admin/goods/RankService.php deleted file mode 100644 index 1a69d7088..000000000 --- a/niucloud/addon/shop/app/service/admin/goods/RankService.php +++ /dev/null @@ -1,325 +0,0 @@ -model = new Rank(); - } - - /** - * 获取商品排行榜列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'rank_id,name,rank_type,goods_source,rule_type,sort,create_time,goods_json,category_ids,brand_ids,label_ids,status'; - $order = 'create_time desc'; - if (!empty($where[ 'order' ])) { - $order = $where[ 'order' ] . ' ' . $where[ 'sort' ]; - } - - $search_model = $this->model - ->where([ [ 'rank_id', '>', 0 ] ]) - ->withSearch([ "name", 'rank_type' ], $where) - ->field($field) - ->order($order)->append([ 'rank_type_name', 'goods_source_name', 'rule_type_name' ]); - $list = $this->pageQuery($search_model); - if (!empty($list[ 'data' ])) { - $list[ 'data' ] = $this->getShowGodsNum($list[ 'data' ]); - } - return $list; - } - - /** - * 获取商品排行榜列表 - * @param array $where - * @param string $field - * @return array - */ - public function getList(array $where = [], $field = 'rank_id,name,rank_type,goods_source,rule_type,sort,create_time') - { - $order = 'create_time desc'; - return $this->model->where([ [ 'rank_id', '>', 0 ] ])->withSearch([ "name" ], $where)->field($field)->order($order)->select()->toArray(); - } - - /** - * 添加商品榜单 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $data[ 'create_time' ] = time(); - $rankInfo = $this->model->where([ [ 'name', '=', $data[ 'name' ] ] ])->findOrEmpty()->toArray(); - if ($rankInfo) { - throw new AdminException('商品榜单已存在,请检查'); - } - $data = $this->checkRankData($data); // 将其他类型的字段值重置 - $res = $this->model->create($data); - return $res->rank_id; - } - - protected function checkRankData($data) - { - // 重置字段,防止修改后字段值错误 - if ($data[ 'goods_source' ] == RankDict::GOODS) { - $data[ 'category_ids' ] = []; - $data[ 'brand_ids' ] = []; - $data[ 'label_ids' ] = []; - } - if ($data[ 'goods_source' ] == RankDict::CATEGORY) { - $data[ 'goods_json' ] = []; - $data[ 'brand_ids' ] = []; - $data[ 'label_ids' ] = []; - } - if ($data[ 'goods_source' ] == RankDict::BRAND) { - $data[ 'category_ids' ] = []; - $data[ 'goods_json' ] = []; - $data[ 'label_ids' ] = []; - } - if ($data[ 'goods_source' ] == RankDict::LABEL) { - $data[ 'category_ids' ] = []; - $data[ 'brand_ids' ] = []; - $data[ 'goods_json' ] = []; - } - return $data; - } - - /** - * 修改商品榜单 - * @param int $id - * @param array $data - * @return mixed - */ - public function edit(int $id, array $data) - { - $info = $this->model->where([ [ 'rank_id', '=', $id ] ])->find(); - if (empty($info)) { - throw new AdminException('商品榜单不存在,请检查'); - } - $data[ 'update_time' ] = time(); - $rankInfo = $this->model->where([ [ 'name', '=', $data[ 'name' ] ], [ 'rank_id', '<>', $id ] ])->findOrEmpty()->toArray(); - if (!empty($rankInfo)) { - throw new AdminException('商品榜单已存在,请检查'); - } - $data = $this->checkRankData($data); // 将其他类型的字段值重置 - - $info->save($data); - return true; - } - - /** - * 商品排行榜详情 - * @param int $id - * @return - */ - public function getInfo(int $id) - { - $info = $this->model->where([ [ 'rank_id', '=', $id ] ])->findOrEmpty()->toArray(); - if (empty($info)) { - throw new AdminException('商品榜单不存在,请检查'); - } - $goods_list = []; - if (!empty($info[ 'goods_source' ]) && $info[ 'goods_source' ] == RankDict::GOODS) { - $goods_id = array_column($info[ 'goods_json' ], 'goods_id'); - $goods_id_sort_array = array_column($info[ 'goods_json' ], 'sort', 'goods_id'); - $goods_list = ( new Goods )->where([ [ 'goods_id', 'in', $goods_id ] ]) - ->field('goods_id,goods_name,goods_type') - ->with([ 'goodsSku' => function($query) { - $query->field('sku_id,sku_name,sku_image,goods_id,price,stock'); - } ]) - ->append([ 'goods_type_name' ])->select()->toArray(); - foreach ($goods_list as &$item) { - $item[ 'sort' ] = 0; - if (isset($goods_id_sort_array[ $item[ 'goods_id' ] ])) { - $item[ 'sort' ] = $goods_id_sort_array[ $item[ 'goods_id' ] ]; - } - } - } - $info[ 'goods_list' ] = $goods_list; - return $info; - } - - /** - * 商品排行榜选项列表 - */ - public function getOptionData() - { - $list[ 'rank_type' ] = RankDict::getRankType(); - $list[ 'goods_source' ] = RankDict::getGoodsSource(); - $list[ 'rule_type' ] = RankDict::getRuleType(); - return $list; - } - - /** - * 删除商品排行榜 - * @param int $id - * @return bool - */ - public function del(int $id) - { - $info = $this->model->where([ [ 'rank_id', '=', $id ] ])->find(); - if (empty($info)) { - throw new AdminException('商品榜单不存在,请检查'); - } - $res = $info->delete(); - return $res; - } - - /** - * 设置商品排行榜配置 - * @param array $params - * @return bool - */ - public function setGoodsRankConfig(array $params = []) - { - return ( new CoreGoodsRankConfigService() )->setGoodsRankConfig($params); - } - - /** - * 获取商品排行榜配置 - * @return array - */ - public function getGoodsRankConfig() - { - return ( new CoreGoodsRankConfigService() )->getGoodsRankConfig(); - } - - /** - * 修改榜单排序号 - * @return bool - */ - public function editSort($data) - { - if (empty($data[ 'rank_id' ])) { - throw new AdminException('SHOP_RANK_NOT_EXIST'); - } - $this->model->where([ [ 'rank_id', '=', $data[ 'rank_id' ] ] ])->update([ 'sort' => $data[ 'sort' ] ]); - return true; - } - - /** - * 批量删除 - * @return bool - */ - public function batchDelete($data) - { - if (empty($data[ 'rank_id' ])) { - throw new AdminException('SHOP_RANK_NOT_EXIST'); - } - $this->model->where([ [ 'rank_id', 'in', $data[ 'rank_id' ] ] ])->delete(); - return true; - } - - /** - * 获取排行榜分页列表 - * @param array $where - * @return array - */ - public function getSelectPage(array $where = []) - { - - $verify_rank_ids = []; - if (!empty($where[ 'verify_rank_ids' ])) { - $verify_rank_ids = $this->model->where([ - [ 'rank_id', 'in', $where[ 'verify_rank_ids' ] ] - ])->withSearch([ "name", "rank_type" ], $where)->field('rank_id')->select()->toArray(); - if (!empty($verify_rank_ids)) { - $verify_rank_ids = array_column($verify_rank_ids, 'rank_id'); - } - } - - $field = 'rank_id,name,rank_type,goods_source,rule_type,create_time,goods_json,category_ids,brand_ids,label_ids'; - $order = 'sort desc,create_time desc'; - $search_model = $this->model - ->where([ - [ 'rank_id', '>', 0 ], -// [ 'status', '=', RankDict::ON ] // 不限制状态 - ]) - ->withSearch([ "name", 'rank_type' ], $where) - ->field($field) - ->order($order)->append([ 'rank_type_name', 'goods_source_name', 'rule_type_name' ]); - $list = $this->pageQuery($search_model); - if (!empty($list[ 'data' ])) { - $list[ 'data' ] = $this->getShowGodsNum($list[ 'data' ]); - } - $list[ 'verify_rank_ids' ] = $verify_rank_ids; - return $list; - } - - /** - * 获取榜单展示数量 - * @param array $data - * @return array - */ - public function getShowGodsNum($data) - { - $goods_model = new Goods(); - foreach ($data as &$value) { - switch ($value[ 'goods_source' ]) { - case RankDict::ALL: - $value[ 'show_goods_num' ] = $goods_model->where([ [ 'is_gift', '=', GoodsDict::NOT_IS_GIFT ], [ 'status', '=', 1 ], [ 'delete_time', '=', 0 ] ])->count(); - break; - case RankDict::GOODS: - $goods_json = $value[ 'goods_json' ]; - $goods_ids = array_column($goods_json, 'goods_id'); - $value[ 'show_goods_num' ] = $goods_model->where([ [ 'is_gift', '=', GoodsDict::NOT_IS_GIFT ], [ 'goods_id', 'in', $goods_ids ], [ 'status', '=', 1 ], [ 'delete_time', '=', 0 ] ])->count(); - break; - case RankDict::CATEGORY: - $category_ids = $value[ 'category_ids' ]; - $value[ 'show_goods_num' ] = $goods_model->withSearch([ 'goods_category' ], [ 'goods_category' => $category_ids ])->where([ [ 'is_gift', '=', GoodsDict::NOT_IS_GIFT ], [ 'status', '=', 1 ], [ 'delete_time', '=', 0 ] ])->count(); - break; - case RankDict::BRAND: - $brand_ids = $value[ 'brand_ids' ]; - $value[ 'show_goods_num' ] = $goods_model->where([ [ 'is_gift', '=', GoodsDict::NOT_IS_GIFT ], [ 'brand_id', 'in', $brand_ids ], [ 'status', '=', 1 ], [ 'delete_time', '=', 0 ] ])->count(); - break; - case RankDict::LABEL: - $label_ids = $value[ 'label_ids' ]; - $value[ 'show_goods_num' ] = $goods_model->withSearch([ 'label_ids' ], [ 'label_ids' => $label_ids ])->where([ [ 'is_gift', '=', GoodsDict::NOT_IS_GIFT ], [ 'status', '=', 1 ], [ 'delete_time', '=', 0 ] ])->count(); - break; - } - } - return $data; - } - - /** - * 修改状态 - * @param $data - * @return Rank - */ - public function modifyStatus($data) - { - return $this->model->where([ - [ 'rank_id', '=', $data[ 'rank_id' ] ], - ])->update([ 'status' => $data[ 'status' ] ]); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/goods/ServiceService.php b/niucloud/addon/shop/app/service/admin/goods/ServiceService.php deleted file mode 100644 index 5032cfb81..000000000 --- a/niucloud/addon/shop/app/service/admin/goods/ServiceService.php +++ /dev/null @@ -1,107 +0,0 @@ -model = new Service(); - } - - /** - * 获取商品服务列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'service_id,service_name,image,desc,create_time,update_time'; - $order = 'create_time desc'; - - $search_model = $this->model->where([ [ 'service_id', '>', 0 ] ])->withSearch([ "service_name" ], $where)->field($field)->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取商品服务列表 - * @param array $where - * @param string $field - * @return array - */ - public function getList(array $where = [], $field = 'service_id,service_name,image,desc,create_time,update_time') - { - $order = "create_time desc"; - return $this->model->where([ [ 'service_id', '>', 0 ] ])->withSearch([ "service_name" ], $where)->field($field)->order($order)->select()->toArray(); - } - - /** - * 获取商品服务信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'service_id,service_name,image,desc,create_time,update_time'; - - $info = $this->model->field($field)->where([ [ 'service_id', '=', $id ] ])->findOrEmpty()->toArray(); - return $info; - } - - /** - * 添加商品服务 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $data[ 'create_time' ] = time(); - $res = $this->model->create($data); - return $res->service_id; - } - - /** - * 商品服务编辑 - * @param int $id - * @param array $data - * @return bool - */ - public function edit(int $id, array $data) - { - $data[ 'update_time' ] = time(); - $this->model->where([ [ 'service_id', '=', $id ] ])->update($data); - return true; - } - - /** - * 删除商品服务 - * @param int $id - * @return bool - */ - public function del(int $id) - { - $model = $this->model->where([ [ 'service_id', '=', $id ] ])->find(); - $res = $model->delete(); - return $res; - } -} diff --git a/niucloud/addon/shop/app/service/admin/goods/StatisticsService.php b/niucloud/addon/shop/app/service/admin/goods/StatisticsService.php deleted file mode 100644 index a5e4b39b8..000000000 --- a/niucloud/addon/shop/app/service/admin/goods/StatisticsService.php +++ /dev/null @@ -1,325 +0,0 @@ -model = new Stat(); - } - - /** - * 获取商品统计基本信息 - * @param array $data - * @return array - */ - public function getBasic(array $data) - { - if (empty($data[ 'date' ])) { - $data[ 'date' ] = date('Y/m/d', strtotime('-1 month')) . '-' . date('Y/m/d'); - } - - $date_arr = explode('-', $data[ 'date' ]); - $date = [ strtotime($date_arr[ 0 ]), strtotime($date_arr[ 1 ]) ]; - $goods_ids = (new Goods())->where([[ 'goods_id', '>', 0 ]])->column('goods_id'); - - $field = 'goods_id,sum(cart_num) as cart_num,sum(sale_num) as sale_num,sum(pay_num) as pay_num,sum(pay_money) as pay_money,sum(refund_num) as refund_num,sum(refund_money) as refund_money,sum(collect_num) as collect_num,sum(evaluate_num) as evaluate_num,sum(access_num) as access_num,sum(goods_visit_member_count) as goods_visit_member_count'; - $list = $this->model->where([ [ 'date_time', 'between', $date ], ['goods_id','in',$goods_ids] ]) - ->field($field) - ->group('goods_id') - ->select() - ->toArray(); - - $data = [ - 'access_good_num' => 0,//被访问商品数 - 'sale_good_num' => 0,//动销商品数 - 'cart_num' => 0,//加入购物车数量 - 'sale_num' => 0,//商品销量(下单数) - 'pay_num' => 0,//支付件数 - 'pay_money' => 0,//支付总金额 - 'refund_num' => 0,//退款件数 - 'refund_money' => 0,//退款总额 - 'access_num' => 0,//访问次数(浏览量) - 'collect_num' => 0,//收藏数量 - 'evaluate_num' => 0,//评论数量 - 'goods_visit_member_count' => 0,//商品访客数 -// 'pay_percent'=>0,//支付转化率 - ]; - foreach ($list as $value) { - if ($value[ 'access_num' ] >= 1) { - $data[ 'access_good_num' ] += 1; - } - if ($value[ 'sale_num' ] >= 1) { - $data[ 'sale_good_num' ] += 1; - } - $data[ 'cart_num' ] += $value[ 'cart_num' ]; - $data[ 'sale_num' ] += $value[ 'sale_num' ]; - $data[ 'pay_num' ] += $value[ 'pay_num' ]; - $data[ 'pay_money' ] = bcadd($data[ 'pay_money' ], $value[ 'pay_money' ], 2); - $data[ 'refund_num' ] += $value[ 'refund_num' ]; - $data[ 'refund_money' ] = bcadd($data[ 'refund_money' ], $value[ 'refund_money' ], 2); - $data[ 'access_num' ] += $value[ 'access_num' ]; - $data[ 'collect_num' ] += $value[ 'collect_num' ]; - $data[ 'evaluate_num' ] += $value[ 'evaluate_num' ]; - $data[ 'goods_visit_member_count' ] += $value[ 'goods_visit_member_count' ]; - } - return $data; - } - - /** - * 获取商品统计图表信息 - * @param array $data - * @return array - */ - public function getTrend(array $data) - { - $goods_ids = (new Goods())->where([[ 'goods_id', '>', 0 ]])->column('goods_id'); - $where[] = [ - ['goods_id','in',$goods_ids] - ]; - $date_type = 'day'; - if (empty($data[ 'date' ])) { - $data[ 'date' ] = date('Y/m/d', strtotime('-1 month')) . '-' . date('Y/m/d'); - } - $date_arr = explode('-', $data[ 'date' ]); - $allDates = $this->getDatesBetween($date_arr[ 0 ], $date_arr[ 1 ]); - $select_data = []; - if (count($allDates) > 32) { - $date_type = 'month'; - foreach ($allDates as $v) { - $select_data[ date('Y-m', strtotime($v)) ][] = $v; - } - $allDates = $this->getMonthsBetween($date_arr[ 0 ], $date_arr[ 1 ]); - } - - $date = [ strtotime($date_arr[ 0 ]), strtotime($date_arr[ 1 ]) ]; - $where[] = [ 'date_time', 'between', $date ]; - $field = 'goods_id,date,date_time,sum(cart_num) as cart_num,sum(sale_num) as sale_num,sum(pay_num) as pay_num,sum(pay_money) as pay_money,sum(refund_num) as refund_num,sum(refund_money) as refund_money,sum(collect_num) as collect_num,sum(evaluate_num) as evaluate_num,sum(access_num) as access_num,sum(goods_visit_member_count) as goods_visit_member_count'; - $list = $this->model - ->where($where) - ->field($field) - ->group('date_time') - ->order('date_time asc') - ->select() - ->toArray(); - $data = $stat_count = $date_arr_data = []; - if (!empty($allDates)) { - foreach ($allDates as $key => $value) { - $stat_count[ 'access_count' ][ $value ] = 0;//浏览量 - $stat_count[ 'goods_visit_member_count' ][ $value ] = 0;//访客数 - $stat_count[ 'pay_money' ][ $value ] = 0;//支付金额 - $stat_count[ 'refund_money' ][ $value ] = 0;//退款金额 - $stat_count[ 'cart_num' ][ $value ] = 0;//加入购物车数 - $stat_count[ 'sale_num' ][ $value ] = 0;//下单件数 - $stat_count[ 'pay_num' ][ $value ] = 0;//支付件数 - $stat_count[ 'refund_num' ][ $value ] = 0;//退款件数 - } - - if ($date_type == 'day') { - foreach ($list as $k => $v) { - $stat_count[ 'access_count' ][ $v[ 'date' ] ] += $v[ 'access_num' ]; - $stat_count[ 'goods_visit_member_count' ][ $v[ 'date' ] ] += $v[ 'goods_visit_member_count' ]; - $stat_count[ 'pay_money' ][ $v[ 'date' ] ] = bcadd($stat_count[ 'pay_money' ][ $v[ 'date' ] ], $v[ 'pay_money' ], 2); - $stat_count[ 'refund_money' ][ $v[ 'date' ] ] += bcadd($stat_count[ 'refund_money' ][ $v[ 'date' ] ], $v[ 'refund_money' ], 2); - $stat_count[ 'cart_num' ][ $v[ 'date' ] ] += $v[ 'cart_num' ]; - $stat_count[ 'sale_num' ][ $v[ 'date' ] ] += $v[ 'sale_num' ]; - $stat_count[ 'pay_num' ][ $v[ 'date' ] ] += $v[ 'pay_num' ]; - $stat_count[ 'refund_num' ][ $v[ 'date' ] ] += $v[ 'refund_num' ]; - } - } elseif ($date_type == 'month') { - foreach ($select_data as $key => $value) { - foreach ($list as $k => $v) { - if (in_array($v[ 'date' ], $value)) { - $stat_count[ 'access_count' ][ $key ] += $v[ 'access_num' ]; - $stat_count[ 'goods_visit_member_count' ][ $key ] += $v[ 'goods_visit_member_count' ]; - $stat_count[ 'pay_money' ][ $key ] = bcadd($stat_count[ 'pay_money' ][ $key ], $v[ 'pay_money' ], 2); - $stat_count[ 'refund_money' ][ $key ] = bcadd($stat_count[ 'refund_money' ][ $key ], $v[ 'refund_money' ], 2); - $stat_count[ 'cart_num' ][ $key ] += $v[ 'cart_num' ]; - $stat_count[ 'sale_num' ][ $key ] += $v[ 'sale_num' ]; - $stat_count[ 'pay_num' ][ $key ] += $v[ 'pay_num' ]; - $stat_count[ 'refund_num' ][ $key ] += $v[ 'refund_num' ]; - } - } - } - } - foreach ($stat_count as $key => $value) { - $data[ $key ][ 'name' ] = $key; - $data[ $key ][ 'data' ] = array_values($value); - } - } - $arr = [ - 'data' => array_values($data), - 'xAxis' => $allDates, - ]; - return $arr; - } - - /** - * 获取商品排行榜信息 - * @param array $data - * @return array - */ - public function getRank(array $data) - { - if (empty($data[ 'date' ])) { - $data[ 'date' ] = date('Y/m/d', strtotime('-1 month')) . '-' . date('Y/m/d'); - } - $date_arr = explode('-', $data[ 'date' ]); - $date = [ strtotime($date_arr[ 0 ]), strtotime($date_arr[ 1 ]) ]; - - $where[] = [ - [ 'date_time', 'between', $date ], - [ 'goods.delete_time', '=', 0 ], - ]; - if (!empty($data[ 'category_ids' ])) { - $category_where = array_map(function($item) { return '%"' . $item . '"%'; }, $data[ 'category_ids' ]); - $where[] = [ 'goods_category', 'like', $category_where, 'or' ]; - } - if (!empty($data[ 'goods_name' ])) { - $where[] = [ "goods_name", "like", "%" . $data[ 'goods_name' ] . "%"]; - } - $field = 'stat.goods_id,sum(stat.cart_num) as cart_num,sum(stat.sale_num) as sale_num,sum(stat.pay_num) as pay_num,sum(stat.pay_money) as pay_money,sum(stat.refund_num) as refund_num,sum(stat.refund_money) as refund_money,sum(stat.collect_num) as collect_num,sum(stat.evaluate_num) as evaluate_num,sum(stat.access_num) as access_num,sum(goods_visit_member_count) as goods_visit_member_count,goods_name,goods_cover,is_gift'; - //排序 access_num=访问次数(浏览量) cart_num=>加入购物车数量 sale_num=商品销量(下单数)pay_num=支付件数 collect_num=收藏数量 pay_money=支付总金额 - $order = $data[ 'type' ] . ' desc,goods.sort desc,goods.create_time desc'; - $query = $this->model - ->alias('stat') - ->where($where) - ->withSearch(['goods_name'],$where) - ->field($field) - ->join('shop_goods goods', 'stat.goods_id=goods.goods_id', 'left') - ->append([ 'goods_cover_thumb_small' ]) - ->group('stat.goods_id') - ->order($order); - $list = $this->pageQuery($query); - return $list; - } - - /** - * 获取商品排行榜统计类型 - * @return array - */ - public function getType() - { - $list = StatisticsDict::getType(); - return $list; - } - - public function getDatesBetween($startDate, $endDate) - { - $dates = []; - $start = strtotime($startDate); - $end = strtotime($endDate); - - // 确保开始日期小于或等于结束日期 - if ($start > $end) { - return $dates; // 返回空数组 - } - - // 循环获取日期 - while ($start <= $end) { - $dates[] = date('Y-m-d', $start); // 格式化为日期字符串 - $start = strtotime("+1 day", $start); // 增加一天 - } - - return $dates; // 返回日期数组 - } - - public function getMonthsBetween($startDate, $endDate) - { - $months = []; - $start = new DateTime($startDate); - $end = new DateTime($endDate); - - // 确保开始日期小于等于结束日期 - if ($start > $end) { - return $months; // 返回空数组 - } - - // 循环获取月份 - while ($start <= $end) { - $months[] = $start->format('Y-m'); // 格式化为年月字符串 - $start->modify('first day of next month'); // 移动到下一个月的第一天 - } - - return $months; // 返回月份数组 - } - - /** - * 同步商品统计信息 - * @param array $date - * @return bool - */ - public function syncStatGoods($date = []) - { - $pageSize = 100; - $page = 1; - - if (empty($date)) { - $date[] = date('Y-m-d'); - } - - while (true) { - $goods_list = (new Goods()) - ->field('goods_id') - ->limit(($page - 1) * $pageSize, $pageSize) - ->select() - ->toArray(); - - if (empty($goods_list)) { - break; // 没有更多商品时退出循环 - } - - $goods_ids = array_column($goods_list, 'goods_id'); - - $data = []; - foreach ($date as $value) { - $stat_goods_ids = $this->model - ->where([ - ['date', '=', $value], - ['goods_id', 'in', $goods_ids] - ]) - ->column('goods_id'); - - foreach ($goods_list as $v) { - if (!in_array($v['goods_id'], $stat_goods_ids)) { - $data[] = [ - 'date' => $value, - 'date_time' => strtotime($value), - 'goods_id' => $v['goods_id'], - ]; - } - } - } - if (!empty($data)) { - $this->model->saveAll($data); - } - - $page++; - } - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/admin/goods/VirtualGoodsService.php b/niucloud/addon/shop/app/service/admin/goods/VirtualGoodsService.php deleted file mode 100644 index 382caaaf8..000000000 --- a/niucloud/addon/shop/app/service/admin/goods/VirtualGoodsService.php +++ /dev/null @@ -1,713 +0,0 @@ -model = new Goods(); - } - - /** - * 获取商品添加/编辑数据 - * @param array $params - * @return array - */ - public function getInit(array $params = []) - { - - $res = []; - - $addon_service = new AddonService(); - $res[ 'addon_shop_supplier' ] = $addon_service->getInfoByKey('shop_supplier'); - - if (!empty($params[ 'goods_id' ])) { - // 查询商品信息,用于编辑 - $field = 'goods_id,goods_name,sub_title,goods_type,goods_cover,goods_image,goods_video,goods_desc,brand_id,goods_category,label_ids,service_ids,unit,stock,virtual_sale_num,is_limit,limit_type,max_buy,min_buy,status,sort,supplier_id,attr_ids,attr_format,virtual_auto_delivery,virtual_receive_type,virtual_verify_type,virtual_indate,member_discount,poster_id,is_gift,form_id'; - $goods_info = $this->model->field($field)->where([ [ 'goods_id', '=', $params[ 'goods_id' ] ] ])->findOrEmpty()->toArray(); - if (!empty($goods_info)) { - - if (!empty($goods_info[ 'goods_category' ])) { - $category_service = new CategoryService(); - foreach ($goods_info[ 'goods_category' ] as $k => $v) { - $category = $category_service->getInfo($v); - if (empty($category)) { - unset($goods_info[ 'goods_category' ][ $k ]); - } - } - } - - // 商品品牌,处理数据类型 - if (empty($goods_info[ 'brand_id' ])) { - $goods_info[ 'brand_id' ] = ''; - } else { - $brand_count = ( new Brand() )->where([ [ 'brand_id', '=', $goods_info[ 'brand_id' ] ] ])->count(); - if ($brand_count == 0) $goods_info[ 'brand_id' ] = ''; - } - - // 供应商,处理数据类型 - if (empty($goods_info[ 'supplier_id' ])) { - $goods_info[ 'supplier_id' ] = ''; - } - - // 标签组 - if (empty($goods_info[ 'label_ids' ])) { - $goods_info[ 'label_ids' ] = []; - } else { - $goods_info[ 'label_ids' ] = array_map(function ($item) { - return (int) $item; - }, $goods_info[ 'label_ids' ]); - } - - // 商品服务 - if (empty($goods_info[ 'service_ids' ])) { - $goods_info[ 'service_ids' ] = []; - } else { - $goods_info[ 'service_ids' ] = array_map(function ($item) { - return (int) $item; - }, $goods_info[ 'service_ids' ]); - } - - // 商品参数,处理数据类型 - if (empty($goods_info[ 'attr_ids' ])) { - $goods_info[ 'attr_ids' ] = []; - } else { - $goods_info[ 'attr_ids' ] = array_map(function ($item) { - return (int) $item; - }, $goods_info[ 'attr_ids' ]); - } - - // 商品海报id,处理数据类型 - if (empty($goods_info[ 'poster_id' ])) { - $goods_info[ 'poster_id' ] = ''; - } - - // 自定义商品详情模板id,处理数据类型 - if (!empty($goods_info[ 'diy_detail_id' ])) { - $diy_model = new Diy(); - $diy_count = $diy_model->where([ - [ 'id', '=', $goods_info[ 'diy_detail_id' ] ] - ])->count(); - if ($diy_count == 0) { - $goods_info[ 'diy_detail_id' ] = ''; - } - } else { - $goods_info[ 'diy_detail_id' ] = ''; - } - - // 万能表单id,处理数据类型 - if (!empty($goods_info[ 'form_id' ])) { - $diy_form_model = new DiyForm(); - $diy_form_count = $diy_form_model->where([ - [ 'form_id', '=', $goods_info[ 'form_id' ] ] - ])->count(); - if ($diy_form_count == 0) { - $goods_info[ 'form_id' ] = ''; - } - } else { - $goods_info[ 'form_id' ] = ''; - } - - $goods_info[ 'status' ] = (string) $goods_info[ 'status' ]; - - $goods_sku_model = new GoodsSku(); - - $sku_field = 'sku_id,sku_name,sku_image,sku_no,goods_id,sku_spec_format,price,market_price,cost_price,stock,is_default'; - $sku_order = 'sku_id asc'; - $goods_info[ 'sku_list' ] = $goods_sku_model->withSearch([ "goods_id" ], [ 'goods_id' => $params[ 'goods_id' ] ])->field($sku_field)->order($sku_order)->select()->toArray(); - - $goods_info[ 'spec_type' ] = 'single'; - if (count($goods_info[ 'sku_list' ]) > 1) { - // 多规格 - $goods_info[ 'spec_type' ] = 'multi'; - - $goods_spec_model = new GoodsSpec(); - $spec_field = 'spec_id,goods_id,spec_name,spec_values'; - $spec_order = 'spec_id asc'; - $goods_info[ 'spec_list' ] = $goods_spec_model->withSearch([ "goods_id" ], [ 'goods_id' => $params[ 'goods_id' ] ])->field($spec_field)->order($spec_order)->select()->toArray(); - - } - - // 存在订单的虚拟商品(收货方式为 到店核销),则无法编辑收发货设置 - if ($goods_info[ 'virtual_receive_type' ] == 'verify') { - $order_goods_model = new OrderGoods(); - - // 检测订单是否存在 - $order_where = [ - [ 'orderMain.status', 'in', [ 1, 2, 3 ] ], // 排除已完成、已关闭状态 - [ 'goods_id', '=', $goods_info[ 'goods_id' ] ], - ]; - $goods_info[ 'order_goods_count' ] = $order_goods_model - ->withJoin([ 'orderMain' ]) - ->where($order_where)->count(); - } else { - $goods_info[ 'order_goods_count' ] = 0; - } - - // 查询商品参与营销活动的数量 - $goods_info[ 'active_goods_count' ] = $this->getActiveGoodsCount($goods_info[ 'goods_id' ]); - - $res[ 'goods_info' ] = $goods_info; - - } - - } - $res[ 'default_sort' ] = ( new CoreGoodsConfigService() )->getDefaultSort(); - - return $res; - } - - /** - * 添加商品 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - try { - Db::startTrans(); - $goods_sku_model = new GoodsSku(); - $goods_spec_model = new GoodsSpec(); - $goods_stat_model = new Stat(); - - // 商品封面 - if (!empty($data[ 'goods_image' ])) $data[ 'goods_cover' ] = explode(',', $data[ 'goods_image' ])[ 0 ]; - - $goods_data = [ - 'goods_name' => $data[ 'goods_name' ], - 'sub_title' => $data[ 'sub_title' ], - 'goods_type' => $data[ 'goods_type' ], - 'goods_cover' => $data[ 'goods_cover' ], - 'goods_image' => $data[ 'goods_image' ], - 'goods_image_width' => $data[ 'goods_image_width' ], - 'goods_image_height' => $data[ 'goods_image_height' ], - 'goods_video' => $data[ 'goods_video' ], - 'goods_category' => array_map(function ($item) { - return (string) $item; - }, $data[ 'goods_category' ]), - 'goods_desc' => $data[ 'goods_desc' ], - 'brand_id' => $data[ 'brand_id' ], - 'label_ids' => array_map(function ($item) { - return (string) $item; - }, $data[ 'label_ids' ]), - 'service_ids' => array_map(function ($item) { - return (string) $item; - }, $data[ 'service_ids' ]), - 'unit' => $data[ 'unit' ], - 'stock' => $data[ 'stock' ], - 'virtual_sale_num' => $data[ 'virtual_sale_num' ], - 'is_limit' => $data[ 'is_limit' ], - 'limit_type' => $data[ 'limit_type' ], - 'max_buy' => $data[ 'max_buy' ], - 'min_buy' => $data[ 'min_buy' ], - 'is_gift' => $data[ 'is_gift' ], - 'status' => $data[ 'status' ], - 'sort' => $data[ 'sort' ], - 'attr_ids' => $data[ 'attr_ids' ], - 'attr_format' => $data[ 'attr_format' ], - 'supplier_id' => $data[ 'supplier_id' ], - 'virtual_auto_delivery' => $data[ 'virtual_auto_delivery' ] ?? 0, - 'virtual_receive_type' => $data[ 'virtual_receive_type' ] ?? 'artificial', - 'virtual_verify_type' => $data[ 'virtual_verify_type' ] ?? 0, - 'virtual_indate' => $data[ 'virtual_indate' ] ?? 0, - 'member_discount' => $data[ 'member_discount' ], - 'poster_id' => $data[ 'poster_id' ], - 'form_id' => $data[ 'form_id' ], - 'diy_detail_id' => $data[ 'diy_detail_id' ], - 'create_time' => time() - ]; - $res = $this->model->create($goods_data); - - $sku_data = []; - if ($data[ 'spec_type' ] == 'single') { - if (!empty($data[ 'sku_no' ])) { - ( new ConfigService() )->verifySkuNo([ 'sku_no' => $data[ 'sku_no' ] ]); - } - // 单规格 - $sku_data = [ - 'sku_name' => '', - 'sku_image' => $data[ 'goods_cover' ], - 'sku_no' => $data[ 'sku_no' ], - 'goods_id' => $res->goods_id, - 'sku_spec_format' => '', // sku规格格式 - 'price' => $data[ 'price' ], - 'market_price' => $data[ 'market_price' ], - 'sale_price' => $data[ 'price' ], - 'cost_price' => $data[ 'cost_price' ], - 'stock' => $data[ 'stock' ], - 'is_default' => 1 - ]; - $goods_sku_model->save($sku_data); - - } elseif ($data[ 'spec_type' ] == 'multi') { - $sku_no = implode(',', array_column($data[ 'goods_sku_data' ] ?? [], 'sku_no')); - if (!empty($sku_no)) { - ( new ConfigService() )->verifySkuNo([ 'sku_no' => $sku_no ]); - } - // 多规格数据 - $default_spec_count = 0; - foreach ($data[ 'goods_sku_data' ] as $k => $v) { - $sku_spec_format = []; - foreach ($v[ 'sku_spec' ] as $ck => $cv) { - $sku_spec_format[] = $cv[ 'spec_value_name' ]; - } - $sku_data[] = [ - 'sku_name' => $v[ 'spec_name' ], - 'sku_image' => !empty($v[ 'sku_image' ]) ? $v[ 'sku_image' ] : $data[ 'goods_cover' ], - 'sku_no' => $v[ 'sku_no' ], - 'goods_id' => $res->goods_id, - 'sku_spec_format' => implode(',', $sku_spec_format), // sku规格格式 - 'price' => $v[ 'price' ], - 'market_price' => $v[ 'market_price' ], - 'sale_price' => $v[ 'price' ], - 'cost_price' => $v[ 'cost_price' ], - 'stock' => $v[ 'stock' ], - 'is_default' => $v[ 'is_default' ] - ]; - if ($v[ 'is_default' ] == 1) $default_spec_count++; - } - - if ($default_spec_count == 0) throw new AdminException('SHOP_GOODS_NOT_HAS_DEFAULT_SPEC'); - - $goods_sku_model->saveAll($sku_data); - - // 商品规格值 - $spec_data = []; - foreach ($data[ 'goods_spec_format' ] as $k => $v) { - $spec_values = []; - foreach ($v[ 'values' ] as $ck => $cv) { - $spec_values[] = $cv[ 'spec_value_name' ]; - } - $spec_data[] = [ - 'goods_id' => $res->goods_id, - 'spec_name' => $v[ 'spec_name' ], - 'spec_values' => implode(',', $spec_values) - ]; - } - $goods_spec_model->saveAll($spec_data); - - } - - //添加商品统计表数据 - $goods_stat_data = [ - 'date' => date('Y-m-d'), - 'date_time' => strtotime(date('Y-m-d')), - 'goods_id' => $res->goods_id, - ]; - $goods_stat_model->create($goods_stat_data); - - Db::commit(); - - event('AfterGoodsEdit', [ - 'goods_id' => $res->goods_id, - 'goods_data' => $goods_data, - 'sku_data' => $sku_data - ]); - return $res->goods_id; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 商品编辑 - * @param int $goods_id - * @param array $data - * @return bool - */ - public function edit(int $goods_id, array $data) - { - try { - Db::startTrans(); - - $goods_sku_model = new GoodsSku(); - $goods_spec_model = new GoodsSpec(); - $order_goods_model = new OrderGoods(); - - // 查询商品参与营销活动的数量 - $active_goods_count = $this->getActiveGoodsCount($goods_id); - if ($data[ 'status' ] == 0) { - if ($active_goods_count > 0) { - throw new AdminException('SHOP_GOODS_PARTICIPATE_IN_ACTIVE_DISABLED_EDIT'); - } - } - - // 商品封面 - if (!empty($data[ 'goods_image' ])) $data[ 'goods_cover' ] = explode(',', $data[ 'goods_image' ])[ 0 ]; - - $goods_data = [ - 'goods_name' => $data[ 'goods_name' ], - 'sub_title' => $data[ 'sub_title' ], - 'goods_type' => $data[ 'goods_type' ], - 'goods_cover' => $data[ 'goods_cover' ], - 'goods_image' => $data[ 'goods_image' ], - 'goods_image_width' => $data[ 'goods_image_width' ], - 'goods_image_height' => $data[ 'goods_image_height' ], - - 'goods_video' => $data[ 'goods_video' ], - 'goods_category' => array_map(function ($item) { - return (string) $item; - }, $data[ 'goods_category' ]), - 'goods_desc' => $data[ 'goods_desc' ], - 'brand_id' => $data[ 'brand_id' ], - 'label_ids' => array_map(function ($item) { - return (string) $item; - }, $data[ 'label_ids' ]), - 'service_ids' => array_map(function ($item) { - return (string) $item; - }, $data[ 'service_ids' ]), - 'unit' => $data[ 'unit' ], - 'stock' => $data[ 'stock' ], - 'virtual_sale_num' => $data[ 'virtual_sale_num' ], - 'is_limit' => $data[ 'is_limit' ], - 'limit_type' => $data[ 'limit_type' ], - 'max_buy' => $data[ 'max_buy' ], - 'min_buy' => $data[ 'min_buy' ], - 'is_gift' => $data[ 'is_gift' ], - 'status' => $data[ 'status' ], - 'sort' => $data[ 'sort' ], - 'attr_ids' => $data[ 'attr_ids' ], - 'attr_format' => $data[ 'attr_format' ], - 'supplier_id' => $data[ 'supplier_id' ], - 'virtual_auto_delivery' => $data[ 'virtual_auto_delivery' ] ?? 0, - 'virtual_receive_type' => $data[ 'virtual_receive_type' ] ?? 'artificial', - 'virtual_verify_type' => $data[ 'virtual_verify_type' ] ?? 0, - 'virtual_indate' => $data[ 'virtual_indate' ] ?? 0, - 'member_discount' => $data[ 'member_discount' ], - 'poster_id' => $data[ 'poster_id' ], - 'form_id' => $data[ 'form_id' ], - 'diy_detail_id' => $data[ 'diy_detail_id' ], - 'update_time' => time() - ]; - - $this->model->where([ [ 'goods_id', '=', $goods_id ] ])->update($goods_data); - - $sku_data = []; - if ($data[ 'spec_type' ] == 'single') { - if (!empty($data[ 'sku_no' ])) { - $check = [ 'sku_no' => $data[ 'sku_no' ], 'goods_id' => $goods_id ]; - ( new ConfigService() )->verifySkuNo($check); - } - // 单规格 - $sku_data = [ - 'sku_name' => '', - 'sku_image' => $data[ 'goods_cover' ], - 'sku_no' => $data[ 'sku_no' ], - 'goods_id' => $goods_id, - 'sku_spec_format' => '', // sku规格格式 - 'market_price' => $data[ 'market_price' ], - 'cost_price' => $data[ 'cost_price' ], - 'is_default' => 1 - ]; - - // 未参与营销活动,则允许修改 原价、销售价、库存 - if ($active_goods_count == 0) { - $sku_data[ 'price' ] = $data[ 'price' ]; - $sku_data[ 'sale_price' ] = $data[ 'price' ]; - $sku_data[ 'stock' ] = $data[ 'stock' ]; - } - - $sku_count = $goods_sku_model->where([ [ 'goods_id', '=', $goods_id ] ])->count(); - if ($sku_count > 1) { - - // 规格项发生变化,删除旧规格,添加新规格重新生成 - $goods_sku_model->where([ [ 'goods_id', '=', $goods_id ] ])->delete(); - - // 防止存在遗留规格项,删除旧规格 - $goods_spec_model->where([ [ 'goods_id', '=', $goods_id ] ])->delete(); - - // 新增规格 - $goods_sku_model->create($sku_data); - - } else { - - $goods_sku_model->where([ [ 'goods_id', '=', $goods_id ] ])->update($sku_data); - - // 防止存在遗留规格项,删除旧规格 - $goods_spec_model->where([ [ 'goods_id', '=', $goods_id ] ])->delete(); - } - - } elseif ($data[ 'spec_type' ] == 'multi') { - $sku_no = implode(',', array_column($data[ 'goods_sku_data' ] ?? [], 'sku_no')); - if (!empty($sku_no)) { - $check = [ 'sku_no' => $sku_no, 'goods_id' => $goods_id ]; - ( new ConfigService() )->verifySkuNo($check); - } - // 多规格数据 - $first_sku_data = reset($data[ 'goods_sku_data' ]); - - // 商品正在参与营销活动,禁止修改规格 - if ($active_goods_count > 0 && empty($first_sku_data[ 'sku_id' ])) { - throw new AdminException('SHOP_GOODS_PARTICIPATE_IN_ACTIVE_DISABLED_EDIT'); - } - - // 检测规格项是否发生变化 - if (!empty($first_sku_data[ 'sku_id' ])) { - // 规格项没有变化,修改/新增规格数据 - - $sku_id_arr = []; - $default_spec_count = 0; - foreach ($data[ 'goods_sku_data' ] as $k => $v) { - $sku_spec_format = []; - foreach ($v[ 'sku_spec' ] as $ck => $cv) { - $sku_spec_format[] = $cv[ 'spec_value_name' ]; - } - $sku_data = [ - 'sku_name' => $v[ 'spec_name' ], - 'sku_image' => !empty($v[ 'sku_image' ]) ? $v[ 'sku_image' ] : $data[ 'goods_cover' ], - 'sku_no' => $v[ 'sku_no' ], - 'goods_id' => $goods_id, - 'sku_spec_format' => implode(',', $sku_spec_format), // sku规格格式 - 'market_price' => $v[ 'market_price' ], - 'cost_price' => $v[ 'cost_price' ], - 'is_default' => $v[ 'is_default' ] - ]; - - // 未参与营销活动,则允许修改 原价、销售价 - if ($active_goods_count == 0) { - $sku_data[ 'price' ] = $v[ 'price' ]; - $sku_data[ 'sale_price' ] = $v[ 'price' ]; - $sku_data[ 'stock' ] = $v[ 'stock' ]; - } - - if (!empty($v[ 'sku_id' ])) { - // 修改规格 - $sku_id_arr[] = $v[ 'sku_id' ]; - $goods_sku_model->where([ [ 'sku_id', '=', $v[ 'sku_id' ] ], [ 'goods_id', '=', $goods_id ] ])->update($sku_data); - } else { - // 新增规格 - $sku_model = $goods_sku_model->create($sku_data); - $sku_id_arr[] = $sku_model->sku_id; - } - if ($v[ 'is_default' ] == 1) $default_spec_count++; - - } - - // 校验默认必须存在默认规格 - if ($default_spec_count == 0) throw new AdminException('SHOP_GOODS_NOT_HAS_DEFAULT_SPEC'); - - $spec_id_list = $goods_spec_model->withSearch([ "goods_id" ], [ 'goods_id' => $goods_id ])->field('spec_id')->select()->toArray(); - $spec_id_list = array_column($spec_id_list, 'spec_id'); - - // 商品规格值 - foreach ($data[ 'goods_spec_format' ] as $k => $v) { - $spec_values = []; - foreach ($v[ 'values' ] as $ck => $cv) { - $spec_values[] = $cv[ 'spec_value_name' ]; - } - $spec_data = [ - 'goods_id' => $goods_id, - 'spec_name' => $v[ 'spec_name' ], - 'spec_values' => implode(',', $spec_values) - ]; - if (!empty($v[ 'spec_id' ])) { - // 修改规格值 - $goods_spec_model->where([ [ 'goods_id', '=', $goods_id ], [ 'spec_id', '=', $v[ 'spec_id' ] ] ])->update($spec_data); - foreach ($spec_id_list as $ck => $cv) { - if ($v[ 'spec_id' ] == $cv) { - unset($spec_id_list[ $ck ]); - } - } - - } else { - // 添加规格值 - $goods_spec_model->save($spec_data); - } - } - - // 移除不存在的规格项 - if (!empty($spec_id_list)) { - $goods_spec_model->where([ [ 'spec_id', 'in', implode(',', $spec_id_list) ] ])->delete(); - } - - // 移除不存在的商品SKU - $sku_id_list = $goods_sku_model->withSearch([ "goods_id" ], [ 'goods_id' => $goods_id ])->field('sku_id')->select()->toArray(); - $sku_id_list = array_column($sku_id_list, 'sku_id'); - foreach ($sku_id_list as $k => $v) { - foreach ($sku_id_arr as $ck => $cv) { - if ($v == $cv) { - unset($sku_id_list[ $k ]); - } - } - } - $sku_id_list = array_values($sku_id_list); - - if (!empty($sku_id_list)) { - - // 检测订单是否存在要删除的商品 - $order_where = [ - [ 'orderMain.status', 'in', [ 1, 2, 3 ] ], // 排除已完成、已关闭状态 - [ 'goods_id', '=', $goods_id ], - [ 'sku_id', 'in', $sku_id_list ] - ]; - $order_goods_count = $order_goods_model - ->withJoin([ 'orderMain' ]) - ->where($order_where)->count(); - - if ($order_goods_count > 0) { - Db::rollback(); - throw new CommonException('EXIST_ORDER_NOT_DELETE_GOODS'); - } - - $goods_sku_model->where([ [ 'sku_id', 'in', implode(',', $sku_id_list) ] ])->delete(); - } - - } else { - - // 检测订单是否存在要删除的商品 - $order_where = [ - [ 'orderMain.status', 'in', [ 1, 2, 3 ] ], // 排除已完成、已关闭状态 - [ 'goods_id', '=', $goods_id ] - ]; - $order_goods_count = $order_goods_model - ->withJoin([ 'orderMain' ]) - ->where($order_where)->count(); - - if ($order_goods_count > 0) { - Db::rollback(); - throw new CommonException('EXIST_ORDER_NOT_EDIT_GOODS'); - } - - // 规格项发生变化,删除旧规格,添加新规格重新生成 - $goods_sku_model->where([ [ 'goods_id', '=', $goods_id ] ])->delete(); - $goods_spec_model->where([ [ 'goods_id', '=', $goods_id ] ])->delete(); - - $default_spec_count = 0; - foreach ($data[ 'goods_sku_data' ] as $k => $v) { - $sku_spec_format = []; - foreach ($v[ 'sku_spec' ] as $ck => $cv) { - $sku_spec_format[] = $cv[ 'spec_value_name' ]; - } - $sku_data[] = [ - 'sku_name' => $v[ 'spec_name' ], - 'sku_image' => !empty($v[ 'sku_image' ]) ? $v[ 'sku_image' ] : $data[ 'goods_cover' ], - 'sku_no' => $v[ 'sku_no' ], - 'goods_id' => $goods_id, - 'sku_spec_format' => implode(',', $sku_spec_format), // sku规格格式 - 'price' => $v[ 'price' ], - 'market_price' => $v[ 'market_price' ], - 'sale_price' => $v[ 'price' ], - 'cost_price' => $v[ 'cost_price' ], - 'stock' => $v[ 'stock' ], - 'is_default' => $v[ 'is_default' ] - ]; - if ($v[ 'is_default' ] == 1) $default_spec_count++; - } - - // 校验默认必须存在默认规格 - if ($default_spec_count == 0) throw new AdminException('SHOP_GOODS_NOT_HAS_DEFAULT_SPEC'); - - $goods_sku_model->saveAll($sku_data); - - // 商品规格值 - $spec_data = []; - foreach ($data[ 'goods_spec_format' ] as $k => $v) { - $spec_values = []; - foreach ($v[ 'values' ] as $ck => $cv) { - $spec_values[] = $cv[ 'spec_value_name' ]; - } - $spec_data[] = [ - 'goods_id' => $goods_id, - 'spec_name' => $v[ 'spec_name' ], - 'spec_values' => implode(',', $spec_values) - ]; - } - $goods_spec_model->saveAll($spec_data); - - } - - } - - Db::commit(); - - event('AfterGoodsEdit', [ - 'goods_id' => $goods_id, - 'goods_data' => $goods_data, - 'sku_data' => $sku_data - ]); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 查询商品参与营销活动的数量 - * @param $goods_id - * @return mixed - */ - public function getActiveGoodsCount($goods_id) - { - $active_goods_model = new ActiveGoods(); - $discount_goods_model = new DiscountGoods(); - $field = 'active_goods_id,active_id'; - - $condition = []; - - // 判断 $goods_id 类型 - if (is_array($goods_id)) { - $condition[] = [ 'goods_id', 'in', $goods_id ]; - } else { - $condition[] = [ 'goods_id', '=', $goods_id ]; - } - - // 活动商品条件 - $active_goods_count = $active_goods_model->where(array_merge($condition, [ - [ 'active_goods_status', '=', 'active' ], - [ 'active_goods_type', 'in', [ ActiveDict::GOODS_SINGLE, ActiveDict::GOODS_INDEPENDENT ] ] - ]))->field($field)->with([ - 'active' => function ($query) { - $query->withField('active_id,active_name, active_desc, start_time, end_time'); - } - ])->count(); - - // 折扣商品条件 - $discount_goods_count = $discount_goods_model->where(array_merge($condition, [ - [ 'status', '=', 'active' ] - ]))->field('discount_goods_id')->with([ - 'discount' => function ($query) { - $query->withField('discount_id'); - } - ])->count(); - - return $active_goods_count + $discount_goods_count; - } - -} diff --git a/niucloud/addon/shop/app/service/admin/local_delivery/config/ConfigService.php b/niucloud/addon/shop/app/service/admin/local_delivery/config/ConfigService.php deleted file mode 100644 index 6937b553e..000000000 --- a/niucloud/addon/shop/app/service/admin/local_delivery/config/ConfigService.php +++ /dev/null @@ -1,44 +0,0 @@ -setLocalDeliveryConfig($data); - } - - /** - * 获取配送配置 - * @return array - */ - public function getConfig() - { - return (new CoreConfigService())->getLocalDeliveryConfig(); - } -} diff --git a/niucloud/addon/shop/app/service/admin/local_delivery/config/LocalService.php b/niucloud/addon/shop/app/service/admin/local_delivery/config/LocalService.php deleted file mode 100644 index 77add8dc3..000000000 --- a/niucloud/addon/shop/app/service/admin/local_delivery/config/LocalService.php +++ /dev/null @@ -1,80 +0,0 @@ -where([['local_id', '>', 0]])->delete(); - - $create_res = (new Local())->create([ - 'fee_type' => $data['fee_type'], - 'base_dist' => $data['base_dist'], - 'base_price' => $data['base_price'], - 'grad_dist' => $data['grad_dist'], - 'grad_price' => $data['grad_price'], - 'weight_start' => $data['weight_start'], - 'weight_unit' => $data['weight_unit'], - 'weight_price' => $data['weight_price'], - - 'time_is_open' => $data['time_is_open'], - 'time_type' => $data['time_type'], - 'time_week' => $data['time_week'], - 'time_interval' => $data['time_interval'], - 'advance_day' => 0, - 'most_day' => 7, - 'start_time' => $data['start_time'], - 'end_time' => $data['end_time'], - 'delivery_time' => $data['delivery_time'], - 'area' => [] - ]); - - try { - if (!empty($data['area_data'])) { - foreach ($data['area_data'] as $store_id => $area) { - (new DeliveryStoreService())->editArea($store_id, $area); - } - } - } catch (\Exception $e) { - } - return $create_res->local_id; - } - - /** - * 获取同城配送设置 - * @return array - */ - public function getLocal($field = 'fee_type,base_dist,base_price,grad_dist,grad_price,weight_start,weight_unit,weight_price') - { - return (new Local())->where([['local_id', '>', 0]])->field($field)->findOrEmpty()->toArray(); - } -} diff --git a/niucloud/addon/shop/app/service/admin/local_delivery/order/LocalDeliveryOrderService.php b/niucloud/addon/shop/app/service/admin/local_delivery/order/LocalDeliveryOrderService.php deleted file mode 100644 index a95dad41c..000000000 --- a/niucloud/addon/shop/app/service/admin/local_delivery/order/LocalDeliveryOrderService.php +++ /dev/null @@ -1,118 +0,0 @@ -model = new LocalDeliveryOrder(); - } - - /** - * 查询本地配送订单列表 - * @param array $where - * @return array - * @throws DbException - */ - public function getPage(array $where) - { - $field = 'id, delivery_service, delivery_no, trade_id, trade_no, trade_type, delivery_money, delivery_start, delivery_start_lng, delivery_start_lat, delivery_end, delivery_end_lng, delivery_end_lat, delivery_distance, status, create_time, remark, body'; - $search_model = $this->model->where([ ['id', '>', 0] ])->withSearch([ 'delivery_no', 'trade_no', 'status', 'create_time' ], $where)->field($field)->order('create_time desc')->append([ 'delivery_service_name' , 'status_name', 'trade_type_name', 'pre_status_name' ]); - return $this->pageQuery($search_model); - } - - /** - * 查询本地配送订单详情 - * @return array - */ - public function getInfo(int $id) - { - $field = 'id, delivery_service, delivery_no, out_delivery_no, trade_id, trade_no, trade_type, delivery_money, delivery_start, delivery_start_lng, delivery_start_lat, delivery_end, delivery_end_lng, delivery_end_lat, delivery_distance, status, create_time, finish_time, cancel_time, rider_name, rider_mobile, remark, body'; - return $this->model->where([ [ 'id', '=', $id ] ])->field($field)->with(['orderLog'])->append([ 'delivery_service_name' , 'status_name', 'trade_type_name' ])->findOrEmpty()->toArray(); - } - - /** - * 取消订单 - * @param int $id - * @param array $data - * @return bool - */ - public function closeOrder(int $id, array $data) - { - $data['main_id'] = $this->uid; - $data['main_type'] = OrderLogDict::STORE; - $data['main_name'] = (new SysUser())->where('uid', $this->uid)->value('username') ?? ''; - $data['id'] = $id; - return (new CoreLocalDeliveryOrderCloseService())->closeOrder($data); - } - - /** - * 完成订单 - * @param int $id - * @return bool - */ - public function finishOrder(int $id) - { - $data['main_id'] = $this->uid; - $data['main_type'] = OrderLogDict::STORE; - $data['main_name'] = (new SysUser())->where('uid', $this->uid)->value('username') ?? ''; - $data['id'] = $id; - return (new CoreLocalDeliveryOrderFinishService())->finishOrder($data); - } - - /** - * 同步订单信息 - * @param int $id - * @return bool - */ - public function syncOrder(int $id) - { - return (new CoreLocalDeliveryOrderService())->syncOrder($id); - } - - /** - * 订单取消原因 - * @return array - */ - public function getCancelReasonList(string $service) - { - return OrderCancelReasonDict::getType('', $service); - } - - /** - * 获取订单状态列表 - * @return array - */ - public function getOrderStatusList() - { - return LocalDeliveryStatusDict::getStatus(); - } -} diff --git a/niucloud/addon/shop/app/service/admin/local_delivery/service/LocalDeliveryServiceService.php b/niucloud/addon/shop/app/service/admin/local_delivery/service/LocalDeliveryServiceService.php deleted file mode 100644 index 9614d92c7..000000000 --- a/niucloud/addon/shop/app/service/admin/local_delivery/service/LocalDeliveryServiceService.php +++ /dev/null @@ -1,150 +0,0 @@ -model = new LocalDeliveryService(); - } - - /** - * 获取配送服务商列表 - */ - public function getList() - { - $delivery_type_list = LocalDeliveryDict::getType(); - $list = []; - foreach($delivery_type_list as $k => $v) - { - $info = $this->getConfig($k); - $data = []; - $data['delivery_type'] = $k; - $data['name'] = $v['name']; - $data['is_merchant'] = $v['is_merchant']; - $data['is_use'] = $info['is_use']; - foreach ($v['params'] as $k_param => $v_param) - { - $data['params'][$k_param] = [ - 'name' => $v_param, - 'value' => $info ? $info['config'][$k_param] ?? '' : '' - ]; - } - $data['component'] = $v['component'] ?? ''; - $list[] = $data; - } - return $list; - } - - /** - * 设置服务商配置 - * @param $delivery_type - * @param $data - * @return true - */ - public function setConfig($delivery_type, $data) - { - $delivery_type_list = LocalDeliveryDict::getType(); - if(!array_key_exists($delivery_type, $delivery_type_list)) throw new AdminException('LOCAL_DELIVERY_TYPE_NOT_EXIST'); - $db_config = $this->getConfig($delivery_type); - $config = []; - foreach ($delivery_type_list[$delivery_type]['params'] as $k_param => $v_param) - { - if ($data[$k_param] == CommonDict::ENCRYPT_STR){ - $config[$k_param] = $db_config['params'][$k_param]['value']; - }else{ - $config[$k_param] = $data[$k_param] ?? ''; - } - - } - $third_delivery = $this->model->where([['key', '=', $delivery_type]])->findOrEmpty(); - if ($third_delivery->isEmpty()) { - $this->model->create([ - 'key' => $delivery_type, - 'name' => $delivery_type_list[$delivery_type]['name'], - 'config' => $config, - 'is_use' => $data['is_use'] ?? 0, - ]); - } else { - $third_delivery->save([ - 'config' => $config, - 'is_use' => $data['is_use'] ?? 0, - ]); - } - return true; - } - - /** - * 获取服务商配置 - * @return array - */ - public function getConfig($delivery_type,$is_encrypt = false) - { - $delivery_type_list = LocalDeliveryDict::getType(); - if(!array_key_exists($delivery_type, $delivery_type_list)) throw new AdminException('LOCAL_DELIVERY_TYPE_NOT_EXIST'); - $info = $this->model->where([['key', '=', $delivery_type]])->findOrEmpty()->toArray(); - $data = [ - 'delivery_type' => $delivery_type, - 'name' => $delivery_type_list[$delivery_type]['name'], - 'is_merchant' => $delivery_type_list[$delivery_type]['is_merchant'], - 'is_use' => $info ? $info['is_use'] : ($delivery_type_list[$delivery_type]['is_merchant'] ? 1 : 0) - ]; - foreach ($delivery_type_list[$delivery_type]['params'] as $k_param => $v_param) - { - $data['params'][$k_param] = [ - 'name' => $v_param, - 'value' => $info ? ($is_encrypt ? CommonDict::ENCRYPT_STR :$info['config'][$k_param]) ?? '' : '' - ]; - } - return $data; - } - - /** - * 获取已启用配送服务商列表 - * @param array $data - * @return array - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function getInUseList(array $data) - { - $support_delivery_list = (new Store())->where([['store_id', '=', $data['store_id']], ['status', '=', 1]])->value('support_delivery') ?? []; - $list = $this->model->field('key,name')->where([['is_use', '=', 1]])->select()->toArray(); - foreach ($list as &$v) { - if (in_array($v['key'], array_keys($support_delivery_list))) { - $v['open_status'] = $support_delivery_list[$v['key']]['open_status']; - } else { - $v['open_status'] = LocalDeliveryDict::OPEN_REFUND; - } - } - return $list; - } -} diff --git a/niucloud/addon/shop/app/service/admin/marketing/CouponService.php b/niucloud/addon/shop/app/service/admin/marketing/CouponService.php deleted file mode 100644 index 627abf5d1..000000000 --- a/niucloud/addon/shop/app/service/admin/marketing/CouponService.php +++ /dev/null @@ -1,630 +0,0 @@ -model = new Coupon(); - } - - public function getInit() - { - // 查询商品分类 - $goods_category_tree = []; - $goods_category_service = new CategoryService(); - $goods_category = $goods_category_service->getTree(); - foreach ($goods_category as $k => $v) { - $children = []; - if (!empty($v['child_list'])) { - foreach ($v['child_list'] as $ck => $cv) { - $children[] = [ - 'value' => $cv['category_id'], - 'label' => $cv['category_name'], - ]; - } - } - $goods_category_tree[] = [ - 'value' => $v['category_id'], - 'label' => $v['category_name'], - 'children' => $children - ]; - } - $res['goods_category_tree'] = $goods_category_tree; - return $res; - } - - /** - * 获取优惠券列表 - * @param array $where - * @return array - * @throws \think\db\exception\DbException - */ - public function getPage(array $where = []) - { - $field = 'id,title,price,type,receive_type,start_time,end_time,remain_count,receive_count,give_count,status,limit_count,min_condition_money,receive_status,valid_type,length,valid_end_time'; - $order = 'id desc'; - $search_model = $this->model->where([['id', '>', 0]])->withSearch(["title", "status"], $where)->append(['is_show_send', 'type_name', 'receive_type_name', 'status_name'])->field($field)->order($order); - $list = $this->pageQuery($search_model); - $coupon_member_model = new CouponMember(); - foreach ($list['data'] as $k => &$v) { - if ($v['remain_count'] != '-1') { - $v['sum_count'] = $v['remain_count'] + $v['receive_count']; - } else { - $v['sum_count'] = '-1'; - } - //查询已使用数量 - $v['receive_use_count'] = $coupon_member_model->where([['coupon_id', '=', $v['id']], ['use_time', '>', 1]])->count(); - } - return $list; - } - - /** - * 获取优惠券选择分页列表 - * @param array $where - * @return array - * @throws \think\db\exception\DbException - */ - public function getSelectPage(array $where = []) - { - $verify_coupon_ids = []; - // 检测优惠券id集合是否存在,移除不存在的优惠券id,纠正数据准确性 - if (!empty($where['verify_coupon_ids'])) { - $verify_coupon_ids = $this->model->where([ - ['id', 'in', $where['verify_coupon_ids']] - ])->withSearch(["title"], $where)->field('id')->select()->toArray(); - - if (!empty($verify_coupon_ids)) { - $verify_coupon_ids = array_column($verify_coupon_ids, 'id'); - } - } - - $field = 'id,title,price,type,receive_type,start_time,end_time,remain_count,receive_count,status,limit_count,min_condition_money,receive_status,valid_type,length,valid_end_time'; - $order = 'id desc'; - $search_model = $this->model->where([['status', '=', CouponDict::NORMAL]])->withSearch(["title"], $where)->append(['type_name', 'receive_type_name', 'status_name'])->field($field)->order($order); - $list = $this->pageQuery($search_model); - $list['verify_coupon_ids'] = $verify_coupon_ids; - return $list; - } - - /** - * 查询选中的优惠券 - * @param string $coupon_ids - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function getSelectedList(string $coupon_ids = '') - { - if (empty($coupon_ids)) return []; - $field = 'id,title,price,type,receive_type,start_time,end_time,remain_count,receive_count,status,limit_count,min_condition_money,receive_status,valid_type,length,valid_end_time'; - $order = 'id desc'; - return $this->model->where([['id', 'in', $coupon_ids]])->append(['type_name', 'receive_type_name', 'status_name'])->field($field)->order($order)->select()->toArray(); - } - - /** - * 获取优惠券详情 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $info = $this->model->where([['id', '=', $id]])->findOrEmpty()->toArray(); - if ($info['remain_count'] == '-1') { - $info['limit'] = 2; - } else { - $info['limit'] = 1; - } - if ($info['min_condition_money'] == '0.00') { - $info['threshold'] = 2; - } else { - $info['threshold'] = 1; - } - if ($info['limit_count'] == 0) { - $info['limit_count'] = ''; - } - - if ($info['type'] == 2) { - $goods_coupon_model = new CouponGoods(); - $goods_coupon_list = $goods_coupon_model->where([['coupon_id', '=', $id]])->field('category_id')->select()->toArray(); - $info['goods_category_ids'] = array_column($goods_coupon_list, 'category_id'); - } else { - $info['goods_category_ids'] = []; - } - if ($info['type'] == 3) { - $goods_coupon_model = new CouponGoods(); - //获取商品ids - $goods_coupon_ids = $goods_coupon_model->where([['coupon_id', '=', $id]])->column('goods_id'); - //获取选中商品信息 - $goods_list = (new Goods())->field('goods_id,goods_cover,goods_name,status') - ->where([ ['goods.goods_id', 'in', $goods_coupon_ids], ['goods.status', '=', 1], ['goodsSku.is_default', '=', 1]]) - ->withJoin(['goodsSku' => function ($query) { - $query->field('sku_id,sku_name,sku_image,goodsSku.stock,goodsSku.price'); - }]) - ->hidden(['goodsSku']) - ->append(['goods_cover_thumb_small'])->select()->toArray(); - $info['goods_ids'] = $goods_coupon_ids; - $info['goods_list'] = $goods_list; - } else { - $info['goods_ids'] = []; - } - if ($info['remain_count'] != '-1') { - $info['sum_count'] = $info['remain_count'] + $info['receive_count']; - } else { - $info['remain_count'] = 1000; - $info['sum_count'] = '不限量'; - } - - //查询已使用数量 - $coupon_member_model = new CouponMember(); - $info['receive_invalid_count'] = $coupon_member_model->where([['coupon_id', '=', $info['id']], ['status', '=', CouponMemberDict::INVALID]])->count(); - $info['receive_use_count'] = $coupon_member_model->where([['coupon_id', '=', $info['id']], ['use_time', '>', 1]])->count(); - - //查询已过期数量 - $info['receive_expire_count'] = $coupon_member_model->where([['coupon_id', '=', $info['id']], ['use_time', '=', 0], ['expire_time', '<', time()]])->count(); - - return $info; - } - - /** - * 添加优惠券 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - if ($data['threshold'] == 2) { - $data['min_condition_money'] = 0; - } - if ($data['receive_type'] == 2) { - unset($data['receive_time']); - unset($data['valid_time']); - unset($data['limit_count']); - unset($data['remain_count']); - } else { - if ($data['receive_type_time'] == 1) { - if (!empty($data['receive_time'])) { - $data['start_time'] = strtotime($data['receive_time'][0]); - $data['end_time'] = strtotime($data['receive_time'][1]); - $now_time = strtotime(date('Y-m-d', time())); - if ($data['start_time'] > $now_time) { - $data['status'] = 0; // 活动未开始 - } - } else { - $data['start_time'] = ''; - $data['end_time'] = ''; - } - } else { - $data['start_time'] = ''; - $data['end_time'] = ''; - } - if (!empty($data['valid_time'])) { - $data['valid_start_time'] = time(); - $data['valid_end_time'] = strtotime($data['valid_time']); - if ($data['valid_end_time'] <= $data['valid_start_time']) throw new AdminException('SHOP_COUPON_VALID_END_TIME_NOT_ALLOW_LT_START_TIME'); - } - if ($data['limit'] == 2) { - $data['remain_count'] = '-1'; - } - } - - if (!empty($data['goods_ids']) || !empty($data['goods_category_ids'])) { - - $coupon_goods_model = new CouponGoods(); - if (!empty($data['goods_ids'])) { - Db::startTrans(); - try { - $res = $this->model->create($data); - $coupon_goods = []; - foreach ($data['goods_ids'] as $value) { - $coupon_goods[] = [ - 'coupon_id' => $res->id, - 'goods_id' => $value, - ]; - } - $coupon_goods_model->saveAll($coupon_goods); - Db::commit(); - return $res->id; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - if (!empty($data['goods_category_ids'])) { - Db::startTrans(); - try { - $res = $this->model->create($data); - $coupon_goods = []; - foreach ($data['goods_category_ids'] as $category) { - $coupon_goods[] = [ - 'coupon_id' => $res->id, - 'category_id' => $category[count($category) - 1], - ]; - } - - $coupon_goods_model->saveAll($coupon_goods); - Db::commit(); - return $res->id; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - } else { - $res = $this->model->create($data); - return $res->id; - } - } - - /** - * 编辑优惠券 - * @param int $id - * @param array $data - * @return bool - */ - public function edit(int $id, array $data) - { - $coupon_ids = $this->checkCouponInUse(); - if (in_array($id, $coupon_ids)) { - throw new AdminException('SHOP_COUPON_IN_USE_NOT_ALLOW_EDIT'); - } - if ($data['threshold'] == 2) { - $data['min_condition_money'] = 0; - } - unset($data['threshold']); - if ($data['receive_type'] == 2) { - unset($data['receive_time']); - unset($data['valid_time']); - unset($data['limit_count']); - unset($data['remain_count']); - - } else { - if ($data['receive_type_time'] == 1) { - if (!empty($data['receive_time'])) { - $data['start_time'] = strtotime($data['receive_time'][0]); - $data['end_time'] = strtotime($data['receive_time'][1]); - $now_time = strtotime(date('Y-m-d', time())); - if ($data['start_time'] > $now_time) { - $data['status'] = 0; // 活动未开始 - } - } else { - $data['start_time'] = ''; - $data['end_time'] = ''; - $data['status'] = 1; - } - } else { - $data['start_time'] = ''; - $data['end_time'] = ''; - $data['status'] = 1; - } - - if ($data['valid_type'] == 2) { - if (!empty($data['valid_time'])) { - $data['valid_start_time'] = time(); - $data['valid_end_time'] = strtotime($data['valid_time']); - if ($data['valid_end_time'] <= $data['valid_start_time']) throw new AdminException('SHOP_COUPON_VALID_END_TIME_NOT_ALLOW_LT_START_TIME'); - } - } else { - $data['valid_start_time'] = ''; - $data['valid_end_time'] = ''; - } - if ($data['limit'] == 2) { - $data['remain_count'] = '-1'; - } - - } - unset($data['limit']); - unset($data['receive_time']); - unset($data['valid_time']); - unset($data['receive_type_time']); - unset($data['type']); - - $coupon_goods_model = new CouponGoods(); - if (!empty($data['goods_ids'])) { - Db::startTrans(); - try { - - $coupon_goods = []; - $coupon_goods_model->where([['coupon_id', '=', $id]])->delete(); - foreach ($data['goods_ids'] as $value) { - $coupon_goods[] = [ - 'coupon_id' => $id, - 'goods_id' => $value, - ]; - } - $coupon_goods_model->saveAll($coupon_goods); - unset($data['goods_ids']); - unset($data['goods_category_ids']); - Db::commit(); - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } else if (!empty($data['goods_category_ids'])) { - Db::startTrans(); - try { - $coupon_goods = []; - $coupon_goods_model->where([['coupon_id', '=', $id]])->delete(); - foreach ($data['goods_category_ids'] as $category) { - $coupon_goods[] = [ - 'coupon_id' => $id, - 'category_id' => $category[count($category) - 1], - ]; - } - $coupon_goods_model->saveAll($coupon_goods); - unset($data['goods_ids']); - unset($data['goods_category_ids']); - Db::commit(); - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } else { - unset($data['goods_ids']); - unset($data['goods_category_ids']); - Db::startTrans(); - try { - $coupon_goods_model->where([['coupon_id', '=', $id]])->delete(); - Db::commit(); - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - $res = $this->model->where([ - ['id', '=', $id] - ])->update($data); - (new CoreCouponMemberService())->refeshMemberCouponExpireTime($id); - return $res; - } - - /** - * 删除优惠券 - * @param $ids - * @return bool - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function del($ids) - { - if (empty($ids)) { - return true; - } - $coupon_list = $this->model->where([ - ['id', 'in', implode(',', $ids)], - ])->field('id,status,title')->select()->toArray(); - $coupon_names = array_column($coupon_list, 'title', 'id'); - - $use_coupon_list = (new CouponMember())->where([ - ['coupon_id', 'in', implode(',', $ids)], - ['status', '=', CouponMemberDict::WAIT_USE] - ])->field('coupon_id')->select()->toArray(); - - $not_del_coupon_list = array_unique(array_column($use_coupon_list, 'coupon_id')); - if (count($not_del_coupon_list) > 0) { - $err_str = ''; - foreach ($not_del_coupon_list as $coupon_id) { - $err_str .= $coupon_names[$coupon_id] . '、'; - } - $err_str = rtrim($err_str, '、'); - $err_str .= " \n" . get_lang('SHOP_COUPON_IN_USE_NOT_ALLOW_DEL'); - throw new AdminException($err_str); - } - return $this->model->where([ ['id', 'in', implode(',', $ids)]])->delete(); - } - - /** - * 领取记录 - * @param int $id - * @return void - */ - public function getMemberCoupon($data) - { - $coupon_member_model = new CouponMember(); - $member_where = []; - if (isset($data['keywords']) && $data['keywords'] != '') { - $member_where = [['member.member_no|member.username|member.nickname|member.mobile', 'like', '%' . $this->model->handelSpecialCharacter($data['keywords']) . '%']]; - } - $memberList = $coupon_member_model->where([['coupon_id', '=', $data['id']]])->withJoin([ - 'member' => ['member_id', 'member_no', 'username', 'mobile', 'nickname'], - ])->where($member_where)->order('id desc')->append(['status_name', 'receive_type_name']); - $list = $this->pageQuery($memberList); - return $list; - } - - /** - * 领取状态修改 - * @param $id - * @param $status - * @return true - */ - public function setStatus($id, $status) - { - $coupon_ids = $this->checkCouponInUse(); - if (in_array($id, $coupon_ids)) { - throw new AdminException('SHOP_COUPON_IN_USE_NOT_ALLOW_EDIT'); - } - $data = array( - 'receive_status' => $status - ); - $this->model->where([['id', '=', $id]])->update($data); - return true; - } - - /** - * 优惠券失效 - * @param $id - * @param $status - * @return true - */ - public function couponInvalid($ids) - { - $data = array( - 'status' => CouponDict::INVALID - ); - $res = $this->model->where([['id', 'in', implode(',', $ids)]])->update($data); - $coupon_member_model = new CouponMember(); - if ($res) $coupon_member_model->where([ ['coupon_id', 'in', implode(',', $ids)], ['status', '=', CouponMemberDict::WAIT_USE]])->update(['status' => CouponMemberDict::INVALID]); - return true; - } - - - /** - * 优惠券使用检测 - * @return array - */ - public function checkCouponInUse() - { - $coupon_ids = []; - $sign_config = (new CoreConfigService())->getConfig( 'SIGN_CONFIG'); - if (!empty($sign_config) && !empty($sign_config['value'])) { - $sign_info = $sign_config['value']; - if (!empty($sign_info['day_award']) && !empty($sign_info['day_award']['shop_coupon'])) { - $coupon_ids = $sign_info['day_award']['shop_coupon']['coupon_id']; - } - if (!empty($sign_info['continue_award'])) { - foreach ($sign_info['continue_award'] as $item) { - if (!empty($item['shop_coupon'])) { - $coupon_ids = array_merge($coupon_ids, $item['shop_coupon']['coupon_id']); - } - } - } - $coupon_ids = array_values(array_unique($coupon_ids)); - } - return $coupon_ids; - } - - public function getSendReordsPageList($coupon_id, $data) - { - $where[] = ['coupon_id', '=', $coupon_id]; - if (!empty($data['range_type'])) { - $where[] = ['range_type', '=', $data['range_type']]; - } - $model = (new CouponSendRecord())->where($where)->with([ - 'coupon' => function ($query) { - $query->field('title,id'); - } - ])->withSearch(['create_time'], $data)->field("success_num,status,id,coupon_id,range_type,range_param,end_time,admin_username,create_time")->append(['status_name', 'range_param_value', 'range_type_name'])->order('create_time desc'); - $list = $this->pageQuery($model); - return $list; - } - - /** - * 添加发券记录 - * @param $coupon_id - * @param $data - * @return true - * @throws \think\db\exception\DbException - */ - public function sendCoupon($coupon_id, $data) - { - $coupon = (new Coupon())->where([['id', '=', $coupon_id]])->findOrEmpty(); - if ($coupon->isEmpty()) { - throw new CommonException('COUPON_NOT_EXIST'); - } - if ($coupon->status != CouponDict::NORMAL) { - throw new CommonException('COUPON_INVALID'); - } - $range_param = $data['range_param'] ?? []; - list($member_num, $range_param) = $this->getSendMemberNum($data['range_type'], $range_param); - $data = [ - 'coupon_id' => $coupon_id, - 'send_num' => $data['send_num'], - 'range_type' => $data['range_type'], - 'range_param' => $range_param, - 'member_num' => $member_num, - 'status' => CouponDict::SEND_STATUS_WAIT, - 'admin_uid' => $this->uid, - 'admin_username' => $this->username, - 'create_time' => time(), - ]; - $record_id = (new CouponSendRecord())->insertGetId($data); - CouponSend::dispatch(['record_id' => $record_id]); - return true; - } - - /** - * 获取发送用户数量 - * @param $range_type - * @param $range_param - * @return array - * @throws \think\db\exception\DbException - */ - public function getSendMemberNum($range_type, $range_param) - { - switch ($range_type) { - case CouponDict::SEND_RANGE_ALL: - $member_num = (new Member())->where([ - ])->count(); - break; - case CouponDict::SEND_RANGE_MEMBER: - $member_num = count($range_param['member_ids']); - break; - case CouponDict::SEND_RANGE_MEMBER_LEVEL: - $member_level = $range_param['member_level']; - $member_num = (new Member())->where([ - ['member_level', 'in', implode(',', $member_level)] - ])->count(); - $level_names = (new MemberLevel())->where([ - ['level_id', 'in', implode(',', $member_level)] - ])->column('level_name'); - $range_param['level_name'] = implode('、', $level_names); - break; - case CouponDict::SEND_RANGE_MEMBER_LABEL: - $member_label = $range_param['member_label']; - $member_num = (new Member())->where([ - ['member_id', '>', 0] - ])->withSearch(['member_label'], ['member_label' => $member_label])->count(); - $label_names = (new MemberLabel())->where([ - ['label_id', 'in', implode(',', $member_label)] - ])->column('label_name') ?? []; - $range_param['label_name'] = implode('、', $label_names);; - break; - default: - $member_num = 0; - break; - } - return [$member_num, $range_param]; - - } - -} diff --git a/niucloud/addon/shop/app/service/admin/marketing/DiscountService.php b/niucloud/addon/shop/app/service/admin/marketing/DiscountService.php deleted file mode 100644 index c21eb8ca1..000000000 --- a/niucloud/addon/shop/app/service/admin/marketing/DiscountService.php +++ /dev/null @@ -1,786 +0,0 @@ -model = new Discount(); - } - - /** - * 获取限时折扣列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'discount_id,name,remark,start_time,end_time,status,create_time,order_money,order_num,member_num,success_num'; - $order = 'discount_id desc'; - $search_model = $this->model->where([ [ 'discount_id', '>', 0 ] ])->withSearch([ "name", "status", "active_id" ], $where)->append([ 'status_name' ])->field($field)->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取限时折扣详情 - * @param int $discount_id - * @return array - */ - public function getInfo(int $discount_id) - { - $info = $this->model->field('discount_id,name,remark,start_time,end_time,status,create_time,order_money,order_num,member_num,success_num')->where([ [ 'discount_id', '=', $discount_id ] ])->append([ 'status_name' ])->findOrEmpty()->toArray(); - return $info; - } - - /** - * 获取限时折扣详情 - * @param int $discount_id - * @return array - */ - public function getDetail(int $discount_id) - { - $info = $this->model->where([ [ 'discount_id', '=', $discount_id ] ])->append([ 'status_name' ])->findOrEmpty()->toArray(); - $active_goods = ( new DiscountGoods() ) - ->field('discount_goods_id,discount_id,goods_id,sku_id,type,rate,reduce_money,discount_price,is_enabled') - ->where([ [ 'discount_id', '=', $discount_id ] ]) - ->withJoin([ 'goods' => function($query){ - $query->field('goods.goods_id,goods_name,goods_cover,goods_type'); - },'goodsSku' => function($query){ - $query->field('goodsSku.sku_id,price,sku_name,sku_image'); - }]) - ->append([ 'goods_cover_thumb_small']) - ->hidden(['goods', 'goodsSku']) - ->select() - ->toArray(); - - $goods_sku_data = $goods_info =[]; - foreach($active_goods as $value){ - $goods_sku_data[$value['goods_id']][] = $value; - } - foreach ($goods_sku_data as $value){ - if (count($value) > 1){ - - $filtered = array_filter($value, fn($item) => $item['is_enabled'] == 1); - $rates = array_map(fn($item) => floatval($item['rate']), $filtered); - $reduce_money = array_map(fn($item) => floatval($item['reduce_money']), $filtered); - $discount_price = array_map(fn($item) => floatval($item['discount_price']), $filtered); - - $goods_info[$value[0]['goods_id']] = [ - 'goods_cover_thumb_small' => $value[0]['goods_cover_thumb_small'] ?? '', - 'goods_id' => $value[0]['goods_id'] ?? '', - 'sku_id' => $value[0]['sku_id'] ?? '', - 'type' => $value[0]['type'] ?? '', - 'goods_type' => $value[0]['goods_type'] ?? '', - 'goods_type_name' => GoodsDict::getType($value[0]['goods_type'])[ 'name' ] ?? '', - 'goods_name' => $value[0]['goods_name'] ?? '', - 'price' => $value[0]['price'] ?? '', - 'min_rate' => !empty($rates) ? $this->formatNumber(min($rates)) : null, - 'max_rate' => !empty($rates) ? $this->formatNumber(max($rates)) : null, - 'min_reduce_money' => !empty($reduce_money) ? min($reduce_money) : null, - 'max_reduce_money' => !empty($reduce_money) ? max($reduce_money) : null, - 'min_discount_price' => !empty($discount_price) ? min($discount_price) : null, - 'max_discount_price' => !empty($discount_price) ? max($discount_price) : null, - 'spec_type' => 'multi', - 'goods_sku_list' => $value, - ]; - }else{ - $goods_info[$value[0]['goods_id']] = [ - 'goods_cover_thumb_small' => $value[0]['goods_cover_thumb_small'] ?? '', - 'goods_id' => $value[0]['goods_id'] ?? '', - 'sku_id' => $value[0]['sku_id'] ?? '', - 'type' => $value[0]['type'] ?? '', - 'goods_type' => $value[0]['goods_type'] ?? '', - 'goods_type_name' => GoodsDict::getType($value[0]['goods_type'])[ 'name' ] ?? '', - 'goods_name' => $value[0]['goods_name'] ?? '', - 'price' => $value[0]['price'] ?? '', - 'rate' => $this->formatNumber($value[0]['rate']) ?? '', - 'reduce_money' => $value[0]['reduce_money'] ?? '', - 'discount_price' => $value[0]['discount_price'] ?? '', - 'spec_type' => 'single', - 'goods_sku_list' => $value, - ]; - } - } - $info['goods_info'] = array_values($goods_info); - return $info; - } - - /** - * 添加限时折扣 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $goods_list = $data['goods_list']; - $goods_ids = array_column($goods_list, 'goods_id'); - $data[ 'start_time' ] = strtotime($data[ 'start_time' ]); - $data[ 'end_time' ] = strtotime($data[ 'end_time' ]); - $data[ 'create_time' ] = time(); - $data[ 'update_time' ] = time(); - - $this->checkGoods($goods_list); - - $check_condition = [ - [ 'discount_goods.goods_id', 'in', $goods_ids ], - ]; - - $goods_where = [ - [ 'discount.status', 'in', [ DiscountDict::NOT_ACTIVE, DiscountDict::ACTIVE ] ] - ]; - $goods_where_or = [ - [ 'discount.start_time|discount.end_time', 'between', [ $data[ 'start_time' ], $data[ 'end_time' ] ] ], - [ [ 'discount.start_time', '<=', $data[ 'start_time' ] ], [ 'discount.end_time', '>=', $data[ 'end_time' ] ] ], - [ [ 'discount.start_time', '>=', $data[ 'start_time' ] ], [ 'discount.end_time', '<=', $data[ 'end_time' ] ] ], - ]; - - $discount_goods_model = new DiscountGoods(); - $count = $discount_goods_model->where($check_condition) - ->withJoin([ - 'discount' => function(Query $query) use ($goods_where, $goods_where_or) { - $query->where($goods_where)->where(function($query) use ($goods_where_or) { - $query->whereOr($goods_where_or); - }); - }, - ], 'inner') - ->count(); - - if ($count > 0) throw new AdminException('ACTIVE_GOODS_NOT_REPEAR'); - - Db::startTrans(); - try { - $status = DiscountDict::NOT_ACTIVE; - - $time = time(); - if (!empty($data[ 'start_time' ]) && $data[ 'start_time' ] <= $time) { - $status = DiscountDict::ACTIVE; - } elseif (!empty($data[ 'end_time' ]) && $data[ 'end_time' ] <= $time) { - $status = DiscountDict::END; - } - $data[ 'status' ] = $status; - $discount_id = $this->model->create($data)->discount_id; - - $discount_goods = []; - foreach ($goods_list as $k => $v) { - foreach($v['sku_list'] as $item){ - $discount_goods[] = [ - 'discount_id' => $discount_id, - 'goods_id' => $item[ 'goods_id' ], - 'sku_id' => $item[ 'sku_id' ], - 'status' => $status, - 'type' => $item[ 'discount_type' ], - 'rate' => $item[ 'discount_rate' ], - 'reduce_money' => $item[ 'reduce_money' ], - 'discount_price' => $item[ 'discount_price' ] ?? $item[ 'reduce_money' ], - 'is_enabled' => $item[ 'is_enabled' ] ?? 1, - ]; - } - } - - (new DiscountGoods())->saveAll($discount_goods); - - if (!empty($data[ 'start_time' ]) && $data[ 'start_time' ] <= $time) { - $this->discountStartAfter($discount_id); - } elseif (!empty($data[ 'end_time' ]) && $data[ 'end_time' ] <= $time) { - $this->discountEndAfter($discount_id); - } - - Db::commit(); - return $discount_id; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 编辑限时折扣 - * @param int $discount_id - * @param array $data - * @return bool - */ - public function edit(int $discount_id, array $data) - { - $goods_list = $data['goods_list']; - $goods_ids = array_column($goods_list, 'goods_id'); - $data[ 'start_time' ] = strtotime($data[ 'start_time' ]); - $data[ 'end_time' ] = strtotime($data[ 'end_time' ]); - $data[ 'create_time' ] = time(); - $data[ 'update_time' ] = time(); - - $this->checkGoods($goods_list); - - $check_condition = [ - [ 'discount_goods.goods_id', 'in', $goods_ids ], - [ 'discount_goods.discount_id', '<>', $discount_id ], - ]; - - $goods_where = [ - [ 'discount.status', 'in', [ DiscountDict::NOT_ACTIVE, DiscountDict::ACTIVE ] ] - ]; - $goods_where_or = [ - [ 'discount.start_time|discount.end_time', 'between', [ $data[ 'start_time' ], $data[ 'end_time' ] ] ], - [ [ 'discount.start_time', '<=', $data[ 'start_time' ] ], [ 'discount.end_time', '>=', $data[ 'end_time' ] ] ], - [ [ 'discount.start_time', '>=', $data[ 'start_time' ] ], [ 'discount.end_time', '<=', $data[ 'end_time' ] ] ], - ]; - - $discount_goods_model = new DiscountGoods(); - $count = $discount_goods_model->where($check_condition) - ->withJoin([ - 'discount' => function(Query $query) use ($goods_where, $goods_where_or) { - $query->where($goods_where)->where(function($query) use ($goods_where_or) { - $query->whereOr($goods_where_or); - }); - }, - ], 'inner') - ->count(); - if ($count > 0) throw new AdminException('ACTIVE_GOODS_NOT_REPEAR'); - - $this->model->where([ [ 'discount_id', '=', $discount_id ] ])->update([ 'status' => DiscountDict::NOT_ACTIVE ]); - $this->discountEndAfter($discount_id); - - $status = DiscountDict::NOT_ACTIVE; - $time = time(); - if (!empty($data[ 'start_time' ]) && $data[ 'start_time' ] <= $time) { - $status = DiscountDict::ACTIVE; - } elseif (!empty($data[ 'end_time' ]) && $data[ 'end_time' ] <= $time) { - $status = DiscountDict::END; - } - - $active_goods_data = $discount_goods_model->where([[ 'discount_id', '=', $discount_id]])->select()->toArray(); - $active_goods_ids = array_unique(array_column($active_goods_data,'goods_id')); - $discount_goods = []; - foreach ($goods_list as $k=>$v){ - foreach($v['sku_list'] as $item){ - $discount_goods[] = [ - 'discount_id' => $discount_id, - 'goods_id' => $item[ 'goods_id' ], - 'sku_id' => $item[ 'sku_id' ], - 'status' => $status, - 'type' => $item[ 'discount_type' ], - 'rate' => $item[ 'discount_rate' ], - 'reduce_money' => $item[ 'reduce_money' ], - 'discount_price' => $item[ 'discount_price' ] ?? $item[ 'reduce_money' ], - 'is_enabled' => $item[ 'is_enabled' ] ?? 1, - ]; - } - } - $delete_goods_ids = array_diff($active_goods_ids, $goods_ids); - unset($data['goods_list']); - Db::startTrans(); - try { - $data[ 'discount_id' ] = $discount_id; - $data[ 'status' ] = $status; - - $this->model->where([ [ 'discount_id', '=', $discount_id]])->update($data); - - foreach ($discount_goods as $v){ - $discount_goods_info = $discount_goods_model->where([[ 'discount_id', '=', $v['discount_id']], [ 'goods_id', '=', $v['goods_id']], [ 'sku_id', '=', $v['sku_id']]])->findOrEmpty(); - if($discount_goods_info->isEmpty()){ - $discount_goods_model->create($v); - }else{ - $discount_goods_model->where([[ 'discount_id', '=', $v['discount_id']], [ 'goods_id', '=', $v['goods_id']], [ 'sku_id', '=', $v['sku_id']]])->update($v); - } - } - - $discount_goods_model->where([[ 'goods_id', 'in', $delete_goods_ids], [ 'discount_id', '=', $discount_id]])->delete(); - - if (!empty($data[ 'start_time' ]) && $data[ 'start_time' ] <= $time) { - $this->discountStartAfter($discount_id); - } elseif (!empty($data[ 'end_time' ]) && $data[ 'end_time' ] <= $time) { - $this->discountEndAfter($discount_id); - } - - Db::commit(); - return $discount_id; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 限时折扣商品校验 - * @param $data - * @return array - */ - public function checkGoodsData($data) - { - $error = [ - 'code' => 1, - 'data' => [] - ]; - $goods_ids = $data[ 'goods_ids' ]; - $discount_goods_model = new DiscountGoods(); - $select_goods_id = $discount_goods_model - ->where([ [ 'discount_goods.discount_goods_id', '>', 0 ] ]) - ->withJoin([ - 'discount' => function(Query $query) use ($data) { - $query->where([ [ 'discount.status', 'in', [ DiscountDict::NOT_ACTIVE, DiscountDict::ACTIVE ] ] ])->where(function($query) use ($data) { - $query->whereOr([ [ 'discount.start_time|discount.end_time', 'between', [ strtotime($data[ 'start_time' ]), strtotime($data[ 'end_time' ]) ] ], - [ [ 'discount.start_time', '<=', strtotime($data[ 'start_time' ]) ], [ 'discount.end_time', '>=', strtotime($data[ 'end_time' ]) ] ], - [ [ 'discount.start_time', '>=', strtotime($data[ 'start_time' ]) ], [ 'discount.end_time', '<=', strtotime($data[ 'end_time' ]) ] ] ]); - }); - }, - ], 'inner') - ->column('goods_id'); - - if (!empty($select_goods_id)) { - if (!empty($data[ 'discount_id' ])) { - $select_goods_ids = $discount_goods_model->where([ - [ 'discount_id', '=', $data[ 'discount_id' ] ] - ])->column('goods_id'); - $goods_ids = array_diff($goods_ids, $select_goods_ids); - } - $goods_id_intersect = array_intersect($goods_ids, $select_goods_id); - if (!empty($goods_id_intersect)) { - foreach ($goods_id_intersect as $goods_id) { - $discount_info = $discount_goods_model->where([ - [ 'goods_id', '=', $goods_id ], - [ 'status', 'in', [ DiscountDict::NOT_ACTIVE, DiscountDict::ACTIVE ] ], - ])->with([ 'discount' => function($query) use ($data) { - $query->field('discount_id,name'); - } ])->findOrEmpty()->toArray(); - if (!empty($discount_info)) { - $error[ 'code' ] = -1; - $error[ 'data' ][] = [ - 'goods_id' => $goods_id, - 'error_msg' => '该商品已参加【' . $discount_info[ 'discount' ][ 'name' ] . '】活动' - ]; - } - } - } - } - return $error; - } - - /** - * 商品结构校验 - * @param $goods_list - * @return void - */ - public function checkGoods($goods_list) - { - if (empty($goods_list)) throw new AdminException('DISCOUNT_GOODS_NOT_EMPTY'); - foreach ($goods_list as $k => $v) { - if (empty($v[ 'sku_list' ])) throw new AdminException('DISCOUNT_GOODS_SKU_NOT_EMPTY'); - foreach ($v[ 'sku_list' ] as $key => $value) { - if (!isset($value[ 'is_enabled' ])) throw new AdminException('DISCOUNT_IS_ENABLED_NOT_EMPTY'); - - if ($value[ 'is_enabled' ]) { - if (empty($value[ 'discount_type' ])) throw new AdminException('DISCOUNT_GOODS_DISCOUNT_TYPE_NOT_EMPTY'); - if (!in_array($value[ 'discount_type' ], [ 'discount', 'reduce', 'specify' ])) throw new AdminException('DISCOUNT_GOODS_DISCOUNT_TYPE_ERROR'); - if (empty($value[ 'discount_price' ]) && $value[ 'discount_price' ] != 0) throw new AdminException('DISCOUNT_GOODS_DISCOUNT_PRICE_NOT_EMPTY'); - if (empty($value[ 'discount_rate' ]) && $value[ 'discount_price' ] != 0) throw new AdminException('DISCOUNT_GOODS_DISCOUNT_RATE_NOT_EMPTY'); - if (empty($value[ 'reduce_money' ]) && $value[ 'discount_price' ] != 0) throw new AdminException('DISCOUNT_GOODS_REDUCE_MONEY_NOT_EMPTY'); - } - } - } - } - - /** - * 删除限时折扣 - * @param int $discount_id - * @return bool - */ - public function del(int $discount_id) - { - $info = $this->model->where([ ['discount_id', '=', $discount_id] ])->findOrEmpty(); - if ($info->isEmpty()) throw new AdminException('ACTIVE_NOT_FOUND'); - if ($info->status == DiscountDict::ACTIVE) throw new AdminException('ACTIVE_NOT_DELETE'); - $this->model->where([ [ 'discount_id', '=', $discount_id ] ])->delete(); - (new DiscountGoods())->where([ [ 'discount_id', '=', $discount_id ] ])->delete(); - return true; - } - - /** - * 批量删除限时折扣 - * @param array $ids - * @return bool - */ - public function batchDel($ids) - { - $discount_list = $this->model->where([ [ 'discount_id', 'in', $ids ] ])->select()->toArray(); - foreach ($discount_list as $value){ - if ($value[ 'status' ] == DiscountDict::ACTIVE) throw new AdminException('ACTIVE_NOT_DELETE'); - } - - Db::startTrans(); - try { - $this->model->where([ [ 'discount_id', 'in', $ids ] ])->delete(); - (new DiscountGoods())->where([ [ 'discount_id', 'in', $ids ] ])->delete(); - - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 批量关闭限时折扣 - * @param array $ids - * @return bool - */ - public function batchClose($ids) - { - $discount_goods_model = new DiscountGoods(); - $shop_goods_model = new Goods(); - $shop_goods_sku_model = new GoodsSku(); - - $discount_list = $this->model->where([ [ 'discount_id', 'in', $ids ] ])->select()->toArray(); - if (empty($discount_list)) throw new AdminException('ACTIVE_NOT_FOUND'); - - $discount_goods_ids = $discount_goods_model->where([ [ 'discount_id', 'in', $ids ] ])->column('goods_id'); - - Db::startTrans(); - try { - $this->model->where([ ['discount_id', 'in', $ids], ['status', '=', DiscountDict::ACTIVE] ])->update([ 'status' => DiscountDict::CLOSE ]); - $discount_goods_model->where([ ['discount_id', 'in', $ids]])->update([ 'status' => DiscountDict::CLOSE ]); - $shop_goods_model->where([ [ 'goods_id', 'in', $discount_goods_ids ] ])->update([ 'is_discount' => 0 ]); - $shop_goods_sku_model->where([ [ 'goods_id', 'in', $discount_goods_ids ] ])->update([ 'sale_price' => Db::raw('price') ]); - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - - - - } - - /** - * 设置商品限时折扣 - * @param $discount_ids - * @return void - */ - public function setGoodsDiscount($discount_ids) - { - $list = $this->model->where([ [ 'discount_id', 'in', $discount_ids ],['status','=',DiscountDict::ACTIVE] ])->select()->toArray(); - if (empty($list)) return true; - $discount_goods_model = new DiscountGoods(); - $shop_goods_model = new Goods(); - $shop_goods_sku_model = new GoodsSku(); - $discount_goods_list = $discount_goods_model->where([ [ 'discount_id', 'in', $discount_ids ] ])->field('goods_id, discount_id,sku_id,is_enabled,discount_price')->select()->toArray(); - $discount_goods_ids = array_unique(array_column($discount_goods_list, 'goods_id' )); - $shop_goods_model->where([ [ 'goods_id', 'in', $discount_goods_ids ] ])->update([ 'is_discount' => 1]); - foreach ($discount_goods_list as $k => $v) { - if ($v[ 'is_enabled' ]) { - $shop_goods_sku_model->where([ [ 'sku_id', '=', $v[ 'sku_id' ] ] ])->update([ - 'sale_price' => $v[ 'discount_price' ] - ]); - } - } - return true; - } - - /** - * 设置商品取消限时折扣 - * @param $discount_id - * @return bool - */ - public function cancelGoodsDiscount($discount_ids) - { - $list = $this->model->where([ [ 'discount_id', 'in', $discount_ids ],['status','=',DiscountDict::ACTIVE] ])->select()->toArray(); - if (empty($list)) return true; - - $discount_goods_model = new DiscountGoods(); - $shop_goods_model = new Goods(); - $shop_goods_sku_model = new GoodsSku(); - - $discount_goods_list = $discount_goods_model->where([ [ 'discount_id', 'in', $discount_ids ] ])->field('goods_id, discount_id')->select()->toArray(); - $discount_goods_ids = array_column($discount_goods_list, 'goods_id'); - $shop_goods_model->where([ [ 'goods_id', 'in', $discount_goods_ids ] ])->update([ 'is_discount' => 0 ]); - $shop_goods_sku_model->where([ [ 'goods_id', 'in', $discount_goods_ids ] ])->update([ 'sale_price' => Db::raw('price') ]); - - return true; - } - - - /** - * 活动关闭 - * @return void - */ - public function discountClose($discount_id) - { - $this->model->where([ ['discount_id', '=', $discount_id], ['status', '=', DiscountDict::ACTIVE] ])->update([ 'status' => DiscountDict::CLOSE ]); - (new DiscountGoods())->where([ ['discount_id', '=', $discount_id]])->update([ 'status' => DiscountDict::CLOSE ]); - $this->discountEndAfter($discount_id); - return true; - } - - /** - * 活动开启 - * @return void - */ - public function discountStartAfter($discount_ids) - { - if (!is_array($discount_ids)) { - $discount_ids = [$discount_ids]; - } - $this->setGoodsDiscount($discount_ids); - return true; - - } - - /** - * 活动结束 - * @return void - */ - public function discountEndAfter($discount_ids) - { - if (!is_array($discount_ids)){ - $discount_ids = [$discount_ids]; - } - $this->cancelGoodsDiscount($discount_ids); - return true; - } - - - /** - * 领取记录 - * @param int $id - * @return void - */ - public function order(int $discount_id, $where) - { - $order = 'create_time desc'; - $search_model = ( new Order() ) - ->where([ [ 'order.pay_time', '>', 0 ] ]) - ->withSearch([ 'search_type', 'order_from', 'join_status', 'create_time', 'pay_time' ], $where) - ->with([ - 'member' => function($query) { - $query->field('member_id, nickname, mobile, headimg'); - }, - 'pay' - ]) - ->withJoin([ 'shopOrderDiscount' => function($query) use ($discount_id) { - $query->where([ [ 'discount_type', '=', ActiveDict::DISCOUNT ], [ 'discount_type_id', '=', $discount_id ] ]); - } ], 'left')->order($order); - - $order_status_list = OrderDict::getStatus(); - $list = $this->pageQuery($search_model, function($item, $key) use ($order_status_list) { - $item[ 'order_status_data' ] = $order_status_list[ $item[ 'status' ] ] ?? []; - $item_pay = $item[ 'pay' ]; - if (!empty($item_pay)) { - $item_pay->append([ 'type_name' ]); - } - }); - return $list; - } - - - /** - * 会员 - * @param int $discount_id - * @param $where - * @return array - * @throws \think\db\exception\DbException - */ - public function member(int $discount_id, $where) - { - $active_goods_ids = ( new DiscountGoods() )->where([ [ 'discount_id', '=', $discount_id ] ])->column('goods_id'); - $order = 'create_time desc'; - $search_model = ( new Order() ) - ->where([ [ 'order.pay_time', '>', 0 ] ]) - ->withJoin([ 'shopOrderDiscount' => function($query) use ($discount_id) { - $query->where([ [ 'discount_type', '=', ActiveDict::DISCOUNT ], [ 'discount_type_id', '=', $discount_id ] ]); - } ], 'left') - ->with([ 'member' => function($query) { - $query->field('username,member_id, nickname, mobile, headimg'); - }, 'orderGoods' ]) - ->order($order) - ->field('order.member_id,COUNT(order.member_id) as member_count, group_concat(order.create_time) as create_time_data,group_concat(order.order_id) as order_ids') - ->group('order.member_id'); - $list = $this->pageQuery($search_model, function($item, $key) use ($active_goods_ids) { - $create_time_data = explode(',', $item[ 'create_time_data' ]); - $item[ 'create_time' ] = date('Y-m-d H:i:s', end($create_time_data)); - - }); - if (!empty($list[ 'data' ])) { - $member_ids = array_column($list[ 'data' ], 'member_id'); - $data_list = ( new Order() ) - ->where([ [ 'order.member_id', 'in', $member_ids ], [ 'order.pay_time', '>', 0 ] ]) - ->withJoin([ 'shopOrderDiscount' => function($query) use ($discount_id) { - $query->where([ [ 'discount_type', '=', ActiveDict::DISCOUNT ], [ 'discount_type_id', '=', $discount_id ] ]); - } ], 'left') - ->with([ 'orderGoods' ]) - ->select()->toArray(); - - foreach ($list[ 'data' ] as $key => $item) { - $item[ 'active_order_money' ] = 0; - foreach ($data_list as $k => $v) { - if ($item[ 'member_id' ] == $v[ 'member_id' ]) { - foreach ($v[ 'orderGoods' ] as $order_goods) { - if (in_array($order_goods[ 'goods_id' ], $active_goods_ids)) { - $item[ 'active_order_money' ] += $order_goods[ 'order_goods_money' ]; - } - } - } - - } - $list[ 'data' ][ $key ] = $item; - } - } - - return $list; - } - - /** - * 商品 - * @param int $discount_id - * @param $where - * @return array - * @throws \think\db\exception\DbException - */ - public function goods(int $discount_id, $where) - { - $active_goods_model = new DiscountGoods(); - $search_model = $active_goods_model - ->alias('discount_goods') - ->where([ - [ 'discount_goods.discount_id', '=', $discount_id ], - [ 'goods.goods_name', 'like', '%' . $where[ 'keyword' ] . '%' ], - ]) - ->field(' - goods.goods_name, - goods.goods_cover, - discount_goods_id, - discount_id, - discount_goods.goods_id, - discount_goods.sku_id, - goods_sku.price, - SUM(discount_goods.order_money) as order_money, - SUM(discount_goods.order_num) as order_num, - SUM(discount_goods.member_num) as member_num, - SUM(discount_goods.success_num) as success_num - ') - ->leftJoin('shop_goods goods', 'discount_goods.goods_id = goods.goods_id') - ->leftJoin('shop_goods_sku goods_sku', 'discount_goods.sku_id = goods_sku.sku_id') - ->group('discount_goods.goods_id') - ->append([ 'goods_cover_thumb_small' ]); - return $this->pageQuery($search_model); - } - - /** - * 配置设置 - * @param array $params - * @return array - */ - public function setConfig($key, $data) - { - ( new CoreConfigService() )->setConfig($key, $data); - return true; - } - - /** - * 折扣页面轮播图配置 - */ - public function getDiscountBannerConfig() - { - $data = ( new CoreConfigService() )->getConfigValue('SHOP_DISCOUNT_BANNER_CONFIG'); - if (empty($data)) { - $data = []; - } - return $data; - } - - /** - * 订单支付后累计 - * @param $order - * @return bool - */ - public function orderPayAfter($order) - { - $order_discount_model = new OrderDiscounts(); - $order_discount = $order_discount_model->field('order_id, order_goods_ids, num, money, discount_type, discount_type_id, member_id, goods_id, sku_id')->where([ [ 'order_id', '=', $order[ 'order_id' ] ], [ 'discount_type', '=', ActiveDict::DISCOUNT ] ])->field('order_id,discount_type_id')->select()->toArray(); - if (empty($order_discount)) return true; - - $discount_model = (new Discount()); - $discount_goods_model = (new DiscountGoods()); - - Db::startTrans(); - try { - foreach ($order_discount as $value){ - $member_goods_count = $order_discount_model->where([ - [ 'discount_type', '=', ActiveDict::DISCOUNT ], - [ 'discount_type_id', '=', $value[ 'discount_type_id' ] ], - [ 'order_id', '<>', $value[ 'order_id' ] ], - [ 'member_id', '=', $value[ 'member_id' ] ], - ])->count(); - - $discount_goods_query = $discount_goods_model->where([ - [ 'discount_id', '=', $value[ 'discount_type_id' ] ], - [ 'goods_id', '=', $value[ 'goods_id' ] ], - [ 'sku_id', '=', $value[ 'sku_id' ] ], - ])->inc('order_money',$value[ 'money' ])->inc('order_num')->inc('success_num'); - - $discount_query = $discount_model->where([ - [ 'discount_id', '=', $value[ 'discount_type_id' ] ], - ])->inc('order_money',$value[ 'money' ])->inc('order_num')->inc('success_num'); - - if (empty($member_goods_count)){ - $discount_goods_query->inc('member_num'); - $discount_query->inc('member_num'); - } - - $discount_goods_query->update(); - $discount_query->update(); - } - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - - } - - /** - * 数字格式转化转换 - * @param $num - * @return string - */ - public function formatNumber($num) { - return ($num == intval($num)) ? intval($num) : round($num, 1); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/marketing/ManjianService.php b/niucloud/addon/shop/app/service/admin/marketing/ManjianService.php deleted file mode 100644 index c2ad5ae92..000000000 --- a/niucloud/addon/shop/app/service/admin/marketing/ManjianService.php +++ /dev/null @@ -1,666 +0,0 @@ -model = new Manjian(); - } - - /** - * 获取满减送列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - //活动名称、活动类型、活动详情、活动状态、支付订单数、参与会员数、支付金额 、活动时间 - $field = 'manjian_id,manjian_name,condition_type,rule_json,status,total_order_num,total_member_num,total_order_money,start_time,end_time'; - $order = 'create_time desc'; - $search_model = $this->model - ->withSearch(["manjian_name", "status", "create_time", "active_id"], $where) - ->append(['status_name']) - ->field($field) - ->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 关闭满减送 - * @param $manjian_id - */ - public function closeManjian($manjian_id) - { - $manjian_info = $this->model->where([['manjian_id', '=', $manjian_id]])->field('status,end_time')->findOrEmpty()->toArray(); - if (!empty($manjian_info)) { - if ($manjian_info['end_time'] >= time() && $manjian_info['status'] == ManjianDict::ACTIVE) { - $this->model->where([['manjian_id', '=', $manjian_id], ['status', '=', ManjianDict::ACTIVE]])->update(['status' => ManjianDict::CLOSE]); - (new ManjianGoods())->where([['manjian_id', '=', $manjian_id]])->update(['status' => ManjianDict::CLOSE]); - } else { - throw new AdminException('MANJIANSONG_CLOSED'); - } - } else { - throw new AdminException('MANJIANSONG_NOT_FOUND'); - } - } - - /** - * 删除满减送活动 - * @param $manjian_id - */ - public function del($manjian_id) - { - $manjian_info = $this->model->where([ ['manjian_id', '=', $manjian_id]])->field('status,end_time')->findOrEmpty()->toArray(); - if (!empty($manjian_info)) { - if ($manjian_info['status'] == ActiveDict::ACTIVE) throw new AdminException('ACTIVE_NOT_DELETE'); - $this->model->where([['manjian_id', '=', $manjian_id]])->delete(); - (new ManjianGoods())->where([['manjian_id', '=', $manjian_id]])->delete(); - } else { - throw new AdminException('MANJIANSONG_NOT_FOUND'); - } - } - - /** - * 满减送活动详情 - * @param $manjian_id - */ - public function info($manjian_id) - { - //条件类型、活动名称、活动开始时间、活动结束时间、活动状态、活动创建时间、参与订单数、参与会员数、支付金额、活动详情(例:满100.00元减5.00元、包邮、送1积分...) - $info = $this->model - ->field('manjian_id,manjian_name,goods_type,start_time,end_time,status,create_time,total_order_num,total_member_num,total_order_money,rule_json') - ->where([['manjian_id', '=', $manjian_id]]) - ->append(['status_name', 'goods_type_name']) - ->findOrEmpty() - ->toArray(); - return $info; - } - - /** - * 会员 - * @param int $manjian_id - * @param $where - * @return array - * @throws \think\db\exception\DbException - */ - public function member(int $manjian_id, $where) - { - $manjian_records = (new ManjianGiveRecords())->field('member_id,order_id')->withJoin(['order' => function ($query) { - $query->field('order.create_time,order_money as total_order_money'); - }])->where([['manjian_id', '=', $manjian_id]]) - ->select()->toArray(); - $member_ids = array_unique(array_column($manjian_records, 'member_id')); - $record_info = []; - foreach ($manjian_records as $key => $value) { - unset($value['order']); - $record_info[$value['member_id']][] = $value; - } - - $search_model = (new Member())->field('username,member_id, nickname, mobile, headimg')->where([['member_id', 'in', $member_ids]]); - $list = $this->pageQuery($search_model); - if (!empty($list['data'])) { - foreach ($list['data'] as &$value) { - $value['total_order_money'] = 0; - $value['total_num'] = 0; - $value['finally_order_time'] = 0; - if (isset($record_info[$value['member_id']])) { - $member_records = $record_info[$value['member_id']]; - $total_order_money = 0; - foreach (array_column($member_records, 'total_order_money') as $order_money) { - $total_order_money = bcadd($total_order_money, $order_money, 2); - } - $value['total_order_money'] = $total_order_money; - $value['total_num'] = count($member_records); - foreach ($member_records as $v) { - if ($v['create_time'] > $value['finally_order_time']) { - $value['finally_order_time'] = $v['create_time']; - } - } - } - } - } - - return $list; - } - - /** - * 添加满减送 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $data['start_time'] = strtotime($data['start_time']); - $data['end_time'] = strtotime($data['end_time']); - if (!empty($data['end_time']) && $data['end_time'] < time()) throw new AdminException('END_TIME_NOT_LESS_CURRENT_TIME'); - - $goods_ids = []; - if ($data['goods_type'] != ManjianDict::ALL_GOODS) { - if (isset($data['goods_data']) && !empty($data['goods_data'])) { - $goods_ids = array_unique(array_column($data['goods_data'], 'goods_id')); - } - } - if ($data['goods_type'] != ManjianDict::SELECTED_GOODS){ - $other_active = $this->model - ->where([ - ['goods_type', '<>', ManjianDict::ALL_GOODS], - ['status', 'in', [ManjianDict::ACTIVE]], - ])->where(function ($query) use ($data) { - $query->whereOr([ - ['start_time|end_time', 'between', [$data['start_time'], $data['end_time']]], - [['start_time', '<=', $data['start_time']], ['end_time', '>=', $data['end_time']]], - [['start_time', '>=', $data['start_time']], ['end_time', '<=', $data['end_time']]] - ]); - })->count(); - if ($other_active > 0) { - throw new AdminException('MANJIAN_TIME_HINT'); - } - } - - //验证商品是否参加活动 - //有正在进行的全部商品活动 - $all_goods_count = $this->model - ->where([ - ['goods_type', '=', ManjianDict::ALL_GOODS], - ['status', 'in', [ManjianDict::NOT_ACTIVE, ManjianDict::ACTIVE]], - ])->where(function ($query) use ($data) { - $query->whereOr([ - ['start_time|end_time', 'between', [$data['start_time'], $data['end_time']]], - [['start_time', '<=', $data['start_time']], ['end_time', '>=', $data['end_time']]], - [['start_time', '>=', $data['start_time']], ['end_time', '<=', $data['end_time']]] - ]); - })->count(); - if ($all_goods_count > 0) throw new AdminException('MANJIANSONG_ALL_GOODS_EXIT'); - - $manjian_goods_model = new ManjianGoods(); - $select_goods_id = $manjian_goods_model - ->where([['manjian_goods.manjian_goods_id', '>',0]]) - ->withJoin([ - 'manjian' => function (Query $query) use ($data) { - $query->where([['manjian.status', 'in', [ManjianDict::NOT_ACTIVE, ManjianDict::ACTIVE]], ['manjian.goods_type', '=', ManjianDict::SELECTED_GOODS]])->where(function ($query) use ($data) { - $query->whereOr([['manjian.start_time|manjian.end_time', 'between', [$data['start_time'], $data['end_time']]], - [['manjian.start_time', '<=', $data['start_time']], ['manjian.end_time', '>=', $data['end_time']]], - [['manjian.start_time', '>=', $data['start_time']], ['manjian.end_time', '<=', $data['end_time']]]]); - }); - }, - ], 'inner') - ->column('goods_id'); - - $select_goods_not_id = $manjian_goods_model - ->where([['manjian_goods.manjian_goods_id', '>', 0]]) - ->withJoin([ - 'manjian' => function (Query $query) use ($data) { - $query->where([ ['manjian.status', 'in', [ManjianDict::NOT_ACTIVE, ManjianDict::ACTIVE]], ['manjian.goods_type', '=', ManjianDict::SELECTED_GOODS_NOT]])->where(function ($query) use ($data) { - $query->whereOr([ - ['manjian.start_time|manjian.end_time', 'between', [$data['start_time'], $data['end_time']]], - [['manjian.start_time', '<=', $data['start_time']], ['manjian.end_time', '>=', $data['end_time']]], - [['manjian.start_time', '>=', $data['start_time']], ['manjian.end_time', '<=', $data['end_time']]] - ]); - }); - }, - ], 'inner') - ->column('goods_id'); - - $error = [ - 'code' => 1, - 'data' => [] - ]; - if ($data['goods_type'] != ManjianDict::ALL_GOODS) { - $used_goods_ids = array_merge($select_goods_id, $select_goods_not_id); - $goods_id_intersect = array_intersect($goods_ids, $used_goods_ids); - if (!empty($goods_id_intersect)) { - throw new AdminException('MANJIANSONG_GOODS_NOT_REPEAR'); - } - } - -// switch ($data['goods_type']) { -// case ManjianDict::ALL_GOODS: -// if (!empty($select_goods_id) || !empty($select_goods_not_id)) { -// throw new AdminException('MANJIANSONG_GOODS_NOT_REPEAR'); -// } -// break; -// case ManjianDict::SELECTED_GOODS_NOT: -// if (!empty($select_goods_id)) {//参与【123】 【12】 【3】 -// $goods_id_diff = array_diff($select_goods_id, $goods_ids); -// if (!empty($goods_id_diff)) { -// throw new AdminException('MANJIANSONG_GOODS_NOT_REPEAR'); -// } -// } -// if (!empty($select_goods_not_id)) {//【678】 -// throw new AdminException('MANJIANSONG_GOODS_NOT_REPEAR'); -// } -// break; -// case ManjianDict::SELECTED_GOODS: -// if (!empty($select_goods_id)) { -// $goods_id_intersect = array_intersect($goods_ids, $select_goods_id); -// if (!empty($goods_id_intersect)) { -// throw new AdminException('MANJIANSONG_GOODS_NOT_REPEAR'); -// } -// } -// if (!empty($select_goods_not_id)) { -// $goods_id_diff = array_diff($goods_ids, $select_goods_not_id); -// if (!empty($goods_id_diff)) { -// throw new AdminException('MANJIANSONG_GOODS_NOT_REPEAR'); -// } -// } -// break; -// } - - Db::startTrans(); - try { - // 满减送活动数据 - $manjian_value['manjian_name'] = $data['manjian_name']; - $manjian_value['condition_type'] = $data['condition_type']; - $manjian_value['goods_type'] = $data['goods_type']; - $manjian_value['join_member_type'] = $data['join_member_type']; - $manjian_value['rule_type'] = $data['rule_type'] ?? ''; - $manjian_value['rule_json'] = $data['rule_json']; - $manjian_value['goods_ids'] = array_map(function ($item) { - return (string)$item; - }, $goods_ids); - $manjian_value['level_ids'] = array_map(function ($item) { - return (string)$item; - }, $data['level_ids']); - $manjian_value['label_ids'] = array_map(function ($item) { - return (string)$item; - }, $data['label_ids']); - $manjian_value['status'] = ManjianDict::NOT_ACTIVE; - $manjian_value['start_time'] = $data['start_time']; - $manjian_value['end_time'] = $data['end_time']; - $manjian_value['remark'] = $data['remark']; - - if (!empty($data['start_time']) && $data['start_time'] <= time()) { - $manjian_value['status'] = ManjianDict::ACTIVE; - } elseif (!empty($data['end_time']) && $data['end_time'] <= time()) { - $manjian_value['status'] = ManjianDict::END; - } - $res = $this->model->create($manjian_value); - - $manjian_goods = []; - if ($data['goods_type'] != ManjianDict::ALL_GOODS) { - if (!empty($data['goods_data'])) { - foreach ($data['goods_data'] as $v) { - $manjian_goods[] = [ - 'manjian_id' => $res->manjian_id, - 'goods_id' => $v['goods_id'], - 'sku_id' => $v['sku_id'], - 'goods_type' => $data['goods_type'], - 'status' => $manjian_value['status'], - ]; - } - } - } - (new Manjiangoods())->saveAll($manjian_goods); - - Db::commit(); - $error['data'] = ['id' => $res->manjian_id]; - return $error; - } catch (\Exception $e) { - Db::rollback(); - throw new AdminException($e->getMessage()); - } - } - - /** - * 获取满减送编辑数据 - * @param array $params - * @return array - */ - public function getInit($params = []) - { - $res = $active_goods = []; - if (!empty($params['manjian_id'])) { - //获取满减基本信息 - $manjisn_info = $this->model - ->field('manjian_id,manjian_name,condition_type,goods_type,join_member_type,rule_type,rule_json,start_time,end_time,remark,level_ids,label_ids,total_order_money,total_member_num,total_order_num,status,create_time,total_point,total_balance,total_coupon_num,total_goods_num') - ->where([['manjian_id', '=', $params['manjian_id']]]) - ->append(['status_name']) - ->findOrEmpty()->toArray(); - - $coupon_model = (new Coupon()); - $goods_model = (new Goods()); - if (!empty($manjisn_info['rule_json'])) { - foreach ($manjisn_info['rule_json'] as &$value) { - if (isset($value['coupon']) && !empty($value['coupon'])) { - $coupon_ids = array_column($value['coupon'], 'coupon_id'); - $coupon_info = $coupon_model->field('id,title,type,price')->where([['id', 'in', $coupon_ids]])->append(['type_name'])->select()->toArray(); - $coupon_info = array_column($coupon_info, null, 'id'); - foreach ($value['coupon'] as &$item) { - if (isset($coupon_info[$item['coupon_id']])) { - $item['type_name'] = $coupon_info[$item['coupon_id']]['type_name'] ?? ''; - $item['title'] = $coupon_info[$item['coupon_id']]['title'] ?? ''; - $item['price'] = $coupon_info[$item['coupon_id']]['price'] ?? 0; - } - } - } - if (isset($value['goods']) && !empty($value['goods'])) { - foreach ($value['goods'] as &$goods_item) { - $sku_id = $goods_item['sku_id']; - $goods_info = $goods_model->field('goods_id,goods_cover,goods_name')->where([ ['goods.goods_id', '=', $goods_item['goods_id']]]) - ->withJoin(['goodsSku' => function ($query) use ($sku_id) { - $query->field('sku_id,sku_name,sku_image,goodsSku.stock,goodsSku.price')->where([['sku_id', '=', $sku_id]]); - }])->append(['goods_cover_thumb_small'])->findOrEmpty()->toArray(); - $goods_info['num'] = $goods_item['num']; - $goods_item = $goods_info; - } - } - } - } - - if (isset($manjisn_info['label_ids']) && !empty($manjisn_info['label_ids'])) { - $manjisn_info['label_ids'] = array_map('intval', $manjisn_info['label_ids']); - } - if (isset($manjisn_info['level_ids']) && !empty($manjisn_info['level_ids'])) { - $manjisn_info['level_ids'] = array_map('intval', $manjisn_info['level_ids']); - } - - $res['manjian_info'] = $manjisn_info; - - $active_goods_info = []; - //获取满减商品信息 - if (!empty($manjisn_info['goods_type']) && $manjisn_info['goods_type'] != ManjianDict::ALL_GOODS) { - $active_goods = (new ManjianGoods())->field('goods_id,sku_id')->where([ ['manjian_id', '=', $params['manjian_id']]])->select()->toArray(); - foreach ($active_goods as $v) { - $goods_sku_id = $v['sku_id']; - $goods_info = $goods_model->field('goods_id,goods_cover,goods_name,status')->where([ ['goods.goods_id', '=', $v['goods_id']]]) - ->withJoin(['goodsSku' => function ($query) use ($goods_sku_id) { - $query->field('sku_id,sku_name,sku_image,goodsSku.stock,goodsSku.price')->where([['sku_id', '=', $goods_sku_id]]); - }])->append(['goods_cover_thumb_small'])->findOrEmpty()->toArray(); - if (!empty($goods_info)) { - $active_goods_info[] = $goods_info; - } - } - } - $res['manjian_goods'] = $active_goods_info; - } - return $res; - } - - /** - * 编辑满减送 - * @param array $data - * @return mixed - */ - public function edit(int $manjian_id, array $data) - { - $data['start_time'] = strtotime($data['start_time']); - $data['end_time'] = strtotime($data['end_time']); - if (!empty($data['end_time']) && $data['end_time'] < time()) throw new AdminException('END_TIME_NOT_LESS_CURRENT_TIME'); - - $goods_ids = []; - if ($data['goods_type'] != ManjianDict::ALL_GOODS) { - if (isset($data['goods_data']) && !empty($data['goods_data'])) { - $goods_ids = array_unique(array_column($data['goods_data'], 'goods_id')); - } - } - - //有正在进行的全部商品活动 - $all_goods_count = $this->model - ->where([ - ['manjian_id', '<>', $manjian_id], - ['goods_type', '=', ManjianDict::ALL_GOODS], - ['status', 'in', [ManjianDict::NOT_ACTIVE, ManjianDict::ACTIVE]], - ])->where(function ($query) use ($data) { - $query->whereOr([ - ['start_time|end_time', 'between', [$data['start_time'], $data['end_time']]], - [['start_time', '<=', $data['start_time']], ['end_time', '>=', $data['end_time']]], - [['start_time', '>=', $data['start_time']], ['end_time', '<=', $data['end_time']]] - ]); - })->count(); - if ($all_goods_count > 0) throw new AdminException('MANJIANSONG_ALL_GOODS_EXIT'); - - $manjian_goods_model = new ManjianGoods(); - $select_goods_id = $manjian_goods_model - ->where([['manjian_goods.manjian_goods_id', '>', 0]]) - ->withJoin([ - 'manjian' => function (Query $query) use ($data, $manjian_id) { - $query->where([['manjian.manjian_id', '<>', $manjian_id], ['manjian.status', 'in', [ManjianDict::NOT_ACTIVE, ManjianDict::ACTIVE]], ['manjian.goods_type', '=', ManjianDict::SELECTED_GOODS]])->where(function ($query) use ($data) { - $query->whereOr([['manjian.start_time|manjian.end_time', 'between', [$data['start_time'], $data['end_time']]], - [['manjian.start_time', '<=', $data['start_time']], ['manjian.end_time', '>=', $data['end_time']]], - [['manjian.start_time', '>=', $data['start_time']], ['manjian.end_time', '<=', $data['end_time']]]]); - }); - }, - ], 'inner') - ->column('goods_id'); - - $select_goods_not_id = $manjian_goods_model - ->where([['manjian_goods.manjian_goods_id', '>', 0]]) - ->withJoin([ - 'manjian' => function (Query $query) use ($data, $manjian_id) { - $query->where([['manjian.manjian_id', '<>', $manjian_id], ['manjian.status', 'in', [ManjianDict::NOT_ACTIVE, ManjianDict::ACTIVE]], ['manjian.goods_type', '=', ManjianDict::SELECTED_GOODS_NOT]])->where(function ($query) use ($data) { - $query->whereOr([['manjian.start_time|manjian.end_time', 'between', [$data['start_time'], $data['end_time']]], - [['manjian.start_time', '<=', $data['start_time']], ['manjian.end_time', '>=', $data['end_time']]], - [['manjian.start_time', '>=', $data['start_time']], ['manjian.end_time', '<=', $data['end_time']]]]); - }); - }, - ], 'inner') - ->column('goods_id'); - - $error = [ - 'code' => 1, - 'data' => [] - ]; - if ($data['goods_type'] != ManjianDict::ALL_GOODS) { - $used_goods_ids = array_merge($select_goods_id, $select_goods_not_id); - $goods_id_intersect = array_intersect($goods_ids, $used_goods_ids); - if (!empty($goods_id_intersect)) { - throw new AdminException('MANJIANSONG_GOODS_NOT_REPEAR'); - } - } -// switch ($data['goods_type']) { -// case ManjianDict::ALL_GOODS: -// if (!empty($select_goods_id) || !empty($select_goods_not_id)) { -// throw new AdminException('MANJIANSONG_GOODS_NOT_REPEAR'); -// } -// break; -// case ManjianDict::SELECTED_GOODS_NOT: -// if (!empty($select_goods_id)) { -// $goods_id_diff = array_diff($select_goods_id, $goods_ids); -// if (!empty($goods_id_diff)) { -// throw new AdminException('MANJIANSONG_GOODS_NOT_REPEAR'); -// } -// } -// if (!empty($select_goods_not_id)) { -// throw new AdminException('MANJIANSONG_GOODS_NOT_REPEAR'); -// } -// break; -// case ManjianDict::SELECTED_GOODS: -// if (!empty($select_goods_id)) { -// $goods_id_intersect = array_intersect($goods_ids, $select_goods_id); -// if (!empty($goods_id_intersect)) { -// throw new AdminException('MANJIANSONG_GOODS_NOT_REPEAR'); -// } -// } -// if (!empty($select_goods_not_id)) { -// $goods_id_diff = array_diff($goods_ids, $select_goods_not_id); -// if (!empty($goods_id_diff)) { -// throw new AdminException('MANJIANSONG_GOODS_NOT_REPEAR'); -// } -// } -// break; -// } - - Db::startTrans(); - try { - // 满减送活动数据 - $manjian_value['manjian_name'] = $data['manjian_name']; - $manjian_value['condition_type'] = $data['condition_type']; - $manjian_value['goods_type'] = $data['goods_type']; - $manjian_value['join_member_type'] = $data['join_member_type']; - $manjian_value['rule_type'] = $data['rule_type'] ?? ''; - $manjian_value['rule_json'] = $data['rule_json']; - $manjian_value['goods_ids'] = array_map(function ($item) { - return (string)$item; - }, $goods_ids); - $manjian_value['level_ids'] = array_map(function ($item) { - return (string)$item; - }, $data['level_ids']); - $manjian_value['label_ids'] = array_map(function ($item) { - return (string)$item; - }, $data['label_ids']); - $manjian_value['status'] = ManjianDict::NOT_ACTIVE; - $manjian_value['start_time'] = $data['start_time']; - $manjian_value['end_time'] = $data['end_time']; - $manjian_value['remark'] = $data['remark']; - - if (!empty($data['start_time']) && $data['start_time'] <= time()) { - $manjian_value['status'] = ManjianDict::ACTIVE; - } elseif (!empty($data['end_time']) && $data['end_time'] <= time()) { - $manjian_value['status'] = ManjianDict::END; - } - $this->model->where([['manjian_id', '=', $manjian_id]])->update($manjian_value); - - $manjian_goods = []; - if ($data['goods_type'] != ManjianDict::ALL_GOODS) { - if (!empty($data['goods_data'])) { - foreach ($data['goods_data'] as $v) { - $manjian_goods[] = [ - 'manjian_id' => $manjian_id, - 'goods_id' => $v['goods_id'], - 'sku_id' => $v['sku_id'], - 'goods_type' => $data['goods_type'], - 'status' => $manjian_value['status'], - ]; - } - } - } - (new Manjiangoods())->where([['manjian_id', '=', $manjian_id]])->delete(); - (new Manjiangoods())->saveAll($manjian_goods); - Db::commit(); - $error['data'] = ['id' => $manjian_id]; - return $error; - } catch (\Exception $e) { - Db::rollback(); - throw new AdminException($e->getMessage()); - } - } - - /** - * 满减送商品校验 - * @param $data - * @return array - */ - public function checkGoods($data) - { - $error = [ - 'code' => 1, - 'data' => [] - ]; - $goods_ids = $data['goods_ids']; - $manjian_goods_model = new ManjianGoods(); - $select_goods_id = $manjian_goods_model - ->where([['manjian_goods.manjian_goods_id', '>', 0 ]]) - ->withJoin([ - 'manjian' => function (Query $query) use ($data) { - $query->where([['manjian.status', 'in', [ManjianDict::NOT_ACTIVE, ManjianDict::ACTIVE]], ['manjian.goods_type', '=', ManjianDict::SELECTED_GOODS]])->where(function ($query) use ($data) { - $query->whereOr([['manjian.start_time|manjian.end_time', 'between', [strtotime($data['start_time']), strtotime($data['end_time'])]], - [['manjian.start_time', '<=', strtotime($data['start_time'])], ['manjian.end_time', '>=', strtotime($data['end_time'])]], - [['manjian.start_time', '>=', strtotime($data['start_time'])], ['manjian.end_time', '<=', strtotime($data['end_time'])]]]); - }); - }, - ], 'inner') - ->column('goods_id'); - - if (!empty($select_goods_id) && $data['goods_type'] != ManjianDict::ALL_GOODS) { - if (!empty($data['manjian_id'])) { - $select_goods_ids = $manjian_goods_model->where([ - ['manjian_id', '=', $data['manjian_id']] - ])->column('goods_id'); - $goods_ids = array_diff($goods_ids, $select_goods_ids); - } - $goods_id_intersect = array_intersect($goods_ids, $select_goods_id); - if (!empty($goods_id_intersect)) { - foreach ($goods_id_intersect as $goods_id) { - $manjian_info = $manjian_goods_model->where([ - ['goods_id', '=', $goods_id], - ['status', 'in', [ManjianDict::NOT_ACTIVE, ManjianDict::ACTIVE]], -// [ 'goods_type', '=', $data[ 'goods_type' ] ] - ])->with(['manjian' => function ($query) use ($data) { - $query->field('manjian_id,manjian_name'); - }])->findOrEmpty()->toArray(); - if (!empty($manjian_info)) { - $error['code'] = -1; - $error['data'][] = [ - 'goods_id' => $goods_id, - 'error_msg' => '该商品已参加【' . $manjian_info['manjian']['manjian_name'] . '】活动' - ]; - } - } - } - } - return $error; - } - - /** - * 批量关闭 - * @param $data - * @return bool - */ - public function batchClose($data) - { - if (empty($data['manjian_id'])) throw new AdminException('MANJIANSONG_NOT_FOUND'); - - $save_data = []; - foreach ($data['manjian_id'] as $key => $value) { - $save_data[$key]['manjian_id'] = $value; - $save_data[$key]['status'] = ManjianDict::CLOSE; - } - $this->model->saveAll($save_data); - return true; - } - - /** - * 批量删除 - * @param $data - * @return bool - */ - public function batchDelete($data) - { - if (empty($data['manjian_id'])) throw new AdminException('MANJIANSONG_NOT_FOUND'); - $this->model->where([['manjian_id', 'in', $data['manjian_id']]])->delete(); - return true; - } - - /** - * 获取满减信息 - * @return array - */ - public function getManjianInfo($data) - { - return (new CoreManjianService())->getManjianInfo($data); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/marketing/MarketingService.php b/niucloud/addon/shop/app/service/admin/marketing/MarketingService.php deleted file mode 100644 index 0ac29dbe1..000000000 --- a/niucloud/addon/shop/app/service/admin/marketing/MarketingService.php +++ /dev/null @@ -1,76 +0,0 @@ -arrayUniqueness($category, 'key'); - foreach ($category as &$value) { - $value[ 'child' ] = []; - foreach ($app as $v) { - if ($value[ 'key' ] == $v[ 'category' ]) { - $value[ 'child' ][] = $v; - } - } - } - return $category; - } - - //去重 - function arrayUniqueness($arr, $key) - { - $res = array(); - foreach ($arr as $value) { - //查看有没有重复项 - if (isset($res[ $value[ $key ] ])) { - //有:销毁 - unset($value[ $key ]); - } else { - $res[ $value[ $key ] ] = $value; - } - } - return $res; - } - -} diff --git a/niucloud/addon/shop/app/service/admin/marketing/NewcomerService.php b/niucloud/addon/shop/app/service/admin/marketing/NewcomerService.php deleted file mode 100644 index 680222d93..000000000 --- a/niucloud/addon/shop/app/service/admin/marketing/NewcomerService.php +++ /dev/null @@ -1,386 +0,0 @@ -model = new Active(); - } - - /** - * 新人专享设置 - * @param array $data - * @return bool - */ - public function setConfig(array $data) - { - $goods_data = json_decode($data[ 'goods_data' ], true); - if ($data[ 'active_status' ] == ActiveDict::ACTIVE) { - $this->checkGoods($goods_data); - } - try { - $active_value[ 'validity_type' ] = $data[ 'validity_type' ]; - $active_value[ 'validity_day' ] = $data[ 'validity_day' ]; - $active_value[ 'validity_time' ] = !empty($data[ 'validity_time' ]) ? strtotime($data[ 'validity_time' ]) : 0; - $active_value[ 'participation_way' ] = $data[ 'participation_way' ]; - $active_value[ 'appoint_time' ] = !empty($data[ 'appoint_time' ]) ? strtotime($data[ 'appoint_time' ]) : 0; - $active_value[ 'limit_num' ] = $data[ 'limit_num' ]; - $active_value[ 'banner_list' ] = $data[ 'banner_list' ]; - - $active_goods = []; - foreach ($goods_data as $k => $v) { - $active_goods[] = [ - 'goods_id' => $v[ 'goods_id' ], - 'sku_id' => $v[ 'sku_id' ], - 'active_goods_type' => ActiveDict::GOODS_SINGLE, - 'active_class' => ActiveDict::NEWCOMER_DISCOUNT, - 'active_goods_value' => json_encode($v), - 'active_goods_status' => $data[ 'active_status' ], - 'active_goods_price' => $v[ 'newcomer_price' ], - ]; - } - $data[ 'active_goods_info' ] = $data[ 'goods_data' ]; - $data[ 'active_goods' ] = $active_goods; - $data[ 'active_type' ] = ActiveDict::GOODS; - $data[ 'active_goods_type' ] = ActiveDict::GOODS_SINGLE; - $data[ 'active_class' ] = ActiveDict::NEWCOMER_DISCOUNT; - $data[ 'active_value' ] = $active_value; - - $info = $this->model->where([[ 'active_class', '=', ActiveDict::NEWCOMER_DISCOUNT ] ])->findOrEmpty(); - if ($info->isEmpty()) { - ( new CoreActiveService() )->add($data); - } else { - ( new CoreActiveService() )->edit($info[ 'active_id' ], $data); - } - return true; - } catch (\Exception $e) { - throw new CommonException($e->getMessage()); - } - } - - /** - * 获取新人专享配置 - * @return array - */ - public function getConfig() - { - $value = ( new CoreNewcomerService() )->getConfig(); - if (!empty($value[ 'active_id' ])) { - $active_goods = ( new ActiveGoods() )->field('goods_id,sku_id,active_goods_value')->where([ [ 'active_id', '=', $value[ 'active_id' ] ], [ 'active_class', '=', ActiveDict::NEWCOMER_DISCOUNT ] ]) - ->with([ - 'goods' => function ($query) { - $query->field('goods_id,goods_name,goods_type,goods_cover')->append([ 'goods_type_name', 'goods_cover_thumb_mid' ]); - }, - 'goodsSkuOne' => function ($query) { - $query->field('sku_id,sku_name,sku_image,goods_id,price,stock'); - } - ]) - ->select()->toArray(); - foreach ($active_goods as $k => &$item) { - if (!empty($item[ 'goods' ])) { - $item[ 'goods_name' ] = $item[ 'goods' ][ 'goods_name' ]; - $item[ 'goods_type' ] = $item[ 'goods' ][ 'goods_type' ]; - $item[ 'goods_type_name' ] = $item[ 'goods' ][ 'goods_type_name' ]; - $item[ 'sku_name' ] = $item[ 'goodsSkuOne' ][ 'sku_name' ]; - $item[ 'sku_image' ] = $item[ 'goodsSkuOne' ][ 'sku_image' ]; - if (empty($item[ 'sku_image' ])) { - $item[ 'sku_image' ] = $item[ 'goods' ][ 'goods_cover_thumb_mid' ]; - } - $item[ 'price' ] = $item[ 'goodsSkuOne' ][ 'price' ]; - $item[ 'stock' ] = $item[ 'goodsSkuOne' ][ 'stock' ]; - $item[ 'active_goods_value' ] = json_decode($item[ 'active_goods_value' ], true); - } else { - unset($active_goods[ $k ]); - } - } - $active_goods = array_values($active_goods); - $value[ 'active_goods' ] = $active_goods; - } - return $value; - } - - /** - * 商品结构校验 - * @param $goods_data - * @return void - */ - public function checkGoods($goods_data) - { - if (empty($goods_data)) throw new AdminException('ACTIVE_GOODS_NOT_EMPTY'); - foreach ($goods_data as $v) { - if (empty($v)) throw new AdminException('ACTIVE_GOODS_SKU_NOT_EMPTY'); - if (!isset($v[ 'newcomer_price' ]) || $v[ 'newcomer_price' ] == '') throw new AdminException('ACTIVE_GOODS_NEWCOMER_PRICE_NOT_EMPTY'); - } - } - - /** - * 获取商品选择分页列表 - * @param array $where - * @return array - */ - public function getSelectPage(array $where = []) - { - $goods_model = new Goods(); - $goods_sku_model = new GoodsSku(); - $active_goods_model = new ActiveGoods(); - $active_goods = $active_goods_model->field('goods_id,sku_id,active_goods_value')->where([ - [ 'active_class', '=', ActiveDict::NEWCOMER_DISCOUNT ], -// [ 'active_goods_status', '=', ActiveDict::ACTIVE ] - ])->select()->toArray(); - $active_goods_ids = array_unique(array_column($active_goods, 'goods_id')); - $active_sku_ids = array_column($active_goods, 'sku_id'); - $active_goods = array_column($active_goods, null, 'sku_id'); - - $field = 'goods_id, goods_name, goods_type, goods_cover,goods_image, stock,sub_title,goods_desc'; - $order = 'sort desc,create_time desc'; - - $sku_where = [ - [ 'goodsSku.is_default', '=', 1 ], - [ 'goods.is_gift', '=', GoodsDict::NOT_IS_GIFT ] - ]; - - if (!empty($where[ 'keyword' ])) { - $sku_where[] = [ 'goods_name|sub_title', 'like', '%' . $where[ 'keyword' ] . '%' ]; - } - - if ($where[ 'select_type' ] == 'all') { - $sku_where[] = [ 'goods.stock', '>', 0 ]; - $sku_where[] = [ 'status', '=', 1 ]; - $sku_where[] = [ 'goods.goods_id', 'in', $active_goods_ids ]; - } - if ($where[ 'select_type' ] == 'selected') { - $goods_ids = $goods_sku_model->where([ - [ 'sku_id', 'in', $where[ 'sku_ids' ] ] - ])->column('goods_id'); - $sku_where[] = [ 'goods.goods_id', 'in', $goods_ids ]; - } - - $verify_goods_ids = []; - $verify_sku_ids = []; - // 检测商品id集合是否存在,移除不存在的商品id,纠正数据准确性 - if (!empty($where[ 'verify_goods_ids' ]) && !empty($active_goods_ids)) { - $verify_goods_ids = $goods_model->where([ - [ 'goods_id', 'in', $where[ 'verify_goods_ids' ] ], - [ 'status', '=', 1 ] - ])->field('goods_id')->select()->toArray(); - - if (!empty($verify_goods_ids)) { - // 移除不在新人活动列表中的商品 - foreach ($verify_goods_ids as $k => $v) { - if (!in_array($v[ 'goods_id' ], $active_goods_ids)) unset($verify_goods_ids[ $k ]); - } - $verify_goods_ids = array_values($verify_goods_ids); - $verify_goods_ids = array_column($verify_goods_ids, 'goods_id'); - } - } - - // 检测商品id集合是否存在,移除不存在的商品id,纠正数据准确性 - if (!empty($where[ 'verify_sku_ids' ]) && !empty($active_sku_ids)) { - $verify_sku_ids = $goods_sku_model->where([ - [ 'sku_id', 'in', $where[ 'verify_sku_ids' ] ] - ])->field('sku_id')->select()->toArray(); - - if (!empty($verify_sku_ids)) { - // 移除不在新人活动列表中的商品 - foreach ($verify_sku_ids as $k => $v) { - if (!in_array($v[ 'sku_id' ], $active_sku_ids)) unset($verify_sku_ids[ $k ]); - } - $verify_sku_ids = array_values($verify_sku_ids); - $verify_sku_ids = array_column($verify_sku_ids, 'sku_id'); - } - } - - $search_model = $goods_model - ->withSearch([ "goods_category", "goods_type" ], $where) - ->field($field) - ->withJoin([ - 'goodsSku' => [ 'sku_id', 'sku_name', 'goods_id', 'price', 'stock', 'sku_spec_format' ], - ]) - ->with([ - 'skuList' => function (Query $query) use ($active_sku_ids) { - $query->where([ [ 'sku_id', 'in', $active_sku_ids ] ]); - } - ]) - ->where($sku_where)->order($order)->append([ 'goods_type_name', 'goods_cover_thumb_small', 'goods_cover_thumb_mid' ]); - $list = $this->pageQuery($search_model); - - foreach ($list[ 'data' ] as &$item) { - if (!empty($item[ 'skuList' ]) && !empty($active_goods)) { - foreach ($item[ 'skuList' ] as &$sku_item) { - $active_goods_value = json_decode($active_goods[ $sku_item[ 'sku_id' ] ][ 'active_goods_value' ], true); - $sku_item[ 'newcomer_price' ] = $active_goods_value[ 'newcomer_price' ] ?? 0; - } - if (!empty($item[ 'goodsSku' ])) { - if (in_array($item[ 'goodsSku' ][ 'sku_id' ], $active_sku_ids)) { - $active_goods_value = json_decode($active_goods[ $item[ 'goodsSku' ][ 'sku_id' ] ][ 'active_goods_value' ], true); - $item[ 'goodsSku' ][ 'newcomer_price' ] = $active_goods_value[ 'newcomer_price' ] ?? 0; - } else { - $item[ 'goodsSku' ][ 'newcomer_price' ] = $item[ 'skuList' ][ 0 ][ 'newcomer_price' ]; - } - } - } - } - - $list[ 'verify_goods_ids' ] = $verify_goods_ids; - $list[ 'verify_sku_ids' ] = $verify_sku_ids; - - return $list; - } - - /** - * 获取已选商品列表 - * @param array $where - * @return array - */ - public function getSelectSku(array $where = []) - { - $goods_model = new Goods(); - $active_goods_model = new ActiveGoods(); - $active_goods = $active_goods_model->field('goods_id,sku_id,active_goods_value')->where([ - [ 'active_class', '=', ActiveDict::NEWCOMER_DISCOUNT ], -// [ 'active_goods_status', '=', ActiveDict::ACTIVE ] - ])->select()->toArray(); - $active_goods_ids = array_unique(array_column($active_goods, 'goods_id')); - $active_sku_ids = array_column($active_goods, 'sku_id'); - $active_goods = array_column($active_goods, null, 'sku_id'); - $field = 'goods_id, goods_name, goods_type, goods_cover, stock'; - $order = 'sort desc,create_time desc'; - - $select_goods_list = [];// 已选商品列表 - - // 检测商品id集合是否存在,移除不存在的商品id,纠正数据准确性 - if (!empty($where[ 'verify_goods_ids' ]) && !empty($active_goods_ids)) { - $verify_goods_ids = $goods_model->where([ - [ 'goods_id', 'in', $where[ 'verify_goods_ids' ] ], - [ 'status', '=', 1 ] - ])->field('goods_id')->select()->toArray(); - - if (!empty($verify_goods_ids)) { - // 移除不在新人活动列表中的商品 - foreach ($verify_goods_ids as $k => $v) { - if (!in_array($v[ 'goods_id' ], $active_goods_ids)) unset($verify_goods_ids[ $k ]); - } - $verify_goods_ids = array_values($verify_goods_ids); - $verify_goods_ids = array_column($verify_goods_ids, 'goods_id'); - } - - $select_goods_list = $goods_model - ->field($field) - ->with([ - 'skuList' => function (Query $query) use ($active_sku_ids) { - $query->where([ [ 'sku_id', 'in', $active_sku_ids ] ]); - } - ]) - ->where([ - [ 'goods_id', 'in', $verify_goods_ids ] - ]) - ->order($order)->append([ 'goods_type_name', 'goods_cover_thumb_small', 'goods_cover_thumb_mid' ]) - ->select()->toArray(); - - foreach ($select_goods_list as &$item) { - if (!empty($item[ 'skuList' ]) && !empty($active_goods)) { - foreach ($item[ 'skuList' ] as &$sku_item) { - $active_goods_value = json_decode($active_goods[ $sku_item[ 'sku_id' ] ][ 'active_goods_value' ], true); - $sku_item[ 'newcomer_price' ] = $active_goods_value[ 'newcomer_price' ] ?? 0; - } - if (!empty($item[ 'goodsSku' ])) { - if (in_array($item[ 'goodsSku' ][ 'sku_id' ], $active_sku_ids)) { - $active_goods_value = json_decode($active_goods[ $item[ 'goodsSku' ][ 'sku_id' ] ][ 'active_goods_value' ], true); - $item[ 'goodsSku' ][ 'newcomer_price' ] = $active_goods_value[ 'newcomer_price' ] ?? 0; - } else { - $item[ 'goodsSku' ][ 'newcomer_price' ] = $item[ 'skuList' ][ 0 ][ 'newcomer_price' ]; - } - } - } - } - } - - // 检测商品id集合是否存在,移除不存在的商品id,纠正数据准确性 - if (!empty($where[ 'verify_sku_ids' ]) && !empty($active_sku_ids)) { - $goods_sku_model = new GoodsSku(); - $verify_sku_ids = $goods_sku_model->where([ - [ 'sku_id', 'in', $where[ 'verify_sku_ids' ] ] - ])->field('sku_id')->select()->toArray(); - - if (!empty($verify_sku_ids)) { - // 移除不在新人活动列表中的商品 - foreach ($verify_sku_ids as $k => $v) { - if (!in_array($v[ 'sku_id' ], $active_sku_ids)) unset($verify_sku_ids[ $k ]); - } - $verify_sku_ids = array_values($verify_sku_ids); - $verify_sku_ids = array_column($verify_sku_ids, 'sku_id'); - } - - $goods_ids = $goods_sku_model->where([ - [ 'sku_id', 'in', $verify_sku_ids ] - ])->field('goods_id')->select()->toArray(); - if (!empty($goods_ids)) { - $goods_ids = array_column($goods_ids, 'goods_id'); - $goods_ids = array_unique($goods_ids); - } - - $select_goods_list = $goods_model - ->field($field) - ->with([ - 'skuList' => function (Query $query) use ($verify_sku_ids) { - $query->where([ [ 'sku_id', 'in', $verify_sku_ids ] ]); - } - ]) - ->where([ - [ 'goods_id', 'in', $goods_ids ] - ]) - ->order($order)->append([ 'goods_type_name', 'goods_cover_thumb_small', 'goods_cover_thumb_mid' ]) - ->select()->toArray(); - - foreach ($select_goods_list as &$item) { - if (!empty($item[ 'skuList' ]) && !empty($active_goods)) { - foreach ($item[ 'skuList' ] as &$sku_item) { - $active_goods_value = json_decode($active_goods[ $sku_item[ 'sku_id' ] ][ 'active_goods_value' ], true); - $sku_item[ 'newcomer_price' ] = $active_goods_value[ 'newcomer_price' ] ?? 0; - } - if (!empty($item[ 'goodsSku' ])) { - if (in_array($item[ 'goodsSku' ][ 'sku_id' ], $verify_sku_ids)) { - $active_goods_value = json_decode($active_goods[ $item[ 'goodsSku' ][ 'sku_id' ] ][ 'active_goods_value' ], true); - $item[ 'goodsSku' ][ 'newcomer_price' ] = $active_goods_value[ 'newcomer_price' ] ?? 0; - } else { - $item[ 'goodsSku' ][ 'newcomer_price' ] = $item[ 'skuList' ][ 0 ][ 'newcomer_price' ]; - } - } - } - } - } - - return $select_goods_list; - } - -} diff --git a/niucloud/addon/shop/app/service/admin/marketing/pointexchange/ExchangeService.php b/niucloud/addon/shop/app/service/admin/marketing/pointexchange/ExchangeService.php deleted file mode 100644 index 6875574e7..000000000 --- a/niucloud/addon/shop/app/service/admin/marketing/pointexchange/ExchangeService.php +++ /dev/null @@ -1,418 +0,0 @@ -model = new Exchange(); - } - - /** - * 获取积分商城列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'total_exchange_num,stock,id,type,names,title,image,status,product_detail,point,price,limit_num,content,sort,total_point_num,total_price_num,total_order_num,total_member_num,update_time,create_time'; - $order = 'id desc'; - $search_model = $this->model->where([ [ 'id', '>', 0 ] ])->withSearch([ 'names', 'status', 'create_time', 'active_id' ], $where)->append([ 'type_name', 'status_name', 'goods_cover_thumb_small' ])->field($field)->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取积分商城分页列表(用于弹框选择) - * @param array $where - * @return array - */ - public function getSelectPage(array $where = []) - { - $verify_ids=[]; - // 检测id集合是否存在,移除不存在的id,纠正数据准确性 - if (!empty($where[ 'verify_ids' ])) { - $verify_ids = $this->model->where([ - [ 'id', 'in', $where[ 'verify_ids' ] ] - ])->field('id')->select()->toArray(); - - if (!empty($verify_ids)) { - $verify_ids = array_column($verify_ids, 'id'); - } - } - - $field = 'total_exchange_num,stock,id,type,names,title,image,status,product_detail,point,price,limit_num,content,sort,total_point_num,total_price_num,total_order_num,total_member_num,update_time,create_time'; - $order = 'id desc'; - $search_model = $this->model->where([ [ 'status', '=', ExchangeDict::UP ] ])->withSearch([ 'names', 'status', 'create_time' ], $where)->append([ 'type_name', 'status_name', 'goods_cover_thumb_small' ])->field($field)->order($order); - $list = $this->pageQuery($search_model); - $list[ 'verify_ids' ] = $verify_ids; - return $list; - } - - /** - * 获取积分商城详情 - * @param int $id - * @return array - */ - public function getDetail(int $id) - { - $field = 'stock,total_exchange_num,id,type,names,title,image,status,product_detail,point,price,limit_num,content,sort,total_point_num,total_price_num,total_order_num,total_member_num,update_time,create_time'; - $info = $this->model->where([ [ 'id', '=', $id ] ])->append([ 'type_name' ])->field($field)->findOrEmpty()->toArray(); - switch ($info[ 'type' ]) { - case ExchangeDict::GOODS: - $goods_id = 0; - foreach ($info[ 'product_detail' ] as $k => $v) { - if (!empty($v[ 'goods_id' ])) { - $goods_id = $v[ 'goods_id' ]; - } - } - $info[ 'goods_list' ] = ( new GoodsSku() )->where([ [ 'goods_id', '=', $goods_id ] ])->field('sku_spec_format,sku_id,sku_name,sku_image,sku_no,price as goods_price,stock as goods_stock')->select()->toArray(); - $info[ 'goods_info' ] = ( new Goods() )->where([ [ 'goods_id', '=', $goods_id ] ])->field('goods_id,goods_name,goods_image,goods_cover')->findOrEmpty()->toArray(); - $info[ 'goods_info' ][ 'spec_type' ] = empty($info[ 'goods_list' ][ 0 ][ 'sku_spec_format' ]) ? 'single' : 'multi'; - $info[ 'goods_info' ][ 'goods_price' ] = $info[ 'goods_list' ][ 0 ][ 'goods_price' ]; - foreach ($info[ 'goods_list' ] as &$item) { - $product_detail_key = array_search($item[ 'sku_id' ], array_column($info[ 'product_detail' ], 'sku_id')); - if ($product_detail_key !== false) { - $item[ 'is_enabled' ] = 1; - $item = array_merge($item, $info[ 'product_detail' ][ $product_detail_key ]); - } else { - $item[ 'is_enabled' ] = 0; - } - } - break; - } - return $info; - } - - /** - * 获取积分商城详情 - * @param $where - * @return mixed - */ - public function getInfo($where) - { - $field = 'stock,total_exchange_num,id,type,names,title,image,status,product_detail,point,price,limit_num,content,sort,total_point_num,total_price_num,total_order_num,total_member_num,update_time,create_time'; - $info = $this->model->withSearch([ 'ids', 'names', 'status', 'create_time', 'product_detail', 'sku_id', 'goods_id' ], $where)->append([ 'type_name' ])->field($field)->findOrEmpty()->toArray(); - return $info; - } - - /** - * 添加积分商城 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $product_detail = json_decode($data[ 'product_detail' ], true); - $this->verifyData($data); - $check_condition = [ - [ 'active_goods.active_class', '=', ActiveDict::EXCHANGE ], - [ 'active_goods.goods_id', 'in', $product_detail[ 0 ][ 'goods_id' ] ], - ]; - $goods_where = []; - $active_goods_model = new ActiveGoods(); - $count = $active_goods_model->where($check_condition) - ->withJoin([ - 'active' => function(Query $query) use ($goods_where) { - $query->where($goods_where); - }, - ], 'inner') - ->count(); - if ($count > 0) throw new AdminException('EXCHANGE_GOODS_ACTIVITY_EXISTING'); - Db::startTrans(); - try { - $create_data = [ - 'names' => $data[ 'names' ] ?? '', - 'type' => $data[ 'type' ] ?? '', - 'title' => $data[ 'title' ] ?? '', - 'image' => $data[ 'image' ] ?? '', - 'product_detail' => $data[ 'product_detail' ] ?? '', - 'point' => $data[ 'point' ] ?? 0, - 'price' => $data[ 'price' ] ?? 0, - 'stock' => $data[ 'stock' ] ?? 0, - 'limit_num' => $data[ 'limit_num' ] ?? '', - 'content' => $data[ 'content' ] ?? '', - 'create_time' => time(), - 'update_time' => time(), - 'status' => ExchangeDict::UP, - ]; - $res = $this->model->create($create_data); - $active_goods[] = [ - 'goods_id' => $product_detail[ 0 ][ 'goods_id' ], - 'active_goods_type' => ActiveDict::GOODS_SINGLE, - 'active_class' => ActiveDict::EXCHANGE, - 'active_goods_value' => json_encode($product_detail), - 'active_goods_status' => ActiveDict::ACTIVE, - 'active_goods_price' => $create_data[ 'price' ], - 'active_goods_point' => $create_data[ 'point' ], - ]; - $data[ 'active_goods' ] = $product_detail; - $data[ 'active_status' ] = ActiveDict::ACTIVE; - $data[ 'active_type' ] = ActiveDict::GOODS; - $data[ 'active_goods_type' ] = ActiveDict::GOODS_SINGLE; - $data[ 'active_class' ] = ActiveDict::EXCHANGE; - $data[ 'active_name' ] = $create_data[ 'names' ] ?? ''; - $data[ 'active_desc' ] = $create_data[ 'content' ] ?? ''; - $data[ 'start_time' ] = time(); - $data[ 'end_time' ] = 0; - $data[ 'active_goods' ] = $active_goods; - $active_id = ( new CoreActiveService() )->add($data); - Db::commit(); - return $res->id; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - - /** - * 验证积分商城 数据保存 - * @param int $id - * @param array $data - * @return bool - */ - public function verifyData(&$data) - { - if (empty(ExchangeDict::getType($data[ 'type' ]))) throw new AdminException('EXCHANGE_GOODS_CONFIRM_TYPE'); - $product_detail = json_decode($data[ 'product_detail' ], true); - if ($data[ 'type' ] == 'goods') { - if (empty($product_detail)) throw new AdminException('EXCHANGE_GOODS_NOT_EMPTY'); - $data[ 'stock' ] = 0; - foreach ($product_detail as &$item) { - if ($item[ 'point' ] <= 0) throw new AdminException('EXCHANGE_GOODS_POINT_GREATER_THAN_ZERO'); - if ($item[ 'stock' ] < 0) throw new AdminException('EXCHANGE_GOODS_STOCK_GREATER_THAN_ZERO'); - if (empty($item[ 'price' ])) $item[ 'price' ] = 0; - $data[ 'stock' ] += $item[ 'stock' ]; - } - array_multisort(array_column($product_detail, "point"), SORT_ASC, $product_detail); - $data[ 'point' ] = $product_detail[ 0 ][ 'point' ]; - $data[ 'price' ] = $product_detail[ 0 ][ 'price' ]; - $data[ 'limit_num' ] = $product_detail[ 0 ][ 'limit_num' ]; - $data[ 'product_detail' ] = json_encode($product_detail); - } - } - - /** - * 编辑积分商城 - * @param int $id - * @param array $data - * @return bool - */ - public function edit(int $id, array $data) - { - $info = $this->model->where([ [ 'id', '=', $id ] ])->findOrEmpty(); - if ($info->isEmpty()) throw new AdminException('EXCHANGE_DATA_NOT_FOUND'); -// $product_detail = json_decode($data[ 'product_detail' ], true); - $this->verifyData($data); - Db::startTrans(); - try { - $save_data = [ - 'names' => $data[ 'names' ] ?? '', - 'type' => $data[ 'type' ] ?? '', - 'title' => $data[ 'title' ] ?? '', - 'image' => $data[ 'image' ] ?? '', - 'product_detail' => $data[ 'product_detail' ] ?? '', - 'point' => $data[ 'point' ] ?? 0, - 'price' => $data[ 'price' ] ?? 0, - 'stock' => $data[ 'stock' ] ?? 0, - 'limit_num' => $data[ 'limit_num' ] ?? '', - 'content' => $data[ 'content' ] ?? '', - 'update_time' => time(), - ]; - $this->model->where([ [ 'id', '=', $id ] ])->update($save_data); - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 修改积分商品上下架状态 - * @param $data - * @return Goods - */ - public function editStatus($data, $id) - { - if ($data[ 'status' ] == 1) { - $data_info = $this->getInfo([ 'ids' => $id ]); - if (!empty($data_info)) - $goods_info = ( new Goods() )->where([ [ 'goods_id', '=', $data_info[ 'product_detail' ][ 0 ][ 'goods_id' ] ] ])->field('status')->findOrEmpty()->toArray(); - if ($goods_info[ 'status' ] == 0) throw new AdminException('SHOP_GOODS_DELISTED'); - } - return $this->model->where([ [ 'id', '=', $id ] ])->update([ 'status' => $data[ 'status' ] ]); - } - - - /** - * 修改排序号 - * @param $data - * @return mixed - */ - public function modifySort($data, $id = 0) - { - return $this->model->where([ [ 'id', '=', $id ] ])->update([ 'sort' => $data[ 'sort' ] ]); - } - - - /** - * 删除积分商城 - * @param int $active_id - * @return bool - */ - public function del(int $id) - { - $info = $this->model->where([ [ 'id', '=', $id ] ])->findOrEmpty(); - if ($info->isEmpty()) throw new AdminException('EXCHANGE_DATA_NOT_FOUND'); - Db::startTrans(); - try { - $goods_id = 0; - foreach ($info[ 'product_detail' ] as $k => $v) { - if (!empty($v[ 'goods_id' ])) { - $goods_id = $v[ 'goods_id' ]; - } - } - $active_info = ( new ActiveGoods() )->where([ - [ 'goods_id', 'in', $goods_id ], - [ 'active_class', '=', ActiveDict::EXCHANGE ], - ])->field('active_id')->findOrEmpty()->toArray(); - if (!empty($active_info)) ( new CoreActiveService() )->del($active_info[ 'active_id' ], 1); - $this->model->where([ [ 'id', '=', $id ] ])->delete(); - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 批量删除积分商城 - * @param array $ids - * @return bool - */ - public function batchDelete($ids) - { - $point_exchange_list = $this->model->where([ [ 'id', 'in', $ids ] ])->select()->toArray(); - foreach ($point_exchange_list as $value){ - if ($value[ 'status' ] == ExchangeDict::UP) throw new AdminException('EXIST_NOT_DOWN_ACTIVE'); - } - - $goods_ids = []; - foreach ($point_exchange_list as $value){ - foreach ($value[ 'product_detail' ] as $v) { - if (!empty($v[ 'goods_id' ])) { - $goods_ids[] = $v[ 'goods_id' ]; - } - } - } - $goods_ids = array_unique($goods_ids); - - $active_ids = ( new ActiveGoods() )->where([ - [ 'goods_id', 'in', $goods_ids ], - [ 'active_class', '=', ActiveDict::EXCHANGE ], - ])->column('active_id'); - Db::startTrans(); - try { - $this->model->where([ [ 'id', 'in', $ids ] ])->delete(); - (new Active())->where([ [ 'active_id', 'in', $active_ids ], [ 'active_class', '=', ActiveDict::EXCHANGE ] ])->delete(); - (new ActiveGoods())->where([ [ 'active_id', 'in', $active_ids ], [ 'active_class', '=', ActiveDict::EXCHANGE ] ])->delete(); - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 批量下架积分商城 - * @param array $ids - * @return bool - */ - public function batchDown($ids) - { - $this->model->where([ [ 'id', 'in', $ids ], [ 'status', '=', ExchangeDict::UP] ])->update( [ 'status' => ExchangeDict::DOWN] ); - - return true; - } - - /** - * 批量上架积分商城 - * @param array $ids - * @return bool - */ - public function batchUp($ids) - { - $this->model->where([ [ 'id', 'in', $ids ], [ 'status', '=', ExchangeDict::DOWN] ])->update( [ 'status' => ExchangeDict::UP] ); - - return true; - } - - - /** - * 商品编辑业务 - * @param $exchange_goods_info - * @param string $status - * @param array $sku_list - * @return bool - */ - public function afterGoodsEdit($exchange_goods_info, $status = '', $sku_list = []) - { - Db::startTrans(); - try { - if ($status != '' && $status == '0') $save_data[ 'status' ] = $status; - if (!empty($sku_list)) { - foreach ($exchange_goods_info[ 'product_detail' ] as &$item) { - $item[ 'stock' ] = $item[ 'stock' ] > $sku_list[ $item[ 'sku_id' ] ][ 'stock' ] ? $sku_list[ $item[ 'sku_id' ] ][ 'stock' ] : $item[ 'stock' ]; - } - $save_data[ 'type' ] = $exchange_goods_info[ 'type' ]; - $save_data[ 'product_detail' ] = json_encode($exchange_goods_info[ 'product_detail' ]); - $this->verifyData($save_data); - } - if (isset($save_data)) $this->model->where([ [ 'id', '=', $exchange_goods_info[ 'id' ] ] ])->update($save_data); - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - - } - - -} diff --git a/niucloud/addon/shop/app/service/admin/order/ConfigService.php b/niucloud/addon/shop/app/service/admin/order/ConfigService.php deleted file mode 100644 index 1654c7f31..000000000 --- a/niucloud/addon/shop/app/service/admin/order/ConfigService.php +++ /dev/null @@ -1,57 +0,0 @@ -order_config_service = new CoreOrderConfigService(); - } - - /** - * 交易设置 - * @param array $params - * @return array - */ - public function setConfig($params) - { - if ($params['evaluate_is_to_examine'] == 0) { - ( new EvaluateService() )->auditEditBatch(); - } - return $this->order_config_service->setConfig($params); - } - - /** - * 获取交易设置 - * @return array - */ - public function getConfig() - { - return $this->order_config_service->getConfig(); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/order/InvoiceService.php b/niucloud/addon/shop/app/service/admin/order/InvoiceService.php deleted file mode 100644 index f18e44edd..000000000 --- a/niucloud/addon/shop/app/service/admin/order/InvoiceService.php +++ /dev/null @@ -1,134 +0,0 @@ -model = new Invoice(); - } - - public function getPage(array $where) - { - $order = 'id desc'; - $search_model = $this->model - ->withSearch(["is_invoice", "header_type", "header_name", "create_time", "invoice_time"], $where) - ->where([['status', '=', InvoiceDict::OPEN]]) - ->append(['header_type_name', 'type_name', 'invoice_type_name','pay_voucher_thumb_mid','pay_voucher_thumb_small','pay_voucher_thumb_big','invoice_voucher_thumb_mid','invoice_voucher_thumb_small','invoice_voucher_thumb_big']) - ->field('*')->order($order); - $list = $this->pageQuery($search_model); - foreach ($list['data'] as &$item) { - $item['is_can_jump'] = 1; - if (count(explode(',', $item['trade_id'])) > 1) { - $item['is_can_jump'] = 0; - } - } - return $list; - } - - public function getInfo(int $id) - { - $detail = $this->model->where([['id', '=', $id], ['status', '=', InvoiceDict::OPEN]])->field('*')->append(['header_type_name', 'type_name'])->findOrEmpty()->toArray(); - return $detail; - } - - /** - * 开票 - * @param int $id - * @param array $data - * @return true - */ - public function invoicing(int $id, array $data) - { - $invoice = $this->model->where([['id', '=', $id], ['status', '=', 2]])->findOrEmpty(); - if ($invoice->isEmpty()) throw new CommonException('INVOICE_NOT_EXIST'); - if ($invoice['is_invoice']) throw new CommonException('INVOICED'); - - $invoice->is_invoice = 1; - $invoice->invoice_number = $data['invoice_number']; - $invoice->invoice_voucher = $data['invoice_voucher']; - $invoice->remark = $data['remark']; - $invoice->invoice_time = time(); - - $invoice->save(); - - return true; - } - - /** - * 开票 - * @param int $id - * @param array $data - * @return true - */ - public function audit($data) - { - (new CoreInvoiceService())->audit($data['ids']); - return true; - } - - public function add($data) - { - $order_info = (new OrderService())->getInfoByOrderNo($data['order_no']); - if (empty($order_info)) { - throw new AdminException('SHOP_ORDER_NOT_FOUND'); - } - $trade_id = $order_info['order_id']; - $member_id = $order_info['member_id']; - $invoice_info = $this->model->where([ - 'trade_id' => $trade_id, - 'member_id' => $member_id - ])->findOrEmpty(); - if (!$invoice_info->isEmpty()) { - throw new CommonException('INVOICE_IS_EXIST'); - } - $insert = [ - 'member_id' => $member_id, - 'trade_type' => InvoiceDict::TYPE, - 'trade_id' => $trade_id, - 'header_type' => $data['header_type'], - 'header_name' => $data['header_name'], - 'type' => $data['type'], - 'name' => $data['name'], - 'pay_voucher' => $data['pay_voucher'], - 'tax_number' => $data['tax_number'], - 'mobile' => $data['mobile'], - 'email' => $data['email'], - 'telephone' => $data['telephone'], - 'address' => $data['address'], - 'bank_name' => $data['bank_name'], - 'bank_card_number' => $data['bank_card_number'], - 'money' => $data['money'], - 'is_invoice' => InvoiceDict::WAIT_INVOICE, - 'create_time' => time(), - 'status' => InvoiceDict::OPEN, - ]; - $invoice_id = (new CoreInvoiceService())->add($insert); - (new CoreOrderService())->setInvoiceIdByOrderId([$trade_id], $invoice_id); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/order/OrderBatchDeliveryService.php b/niucloud/addon/shop/app/service/admin/order/OrderBatchDeliveryService.php deleted file mode 100644 index 97b181b99..000000000 --- a/niucloud/addon/shop/app/service/admin/order/OrderBatchDeliveryService.php +++ /dev/null @@ -1,95 +0,0 @@ -model = new OrderBatchDelivery(); - } - - /** - * 分页列表 - * @param array $where - * @return array - */ - public function getPage(array $where) - { - $field = 'id,main_id,status,type,total_num,success_num,fail_num,create_time,data, update_time, output, fail_output, fail_remark'; - $order = 'create_time desc'; - $search_model = $this->model - ->withSearch([ 'status', 'type', 'create_time', 'main_id' ], $where) - ->field($field) - ->with([ - 'user' => function($query) { - $query->field('uid, username, head_img, real_name'); - } - ])->order($order)->append([ 'type_name', 'status_name' ]); - return $this->pageQuery($search_model); - } - - /** - * 获取详情 - * @param $id - * @return array - * @throws \think\db\exception\DbException - */ - public function getInfo($id) - { - $field = 'id,main_id,status,type,total_num,success_num,fail_count,create_time,data, update_time, output, fail_output, fail_remark'; - return $this->model - ->where([ - [ 'id', '=', $id ] - ]) - ->field($field) - ->with([ - 'user' => function($query) { - $query->field('extend,order_goods_id, order_id, member_id, goods_id, sku_id, goods_name, sku_name, goods_image, sku_image, price, num, goods_money, is_enable_refund, goods_type, delivery_status, status,discount_money')->append([ 'delivery_status_name', 'status_name', 'goods_image_thumb_small' ]); - } - ])->append([ 'type_name', 'status_name' ])->findOrEmpty()->toArray(); - } - - /** - * 加入批量发货任务 - * @param $data - * @return void - */ - public function addBatchOrderDelivery($data) - { - $data[ 'type' ] = OrderBatchDeliveryDict::DELIVERY; - $data[ 'main_id' ] = $this->uid; - ( new CoreOrderBatchDeliveryService() )->add($data); - return true; - } - - /** - * 手动执行任务 - * @param $id - * @return void - */ - public function execute($id) - { - return ( new CoreOrderBatchDeliveryService() )->execute($id); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/order/OrderCloseService.php b/niucloud/addon/shop/app/service/admin/order/OrderCloseService.php deleted file mode 100644 index 81ebc7bf8..000000000 --- a/niucloud/addon/shop/app/service/admin/order/OrderCloseService.php +++ /dev/null @@ -1,45 +0,0 @@ -uid; - $data[ 'close_type' ] = OrderDict::SHOP_CLOSE; - $data[ 'order_id' ] = $order_id; - ( new CoreOrderCloseService() )->close($data); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/admin/order/OrderDeliveryService.php b/niucloud/addon/shop/app/service/admin/order/OrderDeliveryService.php deleted file mode 100644 index d70facd29..000000000 --- a/niucloud/addon/shop/app/service/admin/order/OrderDeliveryService.php +++ /dev/null @@ -1,107 +0,0 @@ -uid; - $data[ 'main_name' ] = (new SysUser())->where('uid', $this->uid)->value('username') ?? ''; - ( new CoreOrderDeliveryService() )->delivery($data); - return true; - } - - /** - * 获取订单发货包裹列表 - * @param $params - * @return mixed - */ - public function getDeliveryPackageList($params) - { - $list = ( new OrderDelivery() ) - ->where([ - [ 'order_id', '=', $params[ 'order_id' ] ] - ]) - ->field('id, order_id, name, delivery_type, sub_delivery_type,express_company_id, express_number, create_time')->with([ - 'company' => function($query) { - $query->field('company_id, company_name, express_no'); - }, - 'order_goods' => function($query) { - $query->field('goods_name, sku_name, goods_image, delivery_id, num, price')->append([ 'goods_image_thumb_small' ]); - } - ]) - ->select()->toArray(); - return $list; - } - - /** - * 物流信息 - * @param $id - */ - public function getDeliveryPackage($data) - { - $field = 'id, order_id, name, delivery_type, sub_delivery_type, express_company_id, express_number, local_deliver_id, status, create_time'; - $info = ( new OrderDelivery() )->where([ [ 'id', '=', $data[ 'id' ] ] ])->with([ - 'company' => function($query) { - $query->field('company_id, company_name, express_no'); - }, - 'order_goods' => function($query) { - $query->field('goods_name, sku_name, goods_image, delivery_id, num, price')->append([ 'goods_image_thumb_small' ]); - } - ])->field($field)->findOrEmpty()->toArray(); - if (!empty($info) && $info[ 'delivery_type' ] == OrderDeliveryDict::EXPRESS && $info[ 'sub_delivery_type' ] != OrderDeliveryDict::NONE_EXPRESS) { - $info[ 'mobile' ] = $data[ 'mobile' ]; - $info = ( new CoreOrderService() )->deliverySearch($info); - } - return $info; - } - - /** - * 配送费用计算 - * @param $data - * @return array|mixed - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function getDeliveryFee($data) - { - return ( new CoreOrderDeliveryService() )->getDeliveryFee($data); - } -} diff --git a/niucloud/addon/shop/app/service/admin/order/OrderFinishService.php b/niucloud/addon/shop/app/service/admin/order/OrderFinishService.php deleted file mode 100644 index d9b7dfcc3..000000000 --- a/niucloud/addon/shop/app/service/admin/order/OrderFinishService.php +++ /dev/null @@ -1,56 +0,0 @@ -model = new Order(); - } - - /** - * 完成 - * @param $order_id - * @return true - */ - public function finish(int $order_id) - { - $data[ 'main_type' ] = OrderLogDict::STORE; - $data[ 'main_id' ] = $this->uid; - $data[ 'order_id' ] = $order_id; - - //查询订单 - $where = array( - ['order_id', '=', $order_id], - ); - $order = $this->model->where($where)->findOrEmpty()->toArray(); - if (empty($order)) throw new AdminException('SHOP_ORDER_NOT_FOUND');//订单不存在 - if ($order['status'] != OrderDict::WAIT_TAKE) throw new AdminException('SHOP_ONLY_WAIT_TAKE_CAN_BE_TAKE');//只有待收货的订单才可以收货 - ( new CoreOrderFinishService() )->finish($data); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/admin/order/OrderService.php b/niucloud/addon/shop/app/service/admin/order/OrderService.php deleted file mode 100644 index 9e4b68bd5..000000000 --- a/niucloud/addon/shop/app/service/admin/order/OrderService.php +++ /dev/null @@ -1,652 +0,0 @@ -model = new Order(); - } - - /** - * 分页列表 - * @param array $where - * @return array - */ - public function getPage(array $where) - { - $field = 'buyer_ask_delivery_time,point,activity_type,order_id,order_no,order_type,order_from,out_trade_no,status,member_id,ip,goods_money,delivery_money,order_money,create_time,pay_time,delivery_type,taker_name,taker_mobile,taker_full_address,take_store_id,is_enable_refund,member_remark,shop_remark,close_type,close_remark,pay_money,relate_source,relate_order_id'; - $order = 'create_time desc'; - - $pay_where = []; - if ($where['pay_type']) { - if ($where['pay_type'] == PayDict::FRIENDSPAY) { - $pay_where = [ - ['pay.main_id', '<>', Db::raw("pay.from_main_id")], - ['pay.from_main_id', '>', 0], - ['pay.status', '=', PayDict::STATUS_FINISH] - ]; - } else { - $pay_where[] = ['pay.type', '=', $where['pay_type']]; - } - } - - $member_where = []; - if ($where['keyword'] != '') { - $member_where = [ - ['member.member_no|member.nickname|member.username|member.mobile', 'like', "%" . $where['keyword'] . "%"], - ]; - } - $search_model = $this->model - ->where([['order.order_id', '>', 0]]) - ->withSearch(['search_type', 'order_from', 'join_status', 'create_time', 'join_pay_time', 'activity_type'], $where) - ->field($field) - ->withJoin([ - 'pay' => function (Query $query) use ($pay_where) { - $query->where($pay_where); - }, - 'member' => function (Query $query) use ($member_where) { - $query->where($member_where); - }, - - ], 'left') - ->with([ - 'order_goods' => function ($query) { - $query->with(['delivery_info' => function ($query) { - $query->field('*')->with(['localDeliveryOrder'])->append(['express_company_name']); - }]) - ->field('extend,order_goods_id, order_id, member_id, goods_id, sku_id, goods_name, sku_name, goods_image, sku_image, price, num, goods_money, is_enable_refund, goods_type, delivery_status, status,discount_money,delivery_id,is_gift') - ->append(['delivery_status_name', 'status_name', 'goods_image_thumb_small', 'impulse_buy_info']); - } - ])->order($order)->append(['order_from_name', 'order_type_name', 'status_name', 'delivery_type_name']); - $order_status_list = OrderDict::getStatus(); - $order_close_list = OrderDict::getCloseType(); - $list = $this->pageQuery($search_model, function ($item, $key) use ($order_status_list, $order_close_list) { - $item['close_type_name'] = $order_close_list[$item['close_type']] ?? ""; - $item['order_status_data'] = $order_status_list[$item['status']] ?? []; - $item_pay = $item['pay']; - if (!empty($item_pay)) { - $item_pay->append(['type_name']); - $item_pay['pay_type_name'] = PayDict::getPayType()[PayDict::FRIENDSPAY]['name'] ?? ''; - } - }); - $list['data'] = $this->getOrderRelateSourceInfo($list['data']); - return $list; - } - - /** - * 获取订单来源的活动 - * @param $order_data - * @return mixed - */ - private function getOrderRelateSourceInfo($order_data) - { - $relate_activity_list = array_reduce($order_data, function ($result, $order_data) { - $source = $order_data['relate_source']; - $result[$source][] = [ - 'order_id' => $order_data['order_id'], - 'relate_order_id' => $order_data['relate_order_id'], - ]; - return $result; - }, []); - $active_res_list = event('ThirdAddonGetOrderActive', $relate_activity_list); - $active_list = []; - foreach ($active_res_list as $item) { - if (empty($item)) { - continue; - } - $active_list += $item; - } - foreach ($order_data as &$datum) { - $datum['relate_active_info'] = $active_list[$datum['order_id']] ?? []; - } - return $order_data; - } - - /** - * 详情 - * @param int $order_id - * @return array - */ - public function getDetail(int $order_id) - { - $field = 'activity_type,point,order_id,order_no,order_type,order_from,out_trade_no,status,member_id,ip,goods_money,delivery_money,order_money,invoice_id,create_time,pay_time,delivery_time,take_time,finish_time,close_time,delivery_type,taker_name,taker_mobile,buyer_ask_delivery_time,taker_province,taker_city,taker_district,taker_address,taker_full_address,taker_longitude,taker_latitude,take_store_id,is_enable_refund,member_remark,shop_remark,close_remark,discount_money,form_record_id'; - $info = $this->model->where([['order_id', '=', $order_id]])->field($field) - ->with( - [ - 'order_goods' => function ($query) { - $query->field('extend,order_goods_id, order_id, member_id, goods_id, sku_id, goods_name, sku_name, goods_image, sku_image, price, num, goods_money, is_enable_refund, goods_type, delivery_status, status,discount_money,delivery_id,is_gift,form_record_id')->append(['delivery_status_name', 'status_name', 'impulse_buy_info']); - }, - 'member' => function ($query) { - $query->field('member_id, nickname, mobile, headimg'); - }, - 'order_log' => function ($query) { - $query->field('order_id, content, main_type, create_time, main_id, type')->order("create_time desc, id desc")->append(['main_type_name', 'type_name', 'main_name']); - }, - 'order_discount' => function ($query) { - $query->field('order_id,discount_type,money,content'); - } - ])->append(['order_from_name', 'order_type_name', 'status_name', 'delivery_type_name'])->findOrEmpty()->toArray(); - $info['verify_code'] = ''; // 核销码 - $info['verifier_member'] = ''; // 核销员 - $order_status_list = OrderDict::getStatus(); - if (!empty($info)) $info['order_status_data'] = $order_status_list[$info['status']] ?? []; - if ($info['delivery_type'] == DeliveryDict::STORE) { - $info['store'] = (new Store())->where([['store_id', '=', $info['take_store_id']]]) - ->field('store_id, store_name, full_address, store_mobile, trade_time') - ->findOrEmpty()->toArray(); - $verify_info = (new Verify())->where([ - ['type', '=', 'shopPickUpOrder'], - ['relate_tag', '=', $order_id] - ])->field('id, code, verifier_member_id')->with(['member' => function ($query) { - $query->field('member_id, nickname'); - }])->findOrEmpty()->toArray(); - if (!empty($verify_info)) { - $info['verify_code'] = $verify_info['code']; - $info['verifier_member'] = $verify_info['member']; - } - } - - if ($info['delivery_type'] == DeliveryDict::EXPRESS || $info['delivery_type'] == DeliveryDict::LOCAL_DELIVERY) { - $info['order_delivery'] = (new OrderDelivery()) - ->where([['order_id', '=', $info['order_id']]]) - ->field('id, order_id, name, delivery_type, sub_delivery_type,express_company_id, express_number, create_time,third_delivery,local_delivery_order_id') - ->append(['third_delivery_name']) - ->select()->toArray(); - if ($info['delivery_type'] == DeliveryDict::LOCAL_DELIVERY) { - if (!empty($info['order_delivery'])) { - $local_delivery_order_id = $info['order_delivery'][0]['local_delivery_order_id']; - $local_delivery_order_info = (new CoreLocalDeliveryService()) ->getLocalDeliveryOrderInfo($local_delivery_order_id); - $info = array_merge($info, $local_delivery_order_info); - } - } - } - - - if ($info['out_trade_no']) { - $info['pay'] = (new Pay())->where([['out_trade_no', '=', $info['out_trade_no']]]) - ->field('main_id, out_trade_no, type, pay_time, status')->append(['type_name'])->findOrEmpty()->toArray(); - - if (!empty($info['pay'])) { - if ($info['member_id'] != $info['pay']['main_id']) { - $member_info = (new Member())->where([['member_id', '=', $info['pay']['main_id']]])->findOrEmpty()->toArray(); - if (!empty($member_info)) { - $info['pay']['pay_member'] = $member_info['nickname']; - } - } - $info['pay']['pay_type_name'] = PayDict::getPayType()[PayDict::FRIENDSPAY]['name'] ?? ''; - } - } - - $coupon_money = 0; - $manjian_discount_money = 0; - if ($info['order_discount']) { - foreach ($info['order_discount'] as $item) { - if ($item['discount_type'] == 'coupon') { - $coupon_money += $item['money']; - } - if ($item['discount_type'] == 'manjian') { - $manjian_discount_money += $item['money']; - } - } - } - $info['coupon_money'] = number_format($coupon_money, 2, '.', ''); - $info['manjian_discount_money'] = number_format($manjian_discount_money, 2, '.', ''); - - $diy_form_records_fields_model = new DiyFormRecordsFields(); - if (!empty($info['form_record_id'])) { - $field_count = $diy_form_records_fields_model->where([['record_id', '=', $info['form_record_id']]])->count(); - if ($field_count > 0) { - $info['form_record_show'] = true; - } else { - $info['form_record_show'] = false; - } - } - if (!empty($info['order_goods'])) { - foreach ($info['order_goods'] as &$item) { - $field_count = $diy_form_records_fields_model->where([['record_id', '=', $item['form_record_id']]])->count(); - if ($field_count > 0) { - $item['form_record_show'] = true; - } else { - $item['form_record_show'] = false; - } - $impulse_buy_tips = ''; - if (isset($item['extend']['is_impulse_buy']) == 1) { - $impulse_buy_num = $item['extend']['impulse_buy_goods_num'] ?? 0;//5 - $impulse_buy_price_total = $item['extend']['impulse_buy_price'] ?? 0; - if ($impulse_buy_num > 0) { - $impulse_buy_price = $impulse_buy_price_total / $impulse_buy_num; - if ($impulse_buy_num == 1) { - $impulse_buy_tips = '第1' . '件' . $impulse_buy_price . '元'; - } else { - $impulse_buy_tips = '第1-' . $impulse_buy_num . '件' . $impulse_buy_price . '元'; - if ($item['num'] > $impulse_buy_num) { - if ($impulse_buy_num + 1 == $item['num']) { - $impulse_buy_tips .= ' 第' . ($impulse_buy_num + 1) . '件' . $item['price'] . '元'; - } else { - $impulse_buy_tips .= ' 第' . ($impulse_buy_num + 1) . '-' . $item['num'] . '件' . $item['price'] . '元'; - } - } - } - } else {//全原价 - $impulse_buy_tips = '第1-' . $item['num'] . '件' . $item['price'] . '元'; - } - } - $item['impulse_buy_info']['show_tips'] = $impulse_buy_tips; - } - } - return $info; - } - - /** - * 商家留言 - * @param $data - * @return bool - */ - public function shopRemark($data) - { - $this->model->where([['order_id', '=', $data['order_id']]])->update(['shop_remark' => $data['shop_remark']]); - return true; - } - - /** - * 订单数量统计 - * @throws DbException - */ - public function getOrderCount() - { - $data = [ - "wait_pay_order" => 0, //待付款 - "wait_delivery_order" => 0, //待发货 - "wait_take_order" => 0, //待收货 - "refund_order" => 0, //退款中(订单项) - ]; - - $data['wait_pay_order'] = $this->model->where([['status', '=', OrderDict::WAIT_PAY]])->count(); - $data['wait_delivery_order'] = $this->model->where([['status', '=', OrderDict::WAIT_DELIVERY]])->count(); - $data['wait_take_order'] = $this->model->where([['status', '=', OrderDict::WAIT_TAKE]])->count(); - $data['refund_order'] = (new OrderGoods())->where([['status', '=', OrderGoodsDict::REFUNDING]])->count(); - - return $data; - } - - /** - * 订单改价 - * @param $data - * @return void - */ - public function editPrice($data) - { - $order_id = $data['order_id']; - $order = $this->model->where([['order_id', '=', $order_id]])->findOrEmpty(); - if ($order->isEmpty()) throw new AdminException('SHOP_ORDER_NOT_FOUND'); - if ($order['status'] != OrderDict::WAIT_PAY) throw new AdminException('SHOP_ONLY_PENDING_ORDERS_CAN_BE_REPRICED'); - - //关闭相关的支付 todo 封装订单专用的关闭支付相关 - try { - (new CorePayService())->closeByTrade(OrderDict::TYPE, $order_id); - } catch (\Exception $e) { - throw new AdminException($e->getMessage()); - } - - $delivery_money = $data['delivery_money']; - if ($delivery_money < 0) throw new AdminException('SHOP_THE_SHIPPING_FEE_CANNOT_BE_LESS_THAN_0'); - $order_goods_data = $data['order_goods_data'];//['order_goods_id' => ['money' => 10]] - $order_goods_model = new OrderGoods(); - $order_goods_list = $order_goods_model->where([['order_id', '=', $order_id]])->select(); - $goods_money = 0; - Db::startTrans(); - try { - foreach ($order_goods_list as $key => $item) { - $item_order_goods_id = $item['order_goods_id']; - $temp_goods_data = $order_goods_data[$item_order_goods_id] ?? []; - - if (!empty($temp_goods_data)) { - $item_money = $temp_goods_data['money'] ?? 0; - if ($item_money != 0) { - $item_order_goods_money = $item['order_goods_money'];//订单项总额 - $item_new_order_goods_money = round($item_order_goods_money + $item_money, 2);// - if ($item_new_order_goods_money < 0) { - throw new AdminException('SHOP_THE_LINE_ITEM_SUBTOTAL_CAN_T_BE_LESS_THAN_0'); - } - $item_new_goods_money = $item_new_order_goods_money + $item['discount_money']; - $item_new_price = floor($item_new_goods_money / $item['num'] * 100) / 100; - - $order_goods_list[$key]['old_goods_money'] = $item['goods_money']; - - $item->save([ - 'price' => $item_new_price, - 'goods_money' => $item_new_goods_money, - 'order_goods_money' => $item_new_order_goods_money - ]); - $goods_money += $item_new_goods_money; - continue; - } - } - $goods_money += $item['goods_money']; - } - $order_money = round($goods_money + $delivery_money - $order['discount_money'], 2); - if ($order_money < 0) { - $order_money = 0; - } - - $order['old_delivery_money'] = $order['delivery_money']; - - $order->save([ - 'goods_money' => $goods_money, - 'delivery_money' => $delivery_money, - 'order_money' => $order_money - ]); - - $order_param = [ - 'order_data' => $order->toArray(), - 'order_goods_data' => $order_goods_list->toArray(), - 'main_id' => $this->uid, - 'main_type' => OrderLogDict::SYSTEM - ]; - //订单改价操作 - CoreOrderEventService::orderEditPrice($order_param); - //订单改价后操作 - CoreOrderEventService::orderEditPriceAfter($order_param); - if ($order_money == 0) { - (new CoreOrderPayService())->pay(['trade_id' => $order_id, 'main_type' => OrderLogDict::SYSTEM, 'main_id' => $this->uid]); - } - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new AdminException($e->getMessage()); - } - } - - /** - * 修改收货地址 - * @param $data - */ - public function editDelivery($data) - { - $data = $this->getEditDeliveryData($data); - if ($data['error_code'] < 0) { - throw new AdminException($data['error_msg'] ?? ''); - } - $delivery_data = $data['delivery_data']; - $this->model->where([['order_id', '=', $data['order_id']]])->update($delivery_data); - return true; - } - - /** - * 订单修改收货地址信息 - * @param $data - */ - public function getEditDeliveryData($data) - { - $delivery_type = $data['delivery_type']; - $order_id = $data['order_id']; - $order = $this->model->where([['order_id', '=', $order_id]])->findOrEmpty()->toArray(); - $delivery_list = (new DeliveryService())->getDeliveryList(); - if (empty($order)) throw new AdminException('SHOP_ORDER_NOT_FOUND'); - if (!in_array($order['status'], [OrderDict::WAIT_PAY, OrderDict::WAIT_DELIVERY])) throw new AdminException('SHOP_ONLY_PENDING_ORDERS_EDIT_TAKER'); - if ($order['delivery_type'] == OrderDeliveryDict::VIRTUAL) throw new AdminException('SHOP_VIRTUAL_ORDERS_EDIT_TAKER'); - $order['delivery_data'] = $data; - - $order['order_goods'] = (new OrderGoods())->where([['goods_type', '=', 'real'], ['order_id', '=', $order_id]])->with(['goods'])->select()->toArray(); - $order['error_code'] = 1; - $order['error_msg'] = ''; - if (empty($delivery_type) || !isset($delivery_list[$delivery_type])) { - $order['error_code'] = -1; - $order['error_msg'] = get_lang('NOT_SUPPORT_DELIVERY_TYPE'); - return $order; - } else if (!empty($delivery_type) && $delivery_list[$delivery_type]['status'] > 1) { - $order['error_code'] = -1; - $order['error_msg'] = get_lang('DELIVERY_TYPE_NOT_OPEN'); - return $order; - } - - $goods_name = ''; - foreach ($order['order_goods'] as $k => &$v) { - if (!in_array($delivery_type, $v['goods']['delivery_type'])) { - $v['error_code'] = -1; - $v['error_msg'] = get_lang('GOODS_NOT_DELIVERY_TYPE'); - $order['error_code'] = -1; - $goods_name .= $v['goods_name'] . ','; - } - } - - if ($order['error_code'] < 0) { - $goods_name = trim($goods_name, ','); - if ($goods_name) $order['error_msg'] = $goods_name . '-' . get_lang('GOODS_NOT_DELIVERY_TYPE'); - return $order; - } - - switch ($delivery_type) { - case OrderDeliveryDict::EXPRESS: - if (empty($data['taker_name']) - || empty($data['taker_mobile']) - || empty($data['taker_province']) - || empty($data['taker_city']) - || empty($data['taker_district']) - || empty($data['taker_address']) - || empty($data['taker_full_address']) - ) { - $order['error_code'] = -1; - $order['error_msg'] = get_lang('EXPRESS_FIELD_EMPTY'); - } - break; - case OrderDeliveryDict::LOCAL_DELIVERY: - if (empty($data['taker_name']) - || empty($data['taker_mobile']) - || empty($data['taker_province']) - || empty($data['taker_city']) - || empty($data['taker_district']) - || empty($data['taker_address']) - || empty($data['taker_full_address']) - || empty($data['taker_longitude']) - || empty($data['taker_latitude']) - ) { - $order['error_code'] = -1; - $order['error_msg'] = get_lang('EXPRESS_FIELD_EMPTY'); - } else { - $order = $this->checkLocationInArea($order, $data); - } - break; - case OrderDeliveryDict::STORE: - if (empty($data['take_store_id'])) { - $order['error_code'] = -1; - $order['error_msg'] = get_lang('EXPRESS_FIELD_EMPTY'); - } - break; - } - - return $order; - } - - /** - * 检查收货地址是否在配送区域 - * @param $order - * @param $data - * @return mixed - */ - public function checkLocationInArea($order, $data) - { - $local = (new Local())->where([['local_id', '>', 0]])->field('fee_type,base_dist,base_price,grad_dist,grad_price,weight_start,weight_unit,weight_price,delivery_type,area,center')->findOrEmpty(); - if ($local->isEmpty()) { - $order['error_code'] = -1; - $order['error_msg'] = get_lang('NOT_CONFIGURED_LOCAL_DELIVERY'); - } - // 收货地址 - $address_point = new Coordinate($data['taker_latitude'], $data['taker_longitude']); - - // 判断所在区域 - $located_in_area = null; - foreach ($local['area'] as $area) { - if ($area['area_type'] == 'radius') { - $center = new Coordinate($area['area_json']['center']['lat'], $area['area_json']['center']['lng']); - $distance = (new Vincenty())->getDistance($address_point, $center); - if ($distance <= $area['area_json']['radius']) { - $located_in_area = $area; - break; - } - } else { - $geofence = new Polygon(); - $geofence->addPoints(array_map(function ($latlng) { - return new Coordinate($latlng['lat'], $latlng['lng']); - }, $area['area_json']['paths'])); - if ($geofence->contains($address_point)) { - $located_in_area = $area; - break; - } - } - } - if (!$located_in_area) { - $order['error_code'] = -1; - $order['error_msg'] = get_lang('NOT_SUPPORT_DELIVERY_ADDRESS'); - } - return $order; - } - - /** - * 获取订单来源 - * @return array - */ - public function getOrderFrom() - { - $order_from_list = ChannelDict::getType(); - $from_event_list = array_filter(event('OrderFromList')) ?? []; - foreach ($from_event_list as $item) { - $order_from_list = array_merge($order_from_list, $item); - } - return $order_from_list; - } - - /** - * 获取已选商品总重量 - * @param $data - * @return float|int|mixed - */ - public function getSelectOrderGoodsWeight($data) - { - $sku_ids = (new OrderGoods())->where([['order_goods_id', 'in', $data[ 'order_goods_ids' ]] ])->column('num', 'sku_id'); - $weight = 0; - foreach ($sku_ids as $sku_id => $value) { - $weight += (new GoodsSku())->where([['sku_id', '=', $sku_id] ])->value('weight') ?? 0 * $value['num']; - } - return max($weight, 1); - } - - /** - * 待确定删除逻辑之后再细化 - * @param $order_ids - * @return bool|void - */ - public function delete($order_ids) - { - - if (empty($order_ids)) throw new AdminException('SHOP_ORDER_NOT_FOUND'); - - $status_list = $this->model->field('order_id, status,order_no,create_time')->whereIn('order_id', $order_ids)->with(['orderGoods' => function ($query) { - $query->field('order_id, goods_id'); - }])->select()->toArray(); - - $error_order_str = ''; - foreach ($status_list as $item) { - if ($item['status'] == OrderDict::CLOSE) { - continue; - } - $error_order_str .= $item['order_no'] . ','; - } - - $error_order_str = rtrim($error_order_str, ','); - if (!empty($error_order_str)) { - $error_str = sprintf(get_lang('SHOP_ORDER_DELETE_STATUS_ERROR'), $error_order_str); - throw new AdminException($error_str); - } - - Db::startTrans(); - try { - //删除订单表 - $this->model::destroy(function ($query) use ($order_ids) { - $query->where([['order_id', 'in', $order_ids]]); - }); - - //删除订单商品项 - (new OrderGoods())::destroy(function ($query) use ($order_ids) { - $query->where([['order_id', 'in', $order_ids]]); - }); - - //删除订单退款 - (new OrderRefund())::destroy(function ($query) use ($order_ids) { - $query->where([ [ 'order_id', 'in', $order_ids ] ]); - }); - - //删除统计 - foreach ($status_list as $value) { - if (!empty($value['orderGoods'])) { - foreach ($value['orderGoods'] as $v) { - CoreGoodsStatService::decStat(['goods_id' => $v['goods_id'], 'time' => $value['create_time'], 'sale_num' => 1]); - } - CoreStatService::decStat(['time' => $value['create_time'], 'order_num' => 1]); - } - } - - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - public function getInfoByOrderNo($order_no) - { - return $this->model->where('order_no', $order_no)->findOrEmpty()->toArray(); - } -} diff --git a/niucloud/addon/shop/app/service/admin/refund/RefundActionService.php b/niucloud/addon/shop/app/service/admin/refund/RefundActionService.php deleted file mode 100644 index 0c36bed5e..000000000 --- a/niucloud/addon/shop/app/service/admin/refund/RefundActionService.php +++ /dev/null @@ -1,98 +0,0 @@ -model = new OrderRefund(); - } - - /** - * 审核退款申请 - * @param $data ['is-agree] - * @return void - */ - public function auditApply($data) - { - $data[ 'main_type' ] = OrderRefundLogDict::STORE; - $data[ 'main_id' ] = $this->uid; - (new CoreRefundActionService())->auditApply($data); - return true; - } - - /** - * 审核是否确认收货 - * @param $data - * @return true - */ - public function auditRefundGoods($data) - { - $data[ 'main_type' ] = OrderRefundLogDict::STORE; - $data[ 'main_id' ] = $this->uid; - (new CoreRefundActionService())->auditRefundGoods($data); - return true; - } - - /** - * 商家主动退款 - * @param $data - * @return true - */ - public function shopActiveRefund($data) - { - $data[ 'main_type' ] = OrderRefundLogDict::STORE; - $data[ 'main_id' ] = $this->uid; - (new CoreRefundActionService())->shopActiveRefund($data); - return true; - } - - /** - * 获取订单可退款金额 - * @param $data - * @return array - */ - public function getOrderRefundMoney($data) - { - $order_goods_ids = $data[ 'order_goods_ids' ]; - $refund_money_array = (new CoreRefundService())->getOrderRefundMoney($order_goods_ids); - return [ - 'refund_money' => round($refund_money_array[ 'refund_money' ] ?? 0, 2) - ]; - } - - /** - * 商家主动关闭售后 - * @param $order_refund_no - * @return void - */ - public function closeRefund($order_refund_no) - { - $data[ 'main_type' ] = OrderRefundLogDict::STORE; - $data[ 'main_id' ] = $this->uid; - $data[ 'order_refund_no' ] =$order_refund_no; - (new CoreRefundActionService())->close($data,OrderRefundDict::SHOP_ACTIVE_CLOSE_REFUND); - } - -} diff --git a/niucloud/addon/shop/app/service/admin/refund/RefundService.php b/niucloud/addon/shop/app/service/admin/refund/RefundService.php deleted file mode 100644 index 4c1ca83b4..000000000 --- a/niucloud/addon/shop/app/service/admin/refund/RefundService.php +++ /dev/null @@ -1,112 +0,0 @@ -model = new OrderRefund(); - } - - /** - * 分页列表 - * @param array $where - * @return array - */ - public function getPage(array $where) - { - $field = 'refund_id, order_id, order_goods_id, order_refund_no, refund_type, reason, member_id, apply_money, money, status, create_time, transfer_time, remark, voucher, source, timeout, refund_no, delivery, shop_reason, refund_address'; - $order = 'create_time desc'; - - $search_model = $this->model - ->where([ [ 'refund_id', '>', 0 ] ]) - ->withSearch([ 'order_refund_no', 'status', 'create_time' ], $where) - ->field($field) - ->with( - [ - 'order_goods' => function($query) { - $query->field('order_goods_id, order_id, member_id, goods_id, sku_id, goods_name, sku_name, goods_image, sku_image, price, num, goods_money,discount_money, is_enable_refund, goods_type')->append([ 'goods_image_thumb_small' ]); - }, - 'member' => function($query) { - $query->field('member_id, nickname'); - } - ])->order($order)->append([ 'status_name', 'refund_type_name' ]); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 详情 - * @param int $refund_id - * @return array - */ - public function getDetail(int $refund_id) - { - $field = 'refund_id, order_id, order_goods_id, order_refund_no, refund_type, reason, member_id, apply_money, money, status, create_time, transfer_time, remark, voucher, source, timeout, refund_no, delivery, shop_reason, refund_address'; - $info = $this->model->where([ [ 'refund_id', '=', $refund_id ] ])->field($field) - ->with( - [ - 'order_main' => function($query) { - $query->field('order_id,order_no,order_type,order_from,out_trade_no,status,member_id,ip,goods_money,delivery_money,order_money,invoice_id,create_time,pay_time,delivery_time,take_time,finish_time,close_time,delivery_type,taker_name,taker_mobile,taker_province,taker_city,taker_district,taker_address,taker_full_address,taker_longitude,taker_latitude,take_store_id,is_enable_refund,member_remark,shop_remark,close_remark,discount_money,point') - ->append([ 'order_from_name', 'order_type_name', 'status_name', 'delivery_type_name' ]); - }, - 'order_goods' => function($query) { - $query->field('order_goods_id, order_id, member_id, goods_id, sku_id, goods_name, sku_name, goods_image, sku_image, price, num, goods_money, is_enable_refund, goods_type'); - }, - 'member' => function($query) { - $query->field('member_id, nickname, mobile, headimg, balance'); - }, - 'pay_refund' => function($query) { - $query->field('refund_no, type, money, create_time, refund_time')->append([ 'type_name' ]); - }, - 'refund_log' => function($query) { - $query->field('order_refund_no, content, main_type, create_time ,main_id, type')->order("create_time desc, id desc")->append([ 'main_name', 'type_name', 'main_type_name' ]); - } - ])->append([ 'status_name', 'refund_type_name' ])->findOrEmpty()->toArray(); - - if (!empty($info)) { - - if ($info[ 'order_main' ][ 'delivery_type' ] == DeliveryDict::STORE) { - $info[ 'store' ] = ( new Store() )->where([ [ 'store_id', '=', $info[ 'order_main' ][ 'take_store_id' ] ] ]) - ->field('store_id, store_name, full_address, store_mobile, trade_time') - ->findOrEmpty()->toArray(); - } - - $refund_gift_list = (new CoreManjianService())->refundCheck($info); - if (!empty($refund_gift_list)) { - $gift_balance = 0; - foreach ($refund_gift_list as $value) { - if (isset($value[ 'balance' ]) && $value[ 'balance' ] > 0) { - $gift_balance = bcadd($gift_balance, $value[ 'balance' ], 2); - } - } - if ($gift_balance > 0) { - $info[ 'gift_balance' ] = $gift_balance; - } - } - - } - return $info; - } - -} diff --git a/niucloud/addon/shop/app/service/admin/shop_address/ShopAddressService.php b/niucloud/addon/shop/app/service/admin/shop_address/ShopAddressService.php deleted file mode 100644 index f4b5f0249..000000000 --- a/niucloud/addon/shop/app/service/admin/shop_address/ShopAddressService.php +++ /dev/null @@ -1,148 +0,0 @@ -model = new ShopAddress(); - } - - /** - * 获取商家地址库列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'id,contact_name,mobile,province_id,city_id,district_id,address,full_address,lat,lng,is_delivery_address,is_refund_address,is_default_delivery,is_default_refund'; - $order = ''; - - $search_model = $this->model->where([ ['id', '>', 0] ])->withSearch([ "mobile", "full_address" ], $where)->field($field)->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取商家地址库信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'id,contact_name,mobile,province_id,city_id,district_id,address,full_address,lat,lng,is_delivery_address,is_refund_address,is_default_delivery,is_default_refund'; - - $info = $this->model->field($field)->where([ [ 'id', '=', $id ] ])->findOrEmpty()->toArray(); - return $info; - } - - /** - * 添加商家地址库 - * @param array $param - * @return mixed - */ - public function add(array $param) - { - $data = [ - 'contact_name' => $param[ 'contact_name' ], - 'mobile' => $param[ 'mobile' ], - 'province_id' => $param[ 'province_id' ], - 'city_id' => $param[ 'city_id' ], - 'district_id' => $param[ 'district_id' ], - 'address' => $param[ 'address' ], - 'full_address' => $param[ 'full_address' ], - 'lat' => $param[ 'lat' ], - 'lng' => $param[ 'lng' ], - 'is_delivery_address' => $param[ 'is_delivery_address' ], - 'is_refund_address' => $param[ 'is_refund_address' ], - 'is_default_delivery' => $param[ 'is_delivery_address' ] ? $param[ 'is_default_delivery' ] : 0, - 'is_default_refund' => $param[ 'is_refund_address' ] ? $param[ 'is_default_refund' ] : 0 - ]; - if ($data[ 'is_default_delivery' ]) $this->model->update([ 'is_default_delivery' => 0 ], [ [ 'is_default_delivery', '>', 0 ] ]); - if ($data[ 'is_default_refund' ]) $this->model->update([ 'is_default_refund' => 0 ], [ [ 'is_default_refund', '>', 0 ] ]); - $res = $this->model->create($data); - return $res->id; - - } - - /** - * 商家地址库编辑 - * @param int $id - * @param array $param - * @return bool - */ - public function edit(int $id, array $param) - { - $data = [ - 'contact_name' => $param[ 'contact_name' ], - 'mobile' => $param[ 'mobile' ], - 'province_id' => $param[ 'province_id' ], - 'city_id' => $param[ 'city_id' ], - 'district_id' => $param[ 'district_id' ], - 'address' => $param[ 'address' ], - 'full_address' => $param[ 'full_address' ], - 'lat' => $param[ 'lat' ], - 'lng' => $param[ 'lng' ], - 'is_delivery_address' => $param[ 'is_delivery_address' ], - 'is_refund_address' => $param[ 'is_refund_address' ], - 'is_default_delivery' => $param[ 'is_delivery_address' ] ? $param[ 'is_default_delivery' ] : 0, - 'is_default_refund' => $param[ 'is_refund_address' ] ? $param[ 'is_default_refund' ] : 0 - ]; - if ($data[ 'is_default_delivery' ]) $this->model->update([ 'is_default_delivery' => 0 ], [ [ 'is_default_delivery', '>', 0 ] ]); - if ($data[ 'is_default_refund' ]) $this->model->update([ 'is_default_refund' => 0 ], [ [ 'is_default_refund', '>', 0 ] ]); - $this->model->where([ [ 'id', '=', $id ] ])->update($data); - return true; - } - - /** - * 删除商家地址库 - * @param int $id - * @return bool - */ - public function del(int $id) - { - $model = $this->model->where([ [ 'id', '=', $id ] ])->find(); - $res = $model->delete(); - return $res; - } - - /** - * 获取默认发货地址 - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function getDefaultDeliveryAddress() - { - $address = $this->model->where([ [ 'is_delivery_address', '=', 1 ], [ 'is_default_delivery', '=', 1 ] ])->findOrEmpty(); - if (!$address->isEmpty()) return $address->toArray(); - } - - public function getList() - { - $field = 'id,contact_name,mobile,province_id,city_id,district_id,address,full_address,lat,lng,is_delivery_address,is_refund_address,is_default_delivery,is_default_refund'; - $list = $this->model->where([['is_refund_address', '=', 1] ])->field($field)->select()->toArray(); - return $list; - } -} diff --git a/niucloud/addon/shop/app/service/admin/shop_delivery/deliver/DeliverService.php b/niucloud/addon/shop/app/service/admin/shop_delivery/deliver/DeliverService.php deleted file mode 100644 index 5049f92cd..000000000 --- a/niucloud/addon/shop/app/service/admin/shop_delivery/deliver/DeliverService.php +++ /dev/null @@ -1,113 +0,0 @@ -model = new Deliver(); - } - - /** - * 获取配送员分页列表 - * @param array $where - * @return array - * @throws DbException - */ - public function getPage(array $where = []) - { - $field = 'deliver_id,deliver_name,deliver_mobile'; - $order = 'deliver_id desc'; - - $search_model = $this->model->where([['deliver_id', '>', 0] ])->withSearch(['deliver_name', 'deliver_mobile'], $where)->field($field)->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取配送员列表 - * @param array $where - * @return array - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function getList(array $where = []) - { - $field = 'deliver_id,deliver_name,deliver_mobile'; - $order = 'deliver_id desc'; - return $this->model->where([['deliver_id', '>', 0]])->withSearch(['deliver_name', 'deliver_mobile'], $where)->field($field)->order($order)->select()->toArray(); - } - - /** - * 获取详情 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'deliver_id,deliver_name,deliver_mobile'; - $info = $this->model->field($field)->where([['deliver_id', '=', $id] ])->findOrEmpty()->toArray(); - return $info; - } - - /** - * 添加 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $data['create_time'] = time(); - $res = $this->model->create($data); - return $res->deliver_id; - } - - /** - * 编辑 - * @param int $id - * @param array $data - * @return bool - */ - public function edit(int $id, array $data) - { - $data['modify_time'] = time(); - $this->model->where([['deliver_id', '=', $id] ])->update($data); - return true; - } - - /** - * 删除 - * @param int $id - * @return bool - */ - public function del(int $id) - { - $res = $this->model->where([['deliver_id', '=', $id] ])->delete(); - return $res; - } - -} diff --git a/niucloud/addon/shop/app/service/admin/shop_delivery/order/ShopDeliveryOrderService.php b/niucloud/addon/shop/app/service/admin/shop_delivery/order/ShopDeliveryOrderService.php deleted file mode 100644 index 1797e2d83..000000000 --- a/niucloud/addon/shop/app/service/admin/shop_delivery/order/ShopDeliveryOrderService.php +++ /dev/null @@ -1,97 +0,0 @@ -model = new ShopDeliveryOrder(); - } - - /** - * 查询商家配送订单列表 - * @param array $where - * @return array - * @throws DbException - */ - public function getPage(array $where) - { - $field = 'id, delivery_no, out_delivery_no, trade_id, trade_no, trade_type, delivery_money, delivery_start, delivery_start_lng, delivery_start_lat, delivery_end, delivery_end_lng, delivery_end_lat, delivery_distance, status, create_time, remark, body'; - $search_model = $this->model->withSearch([ 'delivery_no', 'trade_no', 'status', 'create_time' ], $where)->field($field)->order('create_time desc')->append([ 'delivery_service_name' , 'status_name', 'trade_type_name', 'pre_status_name' ]); - return $this->pageQuery($search_model); - } - - /** - * 查询商家配送订单详情 - * @return array - */ - public function getInfo(int $id) - { - $field = 'id, delivery_no, out_delivery_no, trade_id, trade_no, trade_type, delivery_money, delivery_start, delivery_start_lng, delivery_start_lat, delivery_end, delivery_end_lng, delivery_end_lat, delivery_distance, status, create_time, finish_time, cancel_time, deliver_id, remark, body'; - return $this->model->where([ [ 'id', '=', $id ] ])->field($field)->with([ 'deliver', 'orderLog' ])->append([ 'delivery_service_name' , 'status_name', 'trade_type_name' ])->findOrEmpty()->toArray(); - } - - /** - * 取消订单 - * @param int $id - * @param array $data - * @return bool - */ - public function closeOrder(int $id, array $data) - { - $data['id'] = $id; - $data['main_id'] = $this->uid; - $data['main_type'] = OrderLogDict::STORE; - $data['main_name'] = (new SysUser())->where('uid', $this->uid)->value('username') ?? ''; - return (new CoreShopDeliveryOrderCloseService())->closeOrder($data); - } - - /** - * 完成订单 - * @param int $id - * @return bool - */ - public function finishOrder(int $id) - { - $data['id'] = $id; - $data['main_id'] = $this->uid; - $data['main_type'] = OrderLogDict::STORE; - $data['main_name'] = (new SysUser())->where('uid', $this->uid)->value('username') ?? ''; - return (new CoreShopDeliveryOrderFinishService())->finishOrder($data); - } - - /** - * 获取订单状态列表 - * @return array - */ - public function getOrderStatusList() - { - return ShopDeliveryStatusDict::getStatus(); - } -} diff --git a/niucloud/addon/shop/app/service/api/ConfigService.php b/niucloud/addon/shop/app/service/api/ConfigService.php deleted file mode 100644 index c67dc1d6d..000000000 --- a/niucloud/addon/shop/app/service/api/ConfigService.php +++ /dev/null @@ -1,47 +0,0 @@ -getConfigValue('SHOP_INVOICE'); - if (empty($config)) { - $config = [ - 'is_invoice' => '2', - 'invoice_type' => [], - 'invoice_content' => [] - ]; - } - return $config; - } - - /** - * 获取评价设置 - * @return array|int[]|mixed - */ - public function getEvaluateConfig() - { - return (new CoreOrderConfigService())->getEvaluateConfig(); - } -} diff --git a/niucloud/addon/shop/app/service/api/cart/CartService.php b/niucloud/addon/shop/app/service/api/cart/CartService.php deleted file mode 100644 index d14734142..000000000 --- a/niucloud/addon/shop/app/service/api/cart/CartService.php +++ /dev/null @@ -1,388 +0,0 @@ -model = new Cart(); - } - - /** - * 添加购物车 - * @param $data - * @return mixed - */ - public function add($data) - { - $member_info = ( new CoreMemberService() )->getInfoByMemberId($this->member_id, 'status'); - - if (empty($member_info)) throw new ApiException('SHOP_ORDER_BUYER_NOT_FOUND');//无效的账号 - if ($member_info[ 'status' ] == MemberDict::OFF) throw new ApiException('SHOP_ORDER_BUYER_LOCKED');//账号被锁定 - - $data[ 'member_id' ] = $this->member_id; - $info = $this->model->where([ - [ 'member_id', '=', $data[ 'member_id' ] ], - [ 'goods_id', '=', $data[ 'goods_id' ] ], - [ 'sku_id', '=', $data[ 'sku_id' ] ], - ])->field('id,num')->findOrEmpty()->toArray(); - -// $other_sku_num = $this->model->where([ -// [ 'member_id', '=', $this->member_id ], -// [ 'goods_id', '=', $data[ 'goods_id' ] ], -// [ 'sku_id', '<>', $data[ 'sku_id' ] ] -// ])->sum('num'); - - $goods_info = ( new Goods() )->where([ - [ 'goods_id', '=', $data[ 'goods_id' ] ], - ])->field('goods_id,goods_name,stock,is_limit,limit_type,max_buy,min_buy')->findOrEmpty()->toArray(); - if (empty($goods_info)) throw new ApiException("SHOP_GOODS_NOT_EXIST"); - // 商品加入购物车统计 - CoreGoodsStatService::addStat([ 'goods_id' => $data[ 'goods_id' ], 'cart_num' => $data[ 'num' ] ]); - ( new CoreGoodsCartNumService() )->inc([ 'goods_id' => $data[ 'goods_id' ], 'cart_num' => $data[ 'num' ] ]); - -// $core_goods_limit_buy_service = new CoreGoodsLimitBuyService(); - if (!empty($info)) { - // 存在,更新数量 - $update = [ - 'num' => $info[ 'num' ] + $data[ 'num' ] - ]; - // 检测限购 -// $goods_info[ 'num' ] = $other_sku_num + $update[ 'num' ]; -// $error = $core_goods_limit_buy_service->checkGoodsLimitBuy($this->member_id, [ $goods_info ]); -// if (!empty($error)) throw new ApiException($error); - $this->model->where([ [ 'id', '=', $info[ 'id' ] ] ])->update($update); - return $info[ 'id' ]; - } else { - // 检测限购 -// $goods_info[ 'num' ] = $other_sku_num + $data[ 'num' ]; -// $error = $core_goods_limit_buy_service->checkGoodsLimitBuy($this->member_id, [ $goods_info ]); -// if (!empty($error)) throw new ApiException($error); - // 添加 - $res = $this->model->create($data); - return $res->id; - } - } - - /** - * 编辑购物车数量 - * @param $data - * @return bool - */ - public function edit($data) - { - $member_info = ( new CoreMemberService() )->getInfoByMemberId($this->member_id, 'status'); - - if (empty($member_info)) throw new ApiException('SHOP_ORDER_BUYER_NOT_FOUND');//无效的账号 - if ($member_info[ 'status' ] == MemberDict::OFF) throw new ApiException('SHOP_ORDER_BUYER_LOCKED');//账号被锁定 - - $data[ 'member_id' ] = $this->member_id; - $info = $this->model->where([ - [ 'id', '=', $data[ 'id' ] ], - [ 'member_id', '=', $data[ 'member_id' ] ], - ])->field('sku_id, goods_id, num')->findOrEmpty()->toArray(); - - if (empty($info)) return false; - - $update = [ - 'num' => $data[ 'num' ] - ]; - - if (!empty($data[ 'sku_id' ]) && $info[ 'sku_id' ] != $data[ 'sku_id' ]) { - $update[ 'sku_id' ] = $data[ 'sku_id' ]; - - $cart_info = $this->model->where([ - [ 'sku_id', '=', $data[ 'sku_id' ] ], - [ 'member_id', '=', $this->member_id ], - ])->field('id')->findOrEmpty()->toArray(); - - if (!empty($cart_info)) { - $this->model->where([ [ 'id', '=', $cart_info[ 'id' ] ] ])->delete(); - } - } - - $goods_info = ( new Goods() )->where([ - [ 'goods_id', '=', $info[ 'goods_id' ] ], - ])->field('goods_id,goods_name,stock,is_limit,limit_type,max_buy,min_buy')->findOrEmpty()->toArray(); - if (empty($goods_info)) throw new ApiException("SHOP_GOODS_NOT_EXIST"); - -// $other_sku_num = $this->model->where([ -// [ 'member_id', '=', $this->member_id ], -// [ 'goods_id', '=', $info[ 'goods_id' ] ], -// [ 'sku_id', '<>', $info[ 'sku_id' ] ] -// ])->sum('num'); - - // 检测限购 -// if ($data[ 'num' ] > $info['num']) { -// $goods_info[ 'num' ] = $other_sku_num + $update[ 'num' ]; -// $error = ( new CoreGoodsLimitBuyService() )->checkGoodsLimitBuy($this->member_id, [ $goods_info ]); -// if (!empty($error)) throw new ApiException($error); -// } - - $this->model->where([ [ 'id', '=', $data[ 'id' ] ] ])->update($update); - - // 商品加入购物车统计 - CoreGoodsStatService::addStat([ 'goods_id' => $info[ 'goods_id' ], 'cart_num' => ( $data[ 'num' ] - $info[ 'num' ] ) ]); - ( new CoreGoodsCartNumService() )->inc([ 'goods_id' => $info[ 'goods_id' ], 'cart_num' => ( $data[ 'num' ] - $info[ 'num' ] ) ]); - - return true; - } - - /** - * 购物车删除,支持批量 - * @param $data - * @return bool - */ - public function del($data) - { - $this->model->where([ [ 'member_id', '=', $this->member_id ],[ 'id', 'in', $data[ 'ids' ] ] ])->delete(); - return true; - } - - /** - * 清空购物车 - * @return bool - */ - public function clear() - { - $this->model->where([ [ 'member_id', '=', $this->member_id ] ])->delete(); - return true; - } - - /** - * 获取购物车列表 - * @param $data - * @return array - */ - public function getList($data) - { - $data[ 'member_id' ] = $this->member_id; - $field = 'id, member_id, goods_id, sku_id, num, status, invalid_remark'; - $order = "create_time desc"; - $list = $this->model->where([ [ 'id', '>', 0 ] ])->withSearch([ "member_id" ], $data)->field($field) - ->with([ - 'goods' => function ($query) { - $query->withField('goods_id, goods_name, goods_cover, unit, stock, status, delete_time, member_discount') - ->append([ 'goods_cover_thumb_mid' ]); - }, - 'goodsSku' => function ($query) { - $query->withField('sku_id,goods_id, sku_name, sku_image, sku_spec_format, price, market_price, sale_price, member_price, stock')->append([ 'sku_image_thumb_mid' ]); - } - ])->order($order)->select()->toArray(); - - array_multisort(array_column($list, 'id'), SORT_ASC, $list); - $goods_active_price_service = ( new CoreGoodsActivePriceService() ); - foreach ($list as $k => &$v) { - if (!empty($v[ 'goodsSku' ])) { - $v[ 'goodsSku' ][ 'member_discount' ] = $v[ 'goods' ][ 'member_discount' ] ?? ''; - //获取展示活动价格 - $show_price_data = $goods_active_price_service->getActivePrice($v[ 'goodsSku' ], $this->member_id); - $v[ 'goodsSku' ][ 'show_price' ] = $show_price_data[ 'show_price' ]; - $v[ 'goodsSku' ][ 'show_type' ] = $show_price_data[ 'show_type' ]; - } - if (!empty($v[ 'goods' ])) { - // 限购查询当前会员已购数量 - $has_buy = ( new CoreGoodsLimitBuyService() )->getGoodsHasBuyNumber($this->member_id, $v[ 'goods' ][ 'goods_id' ]); - $v[ 'goods' ][ 'has_buy' ] = $has_buy; - } - } - array_multisort(array_column($list, 'id'), SORT_DESC, $list); - return $list; - } - - /** - * 获取购物车商品列表 - * @param $data - * @return array - */ - public function getGoodsList($data) - { - $data[ 'member_id' ] = $this->member_id; - $field = 'id, goods_id, sku_id, num, status, invalid_remark'; - $order = "create_time desc"; - $list = $this->model->where([ [ 'id', '>', 0] ])->withSearch([ "member_id" ], $data)->field($field) - ->with([ - 'goods' => function ($query) { - $query->withField('goods_id, goods_name, goods_cover, unit, stock, status, delete_time, label_ids, member_discount') - ->append([ 'goods_label_name', 'goods_cover_thumb_mid' ]); - }, - 'goodsSku' => function ($query) { - $query->withField('sku_id,goods_id, sku_name, sku_image, sku_spec_format, price, market_price, sale_price, member_price, stock')->append([ 'sku_image_thumb_mid' ]); - }, - ])->order($order)->select()->toArray(); - - - array_multisort(array_column($list, 'id'), SORT_ASC, $list); - $goods_active_price_service = ( new CoreGoodsActivePriceService() ); - $gift_goods = []; - foreach ($list as $k => &$v) { - if (!empty($v[ 'goodsSku' ])) { - $v[ 'goodsSku' ][ 'member_discount' ] = $v[ 'goods' ][ 'member_discount' ] ?? ''; - //获取展示活动价格 - $show_price_data = $goods_active_price_service->getActivePrice($v[ 'goodsSku' ], $this->member_id); - $v[ 'goodsSku' ][ 'show_price' ] = $show_price_data[ 'show_price' ]; - $v[ 'goodsSku' ][ 'show_type' ] = $show_price_data[ 'show_type' ]; - } - if (!empty($v[ 'goods' ])) { - // 限购查询当前会员已购数量 - $has_buy = ( new CoreGoodsLimitBuyService() )->getGoodsHasBuyNumber($this->member_id, $v[ 'goods' ][ 'goods_id' ]); - $v[ 'goods' ][ 'has_buy' ] = $has_buy; - } - - $manjian_info = ( new ManjianService() )->getManjianInfo([ 'goods_id' => $v[ 'goods_id' ], 'sku_id' => $v[ 'sku_id' ], 'gift_goods' => $gift_goods ]); - if (!empty($manjian_info[ 'gift_goods' ])) { - $gift_goods = array_merge($gift_goods, $manjian_info[ 'gift_goods' ]); - } - $v[ 'manjian_info' ] = $manjian_info; - } - array_multisort(array_column($list, 'id'), SORT_DESC, $list); - return $list; - } - - /** - * 购物车计算 - * @param $data - * @return array - */ - public function calculate($data) - { - //获取商品信息 - $data = $this->getSelectGoods($data); - //满减 - $data = ( new CoreManjianService() )->manjianPromotion($data, $this->member_id); - $promotion_money = $data[ 'promotion_money' ] ?? 0; - $order_money = max($data[ 'goods_money' ] - $promotion_money, 0); - $data[ 'order_money' ] = $order_money; - - $good_list = $data[ 'goods_list' ]; - $match_list = []; - foreach ($good_list as $k => $v) { - $match_list[ $k ][ 'goods_id' ] = $v[ 'goods_id' ]; - $match_list[ $k ][ 'sku_id' ] = $v[ 'sku_id' ]; - foreach ($v[ 'promotion' ] as $kk => $vv) { -// dd($vv); - switch ($kk) { - case 'manjian': - foreach ($vv as $item){ - if ($item[ 'discount_array' ][ 'level' ] >= 0) { - $match_list[ $k ][$kk][] = [ - 'manjian_id' => $item[ 'manjian_id' ], - 'level' => $item[ 'discount_array' ][ 'level' ] - ]; - } - } - break; - default: - break; - } - } - } - return [ - 'goods_money' => $data[ 'goods_money' ], - 'promotion_money' => $promotion_money, - 'order_money' => $order_money, - 'match_list' => $match_list - ]; - } - - /** - * 获取购物车商品列表信息 - * @param $data - * @return mixed - */ - public function getSelectGoods($data) - { - $member_id = $this->member_id; - - $sku_ids = $data[ 'sku_ids' ] ?? []; - $sku_id_list = array_column($sku_ids, 'sku_id'); - $sku_num_list = array_column($sku_ids, 'num', 'sku_id'); - //组装商品列表 - $field = 'goodsSku.sku_id, goodsSku.sku_name, goodsSku.price, goodsSku.stock, goodsSku.goods_id, cart.id as cart_id,cart.num, goodsSku.member_price, goods.member_discount, goodsSku.sale_price'; - $condition = [ - [ 'goodsSku.sku_id', 'in', $sku_id_list ], - ]; - $goods_list = ( new GoodsSku() ) - ->alias('goodsSku') - ->field($field) - ->where($condition) - ->join('shop_cart cart', 'cart.sku_id = goodsSku.sku_id and cart.member_id = ' . $member_id) - ->join('shop_goods goods', 'goods.goods_id = goodsSku.goods_id') - ->with(['goods']) - ->select() - ->toArray(); - - $data[ 'goods_num' ] = 0; - $data[ 'goods_money' ] = 0; - $data[ 'goods_list' ] = []; - $data[ 'coupon_money' ] = 0; //优惠券金额 - $data[ 'promotion_money' ] = 0; //优惠金额 - $goods_active_price_service = ( new CoreGoodsActivePriceService() ); - if (!empty($goods_list)) { - foreach ($goods_list as $k => $v) { - //获取展示活动价格 - $v['member_discount'] = $v['goods']['member_discount']; - $show_price_data = $goods_active_price_service->getActivePrice($v, $this->member_id); - $v[ 'show_price' ] = $show_price_data[ 'show_price' ]; - $v[ 'show_type' ] = $show_price_data[ 'show_type' ]; - $item_num = $sku_num_list[ $v[ 'sku_id' ] ]; - $price = $v[ 'show_price' ]; - $v[ 'goods_money' ] = $price * $item_num; - $v[ 'real_goods_money' ] = $v[ 'goods_money' ]; - $v[ 'promotion' ] = []; - - $data[ 'goods_num' ] += $item_num; - $data[ 'goods_money' ] += $v[ 'goods_money' ]; - $data[ 'goods_list' ][] = $v; - } - } - return $data; - } - - /** - * 获取购物车数量 - * @param $data - * @return float - */ - public function getSum($data) - { - $condition = [ - [ 'member_id', '=', $this->member_id ], - ]; - if (!empty($data[ 'goods_id' ])) { - $condition[] = [ 'goods_id', '=', $data[ 'goods_id' ] ]; - } - return $this->model->where($condition)->sum('num'); - } - -} diff --git a/niucloud/addon/shop/app/service/api/delivery/OrderService.php b/niucloud/addon/shop/app/service/api/delivery/OrderService.php deleted file mode 100644 index aea04bc59..000000000 --- a/niucloud/addon/shop/app/service/api/delivery/OrderService.php +++ /dev/null @@ -1,39 +0,0 @@ -member_id; - return (new CoreLocalDeliveryOrderService())->getTrackInfo($data); - } -} diff --git a/niucloud/addon/shop/app/service/api/goods/AttrService.php b/niucloud/addon/shop/app/service/api/goods/AttrService.php deleted file mode 100644 index 9f76f0cb3..000000000 --- a/niucloud/addon/shop/app/service/api/goods/AttrService.php +++ /dev/null @@ -1,59 +0,0 @@ -model = new Attr(); - } - - /** - * 获取商品参数列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'attr_id,attr_name,sort'; - $order = ''; - - $search_model = $this->model->where([ [ 'attr_id', ">", 0 ] ])->withSearch([ "attr_id", "attr_name", "attr_value_format", "sort" ], $where)->field($field)->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取商品参数信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'attr_id,attr_name,attr_value_format,sort'; - - $info = $this->model->field($field)->where([ [ 'attr_id', "=", $id ] ])->findOrEmpty()->toArray(); - return $info; - } - -} diff --git a/niucloud/addon/shop/app/service/api/goods/ConfigService.php b/niucloud/addon/shop/app/service/api/goods/ConfigService.php deleted file mode 100644 index 476ed677f..000000000 --- a/niucloud/addon/shop/app/service/api/goods/ConfigService.php +++ /dev/null @@ -1,41 +0,0 @@ -core__goods_config_service = new CoreGoodsConfigService(); - } - - /** - * 获取商品搜索配置 - * @return array - */ - public function getSearchConfig() - { - return $this->core__goods_config_service->getSearchConfig(); - } - -} diff --git a/niucloud/addon/shop/app/service/api/goods/EvaluateService.php b/niucloud/addon/shop/app/service/api/goods/EvaluateService.php deleted file mode 100644 index 1385bcc10..000000000 --- a/niucloud/addon/shop/app/service/api/goods/EvaluateService.php +++ /dev/null @@ -1,134 +0,0 @@ -model = new Evaluate(); - } - - /** - * 获取商品评价列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'evaluate_id,order_id,order_goods_id,goods_id,member_id,member_name,member_head,content,images,is_anonymous,scores,is_audit,explain_first,create_time,topping,update_time'; - $order = 'topping desc,update_time desc,create_time desc'; - $search_model = $this->model->where([ [ 'is_audit', 'in', [ EvaluateDict::AUDIT_NO, EvaluateDict::AUDIT_ADOPT ] ] ])->withSearch([ "goods_id", "scores" ], $where)->field($field)->order($order)->append([ 'image_mid' ]); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取商品评价信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - $field = 'evaluate_id,order_id,order_goods_id,goods_id,member_id,member_name,member_head,content,images,is_anonymous,scores,is_audit,explain_first,create_time'; - $info = $this->model->field($field)->where([ [ 'evaluate_id', '=', $id ] ])->append([ 'image_mid', 'image_big' ])->findOrEmpty()->toArray(); - return $info; - } - - /** - * 添加商品评价 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - - $member_info = ( new Member() )->where([ [ 'member_id', '=', $this->member_id ] ])->field('nickname, headimg')->findOrEmpty()->toArray(); - if (empty($member_info)) throw new CommonException(); - - $config = ( new CoreOrderConfigService() )->getEvaluateConfig(); - - foreach ($data[ 'evaluate_array' ] as $key => $val) { - $params = $val; - $params[ 'member_id' ] = $this->member_id; - $params[ 'member_name' ] = $member_info[ 'nickname' ]; - $params[ 'member_head' ] = $member_info[ 'headimg' ]; - $params[ 'is_audit' ] = $config[ 'evaluate_is_to_examine' ] == 1 ? 1 : 0; - ( new CoreGoodsEvaluateService )->addEvaluate($params); - } - - return true; - } - - /** - * 获取商品评价统计 - * @param $goods_id - * @return mixed - * @throws \think\db\exception\DbException - */ - public function getCount($goods_id) - { - $data[ 'good_evaluate' ] = $this->model->where([ [ 'goods_id', '=', $goods_id ], [ 'scores', 'in', [ 4, 5 ] ], [ 'is_audit', 'in', [ EvaluateDict::AUDIT_NO, EvaluateDict::AUDIT_ADOPT ] ] ])->count(); - $data[ 'centre_evaluate' ] = $this->model->where([ [ 'goods_id', '=', $goods_id ], [ 'scores', 'in', [ 2, 3 ] ], [ 'is_audit', 'in', [ EvaluateDict::AUDIT_NO, EvaluateDict::AUDIT_ADOPT ] ] ])->count(); - $data[ 'wanting_centre_evaluate' ] = $this->model->where([ [ 'goods_id', '=', $goods_id ], [ 'scores', 'in', [ 1 ] ], [ 'is_audit', 'in', [ EvaluateDict::AUDIT_NO, EvaluateDict::AUDIT_ADOPT ] ] ])->count(); - return $data; - } - - /** - * 详情页展示评价 - * @param $goods_id - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function getList($goods_id) - { - $data = []; - $field = 'evaluate_id,order_id,order_goods_id,goods_id,member_id,member_name,member_head,content,images,is_anonymous,scores,is_audit,explain_first,create_time,topping,update_time'; - $order = 'topping desc,update_time desc,create_time desc'; - $data[ 'list' ] = $this->model->field($field)->where([ [ 'goods_id', '=', $goods_id ], [ 'is_audit', 'in', [ EvaluateDict::AUDIT_NO, EvaluateDict::AUDIT_ADOPT ] ] ])->limit(3)->order($order)->append([ 'image_mid' ])->select()->toArray(); - $data[ 'count' ] = $this->model->where([ [ 'goods_id', '=', $goods_id ], [ 'is_audit', 'in', [ EvaluateDict::AUDIT_NO, EvaluateDict::AUDIT_ADOPT ] ] ])->count(); - - return $data; - } - - /** - * 获取评价详情 - * @param $order_id - */ - public function getDetail($order_id) - { - $field = 'evaluate_id,order_id,order_goods_id,goods_id,member_id,member_name,member_head,content,images,is_anonymous,scores,is_audit,explain_first,create_time'; - $list = $this->model->field($field)->where([ [ 'order_id', '=', $order_id ] ])->with([ - 'order_goods' => function ($query) { - $query->field('order_goods_id, goods_name, sku_name, goods_image, num, price')->append([ 'goods_image_thumb_mid' ]); - } - ])->append([ 'image_mid', 'image_big' ])->select()->toArray(); - return $list; - } -} diff --git a/niucloud/addon/shop/app/service/api/goods/GoodsBrowseService.php b/niucloud/addon/shop/app/service/api/goods/GoodsBrowseService.php deleted file mode 100644 index c5e59d41e..000000000 --- a/niucloud/addon/shop/app/service/api/goods/GoodsBrowseService.php +++ /dev/null @@ -1,102 +0,0 @@ -model = new Browse(); - } - - /** - * 查询足迹 - * @param $data - * @return array - * @throws \think\db\exception\DbException - */ - public function getMemberGoodsBrowse($data) - { - $field = 'member_id,browse_time,goods_id,sku_id'; - $start_time = isset($data[ 'date' ][ 0 ]) ? strtotime($data[ 'date' ][ 0 ]) : 0; - $end_time = isset($data[ 'date' ][ 1 ]) ? strtotime($data[ 'date' ][ 1 ]) : time(); - - $search_model = $this->model->field($field)->where([ [ 'member_id', '=', $this->member_id ], [ 'goods.delete_time', '=', 0 ] ]) - ->whereBetweenTime('browse_time', $start_time, $end_time) - ->withJoin([ 'goods' => [ 'goods_id', 'goods_name', 'goods_cover', 'sale_num', 'virtual_sale_num', 'status', 'member_discount' ] ]) - ->with([ 'goodsSku' ]) - ->order('browse_time desc'); - $list = $this->pageQuery($search_model); - if (!empty($list[ 'data' ])) { - $goods_active_price_service = (new CoreGoodsActivePriceService()); - foreach ($list[ 'data' ] as &$v) { - $v[ 'member_discount' ] = $v[ 'goods' ][ 'member_discount' ] ?? ''; - //获取展示活动价格 - $show_price_data = $goods_active_price_service->getActivePrice($v, $this->member_id); - $v[ 'show_price' ] = $show_price_data[ 'show_price' ]; - $v[ 'show_type' ] = $show_price_data[ 'show_type' ]; - $v[ 'browse_time_str' ] = strtotime($v[ 'browse_time' ]); - } - } - - return $list; - } - - /** - * 添加足迹 - */ - public function addGoodsBrowse($data) - { - $goods_info = ( new Goods() )->where([ [ 'goods_id', '=', $data[ 'goods_id' ] ], [ 'delete_time', '=', 0 ] ])->field('goods_id')->findOrEmpty()->toArray(); - if (empty($goods_info)) throw new CommonException('SHOP_GOODS_NOT_EXIST');//商品不存在 - $sku_id = ( new GoodsSku() )->where([ [ 'goods_id', '=', $data[ 'goods_id' ] ], [ 'is_default', '=', 1 ] ])->value('sku_id'); - $data = array_merge($data, $goods_info); - $data[ 'member_id' ] = $this->member_id; - $data[ 'browse_time' ] = time(); - $data[ 'sku_id' ] = $sku_id; - $info = $this->model->where([ - [ 'member_id', '=', $data[ 'member_id' ] ], - [ 'goods_id', '=', $data[ 'goods_id' ] ], - ])->findOrEmpty(); - if ($info->isEmpty()) { - $this->model->create($data); - CoreGoodsStatService::addStat([ 'goods_id' => $data[ 'goods_id' ], 'goods_visit_member_count' => 1 ]); - } else { - $info->save([ - 'browse_time' => $data[ 'browse_time' ] - ]); - } - return true; - } - - /** - * 删除足迹 - */ - public function deleteGoodsBrowse($data) - { - $this->model->where([ [ 'goods_id', 'in', $data[ 'goods_ids' ] ], [ 'member_id', '=', $this->member_id ] ])->delete(); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/api/goods/GoodsCategoryService.php b/niucloud/addon/shop/app/service/api/goods/GoodsCategoryService.php deleted file mode 100644 index 201284430..000000000 --- a/niucloud/addon/shop/app/service/api/goods/GoodsCategoryService.php +++ /dev/null @@ -1,61 +0,0 @@ -model = new Category(); - } - - /** - * 查询商品分类树结构 - * @param string $field - * @param string $order - * @return array - */ - public function getTree() - { - return ( new CoreGoodsCategoryService() )->getTree([ [ 'is_show', '=', 1 ] ], 'category_id,category_name,image,level,pid,category_full_name'); - } - - /** - * 获取商品分类配置 - * @return array - */ - public function getGoodsCategoryConfig() - { - return ( new CoreGoodsCategoryService() )->getGoodsCategoryConfig(); - } - - /** - * 获取商品分类列表 - * @param array $where - * @param string $field - * @return array - */ - public function getList(array $where = [], $field = 'category_id,category_name,image,level,pid,category_full_name') - { - $order = 'sort desc,create_time desc'; - return $this->model->where([ [ 'is_show', '=', 1 ] ])->withSearch([ "category_name", 'level', 'category_id', 'pid' ], $where)->field($field)->order($order)->select()->toArray(); - } - -} diff --git a/niucloud/addon/shop/app/service/api/goods/GoodsCollectService.php b/niucloud/addon/shop/app/service/api/goods/GoodsCollectService.php deleted file mode 100644 index b72ece9cd..000000000 --- a/niucloud/addon/shop/app/service/api/goods/GoodsCollectService.php +++ /dev/null @@ -1,116 +0,0 @@ -model = new GoodsCollect(); - } - - /** - * 商品收藏列表 - */ - public function getMemberGoodsCollectList() - { - $search_model = $this->model->where([ [ 'member_id', '=', $this->member_id ],['goods.delete_time','=',0] ]) - ->withJoin(['goods'=> [ 'goods_id', 'goods_name', 'goods_cover', 'status', 'member_discount']]) - ->with(['goodsSku' ]) - ->append([ 'goods_cover_thumb_mid' ]) - ->order('create_time desc'); - $list = $this->pageQuery($search_model); - - if (!empty($list['data'])){ - $goods_active_price_service = (new CoreGoodsActivePriceService()); - foreach ($list['data'] as &$v){ - $v[ 'member_discount' ] = $v[ 'goods' ][ 'member_discount' ] ?? ''; - //获取展示活动价格 - $show_price_data = $goods_active_price_service->getActivePrice($v, $this->member_id); - $v[ 'show_price' ] = $show_price_data[ 'show_price' ]; - $v[ 'show_type' ] = $show_price_data[ 'show_type' ]; - } - } - return $list; - } - - /** - * 商品添加收藏 - */ - public function addGoodsCollect($data) - { - $data[ 'member_id' ] = $this->member_id; - $info = $this->model->where([ - [ 'member_id', '=', $data[ 'member_id' ] ], - [ 'goods_id', '=', $data[ 'goods_id' ] ], - ])->findOrEmpty()->toArray(); - - $goods_info = ( new Goods() )->where([ - [ 'goods_id', '=', $data[ 'goods_id' ] ], - ])->findOrEmpty()->toArray(); - if (empty($goods_info)) throw new ApiException("SHOP_GOODS_NOT_EXIST"); - - if (!empty($info)) { - throw new CommonException('MEMBER_ALREADY_COLLECT');//已收藏 - } else { - // 添加 - $data[ 'create_time' ] = time(); - $res = $this->model->create($data); - - // 商品收藏统计 - CoreGoodsStatService::addStat([ 'goods_id' => $data[ 'goods_id' ], 'collect_num' => 1 ]); - ( new CoreGoodsCollectNumService() )->inc([ 'goods_id' => $data[ 'goods_id' ], 'collect_num' => 1 ]); - return $res->id; - } - } - - /** - * 商品取消收藏 - */ - public function cancelGoodsCollect($data) - { - $res = $this->model->where([ [ 'goods_id', 'in', $data[ 'goods_ids' ] ], [ 'member_id', '=', $this->member_id ] ])->delete(); - // 商品收藏统计 - foreach ($data[ 'goods_ids' ] as $value) { - $goods_info = ( new Goods() )->where([ - [ 'goods_id', '=', $value ] - ])->findOrEmpty()->toArray(); - if (empty($goods_info)) continue; - - $stat_data = [ - 'date' => date('Y-m-d', time()), - 'date_time' => strtotime(date('Y-m-d', time())), - 'goods_id' => $value, - ]; - $collect_num = ( new Stat() )->where($stat_data)->value('collect_num'); - if ($collect_num > 0) { - CoreGoodsStatService::addStat([ 'goods_id' => $value, 'collect_num' => -1 ]); - } - ( new CoreGoodsCollectNumService() )->inc([ 'goods_id' => $value, 'collect_num' => -1 ]); - } - return $res; - } -} diff --git a/niucloud/addon/shop/app/service/api/goods/GoodsService.php b/niucloud/addon/shop/app/service/api/goods/GoodsService.php deleted file mode 100644 index ad992d68a..000000000 --- a/niucloud/addon/shop/app/service/api/goods/GoodsService.php +++ /dev/null @@ -1,640 +0,0 @@ -model = new Goods(); - } - - /** - * 获取商品列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'goods_id,goods_name,sub_title,goods_type,goods_cover,unit,sale_num + goods.virtual_sale_num as sale_num,is_limit,limit_type,max_buy,min_buy,member_discount,virtual_receive_type,label_ids,brand_id,stock'; - - $sku_where = [ - [ 'goodsSku.is_default', '=', 1 ], - [ 'goods.is_gift', '=', GoodsDict::NOT_IS_GIFT ], - [ 'status', '=', 1 ] - ]; - - if (!empty($where[ 'keyword' ])) { - $sku_where[] = [ 'goods_name|sub_title', 'like', '%' . $where[ 'keyword' ] . '%' ]; - } - - if (!empty($where[ 'start_price' ]) && !empty($where[ 'end_price' ])) { - $money = [ $where[ 'start_price' ], $where[ 'end_price' ] ]; - sort($money); - $sku_where[] = [ 'goodsSku.price', 'between', $money ]; - } else if (!empty($where[ 'start_price' ])) { - $sku_where[] = [ 'goodsSku.price', '>=', $where[ 'start_price' ] ]; - } else if (!empty($where[ 'end_price' ])) { - $sku_where[] = [ 'goodsSku.price', '<=', $where[ 'end_price' ] ]; - } - - // 查询优惠券包括的id - if (!empty($where[ 'coupon_id' ])) { - $coupon_goods_model = new CouponGoods(); - $coupon_list = $coupon_goods_model->where([ - [ 'coupon_id', '=', $where[ 'coupon_id' ] ] - ])->field('goods_id,category_id')->select()->toArray(); - if (!empty($coupon_list)) { - $goods_ids = array_values(array_filter(array_column($coupon_list, 'goods_id'))); - $category_ids = array_values(array_filter(array_column($coupon_list, 'category_id'))); - if (!empty($goods_ids)) { - $sku_where[] = [ 'goods.goods_id', 'in', $goods_ids ]; - } elseif (!empty($category_ids)) { - $like_arr = []; - foreach ($category_ids as $k => $v) { - $like_arr[] = "%" . $v . "%"; - } - $sku_where[] = [ 'goods_category', "like", $like_arr, 'or' ]; - } - } - } - - // 参数过滤 - if (!empty($where[ 'order' ]) && in_array($where[ 'order' ], [ 'sale_num', 'price' ])) { - $order = $where[ 'order' ] . ' ' . $where[ 'sort' ]; - } else { - $sort_config = ( new CoreGoodsConfigService() )->getSortConfig(); - if ($sort_config[ 'sort_column' ] == 'sale_price') { - $sort_config[ 'sort_column' ] = 'goodsSku.sale_price'; - } - $order = $sort_config[ 'sort_column' ] . ' ' . $sort_config[ 'sort_type' ]; - } - - $search_model = $this->model - ->withSearch([ "brand_id", "goods_category", "label_ids", 'service_ids' ], $where) - ->field($field) - ->withJoin([ - 'goodsSku' => [ 'sku_id', 'sku_name', 'sku_image', 'sku_no', 'goods_id', 'sku_spec_format', 'price', 'market_price', 'sale_price', 'stock', 'weight', 'volume', 'member_price' ] - ]) - ->where($sku_where)->order($order)->append([ 'goods_cover_thumb_small','goods_cover_thumb_mid', 'goods_label_name', 'goods_brand' ]); - $list = $this->pageQuery($search_model); - $goods_active_price_service = ( new CoreGoodsActivePriceService() ); - foreach ($list[ 'data' ] as $k => &$v) { - if (!empty($v[ 'goodsSku' ])) { - $v[ 'goodsSku' ][ 'member_discount' ] = $v[ 'member_discount' ]; - $list_show_price = $goods_active_price_service->getShowPrice($v[ 'goodsSku' ], $this->member_id); - $v[ 'goodsSku' ][ 'show_price' ] = $list_show_price[ 'show_price' ]; - $v[ 'goodsSku' ][ 'show_type' ] = $list_show_price[ 'show_type' ]; - } - // 限购查询当前会员已购数量 - $has_buy = ( new CoreGoodsLimitBuyService() )->getGoodsHasBuyNumber($this->member_id, $v[ 'goods_id' ]); - $v[ 'has_buy' ] = $has_buy; - } - return $list; - } - - /** - * 常规调用获取商品列表 - * @param array $where - * @return array - */ - public function getGoodsList(array $where = []) - { - $field = 'goods_id,goods_name,sub_title,goods_category,goods_type,goods_cover,unit,status,sale_num + goods.virtual_sale_num as sale_num,member_discount,is_discount'; - - $sku_where = [ - [ 'goodsSku.is_default', '=', 1 ], - [ 'goods.is_gift', '=', GoodsDict::NOT_IS_GIFT ], - [ 'status', '=', 1 ] - ]; - - if (!empty($where[ 'goods_ids' ])) { - $sku_where[] = [ 'goods.goods_id', 'in', $where[ 'goods_ids' ] ]; - } - - // 参数过滤 - if (!empty($where[ 'order' ]) && in_array($where[ 'order' ], [ 'sale_num', 'price' ])) { - $order = $where[ 'order' ] . ' desc'; - } else { - $order = 'sort desc,create_time desc'; - } - - $list = $this->model - ->withSearch([ 'goods_category', 'label_ids', 'service_ids' ], $where) - ->field($field) - ->withJoin([ 'goodsSku' ]) - ->where($sku_where)->order($order)->append([ 'goods_type_name', 'goods_cover_thumb_small', 'goods_cover_thumb_mid' ]) - ->select()->toArray(); - - if (!empty($list)){ - $goods_active_price_service = (new CoreGoodsActivePriceService()); - foreach ($list as $k => &$v) { - if (!empty($v[ 'goodsSku' ])) { - $v[ 'goodsSku' ][ 'member_discount' ] = $v[ 'member_discount' ]; - $list_show_price = $goods_active_price_service->getShowPrice($v[ 'goodsSku' ], $this->member_id); - $v[ 'goodsSku' ][ 'show_price' ] = $list_show_price[ 'show_price' ]; - $v[ 'goodsSku' ][ 'show_type' ] = $list_show_price[ 'show_type' ]; - } - } - } - - return $list; - } - - /** - * 获取商品详情 - * @param array $data - * @return array - */ - public function getDetail(array $data) - { - $sku_id = $data[ 'sku_id' ]; - $goods_id = $data[ 'goods_id' ]; - if (!empty($goods_id)) { - $goods_info = ( new Goods() )->where([ [ 'goods_id', '=', $goods_id ], [ 'delete_time', '=', 0 ] ])->count(); - if (empty($goods_info)) throw new CommonException('SHOP_GOODS_NOT_EXIST');//商品不存在 - } - - $goods_sku_model = new GoodsSku(); - - if (empty($sku_id) && !empty($goods_id)) { - // 查询默认规格项 - $default_sku_info = $goods_sku_model->where([ [ 'goods_id', '=', $goods_id ], [ 'is_default', '=', 1 ] ], 'sku_id') - ->field('sku_id')->findOrEmpty()->toArray(); - if (!empty($default_sku_info)) { - $sku_id = $default_sku_info[ 'sku_id' ]; - } - } - - $field = 'sku_id, sku_name, sku_image, sku_no, goods_id, sku_spec_format, price, market_price, sale_price, stock, weight, volume, sale_num, is_default,member_price'; - - $info = $goods_sku_model->where([ [ 'sku_id', '=', $sku_id ] ]) - ->field($field) - ->with([ - 'goods' => function ($query) { - $query->withField('goods_id, goods_image_width,goods_image_height, goods_name,goods_type, sub_title, goods_cover, goods_category, goods_image,goods_video,goods_desc,brand_id,label_ids,service_ids, unit, stock, sale_num + virtual_sale_num as sale_num, is_limit,limit_type,max_buy,min_buy,status,delivery_type,attr_ids,attr_format,member_discount,is_discount,poster_id,virtual_receive_type,is_gift,form_id,diy_detail_id') - ->append([ 'goods_type_name', 'goods_cover_thumb_mid', 'delivery_type_list', 'goods_image_thumb_small', 'goods_image_thumb_mid', 'goods_image_thumb_big', 'goods_brand' ]); - }, - // 商品规格列表 - 'skuList' => function ($query) { - $query->field('sku_id, sku_name, sku_image, sku_no, goods_id, sku_spec_format, price, market_price, sale_price, stock, weight, volume, is_default,member_price'); - }, - // 商品规格项/规格值列表 - 'goodsSpec' => function ($query) { - $query->field('spec_id, goods_id, spec_name, spec_values'); - }, - ]) - ->append([ 'sku_image_thumb_small', 'sku_image_thumb_mid', 'sku_image_thumb_big' ]) - ->findOrEmpty()->toArray(); - if (!empty($info) && !empty($info[ 'goods' ])) { - $info[ 'type' ] = $data[ 'type' ] ?? ''; - - $goods_active_price_service = ( new CoreGoodsActivePriceService() ); - //获取展示信息(价格 标签) - $info[ 'member_discount' ] = $info[ 'goods' ][ 'member_discount' ] ?? ''; - $detail_show_price = $goods_active_price_service->getShowPrice($info, $this->member_id); - $info[ 'show_price' ] = $detail_show_price[ 'show_price' ]; - $info[ 'show_type' ] = $detail_show_price[ 'show_type' ]; - //组装数据 - if (!empty($info[ 'skuList' ])) { - foreach ($info[ 'skuList' ] as &$value) { - $value[ 'type' ] = $data[ 'type' ] ?? ''; - $value[ 'member_discount' ] = $info[ 'goods' ][ 'member_discount' ] ?? ''; - $list_show_price = $goods_active_price_service->getShowPrice($value, $this->member_id); - $value[ 'show_price' ] = $list_show_price[ 'show_price' ]; - $value[ 'show_type' ] = $list_show_price[ 'show_type' ]; - } - } - - if (!empty($info[ 'goods' ][ 'service_ids' ])) { - // 商品服务 - $info[ 'service' ] = $this->getGoodsService($info[ 'goods' ][ 'service_ids' ]); - } - if (!empty($info[ 'goods' ][ 'label_ids' ])) { - // 商品标签 - $info[ 'label_info' ] = $this->getGoodsLabel($info[ 'goods' ][ 'label_ids' ]); - } -// if ($info[ 'show_type' ] == GoodsDict::DISCOUNT_PRICE) { - // 参与限时折扣,查询活动信息 - if ($info[ 'goods' ][ 'is_discount' ] == 1) { - $discount_service = new DiscountService(); - $info[ 'discount_info' ] = $discount_service->getInfoByGoods($info[ 'goods_id' ]); - if (!empty($info[ 'discount_info' ])) { - $info[ 'discount_info' ][ 'active' ][ 'start_time' ] = strtotime($info[ 'discount_info' ][ 'active' ][ 'start_time' ]); - $info[ 'discount_info' ][ 'active' ][ 'end_time' ] = strtotime($info[ 'discount_info' ][ 'active' ][ 'end_time' ]); - $info[ 'type' ] = ActiveDict::DISCOUNT; - } - } else { - $info[ 'type' ] = ''; - $info[ 'type_name' ] = ''; - } -// } - - //新人价 - if (!empty($data[ 'type' ]) && $data[ 'type' ] == ActiveDict::NEWCOMER_DISCOUNT) { - // 查询新人价 - $newcomer_service = new NewcomerService(); - if ($newcomer_service->checkIfNewcomer()) { - $newcomer_info = $newcomer_service->getNewcomerInfo($info[ 'goods_id' ], $info[ 'sku_id' ]); - if (!empty($newcomer_info)) { - $info[ 'newcomer_price' ] = $newcomer_info[ 'newcomer_price' ]; - $info[ 'newcomer_desc' ] = $newcomer_info[ 'newcomer_desc' ]; - $info[ 'is_newcomer' ] = 1; - $info[ 'type' ] = ActiveDict::NEWCOMER_DISCOUNT; - } - $newcomer_service->getNewcomerPriceByList($info[ 'skuList' ]); - } else { - $info[ 'is_newcomer' ] = 0; - $info[ 'type' ] = ''; - $info[ 'type_name' ] = ''; - } - } - - if (!empty($this->member_id)) { - $info[ 'goods' ][ 'is_collect' ] = $this->getGoodsIsCollect($info[ 'goods_id' ]); - // 限购查询当前会员已购数量 - $has_buy = ( new CoreGoodsLimitBuyService() )->getGoodsHasBuyNumber($this->member_id, $info[ 'goods' ][ 'goods_id' ]); - $info[ 'goods' ][ 'has_buy' ] = $has_buy; - } else { - $info[ 'goods' ][ 'has_buy' ] = 0; - $info[ 'goods' ][ 'is_collect' ] = 0; - } - - $info[ 'type_name' ] = ''; - if (!empty($info[ 'type' ])) { - $info[ 'type_name' ] = ActiveDict::getClass($info[ 'type' ]); // 查询来源活动类型 - } - - //查询评价设置是否显示 - $core_order_config_service = new CoreOrderConfigService(); - $evaluate_config = $core_order_config_service->getEvaluateConfig(); - $info[ 'evaluate_is_show' ] = $evaluate_config[ 'evaluate_is_show' ]; - - // 商品统计-浏览次数 - CoreGoodsStatService::addStat([ 'goods_id' => $info[ 'goods' ][ 'goods_id' ], 'access_num' => 1 ]); - ( new CoreGoodsAccessNumService() )->inc([ 'goods_id' => $info[ 'goods' ][ 'goods_id' ], 'access_num' => 1 ]); - - // 种草秀数据查询 - $info[ 'sow_show_list' ] = event('SowShowData', [ 'relate_id' => $info[ 'goods_id' ], 'relate_type' => 'shop', 'limit' => 3 ])[ 0 ] ?? []; - - //自定义详情模版 - $info[ 'diy_detail_info' ] = ( new DiyService() )->getInfo([ 'id' => $info[ 'goods' ][ 'diy_detail_id' ], 'name' => 'DIY_SHOP_GOODS_DETAIL' ]); - - //获取商品主图第一张图片宽高 - $first_goods_image = explode(',',$info['goods']['goods_image'])[0] ?? ''; - $info['goods']['image_size'] = ['width' => $info['goods']['goods_image_width'] ?? 800, 'height' => $info['goods']['goods_image_height'] ?? 800]; - } - - return $info; - } - - public function getGoodsService($service_ids) : array - { - $service = ( new Service() ) - ->where([ - [ 'service_id', 'in', $service_ids ] - ]) - ->field('service_id, service_name, image, desc') - ->select() - ->toArray(); - return $service; - } - - - public function getGoodsLabel($label_ids) : array - { - $goods_label_model = new Label(); - $label_info = $goods_label_model - ->where([ - [ 'label_id', 'in', $label_ids ], - [ 'status', '=', 1 ] - ]) - ->field('label_id, label_name, memo,style_type,color_json,icon') - ->order('sort desc,label_id desc') - ->select() - ->toArray(); - return $label_info; - } - - public function getGoodsIsCollect($goods_id) : int - { - $goods_collect_model = new GoodsCollect(); - $collect_info = $goods_collect_model - ->where([ [ 'member_id', '=', $this->member_id ], [ 'goods_id', '=', $goods_id ] ]) - ->findOrEmpty() - ->toArray(); - if (!empty($collect_info)) { - return 1; - } else { - return 0; - } - } - - /** - * 获取商品规格信息,切换规格 - * @param int $sku_id - * @return array - */ - public function getSku(int $sku_id) - { - $field = 'sku_id, sku_name, sku_image, goods_id, sku_spec_format, price, market_price, sale_price, stock, member_price'; - - $goods_sku_model = new GoodsSku(); - - $info = $goods_sku_model->where([ [ 'sku_id', '=', $sku_id ] ]) - ->field($field) - ->with([ - // 商品主表 - 'goodsSingle' => function ($query) { - $query->withField('goods_id, goods_name, goods_cover, unit, member_discount,is_discount') - ->append([ 'goods_cover_thumb_mid' ]); - }, - // 商品规格列表 - 'skuList' => function ($query) { - $query->field('sku_id, sku_name, sku_image, goods_id, sku_spec_format, price, market_price, sale_price, stock,member_price') - ->append([ 'sku_image_thumb_mid' ]); - }, - // 商品规格项/规格值列表 - 'goodsSpec' => function ($query) { - $query->field('spec_id, goods_id, spec_name, spec_values'); - }, - ]) - ->append([ 'sku_image_thumb_mid' ]) - ->findOrEmpty()->toArray(); - - - if (!empty($info)) { - $info[ 'goods' ] = $info[ 'goodsSingle' ]; - unset($info[ 'goodsSingle' ]); - if (!empty($this->member_id)) { - // 限购查询当前会员已购数量 - $has_buy = ( new CoreGoodsLimitBuyService() )->getGoodsHasBuyNumber($this->member_id, $info[ 'goods_id' ]); - $info[ 'has_buy' ] = $has_buy; - } - $goods_active_price_service = new CoreGoodsActivePriceService(); - //获取展示信息(价格 标签) - $info[ 'member_discount' ] = $info[ 'goods' ][ 'member_discount' ] ?? ''; - $detail_show_price = $goods_active_price_service->getShowPrice($info, $this->member_id); - $info[ 'show_price' ] = $detail_show_price[ 'show_price' ]; - $info[ 'show_type' ] = $detail_show_price[ 'show_type' ]; - //组装数据 - if (!empty($info[ 'skuList' ])) { - foreach ($info[ 'skuList' ] as &$value) { - $value[ 'member_discount' ] = $info[ 'goods' ][ 'member_discount' ] ?? ''; - $list_show_price = $goods_active_price_service->getShowPrice($value, $this->member_id); - $value[ 'show_price' ] = $list_show_price[ 'show_price' ]; - $value[ 'show_type' ] = $list_show_price[ 'show_type' ]; - } - } - } - - return $info; - } - - /** - * 获取商品列表供组件调用 - * @param array $where - * @return array - */ - public function getGoodsComponents(array $where = []) - { - $field = 'goods_id,goods_name,sub_title,goods_type,goods_cover,unit,sale_num + goods.virtual_sale_num as sale_num,member_discount,label_ids,brand_id,is_limit,limit_type,max_buy,min_buy,virtual_receive_type'; - - $sku_where = [ - [ 'goodsSku.is_default', '=', 1 ], - [ 'goods.is_gift', '=', GoodsDict::NOT_IS_GIFT ], - [ 'status', '=', 1 ] - ]; - - if (!empty($where[ 'goods_ids' ])) { - $sku_where[] = [ 'goods.goods_id', 'in', $where[ 'goods_ids' ] ]; - } - - // 参数过滤 - if (!empty($where[ 'order' ]) && in_array($where[ 'order' ], [ 'sale_num', 'price' ])) { - $order = $where[ 'order' ] . ' desc'; - } else { - $sort_config = ( new CoreGoodsConfigService() )->getSortConfig(); - if ($sort_config[ 'sort_column' ] == 'sale_price') { - $sort_config[ 'sort_column' ] = 'goodsSku.sale_price'; - } - $order = $sort_config[ 'sort_column' ] . ' ' . $sort_config[ 'sort_type' ]; - } - - $list = $this->model - ->withSearch([ "goods_category", "label_ids", 'service_ids' ], $where) - ->field($field) - ->withJoin([ - 'goodsSku' => [ 'sku_id', 'sku_name', 'sku_image', 'sku_no', 'goods_id', 'sku_spec_format', 'price', 'market_price', 'sale_price', 'stock', 'weight', 'volume', 'member_price' ] - ]) - ->where($sku_where)->order($order)->append([ 'goods_cover_thumb_small','goods_cover_thumb_mid', 'goods_label_name', 'goods_brand' ]) - ->limit($where[ 'num' ]) - ->select()->toArray(); - $goods_active_price_service = ( new CoreGoodsActivePriceService() ); - foreach ($list as $k => &$v) { - if (!empty($v[ 'goodsSku' ])) { - $v[ 'goodsSku' ][ 'member_discount' ] = $v[ 'member_discount' ]; - $list_show_price = $goods_active_price_service->getShowPrice($v[ 'goodsSku' ], $this->member_id); - $v[ 'goodsSku' ][ 'show_price' ] = $list_show_price[ 'show_price' ]; - $v[ 'goodsSku' ][ 'show_type' ] = $list_show_price[ 'show_type' ]; - } - } - return $list; - } - - public function getMemberInfo() - { - $member_model = new Member(); - $member_field = 'member_level'; - $member_info = $member_model->where([ - [ 'member_id', '=', $this->member_id ] - ])->field($member_field) - ->with([ - // 会员等级 - 'memberLevelData' => function ($query) { - $query->field('level_id, level_name, status, level_benefits, level_gifts'); - }, - ]) - ->findOrEmpty()->toArray(); - return $member_info; - } - - /** - * 查询商品的会员价 - * @param $member_info - * @param string $member_discount 会员等级折扣,不参与:空,会员折扣:discount,指定会员价:fixed_price - * @param string $member_price 会员价,json格式,指定会员价,数据结构为:{"level_12":"92.00","level_13":"72.00","level_14":"66.00","level_15":"45.00"} - * @param $price - * @return int|string - */ - public function getMemberPrice($member_info, $member_discount, $member_price, $price) - { - if (empty($member_discount)) { - return $price; - } - - // 未找到会员,排除 - if (empty($member_info)) { - return $price; - } - - // 没有会员等级,排除 - if (!empty($member_info) && empty($member_info[ 'member_level' ])) { - return $price; - } - - if ($member_discount == 'discount') { - // 按照会员等级折扣计算 - - // 默认按会员享受折扣计算 - if (!empty($member_info[ 'memberLevelData' ][ 'level_benefits' ]) - && !empty($member_info[ 'memberLevelData' ][ 'level_benefits' ][ 'discount' ]) - && !empty($member_info[ 'memberLevelData' ][ 'level_benefits' ][ 'discount' ][ 'is_use' ])) { - - $price = number_format($price * $member_info[ 'memberLevelData' ][ 'level_benefits' ][ 'discount' ][ 'discount' ] / 10, 2, '.', ''); - } - - } elseif ($member_discount == 'fixed_price') { - // 指定会员价 - if (!empty($member_price)) { - $member_price = json_decode($member_price, true); - if (!empty($member_price[ 'level_' . $member_info[ 'member_level' ] ])) { - $member_level_price = $member_price[ 'level_' . $member_info[ 'member_level' ] ]; - $price = number_format($member_level_price, 2, '.', ''); - } - } - } - - return $price; - } - - /** - * 查询商品的会员价 - * @param $member_info - * @param string $member_discount 会员等级折扣,不参与:空,会员折扣:discount,指定会员价:fixed_price - * @param $sku_list - * @return int - */ - public function getMemberPriceByList($member_info, $member_discount, &$sku_list) - { - - // 是否按照原价返回 - $is_default = false; - - if (empty($member_discount)) { - $is_default = true; - } - - // 未找到会员,排除 - if (empty($member_info)) { - $is_default = true; - } - - // 没有会员等级,排除 - if (!empty($member_info) && empty($member_info[ 'member_level' ])) { - $is_default = true; - } - - foreach ($sku_list as $k => &$v) { - - if ($is_default) { - $v[ 'member_price' ] = $v[ 'price' ]; - } else { - if ($member_discount == 'discount') { - // 按照会员等级折扣计算 - - // 默认按会员享受折扣计算 - if (!empty($member_info[ 'memberLevelData' ][ 'level_benefits' ]) - && !empty($member_info[ 'memberLevelData' ][ 'level_benefits' ][ 'discount' ]) - && !empty($member_info[ 'memberLevelData' ][ 'level_benefits' ][ 'discount' ][ 'is_use' ])) { - $v[ 'member_price' ] = number_format($v[ 'price' ] * $member_info[ 'memberLevelData' ][ 'level_benefits' ][ 'discount' ][ 'discount' ] / 10, 2, '.', ''); - } else { - $v[ 'member_price' ] = $v[ 'price' ]; - } - - } elseif ($member_discount == 'fixed_price') { - // 指定会员价 - if (!empty($v[ 'member_price' ])) { - $member_price = json_decode($v[ 'member_price' ], true); // 会员价,json格式,指定会员价 - if (!empty($member_price[ 'level_' . $member_info[ 'member_level' ] ])) { - $member_level_price = $member_price[ 'level_' . $member_info[ 'member_level' ] ]; - $v[ 'member_price' ] = number_format($member_level_price, 2, '.', ''); - } else { - $v[ 'member_price' ] = $v[ 'price' ]; - } - } - } - } - } - - return $sku_list; - - } - - /** - * 猜你喜欢 - * @return void|array - */ - public function getRecommend() - { - $field = 'goods_id,goods_name,sub_title,goods_category,goods_type,goods_cover,unit,status,sale_num + goods.virtual_sale_num as sale_num,member_discount,is_discount,virtual_receive_type'; - $order = 'sale_num desc'; - - $where['goods_sku_is_default'] = 1; - $where['status'] = 1; - $search_model = $this->model - ->withSearch([ 'status' ], $where) - ->field($field) - ->withJoin([ 'goodsSku' ]) - ->order($order)->append([ 'goods_type_name', 'goods_cover_thumb_small', 'goods_cover_thumb_mid' ]); - $list = $this->pageQuery($search_model); - if (!empty($list['data'])){ - $goods_active_price_service = (new CoreGoodsActivePriceService()); - foreach ($list[ 'data' ] as $k => &$v) { - $v[ 'goodsSku' ][ 'member_discount' ] = $v[ 'goods' ][ 'member_discount' ] ?? ''; - //获取展示活动价格 - $show_price_data = $goods_active_price_service->getShowPrice($v[ 'goodsSku' ], $this->member_id); - $v[ 'goodsSku' ][ 'show_price' ] = $show_price_data[ 'show_price' ]; - $v[ 'goodsSku' ][ 'show_type' ] = $show_price_data[ 'show_type' ]; - } - } - - return $list; - - } - -} diff --git a/niucloud/addon/shop/app/service/api/goods/GoodsServiceService.php b/niucloud/addon/shop/app/service/api/goods/GoodsServiceService.php deleted file mode 100644 index 641deade9..000000000 --- a/niucloud/addon/shop/app/service/api/goods/GoodsServiceService.php +++ /dev/null @@ -1,38 +0,0 @@ -model = new Service(); - } - - /** - * 商品服务列表 - */ - public function getAll($data) - { - $limit = !empty($data[ 'limit' ]) ? $data[ 'limit' ] : 4; - $field = 'service_id, service_name, image, desc'; - return $this->model->field($field)->order('create_time desc')->limit($limit)->select()->toArray(); - } - -} diff --git a/niucloud/addon/shop/app/service/api/goods/RankService.php b/niucloud/addon/shop/app/service/api/goods/RankService.php deleted file mode 100644 index 72395d63d..000000000 --- a/niucloud/addon/shop/app/service/api/goods/RankService.php +++ /dev/null @@ -1,340 +0,0 @@ -model = new Rank(); - $this->goodsStatModel = new Stat(); - $this->goodsModel = new Goods(); - } - - /** - * 获取商品排行榜配置 - * @return array - */ - public function getGoodsRankConfig() - { - return ( new CoreGoodsRankConfigService() )->getGoodsRankConfig(); - } - - /** - * 获取商品榜单列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'rank_id,name,goods_source'; - $order = 'sort desc,create_time desc'; - $list = $this->model->where([ [ 'status', '=', RankDict::ON ] ])->withSearch([ "name" ], $where)->field($field)->order($order)->select()->toArray(); - - return $list; - } - - /** - * 获取商品榜单列表 - * @param array $data - * @return array - */ - public function getGoodsPage($data) - { - $rank_id = $data[ 'rank_id' ]; - $rank_info = $this->model->field('rank_id,name,rank_type,rule_type,goods_source,goods_json,category_ids,brand_ids,label_ids')->where([ [ 'rank_id', '>', 0 ] ])->find($rank_id); - $list = []; - if ($rank_info) { - $list = $this->getGoodsList($rank_info, 0, $data); - } - return $list; - } - - /** - * 获取商品榜单组件列表 - * @param array $data - * @return array - */ - public function getRankComponents($data) - { - $rank_id = $data[ 'rank_id' ]; - $limit = $data[ 'limit' ]; - $where[] = [ - [ 'status', '=', RankDict::ON ] - ]; - $order = ''; - if ($rank_id > 0) { - $where[] = [ 'rank_id', '=', $rank_id ]; - $order = 'sort desc,create_time desc'; - }else{ - $where[] = [ 'rank_id', '>', 0 ]; - } - - $rank_info = $this->model->field('rank_id,name,rank_type,rule_type,goods_source,goods_json,category_ids,brand_ids,label_ids')->where($where)->order($order)->findOrEmpty()->toArray(); - $data = []; - if (!empty($rank_info)) { - $data[ 'rank_id' ] = $rank_info[ 'rank_id' ]; - $data[ 'name' ] = $rank_info[ 'name' ]; - $data[ 'goods_list' ] = $this->getGoodsList($rank_info, $limit); - } - return $data; - } - - /** - * 根据榜单设置条件查询对应的商品信息 - * @param $rank_info - * @param int $limit - * @param array $data - * @return array - * @throws \think\db\exception\DbException - */ - protected function getGoodsList($rank_info, $limit = 0, $data = []) - { - // 根据排行周期 获取时间区间 - $date_end = strtotime(date('Y-m-d 23:59:59')); - switch ($rank_info[ 'rank_type' ]) { - case RankDict::DAY: - $day = 1; - break; - case RankDict::WEEK: - $day = 7; - break; - case RankDict::MONTH: - $day = 30; - break; - case RankDict::QUARTER: - $day = 90; - break; - } - $date_start = $date_end - 86400 * $day + 1; - $field = 'goods.goods_id,goods_name,goods_cover,unit,goods.sale_num + goods.virtual_sale_num as sale_num,member_discount,sum(stat.sale_num)+ goods.virtual_sale_num as stat_sale_num,sum(stat.collect_num) as stat_collect_num,sum(stat.evaluate_num) as stat_evaluate_num,sum(stat.access_num) as stat_access_num,goods.create_time,goods.sort as goods_sort'; - $where[] = [ - [ 'goods.is_gift', '=', GoodsDict::NOT_IS_GIFT ], - [ 'goods.status', '=', 1 ], - [ 'goods.delete_time', '=', 0 ], - ]; - $order = 'stat_' . $rank_info[ 'rule_type' ] . '_num desc,goods_sort desc,create_time desc'; - // 来源类型 goods=指定商品,category=指定分类,brand=指定品牌, label=指定标签 - if ($rank_info[ 'goods_source' ] == RankDict::GOODS) { - // 根据配置的排行周期查询对应的商品 - $goods_json = $rank_info[ 'goods_json' ]; - $config_goods_ids = array_column($goods_json, 'goods_id'); - $list = $this->goodsModel - ->alias('goods') - ->field($field) - ->where([ [ 'goods.goods_id', 'in', $config_goods_ids ], [ 'goods.is_gift', '=', GoodsDict::NOT_IS_GIFT ], [ 'goods.status', '=', 1 ], [ 'goods.delete_time', '=', 0 ] ]) - ->whereBetweenTime('date_time', $date_start, $date_end) - ->join('shop_goods_stat stat', 'goods.goods_id = stat.goods_id', 'left') - ->group('goods.goods_id') - ->append([ 'goods_cover_thumb_small', 'goods_cover_thumb_mid' ]) - ->select() - ->toArray(); - $sort_goods_json = array_column($goods_json, null, 'goods_id'); - foreach ($list as &$item) { - $item[ 'sort' ] = $sort_goods_json[ $item[ 'goods_id' ] ][ 'sort' ] ?? 0; - } - - usort($list, function ($list_one, $list_two) use ($rank_info) { - // 按 排序号 排序 - if ($list_one[ 'sort' ] != $list_two[ 'sort' ]) { - return $list_two[ 'sort' ] <=> $list_one[ 'sort' ]; - } - // 如果 排序号 相等,则按 排序规则 排序 - if ($list_one[ 'stat_' . $rank_info[ 'rule_type' ] . '_num' ] != $list_two[ 'stat_' . $rank_info[ 'rule_type' ] . '_num' ]) { - return $list_two[ 'stat_' . $rank_info[ 'rule_type' ] . '_num' ] <=> $list_one[ 'stat_' . $rank_info[ 'rule_type' ] . '_num' ]; - } - //如果 排序规则 相等,则按 商品排序号 排序 - if ($list_one[ 'goods_sort' ] != $list_two[ 'goods_sort' ]) { - return $list_two[ 'goods_sort' ] <=> $list_one[ 'goods_sort' ]; - } - - // 如果 商品排序号 也相等,则按 创建时间 排序 - return $list_two[ 'create_time' ] <=> $list_one[ 'create_time' ]; - }); - - if ($limit == 0) { - $goods_list = [ - 'total' => count($list), - 'per_page' => 1, - 'current_page' => 1, - 'last_page' => 1, - 'data' => $list, - ]; - } else { - $goods_list = array_slice($list, 0, $limit); - } - - } elseif ($rank_info[ 'goods_source' ] == RankDict::CATEGORY) { - $category_ids = $rank_info[ 'category_ids' ]; - $query = $this->goodsModel - ->alias('goods') - ->field($field) - ->where($where) - ->whereBetweenTime('date_time', $date_start, $date_end) - ->withSearch([ 'goods_category' ], [ 'goods_category' => $category_ids ]) - ->join('shop_goods_stat stat', 'goods.goods_id = stat.goods_id', 'left') - ->group('goods.goods_id') - ->limit($limit) - ->order($order) - ->append([ 'goods_cover_thumb_small', 'goods_cover_thumb_mid', 'goods_label_name', 'goods_brand' ]); - if ($limit == 0) { - $goods_list = $this->pageQuery($query); - } else { - $goods_list = $query->select()->toArray(); - } - } elseif ($rank_info[ 'goods_source' ] == RankDict::BRAND) { - $brand_ids = $rank_info[ 'brand_ids' ]; - $query = $this->goodsModel - ->alias('goods') - ->field($field) - ->where($where) - ->whereBetweenTime('date_time', $date_start, $date_end) - ->whereIn('goods.brand_id', $brand_ids) - ->join('shop_goods_stat stat', 'goods.goods_id = stat.goods_id', 'left') - ->group('goods.goods_id') - ->limit($limit) - ->order($order) - ->append([ 'goods_cover_thumb_small', 'goods_cover_thumb_mid', 'goods_label_name', 'goods_brand' ]); - if ($limit == 0) { - $goods_list = $this->pageQuery($query); - } else { - $goods_list = $query->select()->toArray(); - } - } elseif ($rank_info[ 'goods_source' ] == RankDict::LABEL) { - $label_ids = $rank_info[ 'label_ids' ]; - $query = $this->goodsModel - ->alias('goods') - ->field($field) - ->where($where) - ->whereBetweenTime('date_time', $date_start, $date_end) - ->withSearch([ 'label_ids' ], [ 'label_ids' => $label_ids ]) - ->join('shop_goods_stat stat', 'goods.goods_id = stat.goods_id', 'left') - ->group('goods.goods_id') - ->limit($limit) - ->order($order) - ->append([ 'goods_cover_thumb_small', 'goods_cover_thumb_mid', 'goods_label_name', 'goods_brand' ]); - if ($limit == 0) { - $goods_list = $this->pageQuery($query); - } else { - $goods_list = $query->select()->toArray(); - } - } else { - $query = $this->goodsModel - ->alias('goods') - ->field($field) - ->where($where) - ->whereBetweenTime('date_time', $date_start, $date_end) - ->join('shop_goods_stat stat', 'goods.goods_id = stat.goods_id', 'left') - ->group('goods.goods_id') - ->limit($limit) - ->order($order) - ->append([ 'goods_cover_thumb_small', 'goods_cover_thumb_mid', 'goods_label_name', 'goods_brand' ]); - if ($limit == 0) { - $goods_list = $this->pageQuery($query); - } else { - $goods_list = $query->select()->toArray(); - } - } - //获取商品SKU、会员价格信息 - $goods_active_price_service = ( new CoreGoodsActivePriceService() ); - if (isset($goods_list[ 'data' ])) { - if (!empty($goods_list[ 'data' ])) { - foreach ($goods_list[ 'data' ] as $key => &$item) { - $item[ 'rank_num' ] = $key + 1; - $item[ 'goodsSku' ] = $this->getGoodsSku($item); - if (!empty($item[ 'goodsSku' ])) { - $item[ 'goodsSku' ][ 'member_discount' ] = $item[ 'member_discount' ]; - $show_price = $goods_active_price_service->getShowPrice($item[ 'goodsSku' ], $this->member_id); - $item[ 'goodsSku' ][ 'show_price' ] = $show_price[ 'show_price' ]; - $item[ 'goodsSku' ][ 'show_type' ] = $show_price[ 'show_type' ]; - } - } - } - } else { - if (!empty($goods_list)) { - foreach ($goods_list as $key => &$item) { - $item[ 'rank_num' ] = $key + 1; - $item[ 'goodsSku' ] = $this->getGoodsSku($item); - if (!empty($item[ 'goodsSku' ])) { - $item[ 'goodsSku' ][ 'member_discount' ] = $item[ 'member_discount' ]; - $show_price = $goods_active_price_service->getShowPrice($item[ 'goodsSku' ], $this->member_id); - $item[ 'goodsSku' ][ 'show_price' ] = $show_price[ 'show_price' ]; - $item[ 'goodsSku' ][ 'show_type' ] = $show_price[ 'show_type' ]; - } - } - } - } - return $goods_list; - } - - /** - * 根据排行周期查询商品统计数据 - */ - protected function getGoodsIds($data) - { - $rank_type = $data[ 'rank_type' ]; - $date_end = strtotime(date('Y-m-d 23:59:59')); - switch ($rank_type) { - case RankDict::DAY: - $day = 1; - break; - case RankDict::WEEK: - $day = 7; - break; - case RankDict::MONTH: - $day = 30; - break; - case RankDict::QUARTER: - $day = 90; - break; - } - $date_start = $date_end - 86400 * $day + 1; - $goods_ids = $this->goodsStatModel->where([ [ 'id', '>', 0 ] ])->whereBetweenTime('date_time', $date_start, $date_end)->column('goods_id'); - return $goods_ids; - } - - /** - * 获取商品SKU - * @param $data - * @return mixed - */ - protected function getGoodsSku($data) - { - $goods_sku_info = ( new GoodsSku() )->field('sku_id,sku_name,sku_image,goods_id,price,sku_spec_format,sale_price,stock,member_price') - ->where([ - [ 'goods_id', '=', $data[ 'goods_id' ] ] - ]) - ->find(); - return $goods_sku_info; - } - -} diff --git a/niucloud/addon/shop/app/service/api/marketing/CouponService.php b/niucloud/addon/shop/app/service/api/marketing/CouponService.php deleted file mode 100644 index d70895313..000000000 --- a/niucloud/addon/shop/app/service/api/marketing/CouponService.php +++ /dev/null @@ -1,478 +0,0 @@ -model = new Coupon(); - } - - /** - * 获取优惠券列表 - * @return array - */ - public function getPage($data) - { - $goods_coupon_id = []; - if ($data[ 'goods_id' ] != '') { - $coupon_goods_model = new CouponGoods(); - $goods_coupon_list = $coupon_goods_model->where([ [ 'goods_id', '=', $data[ 'goods_id' ] ] ])->select()->toArray(); - if (!empty($goods_coupon_list)) { - $goods_coupon_id = array_column($goods_coupon_list, 'coupon_id'); - } else { - $goods_coupon_id = [ -1 ]; - } - } - - $category_coupon_id = []; - if (!empty($data[ 'category_id' ])) { - $coupon_goods_model = new CouponGoods(); - $category_coupon_list = $coupon_goods_model->where([ [ 'category_id', 'in', $data[ 'category_id' ] ] ])->select()->toArray(); - if (!empty($category_coupon_list)) { - $category_coupon_id = array_column($category_coupon_list, 'coupon_id'); - } else { - $category_coupon_id = [ -1 ]; - } - } - $field = 'id,title,start_time,end_time,remain_count,receive_count,limit_count,status,price,min_condition_money,type - ,receive_type,valid_type,length,valid_start_time,valid_end_time,sort'; - - // 参数过滤 - if (!empty($data[ 'order' ]) && in_array($data[ 'order' ], [ 'create_time', 'price' ])) { - $order = $data[ 'order' ] . ' ' . $data[ 'sort' ]; - } else { - $order = 'id desc'; - } - - $where[] = [ 'status', '=', CouponDict::NORMAL ]; - $where[] = [ 'receive_type', '=', CouponDict::USER ]; - $where[] = function ($query) { - $query->where([ [ 'remain_count', '=', '-1' ] ])->whereOr([ [ 'remain_count', '>', 0 ] ]); - }; - - $time_where = function($query) { - $nowtime = time(); - $time_where = [ - [ - [ 'start_time', '<=', $nowtime ], - [ 'end_time', '>=', $nowtime ], - ], - [ - [ 'start_time', '=', 0 ], - [ 'end_time', '=', 0 ], - ] - ]; - $query->whereOr($time_where); - }; - if (!empty($category_coupon_id) || !empty($goods_coupon_id)) { - $category_where = []; - if (!empty($category_coupon_id)) { -// $category_where = function ($query) use($category_coupon_id, $time_where){ -// $query->where([ -// ['id', 'in', $category_coupon_id], -// ['type', '=', CouponDict::CATEGORY] -// ]); -// }; - $category_where = [ - [ 'id', 'in', $category_coupon_id ], - [ 'type', '=', CouponDict::CATEGORY ] - ]; - } - $goods_where = []; - if (!empty($goods_coupon_id)) { - $goods_where = [ - [ 'id', 'in', $goods_coupon_id ], - [ 'type', '=', CouponDict::GOODS ] - ]; - } - $all_where = [ - [ 'type', '=', CouponDict::ALL ] - ]; - - $common_where = function($query) use ($category_where, $goods_where, $all_where) { - $temp_where = [ $all_where ]; - if ($category_where) { - $temp_where[] = $category_where; - } - if ($goods_where) { - $temp_where[] = $goods_where; - } - $query->whereOr($temp_where); - }; - - $search_model = $this->model - ->field($field) - ->where($where) - ->where($common_where) - ->where($time_where) - ->order($order) - ->append([ 'coupon_price', 'coupon_min_price', 'receive_type_name', 'type_name' ]); - } else { - $type_where = []; - if (!empty($data[ 'type' ])) { - $type_where = [ - [ 'type', '=', $data[ 'type' ] ] - ]; - } - - $search_model = $this->model - ->field($field) - ->where($where) - ->where($type_where) - ->where($time_where) - ->order($order) - ->append([ 'coupon_price', 'coupon_min_price', 'receive_type_name', 'type_name' ]); - } - $list = $this->pageQuery($search_model); - $coupon_member = new CouponMember(); - $member_info = ( new Member() )->where([ [ 'member_id', '=', $this->member_id ] ])->field('member_id')->findOrEmpty()->toArray(); - foreach ($list[ 'data' ] as $k => &$v) { - if ($v[ 'remain_count' ] != '-1') { - $v[ 'sum_count' ] = $v[ 'remain_count' ] + $v[ 'receive_count' ]; - } else { - $v[ 'sum_count' ] = '-1'; - } - - if ($member_info) { - $coupon_member_count = $coupon_member->where([ [ 'member_id', '=', $this->member_id ], [ 'coupon_id', '=', $v[ 'id' ] ], [ 'receive_type', '=', 'receive' ] ])->count(); - if ($coupon_member_count) { - $v[ 'is_receive' ] = 1; - $v[ 'member_receive_count' ] = $coupon_member_count; - } else { - $v[ 'is_receive' ] = 0; - $v[ 'member_receive_count' ] = 0; - } - } else { - $v[ 'member_receive_count' ] = 0; - $v[ 'is_receive' ] = 0; - } - } - return $list; - } - - /** - * 查询优惠券详情 - */ - public function getDetail($id) - { - $info = $this->model->where([ [ 'id', '=', $id ] ])->append([ 'coupon_price', 'coupon_min_price' ])->findOrEmpty()->toArray(); - - if (empty($info)) { - throw new CommonException('COUPON_NOT_EXIST'); - } - if ($info[ 'remain_count' ] != '-1') { - $info[ 'sum_count' ] = $info[ 'remain_count' ] + $info[ 'receive_count' ]; - } else { - $info[ 'sum_count' ] = '-1'; - } - $coupon_member = new CouponMember(); - $member_info = ( new Member() )->where([ [ 'member_id', '=', $this->member_id ] ])->field('member_id')->findOrEmpty()->toArray(); - - if ($member_info) { - $coupon_member_count = $coupon_member->where([ [ 'member_id', '=', $this->member_id ], [ 'coupon_id', '=', $id ], [ 'receive_type', '=', 'receive' ] ])->count(); - if ($coupon_member_count) { - $info[ 'is_receive' ] = 1; - $info[ 'member_receive_count' ] = $coupon_member_count; - } else { - $info[ 'is_receive' ] = 0; - $info[ 'member_receive_count' ] = 0; - } - } else { - $info[ 'is_receive' ] = 0; - $info[ 'member_receive_count' ] = 0; - } - - return $info; - } - - /** - * 优惠券领取 - */ - public function receive($data) - { - $member_id = $this->member_id; - $coupon_id = $data[ 'coupon_id' ]; - $number = $data[ 'number' ]; - $type = $data[ 'type' ]; - $coupon_member_model = new CouponMember(); - Db::startTrans(); - try { - //判断是否符合设置的领取方式 - $receive_type = $this->getReceiveType(); - if (!in_array($type, $receive_type)) { - throw new CommonException('COUPON_RECEIVE_TYPE_NOT_EXIST'); - } - //判断是否已经领取过 - $member_coupon_count = $coupon_member_model->where([ [ 'coupon_id', '=', $coupon_id ], [ 'member_id', '=', $member_id ], [ 'receive_type', '=', 'receive' ] ])->count(); - //判断优惠券数量是否充足 - $info = $this->model->where([ [ 'id', '=', $coupon_id ] ])->findOrEmpty()->toArray(); - if (empty($info)) { - throw new CommonException('COUPON_NOT_EXIST'); - } - - if($info['status'] != CouponDict::NORMAL){ - throw new CommonException('COUPON_INVALID');//优惠券已失效 - } - - if($info['receive_type'] != CouponDict::USER) { - throw new CommonException('COUPON_CAN_NOT_MANUAL_RECEIVE');//该优惠券不可手动领取 - } - - if ($member_coupon_count == $info[ 'limit_count' ]) { - throw new CommonException('COUPON_RECEIVE_EXCESS');//领取超过可领取数量 - } - - if ($info[ 'remain_count' ] != '-1' && $info[ 'remain_count' ] == 0) { - throw new CommonException('COUPON_STOCK_INSUFFICIENT');//优惠券已被领完 - } - if (strtotime($info[ 'start_time' ]) > 0) { - $time = time(); - if ($time < strtotime($info[ 'start_time' ])) { - throw new CommonException('COUPON_RECEIVE_NOT_TIME');//优惠券不在领取时间范围内 - } - if ($time > strtotime($info[ 'end_time' ])) { - throw new CommonException('COUPON_RECEIVE_NOT_TIME');//优惠券不在领取时间范围内 - } - } - - if ($info[ 'remain_count' ] != -1) { - $coupon_data = [ - 'remain_count' => $info[ 'remain_count' ] - $number, - 'receive_count' => $info[ 'receive_count' ] + $number, - ]; - } else { - $coupon_data = [ - 'receive_count' => $info[ 'receive_count' ] + $number, - ]; - } - - if ($info[ 'valid_type' ] == 1) { - $expire_time = 86400 * $info[ 'length' ] + time(); - } else { - $expire_time = $info[ 'valid_end_time' ]; - } - $member_coupon_data = [ - 'coupon_id' => $coupon_id, - 'member_id' => $member_id, - 'create_time' => time(), - 'expire_time' => $expire_time, - 'receive_type' => $type, - 'type' => $info[ 'type' ], - 'title' => $info[ 'title' ], - 'price' => $info[ 'price' ], - 'status' => CouponMemberDict::WAIT_USE, - 'min_condition_money' => $info[ 'min_condition_money' ] - ]; - $this->model->where([ [ 'id', '=', $coupon_id ] ])->update($coupon_data); - $coupon_member_model->create($member_coupon_data); - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - - } - - /** - * 会员优惠券领取记录 - */ - public function getMemberPage($data) - { - if (!empty($data[ 'status' ])) { - $where[] = [ 'status', '=', $data[ 'status' ] ]; - } - if (in_array($data[ 'type' ], [CouponDict::ALL, CouponDict::CATEGORY, CouponDict::GOODS])) { - $where[] = [ 'type', '=', $data[ 'type' ] ]; - } -// elseif ($data[ 'type' ] == -1){ -// $where[] = [ 'expire_time', '>', time() + 86400 * 3 ]; -// } - $where[] = [ 'member_id', '=', $this->member_id ]; - $coupon_member_model = new CouponMember(); - $search_model = $coupon_member_model - ->where($where) - ->order([ 'id desc' ]) - ->append([ 'coupon_price', 'coupon_min_price', 'receive_type_name', 'type_name' ]); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 会员优惠券按状态查询数量 - * @param $data - * @return mixed - */ - public function getCouponCountByStatus() - { - $count_list = []; - $status_array = array_keys(CouponMemberDict::getStatus()); - foreach ($status_array as $v) { - $coupon_member_model = new CouponMember(); - $count = $coupon_member_model->where([[ 'member_id', '=', $this->member_id ], [ 'status', '=', $v]])->count(); - $count_list[] = [ - 'status' => $v, - 'status_name' => CouponMemberDict::getStatus($v), - 'count' => $count - ]; - } - return $count_list; - } - - /** - * 会员已领取优惠券数量 - * @param $data - * @return mixed - */ - public function getMemberCount($data) - { - if (!empty($data[ 'status' ])) { - $where[] = [ 'status', '=', $data[ 'status' ] ]; - } - $where[] = [ 'member_id', '=', $this->member_id ]; -// $where[] = [ 'expire_time', '>', time() ]; - $coupon_member_model = new CouponMember(); - $count = $search_model = $coupon_member_model - ->where($where) - ->count(); - return $count; - } - - //获取优惠券领取方式 - public function getReceiveType() - { - $data = event('CouponReceiveType', []); - if (empty($data)) { - return []; - } - foreach ($data as &$value) { - foreach ($value as $v) { - $type[] = $v[ 'name' ]; - - } - } - return $type; - } - - /** - * 获取优惠券类型 - * @return array - */ - public function getCouponType() - { -// $list[] = [ -// 'label' => '快过期', -// 'value' => '-1' -// ]; - $type = CouponDict::getType(); - foreach ($type as $k => $v) { - $list[] = [ - 'label' => $v, - 'value' => $k, - ]; - } - return $list; - } - - /** - * 获取优惠券列表供组件调用 - * @return array - */ - public function getCouponComponents($data) - { - $field = 'id,title,start_time,end_time,remain_count,receive_count,limit_count,status,price,min_condition_money,type - ,receive_type,valid_type,length,valid_start_time,valid_end_time,sort'; - $order = 'id desc'; - - $where[] = ['status', '=', CouponDict::NORMAL]; - $where[] = [ 'receive_type', '=', CouponDict::USER ]; - if (!empty($data[ 'coupon_ids' ])) { - $where[] = [ 'id', 'in', $data[ 'coupon_ids' ] ]; - } - - $time_where = function($query) { - $nowtime = time(); - $time_where = [ - [ - [ 'start_time', '<=', $nowtime ], - [ 'end_time', '>=', $nowtime ] - ], - [ - [ 'start_time', '=', 0 ], - [ 'end_time', '=', 0 ] - ] - ]; - $query->whereOr($time_where); - }; - $list = $this->model - ->field($field) - ->where($where) - ->where($time_where) - ->order($order) - ->limit($data[ 'num' ]) - ->append([ 'coupon_price', 'coupon_min_price', 'receive_type_name', 'type_name' ]) - ->select()->toArray(); - - return $list; - } - - /** - * 查询优惠券二维码 - * @param $id - * @return string - */ - public function getQrcode($id) - { - $info = $this->model->where([ [ 'id', '=', $id ] ])->findOrEmpty()->toArray(); - - if (empty($info)) { - throw new CommonException('COUPON_NOT_EXIST'); - } - - $url = ( new CoreSysConfigService() )->getSceneDomain()[ 'wap_url' ]; - $page = 'addon/shop/pages/coupon/detail'; - - $data = [ - [ - 'key' => 'mid', - 'value' => $this->member_id - ], - [ - 'key' => 'coupon_id', - 'value' => $id - ] - ]; - $dir = 'upload/shop_coupon_qrcode'; - $channel = 'weapp'; - - $path = qrcode($url, $page, $data,$dir, $channel); - return $path; - } -} diff --git a/niucloud/addon/shop/app/service/api/marketing/DiscountService.php b/niucloud/addon/shop/app/service/api/marketing/DiscountService.php deleted file mode 100644 index 9862c29fb..000000000 --- a/niucloud/addon/shop/app/service/api/marketing/DiscountService.php +++ /dev/null @@ -1,165 +0,0 @@ -model = new Discount(); - } - - /** - * 查询商品正在参与的限时折扣活动 - * @param $goods_id - * @return mixed - */ - public function getInfoByGoods($goods_id) - { - $active_goods_model = new DiscountGoods(); - - $field = 'discount_goods_id as active_goods_id,discount_id'; - - $info = $active_goods_model->where([ - [ 'status', '=', 'active' ], - [ 'goods_id', '=', $goods_id ] - ])->field($field) - ->with([ - 'discount' => function($query) { - $query->withField('discount_id,name as active_name, remark as active_desc, start_time, end_time'); - } - ]) - ->findOrEmpty()->toArray(); - if(!empty($info)) { - $info[ 'active_id' ] = $info[ 'discount_id' ]; - $info[ 'discount' ][ 'active_id' ] = $info[ 'active_id' ]; - $info[ 'active' ] = $info[ 'discount' ]; - unset($info[ 'discount' ]); - } - return $info; - - } - - /** - * 折扣页面轮播图配置 - */ - public function getDiscountBannerConfig() - { - $data = ( new CoreConfigService() )->getConfigValue('SHOP_DISCOUNT_BANNER_CONFIG'); - if (empty($data)) { - $data = []; - } - return $data; - } - - - /** - * 获取商品列表 - * @param array $where - * @return array - */ - public function getGoodsPage(array $where = []) - { - $field = 'goods_id,label_ids,goods_name,sub_title,goods_category,goods_type,goods_cover,unit,status,sale_num + virtual_sale_num as sale_num,member_discount,is_discount'; - - $sku_where = [ - [ 'goods.status', '=', 1 ], - ]; - - if (!empty($where[ 'keyword' ])) { - $sku_where[] = [ 'goods_name|sub_title', 'like', '%' . $where[ 'keyword' ] . '%' ]; - } - - // 参数过滤 - if (!empty($where[ 'order' ]) && in_array($where[ 'order' ], [ 'sale_num', 'sale_price' ])) { - $order = $where[ 'order' ] . ' ' . $where[ 'sort' ]; - } else { - $order = 'sort desc,create_time desc'; - } - $search_model = ( new Goods() ) - ->alias('goods') - ->withSearch([ "brand_id", "goods_category", "label_ids", 'service_ids' ], $where) - ->field($field) - ->with([ 'skuList']) - ->withJoin([ 'discountGoods' => function($query) use ($where) { - $discount_where = [ [ 'discountGoods.status', 'in', [ DiscountDict::ACTIVE, DiscountDict::NOT_ACTIVE ] ] ]; - if ($where[ 'discount_id' ]) $discount_where[] = [ 'discount_id', '=', $where[ 'discount_id' ] ]; - $query->field('discount_id,discountGoods.status as discount_status')->where($discount_where); - } ], 'left') - ->group('goods.goods_id') - ->where($sku_where)->order($order)->hidden(['discountGoods'])->append([ 'goods_type_name', 'goods_cover_thumb_mid', 'goods_label_name', 'discount_status_name' ]); - $list = $this->pageQuery($search_model); - - $discount_model = (new DiscountGoods()); - - if (!empty($list[ 'data' ])){ - foreach ($list[ 'data' ] as $key => $item) { - $sku_list = $item[ 'skuList' ] ?? []; - $sku_list = array_column($sku_list, null, 'sku_id'); - $discount_goods_value = $discount_model->where([['discount_id','=',$item['discount_id']],['goods_id','=',$item['goods_id']]])->column('*','sku_id'); - foreach ($discount_goods_value as $k => $v) { - if (!empty($v[ 'is_enabled' ])) { - $goods_sku = $sku_list[ $v[ 'sku_id' ] ] ?? []; - $discount_price = $v[ 'discount_price' ] ?? $goods_sku[ 'price' ]; - - if (( !empty($item[ 'goodsSku' ]) && $item[ 'goodsSku' ][ 'discount_price' ] > $discount_price ) || empty($item[ 'goodsSku' ])) { - $item[ 'goodsSku' ] = $goods_sku; - $item[ 'goodsSku' ][ 'discount_type' ] = $v[ 'type' ] ?? ''; - $item[ 'goodsSku' ][ 'discount_rate' ] = $v[ 'rate' ] ?? '111'; - $item[ 'goodsSku' ][ 'discount_price' ] = $discount_price; - $item[ 'goodsSku' ][ 'reduce_money' ] = $v[ 'reduce_money' ] ?? 0; - } - - } - } - if (empty($item[ 'goodsSku' ])) { - $item[ 'goodsSku' ] = $item[ 'skuList' ][ 0 ] ?? []; - $item[ 'goodsSku' ][ 'discount_type' ] = 'discount'; - $item[ 'goodsSku' ][ 'discount_rate' ] = '10'; - $item[ 'goodsSku' ][ 'discount_price' ] = $item[ 'goodsSku' ][ 'price' ] ?? '0'; - $item[ 'goodsSku' ][ 'reduce_money' ] = 0; - - } - $list[ 'data' ][ $key ] = $item; - } - } - - return $list; - } - - public function getList(array $where) - { - $field = 'discount_id,name,remark,start_time,end_time,status,create_time,update_time'; - - $order = Db::raw('FIELD(status, "' . DiscountDict::ACTIVE . '","' . DiscountDict::NOT_ACTIVE . '"), start_time asc'); - - return $this->model->where([ - [ 'status', 'in', [ DiscountDict::ACTIVE, DiscountDict::NOT_ACTIVE ] ], - ])->withSearch([ "name" ], $where)->append([ 'status_name' ])->field($field)->limit($where[ 'limit' ])->order($order)->select()->toArray(); - - } - -} diff --git a/niucloud/addon/shop/app/service/api/marketing/ManjianService.php b/niucloud/addon/shop/app/service/api/marketing/ManjianService.php deleted file mode 100644 index 7948e8c14..000000000 --- a/niucloud/addon/shop/app/service/api/marketing/ManjianService.php +++ /dev/null @@ -1,48 +0,0 @@ -model = new Manjian(); - } - - /** - * 获取满减信息 - * @return array - */ - public function getManjianInfo($data) - { - $data[ 'member_id' ] = $this->member_id; - return ( new CoreManjianService() )->getManjianInfo($data); - } - -} diff --git a/niucloud/addon/shop/app/service/api/marketing/NewcomerService.php b/niucloud/addon/shop/app/service/api/marketing/NewcomerService.php deleted file mode 100644 index 1c6051a9e..000000000 --- a/niucloud/addon/shop/app/service/api/marketing/NewcomerService.php +++ /dev/null @@ -1,241 +0,0 @@ -model = new Active(); - } - - /** - * 新人专享商品列表 - * @param array $where - * @return array - */ - public function getGoodsPage(array $where = []) - { - $active_goods_model = new ActiveGoods(); - $active_goods = $active_goods_model->field('goods_id,sku_id,active_goods_value')->where([ - [ 'active_class', '=', ActiveDict::NEWCOMER_DISCOUNT ], - [ 'active_goods_status', '=', ActiveDict::ACTIVE ] - ])->select()->toArray(); - $active_goods_ids = array_unique(array_column($active_goods, 'goods_id')); - $active_sku_ids = array_column($active_goods, 'sku_id'); - $active_goods = array_column($active_goods, null, 'sku_id'); - - $field = 'goods_id,goods_name,goods_type,goods_cover,unit,sale_num + goods.virtual_sale_num as sale_num'; - - $sku_where = [ - [ 'status', '=', 1 ], - [ 'goodsSku.is_default', '=', 1 ], - [ 'goods.goods_id', 'in', $active_goods_ids ] - ]; - - if (!empty($where[ 'keyword' ])) { - $sku_where[] = [ 'goods_name|sub_title', 'like', '%' . $where[ 'keyword' ] . '%' ]; - } - - // 参数过滤 - if (!empty($where[ 'order' ]) && in_array($where[ 'order' ], [ 'sale_num', 'sale_price' ])) { - $order = $where[ 'order' ] . ' ' . $where[ 'sort' ]; - } else { - $order = 'sort desc,create_time desc'; - } - - $search_model = ( new Goods() ) - ->withSearch([ "brand_id", "goods_category" ], $where) - ->field($field) - ->withJoin([ - 'goodsSku' => [ 'sku_id', 'sku_name', 'sku_image', 'goods_id', 'sku_spec_format', 'price', 'sale_price' ] - ]) - ->with([ - 'skuList' => function(Query $query) use ($active_sku_ids) { - $query->where([ [ 'sku_id', 'in', $active_sku_ids ] ]); - } - ]) - ->where($sku_where)->order($order)->append([ 'goods_cover_thumb_mid' ]); - $list = $this->pageQuery($search_model); - - foreach ($list[ 'data' ] as &$item) { - if (!empty($item[ 'skuList' ]) && !empty($active_goods) && !empty($active_sku_ids)) { - foreach ($item[ 'skuList' ] as &$sku_item) { - $active_goods_value = json_decode($active_goods[ $sku_item[ 'sku_id' ] ][ 'active_goods_value' ], true); - $sku_item[ 'newcomer_price' ] = $active_goods_value[ 'newcomer_price' ] ?? 0; - } - if (!empty($item[ 'goodsSku' ])) { - if (in_array($item[ 'goodsSku' ][ 'sku_id' ], $active_sku_ids)) { - $active_goods_value = json_decode($active_goods[ $item[ 'goodsSku' ][ 'sku_id' ] ][ 'active_goods_value' ], true); - $item[ 'goodsSku' ][ 'newcomer_price' ] = $active_goods_value[ 'newcomer_price' ] ?? 0; - } else { - $item[ 'goodsSku' ] = $item[ 'skuList' ][ 0 ]; - } - } - } - } - - $newcomerRecords = ( new NewcomerRecords() )->field('validity_time,is_join')->where([ [ 'member_id', '=', $this->member_id ] ])->findOrEmpty()->toArray(); - $list[ 'validity_time' ] = !empty($newcomerRecords) ? $newcomerRecords[ 'validity_time' ] : 0; - $list[ 'is_join' ] = !empty($newcomerRecords) ? $newcomerRecords[ 'is_join' ] : 0; // 是否参与过新人专享活动 - - return $list; - } - - public function getComponentsList($data) - { - $active_goods_model = new ActiveGoods(); - $active_goods = $active_goods_model->field('goods_id,sku_id,active_goods_value')->where([ - [ 'active_class', '=', ActiveDict::NEWCOMER_DISCOUNT ], - [ 'active_goods_status', '=', ActiveDict::ACTIVE ] - ])->select()->toArray(); - - if (!empty($active_goods)) { - $active_sku_ids = array_unique(array_column($active_goods, 'sku_id')); - $active_goods = array_column($active_goods, null, 'sku_id'); - - if (!empty($data[ 'sku_ids' ])) { - $sku_ids = $data[ 'sku_ids' ]; - } else { - $sku_ids = $active_sku_ids; - } - $limit = $data[ 'limit' ] ?? 0; - - foreach ($sku_ids as $sku_id) { - if (!in_array($sku_id, $active_sku_ids)) unset($sku_id); - } - $sku_ids = array_values($sku_ids); - - $field = 'sku_id,goods_id,sku_name,sku_image,price,sale_price'; - $sku_where = [ - [ 'goods.status', '=', 1 ], - [ 'goods_sku.sku_id', 'in', $sku_ids ] - ]; - $order = 'goods_sku.sale_num desc,goods_sku.stock desc'; - - $list = ( new GoodsSku() )->field($field)->withJoin([ 'goods' => [ 'goods_name','goods_cover' ] ])->where($sku_where)->limit($limit)->order($order)->select()->toArray(); - foreach ($list as &$item) { - $active_goods_value = json_decode($active_goods[ $item[ 'sku_id' ] ][ 'active_goods_value' ], true); - $item[ 'newcomer_price' ] = $active_goods_value[ 'newcomer_price' ] ?? 0; - } - - $newcomerRecords = ( new NewcomerRecords() )->field('validity_time,is_join')->where([ [ 'member_id', '=', $this->member_id ] ])->findOrEmpty()->toArray(); - $validity_time = !empty($newcomerRecords) ? $newcomerRecords[ 'validity_time' ] : 0; - $is_join = !empty($newcomerRecords) ? $newcomerRecords[ 'is_join' ] : 0; // 是否参与过新人专享活动 - - return [ - 'goods_list' => $list, - 'validity_time' => $validity_time, - 'is_join' => $is_join - ]; - } else { - return [ - 'goods_list' => [], - 'validity_time' => 0, - 'is_join' => 0 - ]; - } - } - - /** - * 查询商品详情新人专享信息 - * @param $goods_id - * @param $sku_id - * @return array - */ - public function getNewcomerInfo($goods_id, $sku_id) - { - $active_goods_model = new ActiveGoods(); - $active_goods = $active_goods_model->field('active_id,active_goods_value')->where([ - [ 'active_goods_status', '=', ActiveDict::ACTIVE ], - [ 'active_goods_type', '=', ActiveDict::GOODS_SINGLE ], - [ 'active_class', '=', ActiveDict::NEWCOMER_DISCOUNT ], - [ 'goods_id', '=', $goods_id ], - [ 'sku_id', '=', $sku_id ] - ])->with([ - 'active' => function($query) { - $query->field('active_id,active_desc,active_value'); - } - ])->findOrEmpty()->toArray(); - - if (empty($active_goods)) return []; - - $info[ 'newcomer_price' ] = json_decode($active_goods[ 'active_goods_value' ], true)[ 'newcomer_price' ] ?? 0; - $info[ 'newcomer_desc' ] = $active_goods[ 'active' ][ 'active_desc' ] ?? ''; - $info[ 'limit_num' ] = $active_goods[ 'active' ][ 'active_value' ][ 'limit_num' ] ?? ''; - return $info; - - } - - /** - * 查询商品规格的新人价 - * @param $sku_list - * @return array - */ - public function getNewcomerPriceByList(&$sku_list) - { - $active_goods_model = new ActiveGoods(); - foreach ($sku_list as &$v) { - $active_goods = $active_goods_model->field('active_goods_value')->where([ - [ 'active_goods_status', '=', ActiveDict::ACTIVE ], - [ 'active_goods_type', '=', ActiveDict::GOODS_SINGLE ], - [ 'active_class', '=', ActiveDict::NEWCOMER_DISCOUNT ], - [ 'goods_id', '=', $v[ 'goods_id' ] ], - [ 'sku_id', '=', $v[ 'sku_id' ] ] - ])->findOrEmpty()->toArray(); - - if (empty($active_goods)) { - $v[ 'newcomer_price' ] = $v[ 'price' ]; - $v[ 'is_newcomer' ] = 0; - } else { - $v[ 'newcomer_price' ] = json_decode($active_goods[ 'active_goods_value' ], true)[ 'newcomer_price' ] ?? 0; - $v[ 'is_newcomer' ] = 1; - } - } - return $sku_list; - } - - /** - * 检测当前会员是否满足新人专享活动条件 - * @return bool - */ - public function checkIfNewcomer() - { - return ( new CoreNewcomerService() )->checkIfNewcomer($this->member_id); - } - - /** - * 获取新人专享活动配置 - * @return array - */ - public function getConfig() - { - return ( new CoreNewcomerService() )->getConfig(); - } - -} diff --git a/niucloud/addon/shop/app/service/api/marketing/pointexchange/ExchangeService.php b/niucloud/addon/shop/app/service/api/marketing/pointexchange/ExchangeService.php deleted file mode 100644 index aa9b86a59..000000000 --- a/niucloud/addon/shop/app/service/api/marketing/pointexchange/ExchangeService.php +++ /dev/null @@ -1,170 +0,0 @@ -model = new Exchange(); - } - - /** - * 获取积分商城列表 - * @param array $where - * @return array - */ - public function getPage(array $where = []) - { - $field = 'status,total_exchange_num,stock,id,type,names,title,image,status,product_detail,point,price,limit_num,content,sort,total_point_num,total_price_num,total_order_num,total_member_num,update_time,create_time'; - if (!empty($where[ 'order' ]) && in_array($where[ 'order' ], [ 'total_order_num', 'total_exchange_num', 'price' ])) { - $order = $where[ 'order' ] . ' ' . $where[ 'sort' ]; - } else { - $order = 'total_order_num desc,sort desc'; - } - $search_model = $this->model->where([ [ 'id', '>', 0 ] ])->withSearch([ 'names', 'status', 'create_time' ], $where) - ->append([ 'type_name', 'status_name', 'goods_cover_thumb_small', 'goods_cover_thumb_mid', 'goods_label', 'goods_brand' ])->field($field)->order($order); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 获取积分商城详情 - * @param int $id - * @return array - */ - public function getDetail(int $id) - { - - $field = 'total_exchange_num,id,type,names,title,image,status,product_detail,point,price,limit_num,content,sort,total_point_num,total_price_num,total_order_num,total_member_num,update_time,create_time'; - $info = $this->model->where([ [ 'id', '=', $id ] ])->append([ 'type_name', 'goods_cover_thumb_mid', 'goods_image_thumb_small', 'goods_image_thumb_mid', 'goods_image_thumb_big' ])->field($field)->findOrEmpty()->toArray(); - if (!empty($info)) { - $goods_id = 0; - foreach ($info[ 'product_detail' ] as $k => $v) { - if (!empty($v[ 'goods_id' ])) { - $goods_id = $v[ 'goods_id' ]; - } - } - $goods_info = ( new GoodsService() )->getDetail([ 'goods_id' => $goods_id, 'sku_id' => $info[ 'product_detail' ][ 0 ][ 'sku_id' ] ]); - - $goods_info[ 'goods' ][ 'goods_desc' ] = $info[ 'content' ]; - $goods_info[ 'sale_num' ] = $info[ 'total_exchange_num' ]; - $goods_info[ 'goods' ][ 'goods_name' ] = $info[ 'names' ]; - $goods_info[ 'goods' ][ 'goods_image' ] = $info[ 'image' ]; - $goods_info[ 'goods' ][ 'goods_image_thumb_big' ] = $info[ 'goods_image_thumb_big' ]; - $goods_info[ 'goods' ][ 'goods_cover_thumb_mid' ] = $info[ 'goods_cover_thumb_mid' ]; - $goods_info[ 'goods' ][ 'sub_title' ] = $info[ 'title' ]; - $product_detail_array = $info[ 'product_detail' ]; - $product_detail_array = array_column($product_detail_array, null, 'sku_id'); - $sku_ids = array_keys($product_detail_array); - $reset_sku_id = reset($product_detail_array)[ 'sku_id' ]; - $goods_info[ 'price' ] = $product_detail_array[ $reset_sku_id ][ 'price' ]; -// $goods_info[ 'market_price' ] = $product_detail_array[ $reset_sku_id ][ 'price' ]; - $goods_info[ 'sale_price' ] = $product_detail_array[ $reset_sku_id ][ 'price' ]; - $goods_info[ 'stock' ] = min($goods_info[ 'stock' ], $product_detail_array[ $reset_sku_id ][ 'stock' ]); - $goods_info[ 'point' ] = $product_detail_array[ $reset_sku_id ][ 'point' ]; - $goods_info[ 'exchange_id' ] = $id; - if (!empty($goods_info[ 'skuList' ])) { - foreach ($goods_info[ 'skuList' ] as $k => &$item) { - $item[ 'limit_num' ] = 0; - $item[ 'is_join_exchange' ] = 1; - if (!in_array($item[ 'sku_id' ], $sku_ids)) { - $item[ 'is_join_exchange' ] = 0; - unset($goods_info[ 'skuList' ][ $k ]); - } - $item[ 'point' ] = 0; - $item[ 'is_default' ] = $reset_sku_id == $item[ 'sku_id' ] ? 1 : 0; - if (isset($product_detail_array[ $item[ 'sku_id' ] ])) { - $item[ 'price' ] = $product_detail_array[ $item[ 'sku_id' ] ][ 'price' ]; -// $item[ 'market_price' ] = $product_detail_array[ $item[ 'sku_id' ] ][ 'price' ]; - $item[ 'sale_price' ] = $product_detail_array[ $item[ 'sku_id' ] ][ 'price' ]; - $item[ 'stock' ] = min($item[ 'stock' ], $product_detail_array[ $item[ 'sku_id' ] ][ 'stock' ]); - $item[ 'point' ] = $product_detail_array[ $item[ 'sku_id' ] ][ 'point' ]; - $item[ 'limit_num' ] = $product_detail_array[ $item[ 'sku_id' ] ][ 'limit_num' ]; - } - } - $goods_info[ 'skuList' ] = array_values($goods_info[ 'skuList' ]); - } - } - return $goods_info ?? []; - } - - /** - * 获取积分商城详情 - * @param $where - * @return mixed - */ - public function getInfo($where) - { - $field = 'stock,total_exchange_num,id,type,names,title,image,status,product_detail,point,price,limit_num,content,sort,total_point_num,total_price_num,total_order_num,total_member_num,update_time,create_time'; - $info = $this->model->where([ [ 'id', '>', 0 ] ])->withSearch([ 'names', 'status', 'create_time', 'product_detail', 'sku_id', 'goods_id' ], $where)->append([ 'type_name' ])->field($field)->findOrEmpty()->toArray(); - return $info; - } - - /**********************************************************组件调用***************************************************************************************/ - - - /** - * 获取商品列表供组件调用 - * @param array $where - * @return array - */ - public function getGoodsComponents(array $where = []) - { - $field = 'total_exchange_num,stock,id,type,names,title,image,product_detail,point,price,limit_num,total_point_num,total_price_num,total_order_num,total_member_num'; -// $goods_where[] = [ 'stock', '>', 0 ]; - $goods_where[] = [ 'status', '=', 1 ]; - if (!empty($where[ 'order' ]) && in_array($where[ 'order' ], [ 'total_order_num', 'total_exchange_num', 'price' ])) { - $order = $where[ 'order' ] . ' ' . $where[ 'sort' ]; - } else { - $order = 'total_order_num desc,sort desc'; - } - $list = $this->model->where($goods_where)->withSearch([ 'names', 'ids' ], $where) - ->append([ 'type_name', 'goods_cover_thumb_small','goods_cover_thumb_mid', 'goods_label', 'goods_brand' ]) - ->field($field)->order($order)->limit($where[ 'num' ])->select()->toArray(); - return $list; - } - - /** - * 获取组件调用 会员当前积分数+今日积分数 - * @return array - */ - public function getPointInfo() - { - $point_data = ( new Member() )->where([ [ 'member_id', '=', $this->member_id ] ])->field('point')->findOrEmpty()->toArray(); - $condition = [ - [ 'account_type', '=', MemberAccountTypeDict::POINT ], - [ 'account_data', '>', 0 ], - [ 'member_id', '=', $this->member_id ], - ]; - $today_point = ( new MemberAccountLog() )->where($condition)->whereBetweenTime('create_time', strtotime("today"), strtotime("today") + 86400)->sum('account_data'); - $point_data[ 'today_point' ] = $today_point; - return $point_data; - } - -} diff --git a/niucloud/addon/shop/app/service/api/marketing/pointexchange/OrderCreateService.php b/niucloud/addon/shop/app/service/api/marketing/pointexchange/OrderCreateService.php deleted file mode 100644 index 328d0471c..000000000 --- a/niucloud/addon/shop/app/service/api/marketing/pointexchange/OrderCreateService.php +++ /dev/null @@ -1,82 +0,0 @@ -model = new Order(); - } - - /** - * 计算 - * @param array $data - * @return array - * @throws \Exception - */ - public function calculate(array $data) - { - $data['member_id'] = $this->member_id; - $data['order_from'] = $this->channel; - return (new CoreOrderCreateService())->calculate($data); - } - - /** - * 订单创建 - * @param array $data - * @return array - */ - public function create(array $data) - { - $data['member_id'] = $this->member_id; - $data['order_from'] = $this->channel; - $data['main_type'] = OrderLogDict::MEMBER; - $data['main_id'] = $this->member_id; - return (new CoreOrderCreateService())->create($data); - } - - /** - * @return void - * @todo 获取配送信息(待定) - */ - public function getDelivery(array $data) - { - $data['member_id'] = $this->member_id; - } - - /** - * 查询自提点 - * @param array $data - * @return array - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function getStore(array $data) - { - return (new CoreStoreService())->getStoreList($data); - } -} diff --git a/niucloud/addon/shop/app/service/api/order/ConfigService.php b/niucloud/addon/shop/app/service/api/order/ConfigService.php deleted file mode 100644 index 07abb342e..000000000 --- a/niucloud/addon/shop/app/service/api/order/ConfigService.php +++ /dev/null @@ -1,43 +0,0 @@ -order_config_service = new CoreOrderConfigService(); - } - - /** - * 获取交易设置 - * @return array - */ - public function getConfig() - { - return $this->order_config_service->getConfig(); - } - -} diff --git a/niucloud/addon/shop/app/service/api/order/InvoiceService.php b/niucloud/addon/shop/app/service/api/order/InvoiceService.php deleted file mode 100644 index a848f4f21..000000000 --- a/niucloud/addon/shop/app/service/api/order/InvoiceService.php +++ /dev/null @@ -1,183 +0,0 @@ -model = new Invoice(); - } - - public function pages($data) - { - $where[] = ['member_id', '=', $this->member_id]; - if ($data['status'] != '') { - if ($data['status'] == InvoiceDict::WAIT_INVOICE) {//未开票为待开票和待审核 - $where[] = ['is_invoice', 'in', [InvoiceDict::WAIT_AUDIT, InvoiceDict::WAIT_INVOICE]]; - } else { - $where[] = ['is_invoice', '=', $data['status']]; - } - } - $query = $this->model->field('id,member_id,header_type,header_name,type,name,tax_number,mobile,email,telephone,address,bank_name,bank_card_number,money,is_invoice,invoice_number,invoice_voucher,remark,create_time,invoice_time,pay_voucher') - ->where($where) - ->with([ - 'member' => function ($q) { - $q->field('member_id,nickname,headimg'); - } - ]) - ->append(['header_type_name', 'type_name', 'invoice_type_name', 'pay_voucher_thumb_mid', 'pay_voucher_thumb_small', 'pay_voucher_thumb_big', 'invoice_voucher_thumb_mid', 'invoice_voucher_thumb_small', 'invoice_voucher_thumb_big']) - ->order('create_time desc'); - return $this->pageQuery($query); - } - - public function detail($id) - { - $where[] = ['member_id', '=', $this->member_id]; - $where[] = ['id', '=', $id]; - $info = $this->model->field('id,member_id,header_type,header_name,type,name,tax_number,mobile,email,telephone,address,bank_name,bank_card_number,money,is_invoice,invoice_number,invoice_voucher,remark,create_time,invoice_time,pay_voucher')->where($where)->with(['member' => function ($q) { - $q->field('member_id,nickname,headimg'); - }])->with([ - 'order_list' => function ($q) { - $q->field('invoice_id,order_id,order_no,order_money')->with([ - 'order_goods' => function ($query) { - $query->field('extend,order_goods_id, order_id, member_id, goods_id, sku_id, goods_name, sku_name, goods_image, sku_image, price, num, goods_money, is_enable_refund, delivery_id,is_enable_refund, status, is_gift') - ->with([ - 'order_delivery' => function ($query) { - $query->field('id, express_company_id, express_number')->with('company'); - } - ]) - ->append(['goods_image_thumb_small']); - }, - ]); - } - ]) - ->append(['header_type_name', 'type_name', 'invoice_type_name', 'pay_voucher_thumb_mid', 'pay_voucher_thumb_small', 'pay_voucher_thumb_big', 'invoice_voucher_thumb_mid', 'invoice_voucher_thumb_small', 'invoice_voucher_thumb_big']) - ->findOrEmpty(); - if ($info->isEmpty()) { - throw new ApiException('INVOICE_NOT_EXIST'); - } - return $info->toArray(); - } - - /** - * 用户申请补开发票 - * @param $data - * @return void - */ - public function apply($data) - { - $trade_ids = implode(',', $data['trade_ids']); - $is_apply = $this->model->where([ - 'member_id' => $this->member_id, - 'trade_type' => InvoiceDict::TYPE, - ])->whereIn('trade_id',$trade_ids)->count() > 0; - if ($is_apply) { - throw new ApiException('INVOICE_HAS_ORDER_APPLY'); - } - $member_id = $this->member_id; - $insert = [ - 'member_id' => $member_id, - 'trade_type' => InvoiceDict::TYPE, - 'trade_id' => $trade_ids, - 'pay_voucher' => $data['pay_voucher'], - 'header_type' => $data['header_type'], - 'header_name' => $data['header_name'], - 'type' => $data['type'], - 'name' => $data['name'], - 'tax_number' => $data['tax_number'], - 'mobile' => $data['mobile'], - 'email' => $data['email'], - 'telephone' => $data['telephone'], - 'address' => $data['address'], - 'bank_name' => $data['bank_name'], - 'bank_card_number' => $data['bank_card_number'], - 'money' => $data['money'], - 'create_time' => time(), - 'status' => InvoiceDict::OPEN,//生效 - 'is_invoice' => InvoiceDict::WAIT_AUDIT,//待审核 - ]; - $invoice_id = (new CoreInvoiceService())->add($insert); - (new CoreOrderService())->setInvoiceIdByOrderId(explode(',', $trade_ids), $invoice_id); - } - - /** - * 取消发票申请 - * @param $id - * @return void - */ - public function cancel($id) - { - $info = $this->model->where(['id' => $id, 'member_id' => $this->member_id])->findOrEmpty(); - if ($info->isEmpty()) { - throw new ApiException('INVOICE_NOT_EXIST'); - } - if ($info->is_invoice == InvoiceDict::INVOICED) { - throw new ApiException('INVOICED'); - } - Db::startTrans(); - try { - $this->model->where(['id' => $id, 'member_id' => $this->member_id])->delete(); - (new CoreOrderService())->cancelInvoiceId($id); - Db::commit(); - } catch (ApiException $e) { - Db::rollback(); - throw new ApiException('INVOICE_CANCEL_ERROR'); - } - } - - /** - * 编辑发票信息 - * @param $data - * @return void - */ - public function edit($data) - { - $id = $data['id']; - $invoice_info = $this->model->where(['id' => $id, 'member_id' => $this->member_id])->findOrEmpty(); - if ($invoice_info->isEmpty()) { - throw new ApiException('INVOICE_NOT_EXIST'); - } - if ($invoice_info->is_invoice == InvoiceDict::INVOICED) { - throw new ApiException('INVOICED'); - } - $this->model->where(['id' => $id, 'member_id' => $this->member_id])->update([ - 'trade_type' => InvoiceDict::TYPE, - 'pay_voucher' => $data['pay_voucher'], - 'header_type' => $data['header_type'], - 'header_name' => $data['header_name'], - 'type' => $data['type'], - 'name' => $data['name'], - 'tax_number' => $data['tax_number'], - 'mobile' => $data['mobile'], - 'email' => $data['email'], - 'telephone' => $data['telephone'], - 'address' => $data['address'], - 'bank_name' => $data['bank_name'], - 'bank_card_number' => $data['bank_card_number'], - 'money' => $data['money'], - ]); - } - -} diff --git a/niucloud/addon/shop/app/service/api/order/OrderCreateService.php b/niucloud/addon/shop/app/service/api/order/OrderCreateService.php deleted file mode 100644 index 413696518..000000000 --- a/niucloud/addon/shop/app/service/api/order/OrderCreateService.php +++ /dev/null @@ -1,109 +0,0 @@ -model = new Order(); - } - - /** - * 订单创建 - * @param array $data - * @return array - */ - public function create(array $data) - { - $data['member_id'] = $this->member_id; - $data['order_from'] = $this->channel; - $data['main_type'] = OrderLogDict::MEMBER; - $data['main_id'] = $this->member_id; - return (new CoreOrderCreateService())->create($data); - } - - /** - * 计算 - * @param array $data - * @return void|null - */ - public function calculate(array $data) - { - $data['member_id'] = $this->member_id; - $data['order_from'] = $this->channel; - return (new CoreOrderCreateService())->calculate($data); - } - - /** - * 确认订单数据 - * @param array $data - * @return void - */ -// public function confirm(array $data) -// { -// $data['member_id'] = $this->member_id; -// return (new CoreOrderCreateService())->confirm($data); -// } - - /** - * 获取优惠券列表 - * @param array $data - * @return void|null - */ - public function getCoupon(array $data) - { - $data['member_id'] = $this->member_id; - return (new CoreOrderCreateService())->getCoupon($data); - } - - /** - * @return void - * @todo 获取配送信息(待定) - */ - public function getDelivery(array $data) - { - $data['member_id'] = $this->member_id; - } - - /** - * 查询自提点 - * @param array $data - * @return array - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function getStore(array $data) - { - return (new CoreStoreService())->getStoreList($data); - } - - public function getLocalDeliveryConfig() - { - return (new Local())->where([['local_id', '>', 0]])->findOrEmpty()->toArray(); - } -} diff --git a/niucloud/addon/shop/app/service/api/order/OrderPayService.php b/niucloud/addon/shop/app/service/api/order/OrderPayService.php deleted file mode 100644 index badb99fe0..000000000 --- a/niucloud/addon/shop/app/service/api/order/OrderPayService.php +++ /dev/null @@ -1,28 +0,0 @@ -model = new Order(); - } - -} diff --git a/niucloud/addon/shop/app/service/api/order/OrderService.php b/niucloud/addon/shop/app/service/api/order/OrderService.php deleted file mode 100644 index 10e488781..000000000 --- a/niucloud/addon/shop/app/service/api/order/OrderService.php +++ /dev/null @@ -1,411 +0,0 @@ -model = new Order(); - } - - /** - * 分页列表 - * @param array $where - * @return array - */ - public function getPage(array $where) - { - $field = 'point,activity_type,order_id,order_no,close_type,order_type,order_from,out_trade_no,status,member_id,ip,goods_money,delivery_money,order_money,create_time,pay_time,delivery_type,taker_name,taker_mobile,taker_full_address,take_store_id,is_enable_refund,member_remark,shop_remark,close_remark,pay_money,is_evaluate,invoice_id'; - $order = 'create_time desc'; - $search_model = $this->model - ->where([['member_id', '=', $this->member_id]]) - ->withSearch(['order_no', 'status', 'activity_type','body'], $where) - ->field($field) - ->with( - [ - 'invoice' => function ($query) { - $query->field('id'); - }, - 'order_goods' => function ($query) { - $query->field('extend,order_goods_id, order_id, member_id, goods_id, sku_id, goods_name, sku_name, goods_image, sku_image, price, num, goods_money, is_enable_refund, delivery_id,is_enable_refund, status, is_gift') - ->with([ - 'order_delivery' => function ($query) { - $query->field('id, express_company_id, express_number')->with('company'); - } - ]) - ->append(['goods_image_thumb_small']); - }, - 'store' => function ($query) { - $query->field('store_id, store_name, store_mobile'); - } - ] - )->order($order)->append(['order_from_name', 'order_type_name', 'activity_type_name', 'status_name', 'delivery_type_name']); - $order_status_list = OrderDict::getStatus(); - $order_close_list = OrderDict::getCloseType(); - $list = $this->pageQuery($search_model, function ($item, $key) use ($order_status_list, $order_close_list) { - $item['close_type_name'] = $order_close_list[$item['close_type']] ?? ""; - $item['order_status_data'] = $order_status_list[$item['status']] ?? []; - }); - $config = (new CoreOrderConfigService())->getConfig(); - $close_length = $config['close_order_info']['close_length']; - foreach ($list['data'] as $k => $v) { - - $list['data'][$k]['now_time'] = time(); - $list['data'][$k]['expire_time'] = strtotime($v['create_time']) + 60 * $close_length; - if ($v['out_trade_no']) { - $list['data'][$k]['pay'] = (new Pay())->where([['out_trade_no', '=', $v['out_trade_no']]]) - ->field('type, pay_time')->append(['type_name']) - ->findOrEmpty()->toArray(); - } - if ($v['order_goods']) { - foreach ($v['order_goods'] as $kk => $vv) { - $goods_info = (new Goods())->field('unit')->where([['goods_id', '=', $vv['goods_id']]])->findOrEmpty()->toArray(); - if (!empty($goods_info)) { - $v['order_goods'][$kk]['unit'] = $goods_info['unit']; - } else { - $v['order_goods'][$kk]['unit'] = '件'; - } - } - $list['data'][$k]['order_goods'] = $v['order_goods']; - } - $list['data'][$k]['is_can_invoice'] = 1; - if (!empty($v['invoice']) || !in_array($v['status'], [OrderDict::WAIT_DELIVERY, OrderDict::WAIT_TAKE, OrderDict::FINISH]) || ($v['order_money'] == 0)) { - $list['data'][$k]['is_can_invoice'] = 0; - } - } - - // 查询小程序是否已开通发货信息管理服务 - try { - $list['mch_id'] = ''; - $result_is_trade_managed = (new WeappDeliveryService())->getIsTradeManaged(); - if ($result_is_trade_managed) { - - $list['is_trade_managed'] = true; - $pay_service = new PayChannelService(); - $pay_config = $pay_service->getInfo([ - 'type' => PayDict::WECHATPAY, - 'channel' => ChannelDict::WEAPP - ]); - - $mch_id = ''; - if (!empty($pay_config)) { - $mch_id = $pay_config['config']['mch_id']; - } - - $list['mch_id'] = $mch_id; - } else { - $list['is_trade_managed'] = false; - } - } catch (\Exception $e) { - $list['is_trade_managed'] = false; - } - return $list; - } - - /** - * 详情 - * @param $order_id - * @return array - */ - public function getDetail($order_id) - { - $field = 'buyer_ask_delivery_time,relate_id,activity_type,point,order_id,order_no,order_type,order_from,out_trade_no,status,member_id,ip,goods_money,delivery_money,order_money,invoice_id,create_time,pay_time,delivery_time,take_time,finish_time,close_time,delivery_type,taker_name,taker_mobile,taker_province,taker_city,taker_district,taker_address,taker_full_address,taker_longitude,taker_latitude,take_store_id,is_enable_refund,member_remark,shop_remark,close_remark,discount_money,is_evaluate,form_record_id'; - $info = $this->model->where([['order_id|out_trade_no', '=', $order_id], ['member_id', '=', $this->member_id]])->field($field) - ->with( - [ - 'order_goods' => function ($query) { - $query->field('extend,order_goods_id, order_id, member_id, goods_id, sku_id, goods_name, sku_name, goods_image, sku_image, price, num, goods_money, discount_money, is_enable_refund, status, order_refund_no, delivery_status, verify_count, verify_expire_time, is_verify, goods_type, is_gift,form_record_id')->append(['goods_image_thumb_small']); - }, - 'order_discount' => function ($query) { - $query->field('order_id,discount_type,money'); - }, - 'invoice' => function ($query) { - $query->field('id'); - } - ] - )->append(['order_from_name', 'order_type_name', 'status_name', 'delivery_type_name'])->findOrEmpty()->toArray(); - if (!empty($info)) { - $info['is_can_invoice'] = 1; - //已开票或者未支付 或已关闭订单不允许补开发票 - if (!empty($info['invoice']) || ($info['order_money'] == 0) || !in_array($info['status'], [OrderDict::WAIT_DELIVERY, OrderDict::WAIT_TAKE, OrderDict::FINISH])) { - $info['is_can_invoice'] = 0; - } - $info['order_status_data'] = $order_status_list[$info['status']] ?? []; - - if ($info['delivery_type'] == DeliveryDict::STORE) { - $info['store'] = (new Store())->where([['store_id', '=', $info['take_store_id']]]) - ->field('store_id, store_name, store_mobile, store_logo, trade_time, longitude, latitude, full_address') - ->findOrEmpty()->toArray(); - } - - if ($info['out_trade_no']) { - $info['pay'] = (new Pay())->where([['out_trade_no', '=', $info['out_trade_no']]]) - ->field('main_id, out_trade_no, type, pay_time, status')->append(['type_name']) - ->findOrEmpty()->toArray(); - if (!empty($info['pay'])) { - if ($info['member_id'] != $info['pay']['main_id']) { - $member_info = (new Member())->field('nickname,headimg')->where([['member_id', '=', $info['pay']['main_id']]])->findOrEmpty()->toArray(); - if (!empty($member_info)) { - $info['pay']['pay_member'] = $member_info['nickname']; - $info['pay']['pay_member_headimg'] = $member_info['headimg']; - } - } - } - } - - if ($info['delivery_type'] == DeliveryDict::EXPRESS || $info['delivery_type'] == DeliveryDict::LOCAL_DELIVERY) { - $info['order_delivery'] = (new OrderDelivery()) - ->where([['order_id', '=', $info['order_id']]]) - ->field('id, order_id, name, delivery_type, sub_delivery_type,express_company_id, express_number, create_time,local_delivery_order_id') - ->select()->toArray(); - if ($info['delivery_type'] == DeliveryDict::LOCAL_DELIVERY) { - if (!empty($info['order_delivery'])) { - $local_delivery_order_id = $info['order_delivery'][0]['local_delivery_order_id']; - $local_delivery_order_info = (new CoreLocalDeliveryService()) ->getLocalDeliveryOrderInfo($local_delivery_order_id); - $info = array_merge($info, $local_delivery_order_info); - } - } - } - - if ($info['order_goods']) { - foreach ($info['order_goods'] as $k => &$v) { - $goods_info = (new Goods())->field('unit')->where([['goods_id', '=', $v['goods_id']]])->findOrEmpty()->toArray(); - if (!empty($goods_info)) { - $v['unit'] = $goods_info['unit']; - } else { - $v['unit'] = '件'; - } - if (isset($v['extend']['is_impulse_buy']) == 1) { - $impulse_buy_num = $v['extend']['impulse_buy_goods_num'] ?? 0;//5 - $impulse_buy_price_total = $v['extend']['impulse_buy_price'] ?? 0; - if ($impulse_buy_num > 0) { - $impulse_buy_price = $impulse_buy_price_total / $impulse_buy_num; - if ($impulse_buy_num == 1) { - $impulse_buy_tips = '第1' . $v['unit'] . $impulse_buy_price . '元'; - } else { - $impulse_buy_tips = '第1-' . $impulse_buy_num . $v['unit'] . $impulse_buy_price . '元'; - if ($v['num'] > $impulse_buy_num) { - if ($impulse_buy_num + 1 == $v['num']) { - $impulse_buy_tips .= ' 第' . ($impulse_buy_num + 1) . $v['unit'] . $v['price'] . '元'; - } else { - $impulse_buy_tips .= ' 第' . ($impulse_buy_num + 1) . '-' . $v['num'] . $v['unit'] . $v['price'] . '元'; - } - } - } - } else {//全原价 - $impulse_buy_tips = '第1-' . $v['num'] . $v['unit'] . $v['price'] . '元'; - } - } - $v['impulse_buy_tips'] = $impulse_buy_tips ?? ""; - (new CoreManjianService())->getOrderGoodsGiveInfo($v, $info['order_goods'], $this->member_id); - } - } - - $coupon_money = 0; - $manjian_discount_money = 0; - if ($info['order_discount']) { - foreach ($info['order_discount'] as $item) { - if ($item['discount_type'] == 'coupon') { - $coupon_money += $item['money']; - } - if ($item['discount_type'] == 'manjian') { - $manjian_discount_money += $item['money']; - } - } - } - $info['coupon_money'] = number_format($coupon_money, 2, '.', ''); - $info['manjian_discount_money'] = number_format($manjian_discount_money, 2, '.', ''); - - // 查询小程序是否已开通发货信息管理服务 - try { - $info['mch_id'] = ''; - $result_is_trade_managed = (new WeappDeliveryService())->getIsTradeManaged(); - if ($result_is_trade_managed) { - $info['is_trade_managed'] = true; - - $pay_service = new PayChannelService(); - $pay_config = $pay_service->getInfo([ - 'type' => PayDict::WECHATPAY, - 'channel' => ChannelDict::WEAPP - ]); - - $mch_id = ''; - if (!empty($pay_config)) { - $mch_id = $pay_config['config']['mch_id']; - } - - $info['mch_id'] = $mch_id; - } else { - $info['is_trade_managed'] = false; - } - } catch (\Exception $e) { - $info['is_trade_managed'] = false; - } - - $config = (new CoreOrderConfigService())->getConfig(); - $close_length = $config['close_order_info']['close_length']; - - $info['now_time'] = time(); - $info['expire_time'] = strtotime($info['create_time']) + 60 * $close_length; - - } - return $info; - } - - - /** - * 订单关闭 - * @param int $order_id - * @return true - */ - public function close(int $order_id) - { - $data['main_type'] = OrderLogDict::MEMBER; - $data['main_id'] = $this->member_id; - $data['close_type'] = OrderDict::BUYER_CLOSE; - $data['order_id'] = $order_id; - (new CoreOrderCloseService())->close($data); - return true; - } - - - /** - * 订单收货 - * @param $order_id - * @return true - */ - public function finish($order_id) - { - $data = []; - $data['order_id'] = $order_id; - $data['main_type'] = OrderLogDict::MEMBER; - $data['main_id'] = $this->member_id; - //查询订单 - $where = array( - ['order_id', '=', $order_id], - ); - $order = $this->model->where($where)->findOrEmpty()->toArray(); - if (empty($order)) throw new ApiException('SHOP_ORDER_NOT_FOUND');//订单不存在 - if ($order['status'] != OrderDict::WAIT_TAKE) throw new ApiException('SHOP_ONLY_WAIT_TAKE_CAN_BE_TAKE');//只有待收货的订单才可以收货 - (new CoreOrderFinishService())->finish($data); - return true; - } - - /** - * 物流信息 - * @param $data - * @return array|mixed - */ - public function getDeliveryPackage($data) - { - $field = 'id, order_id, name, delivery_type, sub_delivery_type, express_company_id, express_number, local_deliver_id, status, create_time'; - $info = (new OrderDelivery())->where([['id', '=', $data['id']]])->with([ - 'company' => function ($query) { - $query->field('company_id, company_name, express_no'); - }, - 'order_goods' => function ($query) { - $query->field('goods_name, sku_name, goods_image, delivery_id, num, price')->append(['goods_image_thumb_small']); - } - ])->field($field)->findOrEmpty()->toArray(); - - if (!empty($info) && $info['delivery_type'] == OrderDeliveryDict::EXPRESS && $info['sub_delivery_type'] != OrderDeliveryDict::NONE_EXPRESS) { - $info['mobile'] = $data['mobile']; - $info = (new CoreOrderService())->deliverySearch($info); - return $info; - } - return $info; - } - - public function num() - { - - $data['wait_pay'] = $this->model->where([ - ['member_id', '=', $this->member_id], - ['status', '=', OrderDict::WAIT_PAY], - ])->count() ?? 0; - - $data['wait_shipping'] = $this->model->where([ - ['member_id', '=', $this->member_id], - ['status', '=', OrderDict::WAIT_DELIVERY], - ])->count() ?? 0; - - $data['wait_take'] = $this->model->where([ - ['member_id', '=', $this->member_id], - ['status', '=', OrderDict::WAIT_TAKE], - ])->count() ?? 0; - - $data['evaluate'] = $this->model->where([ - ['member_id', '=', $this->member_id], - ['status', '=', OrderDict::FINISH], - ['is_evaluate', '=', 0], - ])->count() ?? 0; - - $data['refund'] = (new OrderRefund())->where([ - ['member_id', '=', $this->member_id], - ['status', 'in', [ - OrderRefundDict::BUYER_APPLY_WAIT_STORE, - OrderRefundDict::STORE_AGREE_REFUND_GOODS_APPLY_WAIT_BUYER, - OrderRefundDict::STORE_REFUSE_REFUND_GOODS_APPLY_WAIT_BUYER, - OrderRefundDict::BUYER_REFUND_GOODS_WAIT_STORE, - OrderRefundDict::STORE_REFUSE_TAKE_REFUND_GOODS_WAIT_BUYER, - OrderRefundDict::STORE_AGREE_REFUND_WAIT_TRANSFER, - OrderRefundDict::STORE_REFUND_TRANSFERING - ]] - ])->count() ?? 0; - - return $data; - } - - public function calculateInvoiceMoney($ids) - { - $order_money = $this->model->whereIn('order_id', $ids)->where('invoice_id',0)->sum('order_money'); - return [ - 'invoice_money' => $order_money, - ]; - } -} diff --git a/niucloud/addon/shop/app/service/api/refund/RefundActionService.php b/niucloud/addon/shop/app/service/api/refund/RefundActionService.php deleted file mode 100644 index c6302ca1f..000000000 --- a/niucloud/addon/shop/app/service/api/refund/RefundActionService.php +++ /dev/null @@ -1,363 +0,0 @@ -model = new OrderRefund(); - } - - /** - * 退款申请 - * @param $data - * @return true - */ - public function apply($data) - { - $order_goods_id = $data['order_goods_id']; - //查询订单项信息 - $order_goods_model = new OrderGoods(); - $order_goods_info = $order_goods_model->where([ - ['order_goods_id', '=', $order_goods_id], - ['member_id', '=', $this->member_id] - ])->findOrEmpty(); - if ($order_goods_info->isEmpty()) throw new ApiException('SHOP_ORDER_IS_INVALID');//订单已失效 - if(!$order_goods_info['is_enable_refund']) throw new ApiException('SHOP_ORDER_IS_NOT_ENABLE_REFUND');//订单不允许退款 - //查询有没有正没有关闭的退款 - if ($order_goods_info['status'] != OrderGoodsDict::NORMAL) throw new ApiException('SHOP_ORDER_REFUND_IS_REFUND_FINISH');//订单已退款或存在未完成的退款 - $order_id = $order_goods_info['order_id'];//订单id - $order = (new Order())->where([['order_id', '=', $order_id]])->findOrEmpty(); - if ($order->isEmpty()) throw new ApiException('SHOP_ORDER_IS_INVALID');//订单已失效 - $order_refund_no = create_no(); - $refund_type = $data['refund_type']; - //只有已发货,才能退货退款 - if($refund_type == OrderRefundDict::RETURN_AND_REFUND_GOODS && $order_goods_info['delivery_status'] == OrderDeliveryDict::WAIT_DELIVERY) throw new ApiException('SHOP_ORDER_REFUND_DELIVERY_NOT_ALLOW_REFUND_GOODS'); - $apply_money = $data['apply_money']; - - //查询是否是最后一笔退款且还没有退运费 - $order_goods_count = $order_goods_model->where([['order_id', '=', $order_id], ['is_gift', '=', 0]])->count(); - $refund_count = $this->model->where([['order_id', '=', $order_id]])->whereNotIn( - 'status', [OrderRefundDict::CLOSE, OrderRefundDict::SHOP_ACTIVE_CLOSE_REFUND] - )->count(); - //是否包含运费 - $is_refund_delivery = 0; - if(($refund_count + 1) >= $order_goods_count){//最后一笔退款 - //判断是否已经退过运费 - $refund_delivery_count = $this->model->where([['order_id', '=', $order_id], ['is_refund_delivery', '=', 1]])->whereNotIn( - 'status', [OrderRefundDict::CLOSE, OrderRefundDict::SHOP_ACTIVE_CLOSE_REFUND] - )->count(); - if($refund_delivery_count == 0){//已经退过运费的,就不需要重复再退了 - $is_refund_delivery = 1; - } - } - //当前订单项最大可退金额 - $max_refund_money = $order_goods_info['goods_money'] - $order_goods_info['discount_money'];//可退金额 - if($is_refund_delivery == 1){ - $max_refund_money += $order['delivery_money']; - } - //退款金额不能大于可退款总额 - $comparison = bccomp(bcsub($apply_money, $max_refund_money), 0);//浮点数直接进行比较会出现精度问题 - if ($comparison > 0) throw new ApiException('SHOP_ORDER_REFUND_MONEY_GT_ORDER_MONEY');//退款金额不能大于可退款总额 - $reason = $data['reason']; - $insert_data = [ - 'order_id' => $order_goods_info['order_id'], - 'order_goods_id' => $order_goods_id, - 'order_refund_no' => $order_refund_no, - 'refund_type' => $refund_type, - 'reason' => $reason, - 'member_id' => $this->member_id, - 'apply_money' => $apply_money, - 'status' => OrderRefundDict::BUYER_APPLY_WAIT_STORE, - 'remark' => $data['remark'], - 'voucher' => $data['voucher'], - 'source' => OrderRefundDict::APPLY, - 'is_refund_delivery' => $is_refund_delivery ?? 0, - ]; - $this->model->create($insert_data); - - //将订单项的退款单号覆盖 - $order_goods_info->save([ - 'order_refund_no' => $order_refund_no, - 'status' => OrderGoodsDict::REFUNDING - ]); - //订单申请退款后事件 - event('AfterShopOrderRefundApply', ['order_refund_no' => $order_refund_no, 'refund_data' => $insert_data]); - return true; - } - - /** - * 售后 - * @param $data - * @return true - */ - public function edit($data) - { - $order_refund_no = $data['order_refund_no']; - //查询订单项信息 - $order_refund_info = $this->model->where([ - ['order_refund_no', '=', $order_refund_no], - ['member_id', '=', $this->member_id] - ])->findOrEmpty(); - if ($order_refund_info->isEmpty()) throw new ApiException('SHOP_ORDER_IS_INVALID');//退款已失效 - if (!in_array($order_refund_info['status'], [OrderRefundDict::BUYER_APPLY_WAIT_STORE, OrderRefundDict::STORE_REFUSE_REFUND_GOODS_APPLY_WAIT_BUYER])) throw new ApiException('SHOP_ORDER_IS_INVALID');//退款已失效(只有被拒绝的请求才可以修改退款) - $refund_type = $data['refund_type']; - $apply_money = $data['apply_money']; - - $order_goods_id = $order_refund_info['order_goods_id']; - //查询订单项信息 - $order_goods_info = (new OrderGoods())->where([ - ['order_goods_id', '=', $order_goods_id], - ['member_id', '=', $this->member_id] - ])->findOrEmpty(); - if ($order_goods_info->isEmpty()) throw new ApiException('SHOP_ORDER_REFUND_IS_INVALID');//订单已失效 - - $order_id = $order_goods_info['order_id'];//订单id - $order = (new Order())->where([['order_id', '=', $order_id]])->findOrEmpty(); - if ($order->isEmpty()) throw new ApiException('SHOP_ORDER_IS_INVALID');//订单已失效 - - //是否包含运费 - $is_refund_delivery = $order_refund_info['is_refund_delivery']; - //当前订单项最大可退金额 - $max_refund_money = $order_goods_info['goods_money'] - $order_goods_info['discount_money'];//可退金额 - if($is_refund_delivery == 1){ - $max_refund_money += $order['delivery_money']; - } - - //退款金额不能大于可退款总额 - $comparison = bccomp(bcsub($apply_money, $max_refund_money), 0);//浮点数直接进行比较会出现精度问题 - if ($comparison > 0) throw new ApiException('SHOP_ORDER_REFUND_MONEY_GT_ORDER_MONEY');//退款金额不能大于可退款总额 - $reason = $data['reason']; - $update_data = [ - 'refund_type' => $refund_type, - 'reason' => $reason, - 'apply_money' => $apply_money, - 'status' => OrderRefundDict::BUYER_APPLY_WAIT_STORE, - 'remark' => $data['remark'], - 'voucher' => $data['voucher'], - 'source' => OrderRefundDict::APPLY, - 'shop_reason'=>'' // 再次申请退款,清空拒绝理由 - ]; - $order_refund_info->save($update_data); - //订单申请退款后事件 - event('AfterShopOrderRefundEdit', [ 'order_refund_no' => $order_refund_no, 'refund_data' => array_merge($order_refund_info->toArray(), $update_data)]); - return true; - } - - /** - * 退款关闭 - * @param $data - * @return true - */ - public function close($data) - { - $data[ 'main_type' ] = OrderRefundLogDict::MEMBER; - $data[ 'main_id' ] = $this->member_id; - (new CoreRefundActionService())->close($data); - return true; - } - - /** - * 退款发货 - * @param $data - * @return true - */ - public function delivery($data) - { - $order_refund_no = $data['order_refund_no']; - //查询订单项信息 - $order_refund_info = $this->model->where([ - ['order_refund_no', '=', $order_refund_no], - ['member_id', '=', $this->member_id] - ])->findOrEmpty(); - if ($order_refund_info->isEmpty()) throw new ApiException('SHOP_ORDER_REFUND_IS_INVALID');//退款已失效 - if ($order_refund_info['status'] != OrderRefundDict::STORE_AGREE_REFUND_GOODS_APPLY_WAIT_BUYER) throw new ApiException('SHOP_ORDER_REFUND_STATUS_NOT_SUPPORT_ACTION');//退款已失效(只有被拒绝的请求才可以修改退货) - - $order_goods_id = $order_refund_info['order_goods_id']; - //查询订单项信息 - $order_goods_info = (new OrderGoods())->where([ - ['order_goods_id', '=', $order_goods_id], - ['member_id', '=', $this->member_id] - ])->findOrEmpty(); - if ($order_goods_info->isEmpty()) throw new ApiException('SHOP_ORDER_REFUND_IS_INVALID');//订单已失效 - //todo 配送信息增加 - $delivery_param = $data['delivery']; - $delivery = array( - 'express_number' => $delivery_param['express_number'], - 'express_company' => $delivery_param['express_company'], - 'remark' => $delivery_param['remark'], - ); - $update_data = [ - 'delivery' => $delivery, - 'status' => OrderRefundDict::BUYER_REFUND_GOODS_WAIT_STORE, - ]; - $order_refund_info->save($update_data); - //订单申请退款后事件 - event('AfterShopOrderRefundDelivery', ['main_type' => OrderRefundLogDict::MEMBER, 'main_id' => $this->member_id, 'order_refund_no' => $order_refund_no, 'refund_data' => array_merge($order_refund_info->toArray(), $update_data)]); - return true; - } - - /** - * 修改发货信息 - * @param $data - * @return true - */ - public function editDelivery($data) - { - $order_refund_no = $data['order_refund_no']; - //查询订单项信息 - $order_refund_info = $this->model->where([ - ['order_refund_no', '=', $order_refund_no], - ['member_id', '=', $this->member_id] - ])->findOrEmpty(); - if ($order_refund_info->isEmpty()) throw new ApiException('SHOP_ORDER_REFUND_IS_INVALID');//退款已失效 - if (!in_array($order_refund_info['status'], [OrderRefundDict::STORE_REFUSE_TAKE_REFUND_GOODS_WAIT_BUYER, OrderRefundDict::BUYER_REFUND_GOODS_WAIT_STORE])) throw new ApiException('SHOP_ORDER_REFUND_STATUS_NOT_SUPPORT_ACTION');//退款已失效(只有被拒绝的请求才可以修改退款) - $order_goods_id = $order_refund_info['order_goods_id']; - //查询订单项信息 - $order_goods_info = (new OrderGoods())->where([ - ['order_goods_id', '=', $order_goods_id], - ['member_id', '=', $this->member_id] - ])->findOrEmpty(); - if ($order_goods_info->isEmpty()) throw new ApiException('SHOP_ORDER_IS_INVALID');//订单已失效 - //todo 配送信息增加 - $delivery_param = $data['delivery']; - $delivery = array( - 'express_number' => $delivery_param['express_number'], - 'express_company' => $delivery_param['express_company'], - 'remark' => $delivery_param['remark'], - ); - $update_data = [ - 'delivery' => $delivery, - 'status' => OrderRefundDict::BUYER_REFUND_GOODS_WAIT_STORE, - ]; - $order_refund_info->save($update_data); - //订单申请退款后事件 - event('AfterShopOrderRefundEditDelivery', ['main_type' => OrderRefundLogDict::MEMBER, 'main_id' => $this->member_id, 'order_refund_no' => $order_refund_no, 'refund_data' => array_merge($order_refund_info->toArray(), $update_data)]); - return true; - } - - /** - * - * @return array - */ - public function getRefundReason() - { - return OrderRefundDict::getRefundReason(); - } - - /** - * 获取订单项可退款属性 - * @param $data - * @return void - */ - public function getRefundData($data){ - $order_goods_id = $data['order_goods_id']; - //查询订单项信息 - $order_goods_model = new OrderGoods(); - $order_goods_info = $order_goods_model->where([ - ['order_goods_id', '=', $order_goods_id], - ['member_id', '=', $this->member_id] - ])->findOrEmpty(); - if ($order_goods_info->isEmpty()) throw new ApiException('SHOP_ORDER_IS_INVALID');//订单已失效 -// if(!$order_goods_info['is_enable_refund']) throw new ApiException('SHOP_ORDER_IS_NOT_ENABLE_REFUND');//订单不允许退款 - //查询有没有正没有关闭的退款 -// if ($order_goods_info['status'] != OrderGoodsDict::NORMAL) throw new ApiException('SHOP_ORDER_REFUND_IS_REFUND_FINISH');//订单已退款或存在未完成的退款 - $order_id = $order_goods_info['order_id'];//订单id - $order = (new Order())->where([['order_id', '=', $order_id]])->findOrEmpty(); - if ($order->isEmpty()) throw new ApiException('SHOP_ORDER_IS_INVALID');//订单已失效 - - //查询是否是最后一笔退款且还没有退运费 - $order_goods_count = $order_goods_model->where([['order_id', '=', $order_id], ['is_gift', '=', 0]])->count(); - $refund_count = $this->model->where([['order_id', '=', $order_id]])->whereNotIn( - 'status', [OrderRefundDict::CLOSE, OrderRefundDict::SHOP_ACTIVE_CLOSE_REFUND] - )->count(); - $is_refund_delivery = 0; - if(($refund_count + 1) >= $order_goods_count){//最后一笔退款 - //判断是否已经退过运费 - $refund_delivery_count = $this->model->where([['order_id', '=', $order_id], ['is_refund_delivery', '=', 1]])->whereNotIn( - 'status', [OrderRefundDict::CLOSE, OrderRefundDict::SHOP_ACTIVE_CLOSE_REFUND] - )->count(); - if($refund_delivery_count == 0){//已经退过运费的,就不需要重复再退了 -// $refund_delivery_money = $order['delivery_money']; - $is_refund_delivery = 1; - } - } - $refund_data = [ - 'refund_money' => $order_goods_info['order_goods_money'], - 'is_refund_delivery' => $is_refund_delivery, - 'refund_order_goods_money' => $order_goods_info['order_goods_money'] - ]; - if($is_refund_delivery){ - $refund_data['refund_money'] += $order['delivery_money']; - $refund_data['refund_delivery_money'] = $order['delivery_money']; - } - return $refund_data; - } - - /** - * 通过退款单号获取退款信息 - * @param array $data - * @return void - */ - public function getRefundDataByOrderRefundNo($data) - { - $order_refund_no = $data['order_refund_no']; - - $order_refund_info = $this->model->where([ - ['order_refund_no', '=', $order_refund_no], - ['member_id', '=', $this->member_id] - ])->findOrEmpty(); - if ($order_refund_info->isEmpty()) throw new ApiException('SHOP_ORDER_IS_INVALID');//退款已失效 - $order_goods_id = $order_refund_info['order_goods_id'];//订单id - $order_id = $order_refund_info['order_id'];//订单id - //查询订单项信息 - $order_goods_model = new OrderGoods(); - $order_goods_info = $order_goods_model->where([ - ['order_goods_id', '=', $order_goods_id], - ['member_id', '=', $this->member_id] - ])->findOrEmpty(); - if ($order_goods_info->isEmpty()) throw new ApiException('SHOP_ORDER_IS_INVALID');//订单已失效 - - $order = (new Order())->where([['order_id', '=', $order_id]])->findOrEmpty(); - if ($order->isEmpty()) throw new ApiException('SHOP_ORDER_IS_INVALID');//订单已失效 - - //判断是否已经退过运费 - $is_refund_delivery = $order_refund_info['is_refund_delivery']; - $refund_data = [ - 'refund_money' => $order_goods_info['order_goods_money'], - 'is_refund_delivery' => $is_refund_delivery, - 'refund_order_goods_money' => $order_goods_info['order_goods_money'] - ]; - if($is_refund_delivery){ - $refund_data['refund_money'] += $order['delivery_money']; - $refund_data['refund_delivery_money'] = $order['delivery_money']; - } - return $refund_data; - } - -} diff --git a/niucloud/addon/shop/app/service/api/refund/RefundService.php b/niucloud/addon/shop/app/service/api/refund/RefundService.php deleted file mode 100644 index 5256900eb..000000000 --- a/niucloud/addon/shop/app/service/api/refund/RefundService.php +++ /dev/null @@ -1,72 +0,0 @@ -model = new OrderRefund(); - } - - /** - * 分页列表 - * @param array $where - * @return array - */ - public function getPage(array $where) - { - $field = 'refund_id, order_id, order_goods_id, order_refund_no, refund_type, reason, member_id, apply_money, money, status, create_time, transfer_time, remark, voucher, source, timeout, refund_no, delivery, shop_reason, refund_address'; - $order = 'create_time desc'; - - $search_model = $this->model - ->where([ [ 'member_id', '=', $this->member_id ] ]) - ->withSearch([ 'status' ], $where) - ->field($field) - ->with( - [ - 'order_goods' => function($query) { - $query->field('order_goods_id, order_id, member_id, goods_id, sku_id, goods_name, sku_name, goods_image, sku_image, price, num, goods_money,discount_money, is_enable_refund, goods_type, order_goods_money, discount_money')->append([ 'goods_image_thumb_small' ]); - }, - ])->order($order)->append([ 'status_name', 'refund_type_name' ]); - $list = $this->pageQuery($search_model); - return $list; - } - - /** - * 详情 - * @param string $order_refund_no - * @return array - */ - public function getDetail(string $order_refund_no) - { - $field = 'refund_id, order_id, order_goods_id, order_refund_no, refund_type, reason, member_id, apply_money, money, status, create_time, transfer_time, remark, voucher, source, timeout, refund_no, delivery, shop_reason, refund_address'; - $info = $this->model->where([ [ 'order_refund_no', '=', $order_refund_no ], [ 'member_id', '=', $this->member_id ] ])->field($field) - ->with([ - 'order_goods' => function($query) { - $query->field('extend,order_goods_id, order_id, member_id, goods_id, sku_id, goods_name, sku_name, goods_image, sku_image, price, num, goods_money, discount_money, is_enable_refund, status, order_refund_no, delivery_status, verify_count, verify_expire_time, is_verify, goods_type')->append([ 'goods_image_thumb_small' ]); - }, - 'refund_log' => function($query) { - $query->field('order_refund_no, content, main_type, create_time ,main_id,type')->order("create_time desc, id desc")->append([ 'main_name', 'main_type_name', 'type_name' ]); - } - ])->append([ 'status_name', 'refund_type_name' ])->findOrEmpty()->toArray(); - - return $info; - } -} diff --git a/niucloud/addon/shop/app/service/core/CoreStatService.php b/niucloud/addon/shop/app/service/core/CoreStatService.php deleted file mode 100644 index b0f2a7f80..000000000 --- a/niucloud/addon/shop/app/service/core/CoreStatService.php +++ /dev/null @@ -1,170 +0,0 @@ - date('Y-m-d', time()), - 'date_time' => strtotime(date('Y-m-d', time())) - ]; - $stat = ( new ShopStat() )->where($stat_data)->findOrEmpty(); - if ($stat->isEmpty()) { - $stat->allowField(array_merge(array_keys($stat_data), self::STAT_FIELD))->save(array_merge($stat_data, $data)); - } else { - foreach ($data as $key => $value) { - $stat->$key = Db::raw("{$key} + {$value}"); - } - $stat->allowField(self::STAT_FIELD)->save(); - } - return true; - } - - /** - * 累减统计数据 - * @param $data - * @return true - */ - public static function decStat($data = []) - { - $time = strtotime($data['time']); - // 更新天统计 - $stat_data = [ - 'date' => date('Y-m-d', $time), - 'date_time' => strtotime(date('Y-m-d', $time)) - ]; - - $stat = ( new ShopStat() )->where($stat_data)->findOrEmpty(); - if (!$stat->isEmpty()) { - unset($data[ 'time' ]); - foreach ($data as $key => $value) { - $stat->$key = Db::raw("CASE WHEN {$key} - {$value} >= 0 THEN {$key} - {$value} ELSE 0 END"); - } - $stat->allowField(self::STAT_FIELD)->save(); - } - return true; - } - - /** - * 获取时间区间内天统计数据 - * @param string $start_date - * @param string $end_date - * @return void - */ - public function getStatData(string $start_date, string $end_date) - { - $start_date = strtotime($start_date); - $end_date = strtotime($end_date); - - $field = implode(',', array_merge(self::STAT_FIELD, [ 'date' ])); - $stat_data = ( new ShopStat() )->where([ [ 'date_time', '>=', $start_date ], [ 'date_time', '<=', $end_date ] ])->field($field)->select()->toArray(); - $stat_data = !empty($stat_data) ? array_column($stat_data, null, 'date') : []; - - $data = []; - $day = ceil(( $end_date - $start_date ) / 86400); - foreach (self::STAT_FIELD as $field) { - $value = []; - $time = []; - for ($i = 0; $i < $day; $i++) { - $date = date('Y-m-d', $start_date + $i * 86400); - $time[] = $date; - - $value[] = isset($stat_data[ $date ]) && isset($stat_data[ $date ][ $field ]) ? $stat_data[ $date ][ $field ] : 0; - } - $data[ $field ] = $value; - $data[ 'time' ] = $time; - } - - return $data; - } - - /** - * 获取时间区间内小时统计数据 - * @param string $date - * @return array - */ - public function getHourStatData( string $date) - { - $field = implode(',', array_merge(self::STAT_FIELD, [ 'hour' ])); - $stat_data = ( new ShopStat() )->where([ [ 'date_time', '=', strtotime($date) ] ])->field($field)->select()->toArray(); - $stat_data = !empty($stat_data) ? array_column($stat_data, null, 'hour') : []; - - $data = []; - foreach (self::STAT_FIELD as $field) { - $value = []; - for ($i = 0; $i < 24; $i++) { - $value[ $i ] = isset($stat_data[ $i ]) && isset($stat_data[ $i ][ $field ]) ? $stat_data[ $i ][ $field ] : 0; - } - $data[ $field ] = $value; - } - $data[ 'time' ] = array_map(function($value) { - return $value . '时'; - }, range(0, 23, 1)); - - return $data; - } - - /** - * 查询统计总和 - * @param string $start_date - * @param string $end_date - * @return array - */ - public function getStat( string $start_date = '', string $end_date = '') - { - $condition = [ - [ 'id', '>', 0 ] - ]; - - if (!empty($start_date) && !empty($end_date)) { - $condition[] = [ 'date_time', '>=', strtotime($start_date) ]; - $condition[] = [ 'date_time', '<=', strtotime($end_date) ]; - } else if (!empty($start_date)) { - $condition[] = [ 'date_time', '=', strtotime($start_date) ]; - } - - $field = array_map(function($field) { - return "IFNULL(sum({$field}), 0) as {$field}"; - }, self::STAT_FIELD); - - if ($start_date == '' && $end_date == '') { - $condition[] = [ 'date_time', '>', 0 ]; - } - - $stat_data = ( new ShopStat() )->where($condition)->field(implode(',', $field))->findOrEmpty()->toArray(); - - return $stat_data; - } -} diff --git a/niucloud/addon/shop/app/service/core/cart/CoreCartService.php b/niucloud/addon/shop/app/service/core/cart/CoreCartService.php deleted file mode 100644 index 4a53477a9..000000000 --- a/niucloud/addon/shop/app/service/core/cart/CoreCartService.php +++ /dev/null @@ -1,40 +0,0 @@ -model = new Cart(); - } - - /** - * 删除购物车(专用于订单) - * @param $cart_ids - * @return bool - */ - public function deleteByCartIds($cart_ids) - { - $this->model->where([ [ 'id', 'in', $cart_ids ] ])->delete(); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/coupon/CoreCouponMemberService.php b/niucloud/addon/shop/app/service/core/coupon/CoreCouponMemberService.php deleted file mode 100644 index ad01e0fc7..000000000 --- a/niucloud/addon/shop/app/service/core/coupon/CoreCouponMemberService.php +++ /dev/null @@ -1,267 +0,0 @@ -model = new CouponMember(); - } - - /** - * 通过会员id查询会员有效可用的优惠券 - * @param $member_id - * @return mixed - */ - public function getUseCouponListByMemberId($member_id) - { - $where = array( - ['member_id', '=', $member_id], - ['status', '=', CouponMemberDict::WAIT_USE], - ['expire_time', '>', time()] - ); - $field = 'id, coupon_id, member_id, create_time, expire_time, use_time, type, status, price, min_condition_money, title'; - return $this->model->where($where)->field($field)->with([ - 'goods' - ])->select()->toArray(); - } - - /** - * 查询会员优惠券 - * @param $id - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function getUseCouponById($id) - { - $where = array( - ['id', '=', $id], - ['status', '=', CouponMemberDict::WAIT_USE] - ); - $field = 'id, coupon_id, member_id, create_time, expire_time, use_time, type, status, price, min_condition_money, title'; - return $this->model->where($where)->field($field)->with([ - 'goods' - ])->findOrEmpty()->toArray(); - } - - /** - * 恢复(只单个恢复) - * @return void - */ - public function recover($ids) - { - if (!is_array($ids)) { - $ids = [$ids]; - } - $where = array( - ['id', 'in', $ids], - ['status', '=', CouponMemberDict::USED] - ); - - $coupon_member_list = $this->model->where($where)->select(); - if ($coupon_member_list->isEmpty()) { - return true; - } - //恢复没必要返还错误 - //判断使用时间是否过期 - $update = []; - foreach ($coupon_member_list as $item) { - if (time() >= $item->expire_time) { - $status = CouponMemberDict::EXPIRE; - } else { - $status = CouponMemberDict::WAIT_USE; - } - $update[] = [ - 'id' => $item->id, - 'status' => $status, - 'trade_id' => 0, - 'use_time' => 0, - ]; - } - $this->model->saveAll($update); - return true; - } - - /** - * 失效 - * @param $ids - * @return void - */ - public function invalid($ids) - { - $where = [ - ['id', 'in', $ids], - ['status', '=', CouponMemberDict::WAIT_USE] - ]; - $data = [ - 'status' => CouponMemberDict::INVALID - ]; - $this->model->where($where)->update($data); - return true; - } - - /** - * 过期 - * @param $ids - * @return void - */ - public function expire($ids) - { - $where = [ - ['id', 'in', $ids], - ['status', '=', CouponMemberDict::WAIT_USE] - ]; - $data = [ - 'status' => CouponMemberDict::EXPIRE - ]; - $this->model->where($where)->update($data); - return true; - } - - /** - * 使用 - * @param array $data - * @return void - */ - public function use(array $data) - { - $id = $data['id']; - $where = array( - ['id', '=', $id], - ['status', '=', CouponMemberDict::WAIT_USE] - ); - $coupon = $this->model->where($where)->findOrEmpty(); - if ($coupon->isEmpty()) throw new CommonException('SHOP_COUPON_IS_USED_OR_EXIST');//优惠券不存在或已使用 - $coupon->save( - [ - 'status' => CouponMemberDict::USED, - 'trade_id' => $data['trade_id'], - 'use_time' => time() - ] - ); - return true; - } - - /** - * 发放优惠券 - - * @param $member_ids - * @param $coupon_id - * @param $num - * @return false|int - */ - public function sendCoupon($member_ids, $coupon_id, $num) - { - if (!is_array($member_ids)) { - $member_ids = [$member_ids]; - } - - $give_count = 0; - $coupon = (new Coupon())->where([['id', '=', $coupon_id], ['status', '=', CouponDict::NORMAL]])->findOrEmpty(); - if ($coupon->isEmpty()) { - return $give_count; - } - // 剩余数量不足 -// if ($coupon[ 'remain_count' ] != '-1' && $coupon[ 'remain_count' ] < $num) { -// throw new CommonException('COUPON_STOCK_INSUFFICIENT'); -// } -// -// if (strtotime($coupon[ 'start_time' ]) > 0) { -// $time = time(); -// if ($time < strtotime($coupon[ 'start_time' ])) { -// throw new CommonException('COUPON_RECEIVE_NOT_TIME');//优惠券不在领取时间范围内 -// } -// if ($time > strtotime($coupon[ 'end_time' ])) { -// throw new CommonException('COUPON_RECEIVE_NOT_TIME');//优惠券不在领取时间范围内 -// } -// } - - if ($coupon['valid_type'] == 1) { - $expire_time = 86400 * $coupon['length'] + time(); - } else { - $expire_time = strtotime($coupon['valid_end_time']); - } - - $member_coupon_data = []; - foreach ($member_ids as $member_id) { - for ($i = 0; $i < $num; $i++) { - $member_coupon_data[] = [ - 'coupon_id' => $coupon_id, - 'member_id' => $member_id, - 'create_time' => time(), - 'expire_time' => $expire_time, - 'receive_type' => 'send', - 'type' => $coupon['type'], - 'title' => $coupon['title'], - 'price' => $coupon['price'], - 'status' => CouponMemberDict::WAIT_USE, - 'min_condition_money' => $coupon['min_condition_money'] - ]; - } - $give_count += $num; - } - - - $this->model->insertAll($member_coupon_data); - - $coupon->give_count += $give_count; -// if ($coupon[ 'remain_count' ] != -1) { -// $coupon->remain_count -= $num; -// } - $coupon->save(); - - return $give_count; - } - - /** - * 刷新用户优惠券过期时间 - * @param $coupon_id - * @return void - */ - public function refeshMemberCouponExpireTime($coupon_id) - { - $coupon_info = (new Coupon())->where([ - ['id', '=', $coupon_id] - ])->findOrEmpty($coupon_id)->toArray(); - if ($coupon_info['valid_type'] == 1) { - $time = 86400 * $coupon_info['length']; - $this->model->where([ - ['coupon_id', '=', $coupon_id] - ])->update([ - 'expire_time' => Db::raw("create_time +{$time}") - ]); - } else { - $this->model->where([ - ['coupon_id', '=', $coupon_id] - ])->update([ - 'expire_time' => strtotime($coupon_info['valid_end_time']) - ]); - } - } - -} diff --git a/niucloud/addon/shop/app/service/core/delivery/CoreCompanyService.php b/niucloud/addon/shop/app/service/core/delivery/CoreCompanyService.php deleted file mode 100644 index a0659e2c3..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/CoreCompanyService.php +++ /dev/null @@ -1,68 +0,0 @@ -create($data); - return true; - } - - /** - * 批量添加物流公司 - * @param $data - * @return bool - */ - public function addAll($data) - { - ( new Company() )->insertAll($data); - return true; - } - - /** - * 获取物流公司信息 - * @param array $condition - * @param string $field - * @return mixed - */ - public function getInfo(array $condition, $field = 'company_id,company_name,logo,url,express_no,express_no_electronic_sheet,electronic_sheet_switch,print_style,exp_type') - { - $info = ( new Company() )->field($field)->where($condition)->findOrEmpty()->toArray(); - return $info; - } - - /** - * 获取物流公司列表 - * @param array $condition - * @param string $field - * @return array - */ - public function getList(array $condition = [], $field = 'company_id,company_name,logo,url,express_no,express_no_electronic_sheet,electronic_sheet_switch,print_style,exp_type') - { - $order = 'create_time desc'; - return ( new Company() )->where($condition)->field($field)->order($order)->select()->toArray(); - } - -} diff --git a/niucloud/addon/shop/app/service/core/delivery/CoreConfigService.php b/niucloud/addon/shop/app/service/core/delivery/CoreConfigService.php deleted file mode 100644 index 5dac208c5..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/CoreConfigService.php +++ /dev/null @@ -1,107 +0,0 @@ -setConfig('DELIVERY_INTERFACE', $data); - } - - /** - * 获取快递鸟、快递100配置 - * @return array - */ - public function getDeliverySearchConfig() - { - $info = ( new ConfigService() )->getConfig('DELIVERY_INTERFACE'); - if (empty($info)) { - $info = []; - $info[ 'value' ] = [ - 'interface_type' => 1, - 'kdniao_id' => '', - 'kdniao_app_key' => '', - 'kdniao_is_pay' => 1, - 'kd100_app_key' => '', - 'kd100_customer' => 0 - ]; - } else { - $info[ 'value' ][ 'interface_type' ] = intval($info[ 'value' ][ 'interface_type' ]); - } - return $info[ 'value' ]; - } - - - /** - * 获取快递鸟、快递100电子面单配置 - * @return array - */ - public function getDeliveryElectronSheeticConfig() - { - $info = ( new ConfigService() )->getConfig('ELECTRONIC_SHEET_CONFIG'); - if (empty($info)) { - $info = []; - $info[ 'value' ] = [ - 'interface_type' => 'kdbird', // 接口类型,kdbird:快递鸟,后期支持扩展 - 'kdniao_id' => '', - 'kdniao_api_key' => '', - 'server_port1' => '8000', - 'server_port2' => '18000', - 'https_port' => '8443' - ]; - } - return $info[ 'value' ]; - } - - /** - * 设置同城配送配置 - * @param $data - * @return SysConfig|bool|Model - */ - public function setLocalDeliveryConfig($data) - { - return (new ConfigService())->setConfig('LOCAL_DELIVERY_CONFIG', $data); - } - - /** - * 获取同城配送配置 - * @return array - */ - public function getLocalDeliveryConfig() - { - $value = (new ConfigService())->getConfigValue('LOCAL_DELIVERY_CONFIG'); - if (empty($value)) { - $value = [ - 'is_show_polyline' => 0, - 'is_local_delivery_store_select' => 0 - ]; - } else { - $value[ 'is_show_polyline' ] = intval($value[ 'is_show_polyline' ] ?? 0); - $value[ 'is_local_delivery_store_select' ] = intval($value[ 'is_local_delivery_store_select' ] ?? 0); - } - return $value; - } -} diff --git a/niucloud/addon/shop/app/service/core/delivery/CoreDeliveryService.php b/niucloud/addon/shop/app/service/core/delivery/CoreDeliveryService.php deleted file mode 100644 index 5277a1cd2..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/CoreDeliveryService.php +++ /dev/null @@ -1,191 +0,0 @@ -core_config_service = new CoreConfigService(); - } - - /** - * 配置设置 - * @param array $params - * @return array - */ - - public function setConfig($key, $data) - { - $this->core_config_service->setConfig($key, $data); - return true; - } - - public function getConfig($key) - { - return $this->core_config_service->getConfig($key); - } - - /** - * 物流 - */ - public function getExpressConfig() - { - $data = (new CoreConfigService())->getConfigValue('SHOP_DELIVERY_CONFIG'); - if (empty($data)) { - $expressInfo = [ - 'name' => '物流配送', - 'status' => '', - 'key' => 'express', - 'desc' => '买家下单可以选择快递发货' - ]; - } else { - $expressInfo = $data[array_search('express', array_column($data, 'key'))]; - } - return $expressInfo; - } - - /** - * 同城 - */ - public function getLocalDeliveryConfig() - { - $data = (new CoreConfigService())->getConfigValue('SHOP_DELIVERY_CONFIG'); - if (empty($data)) { - $localDeliveryInfo = [ - 'name' => '同城配送', - 'status' => '', - 'key' => 'local_delivery', - 'desc' => '在配送范围内的买家可以选择同城配送' - ]; - } else { - $localDeliveryInfo = $data[array_search('local_delivery', array_column($data, 'key'))]; - } - return $localDeliveryInfo; - } - - /** - * 门店 - */ - public function getStoreConfig() - { - $data = (new CoreConfigService())->getConfigValue('SHOP_DELIVERY_CONFIG'); - if (empty($data)) { - $storeInfo = [ - 'name' => '门店配送', - 'status' => '', - 'key' => 'store', - 'desc' => '买家可选择自提点提货' - ]; - } else { - $storeInfo = $data[array_search('store', array_column($data, 'key'))]; - } - return $storeInfo; - } - - - /** - * 查询物流配置 - * @return array - */ - public function getDeliveryConfig() - { - $data = (new CoreConfigService())->getConfigValue('SHOP_DELIVERY_CONFIG'); - if (empty($data)) { - $list = [ - 'express' => [ - 'name' => '物流配送', - 'status' => 1, - 'key' => 'express', - 'desc' => '买家下单可以选择快递发货' - ], - 'local_delivery' => [ - 'name' => '同城配送', - 'status' => 1, - 'key' => 'local_delivery', - 'desc' => '在配送范围内的买家可以选择同城配送' - ], - 'store' => [ - 'name' => '门店自提', - 'status' => 1, - 'key' => 'store', - 'desc' => '买家可选择自提点提货' - ] - ]; - } else { - $desc_arr = [ - 'express' => '买家下单可以选择快递发货', - 'local_delivery' => '在配送范围内的买家可以选择同城配送', - 'store' => '买家可选择自提点提货', - ]; - foreach ($data as $value) { - $list[$value['key']] = [ - 'name' => $value['name'], - 'status' => $value['status'], - 'key' => $value['key'], - 'desc' => $value['desc'] ?? $desc_arr[$value['key']] - ]; - } - } - return $list; - } - - /** - * 查询物流配置 - * @return array - */ - public function getDeliveryList() - { - $deliver = (new CoreConfigService())->getConfigValue('SHOP_DELIVERY_CONFIG'); - foreach ($deliver as $value) { - $list[$value['key']] = [ - 'name' => $value['name'], - 'status' => $value['status'], - 'key' => $value['key'] - ]; - } - if (empty($deliver)) { - $deliver = [ - [ - 'name' => '物流配送', - 'status' => 1, - 'key' => 'express' - ], - [ - 'name' => '同城配送', - 'status' => 1, - 'key' => 'local_delivery' - ], - [ - 'name' => '门店自提', - 'status' => 1, - 'key' => 'store' - ], - ]; - } - return $deliver; - } - -} diff --git a/niucloud/addon/shop/app/service/core/delivery/CoreElectronicSheetService.php b/niucloud/addon/shop/app/service/core/delivery/CoreElectronicSheetService.php deleted file mode 100644 index b78744654..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/CoreElectronicSheetService.php +++ /dev/null @@ -1,659 +0,0 @@ -setConfig( 'ELECTRONIC_SHEET_CONFIG', $data); - } - - /** - * 获取电子面单设置 - * @return array|mixed - */ - public function getElectronicSheetConfig() - { - $info = ( new ConfigService() )->getConfig('ELECTRONIC_SHEET_CONFIG'); - if (empty($info)) { - $info = []; - $info[ 'value' ] = [ - 'interface_type' => 'kdbird', // 接口类型,kdbird:快递鸟,后期支持扩展 - 'kdniao_id' => '', - 'kdniao_api_key' => '', - 'server_port1' => '8000', - 'server_port2' => '18000', - 'https_port' => '8443' - ]; - } - return $info[ 'value' ]; - } - - /** - * 添加电子面单模板 - * @param $data - * @return bool - */ - public function add( $data) - { - ( new ElectronicSheet() )->create($data); - return true; - } - - /** - * 批量添加电子面单模板 - * @param $data - * @return bool - */ - public function addAll($data) - { - ( new ElectronicSheet() )->insertAll($data); - return true; - } - - /** - * 获取电子面单信息 - * @param array $condition - * @param string $field - * @return array - */ - public function getInfo($condition = [], $field = 'id,template_name,express_company_id,customer_name,customer_pwd,send_site,send_staff,month_code,pay_type,is_notice,status,exp_type,print_style,is_default,interface_data,temp_id,child_temp_id,back_temp_id') - { - $info = ( new ElectronicSheet() )->field($field)->where($condition)->withJoin([ - 'company' => [ 'company_name', 'express_no_electronic_sheet' ,'kd100_express_no_electronic_sheet'] - ])->append(['kdbird_config', 'kd100_config'])->findOrEmpty() - ->toArray(); - return $info; - } - - /** - * 打印电子面单 - * @param $params - * @return mixed - */ - public function printElectronicSheet($params) - { - $es_config = $this->getElectronicSheetConfig(); - - // 查询订单信息 - $order_model = new Order(); - $field = 'order_id, order_no, member_id, taker_name, taker_mobile, taker_province, taker_city, taker_district, taker_address,delivery_money'; - $order_list = $order_model->where([ - [ 'order_id', 'in', $params[ 'order_id' ] ], - [ 'delivery_type', '=', DeliveryDict::EXPRESS ], // 物流配送 - [ 'status', 'in', [ OrderDict::WAIT_DELIVERY, OrderDict::WAIT_TAKE ] ], // 待发货、待收货状态下 - ])->field($field) - ->with( - [ - 'order_goods' => function($query) { - $query->field('order_goods_id,order_id, sku_id, goods_name, sku_name, num,status,delivery_id'); - } - ])->select()->toArray(); - - if (empty($order_list)) { - throw new CommonException('SHOP_ORDER_NOT_FOUND'); - } - - $sys_area_model = new SysArea(); - - // 查询商家地址库(默认) - $shop_address_model = new ShopAddress(); - $default_shop_address = $shop_address_model->where([ - [ 'is_delivery_address', '=', 1 ], - [ 'is_default_delivery', '=', 1 ] - ])->field('contact_name,mobile,province_id,city_id,district_id,address')->findOrEmpty()->toArray(); - - if (empty($default_shop_address)) { - throw new CommonException('SHOP_ADDRESS_DEFAULT_EMPTY'); - } - - $sender_province_name = $sys_area_model->where([ [ 'id', '=', $default_shop_address[ 'province_id' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - $sender_city_name = $sys_area_model->where([ [ 'id', '=', $default_shop_address[ 'city_id' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - $sender_exp_area_name = $sys_area_model->where([ [ 'id', '=', $default_shop_address[ 'district_id' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - - $goods_sku_model = new GoodsSku(); - - // 替换商品名称中的特殊字符 ' " # & + < > % \ - $search = array( "'", '"', '&', '+', '<', '>', '%', "\\", '#', "and" ); - - $result = []; - - // 打印方式,single:单订单,multiple:多订单 - - if ($params[ 'print_type' ] == 'single') { - // 单订单打印,按照包裹拆分打印 - - foreach ($params[ 'list' ] as $k => $v) { - // 查询电子面单模板 - $es_template_info = $this->getInfo([ - [ 'id', '=', $v[ 'electronic_sheet_id' ] ], - [ 'status', '=', 1 ] - ], 'express_company_id,customer_name,customer_pwd,send_site,send_staff,month_code,pay_type,is_notice,exp_type,print_style,interface_data,temp_id,child_temp_id,back_temp_id'); - - if (empty($es_template_info)) { - // 电子面单模板不存在 - continue; - } - - if ($es_template_info[ 'print_style' ] == '0') { - $es_template_info[ 'print_style' ] = ''; - } - - foreach ($order_list as $ck => $cv) { - - $key = $es_template_info[ 'company' ][ 'express_no_electronic_sheet' ] . '_' . $cv[ 'order_no' ] - . '_' . $es_config[ 'kdniao_id' ] . '_' . $es_template_info[ 'print_style' ] - . '_' . $v[ 'delivery_id' ] . '_' . $k; - - $cache = Cache::get($key); - if (!empty($cache)) { - $cache[ 'delivery_id' ] = $v[ 'delivery_id' ]; - $result[] = $cache; - continue; - } - - $commodity = []; // 商品信息 - $weight_total = 0; // 包裹总重量kg - $volume_total = 0; // 包裹总体积 m³ - $remark = []; // 备注 - foreach ($cv[ 'order_goods' ] as $og_k => $og_v) { - // 排除退款订单项 - if ($og_v[ 'status' ] != 1) { - continue; - } - - // 排除 无需物流的订单项 - if (empty($og_v[ 'delivery_id' ])) { - continue; - } - - // 排除不是一个包裹 - if ($og_v[ 'delivery_id' ] != $v[ 'delivery_id' ]) { - continue; - } - - $order_goods_delivery = ( new OrderDelivery() ) - ->where([ - [ 'order_id', '=', $cv[ 'order_id' ] ], - [ 'id', '=', $og_v[ 'delivery_id' ] ], - [ 'delivery_type', '=', 'express' ], - [ 'sub_delivery_type', '=', 'express' ] - ]) - ->field('id, order_id, delivery_type, sub_delivery_type,express_company_id, express_number') - ->findOrEmpty()->toArray(); - - // 只打印 物流配送的订单项 - if (!empty($order_goods_delivery)) { - $commodity[] = [ - 'GoodsName' => str_replace($search, '', mb_substr($og_v[ 'goods_name' ] . ' ' . $og_v[ 'sku_name' ], 0, 50, 'UTF-8')), - 'GoodsQuantity' => $og_v[ 'num' ] - ]; -// $remark[] = str_replace($search, '', mb_substr($og_v[ 'goods_name' ] . ' ' . $og_v[ 'sku_name' ], 0, 50, 'UTF-8')); - $goods_sku_info = $goods_sku_model->field('weight,volume')->where([ [ 'sku_id', '=', $og_v[ 'sku_id' ] ] ])->findOrEmpty()->toArray(); - if (!empty($goods_sku_info)) { - $weight_total += number_format($goods_sku_info[ 'weight' ], 3); - $volume_total += number_format($goods_sku_info[ 'volume' ], 3); - } - } - - } - - if (empty($commodity)) { - $result[] = [ - 'success' => false, - 'result_code' => -1, - 'reason' => '该订单不支持打印电子面单', - 'order_no' => $cv[ 'order_no' ] - ]; - continue; - } - - $receiver_province_name = $sys_area_model->where([ [ 'id', '=', $cv[ 'taker_province' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - $receiver_city_name = $sys_area_model->where([ [ 'id', '=', $cv[ 'taker_city' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - $receiver_exp_area_name = $sys_area_model->where([ [ 'id', '=', $cv[ 'taker_district' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - - $api_data = [ - 'cache_key' => $key, -// 'ShipperCode' => $es_template_info[ 'company' ][ 'express_no_electronic_sheet' ], // 快递公司编码 -// 'CustomerName' => $es_template_info[ 'customer_name' ], // 电子面单账号,申请:https://www.yuque.com/kdnjishuzhichi/rg4owd -// 'CustomerPwd' => $es_template_info[ 'customer_pwd' ], // 电子面单密码,电子面单账号对照表:https://www.yuque.com/kdnjishuzhichi/dfcrg1/hrfw43 -// 'SendSite' => $es_template_info[ 'send_site' ], -// 'SendStaff' => $es_template_info[ 'send_staff' ], -// 'MonthCode' => $es_template_info[ 'month_code' ], // 月结账号 -// 'PayType' => $es_template_info[ 'pay_type' ], // 运费支付方式(1:现付,2:到付,3:月结) -// 'ExpType' => $es_template_info[ 'exp_type' ], // 快递业务类型,https://www.yuque.com/kdnjishuzhichi/dfcrg1/hgx758hom5p6wz0l -// 'TemplateSize' => $es_template_info[ 'print_style' ], // 模板规格,https://www.yuque.com/kdnjishuzhichi/dfcrg1/vpptucr1q5ahcxa7#iZvLV -// 'IsNotice' => $es_template_info[ 'is_notice' ], // 是否通知快递员上门揽件跨越速运,京东快运必填 - - 'es_template_info'=>$es_template_info, - 'OrderCode' => $cv[ 'order_no' ] . $k, // 订单编号,多包裹防重复,要增加下标 - // 发件人信息 - 'Sender' => [ - 'Name' => $default_shop_address[ 'contact_name' ], // 发件人 - 'Mobile' => $default_shop_address[ 'mobile' ], // 手机 - 'ProvinceName' => $sender_province_name, // 发件省 - 'CityName' => $sender_city_name, // 发件市 - 'ExpAreaName' => $sender_exp_area_name, // 发件区 - 'Address' => $default_shop_address[ 'address' ], // 发件人详细地址 - 'PostCode' => '000000' // 发件地邮编邮政/EMS 必填可填000000 - ], - // 收件人信息 - 'Receiver' => [ - 'Name' => $cv[ 'taker_name' ], // 收件人 - 'Mobile' => $cv[ 'taker_mobile' ], // 电话 - 'ProvinceName' => $receiver_province_name, // 收件省 - 'CityName' => $receiver_city_name, // 收件市 - 'ExpAreaName' => $receiver_exp_area_name, // 收件区 - 'Address' => mb_substr($cv[ 'taker_address' ], 0, 100, 'UTF-8'), // 收件人详细地址 - 'PostCode' => '000000' // 收件地邮编邮政/EMS 必填可填000000 - ], - 'Quantity' => count($cv[ 'order_goods' ]) > 50 ? 50 : count($cv[ 'order_goods' ]), // 包裹数 (至少填1,最多50) - // 商品信息 - 'Commodity' => $commodity, - 'Weight' => $weight_total, // 包裹总重量kg,京东、快运类必填 - 'Volume' => $volume_total, // 包裹总体积 m³,京东、快运类必填 - 'Cost' => $cv[ 'delivery_money' ], // 快递运费 - 'Remark' => '', // '
' . mb_substr(implode('
', $remark), 0, 80, 'UTF-8'), // 备注 - 'IsReturnPrintTemplate' => 1, // 是否返回电子面单模板:(不填默认为0)0:不需要,1:需要 - ]; - - $class = new ElectronicSheetSearchLoader(); - $temp_result = $class->electronicSheet($api_data); - $temp_result[ 'order_no' ] = $cv[ 'order_no' ]; // 记录打印的 订单号 - $temp_result[ 'delivery_id' ] = $v[ 'delivery_id' ]; // 记录打印的 包裹id - - $result[] = $temp_result; - } - - } - - return $result; - - } elseif ($params[ 'print_type' ] == 'multiple') { - // 多订单打印,一个订单一个电子面单 - // 查询电子面单模板 - if (!empty($params[ 'electronic_sheet_id' ])) { - $es_template_info = $this->getInfo([ - [ 'id', '=', $params[ 'electronic_sheet_id' ] ], - [ 'status', '=', 1 ] - ], 'express_company_id,customer_name,customer_pwd,send_site,send_staff,month_code,pay_type,is_notice,exp_type,print_style,interface_data,temp_id,child_temp_id,back_temp_id'); - } else { - $es_template_info = $this->getInfo([ - [ 'is_default', '=', 1 ], - [ 'status', '=', 1 ] - ], 'express_company_id,customer_name,customer_pwd,send_site,send_staff,month_code,pay_type,is_notice,exp_type,print_style,interface_data,temp_id,child_temp_id,back_temp_id'); - } - - if (empty($es_template_info)) { - throw new CommonException('SHOP_ELECTRONIC_SHEET_TEMPLATE_FOUND'); - } - - if ($es_template_info[ 'print_style' ] == '0') { - $es_template_info[ 'print_style' ] = ''; - } - - // 查询指定订单项 - if (!empty($params[ 'order_goods_ids' ])) { - foreach ($order_list as $k => $v) { - if ($v[ 'order_id' ] == $params[ 'order_id' ]) { - foreach ($v[ 'order_goods' ] as $ck => $cv) { - if (!in_array($cv[ 'order_goods_id' ], $params[ 'order_goods_ids' ])) { - unset($order_list[ $k ][ 'order_goods' ][ $ck ]); - } - } - $order_list[ $k ][ 'order_goods' ] = array_values($order_list[ $k ][ 'order_goods' ]); - } - } - } - - foreach ($order_list as $k => $v) { - - $order_goods_delivery_count = ( new OrderDelivery() )->where([ - [ 'order_id', '=', $v[ 'order_id' ] ], - [ 'delivery_type', '=', 'express' ], - [ 'sub_delivery_type', '=', 'express' ] - ])->count(); - - if ($order_goods_delivery_count > 0) { - $order_goods_delivery_count--; - } - - $key = $es_template_info[ 'company' ][ 'express_no_electronic_sheet' ] . '_' . $v[ 'order_no' ] - . '_' . $es_config[ 'kdniao_id' ] - . '_' . $es_template_info[ 'print_style' ] . '_' . $order_goods_delivery_count; - - $cache = Cache::get($key); - if (!empty($cache)) { - $result[] = $cache; - continue; - } - - $commodity = []; // 商品信息 - $weight_total = 0; // 包裹总重量kg - $volume_total = 0; // 包裹总体积 m³ - $remark = []; // 备注 - foreach ($v[ 'order_goods' ] as $ck => $cv) { - - // 排除退款订单项 - if ($cv[ 'status' ] != 1) { - continue; - } - - // 排除 无需物流的订单项 - if (empty($cv[ 'delivery_id' ])) { - continue; - } - - $order_goods_delivery = ( new OrderDelivery() ) - ->where([ - [ 'order_id', '=', $v[ 'order_id' ] ], - [ 'id', '=', $cv[ 'delivery_id' ] ], - [ 'delivery_type', '=', 'express' ], - [ 'sub_delivery_type', '=', 'express' ] - ]) - ->field('id, order_id, delivery_type, sub_delivery_type,express_company_id, express_number') - ->findOrEmpty()->toArray(); - - // 只打印 物流配送的订单项 - if (!empty($order_goods_delivery)) { - $commodity[] = [ - 'GoodsName' => str_replace($search, '', mb_substr($cv[ 'goods_name' ] . ' ' . $cv[ 'sku_name' ], 0, 50, 'UTF-8')), - 'GoodsQuantity' => $cv[ 'num' ] - ]; -// $remark[] = str_replace($search, '', mb_substr($cv[ 'goods_name' ] . ' ' . $cv[ 'sku_name' ], 0, 50, 'UTF-8')); - $goods_sku_info = $goods_sku_model->field('weight,volume')->where([ [ 'sku_id', '=', $cv[ 'sku_id' ] ] ])->findOrEmpty()->toArray(); - if (!empty($goods_sku_info)) { - $weight_total += number_format($goods_sku_info[ 'weight' ], 3); - $volume_total += number_format($goods_sku_info[ 'volume' ], 3); - } - } - } - - if (empty($commodity)) { - $result[] = [ - 'success' => false, - 'result_code' => -1, - 'reason' => '该订单不支持打印电子面单', - 'order_no' => $v[ 'order_no' ] - ]; - continue; - } - - $receiver_province_name = $sys_area_model->where([ [ 'id', '=', $v[ 'taker_province' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - $receiver_city_name = $sys_area_model->where([ [ 'id', '=', $v[ 'taker_city' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - $receiver_exp_area_name = $sys_area_model->where([ [ 'id', '=', $v[ 'taker_district' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - - $api_data = [ - 'cache_key' => $key, -// 'ShipperCode' => $es_template_info[ 'company' ][ 'express_no_electronic_sheet' ], // 快递公司编码 -// 'CustomerName' => $es_template_info[ 'customer_name' ], // 电子面单账号,申请:https://www.yuque.com/kdnjishuzhichi/rg4owd -// 'CustomerPwd' => $es_template_info[ 'customer_pwd' ], // 电子面单密码,电子面单账号对照表:https://www.yuque.com/kdnjishuzhichi/dfcrg1/hrfw43 -// 'SendSite' => $es_template_info[ 'send_site' ], -// 'SendStaff' => $es_template_info[ 'send_staff' ], -// 'MonthCode' => $es_template_info[ 'month_code' ], // 月结账号 - 'es_template_info'=> $es_template_info, - 'OrderCode' => $v[ 'order_no' ] . $order_goods_delivery_count, // 订单编号,多包裹防重复,要增加下标 - - 'PayType' => $es_template_info[ 'pay_type' ], // 运费支付方式(1:现付,2:到付,3:月结) - 'ExpType' => $es_template_info[ 'exp_type' ], // 快递业务类型,https://www.yuque.com/kdnjishuzhichi/dfcrg1/hgx758hom5p6wz0l - - // 发件人信息 - 'Sender' => [ - 'Name' => $default_shop_address[ 'contact_name' ], // 发件人 - 'Mobile' => $default_shop_address[ 'mobile' ], // 手机 - 'ProvinceName' => $sender_province_name, // 发件省 - 'CityName' => $sender_city_name, // 发件市 - 'ExpAreaName' => $sender_exp_area_name, // 发件区 - 'Address' => $default_shop_address[ 'address' ], // 发件人详细地址 - 'PostCode' => '000000' // 发件地邮编邮政/EMS 必填可填000000 - ], - - // 收件人信息 - 'Receiver' => [ - 'Name' => $v[ 'taker_name' ], // 收件人 - 'Mobile' => $v[ 'taker_mobile' ], // 电话 - 'ProvinceName' => $receiver_province_name, // 收件省 - 'CityName' => $receiver_city_name, // 收件市 - 'ExpAreaName' => $receiver_exp_area_name, // 收件区 - 'Address' => mb_substr($v[ 'taker_address' ], 0, 100, 'UTF-8'), // 收件人详细地址 - 'PostCode' => '000000' // 收件地邮编邮政/EMS 必填可填000000 - ], - - 'Quantity' => count($v[ 'order_goods' ]) > 50 ? 50 : count($v[ 'order_goods' ]), // 包裹数 (至少填1,最多50) - - // 商品信息 - 'Commodity' => $commodity, - 'Weight' => $weight_total, // 包裹总重量kg,京东、快运类必填 - 'Volume' => $volume_total, // 包裹总体积 m³,京东、快运类必填 - 'Cost' => $v[ 'delivery_money' ], // 快递运费 - 'Remark' => '',// '
' . mb_substr(implode('
', $remark), 0, 80, 'UTF-8'), // 备注 - - 'IsReturnPrintTemplate' => 1, // 是否返回电子面单模板:(不填默认为0)0:不需要,1:需要 - - 'TemplateSize' => $es_template_info[ 'print_style' ], // 模板规格,https://www.yuque.com/kdnjishuzhichi/dfcrg1/vpptucr1q5ahcxa7#iZvLV - 'IsNotice' => $es_template_info[ 'is_notice' ] // 是否通知快递员上门揽件跨越速运,京东快运必填 - ]; - - $class = new ElectronicSheetSearchLoader(); - - $temp_result = $class->electronicSheet($api_data); - $temp_result[ 'order_no' ] = $v[ 'order_no' ]; // 记录打印的 订单号 - $result[] = $temp_result; - } - return $result; - } - } - - /** - * 发货的同时打印电子面单 - * @param $params - * @return array|void - */ - public function printElectronicSheetByDelivery($params) - { - $es_config = $this->getElectronicSheetConfig(); - // 查询订单信息 - $order_model = new Order(); - $field = 'order_id, order_no, member_id, taker_name, taker_mobile, taker_province, taker_city, taker_district, taker_address,delivery_money'; - $order_info = $order_model->where([ - [ 'order_id', '=', $params[ 'order_id' ] ], - [ 'delivery_type', '=', DeliveryDict::EXPRESS ], // 物流配送 - [ 'status', 'in', [ OrderDict::WAIT_DELIVERY, OrderDict::WAIT_TAKE ] ], // 待发货、待收货状态下 - ])->field($field)->findOrEmpty()->toArray(); - - if (empty($order_info)) { - throw new CommonException('SHOP_ORDER_NOT_FOUND'); - } - - // 发货的同时打印电子面单 - if (!empty($params[ 'order_goods_data' ])) { - $order_info[ 'order_goods' ] = $params[ 'order_goods_data' ]; - } - - $sys_area_model = new SysArea(); - - // 查询商家地址库(默认) - $shop_address_model = new ShopAddress(); - $default_shop_address = $shop_address_model->where([ - [ 'is_delivery_address', '=', 1 ], - [ 'is_default_delivery', '=', 1 ] - ])->field('contact_name,mobile,province_id,city_id,district_id,address')->findOrEmpty()->toArray(); - - if (empty($default_shop_address)) { - throw new CommonException('SHOP_ADDRESS_DEFAULT_EMPTY'); - } - - $sender_province_name = $sys_area_model->where([ [ 'id', '=', $default_shop_address[ 'province_id' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - $sender_city_name = $sys_area_model->where([ [ 'id', '=', $default_shop_address[ 'city_id' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - $sender_exp_area_name = $sys_area_model->where([ [ 'id', '=', $default_shop_address[ 'district_id' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - - $goods_sku_model = new GoodsSku(); - - // 替换商品名称中的特殊字符 ' " # & + < > % \ - $search = array( "'", '"', '&', '+', '<', '>', '%', "\\", '#', "and" ); - - // 查询电子面单模板 - if (!empty($params[ 'electronic_sheet_id' ])) { - $es_template_info = $this->getInfo([ - [ 'id', '=', $params[ 'electronic_sheet_id' ] ], - [ 'status', '=', 1 ] - ], 'express_company_id,customer_name,customer_pwd,send_site,send_staff,month_code,pay_type,is_notice,exp_type,print_style,exp_type_name,interface_data,temp_id,child_temp_id,back_temp_id'); - } else { - $es_template_info = $this->getInfo([ - [ 'is_default', '=', 1 ], - [ 'status', '=', 1 ] - ], 'express_company_id,customer_name,customer_pwd,send_site,send_staff,month_code,pay_type,is_notice,exp_type,print_style,exp_type_name,interface_data,temp_id,child_temp_id,back_temp_id'); - } - - if (empty($es_template_info)) { - throw new CommonException('SHOP_ELECTRONIC_SHEET_TEMPLATE_FOUND'); - } - - if ($es_template_info[ 'print_style' ] == '0') { - $es_template_info[ 'print_style' ] = ''; - } - - $order_goods_delivery_count = ( new OrderDelivery() ) - ->where([ - [ 'order_id', '=', $order_info[ 'order_id' ] ], - [ 'delivery_type', '=', 'express' ], - [ 'sub_delivery_type', '=', 'express' ] - ]) - ->count(); - - $key = $es_template_info[ 'company' ][ 'express_no_electronic_sheet' ] . '_' . $order_info[ 'order_no' ] - . '_' . $es_config[ 'kdniao_id' ] . '_' . $es_template_info[ 'print_style' ] - . '_' . $order_goods_delivery_count; - - $cache = Cache::get($key); - if (!empty($cache)) { - return $cache; - } - - $commodity = []; // 商品信息 - $weight_total = 0; // 包裹总重量kg - $volume_total = 0; // 包裹总体积 m³ - $remark = []; // 备注 - foreach ($order_info[ 'order_goods' ] as $ck => $cv) { - - $commodity[] = [ - 'GoodsName' => str_replace($search, '', mb_substr($cv[ 'goods_name' ] . ' ' . $cv[ 'sku_name' ], 0, 50, 'UTF-8')), - 'GoodsQuantity' => $cv[ 'num' ] - ]; -// $remark[] = str_replace($search, '', mb_substr($cv[ 'goods_name' ] . ' ' . $cv[ 'sku_name' ], 0, 50, 'UTF-8')); - $goods_sku_info = $goods_sku_model->field('weight,volume')->where([ [ 'sku_id', '=', $cv[ 'sku_id' ] ] ])->findOrEmpty()->toArray(); - if (!empty($goods_sku_info)) { - $weight_total += number_format($goods_sku_info[ 'weight' ], 3); - $volume_total += number_format($goods_sku_info[ 'volume' ], 3); - } - } - - if (empty($commodity)) { - $result = [ - 'success' => false, - 'result_code' => -1, - 'reason' => '该订单不支持打印电子面单', - 'order_no' => $order_info[ 'order_no' ] - ]; - return $result; - } - - $receiver_province_name = $sys_area_model->where([ [ 'id', '=', $order_info[ 'taker_province' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - $receiver_city_name = $sys_area_model->where([ [ 'id', '=', $order_info[ 'taker_city' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - $receiver_exp_area_name = $sys_area_model->where([ [ 'id', '=', $order_info[ 'taker_district' ] ] ])->field('name')->findOrEmpty()->toArray()[ 'name' ] ?? ''; - - -// $ShipperCode = $es_config['interface_type'] == 'kdbird' ? $es_template_info[ 'company' ][ 'express_no_electronic_sheet' ] : $es_template_info[ 'company' ][ 'kd100_express_no_electronic_sheet' ]; - $api_data = [ - 'cache_key' => $key, -// 'ShipperCode' => $ShipperCode, // 快递公司编码 -// 'CustomerName' => $es_template_info[ 'customer_name' ], // 电子面单账号,申请:https://www.yuque.com/kdnjishuzhichi/rg4owd -// 'CustomerPwd' => $es_template_info[ 'customer_pwd' ], // 电子面单密码,电子面单账号对照表:https://www.yuque.com/kdnjishuzhichi/dfcrg1/hrfw43 -// 'SendSite' => $es_template_info[ 'send_site' ], -// 'SendStaff' => $es_template_info[ 'send_staff' ], -// 'MonthCode' => $es_template_info[ 'month_code' ], // 月结账号 - 'es_template_info'=>$es_template_info, - 'OrderCode' => $order_info[ 'order_no' ] . $order_goods_delivery_count, // 订单编号,多包裹防重复,要增加下标 - - 'PayType' => $es_template_info[ 'pay_type' ], // 运费支付方式(1:现付,2:到付,3:月结) - 'ExpType' => $es_template_info[ 'exp_type' ], // 快递业务类型,https://www.yuque.com/kdnjishuzhichi/dfcrg1/hgx758hom5p6wz0l - - // 发件人信息 - 'Sender' => [ - 'Name' => $default_shop_address[ 'contact_name' ], // 发件人 - 'Mobile' => $default_shop_address[ 'mobile' ], // 手机 - 'ProvinceName' => $sender_province_name, // 发件省 - 'CityName' => $sender_city_name, // 发件市 - 'ExpAreaName' => $sender_exp_area_name, // 发件区 - 'Address' => $default_shop_address[ 'address' ], // 发件人详细地址 - 'PostCode' => '000000' // 发件地邮编邮政/EMS 必填可填000000 - ], - - // 收件人信息 - 'Receiver' => [ - 'Name' => $order_info[ 'taker_name' ], // 收件人 - 'Mobile' => $order_info[ 'taker_mobile' ], // 电话 - 'ProvinceName' => $receiver_province_name, // 收件省 - 'CityName' => $receiver_city_name, // 收件市 - 'ExpAreaName' => $receiver_exp_area_name, // 收件区 - 'Address' => mb_substr($order_info[ 'taker_address' ], 0, 100, 'UTF-8'), // 收件人详细地址 - 'PostCode' => '000000' // 收件地邮编邮政/EMS 必填可填000000 - ], - - 'Quantity' => count($order_info[ 'order_goods' ]) > 50 ? 50 : count($order_info[ 'order_goods' ]), // 包裹数 (至少填1,最多50) - - // 商品信息 - 'Commodity' => $commodity, - 'Weight' => $weight_total, // 包裹总重量kg,京东、快运类必填 - 'Volume' => $volume_total, // 包裹总体积 m³,京东、快运类必填 - 'Cost' => $order_info[ 'delivery_money' ], // 快递运费 - 'Remark' => '', // '
' . mb_substr(implode('
', $remark), 0, 80, 'UTF-8'), // 备注 - - 'IsReturnPrintTemplate' => 1, // 是否返回电子面单模板:(不填默认为0)0:不需要,1:需要 - - 'TemplateSize' => $es_template_info[ 'print_style' ], // 模板规格,https://www.yuque.com/kdnjishuzhichi/dfcrg1/vpptucr1q5ahcxa7#iZvLV - 'IsNotice' => $es_template_info[ 'is_notice' ] // 是否通知快递员上门揽件跨越速运,京东快运必填 - ]; - - $class = new ElectronicSheetSearchLoader(); - $result = $class->electronicSheet($api_data); - $result[ 'order_no' ] = $order_info[ 'order_no' ]; // 记录打印的 订单号 - - return $result; - } - -} diff --git a/niucloud/addon/shop/app/service/core/delivery/CoreExpressService.php b/niucloud/addon/shop/app/service/core/delivery/CoreExpressService.php deleted file mode 100644 index ee06e2ebc..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/CoreExpressService.php +++ /dev/null @@ -1,158 +0,0 @@ -delivery['take_address'] ?? []; - - if (empty($address)) { - $order->error[] = get_lang('NOT_SELECT_ADDRESS'); - return; - } - - $template_goods_data = []; - foreach ($order->goods_data as $k => &$v) { - $goods_type = $v['goods']['goods_type']; - if ($goods_type == GoodsDict::REAL) { - if (in_array(OrderDeliveryDict::EXPRESS, $v['goods']['delivery_type'])) { - if ($v['goods']['is_free_shipping'] == 0) { - if ($v['goods']['fee_type'] == 'template') { - $delivery_template_id = $v['goods']['delivery_template_id']; - $template_goods_data[$delivery_template_id][] = $v; - } else { - $v['delivery_money'] = $v['goods']['delivery_money'] * $v['num']; - } - $delivery_money += $v['delivery_money'] ?? 0; - } - } else { - $v['not_support_delivery'] = 1; - $order->error[] = get_lang('NOT_SUPPORT_DELIVERY_TYPE'); - } - } - } - - //运费模板运费计算 - if (!empty($template_goods_data)) { - (new self())->feeCalculate($order, $template_goods_data, $delivery_money, $order->goods_data); - } - - // 判断会员等级是否有包邮的权益 - if (isset($order->buyer['member_level']['level_benefits']) && isset($order->buyer['member_level']['level_benefits']['shop_free_shipping'])) { - if ($order->buyer['member_level']['level_benefits']['shop_free_shipping']['is_use']) { - $order->basic['delivery_money'] = 0; - return; - } - } - - $order->basic['delivery_money'] = $delivery_money; - } - - /** - * 运费模板运费计算 - * @param $order - * @param $template_goods_data - * @param $delivery_money - * @param $goods_data - * @return true|void - */ - private function feeCalculate(&$order, $template_goods_data, &$delivery_money, &$goods_data) { - foreach ($template_goods_data as $delivery_template_id => $goods_list) { - $address = $order->delivery['take_address'] ?? []; - - $field = 'snum,sprice,xnum,xprice,fee_type,fee_area_ids,no_delivery,no_delivery_area_ids,is_free_shipping,free_shipping_area_ids,free_shipping_price,free_shipping_num'; - $template = (new ShippingTemplateItem())->where([['template_id', '=', $delivery_template_id], ['city_id', '=', $address['city_id']]])->field($field)->findOrEmpty()->toArray(); - $nationwide = (new ShippingTemplateItem())->where([['template_id', '=', $delivery_template_id], ['city_id', '=', 0]])->field($field)->findOrEmpty()->toArray(); - if (empty($template)) { - $template = $nationwide; - if (empty($nationwide)) { - $order->error[] = get_lang('SHOP_THE_AVAILABLE_SHIPPING_RATES_AREN_T_CONFIGURED'); - return true; - } - } else { - if (empty($template['snum'])) $template['snum'] = $nationwide['snum']; - if (empty($template['sprice'])) $template['sprice'] = $nationwide['sprice']; - if (empty($template['xnum'])) $template['xnum'] = $nationwide['xnum']; - if (empty($template['xprice'])) $template['xprice'] = $nationwide['xprice']; - } - - //按运费模板计算总量和总金额 - $total = 0; - $total_goods_money = 0; - foreach ($goods_list as $goods) { - $this->totalCalculate($template, $goods, $total, $total_goods_money); - } - - foreach ($goods_list as $goods) { - // 判断收货地址是否不配送 - if ($template['no_delivery'] && !empty($template['no_delivery_area_ids'])) { - $goods_data[$goods['sku_id']]['not_support_delivery'] = 1; - $order->error[] = get_lang('NOT_SUPPORT_DELIVERY_ADDRESS'); - return true; - } - // 判断收货地址是否包邮 - if ($template['is_free_shipping'] && !empty($template['free_shipping_area_ids']) && ($total >= $template['free_shipping_num'] || $total_goods_money >= $template['free_shipping_price'])) { - $goods_data[$goods['sku_id']]['is_free_shipping'] = 1; - return true; - } - } - // 计算费用 - $item_delivery_money = $template['sprice']; - if ($total > $template['snum']) { - $item_delivery_money += round(ceil(($total - $template['snum']) / $template['xnum']) * $template['xprice'], 2); - } - $delivery_money += $item_delivery_money; - } - } - - /** - * 按运费模板计算总量和总金额 - * @param $template - * @param $goods - * @param $total - * @param $total_goods_money - * @return void - */ - private function totalCalculate($template, $goods, &$total, &$total_goods_money) { - $total_goods_money += $goods['goods_money']; - switch ($template['fee_type']) { - case ShippingTemplateDict::NUM: - $total += $goods['num']; - break; - case ShippingTemplateDict::VOLUME: - $total += $goods['volume'] * $goods['num']; - break; - case ShippingTemplateDict::WEIGHT: - $total += $goods['weight'] * $goods['num']; - break; - } - } - -} diff --git a/niucloud/addon/shop/app/service/core/delivery/CoreStoreService.php b/niucloud/addon/shop/app/service/core/delivery/CoreStoreService.php deleted file mode 100644 index 4469dc9e4..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/CoreStoreService.php +++ /dev/null @@ -1,171 +0,0 @@ -model = new Store(); - } - - /** - * 配送费用计算 - * @param $order - * @return void - */ - public static function calculate(&$order) - { - $store = $order->delivery[ 'take_store' ] ?? []; - - if (empty($store)) { - $order->error[] = get_lang('NOT_SELECT_STORE'); - return; - } - - foreach ($order->goods_data as $k => &$v) { - $goods_type = $v[ 'goods' ][ 'goods_type' ]; - if ($goods_type == GoodsDict::REAL) { - if (!in_array(OrderDeliveryDict::STORE, $v[ 'goods' ][ 'delivery_type' ])) { - $v[ 'not_support_delivery' ] = 1; - $order->error[] = get_lang('NOT_SUPPORT_DELIVERY_TYPE'); - } - } - } - } - - /** - * 查询自提点 - * @param int $id - * @return array - */ - public function getInfoById(int $store_id) - { - $condition = array( - [ 'store_id', '=', $store_id ] - ); - return $this->model->where($condition)->findOrEmpty()->toArray(); - } - - /** - * 查询自提点 - * @param $latlng - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function getStoreList($latlng = []) - { - $list = $this->model->where([ [ 'support_store', '=', 1 ], [ 'status', '=', 1 ] ])->field('store_id,time_week,time_interval,trade_time_json,store_name,store_logo,store_mobile,full_address,longitude,latitude,trade_time')->select()->toArray(); - if (!empty($list) && !empty($latlng) && !empty($latlng[ 'lat' ]) && !empty($latlng[ 'lng' ])) { - $location = new Coordinate($latlng[ 'lat' ], $latlng[ 'lng' ]); - $list = array_map(function($item) use ($location) { - $item[ 'distance' ] = ( new Vincenty() )->getDistance($location, new Coordinate((float) $item[ 'latitude' ], (float) $item[ 'longitude' ])); - return $item; - }, $list); - array_multisort(array_column($list, 'distance'), SORT_ASC, $list); - } - $day_start_time = strtotime(date('Y-m-d')); - foreach ($list as &$item) { - $item[ 'store_time_list' ] = $this->formatTime($item[ 'time_week' ], $item[ 'trade_time_json' ], $day_start_time, $item[ 'time_interval' ]); - } - return $list; - } - - /** - * @param $weekList - * @param $hour_arr - * @param $start_time - * @param $interval - * @return array - */ - private function formatTime($weekList, $hour_arr, $start_time, $interval) - { - if (empty($weekList)) { - return []; - } - $array = []; - $day_week = (int) date('w', time()); - foreach ($weekList as $week) { - $name = DeliveryDict::getWeekList($week)[ 'name' ]; - if ($day_week == $week) { - $day_str = '今天'; - $time = $start_time; - } - if ($day_week < $week) { - $day = $week - $day_week; - $time = strtotime("+{$day} day", $start_time); - if ($day_week + 1 == $week) { - $day_str = '明天'; - } else { - $day_str = date("Y-m-d", $time); - } - } - - if ($day_week > $week) { - $day = $day_week - $week; - $time = strtotime('+1 week', strtotime("-{$day} day", $start_time)); - $day_str = date("Y-m-d", $time); - } - $array[ $time ] = [ - 'name' => $day_str . "({$name})", - 'time_list' => $this->getTimeArr($hour_arr, $time, (int) $interval) - ]; - } - ksort($array); - return array_values($array); - } - - /** - * @param $hour_arr - * @param $start_time - * @param int $interval - * @return array - */ - private function getTimeArr($hour_arr, $start_time, int $interval) - { - $array = []; - foreach ($hour_arr as $item) { - $start_second = (int) $item[ 'start_time' ]; - $end_second = (int) $item[ 'end_time' ]; - $num = ( $end_second - $start_second ) / 60 / $interval; - for ($i = 1; $i <= $num; $i++) { - $start_hour = $start_time + $start_second + ( $i - 1 ) * $interval * 60; - $end_hour = $start_time + $start_second + $i * $interval * 60; - if ($end_hour <= time()) { - continue; - } - $array[] = [ -// 'is_show'=>$end_hour>time() ?1:0, - 'show_hour' => date('H:i', $start_hour) . '-' . date('H:i', $end_hour), - 'time_str' => date('Y-m-d H:i', $start_hour) . '-' . date('H:i', $end_hour), - ]; - } - } - return $array; - } -} diff --git a/niucloud/addon/shop/app/service/core/delivery/delivery_search/BaseDeliverySearch.php b/niucloud/addon/shop/app/service/core/delivery/delivery_search/BaseDeliverySearch.php deleted file mode 100644 index 3a710f1be..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/delivery_search/BaseDeliverySearch.php +++ /dev/null @@ -1,38 +0,0 @@ - 'KdniaoDeliverySearch', - 2 => 'Kd100DeliverySearch', - ]; - - public function __construct() - { - $config = ( new CoreConfigService() )->getDeliverySearchConfig(); - if(empty($config['interface_type']) || !isset($this->method[$config['interface_type']]) ){ - throw new AdminException('NOT_CONFIGURED_DELIVERY_TYPE'); - } - parent::__construct($this->method[$config['interface_type']], $config); - } - /** - * 空间名 - * @var string - */ - protected $namespace = '\\addon\\shop\\app\\service\\core\\delivery\\delivery_search\\'; - - protected $config_name = 'delivery_search'; - - /** - * 默认驱动 - * @return mixed - */ - protected function getDefault() - { - return 'kdbird'; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/service/core/delivery/delivery_search/Kd100DeliverySearch.php b/niucloud/addon/shop/app/service/core/delivery/delivery_search/Kd100DeliverySearch.php deleted file mode 100644 index f3e1f7488..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/delivery_search/Kd100DeliverySearch.php +++ /dev/null @@ -1,63 +0,0 @@ -kd100_app_key = $config[ 'kd100_app_key' ] ?? ''; - $this->kd100_customer = $config[ 'kd100_customer' ] ?? ''; - if (empty($this->kd100_app_key) || empty($this->kd100_customer)){ - throw new AdminException('NOT_CONFIGURED_DELIVERY_KD100'); - } - $this->config = [ - 'kd100_app_key' => $this->kd100_app_key, - 'kd100_customer' => $this->kd100_customer - ]; - } - - - /** - * @param array $data - * @return mixed|void - */ - public function search(array $data = []) - { - //查询数据 - if(!empty($data['company_id'])){ - $express_no = (new Company())->where('company_id',$data['company_id'])->value('kd100_express_no'); - }else{ - $express_no = $data['express_no']; - } - return (new Kd100($this->config))->orderTracesSubByJson( - $express_no, - $data[ 'logistic_no' ], - $data[ 'mobile' ] - ); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/service/core/delivery/delivery_search/KdniaoDeliverySearch.php b/niucloud/addon/shop/app/service/core/delivery/delivery_search/KdniaoDeliverySearch.php deleted file mode 100644 index 3fc88fca0..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/delivery_search/KdniaoDeliverySearch.php +++ /dev/null @@ -1,43 +0,0 @@ -logistic_config = $config; - } - - /** - * 物流跟踪查询 - * @param array $data - * @return array - */ - public function search(array $data = []) - { - $kdniao_sdk = ( new Kdbird($this->logistic_config) ); - - $data = $kdniao_sdk->orderTracesSubByJson($data[ 'express_no' ], $data[ 'logistic_no' ], $data[ 'mobile' ]); - return $data; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/service/core/delivery/delivery_search/sdk/Kd100.php b/niucloud/addon/shop/app/service/core/delivery/delivery_search/sdk/Kd100.php deleted file mode 100644 index f44bdf7a4..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/delivery_search/sdk/Kd100.php +++ /dev/null @@ -1,107 +0,0 @@ -key = $config[ "kd100_app_key" ]; - $this->customer = $config[ "kd100_customer" ]; - $this->url = 'https://poll.kuaidi100.com/poll/query.do'; - } - - public function orderTracesSubByJson($shipper_code, $logistic_code, $mobile) - { - $param = [ - 'com' => $shipper_code, // 快递公司编码 - 'num' => $logistic_code, // 快递单号 - ]; - if(!empty($mobile)){ - $param[ 'phone' ] = $mobile; // 手机号 - } - $post_data = array(); - $post_data[ 'customer' ] = $this->customer; - $post_data[ 'param' ] = json_encode($param, JSON_UNESCAPED_UNICODE); - $sign = md5($post_data[ 'param' ] . $this->key . $post_data[ 'customer' ]); - $post_data[ 'sign' ] = strtoupper($sign); - $result = $this->sendPost($this->url, $post_data); - $res = []; - - if (!empty($result[ 'result' ]) && $result[ 'result' ] == false) { - $res[ "success" ] = false; - $res[ "reason" ] = $result[ "message" ]; - } - if (!empty($result[ 'status' ]) && $result[ "status" ] != 200) { - $res[ "success" ] = false; - $res[ "reason" ] = $result[ "message" ]; - } else if (!empty($result[ 'status' ]) && $result[ "status" ] == 200) { - $list = []; - if (!empty($result[ 'data' ])) { - foreach ($result[ 'data' ] as $trace) { - $list[] = [ - 'datetime' => $trace[ 'time' ], - 'remark' => $trace[ 'context' ] - ]; - } - } - $res = [ - 'success' => $result[ 'message' ], - 'status' => !empty($result[ 'status' ]) ? $result[ 'status' ] : '', - 'list' => array_reverse($list) - ]; - }else{ - $res = [ - 'success' => false, - 'reason' => '暂无物流信息' - ]; - } - return $res; - } - - /** - * post提交数据 - * @param string $url 请求Url - * @param array $datas 提交的数据 - * @return url响应返回的html - */ - public function sendPost($url, $datas) - { - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_HEADER, 0); - curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($datas)); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - $result = curl_exec($ch); - // 第二个参数为true,表示格式化输出json - $data = json_decode($result, true); - return $data; - } - - /** - * 物流跟踪状态 - * @param $state - */ - public function getStatusName($status) - { - $data = [ - 0 => "暂无轨迹信息", - 1 => "已揽收", - 2 => "在途中", - 3 => "已签收", - 4 => "问题件", - 5 => "转寄", - 6 => "清关" - ]; - $status_name = isset($data[ $status ]) ? $data[ $status ] : ''; - return $status_name; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/service/core/delivery/delivery_search/sdk/Kdbird.php b/niucloud/addon/shop/app/service/core/delivery/delivery_search/sdk/Kdbird.php deleted file mode 100644 index 41398d910..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/delivery_search/sdk/Kdbird.php +++ /dev/null @@ -1,130 +0,0 @@ -EBusinessID = $config[ "kdniao_id" ]; - $this->AppKey = $config[ "kdniao_app_key" ]; - $this->is_pay = $config[ "kdniao_is_pay" ]; - } - - /** - * 物流跟踪 - * @param $shipper_code - * @param $logistic_code - * @param $mobile - * @return array - */ - public function orderTracesSubByJson($shipper_code, $logistic_code, $mobile) - { - $request_array = array( - 'ShipperCode' => $shipper_code, - 'LogisticCode' => $logistic_code, - 'CustomerName' => substr($mobile, 7, 10) - ); - - $requestData = json_encode($request_array); - - $data = array( - 'EBusinessID' => $this->EBusinessID, - 'RequestType' => '8001', - 'RequestData' => urlencode($requestData), - 'DataType' => '2', - ); - - if ($this->is_pay == 2) $data[ 'RequestType' ] = 8002; - - $data[ 'DataSign' ] = $this->encrypt($requestData, $this->AppKey); - $result = $this->sendPost($this->traces_url, $data); - //根据公司业务处理返回的信息...... - $result = json_decode($result, true); - $res = []; - if ($result[ "Success" ] == false) { - $res[ "success" ] = false; - $res[ "reason" ] = $result[ "Reason" ]; - } else { - $list = []; - if (!empty($result[ 'Traces' ])) { - foreach ($result[ 'Traces' ] as $trace) { - $list[] = [ - 'datetime' => $trace[ 'AcceptTime' ], - 'remark' => $trace[ 'AcceptStation' ] - ]; - } - } - $res = [ - 'success' => $result[ 'Success' ], - 'reason' => !empty($result[ 'Reason' ]) ? $result[ 'Reason' ] : '', - 'status' => !empty($result[ 'State' ]) ? $result[ 'State' ] : '', - 'status_name' => !empty($result[ 'State' ]) ? $this->getStatusName($result[ 'State' ]) : '', - 'shipper_code' => !empty($result[ 'ShipperCode' ]) ? $result[ 'ShipperCode' ] : '', - 'logistic_code' => !empty($result[ 'LogisticCode' ]) ? $result[ 'LogisticCode' ] : '', - 'list' => $list - ]; - } - return $res; - } - - /** - * 电商Sign签名生成 - * @param string $data 内容 - * @param $appkey - * @return string DataSign签名 - */ - public function encrypt($data, $appkey) - { - return urlencode(base64_encode(md5($data . $appkey))); - } - - /** - * post提交数据 - * @param string $url 请求Url - * @param array $data 提交的数据 - * @return false|string - */ - public function sendPost($url, $data) - { - $postdata = http_build_query($data); - $options = array( - 'http' => array( - 'method' => 'POST', - 'header' => 'Content-type:application/x-www-form-urlencoded', - 'content' => $postdata, - 'timeout' => 15 * 60 // 超时时间(单位:s) - ) - ); - $context = stream_context_create($options); - $result = file_get_contents($url, false, $context); - return $result; - } - - /** - * 物流跟踪状态 - * @param $status - * @return mixed|string - */ - public function getStatusName($status) - { - $data = [ - 0 => "暂无轨迹信息", - 1 => "已揽收", - 2 => "在途中", - 3 => "已签收", - 4 => "问题件", - 5 => "转寄", - 6 => "清关" - ]; - $status_name = isset($data[ $status ]) ? $data[ $status ] : ''; - return $status_name; - } -} diff --git a/niucloud/addon/shop/app/service/core/delivery/electronic_sheet/BaseElectronicSheetSearch.php b/niucloud/addon/shop/app/service/core/delivery/electronic_sheet/BaseElectronicSheetSearch.php deleted file mode 100644 index 4ca7ba5bf..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/electronic_sheet/BaseElectronicSheetSearch.php +++ /dev/null @@ -1,38 +0,0 @@ - 'KdniaoSearch', - //需线上测试,先隐藏 'kd100' => 'Kd100Search', - ]; - - public function __construct() - { - $config = ( new CoreConfigService() )->getDeliveryElectronSheeticConfig(); - if(empty($config['interface_type']) || !isset($this->method[$config['interface_type']]) ){ - throw new AdminException('NOT_CONFIGURED_DELIVERY_TYPE'); - } - parent::__construct($this->method[$config['interface_type']], $config); - } - - /** - * 空间名 - * @var string - */ - protected $namespace = '\\addon\\shop\\app\\service\\core\\delivery\\electronic_sheet\\'; - - protected $config_name = 'electronic_sheet'; - - /** - * 默认驱动 - * @return mixed - */ - protected function getDefault() - { - return 'kdbird'; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/service/core/delivery/electronic_sheet/Kd100Search.php b/niucloud/addon/shop/app/service/core/delivery/electronic_sheet/Kd100Search.php deleted file mode 100644 index 25c57b769..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/electronic_sheet/Kd100Search.php +++ /dev/null @@ -1,132 +0,0 @@ -key = $config[ 'kd100_key' ] ?? ''; - $this->secret = $config[ 'kd100_secret' ] ?? ''; - if (empty($this->key) || empty($this->secret)){ - throw new AdminException('NOT_CONFIGURED_DELIVERY_KD100'); - } - } - - /** - * 电子面单 - * @param array $data - * @return array - */ - public function electronicSheet(array $data = []) - { - $kd100_config = $data['es_template_info']['kd100_config']; - $template_info = [ - 'printType'=>'HTML',//打印类型,NON:只下单不打印(默认); IMAGE:生成图片短链;HTML:生成html短链 - 'partnerId'=>$kd100_config['month_code'],//单客户账户或月结账号 - 'partnerKey'=>$kd100_config['customer_pwd'],//电子面单密码 - 'partnerSecret'=>$kd100_config['month_code'],//电子面单密钥 - 'partnerName'=>$kd100_config['customer_name'],//电子面单客户账户名称 - 'code'=>$kd100_config['send_site'],//电子面单承载编号 - 'checkMan'=>$kd100_config['send_staff'],//电子面单承载快递员名 - 'payType'=>$kd100_config['pay_type'],//支付方式: SHIPPER:寄方付(默认) CONSIGNEE:到付 MONTHLY:月结 THIRDPARTY - 'expType'=>$data['es_template_info']['exp_type'],//产品类型 - ]; - $param_data =[ - 'kuaidicom'=>$data['es_template_info']['company']['kd100_express_no_electronic_sheet'],//快递公司编码 - 'recMan'=>[ - 'name'=>$data['Receiver']['Name'],//收件人姓名 - 'mobile'=>$data['Receiver']['Mobile'],//收件人手机 - 'printAddr'=>$data['Receiver']['ProvinceName'].$data['Receiver']['CityName'].$data['Receiver']['ExpAreaName'].$data['Receiver']['Address'],//完整地址地址 - ], - 'sendMan'=>[ - 'name'=>$data['Sender']['Name'],//寄件人姓名 - 'mobile'=>$data['Sender']['Mobile'],//寄件人手机 - 'printAddr'=>$data['Sender']['ProvinceName'].$data['Sender']['CityName'].$data['Sender']['ExpAreaName'].$data['Sender']['Address'],//完整地址地址 - ], - 'cargo'=>'商品',//物品名称,例:文件 - 'count'=>$data['Quantity'],//包裹总数量 - 'weight'=>$data['Weight'],//包裹总重量,极兔速递必填 - 'remark'=>'',//备注 - 'tempId'=>$data['es_template_info']['temp_id'],//主单模板, - 'childTempId'=>$data['es_template_info']['child_temp_id'],//子单模板 - 'backTempId'=>$data['es_template_info']['back_temp_id'],//回单模板 - ]; - - $param = array_merge($template_info,$param_data); - $post_data['method'] = 'order'; - $post_data['param'] = json_encode($param, JSON_UNESCAPED_UNICODE); - $post_data['key'] = $this->key; - $post_data['t'] = time(); - $sign = md5($post_data['param'] . $post_data['t']. $this->key . $this->secret); - $post_data[ 'sign' ] = strtoupper($sign); - $result = $this->sendPost($this->url, $post_data); - Log::write('快递100电子面单返回数据'); - Log::write($result); - - $res = [ - 'success' => false, - 'reason' => '', - 'result_code' => 105, - ]; - if (!empty($result[ 'code' ]) && $result[ 'code' ] == 200) { - $res[ 'success' ] = $result[ 'success' ]; - $res[ 'result_code' ] = $result[ 'code' ]; - $data = $result[ 'data' ]; - $res[ 'print_template' ] = $data[ 'label' ]; - $res['order_info'] = [ - 'LogisticCode'=>$data[ 'kuaidinum' ] - ]; - }else{ - $res[ 'reason' ] = $result[ 'message' ]; - } - return $res; - } - - - /** - * post提交数据 - * @param string $url 请求Url - * @param array $datas 提交的数据 - * @return url响应返回的html - */ - public function sendPost($url, $datas) - { - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_HEADER, 0); - curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($datas)); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - $result = curl_exec($ch); - // 第二个参数为true,表示格式化输出json - $result = json_decode($result, true); - return $result; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/service/core/delivery/electronic_sheet/KdniaoSearch.php b/niucloud/addon/shop/app/service/core/delivery/electronic_sheet/KdniaoSearch.php deleted file mode 100644 index cc12efd91..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/electronic_sheet/KdniaoSearch.php +++ /dev/null @@ -1,68 +0,0 @@ -logistic_config = $config; - } - - /** - * 电子面单 - * @param array $data - * @return array - */ - public function electronicSheet(array $data = []) - { - //后端暂不支持单独配置,先注释 -// $kdbird_config = $data['es_template_info']['kdbird_config']; -// $template_info = [ -// 'ShipperCode' => $data['es_template_info']['company'][ 'express_no_electronic_sheet' ], // 快递公司编码 -// 'CustomerName' => $kdbird_config[ 'customer_name' ], // 电子面单账号,申请:https://www.yuque.com/kdnjishuzhichi/rg4owd -// 'CustomerPwd' => $kdbird_config[ 'customer_pwd' ], // 电子面单密码,电子面单账号对照表:https://www.yuque.com/kdnjishuzhichi/dfcrg1/hrfw43 -// 'SendSite' => $kdbird_config[ 'send_site' ], -// 'SendStaff' => $kdbird_config[ 'send_staff' ], -// 'MonthCode' => $kdbird_config[ 'month_code' ], // 月结账号 -// 'PayType' => $kdbird_config[ 'pay_type' ], // 运费支付方式(1:现付,2:到付,3:月结) -// 'ExpType' => $data['es_template_info'][ 'exp_type' ], // 快递业务类型,https://www.yuque.com/kdnjishuzhichi/dfcrg1/hgx758hom5p6wz0l -// 'TemplateSize' => $kdbird_config[ 'print_style' ], // 模板规格,https://www.yuque.com/kdnjishuzhichi/dfcrg1/vpptucr1q5ahcxa7#iZvLV -// 'IsNotice' => $kdbird_config[ 'is_notice' ], // 是否通知快递员上门揽件跨越速运,京东快运必填 -// ]; - $template_info = [ - 'ShipperCode' => $data['es_template_info'][ 'company' ][ 'express_no_electronic_sheet' ], // 快递公司编码 - 'CustomerName' => $data['es_template_info'][ 'customer_name' ], // 电子面单账号,申请:https://www.yuque.com/kdnjishuzhichi/rg4owd - 'CustomerPwd' => $data['es_template_info'][ 'customer_pwd' ], // 电子面单密码,电子面单账号对照表:https://www.yuque.com/kdnjishuzhichi/dfcrg1/hrfw43 - 'SendSite' => $data['es_template_info'][ 'send_site' ], - 'SendStaff' => $data['es_template_info'][ 'send_staff' ], - 'MonthCode' => $data['es_template_info'][ 'month_code' ], // 月结账号 - 'PayType' => $data['es_template_info'][ 'pay_type' ], // 运费支付方式(1:现付,2:到付,3:月结) - 'ExpType' => $data['es_template_info'][ 'exp_type' ], // 快递业务类型,https://www.yuque.com/kdnjishuzhichi/dfcrg1/hgx758hom5p6wz0l - 'TemplateSize' => $data['es_template_info'][ 'print_style' ], // 模板规格,https://www.yuque.com/kdnjishuzhichi/dfcrg1/vpptucr1q5ahcxa7#iZvLV - 'IsNotice' => $data['es_template_info'][ 'is_notice' ], // 是否通知快递员上门揽件跨越速运,京东快运必填 - ]; - $data = array_merge($data, $template_info); - unset($data[ 'es_template_info' ]); - return ( new Kdbird($this->logistic_config) )->electronicSheetByJson($data); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/service/core/delivery/electronic_sheet/sdk/Kdbird.php b/niucloud/addon/shop/app/service/core/delivery/electronic_sheet/sdk/Kdbird.php deleted file mode 100644 index 1caa5293a..000000000 --- a/niucloud/addon/shop/app/service/core/delivery/electronic_sheet/sdk/Kdbird.php +++ /dev/null @@ -1,108 +0,0 @@ -EBusinessID = $config[ "kdniao_id" ]; - $this->ApiKey = $config[ "kdniao_api_key" ]; - } - - /** - * 电子面单 - * 文档:https://www.yuque.com/kdnjishuzhichi/dfcrg1/xxvu6s - * @param $requestData - * @return array - */ - public function electronicSheetByJson($requestData) - { - $jsonParam = json_encode($requestData, JSON_UNESCAPED_UNICODE); - - $data = array( - 'EBusinessID' => $this->EBusinessID, - 'RequestType' => '1007', - 'RequestData' => urlencode($jsonParam), - 'DataType' => '2', - ); - - $data[ 'DataSign' ] = $this->encrypt($jsonParam, $this->ApiKey); - - $key = $requestData[ 'cache_key' ]; - $cache = Cache::get($key); - if (!empty($cache)) { - return $cache; - } - - $result = $this->sendPost($this->electronic_sheet_url, $data); - //根据公司业务处理返回的信息...... - Log::write('电子面单返回数据 electronicSheetByJson:', $result); - $result = json_decode($result, true); - - $res = [ - 'success' => false, - 'reason' => '接口返回为空,请稍后再试', - 'result_code' => 105, - ]; - - if (!empty($result)) { - - $res[ 'success' ] = $result[ 'Success' ]; - $res[ 'result_code' ] = $result[ 'ResultCode' ] ?? -1; - $res[ 'reason' ] = $result[ 'Reason' ]; - if ($res[ 'success' ]) { - $res[ 'print_template' ] = $result[ 'PrintTemplate' ]; - $res[ 'order_info' ] = $result[ 'Order' ]; - $res[ 'order_no' ] = $requestData[ 'OrderCode' ]; // 记录打印的 订单号 - - // 请求成功,存缓存,防止浪费请求资源 - Cache::tag('electronic_sheet_cache_kdbird')->set($key, $res); - } - } - - return $res; - } - - /** - * 电商Sign签名生成 - * @param string $data 内容 - * @param $ApiKey - * @return string DataSign签名 - */ - public function encrypt($data, $ApiKey) - { - return urlencode(base64_encode(md5($data . $ApiKey))); - } - - /** - * post提交数据 - * @param string $url 请求Url - * @param array $data 提交的数据 - * @return false|string - */ - public function sendPost($url, $data) - { - $postdata = http_build_query($data); - $options = array( - 'http' => array( - 'method' => 'POST', - 'header' => 'Content-type:application/x-www-form-urlencoded', - 'content' => $postdata, - 'timeout' => 15 * 60 // 超时时间(单位:s) - ) - ); - $context = stream_context_create($options); - $result = file_get_contents($url, false, $context); - return $result; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/service/core/delivery_store/CoreDeliveryServiceService.php b/niucloud/addon/shop/app/service/core/delivery_store/CoreDeliveryServiceService.php deleted file mode 100644 index 122b38d4a..000000000 --- a/niucloud/addon/shop/app/service/core/delivery_store/CoreDeliveryServiceService.php +++ /dev/null @@ -1,166 +0,0 @@ -model = new Store(); - $this->local_delivery_event = new CoreLocalDeliveryEventService(); - } - - /** - * 获取配送门店信息 - * @param int $id - * @return array - */ - public function getInfo(int $id) - { - return $this->model->where([ [ 'store_id', '=', $id ] ])->findOrEmpty()->toArray(); - } - - /** - * 获取配送服务商列表 - * @return array - */ - public function deliveryServiceList(int $id) - { - $info = $this->getInfo($id); - if (empty($info)) throw new CommonException('DELIVERY_STORE_NOT_EXIST'); - $list = LocalDeliveryDict::getType(); - $keys = (new LocalDeliveryService())->where([['key', 'in', array_keys($list)], ['is_use', '=', 1]])->column('key'); - $support_delivery_array = $info['support_delivery'] ?? []; - foreach ($list as $k => &$v) { - if ($v['is_merchant']) { - $v['open_status'] = LocalDeliveryDict::OPEN_PASS; - $v['business'] = ''; - $v['edit_status'] = ''; - $v['reason'] = ''; - } else { - if (in_array($k, $keys)) { - $v['open_status'] = empty($support_delivery_array[$k]) ? '' : $support_delivery_array[$k]['open_status']; - $v['business'] = empty($support_delivery_array[$k]) ? '' : $support_delivery_array[$k]['business']; - $v['edit_status'] = empty($support_delivery_array[$k]) ? '' : $support_delivery_array[$k]['edit_status']; - $v['reason'] = empty($support_delivery_array[$k]) ? '' : $support_delivery_array[$k]['reason']; - } else { - unset($list[$k]); - } - } - } - return array_values($list); - } - - /** - * 配送门店开通配送服务 - * @param int $id - * @param array $data - * @return true - * @throws \Exception - */ - public function deliveryServiceOpen(int $id, array $data) - { - $info = $this->getInfo($id); - if (empty($info)) throw new CommonException('DELIVERY_STORE_NOT_EXIST'); - $delivery_type = $data['delivery_type']; - $config = (new CoreLocalDeliveryService())->getConfig($delivery_type); - $request_data = [ - 'delivery_type' => $delivery_type, - 'business' => $data['business'], - 'delivery_store' => $info, - ]; - $response_data = $this->local_delivery_event->init(type: $delivery_type, config: $config)->addShop($request_data); - if (!empty($response_data)) { - $update_data['support_delivery'] = array_merge($info['support_delivery'] ?? [], $response_data['support_delivery']); - $update_data['extend_data'] = array_merge($info['extend_data'] ?? [], $data['extend_data']); - $this->model->where([ [ 'store_id', '=', $id ] ])->update($update_data); - } - return true; - } - - /** - * 配送门店品类修改 - * @param int $id - * @param array $data - * @return true - * @throws \Exception - */ - public function deliveryServiceEdit(int $id, array $data) - { - $info = $this->getInfo($id); - if (empty($info)) throw new CommonException('DELIVERY_STORE_NOT_EXIST'); - $delivery_type = $data['delivery_type']; - $config = (new CoreLocalDeliveryService())->getConfig($delivery_type); - $request_data = [ - 'delivery_type' => $delivery_type, - 'business' => $data['business'], - 'delivery_store' => $info, - ]; - $response_data = $this->local_delivery_event->init(type: $delivery_type, config: $config)->editShop($request_data); - if (!empty($response_data)) { - $update_data['support_delivery'] = $response_data['support_delivery']; - $this->model->where([ [ 'store_id', '=', $id ] ])->update($update_data); - } - return true; - } - - /** - * 配送门店信息批量修改 - * @return true - */ - public function batchDeliveryShopEdit(int $id) - { - try { - $info = $this->getInfo($id); - if (empty($info)) throw new CommonException('DELIVERY_STORE_NOT_EXIST'); - $support_delivery_array = $info['support_delivery']; - $delivery_type_list = array_keys(LocalDeliveryDict::getType()); - foreach ($delivery_type_list as $delivery_type) { - if ($delivery_type != LocalDeliveryDict::MERCHANT && !empty($support_delivery_array[$delivery_type]) && $support_delivery_array[$delivery_type]['open_status'] == LocalDeliveryDict::OPEN_PASS) { - $config = (new CoreLocalDeliveryService())->getConfig($delivery_type); - //三方配送更新门店 - $request_data = [ - 'delivery_type' => $delivery_type, - 'business' => $support_delivery_array[$delivery_type]['business'], - 'delivery_store' => $info, - ]; - $response_data = $this->local_delivery_event->init(type: $delivery_type, config: $config)->editShop($request_data); - if (!empty($response_data)) { - $support_delivery_array[$delivery_type]['edit_status'] = $response_data['support_delivery'][$delivery_type]['edit_status']; - $support_delivery_array[$delivery_type]['reason'] = $response_data['support_delivery'][$delivery_type]['reason']; - } - } - } - $update_data['support_delivery'] = $support_delivery_array; - $this->model->where([['store_id', '=', $id]])->update($update_data); - } catch (\Exception $e) { - Log::write('配送门店信息批量修改:'.$e->getMessage()); - } - return true; - } -} diff --git a/niucloud/addon/shop/app/service/core/goods/CoreGoodsAccessNumService.php b/niucloud/addon/shop/app/service/core/goods/CoreGoodsAccessNumService.php deleted file mode 100644 index cfe8ee6bb..000000000 --- a/niucloud/addon/shop/app/service/core/goods/CoreGoodsAccessNumService.php +++ /dev/null @@ -1,51 +0,0 @@ -model = new Goods(); - } - - /** - * 增加 - * @param $data - * @return void - */ - public function inc($data) - { - $this->model->where([['goods_id', '=', $data['goods_id']]])->inc('access_num', $data['access_num']) ->update(); - return true; - } - - /** - * 减少 - * @param $data - * @return void - */ - public function dec($data) - { - $this->model->where([['goods_id', '=', $data['goods_id']]])->dec('access_num', $data['access_num']) ->update(); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/goods/CoreGoodsActivePriceService.php b/niucloud/addon/shop/app/service/core/goods/CoreGoodsActivePriceService.php deleted file mode 100644 index 0c473369e..000000000 --- a/niucloud/addon/shop/app/service/core/goods/CoreGoodsActivePriceService.php +++ /dev/null @@ -1,159 +0,0 @@ - $price, 'show_type' => GoodsDict::ORIGINAL_PRICE ] - ]; - - $goods_service = new GoodsService(); - - if ($member_id > 0) { - $member_price = $goods_service->getMemberPrice($goods_service->getMemberInfo(), $sku_info[ 'member_discount' ], $sku_info[ 'member_price' ], $price); - $show_price_data[] = [ 'show_price' => $member_price, 'show_type' => GoodsDict::MEMBER_PRICE ]; - } - - $discount = (new DiscountGoods())->where([ - [ 'goods_id', '=', $sku_info['goods_id'] ], - [ 'sku_id', '=', $sku_info['sku_id'] ], - [ 'status', '=', DiscountDict::ACTIVE ], - [ 'is_enabled', '=', DiscountDict::YES ], - ])->findOrEmpty(); - - if (!$discount->isEmpty()) { - $discount_price = floatval($sku_info[ 'sale_price' ] ?? 0); - $show_price_data[] = [ 'show_price' => $discount_price, 'show_type' => GoodsDict::DISCOUNT_PRICE, 'discount_id' => $discount['discount_id'] ]; - } - - return $this->getMinShowPrice($show_price_data, $price); - } - - /** - * 查询商品的展示价格 - * @param $sku_info - * @param $member_id - * @return array - */ - public function getShowPrice($sku_info, $member_id) - { - $type = $sku_info[ 'type' ] ?? ''; - $price = floatval($sku_info[ 'price' ]); - $show_price_data = [ - [ 'show_price' => $price, 'show_type' => GoodsDict::ORIGINAL_PRICE ] - ]; - - $goods_service = new GoodsService(); - - if ($member_id > 0) { - $member_price = $goods_service->getMemberPrice($goods_service->getMemberInfo(), $sku_info[ 'member_discount' ], $sku_info[ 'member_price' ], $price); - $show_price_data[] = [ 'show_price' => $member_price, 'show_type' => GoodsDict::MEMBER_PRICE ]; - } - - $discount = (new DiscountGoods())->where([ - [ 'goods_id', '=', $sku_info['goods_id'] ], - [ 'sku_id', '=', $sku_info['sku_id'] ], - [ 'status', '=', DiscountDict::ACTIVE ], - [ 'is_enabled', '=', DiscountDict::YES ], - ])->findOrEmpty(); - - if (!$discount->isEmpty()) { - $discount_price = floatval($sku_info[ 'sale_price' ] ?? 0); - $show_price_data[] = [ 'show_price' => $discount_price, 'show_type' => GoodsDict::DISCOUNT_PRICE ]; - } - -// // 如果有活动类型,只保留该类型对应的价格和原价 -// if (!empty($type)) { -// $show_type = ''; -// -// switch ($type){ -// case ActiveDict::DISCOUNT: -// $show_type = GoodsDict::DISCOUNT_PRICE; -// break; -// } -// if (!empty($show_type)){ -// $show_price_data = array_filter($show_price_data, function ($item) use ($show_type) { -// return in_array($item[ 'show_type' ], [GoodsDict::ORIGINAL_PRICE, $show_type]); -// }); -// }else{ -// $show_price_data = [[ 'show_price' => $price, 'show_type' => GoodsDict::ORIGINAL_PRICE ]]; -// } -// -// // 重建索引 -// $show_price_data = array_values($show_price_data); -// } - return $this->getMinShowPrice($show_price_data, $price); - } - - /** - * 提取最低价格(优先 original_price) - * @param $price_data - * @param $original_price - * @return array - */ - private function getMinShowPrice(array $price_data, float $original_price): array - { - $priority = [ - 'discount_price' => 1, - 'member_price' => 2, - 'original_price' => 3, - ]; - - usort($price_data, function ($one, $two) use ($priority){ - $price_cmp = floatval($one[ 'show_price' ]) <=> floatval($two[ 'show_price' ]); - - if ($price_cmp === 0) { - // 价格相等时按优先级排序,数字越小优先级越高 - return ($priority[ $one[ 'show_type' ] ] ?? 99) <=> ($priority[ $two[ 'show_type' ] ] ?? 99); - } - - return $price_cmp; - }); - - $min = $price_data[0]; - - if ($min[ 'show_type' ] !== GoodsDict::ORIGINAL_PRICE && floatval($min[ 'show_price' ]) == $original_price) { - $min[ 'show_type' ] = GoodsDict::ORIGINAL_PRICE; - } - return $min; - } - - - -} diff --git a/niucloud/addon/shop/app/service/core/goods/CoreGoodsCartNumService.php b/niucloud/addon/shop/app/service/core/goods/CoreGoodsCartNumService.php deleted file mode 100644 index 881fc0ed0..000000000 --- a/niucloud/addon/shop/app/service/core/goods/CoreGoodsCartNumService.php +++ /dev/null @@ -1,51 +0,0 @@ -model = new Goods(); - } - - /** - * 增加 - * @param $data - * @return void - */ - public function inc($data) - { - $this->model->where([['goods_id', '=', $data['goods_id']]])->inc('cart_num', $data['cart_num']) ->update(); - return true; - } - - /** - * 减少 - * @param $data - * @return void - */ - public function dec($data) - { - $this->model->where([['goods_id', '=', $data['goods_id']]])->dec('cart_num', $data['cart_num']) ->update(); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/goods/CoreGoodsCategoryService.php b/niucloud/addon/shop/app/service/core/goods/CoreGoodsCategoryService.php deleted file mode 100644 index 488b41fa5..000000000 --- a/niucloud/addon/shop/app/service/core/goods/CoreGoodsCategoryService.php +++ /dev/null @@ -1,70 +0,0 @@ -model = new Category(); - } - - /** - * 设置商品分类配置 - * @param array $params - * @return array - */ - public function setGoodsCategoryConfig(array $params = []) - { - $goods_config_service = new CoreGoodsConfigService(); - $res = $goods_config_service->setGoodsCategoryConfig($params); - return $res; - } - - /** - * 获取商品分类配置 - * @return array - */ - public function getGoodsCategoryConfig() - { - $goods_config_service = new CoreGoodsConfigService(); - $res = $goods_config_service->getGoodsCategoryConfig(); - return $res; - } - - /** - * 查询商品分类树结构 - * @param string $condition - * @param string $field - * @param string $order - * @return array - */ - public function getTree($condition = [], $field = 'category_id,category_name,image,level,pid,category_full_name,is_show,sort', $order = 'sort desc, create_time desc') - { - $list = $this->model->where($condition)->field($field)->order($order)->select()->toArray(); - $list = list_to_tree($list, 'category_id', 'pid', 'child_list'); - return $list; - } - -} diff --git a/niucloud/addon/shop/app/service/core/goods/CoreGoodsCollectNumService.php b/niucloud/addon/shop/app/service/core/goods/CoreGoodsCollectNumService.php deleted file mode 100644 index 4186d1ef7..000000000 --- a/niucloud/addon/shop/app/service/core/goods/CoreGoodsCollectNumService.php +++ /dev/null @@ -1,51 +0,0 @@ -model = new Goods(); - } - - /** - * 增加 - * @param $data - * @return void - */ - public function inc($data) - { - $this->model->where([['goods_id', '=', $data['goods_id']]])->inc('collect_num', $data['collect_num']) ->update(); - return true; - } - - /** - * 减少 - * @param $data - * @return void - */ - public function dec($data) - { - $this->model->where([['goods_id', '=', $data['goods_id']]])->dec('collect_num', $data['collect_num']) ->update(); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/goods/CoreGoodsConfigService.php b/niucloud/addon/shop/app/service/core/goods/CoreGoodsConfigService.php deleted file mode 100644 index b0c88fe9e..000000000 --- a/niucloud/addon/shop/app/service/core/goods/CoreGoodsConfigService.php +++ /dev/null @@ -1,198 +0,0 @@ -core_config_service = new CoreConfigService(); - } - - /** - * 设置商品分类配置 - * @param array $params - * @return array - */ - public function setGoodsCategoryConfig($params) - { - - $value = [ - "level" => $params[ 'level' ], // 展示分类等级 - "template" => $params[ 'template' ], // 分类模版名称 - 'page_title' => $params[ 'page_title' ], // 页面标题 - "search" => $params[ 'search' ],// 顶部搜索框 - 'goods' => $params[ 'goods' ], // 商品样式,single-cols:单列,double-cols - "sort" => $params[ 'sort' ], // 商品排序,default:综合,sales:热销、price:价格 - 'cart' => $params[ 'cart' ] - ]; - - $this->core_config_service->setConfig('GOODS_CATEGORY_CONFIG', $value); - return true; - } - - /** - * 获取商品分类配置 - * @return array - */ - public function getGoodsCategoryConfig() - { - $res = ( new CoreConfigService() )->getConfig('GOODS_CATEGORY_CONFIG'); - if (empty($res[ 'value' ])) { - $data = [ - "level" => 2, // 展示分类等级 - "template" => "style-1", // 分类模版名称 - 'page_title' => '商品分类', // 页面标题 - // 顶部搜索框 - "search" => [ - 'control' => 1, // 开关,1:开启,0:关闭 - 'title' => '请搜索您想要的商品', // 搜索栏文字 - ], - // 商品样式 - 'goods' => [ - 'style' => 'single-cols' // single-cols:单列,double-cols:双列 - ], - "sort" => "default", // 商品排序,default:综合,sales:热销、price:价格 - 'cart' => [ - 'control' => 1, // 开关,1:开启,0:关闭 - 'event' => 'detail', // 购物车事件,detail:跳转商品详情,cart:加入购物车 - 'style' => 'style-4', // 样式风格 - 'text' => '购买' //文字 - ] - ]; - } else { - $data = [ - "level" => (int) $res[ 'value' ][ 'level' ], // 展示分类等级 - "template" => $res[ 'value' ][ 'template' ], // 分类模版名称 - 'page_title' => $res[ 'value' ][ 'page_title' ], // 页面标题 - "search" => $res[ 'value' ][ 'search' ],// 顶部搜索框 - 'goods' => $res[ 'value' ][ 'goods' ], - "sort" => $res[ 'value' ][ 'sort' ], // 商品排序,default:综合,sales:热销、price:价格 - 'cart' => $res[ 'value' ][ 'cart' ] - ]; - - } - return $data; - } - - /** - * 获取商品搜索配置 - * @return array - */ - public function getSearchConfig() - { - $data = $this->core_config_service->getConfigValue($this->search_key); - if (empty($data)) { - return [ - 'default_word' => '', - 'search_words' => [] - ]; - } - return $data; - } - - /** - * 设置商品搜索配置 - * @param $data - * @return SysConfig|bool|\think\Model - */ - public function setSearchConfig($data) - { - $data[ 'search_words' ] = explode(',', $data[ 'search_words' ]); - return $this->core_config_service->setConfig($this->search_key, $data); - } - - /** - * 获取编码唯一配置 - * @return array|int[]|mixed - */ - public function getUniqueConfig() - { - $data = $this->core_config_service->getConfigValue($this->unique_key); - if (empty($data)) { - return [ - 'is_enable' => 0, - ]; - } - return $data; - } - - /** - * 设置商品编码唯一值配置 - * @param $data - * @return SysConfig|bool|\think\Model - */ - public function setUniqueConfig($data) - { - return $this->core_config_service->setConfig($this->unique_key, $data); - } - - /** - * 获取商品排序设置 - * @return array|int[]|mixed - */ - public function getSortConfig() - { - $data = $this->core_config_service->getConfigValue($this->sort_key); - if (empty($data)) { - $data = [ - 'sort_type' => 'desc', - 'sort_column' => 'create_time', - 'default_sort' => 0, - ]; - } - $data[ 'init' ] = [ - 'sort_type' => GoodsDict::getSortTypeConfig(), - 'sort_column' => GoodsDict::getSortColumnConfig(), - ]; - - return $data; - } - - /** - * 获取设置的默认排序号 - * @return int|mixed - */ - public function getDefaultSort() - { - $sort_config = $this->getSortConfig(); - return $sort_config[ 'default_sort' ] ?? 0; - } - - /** - * 设置商品排序配置 - * @param $data - * @return SysConfig|bool|\think\Model - */ - public function setSortConfig($data) - { - return $this->core_config_service->setConfig($this->sort_key, $data); - } - -} diff --git a/niucloud/addon/shop/app/service/core/goods/CoreGoodsEvaluateService.php b/niucloud/addon/shop/app/service/core/goods/CoreGoodsEvaluateService.php deleted file mode 100644 index d045fb54e..000000000 --- a/niucloud/addon/shop/app/service/core/goods/CoreGoodsEvaluateService.php +++ /dev/null @@ -1,65 +0,0 @@ -model = new Evaluate(); - } - - /** - * 添加评价 - * @param $data - */ - public function addEvaluate($data) - { - $data = [ - 'order_id' => $data[ 'order_id' ] ?? 0, - 'order_goods_id' => $data[ 'order_goods_id' ] ?? 0, - 'goods_id' => $data[ 'goods_id' ], - 'member_id' => $data[ 'member_id' ] ?? 0, - 'member_head' => $data[ 'member_head' ], - 'member_name' => $data[ 'member_name' ], - 'content' => $data[ 'content' ], - 'images' => $data[ 'images' ], - 'is_anonymous' => $data[ 'is_anonymous' ], - 'scores' => $data[ 'scores' ], - 'is_audit' => $data[ 'is_audit' ] ?? 1, - 'create_time' => isset($data[ 'create_time' ]) ? strtotime($data[ 'create_time' ]) : time(), - 'update_time' => 0 - ]; - $res = $this->model->create($data); - if($data[ 'order_id' ] > 0) (new Order())->where([['order_id', '=', $data[ 'order_id' ]]])->update(['is_evaluate' => 1]); - - // 无需审核的增加评论统计数 - if ($data['is_audit'] == EvaluateDict::AUDIT_NO) { - CoreGoodsStatService::addStat(['goods_id' => $data[ 'goods_id' ], 'evaluate_num' => 1]); - (new Goods())->where([['goods_id', '=', $data['goods_id']]])->inc('evaluate_num', 1) ->update(); - } - - return $res->evaluate_id; - } - -} diff --git a/niucloud/addon/shop/app/service/core/goods/CoreGoodsLimitBuyService.php b/niucloud/addon/shop/app/service/core/goods/CoreGoodsLimitBuyService.php deleted file mode 100644 index 876c20989..000000000 --- a/niucloud/addon/shop/app/service/core/goods/CoreGoodsLimitBuyService.php +++ /dev/null @@ -1,84 +0,0 @@ -model = new Goods(); - } - - /** - * 检测商品限购 - * @param int $member_id - * @param array $goods_list - * @return string - */ - public function checkGoodsLimitBuy(int $member_id, array $goods_list) - { - $goods_count = count($goods_list); - foreach ($goods_list as $item) { - if ($item[ 'min_buy' ] > 0) { - if ($item[ 'stock' ] < $item[ 'min_buy' ]) { - return ($goods_count > 1 ? "商品“" . $item[ 'goods_name' ] . "”" : "该商品") . "库存数量小于起购数量"; - } - if ($item[ 'num' ] < $item[ 'min_buy' ]) { - return ($goods_count > 1 ? "商品“" . $item[ 'goods_name' ] . "”" : "该商品") . $item[ 'min_buy' ] . "件起购"; - } - } - if ($item[ 'is_limit' ] == 1 && $item[ 'max_buy' ] > 0) { - if ($item[ 'limit_type' ] == GoodsDict::SINGLE_TIME) {//单次限购 - if ($item[ 'num' ] > $item[ 'max_buy' ]) { - return ($goods_count > 1 ? "商品“" . $item[ 'goods_name' ] . "”" : "该商品") . "单次限购" . $item[ 'max_buy' ] . "件"; - } - } elseif ($item[ 'limit_type' ] == GoodsDict::SINGLE_PERSON) {//长期限购 - $sum = $this->getGoodsHasBuyNumber($member_id, $item[ 'goods_id' ]); - if ($sum + $item[ 'num' ] > $item[ 'max_buy' ]) { - return ($goods_count > 1 ? "商品“" . $item[ 'goods_name' ] . "”" : "该商品") . "每人限购" . $item[ 'max_buy' ] . "件" . ($sum > 0 ? ",您已购买" . $sum . "件" : ""); - } - } - } - } - return ""; - } - - /** - * 获取已购买的商品数量 - * @param $member_id - * @param $goods_id - * @return int - */ - public function getGoodsHasBuyNumber($member_id, $goods_id) - { - return ( new OrderGoods() )->withJoin([ 'orderMain' ])->where([ - [ 'order_goods.member_id', '=', $member_id ], - [ 'order_goods.goods_id', '=', $goods_id ], - [ 'order_goods.status', '<>', OrderGoodsDict::REFUND_FINISH ], - [ 'orderMain.status', '<>', OrderDict::CLOSE ] - ])->sum('num'); - } - -} diff --git a/niucloud/addon/shop/app/service/core/goods/CoreGoodsRankConfigService.php b/niucloud/addon/shop/app/service/core/goods/CoreGoodsRankConfigService.php deleted file mode 100644 index 3ff1f6a2a..000000000 --- a/niucloud/addon/shop/app/service/core/goods/CoreGoodsRankConfigService.php +++ /dev/null @@ -1,74 +0,0 @@ -core_config_service = new CoreConfigService(); - } - - /** - * 设置商品排行榜配置 - * @param array $params - * @return bool - */ - public function setGoodsRankConfig($params) - { - $value = [ -// "rank_name" => $params[ 'rank_name' ], // 排行榜名称 - "rank_images" => $params[ 'rank_images' ], // 广告图 -// 'rank_remark' => $params[ 'rank_remark' ], // 备注 - "no_color" => $params[ 'no_color' ], // 常规颜色 - "select_color" => $params[ 'select_color' ], // 选中文字颜色 - "select_bg_color_start" => $params[ 'select_bg_color_start' ], // 选中背景色(开始) - "select_bg_color_end" => $params[ 'select_bg_color_end' ], // 选中背景色(结束) - ]; - - $this->core_config_service->setConfig('GOODS_RANK_CONFIG', $value); - return true; - } - - /** - * 获取商品排行榜配置 - * @return array - */ - public function getGoodsRankConfig() - { - $res = ( new CoreConfigService() )->getConfig('GOODS_RANK_CONFIG'); - $data = [ -// 'rank_name' => $res[ 'value' ][ 'rank_name' ] ?? '排名依据销量与销售额计算 定时更新', - 'rank_images' => $res[ 'value' ][ 'rank_images' ] ?? 'addon/shop/rank/rank_images.jpg', -// 'rank_remark' => $res[ 'value' ][ 'rank_remark' ] ?? '精选商城内销量最高的商品,涵盖多个品类,为用户提供当前最受欢迎的商品参考。'. PHP_EOL.'本榜单以销量为主要排名依据,保证推荐商品的高质量和高热度。', - 'no_color' => $res[ 'value' ][ 'no_color' ] ?? '#FFFCF5', - 'select_color' => $res[ 'value' ][ 'select_color' ] ?? '#FF4142', - 'select_bg_color_start' => $res[ 'value' ][ 'select_bg_color_start' ] ?? '#FFFFFF', - 'select_bg_color_end' => $res[ 'value' ][ 'select_bg_color_end' ] ?? '#FFEBD7', - ]; - return $data; - } - -} diff --git a/niucloud/addon/shop/app/service/core/goods/CoreGoodsSaleNumService.php b/niucloud/addon/shop/app/service/core/goods/CoreGoodsSaleNumService.php deleted file mode 100644 index e851ef361..000000000 --- a/niucloud/addon/shop/app/service/core/goods/CoreGoodsSaleNumService.php +++ /dev/null @@ -1,68 +0,0 @@ -model = new Goods(); - } - - /** - * 增加 - * @param $data - * @return void - */ - public function inc($data) - { - $this->model->where([ [ 'goods_id', '=', $data[ 'goods_id' ] ] ])->inc('sale_num', $data[ 'num' ])->update(); - ( new GoodsSku() )->where([ [ 'sku_id', '=', $data[ 'sku_id' ] ] ])->inc('sale_num', $data[ 'num' ])->update(); - return true; - } - - /** - * 减少 - * @param $data - * @return void - */ - public function dec($data) - { - $this->model->where([ [ 'goods_id', '=', $data[ 'goods_id' ] ] ])->dec('sale_num', $data[ 'num' ])->update(); - ( new GoodsSku() )->where([ [ 'sku_id', '=', $data[ 'sku_id' ] ] ])->dec('sale_num', $data[ 'num' ])->update(); - return true; - } - - public function batchUpdateSaleNum($data) - { - if (!isset($data['goods']) || !isset($data['sku'])) { - return false; - } - try { - $this->model->saveAll($data['goods']); - (new GoodsSku())->saveAll($data['sku']); - }catch (\Exception $e){ - throw new \Exception($e->getMessage()); - } - } - - -} diff --git a/niucloud/addon/shop/app/service/core/goods/CoreGoodsStatService.php b/niucloud/addon/shop/app/service/core/goods/CoreGoodsStatService.php deleted file mode 100644 index 1a547797b..000000000 --- a/niucloud/addon/shop/app/service/core/goods/CoreGoodsStatService.php +++ /dev/null @@ -1,172 +0,0 @@ - date('Y-m-d', time()), - 'date_time' => strtotime(date('Y-m-d', time())), - 'goods_id' => $data[ 'goods_id' ], - ]; - if ($stat_data['goods_id'] <= 0) return false; - - $stat = ( new Stat() )->where($stat_data)->findOrEmpty(); - if ($stat->isEmpty()) { - $stat->allowField(array_merge(array_keys($stat_data), self::STAT_FIELD))->save(array_merge($stat_data, $data)); - } else { - unset($data[ 'goods_id' ]); - foreach ($data as $key => $value) { - $stat->$key = Db::raw("{$key} + {$value}"); - } - $stat->allowField(self::STAT_FIELD)->save(); - } - return true; - } - - /** - * 累减统计数据 - * @param $data - * @return true - */ - public static function decStat($data = []) - { - $time = strtotime($data['time']); - // 更新天统计 - $stat_data = [ - 'date' => date('Y-m-d', $time), - 'date_time' => strtotime(date('Y-m-d', $time)), - 'goods_id' => $data[ 'goods_id' ], - ]; - - $stat = ( new Stat() )->where($stat_data)->findOrEmpty(); - if (!$stat->isEmpty()) { - unset($data[ 'goods_id' ]); - unset($data[ 'time' ]); - foreach ($data as $key => $value) { - $stat->$key = Db::raw("CASE WHEN {$key} - {$value} >= 0 THEN {$key} - {$value} ELSE 0 END"); - } - $stat->allowField(self::STAT_FIELD)->save(); - } - return true; - } - - /** - * 获取时间区间内天统计数据 - * @param int $goods_id - * @param string $start_date - * @param string $end_date - * @return array - */ - public function getStatData(int $goods_id, string $start_date, string $end_date) - { - $start_date = strtotime($start_date); - $end_date = strtotime($end_date); - - $field = implode(',', array_merge(self::STAT_FIELD, [ 'date' ])); - $stat_data = ( new Stat() )->where([ [ 'goods_id', '=', $goods_id ], [ 'date_time', '>=', $start_date ], [ 'date_time', '<=', $end_date ] ])->field($field)->select()->toArray(); - $stat_data = !empty($stat_data) ? array_column($stat_data, null, 'date') : []; - - $data = []; - $day = ceil(( $end_date - $start_date ) / 86400); - foreach (self::STAT_FIELD as $field) { - $value = []; - $time = []; - for ($i = 0; $i < $day; $i++) { - $date = date('Y-m-d', $start_date + $i * 86400); - $time[] = $date; - - $value[] = isset($stat_data[ $date ]) && isset($stat_data[ $date ][ $field ]) ? $stat_data[ $date ][ $field ] : 0; - } - $data[ $field ] = $value; - $data[ 'time' ] = $time; - } - - return $data; - } - - /** - * 根据订单统计商品的支付数量及支付金额 - * @param $order_data - * @return bool - */ - public function saveGoodsPayNumAndMoneyByOrderId($order_data) - { - $order_goods_model = new OrderGoods(); - $order_goods_data = $order_goods_model->where([ 'order_id' => $order_data[ 'order_id' ] ])->select()->toArray(); - if (!empty($order_goods_data)) { - foreach ($order_goods_data as $goods) { - CoreGoodsStatService::addStat([ 'goods_id' => $goods[ 'goods_id' ], 'pay_num' => $goods[ 'num' ], 'pay_money' => $goods[ 'order_goods_money' ] ]); - - ( new Goods() )->where([ [ 'goods_id', '=', $goods[ 'goods_id' ] ] ])->inc('pay_num', $goods[ 'num' ])->update(); // 更新支付件数 - ( new Goods() )->where([ [ 'goods_id', '=', $goods[ 'goods_id' ] ] ])->inc('pay_money', $goods[ 'order_goods_money' ])->update(); // 更新支付金额 - } - } - return true; - } - - /** - * 根据退款订单统计商品的退款件数、金额 - * @param $refund_data - * @return bool - */ - public function saveGoodsRefundNumAndMoneyByOrderId($refund_data) - { - $order_goods_model = new OrderGoods(); - $order_goods_info = $order_goods_model->where([ 'order_goods_id' => $refund_data[ 'order_goods_id' ] ])->findOrEmpty(); - if (!$order_goods_info->isEmpty()) { - CoreGoodsStatService::addStat([ 'goods_id' => $order_goods_info[ 'goods_id' ], 'refund_num' => $order_goods_info[ 'num' ], 'refund_money' => $refund_data[ 'money' ] ]); - - ( new Goods() )->where([ [ 'goods_id', '=', $order_goods_info[ 'goods_id' ] ] ])->inc('refund_num', $order_goods_info[ 'num' ])->update(); // 更新退款件数 - ( new Goods() )->where([ [ 'goods_id', '=', $order_goods_info[ 'goods_id' ] ] ])->inc('refund_money', $refund_data[ 'money' ])->update(); // 更新退款金额 - } - - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/goods/CoreGoodsStockService.php b/niucloud/addon/shop/app/service/core/goods/CoreGoodsStockService.php deleted file mode 100644 index b5a31e92b..000000000 --- a/niucloud/addon/shop/app/service/core/goods/CoreGoodsStockService.php +++ /dev/null @@ -1,68 +0,0 @@ -model = new Goods(); - } - - /** - * 增加库存 - * @param $data - * @return void - */ - public function inc($data) - { - $this->model->where([['goods_id', '=', $data['goods_id']]])->inc('stock', $data['num'])->update(); - (new GoodsSku())->where([['sku_id', '=', $data['sku_id']]])->inc('stock', $data['num'])->update(); - return true; - } - - public function batchUpdateStock($data) - { - if (!isset($data['goods']) || !isset($data['sku'])) { - return false; - } - try { - $this->model->saveAll($data['goods']); - (new GoodsSku())->saveAll($data['sku']); - }catch (\Exception $e){ - throw new \Exception($e->getMessage()); - } - } - - /** - * 减少库存 - * @param $data - * @return void - */ - public function dec($data) - { - $this->model->where([['goods_id', '=', $data['goods_id']]])->dec('stock', $data['num'])->update(); - (new GoodsSku())->where([['sku_id', '=', $data['sku_id']]])->dec('stock', $data['num'])->update(); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryEventService.php b/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryEventService.php deleted file mode 100644 index cb858e18c..000000000 --- a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryEventService.php +++ /dev/null @@ -1,153 +0,0 @@ -type = $type; - $this->order_no = $order_no; - $this->config = $config; - return $this; - } - - /** - * 获取实例化应用 - * @param string $action - * @return LocalDeliveryLoader - * @throws Exception - */ - public function app(string $action = 'order') - { - $notify_url = (string)url("/api/delivery/notify/$this->type/$this->order_no/$action", [], '', true);//异步回调通知地址 - $this->config['notify_url'] = $notify_url; - return new LocalDeliveryLoader($this->type, $this->config); - } - - /** - * 直接下单 - * @param array $params - * @return mixed - * @throws Exception - */ - public function createOrder(array $params = []) - { - return $this->app()->createOrder($params); - } - - /** - * 查询运费 - * @param array $params - * @return mixed - * @throws Exception - */ - public function calculate(array $params = []) - { - return $this->app()->calculate($params); - } - - /** - * 取消订单 - * @param array $params - * @return mixed - * @throws Exception - */ - public function closeOrder(array $params = []) - { - return $this->app()->closeOrder($params); - } - - /** - * 完成订单 - * @param array $params - * @return mixed - * @throws Exception - */ - public function finishOrder(array $params = []) - { - return $this->app()->finishOrder($params); - } - - /** - * 查询订单 - * @param array $params - * @return mixed - * @throws Exception - */ - public function queryOrderInfo(array $params = []) - { - return $this->app()->queryOrderInfo($params); - } - - /** - * 添加门店 - * @param array $params - * @return mixed - * @throws Exception - */ - public function addShop(array $params = []) - { - return $this->app()->addShop($params); - } - - /** - * 编辑门店 - * @param array $params - * @return mixed - * @throws Exception - */ - public function editShop(array $params = []) - { - return $this->app()->editShop($params); - } - - /** - * 支付异步通知 - * @param string $action - * @param array $params - * @return ResponseInterface|Response - * @throws Exception - */ - public function notify(string $action, array $params = []) - { - return $this->app()->notify($action, $params); - } -} diff --git a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderCloseService.php b/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderCloseService.php deleted file mode 100644 index 593db3e97..000000000 --- a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderCloseService.php +++ /dev/null @@ -1,77 +0,0 @@ -model = new LocalDeliveryOrder(); - $this->local_delivery_event = new CoreLocalDeliveryEventService(); - } - - /** - * 取消订单 - * @param array $data - * @return bool - * @throws \Exception - */ - public function closeOrder(array $data) - { - $delivery_order_condition = []; - $id = $data['id'] ?? 0; - if(empty($id)){ - $trade_no = $data['trade_no']; - $trade_type = $data['trade_type']; - $delivery_order_condition[] = ['trade_no', '=', $trade_no]; - $delivery_order_condition[] = ['trade_type', '=', $trade_type]; - }else{ - $delivery_order_condition[] = ['id', '=', $id]; - } - $info = $this->model->where($delivery_order_condition)->findOrEmpty(); - if ($info->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - $delivery_service = $info['delivery_service']; - $save_data = [ - 'remark' => $data['cancel_reason_id'] ? OrderCancelReasonDict::getType($data['cancel_reason_id'], $delivery_service) : $data['cancel_reason'] - ]; - $config = (new CoreLocalDeliveryService())->getConfig($delivery_service); - $request_data = [ - 'delivery_no' => $info['delivery_no'], - 'cancel_reason_id' => $data['cancel_reason_id'], - 'cancel_reason' => $data['cancel_reason'], - 'main_id' => $data['main_id'] ?? 0, - 'main_type' => $data['main_type'] ?? OrderLogDict::STORE, - 'main_name' => $data['main_name'] ?? '', - ]; - $response_data = $this->local_delivery_event->init(type: $delivery_service, config: $config)->closeOrder($request_data); - if (empty($response_data)) { - return false; - } - $save_data = array_merge($save_data, $response_data); - $info->save($save_data); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderCreateService.php b/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderCreateService.php deleted file mode 100644 index 2bd507393..000000000 --- a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderCreateService.php +++ /dev/null @@ -1,189 +0,0 @@ -model = new LocalDeliveryOrder(); - $this->local_delivery_event = new CoreLocalDeliveryEventService(); - } - - /** - * 订单创建 - * @param $data - * @return true - * @throws \Exception - */ - public function create($data) - { - $order_data = $data['order_data']; - $order_goods_data = $data['order_goods_data']; - $local_delivery_no = $data['local_delivery_no']; - $param = $data['param']; - $delivery_service = $param['local_delivery_type']; - $store_id = empty($param['store_id']) ? $order_data['take_store_id'] : $param['store_id'];//提货点id - - $config = $this->checkDeliveryService($store_id, $delivery_service); - - $delivery_order_data = [ - 'store_id' => $store_id, - 'delivery_service' => $delivery_service, - 'delivery_no' => $local_delivery_no, - 'status' => LocalDeliveryStatusDict::ORDER_ACCEPTED, - 'trade_id' => $order_data['order_id'], - 'trade_no' => $data['trade_no'], - 'delivery_end' => $order_data['taker_full_address'], - 'delivery_end_province_id' => $order_data['taker_province'], - 'delivery_end_city_id' => $order_data['taker_city'], - 'delivery_end_district_id' => $order_data['taker_district'], - 'delivery_end_lng' => $order_data['taker_longitude'], - 'delivery_end_lat' => $order_data['taker_latitude'], - 'body' => $order_data['body'] ?? '' - ]; - $order_id = $this->createOrder($delivery_order_data); - - if (!empty($order_id)) { - //第三方配送下单 - $request_data = [ - 'order_data' => $order_data, - 'trade_no' => $data['trade_no'], - 'order_goods_data' => $order_goods_data, - 'delivery_no' => $local_delivery_no, - 'param' => $param, - 'deliver_id' => $param['local_deliver_id'], - 'body' => $order_data['body'] ?? '' - ]; - $response_data = (new CoreLocalDeliveryEventService())->init($delivery_service, $local_delivery_no, $config)->createOrder($request_data); - if (empty($response_data)) { - throw new CommonException('呼叫配送失败'); - } - $this->model->where([['id', '=', $order_id]])->update($response_data); - } - - return true; - } - - /** - * 创建配送订单 - * @param $params - * @return mixed - */ - public function createOrder($params) - { - $store = (new Store())->where([['store_id', '=', $params['store_id']]])->findOrEmpty()->toArray(); - $data = [ - 'delivery_service' => $params['delivery_service'], - 'delivery_no' => $params['delivery_no'], - 'out_delivery_no' => $params['out_delivery_no'] ?? '', - 'delivery_money' => $params['delivery_money'] ?? 0, - 'delivery_distance' => $params['delivery_distance'] ?? 0, - 'status' => $params['status'], - 'out_status' => $params['out_status'] ?? '', - 'rider_name' => $params['rider_name'] ?? '', - 'rider_mobile' => $params['rider_mobile'] ?? '', - 'trade_id' => $params['trade_id'] ?? 0, - 'trade_no' => $params['trade_no'], - 'delivery_start' => $store['full_address'] ?? '', - 'delivery_start_province_id' => $store['province_id'] ?? '', - 'delivery_start_city_id' => $store['city_id'] ?? '', - 'delivery_start_district_id' => $store['district_id'] ?? '', - 'delivery_start_lng' => $store['longitude'] ?? '', - 'delivery_start_lat' => $store['latitude'] ?? '', - 'delivery_end' => $params['delivery_end'], - 'delivery_end_province_id' => $params['delivery_end_province_id'] ?? '', - 'delivery_end_city_id' => $params['delivery_end_city_id'] ?? '', - 'delivery_end_district_id' => $params['delivery_end_district_id'] ?? '', - 'delivery_end_lng' => $params['delivery_end_lng'] ?? '', - 'delivery_end_lat' => $params['delivery_end_lat'] ?? '', - 'remark' => $params['remark'] ?? '', - 'body' => $params['body'] ?? '', - 'create_time' => time() - ]; - //添加配送订单记录 - $res = $this->model->create($data); - //添加配送订单日志 - $operate = OrderLogDict::getOperate($res['status']); - (new CoreLocalDeliveryOrderLogService())->addLog([ - 'order_id' => $res['id'], - 'main_id' => '', - 'main_type' => OrderLogDict::STORE, - 'main_name' => '', - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => $res['status'], - 'remark' => $operate['operate_desc'] - ]); - return $res->id; - } - - /** - * 配送费用计算 - * @param $data - * @return mixed - * @throws \Exception - */ - public function getDeliveryFee($data) - { - $order_data = $data['order_data']; - $store_id = empty($data['store_id']) ? $order_data['take_store_id'] : $data['store_id'];//提货点id - $order_goods_data = $data['order_goods_data']; - if (empty($data['local_delivery_type'])) throw new CommonException('DELIVERY_SERVICE_NOT_SELECT'); - $delivery_service = $data['local_delivery_type']; - - $config = $this->checkDeliveryService($store_id, $delivery_service); - $delivery_no = create_no();//创建本地配送单号 - $request_data = [ - 'order_data' => $order_data, - 'order_goods_data' => $order_goods_data, - 'param' => $data, - 'delivery_no' => $delivery_no, - ]; - $response_data = $this->local_delivery_event->init($delivery_service, $delivery_no, $config)->calculate($request_data); - return $response_data['delivery_money'] ?? 0; - } - - public function checkDeliveryService($store_id, $delivery_service) - { - $config = []; - $store = (new Store())->field('store_no,support_delivery')->where([['store_id', '=', $store_id]])->findOrEmpty()->toArray(); - if (empty($store)) throw new CommonException('DELIVERY_STORE_NOT_EXIST'); - if ($delivery_service != LocalDeliveryDict::MERCHANT) { - $config = (new CoreLocalDeliveryService())->getConfig($delivery_service); - if (empty($store['support_delivery']) || empty($store['support_delivery'][$delivery_service]) || $store['support_delivery'][$delivery_service]['open_status'] != LocalDeliveryDict::OPEN_PASS) { - throw new CommonException('配送门店未开通'.LocalDeliveryDict::getType($delivery_service)); - } - if (isset($config['is_use']) && $config['is_use'] != 1) { - throw new CommonException(LocalDeliveryDict::getType($delivery_service).'未启用'); - } - } - $config['store_no'] = $store['store_no']; - return $config; - } - -} diff --git a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderFinishService.php b/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderFinishService.php deleted file mode 100644 index c0576ea28..000000000 --- a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderFinishService.php +++ /dev/null @@ -1,74 +0,0 @@ -model = new LocalDeliveryOrder(); - $this->local_delivery_event = new CoreLocalDeliveryEventService(); - } - - /** - * 完成订单 - * @param array $data - * @return bool - * @throws \Exception - */ - public function finishOrder(array $data) - { - $delivery_order_condition = []; - $id = $data['id'] ?? 0; - if(empty($id)){ - $trade_no = $data['trade_no']; - $trade_type = $data['trade_type']; - $delivery_order_condition[] = ['trade_no', '=', $trade_no]; - $delivery_order_condition[] = ['trade_type', '=', $trade_type]; - }else{ - $delivery_order_condition[] = ['id', '=', $id]; - } - $info = $this->model->where($delivery_order_condition)->findOrEmpty(); - if ($info->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - $delivery_service = $info['delivery_service']; - $save_data = [ - 'finish_time' => time(), - ]; - $config = (new CoreLocalDeliveryService())->getConfig($delivery_service); - $request_data = [ - 'delivery_no' => $info['delivery_no'], - 'main_id' => $data['main_id'] ?? 0, - 'main_type' => $data['main_type'] ?? OrderLogDict::STORE, - 'main_name' => $data['main_name'] ?? '', - ]; - $response_data = $this->local_delivery_event->init(type: $delivery_service, config: $config)->finishOrder($request_data); - if (empty($response_data)) { - return false; - } - $save_data = array_merge($save_data, $response_data); - $info->save($save_data); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderLogService.php b/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderLogService.php deleted file mode 100644 index 1451a414a..000000000 --- a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderLogService.php +++ /dev/null @@ -1,51 +0,0 @@ -model = new LocalDeliveryOrderLog(); - } - - /** - * 添加配送订单日志 - * @param $params - * @return LocalDeliveryOrderLog|\think\Model - */ - public function addLog($params) - { - $data = [ - 'order_id' => $params['order_id'], - 'main_id' => $params['main_id'] ?? 0, - 'main_type' => $params['main_type'], - 'main_name' => $params['main_name'] ?? '', - 'operate' => $params['operate'], - 'operate_desc' => $params['operate_desc'], - 'status' => $params['status'], - 'remark' => $params['remark'] ?? '', - ]; -// dd($data); - return $this->model->create($data); - } - -} diff --git a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderNotifyService.php b/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderNotifyService.php deleted file mode 100644 index 36a4cad6d..000000000 --- a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderNotifyService.php +++ /dev/null @@ -1,45 +0,0 @@ -model = new LocalDeliveryOrder(); - $this->local_delivery_event = new CoreLocalDeliveryEventService(); - } - - public function notify($type, $delivery_no, $action, $params = []) - { - Log::write('同城配送订单状态回调参数:' . json_encode($params)); - try { - return $this->local_delivery_event->init($type, $delivery_no)->notify($action, $params); - } catch ( CommonException $e ) { - Log::write('同城配送订单状态回调失败:'.json_encode(func_get_args()) .$e->getMessage(), 'error'); - return false; - } - } - -} diff --git a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderService.php b/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderService.php deleted file mode 100644 index 895cd9e1c..000000000 --- a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryOrderService.php +++ /dev/null @@ -1,202 +0,0 @@ -model = new LocalDeliveryOrder(); - $this->local_delivery_event = new CoreLocalDeliveryEventService(); - } - - /** - * 同步订单信息 - * @param int $id - * @return bool - * @throws \Exception - */ - public function syncOrder(int $id) - { - $info = $this->model->where([['id', '=', $id]])->findOrEmpty(); - if ($info->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - $delivery_service = $info['delivery_service']; - $config = (new CoreLocalDeliveryService())->getConfig($delivery_service); - $request_data = [ - 'delivery_no' => $info['delivery_no'] - ]; - $save_data = $this->local_delivery_event->init(type: $delivery_service, config: $config)->queryOrderInfo($request_data); - if (empty($save_data)) { - return false; - } - return $info->save($save_data); - } - - /** - * 检查当前交易下是否有在进行中的配送订单 - * @param $data - * @return bool - */ - public function getUnderwayDeliveryOrder($data){ - $order = $this->model->where([ - ['trade_no', '=', $data['trade_no']], - ['status', '<>', LocalDeliveryStatusDict::CANCELED] - ])->findOrEmpty(); - if ($order->isEmpty()) { - return true; - } else { - return false; - } - } - - /** - * 获取配送轨迹 - * @param $param - * @return array|array[] - */ - public function getTrackInfo($param){ - $local_delivery_order_model = new LocalDeliveryOrder(); - $local_delivery_order = $local_delivery_order_model->where([['trade_no', '=', $param['trade_no']]])->order('create_time desc')->findOrEmpty(); -// //查询配送订单的起始点 - $local_delivery_order['member_id'] = $param['member_id']; - $points = array_filter(event('GetLocalDeliveryTrack', $local_delivery_order))[0] ?? []; - if(empty($points)) return []; - $data = [ - 'points' => $points, - ]; - //增加 -// $config = new CoreConfigService(); -// $config_value = $config->getDeliveryConfig(); -// $is_show_polyline = $config_value['is_show_polyline'] ?? false; - //todo 增加配送轨迹是否开启配置 - $is_show_polyline = true; - if(count($data['points']) > 1){ - $center = $this->calculateCenter($data['points']); - $driving = $data['driving'] ?? []; - if($is_show_polyline){ - $from_point = $data['points'][0] ?? []; - $to_point = $data['points'][1] ?? []; - try { - $driving = (new CoreMapService())->getPolyline([ - 'from' => $from_point['latitude'] . ',' . $from_point['longitude'], - 'to' => $to_point['latitude'] . ',' . $to_point['longitude']] - ); - } catch (DbException $e) { - } - } - - }else{ - $center = [ - 'latitude' => $data['points'][0]['latitude'], - 'longitude' => $data['points'][0]['longitude'], - ]; - } - $data['center'] = $center; - $data['driving'] = $driving ?? []; - $data['local_delivery_order'] = $local_delivery_order; - $data['step'] = [ - [ - 'desc' => '已接单', - 'logo' => '' - ], - [ - 'desc' => '召唤骑手取货', - 'logo' => '' - ], - [ - 'desc' => '骑手配送中', - 'logo' => '' - ], - [ - 'desc' => '配送完成', - 'logo' => '' - ], - ]; - $data['expected_finish_time'] = $this->getExpectedFinishTime($data); - //{"step":[{"desc":"已接单","logo":""},{"desc":"召唤骑手取货","logo":""},{"desc":"骑手配送中","logo":""},{"desc":"配送完成","logo":""}],"center":{"latitude":0,"longitude":0},"points":[{"name":"","latitude":0,"longitude":0,"avayar":"","logo":"","tab":{"content":"骑手:王大锤 | 工号:1214564646546464"}},{"name":"","latitude":0,"longitude":0,"avayar":"","logo":"","tab":{"content":""}}],"driving":{}} - return $data; - } - - /** - * 计算预计送达时间 - * @param $data - * @return string - */ - function getExpectedFinishTime($data) - { - $local_delivery_order = $data['local_delivery_order']; - $points = $data['points']; - $current_time = time(); - $rider_speed = 25; // 骑手速度,单位:公里/小时 - $expected_finish_time = $current_time; - - switch ($local_delivery_order['status']){ - case LocalDeliveryStatusDict::ORDER_ACCEPTED: - case LocalDeliveryStatusDict::PENDING_ACCEPTANCE: - $distance = get_map_distance($local_delivery_order['delivery_start_lat'], $local_delivery_order['delivery_start_lng'], $local_delivery_order['delivery_end_lat'], $local_delivery_order['delivery_end_lng']); - $expected_finish_time += ($distance / $rider_speed) * 3600 + 600; - break; - case LocalDeliveryStatusDict::PENDING_PICKUP: - if(count($data['points']) > 1) { - $distance1 = get_map_distance($points[0]['latitude'], $points[0]['longitude'], $points[1]['latitude'], $points[1]['longitude']); - } else { - $distance1 = 0; - } - $distance2 = get_map_distance($local_delivery_order['delivery_start_lat'], $local_delivery_order['delivery_start_lng'], $local_delivery_order['delivery_end_lat'], $local_delivery_order['delivery_end_lng']); - $expected_finish_time += ($distance1 + $distance2) / $rider_speed * 3600; - break; - case LocalDeliveryStatusDict::RIDER_ARRIVED: - $distance1 = get_map_distance($points[0]['latitude'], $points[0]['longitude'], $points[1]['latitude'], $points[1]['longitude']); - $distance2 = get_map_distance($local_delivery_order['delivery_start_lat'], $local_delivery_order['delivery_start_lng'], $local_delivery_order['delivery_end_lat'], $local_delivery_order['delivery_end_lng']); - $expected_finish_time += ($distance1 + $distance2) / $rider_speed * 3600; - break; - case LocalDeliveryStatusDict::IN_DELIVERY: - $distance = get_map_distance($points[0]['latitude'], $points[0]['longitude'], $points[1]['latitude'], $points[1]['longitude']); - $expected_finish_time += ($distance / $rider_speed) * 3600; - break; - } - return date('H:i', $expected_finish_time); - } - - /** - * 计算中心点 - * @param $points - * @return float[]|int[] - */ - function calculateCenter($points) { - $sumX = 0; - $sumY = 0; - $count = count($points); // 获取点的数量 - foreach ($points as $point) { - $sumX += $point['latitude']; - $sumY += $point['longitude']; - } - $xCenter = $sumX / $count; - $yCenter = $sumY / $count; - return ['latitude' => $xCenter, 'longitude' => $yCenter]; - } -} diff --git a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryService.php b/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryService.php deleted file mode 100644 index 7e0fea0bf..000000000 --- a/niucloud/addon/shop/app/service/core/local_delivery/CoreLocalDeliveryService.php +++ /dev/null @@ -1,217 +0,0 @@ -where([['key', '=', $delivery_service]])->findOrEmpty()->toArray(); - if (empty($service_data) || empty($service_data['config'])) { - throw new CommonException(LocalDeliveryDict::getType($delivery_service).'未配置'); - } - $config = $service_data['config']; - $config['is_use'] = $service_data['is_use']; - return $config; - } - - /** - * 配送费用计算 - * @param $order - * @return void - */ - public static function calculate(&$order) - { - $address = $order->delivery[ 'take_address' ] ?? []; - $take_store = $order->delivery['take_store'] ?? []; - - if (empty($address)) { - $order->error[] = get_lang('NOT_SELECT_ADDRESS'); - return; - } - - if (empty($take_store)) { - $order->error[] = get_lang('NOT_SELECT_LOCAL_DELIVERY_STORE'); - $order->delivery['error'] = empty($order->delivery['error']) ? get_lang('NOT_SELECT_LOCAL_DELIVERY_STORE') : $order->delivery['error']; - return; - } - - $goods_money = 0; // 商品价格 - $goods_weight = 0; // 商品重量 - - foreach ($order->goods_data as $k => &$v) { - $goods_type = $v[ 'goods' ][ 'goods_type' ]; - if ($goods_type == GoodsDict::REAL) { - if (in_array(OrderDeliveryDict::LOCAL_DELIVERY, $v[ 'goods' ][ 'delivery_type' ])) { - $goods_money += $v[ 'goods_money' ]; - $goods_weight += $v[ 'weight' ] * $v[ 'num' ]; - } else { - $v[ 'not_support_delivery' ] = 1; - $order->error[] = '“'.$v['goods']['goods_name'].'”'.get_lang('NOT_SUPPORT_DELIVERY_TYPE');//“'.$v['goods']['goods_name'].'”不支持选择的配送方式 - $order->goods_data[$v[ 'sku_id' ]]['error'] = get_lang('GOODS_NOT_SUPPORT_LOCAL_DELIVERY');//该商品不支持同城配送 - } - } - } - ( new self() )->feeCalculate($order, $goods_money, $goods_weight); - } - - /** - * 运费计算 - * @param $order - * @param float $goods_money - * @param float $goods_weight - * @return void - */ - public function feeCalculate(&$order, float $goods_money, float $goods_weight) - { - $address = $order->delivery[ 'take_address' ] ?? []; - $take_store = $order->delivery['take_store'] ?? []; - $local = ( new Local() )->where([ [ 'local_id', '>', 0 ] ])->field('fee_type,base_dist,base_price,grad_dist,grad_price,weight_start,weight_unit,weight_price,delivery_type,area,center')->findOrEmpty(); - if ($local->isEmpty()) { - $order->error[] = get_lang('NOT_CONFIGURED_LOCAL_DELIVERY'); - $order->delivery['error'] = empty($order->delivery['error']) ? get_lang('NOT_CONFIGURED_LOCAL_DELIVERY') : $order->delivery['error']; - return; - } - if (empty($address[ 'lat' ]) || empty($address[ 'lng' ])) { - $order->error[] = get_lang('NOT_SUPPORT_DELIVERY_ADDRESS'); - $order->delivery['error'] = empty($order->delivery['error']) ? get_lang('NOT_SUPPORT_DELIVERY_ADDRESS') : $order->delivery['error']; - return; - } - if (empty($take_store[ 'store_id' ])) { - $order->error[] = get_lang('NOT_SELECT_LOCAL_DELIVERY_STORE'); - $order->delivery['error'] = empty($order->delivery['error']) ? get_lang('NOT_SELECT_LOCAL_DELIVERY_STORE') : $order->delivery['error']; - return; - } - $store = ( new Store() )->where([['store_id', '=', $take_store[ 'store_id' ] ] ])->field('area,latitude,longitude')->findOrEmpty()->toArray(); - if (empty($store)) { - $order->error[] = get_lang('DELIVERY_STORE_NOT_EXIST'); - $order->delivery['error'] = empty($order->delivery['error']) ? get_lang('DELIVERY_STORE_NOT_EXIST') : $order->delivery['error']; - return; - } - - // 收货地址 - $address_point = new Coordinate($address[ 'lat' ], $address[ 'lng' ]); - // 取货地址 - $local_address_point = new Coordinate($store[ 'latitude' ], $store[ 'longitude' ]); - $local = $local->toArray(); - - if (empty($store[ 'area' ])) { - $order->error[] = get_lang('STORE_NOT_SET_DELIVERY_RANGE'); - $order->delivery['error'] = empty($order->delivery['error']) ? get_lang('STORE_NOT_SET_DELIVERY_RANGE') : $order->delivery['error']; - return; - } - // 判断所在区域 - $located_in_area = null; - foreach ($store[ 'area' ] as $area) { - if (empty($area[ 'area_json' ])) { - continue; - } - if ($area[ 'area_type' ] == 'radius') { - $center = new Coordinate($area[ 'area_json' ][ 'center' ][ 'lat' ], $area[ 'area_json' ][ 'center' ][ 'lng' ]); - $distance = ( new Vincenty() )->getDistance($address_point, $center); - if ($distance <= $area[ 'area_json' ][ 'radius' ]) { - $located_in_area = $area; - break; - } - } else { - $geofence = new Polygon(); - $geofence->addPoints(array_map(function ($latlng) { - return new Coordinate($latlng[ 'lat' ], $latlng[ 'lng' ]); - }, $area[ 'area_json' ][ 'paths' ])); - if ($geofence->contains($address_point)) { - $located_in_area = $area; - break; - } - } - } - if (!$located_in_area) { - $order->error[] = get_lang('NOT_SUPPORT_DELIVERY_RANGE'); - $order->delivery['error'] = empty($order->delivery['error']) ? get_lang('NOT_SUPPORT_DELIVERY_RANGE') : $order->delivery['error']; - return; - } - - if (bccomp($goods_money, $located_in_area[ 'start_price' ], 2) == -1) { - $order->error[] = '差' . $located_in_area[ 'start_price' ] - $goods_money . '元起送'; - $order->delivery['error'] = empty($order->delivery['error']) ? ('差' . $located_in_area[ 'start_price' ] - $goods_money . '元起送') : $order->delivery['error']; - return; - } - - if ($local[ 'fee_type' ] == 'distance') { - // 按距离收费 - // 计算收货地址与取货地址的距离 - $distance = round(( new Vincenty() )->getDistance($address_point, $local_address_point) / 1000, 2); - $order->basic[ 'delivery_money' ] = $local[ 'base_price' ]; - if ($distance > $local[ 'base_dist' ] && $local[ 'grad_dist' ] > 0) { - $order->basic[ 'delivery_money' ] += round(ceil(( $distance - $local[ 'base_dist' ] ) / $local[ 'grad_dist' ]) * $local[ 'grad_price' ], 2); - } - } else { - // 按配送区域收费 - $order->basic[ 'delivery_money' ] = $located_in_area[ 'delivery_price' ]; - } - - // 计算续重费用 - if ($goods_weight > 0 && $goods_weight > $local[ 'weight_start' ] && $local[ 'weight_unit' ] > 0 && $local[ 'weight_price' ] > 0) { - $order->basic[ 'delivery_money' ] += round(ceil(( $goods_weight - $local[ 'weight_start' ] ) / $local[ 'weight_unit' ]) * $local[ 'weight_price' ], 2); - } - } - - public function getLocalDeliveryOrderInfo($local_delivery_order_id) - { - $data = [ - 'show_local_delivery_info' => false, - ]; - $local_delivery_order_info = (new LocalDeliveryOrder())->where([['delivery_no', '=', $local_delivery_order_id]])->append(['status_name'])->findOrEmpty()->toArray(); - if (!empty($local_delivery_order_info)) { - $data['local_delivery_status_name'] = $local_delivery_order_info['status_name'] ?? ''; - if ($local_delivery_order_info['delivery_service'] != LocalDeliveryDict::MERCHANT && in_array($local_delivery_order_info['status'], [ LocalDeliveryStatusDict::ORDER_ACCEPTED, - LocalDeliveryStatusDict::PENDING_ACCEPTANCE, - LocalDeliveryStatusDict::PENDING_PICKUP, - LocalDeliveryStatusDict::RIDER_ARRIVED, - LocalDeliveryStatusDict::IN_DELIVERY ])) { - $data['show_local_delivery_info'] = true; - } - $data['local_delivery_order_log'] = (new LocalDeliveryOrderLog()) - ->withJoin('localDeliveryOrder') - ->where([['delivery_no', '=', $local_delivery_order_id]]) - ->append(['main_type_name'])->select()->toArray(); - } - return $data; - } - -} diff --git a/niucloud/addon/shop/app/service/core/local_delivery/dada/CoreOrderEventService.php b/niucloud/addon/shop/app/service/core/local_delivery/dada/CoreOrderEventService.php deleted file mode 100644 index 0a3f65c7d..000000000 --- a/niucloud/addon/shop/app/service/core/local_delivery/dada/CoreOrderEventService.php +++ /dev/null @@ -1,441 +0,0 @@ -model = new LocalDeliveryOrder(); - } - - - public function create(){ - - } - - /** - * 商家呼叫配送 - * @param $param - * @param $delivery_no - * @return true - */ - public function orderCall($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::PENDING_ACCEPTANCE) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::PENDING_ACCEPTANCE, - 'out_status' => $notify_data['order_status'], - 'out_delivery_no' => $notify_data['client_id'], - ]; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - //todo 消息发送 -// (new NoticeService())->send(''); - //添加配送订单日志 - $operate = OrderLogDict::getOperate(LocalDeliveryStatusDict::PENDING_ACCEPTANCE); - $log_data = [ - 'order_id' => $local_delivery_order->id, - 'main_id' => 0, - 'main_name' => '', - 'main_type' => OrderLogDict::STORE, - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => LocalDeliveryStatusDict::PENDING_ACCEPTANCE, - 'remark' => $operate['operate_desc'], - ]; - (new CoreLocalDeliveryOrderLogService())->addLog($log_data); - return true; - } - - /** - * 商家指派骑手 - * @param $param - * @param $delivery_no - * @return true - */ - public function dispatchOrder($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::DISPATCH_ORDER) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::DISPATCH_ORDER, - 'out_status' => $notify_data['order_status'], - 'out_delivery_no' => $notify_data['client_id'], - ]; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - //todo 消息发送 -// (new NoticeService())->send(''); - //添加配送订单日志 - $operate = OrderLogDict::getOperate(LocalDeliveryStatusDict::DISPATCH_ORDER); - $log_data = [ - 'order_id' => $local_delivery_order->id, - 'main_id' => 0, - 'main_name' => '', - 'main_type' => OrderLogDict::STORE, - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => LocalDeliveryStatusDict::DISPATCH_ORDER, - 'remark' => $operate['operate_desc'], - ]; - (new CoreLocalDeliveryOrderLogService())->addLog($log_data); - return true; - } - - /** - * 骑手已接单 - * @param $param - * @param $delivery_no - * @return true - */ - public function riderAccepted($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::PENDING_PICKUP) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::PENDING_PICKUP, - 'out_status' => $notify_data['order_status'], - 'rider_name' => $notify_data['dm_name'] ?? '', - 'rider_mobile' => $notify_data['dm_mobile'] ?? '', - ]; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - //todo 消息发送 -// (new NoticeService())->send(''); - //添加配送订单日志 - $operate = OrderLogDict::getOperate(LocalDeliveryStatusDict::PENDING_PICKUP); - $log_data = [ - 'order_id' => $local_delivery_order->id, - 'main_id' => $notify_data['dm_id'] ?? 0, - 'main_name' => $notify_data['dm_name'] ?? '', - 'main_type' => OrderLogDict::RIDER, - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => LocalDeliveryStatusDict::PENDING_PICKUP, - 'remark' => $operate['operate_desc'].',骑手'.($notify_data['dm_name'] ?? ''), - ]; - (new CoreLocalDeliveryOrderLogService())->addLog($log_data); - return true; - } - - /** - * 骑手已到店 - * @param $param - * @param $delivery_no - * @return true - */ - public function riderArrived($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::RIDER_ARRIVED) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::RIDER_ARRIVED, - 'out_status' => $notify_data['order_status'], - ]; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - //todo 消息发送 -// (new NoticeService())->send(''); - //添加配送订单日志 - $operate = OrderLogDict::getOperate(LocalDeliveryStatusDict::RIDER_ARRIVED); - $log_data = [ - 'order_id' => $local_delivery_order->id, - 'main_id' => $notify_data['dm_id'] ?? 0, - 'main_name' => $notify_data['dm_name'] ?? '', - 'main_type' => OrderLogDict::RIDER, - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => LocalDeliveryStatusDict::RIDER_ARRIVED, - 'remark' => $operate['operate_desc'].',骑手'.($notify_data['dm_name'] ?? ''), - ]; - (new CoreLocalDeliveryOrderLogService())->addLog($log_data); - return true; - } - - /** - * 骑手已取货 - * @param $param - * @param $delivery_no - * @return true - */ - public function riderPickedUp($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::IN_DELIVERY) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::IN_DELIVERY, - 'out_status' => $notify_data['order_status'], - ]; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - //todo 消息发送 -// (new NoticeService())->send(''); - //添加配送订单日志 - $operate = OrderLogDict::getOperate(LocalDeliveryStatusDict::IN_DELIVERY); - $log_data = [ - 'order_id' => $local_delivery_order->id, - 'main_id' => $notify_data['dm_id'] ?? 0, - 'main_name' => $notify_data['dm_name'] ?? '', - 'main_type' => OrderLogDict::RIDER, - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => LocalDeliveryStatusDict::IN_DELIVERY, - 'remark' => $operate['operate_desc'].',骑手'.($notify_data['dm_name'] ?? ''), - ]; - (new CoreLocalDeliveryOrderLogService())->addLog($log_data); - return true; - } - - /** - * 物品返回中 - * @param $param - * @param $delivery_no - * @return true - */ - public function returnApplied($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::RETURN_IN_PROGRESS) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::RETURN_IN_PROGRESS, - 'out_status' => $notify_data['order_status'], - ]; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - //todo 消息发送 -// (new NoticeService())->send(''); - //添加配送订单日志 - $operate = OrderLogDict::getOperate(LocalDeliveryStatusDict::RETURN_IN_PROGRESS); - $log_data = [ - 'order_id' => $local_delivery_order->id, - 'main_id' => $notify_data['dm_id'] ?? 0, - 'main_name' => $notify_data['dm_name'] ?? '', - 'main_type' => OrderLogDict::RIDER, - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => LocalDeliveryStatusDict::RETURN_IN_PROGRESS, - 'remark' => $operate['operate_desc'].',骑手'.($notify_data['dm_name'] ?? ''), - ]; - (new CoreLocalDeliveryOrderLogService())->addLog($log_data); - return true; - } - - /** - * 物品返回完成 - * @param $param - * @param $delivery_no - * @return true - */ - public function returnCompleted($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::RETURN_COMPLETED) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::RETURN_COMPLETED, - 'out_status' => $notify_data['order_status'], - ]; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - //todo 消息发送 -// (new NoticeService())->send(''); - //添加配送订单日志 - $operate = OrderLogDict::getOperate(LocalDeliveryStatusDict::RETURN_COMPLETED); - $log_data = [ - 'order_id' => $local_delivery_order->id, - 'main_id' => $notify_data['dm_id'] ?? 0, - 'main_name' => $notify_data['dm_name'] ?? '', - 'main_type' => OrderLogDict::RIDER, - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => LocalDeliveryStatusDict::RETURN_COMPLETED, - 'remark' => $operate['operate_desc'], - ]; - (new CoreLocalDeliveryOrderLogService())->addLog($log_data); - return true; - } - - public function cancel($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::CANCELED) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::CANCELED, - 'out_status' => $notify_data['order_status'], - 'cancel_time' => time() - ]; - if (!empty($notify_data['cancel_reason'])) { - $data['remark'] = $notify_data['cancel_reason']; - } - $delivery_order_data = $local_delivery_order->toArray(); - $delivery_order_data['event'] = 'cancel'; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - event('LocalDeliveryEvent', $delivery_order_data); - - //添加配送订单日志 - $operate = OrderLogDict::getOperate(LocalDeliveryStatusDict::CANCELED); - $log_data = [ - 'order_id' => $local_delivery_order->id, - 'main_id' => 0, - 'main_name' => '', - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => LocalDeliveryStatusDict::CANCELED, - 'remark' => $operate['operate_desc'], - ]; - if ($notify_data['cancel_from'] == 1) { - $log_data['main_id'] = $notify_data['dm_id'] ?? 0; - $log_data['main_name'] = $notify_data['dm_name'] ?? ''; - $log_data['main_type'] = OrderLogDict::RIDER; - $log_data['remark'] = $operate['operate_desc'].',骑手'.($notify_data['dm_name'] ?? ''); - } elseif ($notify_data['cancel_from'] == 2) { - $log_data['main_type'] = OrderLogDict::STORE; - } elseif ($notify_data['cancel_from'] == 3) { - $log_data['main_type'] = OrderLogDict::SYSTEM; - } else { - $log_data['main_type'] = OrderLogDict::SYSTEM; - } - (new CoreLocalDeliveryOrderLogService())->addLog($log_data); - return true; - } - - public function finish($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::COMPLETED) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::COMPLETED, - 'out_status' => $notify_data['order_status'], - 'finish_time' => time() - ]; - $delivery_order_data = $local_delivery_order->toArray(); - $delivery_order_data['event'] = 'finish'; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - event('LocalDeliveryEvent', $delivery_order_data); - //添加配送订单日志 - $operate = OrderLogDict::getOperate(LocalDeliveryStatusDict::COMPLETED); - $log_data = [ - 'order_id' => $local_delivery_order->id, - 'main_id' => $notify_data['dm_id'] ?? 0, - 'main_name' => $notify_data['dm_name'] ?? '', - 'main_type' => OrderLogDict::RIDER, - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => LocalDeliveryStatusDict::COMPLETED, - 'remark' => $operate['operate_desc'], - ]; - (new CoreLocalDeliveryOrderLogService())->addLog($log_data); - return true; - } - - /** - * 创建达达运单失败 - * @param $param - * @param $delivery_no - * @return true - */ - public function createOrderFailed($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::CREATE_ORDER_FAILED) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::CREATE_ORDER_FAILED, - 'out_status' => $notify_data['order_status'], - ]; - $delivery_order_data = $local_delivery_order->toArray(); - $delivery_order_data['event'] = 'createOrderFailed'; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - event('LocalDeliveryEvent', $delivery_order_data); - return true; - } - - /** - * 售后取件单送达门店 - * @param $param - * @param $delivery_no - * @return true - */ - public function returnRiderArrived($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::RETURN_RIDER_ARRIVED) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::RETURN_RIDER_ARRIVED, - 'out_status' => $notify_data['order_status'], - ]; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/local_delivery/dada/CoreOrderMessageService.php b/niucloud/addon/shop/app/service/core/local_delivery/dada/CoreOrderMessageService.php deleted file mode 100644 index 88200c1e3..000000000 --- a/niucloud/addon/shop/app/service/core/local_delivery/dada/CoreOrderMessageService.php +++ /dev/null @@ -1,107 +0,0 @@ -signature([ $data['client_id'], $data['order_id'], $data['update_time'] ]); - if ($signature != $data['signature']) { - throw new CommonException('DADA_ORDER_NOTIFY_SIGN_ERROR'); - } - // 同城配送订单号 - $delivery_no = $data['order_id']; - // 同城配送订单状态转换 - $status = DadaDeliveryStatusDict::convertStatus($data['order_status']); - - $core_order_event_service = new CoreOrderEventService(); - switch ($status) { - case LocalDeliveryStatusDict::PENDING_ACCEPTANCE: - $core_order_event_service->orderCall(['notify_data' => $data], $delivery_no); - break; - case LocalDeliveryStatusDict::DISPATCH_ORDER: - $core_order_event_service->dispatchOrder(['notify_data' => $data], $delivery_no); - break; - case LocalDeliveryStatusDict::PENDING_PICKUP: - $core_order_event_service->riderAccepted(['notify_data' => $data], $delivery_no); - break; - case LocalDeliveryStatusDict::RIDER_ARRIVED: - $core_order_event_service->riderArrived(['notify_data' => $data], $delivery_no); - break; - case LocalDeliveryStatusDict::IN_DELIVERY: - $core_order_event_service->riderPickedUp(['notify_data' => $data], $delivery_no); - break; - case LocalDeliveryStatusDict::COMPLETED: - $core_order_event_service->finish(['notify_data' => $data], $delivery_no); - break; - case LocalDeliveryStatusDict::RETURN_IN_PROGRESS: - $core_order_event_service->returnApplied(['notify_data' => $data], $delivery_no); - break; - case LocalDeliveryStatusDict::RETURN_COMPLETED: - $core_order_event_service->returnCompleted(['notify_data' => $data], $delivery_no); - break; - case LocalDeliveryStatusDict::CANCELED: - $core_order_event_service->cancel(['notify_data' => $data], $delivery_no); - break; - case LocalDeliveryStatusDict::RETURN_RIDER_ARRIVED: - $core_order_event_service->returnRiderArrived(['notify_data' => $data], $delivery_no); - break; - case LocalDeliveryStatusDict::CREATE_ORDER_FAILED: - $core_order_event_service->createOrderFailed(['notify_data' => $data], $delivery_no); - break; - default: - break; - } - } - - /** - * 回调数据签名校验 - * @param array $data - * @return string - */ - public function signature(array $data) - { - // 对client_id, order_id, update_time的值进行字符串升序排列 - usort($data, function($a, $b) { - return strcmp($a, $b); - }); - - // 属性值拼接拼接字符串 - $signStr = implode('', $data); - - // MD5加密 - return md5($signStr); - } - -} diff --git a/niucloud/addon/shop/app/service/core/marketing/CoreActiveService.php b/niucloud/addon/shop/app/service/core/marketing/CoreActiveService.php deleted file mode 100644 index 53b7d453a..000000000 --- a/niucloud/addon/shop/app/service/core/marketing/CoreActiveService.php +++ /dev/null @@ -1,225 +0,0 @@ -model = new Active(); - } - - /** - * 添加活动 - * @param array $data - * @return mixed - */ - public function add(array $data) - { - $active_goods_data = $data['active_goods'] ?? []; - if(empty($active_goods_data)) throw new AdminException('ACTIVE_GOODS_NOT_EMPTY'); - - if(!empty($data['end_time']) && $data['end_time'] < time()) throw new AdminException('END_TIME_NOT_LESS_CURRENT_TIME'); - - Db::startTrans(); - try { - $create_data = [ - 'active_name'=> $data['active_name'] ?? '', - 'active_desc'=> $data['active_desc'] ?? '', - 'active_type' => $data['active_type'], - 'active_goods_type' => $data['active_goods_type'], - 'active_goods_info' => $data['active_goods_info'] ?? '', - 'active_class' => $data['active_class'], - 'active_class_category' => $data['active_class_category'] ?? '', - 'active_value' => $data['active_value'] ?? '', - 'relate_member' => $data['relate_member'] ?? '', - 'create_time' => time(), - 'update_time' => 0, - 'start_time' => $data['start_time'] ?? 0, - 'end_time' => $data['end_time'] ?? 0, - 'active_status' => $data['active_status'], - ]; - - $res = $this->model->create($create_data); - $active_goods = []; - foreach ($active_goods_data as $k => $v){ - $active_goods[] = [ - 'active_id' => $res->active_id, - 'goods_id' => $v['goods_id'], - 'sku_id' => !empty($v['sku_id']) ? $v['sku_id'] : 0, - 'active_goods_value' => $v['active_goods_value'] ?? [], - 'active_goods_status' => $create_data['active_status'], - 'active_goods_price' => $v['active_goods_price'] ?? 0.00, - 'active_goods_type' => $v['active_goods_type'], - 'active_class' => $v['active_class'], - 'active_goods_label' => $v['active_goods_label'] ?? '', - 'active_goods_category' => $v['active_goods_category'] ?? '', - 'active_goods_point' => $v['active_goods_point'] ?? 0.00, - 'active_goods_stock' => $v['active_goods_stock'] ?? 0, - ]; - } - $active_goods_model = new ActiveGoods(); - $active_goods_model->saveAll($active_goods); - - Db::commit(); - - if(!empty($data['start_time']) && $create_data['start_time'] <= time()) $this->start($res->active_id); - if(!empty($data['end_time']) && $create_data['end_time'] <= time()) $this->end($res->active_id); - return $res->active_id; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 编辑活动 - * @param int $id - * @param array $data - * @return bool - */ - public function edit(int $active_id, array $data) - { - $info = $this->model->where([ ['active_id', '=', $active_id] ])->findOrEmpty(); - if ($info->isEmpty()) throw new AdminException('ACTIVE_NOT_FOUND'); - if ($info->active_class != ActiveDict::NEWCOMER_DISCOUNT && ($info->active_status == ActiveDict::CLOSE || $info->active_status == ActiveDict::END)) throw new AdminException('ACTIVE_NOT_EDIT'); - - //结束时间不能小于当前时间 - if(!empty($data['end_time']) && $data['end_time'] < time()) throw new AdminException('END_TIME_NOT_LESS_CURRENT_TIME'); - $active_goods_data = $data['active_goods'] ?? []; - if($data['active_class'] != ActiveDict::NEWCOMER_DISCOUNT && empty($active_goods_data)) throw new AdminException('ACTIVE_GOODS_NOT_EMPTY'); - $active_goods_model = new ActiveGoods(); - Db::startTrans(); - try { - - $active_goods_list = $active_goods_model->where([ ['active_id', '=', $active_id] ])->select()->toArray(); - $active_goods_list = array_column($active_goods_list, null, 'goods_id'); - - $save_data = [ - 'active_name'=> $data['active_name'] ?? '', - 'active_desc'=> $data['active_desc'] ?? '', - 'active_type' => $data['active_type'], - 'active_goods_type' => $data['active_goods_type'], - 'active_goods_info' => $data['active_goods_info'] ?? '', - 'active_class' => $data['active_class'], - 'active_class_category' => $data['active_class_category'] ?? '', - 'active_value' => $data['active_value'] ?? '', - 'relate_member' => $data['relate_member'] ?? '', - 'update_time' => time(), - 'start_time' => $data['start_time'] ?? 0, - 'end_time' => $data['end_time'] ?? 0, - 'active_status' => $data['active_status'], - ]; - - $this->model->where([ ['active_id', '=', $active_id] ])->update($save_data); - - $active_goods = []; - foreach ($active_goods_data as $k => $v){ - $active_goods[] = [ - 'active_id' => $active_id, - 'goods_id' => $v['goods_id'], - 'sku_id' => !empty($v['sku_id']) ? $v['sku_id'] : 0, - 'active_goods_value' => $v['active_goods_value'] ?? [], - 'active_goods_status' => $save_data['active_status'], - 'active_goods_price' => $v['active_goods_price'] ?? 0.00, - 'active_goods_type' => $v['active_goods_type'], - 'active_class' => $v['active_class'], - 'active_goods_label' => $v['active_goods_label'] ?? '', - 'active_goods_category' => $v['active_goods_category'] ?? '', - 'active_goods_point' => $v['active_goods_point'] ?? 0.00, - 'active_goods_stock' => $v['active_goods_stock'] ?? 0, - 'active_goods_order_money' => $active_goods_list[$v['goods_id']]['active_goods_order_money'] ?? 0, - 'active_goods_order_num' => $active_goods_list[$v['goods_id']]['active_goods_order_num'] ?? 0, - 'active_goods_member_num' => $active_goods_list[$v['goods_id']]['active_goods_member_num'] ?? 0, - 'active_goods_success_num' => $active_goods_list[$v['goods_id']]['active_goods_success_num'] ?? 0, - ]; - } - - $active_goods_model->where([ ['active_id', '=', $active_id] ])->delete(); - $active_goods_model->saveAll($active_goods); - - Db::commit(); - if(!empty($save_data['start_time']) && $save_data['start_time'] <= time())$this->start($active_id); - if(!empty($save_data['end_time']) && $save_data['end_time'] <= time())$this->end($active_id); - event('ActiveSaveAfter', $data); - return true; - } catch (\Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 删除活动 - * @param int $active_id - * @return bool - */ - public function del(int $active_id, $is_force=0) - { - $info = $this->model->where([ ['active_id', '=', $active_id] ])->findOrEmpty(); - if ($info->isEmpty()) throw new AdminException('ACTIVE_NOT_FOUND'); - if ($is_force==0 && $info->active_status == ActiveDict::ACTIVE) throw new AdminException('ACTIVE_NOT_DELETE'); - $this->model->where([ [ 'active_id', '=', $active_id ] ])->delete(); - (new ActiveGoods())->where([ [ 'active_id', '=', $active_id ] ])->delete(); - return true; - } - - /** - * 活动关闭 - * @return void - */ - public function close($active_id) - { - $this->model->where([ ['active_id', '=', $active_id], ['active_status', '=', ActiveDict::ACTIVE] ])->update([ 'active_status' => ActiveDict::CLOSE ]); - (new ActiveGoods())->where([ ['active_id', '=', $active_id]])->update([ 'active_goods_status' => ActiveDict::CLOSE ]); - return true; - } - - /** - * 活动开启 - * @return void - */ - public function start($active_id) - { - $this->model->where([ ['active_id', '=', $active_id], ['active_status', '=', ActiveDict::NOT_ACTIVE], ['start_time', '<=', time()] ])->update([ 'active_status' => ActiveDict::ACTIVE ]); - (new ActiveGoods())->where([ ['active_id', '=', $active_id]])->update([ 'active_goods_status' => ActiveDict::ACTIVE ]); - ActiveStartAfter::dispatch(['active_id' => $active_id]); - return true; - } - - /** - * 活动结束 - * @return void - */ - public function end($active_id) - { - $this->model->where([ ['active_id', '=', $active_id], ['active_status', '=', ActiveDict::ACTIVE], ['end_time', '<=', time()] ])->update([ 'active_status' => ActiveDict::END ]); - (new ActiveGoods())->where([ ['active_id', '=', $active_id]])->update([ 'active_goods_status' => ActiveDict::END ]); - ActiveEndAfter::dispatch(['active_id' => $active_id]); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/marketing/CoreCouponService.php b/niucloud/addon/shop/app/service/core/marketing/CoreCouponService.php deleted file mode 100644 index ef712b968..000000000 --- a/niucloud/addon/shop/app/service/core/marketing/CoreCouponService.php +++ /dev/null @@ -1,66 +0,0 @@ -model = new Coupon(); - } - - /** - * 优惠券状态开启 - * @param $ids - * @return true - */ - public function couponNormal($ids) - { - $where = [ - [ 'id', 'in', $ids ], - [ 'status', '=', CouponDict::WAIT_START ] - ]; - $data = [ - 'status' => CouponDict::NORMAL - ]; - $this->model->where($where)->update($data); - return true; - } - - /** - * 优惠券状态过期 - * @param $ids - * @return true - */ - public function couponExpire($ids) - { - $where = [ - [ 'id', 'in', $ids ], - [ 'status', '=', CouponDict::NORMAL ] - ]; - $data = [ - 'status' => CouponDict::EXPIRE - ]; - $this->model->where($where)->update($data); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/marketing/CoreManjianService.php b/niucloud/addon/shop/app/service/core/marketing/CoreManjianService.php deleted file mode 100644 index 973851055..000000000 --- a/niucloud/addon/shop/app/service/core/marketing/CoreManjianService.php +++ /dev/null @@ -1,1466 +0,0 @@ -model = new Manjian(); - } - - /** - * 满减活动优惠计算 - * @param $order - * @return void - */ - public function calculate(&$order) - { - $manjian_discount_money = 0; - - //查询满减活动 - $manjian_list = $this->model->field('manjian_id,manjian_name,condition_type,goods_type,join_member_type,rule_type,rule_json,level_ids,label_ids')->where([ - ['status', '=', ManjianDict::ACTIVE], - ['start_time', '<=', time()], - ['end_time', '>', time()] - ])->orderRaw("CASE WHEN goods_type = 'selected_goods' THEN 0 WHEN goods_type = 'selected_goods_not' THEN 1 ELSE 2 END ASC")->select()->toArray(); - $member_info = (new Member())->field('member_level,member_label')->where([ - ['member_id', '=', $order->member_id] - ])->findOrEmpty()->toArray(); - - if (!empty($manjian_list) && !empty($member_info)) { - $gift_goods_all = [];//合并所有赠品计算剩余库存 - foreach ($manjian_list as &$value) { - //判断会员是否有参与资格 - $can_join = 0; - $join_member_type = $value['join_member_type']; - $level_ids = $value['level_ids']; - $label_ids = $value['label_ids']; - if ($join_member_type == ManjianDict::ALL_MEMBER) {//所有会员参与 - $can_join = 1; - } elseif ($join_member_type == ManjianDict::SELECTED_MEMBER_LEVEL) {//指定会员等级 - if (in_array($member_info['member_level'], $level_ids)) { - $can_join = 1; - } - } elseif ($join_member_type == ManjianDict::SELECTED_MEMBER_LABEL) {//指定会员标签 - if (!empty($member_info['member_label']) && !empty(array_intersect($member_info['member_label'], $label_ids))) { - $can_join = 1; - } - } - if ($can_join == 0) continue;//不参与 - - $condition_type = $value['condition_type']; - $condition_match_value = 0; - $condition_match_money = 0; - $match_sku_ids = []; - $match_order_goods_money = 0; - foreach ($order->goods_data as $v) { - $manjian_goods_count = (new ManjianGoods())->where([ - ['goods_id', '=', $v['goods_id']], - ['sku_id', '=', $v['sku_id']], - ['manjian_id', '=', $value['manjian_id']], - ['status', '=', ManjianDict::ACTIVE] - ])->count(); - if ($value['goods_type'] == ManjianDict::ALL_GOODS) {//全部商品参与 - if ($condition_type == ManjianDict::OVER_N_YUAN) {//满N元 - $condition_match_value += $v['price'] * $v['num']; - } else {//满N件 - $condition_match_value += $v['num']; - } - $condition_match_money += $v['price'] * $v['num']; - $match_sku_ids[] = $v['sku_id']; - $match_order_goods_money += ($v['goods_money'] - $v['discount_money']); - } elseif ($value['goods_type'] == ManjianDict::SELECTED_GOODS) {//指定商品参与 - if ($manjian_goods_count > 0) { - if ($condition_type == ManjianDict::OVER_N_YUAN) {//满N元 - $condition_match_value += $v['price'] * $v['num']; - } else {//满N件 - $condition_match_value += $v['num']; - } - $condition_match_money += $v['price'] * $v['num']; - $match_sku_ids[] = $v['sku_id']; - $match_order_goods_money += ($v['goods_money'] - $v['discount_money']); - } - } elseif ($value['goods_type'] == ManjianDict::SELECTED_GOODS_NOT) {//指定商品不参与 - if ($manjian_goods_count == 0) { - if ($condition_type == ManjianDict::OVER_N_YUAN) {//满N元 - $condition_match_value += $v['price'] * $v['num']; - } else {//满N件 - $condition_match_value += $v['num']; - } - $condition_match_money += $v['price'] * $v['num']; - $match_sku_ids[] = $v['sku_id']; - $match_order_goods_money += ($v['goods_money'] - $v['discount_money']); - } - } - } - - $discount_money = 0;//优惠金额 - $is_free_shipping = 0;//是否免邮 - $gift = [];//赠品 - $level = -1;//优惠层级 - - $rule_type = $value['rule_type']; - $rule_json = $value['rule_json']; - foreach ($rule_json as $key => $rule) { - if ($condition_match_value >= $rule['limit']) { - if ($rule_type == ManjianDict::LADDER) {//阶梯优惠 - //满减优惠券 - $discount_type = $rule['discount_type']; - if ($discount_type == 1) {//减 - $discount_money = $rule['discount_money'] ?? 0; - } else {//折 - $discount_money = $order->moneyFormat($condition_match_money * (1 - ($rule['discount_money'] ?? 0) / 10)); - } - - if (!$rule['is_discount']) { - $rule_json[$key]['discount_money'] = 0; - $discount_money = 0; - } - //积分 - $gift['point'] = $rule['point'] ?? 0; - - if (!$rule['is_give_point']) { - $rule_json[$key]['point'] = 0; - $gift['point'] = 0; - } - //余额 - $gift['balance'] = $rule['balance'] ?? 0; - - if (!$rule['is_give_balance']) { - $rule_json[$key]['balance'] = 0; - $gift['balance'] = 0; - } - //优惠券 - $gift_coupon = $rule['coupon'] ?? []; - if ($gift_coupon) { - foreach ($gift_coupon as $coupon_key => &$coupon) { - $coupon_info = (new Coupon())->field('price,min_condition_money')->where([ - ['id', '=', $coupon['coupon_id']], - ['status', '=', CouponDict::NORMAL], - ])->findOrEmpty()->toArray(); - if (!empty($coupon_info)) { - if ($coupon_info['min_condition_money'] == '0.00') { - $coupon_name = $coupon_info['price'] . "元无门槛券"; - } else { - $coupon_name = "满" . $coupon_info['min_condition_money'] . "元减" . $coupon_info['price'] . "元券"; - } - $coupon['coupon_name'] = $coupon_name; - } else { - unset($gift_coupon[$coupon_key]); - } - } - $gift_coupon = array_values($gift_coupon); - $rule_json[$key]['coupon'] = $gift_coupon; - } - $gift['coupon'] = $gift_coupon; - - if (!$rule['is_give_coupon']) { - $rule_json[$key]['coupon'] = []; - $gift['coupon'] = []; - } - //赠品 - $gift_goods = $rule['goods'] ?? []; - if ($gift_goods) { - foreach ($gift_goods as $goods_key => &$goods) { - $sku_info = (new GoodsSku())->field('goods_id,sku_name,sku_image,price,stock')->where([ - ['goods_id', '=', $goods['goods_id']], - ['sku_id', '=', $goods['sku_id']], - ['stock', '>', 0], - ])->with(['goods'])->findOrEmpty()->toArray(); - if (!empty($sku_info) && !empty($sku_info['goods']) && $sku_info['goods']['status'] == 1) { - $goods['goods_name'] = $sku_info['goods']['goods_name']; - $goods['sku_name'] = $sku_info['sku_name']; - $goods['sku_image'] = $sku_info['sku_image']; - $goods['price'] = $sku_info['price']; - - if (empty($gift_goods_all)) { - // 库存小于赠送数量时,取剩余库存 - $num = $sku_info['stock'] >= $goods['num'] ? $goods['num'] : $sku_info['stock']; - $goods['num'] = $num; - } else { - // 计算剩余库存 - $leave_num = $sku_info['stock']; - foreach ($gift_goods_all as $gift_goods_item) { - if ($gift_goods_item['goods_id'] == $goods['goods_id'] && $gift_goods_item['sku_id'] == $goods['sku_id']) { - if ($leave_num - $gift_goods_item['num'] >= 0) { - $leave_num = $leave_num - $gift_goods_item['num']; - } else { - $leave_num = 0; - } - } - } - $goods['num'] = $leave_num >= $goods['num'] ? $goods['num'] : $leave_num; - } - - if ($goods['num'] == 0) { - unset($gift_goods[$goods_key]); - } - - } else { - unset($gift_goods[$goods_key]); - } - } - $gift_goods = array_values($gift_goods); - $gift_goods_all = array_merge($gift_goods_all, $gift_goods); - $rule_json[$key]['goods'] = $gift_goods; - } - $gift['goods'] = $gift_goods; - - if (!$rule['is_give_goods']) { - $rule_json[$key]['goods'] = []; - $gift['goods'] = []; - } - } else {//循环优惠 - $cycle_num = intdiv($condition_match_value, $rule['limit']); - $rule_json[$key]['limit'] = $rule['limit'] * $cycle_num; - if ($rule['is_discount']) { - if ($rule['limit'] == 0) { - $discount_money = 0; - } else { - $discount_money = $order->moneyFormat($cycle_num * ($rule['discount_money'] ?? 0)); - } - $rule_json[$key]['discount_money'] = $discount_money; - } - if ($rule['is_give_point']) { - $rule_json[$key]['point'] = ($rule['point'] ?? 0) * $cycle_num; - $gift['point'] = ($rule['point'] ?? 0) * $cycle_num; - } - if ($rule['is_give_balance']) { - $rule_json[$key]['balance'] = ($rule['balance'] ?? 0) * $cycle_num; - $gift['balance'] = ($rule['balance'] ?? 0) * $cycle_num; - } - if ($rule['is_give_coupon']) { - $gift_coupon = $rule['coupon'] ?? []; - if ($gift_coupon) { - foreach ($gift_coupon as $coupon_key => &$coupon) { - $coupon['num'] = intval($coupon['num']) * $cycle_num; - $coupon_info = (new Coupon())->field('price,min_condition_money')->where([ - ['id', '=', $coupon['coupon_id']], - ['status', '=', CouponDict::NORMAL], - ])->findOrEmpty()->toArray(); - if (!empty($coupon_info)) { - if ($coupon_info['min_condition_money'] == '0.00') { - $coupon_name = $coupon_info['price'] . "元无门槛券"; - } else { - $coupon_name = "满" . $coupon_info['min_condition_money'] . "元减" . $coupon_info['price'] . "元券"; - } - $coupon['coupon_name'] = $coupon_name; - } else { - unset($gift_coupon[$coupon_key]); - } - } - $gift_coupon = array_values($gift_coupon); - $rule_json[$key]['coupon'] = $gift_coupon; - } - $gift['coupon'] = $gift_coupon; - } - if ($rule['is_give_goods']) { - $gift_goods = $rule['goods'] ?? []; - if ($gift_goods) { - foreach ($gift_goods as $goods_key => &$goods) { - $goods['num'] = intval($goods['num']) * $cycle_num; - $sku_info = (new GoodsSku())->field('goods_id,sku_name,sku_image,price,stock')->where([ - ['goods_id', '=', $goods['goods_id']], - ['sku_id', '=', $goods['sku_id']], - ['stock', '>', 0], - ])->with(['goods'])->findOrEmpty()->toArray(); - if (!empty($sku_info) && !empty($sku_info['goods']) && $sku_info['goods']['status'] == 1) { - $goods['goods_name'] = $sku_info['goods']['goods_name']; - $goods['sku_name'] = $sku_info['sku_name']; - $goods['sku_image'] = $sku_info['sku_image']; - $goods['price'] = $sku_info['price']; - - if (empty($gift_goods_all)) { - // 库存小于赠送数量时,取剩余库存 - $num = $sku_info['stock'] >= $goods['num'] ? $goods['num'] : $sku_info['stock']; - $goods['num'] = $num; - } else { - // 计算剩余库存 - $leave_num = $sku_info['stock']; - foreach ($gift_goods_all as $gift_goods_item) { - if ($gift_goods_item['goods_id'] == $goods['goods_id'] && $gift_goods_item['sku_id'] == $goods['sku_id']) { - if ($leave_num - $gift_goods_item['num'] >= 0) { - $leave_num = $leave_num - $gift_goods_item['num']; - } else { - $leave_num = 0; - } - } - } - $goods['num'] = $leave_num >= $goods['num'] ? $goods['num'] : $leave_num; - } - - if ($goods['num'] == 0) { - unset($gift_goods[$goods_key]); - } - - } else { - unset($gift_goods[$goods_key]); - } - } - $gift_goods = array_values($gift_goods); - $gift_goods_all = array_merge($gift_goods_all, $gift_goods); - $rule_json[$key]['goods'] = $gift_goods; - } - $gift['goods'] = $gift_goods; - } - } - $is_free_shipping = $rule['is_free_shipping'] ?? 0; - $level = $key; - } - } - - if ($level >= 0) { - foreach ($match_sku_ids as $sku_id) { - $value['rule'] = $rule_json[$level]; - if ($value['rule']['is_discount'] || $value['rule']['is_free_shipping'] || $value['rule']['is_give_point'] || $value['rule']['is_give_balance'] || !empty($value['rule']['coupon']) || !empty($value['rule']['goods'])) { - $order->goods_data[$sku_id]['manjian_info'][] = $value; - } - } - } - - //填充满减商品优惠信息 - $manjian_one_discount_money = 0; - if ($level >= 0) { - $this->manjianGoodsCalculate($order, $is_free_shipping, $discount_money, $match_sku_ids, $match_order_goods_money, $manjian_one_discount_money); - } - if ($manjian_one_discount_money > 0) { - $manjian_discount_money = bcadd($manjian_discount_money, $manjian_one_discount_money, 2); - $order->discount['manjian'][$value['manjian_id']][] = $order->discountFormat( - $match_sku_ids, - OrderDiscountDict::DISCOUNT, - count($match_sku_ids), - $manjian_one_discount_money, - 'manjian', - $value['manjian_id'], - '', - $value['manjian_name'] - ); - } - //获取满减活动商品赠品内容 - if (!empty($gift)) { - $this->getGiftContent($order, $gift, $value['manjian_id'], $level, $match_sku_ids); - } - } - - if ($manjian_discount_money > 0) { - $order->basic['discount_money'] = bcadd($order->basic['discount_money'], $manjian_discount_money, 2); - $order->basic['manjian_discount_money'] = $order->moneyFormat($manjian_discount_money); - } - } - } - - /** - * 满减活动商品计算 - * @param $order - * @param $is_free_shipping - * @param $discount_money - * @param $match_sku_ids - * @param $match_order_goods_money - * @param $manjian_one_discount_money - * @return void - */ - public function manjianGoodsCalculate(&$order, $is_free_shipping, $discount_money, $match_sku_ids, $match_order_goods_money, &$manjian_one_discount_money) - { - if ($discount_money > $match_order_goods_money) {//优惠金额大于订单商品总金额,则优惠金额等于订单商品总金额 - $discount_money = $match_order_goods_money; - } - $surplus_money = $discount_money; - $match_sku_ids = array_filter($match_sku_ids, function ($item) use ($order) { - return ($order->goods_data[$item]['goods_money'] - $order->goods_data[$item]['discount_money']) !== 0; - }); - $match_count = count($match_sku_ids); - foreach ($match_sku_ids as $sku_key => $sku_id) { - $item_order_goods_money = $order->goods_data[$sku_id]['goods_money'] - $order->goods_data[$sku_id]['discount_money']; - if ($is_free_shipping) { - $order->goods_data[$sku_id]['goods']['is_free_shipping'] = 1; - $order->goods_data[$sku_id]['goods']['delivery_money'] = 0; - } - - //订单项满减优惠计算 - if ($sku_key == ($match_count - 1)) { - $item_discount_money = $surplus_money; - } else { - if ($match_order_goods_money == 0 || $discount_money == 0) { - $item_discount_money = 0; - } else { - $item_discount_money = $order->moneyFormat($item_order_goods_money / $match_order_goods_money * $discount_money); - if ($item_discount_money == 0) { - $item_discount_money = $item_order_goods_money; - } - if ($item_discount_money > $surplus_money) { - $item_discount_money = $surplus_money; - } - } - } - $order->goods_data[$sku_id]['discount_money'] = bcadd($order->goods_data[$sku_id]['discount_money'], $item_discount_money, 2); - $manjian_one_discount_money = bcadd($manjian_one_discount_money, $item_discount_money, 2); - $surplus_money = bcsub($surplus_money, $item_discount_money, 2); - } - } - - /** - * 满减活动商品赠品内容 - * @param $order - * @param $gift - * @param $manjian_id - * @param $level - * @param $sku_ids - * @return void - */ - public function getGiftContent(&$order, $gift, $manjian_id, $level, $sku_ids) - { - foreach ($gift as $k => $v) { - switch ($k) { - case 'balance': - case 'point': - if ($v > 0) { - $gift[$k] = $v; - } else { - unset($gift[$k]); - } - break; - case 'coupon': - if (!empty($v) && is_array($v)) { - foreach ($v as $kk => $vv) { - $coupon_count = (new Coupon())->where([ - ['id', '=', $vv['coupon_id']], - ['status', '=', CouponDict::NORMAL], - ])->count(); - if ($coupon_count == 0) { - unset($v[$kk]); - } - } - $v = array_values($v); - if (!empty($v) && is_array($v)) { - $gift[$k] = $v; - } else { - unset($gift[$k]); - } - } - break; - case 'goods': - if (!empty($v) && is_array($v)) { - foreach ($v as $kk => $vv) { - $sku_info = (new GoodsSku())->field('sku_id, sku_name, sku_image, goods_id, price, stock, weight, volume,sku_id, sku_spec_format,member_price, sale_price')->where([ - ['goods_id', '=', $vv['goods_id']], - ['sku_id', '=', $vv['sku_id']], - ['stock', '>', 0], - ])->with(['goods'])->findOrEmpty()->toArray(); - if (!empty($sku_info) && !empty($sku_info['goods']) && $sku_info['goods']['status'] == 1) { - if (isset($order->gift_goods[$vv['sku_id']])) { - $order->gift_goods[$vv['sku_id']]['num'] += $vv['num']; - } else { - $sku_info['original_price'] = $sku_info['price']; - $sku_info['price'] = 0; - $sku_info['num'] = $vv['num']; - $sku_info['goods_money'] = 0; - $sku_info['discount_money'] = 0; - $sku_info['is_gift'] = 1; - $order->gift_goods[$vv['sku_id']] = $sku_info; - } - } else { - unset($v[$kk]); - } - } - $v = array_values($v); - if (!empty($v) && is_array($v)) { - $gift[$k] = $v; - } else { - unset($gift[$k]); - } - } - break; - } - } - if (!empty($gift)) { - $order->gift['manjian'][$manjian_id]['gift'] = $gift; - $order->gift['manjian'][$manjian_id]['level'] = $level; - $order->gift['manjian'][$manjian_id]['sku_ids'] = $sku_ids; - } - } - - /** - * 添加满减活动赠送记录 - * @param $data - * @return true - */ - public function addGiveRecords($data) - { - $discount = $data['basic']['gift']; - $order_data = $data['order_data']; - if (!empty($discount) && !empty($discount['manjian'])) { - $manjian_give_records_model = new ManjianGiveRecords(); - $core_manjian_stat_service = new CoreManjianStatService(); - foreach ($discount['manjian'] as $manjian_id => $v) { - if (!empty($v['gift'])) { - $gift = $v['gift']; - $level = $v['level']; - $sku_ids = $v['sku_ids']; - $coupon_json = []; - if (!empty($gift['coupon'])) { - foreach ($gift['coupon'] as $vv) { - $coupon_json[] = [ - 'coupon_id' => $vv['coupon_id'], - 'num' => $vv['num'] - ]; - } - } - $goods_json = []; - if (!empty($gift['goods'])) { - foreach ($gift['goods'] as $vv) { - $goods_json[] = [ - 'goods_id' => $vv['goods_id'], - 'sku_id' => $vv['sku_id'], - 'num' => $vv['num'] - ]; - } - } - $give_data[] = [ - 'member_id' => $order_data['member_id'], - 'order_id' => $order_data['order_id'], - 'manjian_id' => $manjian_id, - 'level' => $level, - 'point' => $gift['point'] ?? 0, - 'balance' => $gift['balance'] ?? 0, - 'coupon_json' => $coupon_json, - 'goods_json' => $goods_json, - 'sku_ids' => $sku_ids - ]; - } - //会员满减活动参与次数 - $join_count = $manjian_give_records_model->where([ - ['member_id', '=', $order_data['member_id']], - ['manjian_id', '=', $manjian_id], - ])->count(); - //满减活动数据统计 - $stat_data = [ - 'order_num' => 1, - 'member_num' => $join_count == 0 ? 1 : 0, - ]; - $core_manjian_stat_service->stat($manjian_id, $stat_data); - } - if (!empty($give_data)) { - $manjian_give_records_model->saveAll($give_data); - } - } - return true; - } - - /** - * 满减活动赠品发放 - * @param $data - * @return true - */ - public function giftGrant($data) - { - $give_records = (new ManjianGiveRecords())->where([ - ['order_id', '=', $data['order_id']], - ['member_id', '=', $data['member_id']], - ])->field('member_id,manjian_id,point,balance,coupon_json,goods_json')->select()->toArray(); - Log::write('满减送活动赠品发放:' . json_encode($give_records)); - if (!empty($give_records)) { - $core_member_account = new CoreMemberAccountService(); - $core_coupon_member_service = new CoreCouponMemberService(); - $core_manjian_stat_service = new CoreManjianStatService(); - foreach ($give_records as $v) { - //会员积分发放 - if ($v['point'] > 0) { - $core_member_account->addLog($v['member_id'], MemberAccountTypeDict:: POINT, $v['point'], 'manjian_gift_give', '满减送活动赠送', $v['manjian_id']); - } - //会员余额发放 - if ($v['balance'] > 0) { - $core_member_account->addLog($v['member_id'], MemberAccountTypeDict:: BALANCE, $v['balance'], 'manjian_gift_give', '满减送活动赠送', $v['manjian_id']); - } - if (!empty($v['coupon_json'])) { - $coupon_num = 0; - foreach ($v['coupon_json'] as $coupon) { - try { - $core_coupon_member_service->sendCoupon($v['member_id'], $coupon['coupon_id'], $coupon['num']); - $coupon_num += $coupon['num']; - } catch (CommonException $e) { - Log::write('满减赠送优惠券“' . $coupon['coupon_id'] . '”发放失败,错误原因:' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - } - } - if (!empty($v['goods_json'])) { - $nums = array_column($v['goods_json'], 'num'); - $goods_num = array_sum($nums); - } - - //满减活动数据统计 - $stat_data = [ - 'order_money' => $data['order_money'], - 'point' => $v['point'], - 'balance' => $v['balance'], - 'coupon_num' => $coupon_num ?? 0, - 'goods_num' => $goods_num ?? 0 - ]; - $core_manjian_stat_service->stat($v['manjian_id'], $stat_data); - } - } - return true; - } - - /** - * 满减活动退款校验 - * @return array - */ - public function refundCheck($data) - { - $order_goods_model = new OrderGoods(); - //查询订单是否全部退款 - $order_goods_list = $order_goods_model->where([ - ['order_id', '=', $data['order_id']], - ['member_id', '=', $data['member_id']], - ['status', '<>', OrderGoodsDict::REFUND_FINISH], - ['is_gift', '=', 0] - ])->column('order_goods_id,goods_id,sku_id,num,goods_money,extend', 'order_goods_id'); - - $give_records = (new ManjianGiveRecords())->where([ - ['order_id', '=', $data['order_id']], - ['member_id', '=', $data['member_id']], - ])->field('manjian_id,level,point,balance,coupon_json,goods_json')->select()->toArray(); - - $refund_gift_list = []; - foreach ($give_records as $value) { - $manjian_info = $this->model->where([ - ['manjian_id', '=', $value['manjian_id']] - ])->findOrEmpty()->toArray(); - if (empty($manjian_info)) continue; - - $condition_type = $manjian_info['condition_type']; - $condition_match_value = 0; - - if (!empty($order_goods_list)) { - foreach ($order_goods_list as $v) { - $manjian_goods_count = (new ManjianGoods())->where([ - ['goods_id', '=', $v['goods_id']], - ['sku_id', '=', $v['sku_id']], - ['manjian_id', '=', $value['manjian_id']], - ['status', '=', ManjianDict::ACTIVE] - ])->count(); - if ($manjian_info['goods_type'] == ManjianDict::ALL_GOODS) {//全部商品参与 - if ($condition_type == ManjianDict::OVER_N_YUAN) {//满N元 - $condition_match_value += $v['goods_money']; - } else {//满N件 - $condition_match_value += $v['num']; - } - - } elseif ($manjian_info['goods_type'] == ManjianDict::SELECTED_GOODS) {//指定商品参与 - if ($manjian_goods_count > 0) { - if ($condition_type == ManjianDict::OVER_N_YUAN) {//满N元 - $condition_match_value += $v['goods_money']; - } else {//满N件 - $condition_match_value += $v['num']; - } - - } - } elseif ($manjian_info['goods_type'] == ManjianDict::SELECTED_GOODS_NOT) {//指定商品不参与 - if ($manjian_goods_count == 0) { - if ($condition_type == ManjianDict::OVER_N_YUAN) {//满N元 - $condition_match_value += $v['goods_money']; - } else {//满N件 - $condition_match_value += $v['num']; - } - } - } - } - } - - $gift = [];//赠品 - $level = -1;//优惠层级 - $rule_type = $manjian_info['rule_type']; - $rule_json = $manjian_info['rule_json']; - foreach ($rule_json as $key => $rule) { - if ($condition_match_value >= $rule['limit']) { - if ($rule_type == ManjianDict::LADDER) {//阶梯优惠 - //积分 - $gift['point'] = $rule['point'] ?? 0; - - if (!$rule['is_give_point']) { - $gift['point'] = 0; - } - //余额 - $gift['balance'] = $rule['balance'] ?? 0; - - if (!$rule['is_give_balance']) { - $gift['balance'] = 0; - } - //优惠券 - $gift['coupon'] = $rule['coupon'] ?? []; - - if (!$rule['is_give_coupon']) { - $gift['coupon'] = []; - } - //赠品 - $gift['goods'] = $rule['goods'] ?? []; - - if (!$rule['is_give_goods']) { - $gift['goods'] = []; - } - } else {//循环优惠 - $cycle_num = intdiv($condition_match_value, $rule['limit']); - if ($rule['is_give_point']) $gift['point'] = ($rule['point'] ?? 0) * $cycle_num; - if ($rule['is_give_balance']) $gift['balance'] = ($rule['balance'] ?? 0) * $cycle_num; - if ($rule['is_give_coupon']) { - $gift_coupon = $rule['coupon'] ?? []; - if ($gift_coupon) { - foreach ($gift_coupon as &$coupon) { - $coupon['num'] = intval($coupon['num']) * $cycle_num; - } - } - $gift['coupon'] = $gift_coupon; - } - if ($rule['is_give_goods']) { - $gift_goods = $rule['goods'] ?? []; - if ($gift_goods) { - foreach ($gift_goods as &$goods) { - $goods['num'] = intval($goods['num']) * $cycle_num; - } - } - $gift['goods'] = $gift_goods; - } - } - $level = $key; - } - } - - if ($level < $value['level'] || empty($order_goods_list)) {//优惠层级降级或订单全部退款,退还全部赠品 - if ($value['point'] > 0) { - $refund_gift_list[$value['manjian_id']]['point'] = $value['point']; - } - if ($value['balance'] > 0) { - $refund_gift_list[$value['manjian_id']]['balance'] = $value['balance']; - } - if (!empty($value['coupon_json'])) { - $refund_gift_list[$value['manjian_id']]['coupon'] = $value['coupon_json']; - } - if (!empty($value['goods_json'])) { - $refund_gift_list[$value['manjian_id']]['goods'] = $value['goods_json']; - } - } else { - if ($rule_type == ManjianDict::CYCLE) {//循环优惠 - if ($value['point'] > 0) { - if (!empty($gift) && !empty($gift['point'])) { - if ($value['point'] > $gift['point']) { - $value['point'] -= $gift['point']; - $refund_gift_list[$value['manjian_id']]['point'] = $value['point']; - } - } - } - if ($value['balance'] > 0) { - if (!empty($gift) && !empty($gift['balance'])) { - if ($value['balance'] > $gift['balance']) { - $value['balance'] -= $gift['balance']; - $refund_gift_list[$value['manjian_id']]['balance'] = $value['balance']; - } - } - } - if (!empty($value['coupon_json'])) { - foreach ($value['coupon_json'] as $coupon) { - if (!empty($gift) && !empty($gift['coupon'])) { - if ($coupon['num'] > $gift['coupon']['num']) { - $coupon['num'] -= $gift['coupon']['num']; - $refund_gift_list[$value['manjian_id']]['coupon'][] = $coupon; - } - } - } - } - if (!empty($value['goods_json'])) { - foreach ($value['goods_json'] as $goods) { - if (!empty($gift) && !empty($gift['goods'])) { - $gift_goods = array_column($gift['goods'], null, 'sku_id'); - if ($goods['num'] > $gift_goods[$goods['sku_id']]['num']) { - $goods['num'] -= $gift_goods[$goods['sku_id']]['num']; - $refund_gift_list[$value['manjian_id']]['goods'][] = $goods; - } - } - } - } - } - } - } - return $refund_gift_list; - } - - /** - * 订单退款后退还赠品 - * @return true - */ - public function refundGift($data) - { - $refund_gift_list = $this->refundCheck($data); - if (!empty($refund_gift_list)) { - $core_member_account = new CoreMemberAccountService(); - $core_coupon_member_service = new CoreCouponMemberService(); - $coupon_member_model = new CouponMember(); - $member_model = new Member(); - $coupon_model = new Coupon(); - $order_goods_model = new OrderGoods(); - $core_goods_stock_service = new CoreGoodsStockService(); - $manjian_give_records_service = new ManjianGiveRecords(); - $core_manjian_stat_service = new CoreManjianStatService(); - foreach ($refund_gift_list as $manjian_id => $v) { - $manjian_give_where = [ - ['member_id', '=', $data['member_id']], - ['order_id', '=', $data['order_id']], - ['manjian_id', '=', $manjian_id], - ]; - $give_records = $manjian_give_records_service->field('coupon_json,goods_json')->where($manjian_give_where)->findOrEmpty()->toArray(); - $member_info = $member_model->field('point,balance')->where([ - ['member_id', '=', $data['member_id']], - ])->findOrEmpty()->toArray(); - if (isset($v['point']) && $v['point'] > 0) { - //会员积分扣除 - if ($member_info['point'] >= $v['point']) {//剩余积分足够才扣除 - $core_member_account->addLog($data['member_id'], MemberAccountTypeDict:: POINT, -$v['point'], 'manjian_gift_back', '满减送活动订单退款退还赠送积分', $manjian_id); - $manjian_give_records_service->where($manjian_give_where)->update(['point' => Db::raw('point - ' . $v['point'])]); - } - } - if (isset($v['balance']) && $v['balance'] > 0) { - //会员余额扣除 - if ($member_info['balance'] >= $v['balance']) {//剩余余额足够才扣除 - $core_member_account->addLog($data['member_id'], MemberAccountTypeDict:: BALANCE, -$v['balance'], 'manjian_gift_back', '满减送活动订单退款退还赠送余额', $manjian_id); - $manjian_give_records_service->where($manjian_give_where)->update(['balance' => Db::raw('balance - ' . $v['balance'])]); - } - } - if (!empty($v['coupon']) && !empty($give_records)) { - //会员优惠券失效 - $coupon_json = []; - foreach ($v['coupon'] as $coupon) { - $coupon_info = $coupon_model->where([['id', '=', $coupon['coupon_id']]])->findOrEmpty(); - if (!$coupon_info->isEmpty()) { - $ids = $coupon_member_model->where([ - ['member_id', '=', $data['member_id']], - ['coupon_id', '=', $coupon['coupon_id']], - ['status', '=', CouponMemberDict::WAIT_USE] - ])->limit($coupon['num'])->order('create_time desc')->column('id'); - if (!empty($ids)) { - $core_coupon_member_service->invalid($ids); - $coupon_info->give_count -= $coupon['num']; - $coupon_info->save(); - } - if (!empty($give_records['coupon_json'])) { - $coupon_array = array_column($give_records['coupon_json'], 'num', 'coupon_id'); - if ($coupon_array[$coupon['coupon_id']] > $coupon['num']) { - $coupon_json[]['coupon_id'] = $coupon['coupon_id']; - $coupon_json[]['num'] = $coupon_array[$coupon['coupon_id']] - $coupon['num']; - } - } - } - } - $manjian_give_records_service->where($manjian_give_where)->update(['coupon_json' => $coupon_json]); - $nums = array_column($v['coupon'], 'num'); - $coupon_num = array_sum($nums); - } - if (!empty($v['goods']) && !empty($give_records)) { - //赠品退款或扣除赠送数量 - $goods_json = []; - foreach ($v['goods'] as $goods) { - $order_goods_where = [ - ['member_id', '=', $data['member_id']], - ['order_id', '=', $data['order_id']], - ['goods_id', '=', $goods['goods_id']], - ['sku_id', '=', $goods['sku_id']], - ['is_gift', '=', 1] - ]; - $order_goods_info = $order_goods_model->field('num')->where($order_goods_where)->findOrEmpty()->toArray(); - if (!empty($order_goods_info)) { - if ($goods['num'] >= $order_goods_info['num']) {//赠送数量全部扣除,赠品订单项退款完成 - $order_goods_model->where($order_goods_where)->update([ - 'status' => OrderGoodsDict::REFUND_FINISH, - 'is_enable_refund' => 0,//禁用退款 - ]); - } else {//没有全部扣除,只减去需要扣除的赠送数量,不改变退款状态 - $order_goods_model->where($order_goods_where)->update(['num' => Db::raw('num - ' . $goods['num'])]); - } - //增加赠品库存 - $core_goods_stock_service->inc([ - 'num' => $goods['num'], - 'goods_id' => $goods['goods_id'], - 'sku_id' => $goods['sku_id'] - ]); - } - if (!empty($give_records['goods_json'])) { - $goods_array = array_column($give_records['goods_json'], 'num', 'sku_id'); - if ($goods_array[$goods['sku_id']] > $goods['num']) { - $goods_json[]['goods_id'] = $goods['goods_id']; - $goods_json[]['sku_id'] = $goods['sku_id']; - $goods_json[]['num'] = $goods_array[$goods['sku_id']] - $goods['num']; - } - } - } - $manjian_give_records_service->where($manjian_give_where)->update(['goods_json' => $goods_json]); - $nums = array_column($v['goods'], 'num'); - $goods_num = array_sum($nums); - } - //满减活动数据统计 - $stat_data = [ - 'order_money' => -$data['money'], - 'point' => -($v['point'] ?? 0), - 'balance' => -($v['balance'] ?? 0), - 'coupon_num' => -($coupon_num ?? 0), - 'goods_num' => -($goods_num ?? 0) - ]; - $core_manjian_stat_service->stat($manjian_id, $stat_data); - } - } - return true; - } - - /** - * 获取满减送订单项赠送信息 - * @return void - */ - public function getOrderGoodsGiveInfo(&$order_goods_info, $order_goods_list, $member_id) - { - $manjian_records = (new ManjianGiveRecords())->field('manjian_id,level,point,balance,coupon_json,goods_json,sku_ids')->where([ - ['member_id', '=', $member_id], - ['order_id', '=', $order_goods_info['order_id']], - ])->select()->toArray(); - if (!empty($manjian_records)) { - foreach ($manjian_records as $kk => $vv) { - $manjian_list = (new Manjian())->field('manjian_id,manjian_name,condition_type,goods_type,join_member_type,rule_type,rule_json')->where([ - ['manjian_id', '=', $vv['manjian_id']] - ])->select()->toArray(); - foreach ($manjian_list as $manjian_info) { - $condition_match_value = 0; - foreach ($order_goods_list as $k => $v) { - if ($v['is_gift'] == 0) { - if (in_array($v['sku_id'], $vv['sku_ids'])) { - if (!empty($manjian_info)) { - if ($manjian_info['condition_type'] == ManjianDict::OVER_N_YUAN) { - $condition_match_value += $v['goods_money']; - } else { - $condition_match_value += $v['num']; - } - } - } - } - } - if (in_array($order_goods_info['sku_id'], $vv['sku_ids'])) { - if (!empty($manjian_info) && !empty($manjian_info['rule_json'])) { - $rule_json = $manjian_info['rule_json'][$vv['level']]; - $cycle_num = 0; - if ($manjian_info['rule_type'] == ManjianDict::CYCLE) { - $cycle_num = intdiv($condition_match_value, $rule_json['limit']); - $rule_json['limit'] = $rule_json['limit'] * $cycle_num; - if (!empty($rule_json['discount_money'])) { - $rule_json['discount_money'] = bcmul($cycle_num, $rule_json['discount_money'], 2); - } - if (!empty($rule_json['point'])) { - $rule_json['point'] = intval($rule_json['point']) * $cycle_num; - } - if (!empty($rule_json['balance'])) { - $rule_json['balance'] = bcmul($cycle_num, $rule_json['balance'], 2); - } - } - - if (!empty($rule_json['coupon'])) { - foreach ($rule_json['coupon'] as &$coupon) { - if ($manjian_info['rule_type'] == ManjianDict::CYCLE && $cycle_num > 0) { - $coupon['num'] = intval($coupon['num']) * $cycle_num; - } - $coupon_info = (new Coupon())->field('price,min_condition_money')->where([ - ['id', '=', $coupon['coupon_id']] - ])->findOrEmpty()->toArray(); - if (!empty($coupon_info)) { - if ($coupon_info['min_condition_money'] == '0.00') { - $coupon_name = $coupon_info['price'] . "元无门槛券"; - } else { - $coupon_name = "满" . $coupon_info['min_condition_money'] . "元减" . $coupon_info['price'] . "元券"; - } - $coupon['coupon_name'] = $coupon_name; - } - } - } - if (!empty($rule_json['goods'])) { - foreach ($rule_json['goods'] as &$goods) { - if ($manjian_info['rule_type'] == ManjianDict::CYCLE && $cycle_num > 0) { - $goods['num'] = intval($goods['num']) * $cycle_num; - } - $sku_info = (new GoodsSku())->field('goods_id,sku_name,sku_image,price')->where([ - ['goods_id', '=', $goods['goods_id']], - ['sku_id', '=', $goods['sku_id']] - ])->with(['goods'])->findOrEmpty()->toArray(); - if (!empty($sku_info) && !empty($sku_info['goods'])) { - $goods['goods_name'] = $sku_info['goods']['goods_name']; - $goods['sku_name'] = $sku_info['sku_name']; - $goods['sku_image'] = $sku_info['sku_image']; - $goods['price'] = $sku_info['price']; - } - } - } - $manjian_info['rule'] = $rule_json; - if ($manjian_info['rule']['is_discount'] || $manjian_info['rule']['is_free_shipping'] || $manjian_info['rule']['is_give_point'] || $manjian_info['rule']['is_give_balance'] || $manjian_info['rule']['is_give_coupon'] || $manjian_info['rule']['is_give_goods']) { - $order_goods_info['manjian_info'][] = $manjian_info; - } - } - } - } - } - } - } - - /** - * 满减优惠 - * @param $data - * @return mixed - */ - public function manjianPromotion($data, $member_id) - { - $promotion_money = $data['promotion_money'] ?? 0; - //先查询全部商品的满减套餐 进行中 - $manjian_model = new Manjian(); - $all_info = $manjian_model - ->field('manjian_id,manjian_name,goods_type,goods_ids,rule_json,rule_type,join_member_type,level_ids,label_ids,condition_type') - ->where([['goods_type', '=', ManjianDict::ALL_GOODS], ['status', '=', ManjianDict::ACTIVE]]) - ->findOrEmpty()->toArray(); - - $goods_list = $data['goods_list']; - //存在全场满减 - //验证当前用户是否可参与活动 - if (!empty($all_info)) { - $can_join = $this->canJoinManjian($all_info, $member_id); - if ($can_join) { - //获取折扣价格 - $discount_array = $this->getManjianDiscountMoney($all_info, $data); - $all_info['discount_array'] = $discount_array; - - $discount_money = $discount_array['discount_money']; - $promotion_money = bcadd($promotion_money, $discount_money, 2); - if (!empty($discount_array['rule'])) { - $goods_list = array_map(function ($item) use ($all_info) { - $item['promotion']['manjian'][] = $all_info; - return $item; - }, $goods_list); - } - } - } - - //指定不参与 - $not_select_list = $manjian_model - ->field('manjian_id,manjian_name,goods_type,goods_ids,rule_json,rule_type,join_member_type,level_ids,label_ids,condition_type') - ->with(['activeGoods']) - ->where([['goods_type', '=', ManjianDict::SELECTED_GOODS_NOT], ['status', '=', ManjianDict::ACTIVE]]) - ->select()->toArray(); - if (!empty($not_select_list)) { - foreach ($not_select_list as $not_select_info) { - //验证当前用户是否可参与活动 - $can_join = $this->canJoinManjian($not_select_info, $member_id); - if ($can_join) { - $not_select_goods_sku_id = []; - $item_goods_data = [ - 'goods_money' => 0, - 'goods_num' => 0 - ]; - $item_goods_list = []; - $sku_ids = []; - $discount_money = 0; - if (isset($not_select_info['activeGoods']) && !empty($not_select_info['activeGoods'])) { - $not_select_goods_sku_id = array_column($not_select_info['activeGoods'], 'sku_id'); - } - - foreach ($goods_list as $goods_k => $goods_item) { - if (!in_array($goods_item['sku_id'], $not_select_goods_sku_id)) { - $item_goods_data['goods_money'] += $goods_item['goods_money']; - $item_goods_data['goods_num'] += $goods_item['num']; - $item_goods_list[] = $goods_item; - array_push($sku_ids, $goods_item['sku_id']); - } - } - $discount_array = $this->getManjianDiscountMoney($not_select_info, $item_goods_data); - - $not_select_info['discount_array'] = $discount_array; - $discount_money = bcadd($discount_money, $discount_array['discount_money'], 2); - - if (!empty($discount_array['rule'])) { - $goods_list = array_map(function ($item) use ($sku_ids, $not_select_info) { - if (in_array($item['sku_id'], $sku_ids)) { - $item['promotion']['manjian'][] = $not_select_info; - } - return $item; - }, $goods_list); - } - $promotion_money = bcadd($promotion_money, $discount_money, 2); - } - } - - - //指定参与 - $goods_ids = array_unique(array_column($data['goods_list'], 'goods_id')); - $manjian_goods_list = (new ManjianGoods()) - ->where([['status', '=', ManjianDict::ACTIVE], ['goods_id', 'in', $goods_ids]]) - ->column('manjian_id'); - if (!empty($manjian_goods_list)) { - $discount_money = 0; - $manjian_ids = array_unique($manjian_goods_list); //去重 - sort($manjian_ids); - $manjian_list = $manjian_model - ->field('manjian_id,manjian_name,goods_type,goods_ids,rule_json,rule_type,join_member_type,level_ids,label_ids,condition_type') - ->with(['activeGoods']) - ->where([['goods_type', '=', ManjianDict::SELECTED_GOODS], ['status', '=', ManjianDict::ACTIVE], ['manjian_id', 'in', $manjian_ids]]) - ->select()->toArray(); - foreach ($manjian_list as $k => $v) { - //验证当前用户是否可参与活动 - $can_join = $this->canJoinManjian($v, $member_id); - if (!$can_join) { - continue; - } - $manjian_goods_sku_ids = []; - if (isset($v['activeGoods']) && !empty($v['activeGoods'])) { - $manjian_goods_sku_ids = array_column($v['activeGoods'], 'sku_id'); - } - $item_goods_data = [ - 'goods_money' => 0, - 'goods_num' => 0 - ]; - $item_goods_list = []; - $sku_ids = []; - foreach ($goods_list as $goods_k => $goods_item) { - if (in_array($goods_item['sku_id'], $manjian_goods_sku_ids)) { - $item_goods_data['goods_money'] += $goods_item['goods_money']; - $item_goods_data['goods_num'] += $goods_item['num']; - $item_goods_list[] = $goods_item; - array_push($sku_ids, $goods_item['sku_id']); - $goods_list[$goods_k] = $goods_item; - } - } - $discount_array = $this->getManjianDiscountMoney($v, $item_goods_data); - - $discount_money = bcadd($discount_money, $discount_array['discount_money'], 2); - - if (!empty($discount_array['rule'])) { - $goods_list = array_map(function ($item) use ($sku_ids, $v, $discount_array) { - if (in_array($item['sku_id'], $sku_ids)) { - $temp = $v; - $temp['discount_array'] = $discount_array; - $item['promotion']['manjian'][] = $temp; - } - return $item; - }, $goods_list); - } - } - - $promotion_money = bcadd($promotion_money, $discount_money, 2); - } - } - $data['goods_list'] = $goods_list; - $data['promotion_money'] = $promotion_money; - return $data; - } - - /** - * 满减优惠金额 - * @param $manjian_info - * @param $data - * @return array - */ - public function getManjianDiscountMoney($manjian_info, $data) - { - $goods_money = $data['goods_money']; - if ($manjian_info['condition_type'] == ManjianDict::OVER_N_YUAN) { - $value = $data['goods_money']; - } else { - $value = $data['goods_num']; - } - //阶梯计算优惠 - $rule_item = $manjian_info['rule_json']; - $discount_money = 0; - $money = 0; - $rule = []; // 符合条件的优惠规则 - $level = -1; // 优惠层级 - if ($manjian_info['rule_type'] == ManjianDict::LADDER) { - foreach ($rule_item as $k => $v) { - if ($value >= $v['limit']) { - $rule = $v; - if (isset($v['is_discount']) && $v['is_discount'] == 1) { - if ($v['discount_type'] == 1) {//减 - $discount_money = $v['discount_money'] ?? 0; - } else {//折 - $discount_money = bcsub($goods_money, bcmul(bcdiv(($v['discount_money'] ?? 0), 10, 2), $goods_money, 2), 2); - } - } - $money = $v['limit'] ?? 0; - $level = $k; - } - } - } elseif ($manjian_info['rule_type'] == ManjianDict::CYCLE) { - foreach ($rule_item as $k => $v) { - if ($value >= $v['limit']) { - $rule = $v; - $cycle_num = intdiv($value, $v['limit']); - if (isset($v['is_discount']) && $v['is_discount'] == 1) { - if ($v['limit'] == 0) { - $discount_money = 0; - } else { - $discount_money = bcmul($cycle_num, ($v['discount_money'] ?? 0), 2); - } - } - $level = $k; - } - } - } - return ['discount_money' => $discount_money, 'money' => $money, 'rule' => $rule, 'level' => $level]; - } - - /** - * 是否可参加活动 - * @param $manjian_info - * @param $member_id - * @return bool - */ - public function canJoinManjian($manjian_info, $member_id) - { - //判断会员是否有参与资格 - $can_join = FALSE; - $join_member_type = $manjian_info['join_member_type']; - $level_ids = $manjian_info['level_ids']; - $label_ids = $manjian_info['label_ids']; - $member_info = (new Member())->field('member_level,member_label')->where([ - ['member_id', '=', $member_id] - ])->findOrEmpty()->toArray(); - if ($join_member_type == ManjianDict::ALL_MEMBER) {//所有会员参与 - $can_join = TRUE; - } elseif ($join_member_type == ManjianDict::SELECTED_MEMBER_LEVEL) {//指定会员等级 - if (in_array($member_info['member_level'], $level_ids)) { - $can_join = TRUE; - } - } elseif ($join_member_type == ManjianDict::SELECTED_MEMBER_LABEL) {//指定会员标签 - if (!empty($member_info['member_label']) && !empty(array_intersect($member_info['member_label'], $label_ids))) { - $can_join = TRUE; - } - } - return $can_join; - } - - /** - * 获取满减信息 - * @return array - */ - public function getManjianInfo($data) - { - $member_id = $data['member_id']; - $goods_id = $data['goods_id']; - $sku_id = $data['sku_id']; - $gift_goods = $data['gift_goods'] ?? []; - if ($sku_id == 0 && $goods_id == 0) { - return []; - } - if (empty($sku_id) && !empty($goods_id)) { - // 查询默认规格项 - $default_sku_info = (new GoodsSku())->where([['goods_id', '=', $goods_id], ['is_default', '=', 1]], 'sku_id') - ->field('sku_id')->findOrEmpty()->toArray(); - if (!empty($default_sku_info)) { - $sku_id = $default_sku_info['sku_id']; - } - } - - $field = 'manjian_id,manjian_name,condition_type,rule_type,rule_json,join_member_type,level_ids,label_ids,start_time,end_time,remark'; - $common_where = [ - ['status', '=', ManjianDict::ACTIVE], - ['start_time', '<=', time()], - ['end_time', '>', time()] - ]; - $manjian_info_all_goods = $this->model->field($field)->where($common_where)->where([['goods_type', '=', ManjianDict::ALL_GOODS]])->findOrEmpty()->toArray(); - $all_manjian_info = []; - if (!empty($manjian_info_all_goods)) {//全部商品参与 - $manjian_info = $manjian_info_all_goods; - $can_join = $this->canJoinManjian($manjian_info, $member_id); - if ($can_join) { - $rule_content = $this->getRuleContent($manjian_info, $gift_goods); - $manjian_info = $rule_content['is_join'] ? $rule_content : []; - } - $all_manjian_info[] = $manjian_info; - } - - $manjian_info_selected_goods_not = $this->model->field($field) - ->where($common_where) - ->where([['goods_type', '=', ManjianDict::SELECTED_GOODS_NOT]]) - ->select()->toArray(); - if (!empty($manjian_info_selected_goods_not)) {//指定商品不参与 - foreach ($manjian_info_selected_goods_not as $manjian_info) { - $can_join = $this->canJoinManjian($manjian_info, $member_id); - if ($can_join) { - $rule_content = $this->getRuleContent($manjian_info, $gift_goods); - $manjian_info = $rule_content['is_join'] ? $rule_content : []; - } - $all_manjian_info[] = $manjian_info; - } - } - //指定商品参与 - $manjian_info_selected_goods = $this->model->field($field)->where($common_where) - ->where([['goods_type', '=', ManjianDict::SELECTED_GOODS]]) - ->select() - ->toArray(); - $manjian_goods_info = (new ManjianGoods())->field('manjian_id,goods_type')->where([ - ['goods_id', '=', $goods_id], - ['sku_id', '=', $sku_id], - ['status', '=', ManjianDict::ACTIVE] - ])->where([['goods_type', '=', ManjianDict::SELECTED_GOODS]]) - ->findOrEmpty()->toArray(); - if (!empty($manjian_info_selected_goods) && !empty($manjian_goods_info)) { - $manjian_info_selected_goods = array_column($manjian_info_selected_goods, null, 'manjian_id'); - if (in_array($manjian_goods_info['manjian_id'], array_keys($manjian_info_selected_goods))) { - $manjian_info = $manjian_info_selected_goods[$manjian_goods_info['manjian_id']]; - $can_join = $this->canJoinManjian($manjian_info, $member_id); - if ($can_join) { - $rule_content = $this->getRuleContent($manjian_info, $gift_goods); - $manjian_info = $rule_content['is_join'] ? $rule_content : []; - } - $all_manjian_info[] = $manjian_info; - } - } - return $all_manjian_info; - } - - /** - * 获取满减规则内容 - * @param $manjian_info - * @return array - */ - public function getRuleContent($manjian_info, $gift_goods) - { - if (!empty($manjian_info)) { - $is_join = false; - $manjian_info['gift_goods'] = $gift_goods; - foreach ($manjian_info['rule_json'] as $key => $item) { - if ($item['is_discount']) { - $is_join = true; - } - if ($item['is_free_shipping']) { - $is_join = true; - } - if ($item['is_give_point']) { - $is_join = true; - } - if ($item['is_give_balance']) { - $is_join = true; - } - if ($item['is_give_coupon']) { - foreach ($item['coupon'] as $coupon_key => &$coupon) { - $coupon_info = (new Coupon())->field('price,min_condition_money')->where([ - ['id', '=', $coupon['coupon_id']], - ['status', '=', CouponDict::NORMAL], - ])->findOrEmpty()->toArray(); - if (!empty($coupon_info)) { - if ($coupon_info['min_condition_money'] == '0.00') { - $coupon_name = $coupon_info['price'] . "元无门槛券"; - } else { - $coupon_name = "满" . $coupon_info['min_condition_money'] . "元减" . $coupon_info['price'] . "元券"; - } - $coupon['coupon_name'] = $coupon_name; - } else { - unset($item['coupon'][$coupon_key]); - } - } - $item['coupon'] = array_values($item['coupon']); - if (!empty($item['coupon'])) { - $is_join = true; - } - } - if ($item['is_give_goods']) { - foreach ($item['goods'] as $goods_key => &$goods) { - $sku_info = (new GoodsSku())->field('goods_id,sku_name,sku_image,price,stock')->where([ - ['goods_id', '=', $goods['goods_id']], - ['sku_id', '=', $goods['sku_id']], - ['stock', '>', 0], - ])->with(['goods'])->findOrEmpty()->toArray(); - if (!empty($sku_info) && !empty($sku_info['goods']) && $sku_info['goods']['status'] == 1) { - if (empty($gift_goods)) { - // 库存小于赠送数量时,取剩余库存 - $num = $sku_info['stock'] >= $goods['num'] ? $goods['num'] : $sku_info['stock']; - $goods['num'] = $num; - } else { - // 计算剩余库存 - $leave_num = $sku_info['stock']; - foreach ($gift_goods as $gift_goods_item) { - if ($gift_goods_item['goods_id'] == $goods['goods_id'] && $gift_goods_item['sku_id'] == $goods['sku_id']) { - if ($leave_num - $gift_goods_item['num'] >= 0) { - $leave_num = $leave_num - $gift_goods_item['num']; - } else { - $leave_num = 0; - } - } - } - $goods['num'] = $leave_num >= $goods['num'] ? $goods['num'] : $leave_num; - } - $goods['goods_name'] = $sku_info['goods']['goods_name']; - $goods['sku_name'] = $sku_info['sku_name']; - $goods['sku_image'] = $sku_info['sku_image']; - if (empty($goods['sku_image'])) { - $goods['sku_image'] = $sku_info['goods']['goods_cover_thumb_mid']; - } - $goods['price'] = $sku_info['price']; - - if ($goods['num'] == 0) { - unset($item['goods'][$goods_key]); - } - - $manjian_info['gift_goods'][] = $goods; - - } else { - unset($item['goods'][$goods_key]); - } - } - $item['goods'] = array_values($item['goods']); - if (!empty($item['goods'])) { - $is_join = true; - } - } - $manjian_info['rule_json'][$key] = $item; - } - $manjian_info['is_join'] = $is_join; - } - return $manjian_info; - } - - /** - * todo 金额格式化 封装调用 - * @param $money - * @return float|int - */ - public function moneyFormat($money) - { - return floor(strval(($money) * 100)) / 100; - } - -} diff --git a/niucloud/addon/shop/app/service/core/marketing/CoreManjianStatService.php b/niucloud/addon/shop/app/service/core/marketing/CoreManjianStatService.php deleted file mode 100644 index 720f7cac0..000000000 --- a/niucloud/addon/shop/app/service/core/marketing/CoreManjianStatService.php +++ /dev/null @@ -1,82 +0,0 @@ - $data['order_money'] ?? 0, - 'total_order_num' => $data['order_num'] ?? 0, - 'total_member_num' => $data['member_num'] ?? 0, - 'total_point' => $data['point'] ?? 0, - 'total_balance' => $data['balance'] ?? 0, - 'total_coupon_num' => $data['coupon_num'] ?? 0, - 'total_goods_num' => $data['goods_num'] ?? 0 - ]; - self::set($manjian_id, $data); - return true; - } - - /** - * 统计 - * @param int $manjian_id - * @param array $data - * @return true - */ - public static function set(int $manjian_id, array $data) - { - $manjian_model = new Manjian(); - $condition = [ - ['manjian_id', '=', $manjian_id], - ]; - $manjian_info = $manjian_model->where($condition)->findOrEmpty(); - if (!$manjian_info->isEmpty()) { - $update_data = []; - foreach ($data as $k => $v) { - if ($v != 0) { - if ($v > 0) { - $item_sql = ' + ' . abs($v); - } else if ($v < 0) { - $item_sql = ' - ' . abs($v); - } - $update_data[$k] = Db::raw('CASE WHEN '.$k . $item_sql. '>= 0 THEN ' .$k . $item_sql. ' ELSE 0 END'); - } - } - if ($update_data) { - $manjian_info->save($update_data); - } - } - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/marketing/CoreNewcomerService.php b/niucloud/addon/shop/app/service/core/marketing/CoreNewcomerService.php deleted file mode 100644 index 687cd9880..000000000 --- a/niucloud/addon/shop/app/service/core/marketing/CoreNewcomerService.php +++ /dev/null @@ -1,228 +0,0 @@ -model = new Active(); - } - - /** - * 获取新人专享配置 - * @return array - */ - public function getConfig() - { - $info = $this->model->field('active_id,active_status,active_value,active_desc')->where([ [ 'active_class', '=', ActiveDict::NEWCOMER_DISCOUNT ] ])->findOrEmpty()->toArray(); - $value = [ - 'active_id' => $info[ 'active_id' ] ?? 0, - 'active_status' => $info[ 'active_status' ] ?? 'close', - 'validity_type' => $info[ 'active_value' ][ 'validity_type' ] ?? 'day', - 'validity_day' => $info[ 'active_value' ][ 'validity_day' ] ?? 3, - 'validity_time' => date('Y-m-d H:i:s', $info[ 'active_value' ][ 'validity_time' ] ?? time() + 86400 * 3), - 'participation_way' => $info[ 'active_value' ][ 'participation_way' ] ?? 'never_order', - 'appoint_time' => date('Y-m-d H:i:s', $info[ 'active_value' ][ 'appoint_time' ] ?? time()), - 'limit_num' => $info[ 'active_value' ][ 'limit_num' ] ?? 1, - 'banner_list' => $info[ 'active_value' ][ 'banner_list' ] ?? [ - [ - 'imageUrl' => 'addon/shop/newcomer/banner.jpg', - 'toLink' => [ - 'name' => '', - ] - ] - ] - ]; - - $default_active_desc = "1、新人价是面向" . $this->getParticipationWayContent($value[ 'participation_way' ]) . "提供的一种专属优惠价格,同一账号仅限享受一次优惠;\n"; - $default_active_desc .= "2、仅限" . $this->getParticipationWayText($value[ 'participation_way' ], $value[ 'appoint_time' ]) . "可参与;\n"; - $default_active_desc .= "3、活动有效期:" . $this->getValidityTypeText($value[ 'validity_type' ], $value[ 'validity_day' ], $value[ 'validity_time' ]); - - $value[ 'active_desc' ] = $info[ 'active_desc' ] ?? $default_active_desc; - return $value; - } - - /** - * 获取参与门槛文字描述 - * @param $participation_way - * @return string - */ - public function getParticipationWayContent($participation_way) - { - switch ($participation_way) { - case NewcomerDict::NEVER_ORDER: - return '从未下过单的会员'; - case NewcomerDict::ASSIGN_TIME_ORDER: - return '指定时间内未下过单的会员'; - case NewcomerDict::ASSIGN_TIME_REGISTER: - return '指定时间内注册的会员'; - default: - return ''; - } - } - - /** - * 获取参与门槛文字描述 - * @param $participation_way - * @param $appoint_time - * @return string - */ - public function getParticipationWayText($participation_way, $appoint_time) - { - switch ($participation_way) { - case NewcomerDict::NEVER_ORDER: - return '从未下过单的会员'; - case NewcomerDict::ASSIGN_TIME_ORDER: - return $appoint_time . '之前未下过单的会员'; - case NewcomerDict::ASSIGN_TIME_REGISTER: - return $appoint_time . '之后注册的会员'; - default: - return ''; - } - } - - /** - * 获取有效期文字描述 - * @param $validity_type - * @param $validity_day - * @param $validity_time - * @return string - */ - public function getValidityTypeText($validity_type, $validity_day, $validity_time) - { - switch ($validity_type) { - case NewcomerDict::DAY: - return '参与活动后' . $validity_day . '天内。'; - case NewcomerDict::DATE: - return $validity_time . '后截止。'; - default: - return ''; - } - } - - /** - * 检测当前会员是否满足新人专享活动条件 - * @param $member_id - * @return bool - */ - public function checkIfNewcomer($member_id) - { - $is_newcomer = false; - $config = $this->getConfig(); - if (!empty($config)) { - if ($config[ 'active_status' ] == ActiveDict::ACTIVE) { - $appoint_time = strtotime($config[ 'appoint_time' ]); - - $order_model = new Order(); - $order_where = [ - [ 'member_id', '=', $member_id ], - [ 'status', 'in', [ OrderDict::WAIT_PAY, OrderDict::WAIT_DELIVERY, OrderDict::WAIT_TAKE, OrderDict::FINISH ] ] - ]; - switch ($config[ 'participation_way' ]) { - case NewcomerDict::NEVER_ORDER: - $order_count = $order_model->where($order_where)->count(); - if ($order_count == 0) $is_newcomer = true; - break; - case NewcomerDict::ASSIGN_TIME_ORDER: - $order_where[] = [ 'create_time', '<', $appoint_time ]; - $order_count = $order_model->where($order_where)->count(); - if ($order_count == 0) $is_newcomer = true; - break; - case NewcomerDict::ASSIGN_TIME_REGISTER: - $member_info = ( new Member() )->field('create_time')->where([ - [ 'member_id', '=', $member_id ] ]) - ->findOrEmpty()->toArray(); - if (!empty($member_info) && strtotime($member_info[ 'create_time' ]) >= $appoint_time) $is_newcomer = true; - break; - } - - if ($is_newcomer) { - $newcomer_records_model = new NewcomerRecords(); - $newcomerRecords = $newcomer_records_model->field('validity_time,is_join')->where([ - [ 'member_id', '=', $member_id ] - ])->findOrEmpty()->toArray(); - if (empty($newcomerRecords)) { - $validity_time = $this->getNewcomerEndTime($config); - $newcomer_records_model->create([ - 'member_id' => $member_id, - 'validity_time' => $validity_time - ]); - } else { - if ($newcomerRecords[ 'validity_time' ] < time() || $newcomerRecords[ 'is_join' ] == 1) { - $is_newcomer = false; - } - } - } - - } - } - return $is_newcomer; - } - - /** - * 获取新人专享倒计时结束时间 - * @param $member_id - * @param $config - * @return int - */ - public function getNewcomerEndTime($config) - { - $end_time = 0; - switch ($config[ 'validity_type' ]) { - case NewcomerDict::DAY: - $validity_day = $config[ 'validity_day' ]; - $end_time = time() + $validity_day * 86400; - break; - case NewcomerDict::DATE: - $validity_time = strtotime($config[ 'validity_time' ]); - $end_time = $validity_time; - break; - } - return $end_time; - } - - /** - * 新人专享活动修改后更新会员活动有效期 - * @return bool - */ - public function afterSave() - { - $config = $this->getConfig(); - ( new NewcomerRecords() )->where([ - [ 'is_join', '=', 0 ], - [ 'order_id', '=', 0 ] - ])->update( - [ - 'validity_time' => $this->getNewcomerEndTime($config), - 'update_time' => time() - ] - ); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/order/CoreInvoiceService.php b/niucloud/addon/shop/app/service/core/order/CoreInvoiceService.php deleted file mode 100644 index a56c912cd..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreInvoiceService.php +++ /dev/null @@ -1,93 +0,0 @@ -model = new Invoice(); - } - - /** - * 创建关联订单的发票 - * @param array $data - * @return array - */ - public function add($data) - { - $invoice = $this->model->create($data); - return $invoice->id; - } - - /** - * 发票启用 - * @param $id - * @return void - */ - public function open($id) - { - $this->model->where( - [ - ['id', '=', $id] - ] - )->update([ - 'status' => InvoiceDict::OPEN - ]); - return true; - } - - /** - * 发票审核 - * @param $id - * @return void - */ - public function audit($ids) - { - $this->model->where( - [ - ['id', 'in', $ids], - ['is_invoice', '=', InvoiceDict::WAIT_AUDIT] - ] - )->update([ - 'is_invoice' => InvoiceDict::WAIT_INVOICE - ]); - return true; - } - - /** - * 发票关闭 - * @param $id - * @return true - */ - public function close($id) - { - $this->model->where( - [ - ['id', '=', $id] - ] - )->update([ - 'status' => InvoiceDict::WAIT_OPEN - ]); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/order/CoreOrderBatchDeliveryService.php b/niucloud/addon/shop/app/service/core/order/CoreOrderBatchDeliveryService.php deleted file mode 100644 index 787f37e6e..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreOrderBatchDeliveryService.php +++ /dev/null @@ -1,339 +0,0 @@ -model = new OrderBatchDelivery(); - } - - - public function add($data) - { - //记录 - $data[ 'status' ] = OrderBatchDeliveryDict::PROCESSING;//进行中 - $batch = $this->model->create($data); - //发布任务 -// (new CoreOrderBatchDeliveryService())->execute($batch['id']); - OrderBatchDeliveryJob::dispatch([ 'data' => $batch->toArray() ]); - return true; - } - - /** - * 执行任务 - * @param $id - * @return void - */ - public function execute($id) - { - $where = [ 'id' => $id ]; - //获取订单 - $batch = $this->model->where($where)->findOrEmpty(); - if ($batch->isEmpty()) throw new CommonException("任务不存在"); - if ($batch[ 'status' ] != OrderBatchDeliveryDict::PROCESSING) throw new CommonException("任务已经完成"); - $type = $batch[ 'type' ]; - switch ($type) { - case 'delivery': - //订单批量发货 - $result = $this->delivery($batch); - break; - } - $fail_remark = $result[ 'fail_remark' ] ?? ''; - if (empty($fail_remark)) { - $status = OrderBatchDeliveryDict::FINISH; - } else { - $status = OrderBatchDeliveryDict::FAIL; - } - //todo 完成或失败后,记录日志 - $update_data = [ - 'status' => $status, - 'total_num' => $result[ 'total_num' ], - 'success_num' => $result[ 'success_num' ], - 'fail_num' => $result[ 'fail_num' ], - 'fail_remark' => $result[ 'fail_remark' ] - ]; - $total_list = $result[ 'total_list' ]; - //将完整记录写入excel - if (!empty($total_list)) { - $output_dir = public_path() . 'upload' . DIRECTORY_SEPARATOR . 'batch' . DIRECTORY_SEPARATOR . 'output' . DIRECTORY_SEPARATOR; - if (!is_dir($output_dir) && !mkdir($output_dir, 0777, true) && !is_dir($output_dir)) { - - } else { - $output = $output_dir . create_no() . '.csv'; - $file = fopen($output, 'wb'); - foreach ($total_list as $row) { - fputcsv($file, $row, ',', '"'); - } - fclose($file); - $update_data[ 'output' ] = str_replace(public_path(), '', $output); - } - } - - //将失败记录写入excel - $fail_list = $result[ 'fail_list' ]; - if (!empty($fail_list)) { - $fail_output_dir = public_path() . 'upload' . DIRECTORY_SEPARATOR . 'batch' . DIRECTORY_SEPARATOR . 'fail_output' . DIRECTORY_SEPARATOR; - if (!is_dir($fail_output_dir) && !mkdir($fail_output_dir, 0777, true) && !is_dir($fail_output_dir)) { - - } else { - $fail_output = $fail_output_dir . create_no() . '.csv'; - $fail_file = fopen($fail_output, 'wb'); - foreach ($fail_list as $row) { - fputcsv($fail_file, $row, ',', '"'); - } - fclose($fail_file); - $update_data[ 'fail_output' ] = str_replace(public_path(), '', $fail_output); - } - } - $this->model->where('id', $id)->update($update_data); - return $result; - } - - /** - * 批量发货 - * @param $params - * @return int[] - * @throws \PhpOffice\PhpSpreadsheet\Exception - */ - public function delivery($params) - { - $order_delivery_data = [];//以订单编号为key分配数据 - $core_order_delivery_service = new CoreOrderDeliveryService(); - $order_model = new Order(); - $order_goods_model = new OrderGoods(); - $main_id = $params[ 'main_id' ]; - $order_id_list_map = []; - - $express_company_column = ( new Company() )->where([ [ 'company_id', '>', 0 ] ])->column('company_id', 'company_name'); - - $total_num = 0; - $success_num = 0; - $fail_count = 0; - $total_list = []; - - if (empty($params[ 'order_ids' ])) { - $data = $params[ 'data' ]; - //读取导入文件 - $path = public_path() . $data[ 'path' ]; - if (is_file($path)) { - try { - //复制一个新文件 - $type = $data[ 'type' ]; - //将文件内容读取出来 - $spreadsheet = IOFactory::load($path); - // 选择要操作的工作表,这里选择第一个工作表 - $sheet = $spreadsheet->getSheet(0); - - // 获取行和列的数据 - $highestRow = $sheet->getHighestRow(); // 取得总行数 - $highestColumn = $sheet->getHighestColumn(); // 取得总列数 - if ($type == 'order') {//整单发货 - $sheet->setCellValue('D' . 1, '结果'); - $sheet->setCellValue('E' . 1, '描述'); - $total_list = [ - [ - '订单编号', '物流公司', '物流单号', '结果', '描述' - ] - ]; - $fail_list = [ - [ - '订单编号', '物流公司', '物流单号', '结果', '描述' - ] - ]; - - } else { - $sheet->setCellValue('E' . 1, '结果'); - $sheet->setCellValue('F' . 1, '描述'); - $total_list = [ - [ - '订单编号', '订单项ID', '物流公司', '物流单号', '结果', '描述' - ] - ]; - $fail_list = [ - [ - '订单编号', '订单项ID', '物流公司', '物流单号', '结果', '描述' - ] - ]; - } - // 循环读取每一行的数据 - for ($row = 2; $row <= $highestRow; ++$row) { - // 读取一行数据 - $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE); - // 根据需要处理$rowData - $item_data = $rowData[ 0 ]; - $item_data = array_map(function($value) { return trim($value); }, $item_data); - - $error = ''; - try { - $item_order_no = $item_data[ 0 ]; - - if (empty($item_order_no)) continue; - $total_num++; - $item_data[ 0 ] = (string) $item_data[ 0 ] . "\t"; - $temp_item_data = []; - $item_order_id = $order_id_list_map[ $item_order_no ] ?? 0; - if ($item_order_id == 0) { - $temp_order = $order_model->where([ 'order_no' => $item_order_no ])->findOrEmpty(); - if (!$temp_order->isEmpty()) { - $order_id_list_map[ $item_order_no ] = $temp_order[ 'order_id' ]; - $item_order_id = $temp_order[ 'order_id' ]; - $order_id_list_map[ $item_order_no ] = $item_order_id; - } - } - - if ($item_order_id > 0) { - if ($type == 'order') {//整单发货 - $item_express_company_name = $item_data[ 1 ]; - $express_number = $item_data[ 2 ] ?? ''; - if ($item_express_company_name != '无需物流') { - $delivery_type = OrderDeliveryDict::EXPRESS; - $item_express_company_id = $express_company_column[ $item_express_company_name ] ?? 0; - if ($item_express_company_id == 0) { -// $error = '物流公司不存在'; - throw new CommonException('物流公司不存在'); - } - } else { - $delivery_type = OrderDeliveryDict::NONE_EXPRESS; - $item_express_company_id = 0; - $express_number = ''; - } - - - $item_order_goods_ids = $order_goods_model->where([ 'order_id' => $item_order_id ])->column('order_goods_id'); - $core_order_delivery_service->delivery([ - 'main_type' => OrderLogDict::SYSTEM, - 'main_id' => $main_id, - 'order_id' => $item_order_id,//订单编号 - 'order_goods_ids' => $item_order_goods_ids,//订单项ids - 'delivery_type' => $delivery_type,//配送方式 - 'delivery_way' => 'manual_write',//发货方式,manual_write:手动填写,electronic_sheet:电子面单 - 'express_company_id' => $item_express_company_id,//物流公司 - 'express_number' => $express_number,//物流单号 - 'remark' => '', - 'electronic_sheet_id' => ''//电子面单模板 - ]); - - } else { - $item_express_company_name = $item_data[ 2 ]; - $express_number = $item_data[ 3 ] ?? ''; - if ($item_express_company_name != '无需物流') { - $delivery_type = OrderDeliveryDict::EXPRESS; - $item_express_company_id = $express_company_column[ $item_express_company_name ] ?? 0; - if ($item_express_company_id == 0) { -// $error = '物流公司不存在'; - throw new CommonException('物流公司不存在'); - } - } else { - $delivery_type = OrderDeliveryDict::NONE_EXPRESS; - $item_express_company_id = 0; - $express_number = ''; - } - - $core_order_delivery_service->delivery([ - 'main_type' => OrderLogDict::SYSTEM, - 'main_id' => $main_id, - 'order_id' => $item_order_id,//订单编号 - 'order_goods_ids' => [ $item_data[ 1 ] ],//订单项ids - 'delivery_type' => $delivery_type,//配送方式 - 'delivery_way' => 'manual_write',//发货方式,manual_write:手动填写,electronic_sheet:电子面单 - 'express_company_id' => $item_express_company_id,//物流公司 - 'express_number' => $express_number,//物流单号 - 'remark' => '', - 'electronic_sheet_id' => ''//电子面单模板 - ]); - - } - } else { - $error = '订单不存在'; - } - } catch (\Exception $e) { - $error = get_lang($e->getMessage()); - } - if ($type == 'order') {//整单发货 - $temp_item_data = [ - $item_data[ 0 ], - $item_data[ 1 ], - $item_data[ 2 ] - ]; - } else { - $temp_item_data = [ - $item_data[ 0 ], - $item_data[ 1 ], - $item_data[ 2 ], - $item_data[ 3 ] - ]; - } - if (!$error) { - $temp_item_data[] = '成功'; - $total_list[] = $temp_item_data; - $success_num++; - } else { - $temp_item_data[] = '失败'; - $temp_item_data[] = $error; - $total_list[] = $temp_item_data; - $fail_list[] = $temp_item_data; - $fail_count++; - } - - } - } catch (\Exception $e) { - $fail_remark = get_lang($e->getMessage()); - } - } else { - $fail_remark = '文件不存在'; - } - } - return [ - 'success_num' => $success_num, - 'fail_num' => $fail_count, - 'total_num' => $total_num, - 'total_list' => $total_list ?? [], - 'fail_list' => $fail_list ?? [], - 'fail_remark' => $fail_remark ?? '' - ]; - } - - - public function batchDelivery($data) - { - - } - - /** - * 获取正在进行的任务 - * @return void - */ - public function getProcessingList() - { - return $this->model->where('status', OrderBatchDeliveryDict::PROCESSING)->select(); - } -} diff --git a/niucloud/addon/shop/app/service/core/order/CoreOrderCloseService.php b/niucloud/addon/shop/app/service/core/order/CoreOrderCloseService.php deleted file mode 100644 index 9ea48de9e..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreOrderCloseService.php +++ /dev/null @@ -1,133 +0,0 @@ -model = new Order(); - } - - /** - * 订单关闭 - * @param array $data - * @return void - */ - public function close(array $data) - { - try { - $order_data = $this->model->where([ - ['order_id', '=', $data['order_id']], - ])->findOrEmpty()->toArray(); - if (empty($order_data)) throw new CommonException('SHOP_ORDER_NOT_FOUND');//订单不存在 - if ($order_data['status'] == OrderDict::CLOSE) throw new CommonException('SHOP_ORDER_IS_CLOSED'); - if ($data['close_type'] == OrderDict::SHOP_CLOSE && !in_array($order_data['status'], [ OrderDict::WAIT_PAY, OrderDict::CLOSE ])) { - throw new CommonException('SHOP_ORDER_IS_PAY_FINISH');//订单已支付 - } - if ($data['close_type'] != OrderDict::REFUND_CLOSE) { - //关闭相关的支付 todo 封装订单专用的关闭支付相关 - try { - (new CorePayService())->closeByTrade(OrderDict::TYPE, $order_data['order_id']); - } catch ( \Exception $e ) { - - } - } - - //关闭订单 - $this->model->where([ - [ - ['order_id', '=', $order_data['order_id']] - ] - ])->update( - [ - 'status' => OrderDict::CLOSE, - 'close_type' => $data['close_type'], - 'close_remark' => $data['close_remark'] ?? '', - 'is_enable_refund' => 0, - 'timeout' => 0 - ] - ); - $data['order_data'] = $order_data; -// //订单关闭后操作 -// event('AfterShopOrderClose', $data); - - //订单关闭操作 - CoreOrderEventService::orderClose($data); - //订单关闭后操作 - CoreOrderEventService::orderCloseAfter($data); - return true; - } catch ( \Exception $e ) { - throw new CommonException($e->getMessage()); - } - } - - /** - * 校验一下是否全部退款 - * @param $data - * @return void - * @throws \think\db\exception\DbException - */ - public function checkAllClose($data) - { - $order_id = $data['order_id']; - //检测一下订单下的订单项是否全部退款完毕 - $where = array( - ['order_id', '=', $order_id], - ['status', '<>', OrderGoodsDict::REFUND_FINISH] - ); - if ((new OrderGoods())->where($where)->count() == 0) { - $data = []; -// $data['main_type'] = OrderLogDict::SYSTEM; -// $data['main_id'] = 0; -// $data['close_type'] = OrderDict::REFUND_CLOSE; -// $data['order_id'] = $order_id; -// $this->close($data); - - //判断订单总额是否全部扣除 - $order = (new Order())->where([['order_id', '=', $order_id]])->findOrEmpty(); - $total_refund_money = (new OrderRefund())->where([['order_id', '=', $order_id], ['status', '=', OrderRefundDict::FINISH]])->sum('money'); - if ($total_refund_money >= $order['order_money']) { - $data['main_type'] = OrderLogDict::SYSTEM; - $data['main_id'] = 0; - $data['close_type'] = OrderDict::REFUND_CLOSE; - $data['order_id'] = $order_id; - $this->close($data); - }else{//订单项全部关闭,但是订单总额为完全退款,订单直接完成 - //调用订单直接完成 - $data['main_type'] = OrderLogDict::SYSTEM; - $data['main_id'] = 0; - $data['order_id'] = $order_id; - (new CoreOrderFinishService())->finish($data); - } - event('AfterShopOrderAllRefundFinish', $data); - } - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/order/CoreOrderConfigService.php b/niucloud/addon/shop/app/service/core/order/CoreOrderConfigService.php deleted file mode 100644 index 7bec9b1e6..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreOrderConfigService.php +++ /dev/null @@ -1,249 +0,0 @@ -core_config_service = new CoreConfigService(); - } - - /** - * 设置交易配置 - * @param array $params - * @return array - */ - public function setConfig($params) - { - $value[ 'order_close' ] = [ - 'is_close' => $params[ 'is_close' ], - 'close_length' => $params[ 'close_length' ] - ]; - $value[ 'order_finish' ] = [ - 'is_finish' => $params[ 'is_finish' ], - 'finish_length' => $params[ 'finish_length' ] - ]; - $value[ 'order_refund' ] = [ - 'no_allow_refund' => $params[ 'no_allow_refund' ], - 'refund_length' => $params[ 'refund_length' ] - ]; - $value[ 'evaluate' ] = [ - 'is_evaluate' => $params[ 'is_evaluate' ], - 'evaluate_is_to_examine' => $params[ 'evaluate_is_to_examine' ], - 'evaluate_is_show' => $params[ 'evaluate_is_show' ] - ]; - $value[ 'form_id' ] = $params[ 'form_id' ]; - - $this->core_config_service->setConfig('SHOP_ORDER_CONFIG', $value); - - $invoice = 'SHOP_INVOICE'; - $invoiceInfo = [ - 'is_invoice' => $params[ 'is_invoice' ], - 'invoice_type' => $params[ 'invoice_type' ], - 'invoice_content' => $params[ 'invoice_content' ] - ]; - $this->core_config_service->setConfig($invoice, $invoiceInfo); - - $evaluate = 'SHOP_GOODS_EVALUATE'; - $evaluateInfo = [ - 'is_evaluate' => $params[ 'is_evaluate' ], - 'evaluate_is_to_examine' => $params[ 'evaluate_is_to_examine' ], - 'evaluate_is_show' => $params[ 'evaluate_is_show' ] - ]; - $this->core_config_service->setConfig($evaluate, $evaluateInfo); - - return true; - } - - /** - * 自动取消订单 - */ - public function orderClose() - { - $data = ( new CoreConfigService() )->getConfigValue('SHOP_ORDER_CONFIG'); - if (empty($data)) { - $closeOrderInfo = [ - 'is_close' => true, - 'close_length' => 120 - ]; - } else { - $closeOrderInfo = [ - 'is_close' => $data[ 'order_close' ][ 'is_close' ], - 'close_length' => $data[ 'order_close' ][ 'close_length' ] - ]; - } - return $closeOrderInfo; - } - - /** - * 获取交易配置 - * @return array - */ - public function getConfig() - { - $data = ( new CoreConfigService() )->getConfigValue('SHOP_ORDER_CONFIG'); - if (empty($data)) { - $data[ 'close_order_info' ] = [ - 'is_close' => true, - 'close_length' => 120 - ]; - $data[ 'confirm' ] = [ - 'is_finish' => true, - 'finish_length' => 14 - ]; - $data[ 'refund' ] = [ - 'no_allow_refund' => 1, - 'refund_length' => 7 - ]; - $data[ 'form_id' ] = ''; - } else { - $data[ 'close_order_info' ] = [ - 'is_close' => $data[ 'order_close' ][ 'is_close' ], - 'close_length' => $data[ 'order_close' ][ 'close_length' ] - ]; - $data[ 'confirm' ] = [ - 'is_finish' => $data[ 'order_finish' ][ 'is_finish' ], - 'finish_length' => $data[ 'order_finish' ][ 'finish_length' ], - ]; - $data[ 'refund' ] = [ - 'no_allow_refund' => $data[ 'order_refund' ][ 'no_allow_refund' ], - 'refund_length' => $data[ 'order_refund' ][ 'refund_length' ], - ]; - $data[ 'form_id' ] = $data[ 'form_id' ] ?? ''; - - if(!empty($data[ 'form_id' ])) { - $diy_form_model = new DiyForm(); - $diy_form_count = $diy_form_model->where([ - [ 'form_id', '=', $data[ 'form_id' ] ] - ])->count(); - if ($diy_form_count == 0) { - $data[ 'form_id' ] = ''; - } - } - } - - //发票 - $data[ 'invoice' ] = ( new CoreConfigService() )->getConfigValue('SHOP_INVOICE'); - if (empty($data[ 'invoice' ])) { - $data[ 'invoice' ] = [ - 'is_invoice' => '2', - 'invoice_type' => [], - 'invoice_content' => [] - ]; - } - //评价 - $data[ 'evaluate' ] = ( new CoreConfigService() )->getConfigValue('SHOP_GOODS_EVALUATE'); - if (empty($data[ 'evaluate' ])) { - $data[ 'evaluate' ] = [ - 'is_evaluate' => 1, - 'evaluate_is_to_examine' => 1, - 'evaluate_is_show' => 1 - ]; - } - return $data; - } - - /** - * 订单确认收货 - */ - public function orderConfirm() - { - $data = ( new CoreConfigService() )->getConfigValue('SHOP_ORDER_CONFIG'); - if (empty($data)) { - $confirmOrderInfo = [ - 'is_finish' => true, - 'finish_length' => 14 - ]; - } else { - $confirmOrderInfo = [ - 'is_finish' => $data[ 'order_finish' ][ 'is_finish' ], - 'finish_length' => $data[ 'order_finish' ][ 'finish_length' ] - ]; - } - return $confirmOrderInfo; - } - - /** - * 售后 - */ - public function orderRefund() - { - $data = ( new CoreConfigService() )->getConfigValue('SHOP_ORDER_CONFIG'); - if (empty($data)) { - $refundOrderInfo = [ - 'no_allow_refund' => 1, - 'refund_length' => 7 - ]; - } else { - $refundOrderInfo = [ - 'no_allow_refund' => $data[ 'order_refund' ][ 'no_allow_refund' ], - 'refund_length' => $data[ 'order_refund' ][ 'refund_length' ] - ]; - } - return $refundOrderInfo; - } - - /** - * 发票信息 - */ - public function invoice() - { - $data = ( new CoreConfigService() )->getConfigValue('SHOP_INVOICE'); - if (empty($data)) { - $invoiceInfo = [ - 'is_invoice' => '', - 'invoice_type' => [], - 'invoice_content' => [] - ]; - } else { - $invoiceInfo = [ - 'is_invoice' => $data[ 'is_invoice' ], - 'invoice_type' => $data[ 'invoice_type' ], - 'invoice_content' => $data[ 'invoice_content' ] - ]; - } - return $invoiceInfo; - } - - /** - * 获取评价设置 - * @return array|int[]|mixed - */ - public function getEvaluateConfig() - { - $config = ( new CoreConfigService() )->getConfigValue('SHOP_GOODS_EVALUATE'); - if (empty($config)) { - $config = [ - 'is_evaluate' => 1, - 'evaluate_is_to_examine' => 1, - 'evaluate_is_show' => 1 - ]; - } - return $config; - } -} - diff --git a/niucloud/addon/shop/app/service/core/order/CoreOrderCreateService.php b/niucloud/addon/shop/app/service/core/order/CoreOrderCreateService.php deleted file mode 100644 index 774d18cab..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreOrderCreateService.php +++ /dev/null @@ -1,442 +0,0 @@ -model = new Order(); - } - - /** - * 订单创建 - * @param array $data - * @return array - */ - public function create(array $data) - { - //参数赋值 - $this->setParam($data); - $member_info = ( new CoreMemberService() )->getInfoByMemberId($data[ 'member_id' ], 'status'); - - if (empty($member_info)) throw new CommonException('SHOP_ORDER_BUYER_NOT_FOUND');//无效的账号 - if ($member_info[ 'status' ] == MemberDict::OFF) throw new CommonException('SHOP_ORDER_BUYER_LOCKED');//账号被锁定 - - $order_key = $this->param[ 'order_key' ] ?? ''; - //获取订单缓存缓存 - $this->getOrderCache($order_key); - - - $this->goods_data = array_merge($this->goods_data, $this->gift_goods); - $this->form_data = $this->param[ 'form_data' ] ?? []; // 万能表单数据 - //校验错误 - $this->checkError(); - //普通订单校验库存 - $this->checkStock($this->goods_data); - $local_delivery_type = $data[ 'delivery' ]['local_delivery_type'] ?? ''; - $delivery_type = $this->delivery[ 'delivery_type' ] ?? ''; - $order_data = [ - //订单整体 - 'order_type' => OrderDict::TYPE, - 'status' => OrderDict::WAIT_PAY, - 'body' => $this->basic[ 'body' ], - 'member_id' => $this->member_id, - 'goods_money' => $this->basic[ 'goods_money' ], - 'delivery_money' => $this->basic[ 'delivery_money' ] ?? 0, - 'discount_money' => $this->basic[ 'discount_money' ] ?? 0, - 'order_money' => $this->basic[ 'order_money' ], - 'has_goods_types' => $this->basic[ 'has_goods_types' ],//包含的商品形式 -// 'invoice_id' => $order_array['invoice_id'] ?? 0, - - //收发货相关 - 'delivery_type' => $delivery_type, - 'taker_name' => $data[ 'delivery' ][ 'taker_name' ] ?? $this->delivery[ 'take_address' ][ 'name' ] ?? '', - 'taker_mobile' => $data[ 'delivery' ][ 'taker_mobile' ] ?? $this->delivery[ 'take_address' ][ 'mobile' ] ?? '', - 'buyer_ask_delivery_time' => ($local_delivery_type == 'now' && $delivery_type == DeliveryDict::LOCAL_DELIVERY) ? "" : $data[ 'delivery' ][ 'buyer_ask_delivery_time' ] ?? '', // 购买者期望的时间 - 'taker_province' => $this->delivery[ 'take_address' ][ 'province_id' ] ?? 0, - 'taker_city' => $this->delivery[ 'take_address' ][ 'city_id' ] ?? 0, - 'taker_district' => $this->delivery[ 'take_address' ][ 'district_id' ] ?? 0, - 'taker_address' => $this->delivery[ 'take_address' ][ 'address' ] ?? '', - 'taker_full_address' => $this->delivery[ 'take_address' ][ 'full_address' ] ?? '', - 'taker_longitude' => $this->delivery[ 'take_address' ][ 'lng' ] ?? '', - 'taker_latitude' => $this->delivery[ 'take_address' ][ 'lat' ] ?? '', - 'take_store_id' => $this->delivery[ 'take_store' ][ 'store_id' ] ?? 0, - - // 附属信息 - 'member_remark' => $this->param[ 'member_remark' ] ?? '',//买家留言 - 'relate_id' => $this->extend_data[ 'relate_id' ] ?? 0,//关联id - 'activity_type' => $this->extend_data[ 'activity_type' ] ?? '', // 活动类型 - - ];//总 - - $order_goods_data = [];//项 - $write_goods_data = array_merge($this->goods_data, $this->impulse_buy_list); - foreach ($write_goods_data as $v) { - $order_goods_data[] = [ - 'member_id' => $data[ 'member_id' ], - 'goods_id' => $v[ 'goods_id' ], - 'sku_id' => $v[ 'sku_id' ], - 'goods_name' => $v[ 'goods' ][ 'goods_name' ], - 'sku_name' => $v[ 'sku_name' ], - 'goods_image' => $v[ 'goods' ][ 'goods_cover' ], - 'sku_image' => $v[ 'sku_image' ], - 'price' => $v[ 'price' ], - 'original_price' => $v[ 'original_price' ] ?? 0, - 'num' => $v[ 'num' ], - 'goods_money' => $v[ 'goods_money' ], - 'goods_type' => $v[ 'goods' ][ 'goods_type' ], - 'order_id' => &$this->order_id, - 'discount_money' => $v[ 'discount_money' ] ?? 0, - 'status' => OrderGoodsDict::NORMAL, - 'extend' => $v[ 'extend' ] ?? '', - 'is_gift' => $v[ 'is_gift' ] ?? 0, - ]; - } - $create_order_data = array( - 'order_data' => $order_data, - 'order_goods_data' => $order_goods_data, - ); - return $this->createOrder($create_order_data); - } - - /** - * 整理 - * @param array $data - * @return void - */ - public function calculate(array $data) - { - //参数赋值 - $this->setParam($data); - $this->order_key = $this->param[ 'order_key' ] ?? ''; - $is_need_recalculate = $data[ 'is_need_recalculate' ] ?? 0; - if (empty($this->order_key) || $is_need_recalculate == 1) { - $this->confirm($this->order_key); - } - //获取订单数据的缓存 - $this->getOrderCache($this->order_key . '_basic'); - //计算优惠和营销 - $this->calculateDiscount(); - $this->setOrderCache($this->order_key); - //计算运费 - $this->calculateDelivery(); - //检测限购 - $this->checkGoodsLimitBuy(); - - //金额格式化 - $discount_money = $this->moneyFormat($this->basic[ 'discount_money' ] ?? 0);//优惠金额 - $delivery_money = $this->moneyFormat($this->basic[ 'delivery_money' ] ?? 0); - $goods_money = $this->moneyFormat($this->basic[ 'goods_money' ] ?? 0); - $order_money = $this->moneyFormat($this->basic[ 'order_money' ] ?? 0); - - $order_money = $this->moneyFormat($this->moneyCalculate($order_money, $delivery_money, $goods_money, -$discount_money)); - $this->basic[ 'discount_money' ] = $discount_money; - $this->basic[ 'delivery_money' ] = $delivery_money; - $this->basic[ 'goods_money' ] = $goods_money; - //todo 校验控制,不能小于0 - $order_money = $order_money < 0 ? 0 : $order_money; - $this->basic[ 'order_money' ] = $order_money; -// $this->basic['pay_money'] = $this->basic['pay_money'] ?? $order_money; - //订单创建数据写入缓存,并将标识返回给前端 - $order_cache = get_object_vars($this); - unset($order_cache[ 'param' ]); - $this->setOrderCache($this->order_key, $order_cache); - return $order_cache; - } - - /** - * 订单确认(基础信息查询并缓存) - * @return array|mixed - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function confirm($order_key = '') - { - //查看会员信息 - $member_id = $this->param[ 'member_id' ]; - $this->member_id = $member_id; - $member_info = ( new CoreMemberService() )->getInfoByMemberId($member_id, 'nickname, headimg, balance, point, member_level,member_label'); - if (empty($member_info)) throw new CommonException('SHOP_ORDER_BUYER_NOT_FOUND');//无效的账号 - - // 查询会员等级信息 - $member_info['member_level_id'] = $member_info[ 'member_level' ]; - $member_info[ 'member_level' ] = ( new MemberLevel() )->where([ [ 'level_id', '=', $member_info[ 'member_level' ] ] ])->field('level_id,level_benefits')->findOrEmpty()->toArray(); - - //会员账户信息 - $this->buyer = $member_info; - - $order_config = ( new CoreOrderConfigService() )->getConfig() ?? []; - $this->form_id = $order_config[ 'form_id' ]; - - //查询商品信息 - $this->getGoodsData(); - ///$this->createGoodsData(); - //配送相关信息 - $this->getDelivery(); - - $order_cache = get_object_vars($this); - unset($order_cache[ 'param' ]); - unset($order_cache[ 'order_key' ]); - if (empty($order_key)) { - $order_key = $this->setOrderCache('', $order_cache); - } - //将基础订单数据单独存放一个缓存 - $order_basic_key = $order_key . '_basic'; - $this->setOrderCache($order_basic_key, $order_cache); - - $this->order_key = $order_key; - return true; - } - - - /** - * 商品相关数据 - * @return array - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function getGoodsData() - { - $cart_ids = $this->param[ 'cart_ids' ] ?? []; - $this->extend_data = $this->param[ 'extend_data' ] ?? []; //活动扩展数据:[ 'relate_id' => 1, 'activity_type' => 'giftcard' ] - if (!empty($cart_ids)) { - $this->cart_ids = $cart_ids; - //查询购物车 - $cart = ( new Cart() )->where([ [ 'id', 'in', $cart_ids ] ])->field('goods_id, sku_id, num')->select(); - if ($cart->isEmpty()) throw new CommonException('SHOP_ORDER_CARTS_EXPIRE');//无效的数据 - if ($cart->count() != count($cart_ids)) throw new CommonException('SHOP_ORDER_CARTS_EXPIRE');//无效的商品 - $sku_data = $cart->toArray(); - } else { - $sku_data = $this->param[ 'sku_data' ] ?? []; - if (empty($sku_data)) throw new CommonException('SHOP_ORDER_CARTS_EXPIRE');//无效的数据 - } - $sku_ids = array_column($sku_data, 'sku_id'); - $sku_condition = array( - [ 'sku_id', 'in', $sku_ids ] - ); - $sku_list = ( new GoodsSku() )->where($sku_condition)->with([ 'goods' ])->field('sku_id, sku_name, sku_image, goods_id, price, stock, weight, volume,sku_id, sku_spec_format,member_price, sale_price')->select()->toArray(); - foreach ($sku_list as &$value){ - if (empty($value['sku_image']) && isset($value['goods']['goods_cover'])){ - $value['sku_image'] = $value['goods']['goods_cover']; - } - } - $sku_list = array_column($sku_list, null, 'sku_id'); - //商品数据 查询商品列表 - $order_data = []; - $goods_list = []; - $order_money = $goods_money = $delivery_money = 0; - $total_num = 0; - $body = ''; - //订单中包含的商品形式 - $has_goods_types = []; - $activity_type = $this->extend_data[ 'activity_type' ] ?? ''; - foreach ($sku_data as $v) { - $sku_id = $v[ 'sku_id' ]; - $num = $v[ 'num' ]; - $total_num += $num; - $market_type = $v[ 'market_type' ] ?? ''; - $market_type_id = $v[ 'market_type_id' ] ?? 0; - $sku_info = $sku_list[ $sku_id ] ?? []; - if (empty($sku_info)) throw new CommonException('SHOP_ORDER_CARTS_EXPIRE');//无效的商品 - $sku_info[ 'member_discount' ] = $sku_info[ 'goods' ][ 'member_discount' ] ?? ''; - - //商品原价 - $sku_info[ 'original_price' ] = $sku_info[ 'price' ]; - //获取活动价格 - //todo 需仔细看看 - $sku_info[ 'show_type' ] = 'original_price'; - $sku_info[ 'active_id' ] = ''; - $goods_active_price_service = (new CoreGoodsActivePriceService()); - $show_price_data = $goods_active_price_service->getActivePrice($sku_info, $this->member_id); - $sku_info[ 'show_type' ] = $show_price_data[ 'show_type' ]; - $sku_info[ 'price' ] = $show_price_data[ 'show_price' ]; - $sku_info[ 'active_id' ] = $show_price_data[ 'discount_id' ] ?? ''; - $sku_info[ 'member_price' ] = $this->getMemberPrice($sku_info); - - - - //默认金额填充 - $sku_info[ 'discount_money' ] = 0; - $item_goods_type = $sku_info[ 'goods' ][ 'goods_type' ]; - - // 商品限购处理 - if (isset($this->limit_buy[ 'goods_' . $sku_info[ 'goods_id' ] ])) { - $this->limit_buy[ 'goods_' . $sku_info[ 'goods_id' ] ][ 'num' ] += $num; - } else { - $this->limit_buy[ 'goods_' . $sku_info[ 'goods_id' ] ] = [ - 'goods_id' => $sku_info[ 'goods_id' ], - 'goods_name' => $sku_info[ 'goods' ][ 'goods_name' ], - 'stock' => $sku_info[ 'goods' ][ 'stock' ], - 'num' => $num, - 'is_limit' => $sku_info[ 'goods' ][ 'is_limit' ], - 'limit_type' => $sku_info[ 'goods' ][ 'limit_type' ], - 'max_buy' => $sku_info[ 'goods' ][ 'max_buy' ], - 'min_buy' => $sku_info[ 'goods' ][ 'min_buy' ] - ]; - } - - if (!in_array($item_goods_type, $has_goods_types)) $has_goods_types[] = $item_goods_type; - - $sku_info[ 'num' ] = $num; - $sku_info[ 'market_type' ] = $market_type;//活动类型 - $sku_info[ 'market_type_id' ] = $market_type_id;//活动id - - // 计算商品小计 - $price = $sku_info[ 'price' ]; - $sku_info[ 'goods_money' ] = $price * $num; - - /****顺手买商品不参与任何其他活动 进行单独计算****/ - if (!isset($v[ 'impulse_buy_goods_id' ])) { - // 活动操纵数据 market_data 活动信息 - $temp = []; - // 过滤活动计算结果,去除空元素 - $temp_list = array_filter(event('ShopGoodsMarketCalculate', [ - 'sku_info' => $sku_info, - 'sku_data' => $sku_data, - 'order_obj' => $this - ])); - - // 获取最后一个非空的活动计算结果 - if (!empty($temp_list)) { - $temp = end($temp_list); - } - - if (!empty($temp)) { - // 更新 SKU 信息 - $sku_info = $temp[ 'sku_info' ]; - //todo 需仔细看看 - $sku_info['relate_id'] = $temp[ 'relate_id' ]; - //todo 需仔细看看 - if (!empty($this->extend_data)) { - // 更新扩展数据中的关联 ID 和活动类型 - $this->extend_data[ 'relate_id' ] = $temp[ 'relate_id' ] ?? 0; - $this->extend_data[ 'activity_type' ] = $temp[ 'activity_type' ] ?? ''; - } - if (isset($temp['error']) && !empty($temp['error'])) { - if(is_array($temp['error'])){ - foreach ($temp['error'] as $error){ - $this->setError($error); - } - }else{ - $this->setError($temp['error']); - } - - } - } - } - - $goods_money += $sku_info[ 'goods_money' ]; - $body = $body ? $body . ( $sku_info[ 'sku_name' ] . $sku_info[ 'goods' ][ 'goods_name' ] ) : ( $sku_info[ 'sku_name' ] . $sku_info[ 'goods' ][ 'goods_name' ] ); - $goods_list[ $sku_id ] = $sku_info; - } - - /*****顺手买开始*****/ - $impulse_buy_goods = $this->param[ 'impulse_buy_goods' ] ?? []; - $impulse_buy_list = []; - if (!empty($impulse_buy_goods)) { - $temp_list = array_filter(event('ShopImpulseBuyGoodsMarketCalculate', [ - 'data' => $impulse_buy_goods, - 'member_id' => $this->member_id, - 'goods_money' => $goods_money, - 'order_obj' => $this - ]))[ 0 ] ?? []; - if (!empty($temp_list)) { - $impulse_buy_list = $temp_list[ 'impulse_buy_data' ]; - $goods_money = $temp_list[ 'goods_money' ]; - $order_money = $temp_list[ 'order_money' ]; - $this->basic[ 'order_money' ] += $order_money; - } - } - /*****顺手买结束*****/ - - $this->basic[ 'has_goods_types' ] = $has_goods_types; - $this->basic[ 'total_num' ] = $total_num; - $this->goods_data = $goods_list; - $this->impulse_buy_list = $impulse_buy_list; - $this->basic[ 'goods_money' ] = $goods_money; - $this->basic[ 'body' ] = $body; - return $order_data; - } - - /** - * 获取商品的会员价 - * @param $sku_info - * @return string - */ - public function getMemberPrice($sku_info) - { - if (empty($sku_info[ 'goods' ][ 'member_discount' ])) { - return $sku_info[ 'price' ]; - } - - // 没有会员等级,排除 - if (empty($this->buyer[ 'member_level' ])) { - return $sku_info[ 'price' ]; - } - - $price = $sku_info[ 'price' ]; - - if ($sku_info[ 'goods' ][ 'member_discount' ] == 'discount') { - // 按照会员等级折扣计算 - - // 默认按会员享受折扣计算 - if (isset($this->buyer[ 'member_level' ][ 'level_benefits' ]) - && isset($this->buyer[ 'member_level' ][ 'level_benefits' ][ 'discount' ]) - && $this->buyer[ 'member_level' ][ 'level_benefits' ][ 'discount' ][ 'is_use' ]) { - - $price = number_format($price * $this->buyer[ 'member_level' ][ 'level_benefits' ][ 'discount' ][ 'discount' ] / 10, 2, '.', ''); - } - - } elseif ($sku_info[ 'goods' ][ 'member_discount' ] == 'fixed_price') { - // 指定会员价 - if (!empty($sku_info[ 'member_price' ])) { - $sku_info[ 'member_price' ] = json_decode($sku_info[ 'member_price' ], true); - if (!empty($sku_info[ 'member_price' ][ 'level_' . $this->buyer[ 'member_level' ][ 'level_id' ] ])) { - $member_level_price = $sku_info[ 'member_price' ][ 'level_' . $this->buyer[ 'member_level' ][ 'level_id' ] ]; - $price = number_format($member_level_price, 2, '.', ''); - } - } - } - - return $price; - } - -} diff --git a/niucloud/addon/shop/app/service/core/order/CoreOrderCreateTrait.php b/niucloud/addon/shop/app/service/core/order/CoreOrderCreateTrait.php deleted file mode 100644 index 21090d161..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreOrderCreateTrait.php +++ /dev/null @@ -1,1040 +0,0 @@ - 0,//优惠金额 - 'coupon_money' => 0,//优惠券金额 - 'delivery_money' => 0, - 'goods_money' => 0, - 'order_money' => 0 - ];//基本数据处理(整体的数据) - public $goods_data = [];//商品数据处理 - public $impulse_buy_list = [];//顺买商品数据处理 - public $extend_data = [];//活动数据 - public $form_data = [];// 万能表单数据 - public $config = [];//配置集合 - public $discount = [];//优惠整合 - public $gift = [];//赠品集合 - public $gift_goods = [];//赠品商品 - public $limit_buy = [];//限购 - - public $delivery = [];//配送相关 - - public $order_id; - - public $invoice = []; - - public $order_key; - public $error = []; - public $join_manjian = true; - - public function createOrder(array $data) - { - $order_data = $data[ 'order_data' ]; - $order_goods_data = $data[ 'order_goods_data' ]; - $order_no = create_no(); - $order_data[ 'order_no' ] = $order_no; - $order_data[ 'order_from' ] = $this->param[ 'order_from' ];//来源渠道 - $order_data[ 'ip' ] = request()->ip(); - $main_type = $data[ 'main_type' ] ?? OrderLogDict::MEMBER; - $main_id = $data[ 'main_id' ] ?? $order_data[ 'member_id' ]; - - // 校验整理发票 - $this->invoice(); - Db::startTrans(); - try { - $order = ( new Order() )->create($order_data); - $this->order_id = $order[ 'order_id' ]; - // 添加订单项目表 - $order_goods_model = new OrderGoods(); - $order_goods_data = array_map(function($value) { - $value[ 'order_goods_money' ] = $this->calculateOrderGoodsMoney($value); - return $value; - }, $order_goods_data); - $order_goods_model->insertAll($order_goods_data); - - // 优惠项 - $this->useDiscount(); - - // 添加万能表单 - $this->addFormData($this->order_id); - - //处理限时折扣 - $this->useDiscountActive(); - - $order_data[ 'order_id' ] = $this->order_id; - - // 订单创建后事件 - CoreOrderEventService::orderCreate([ 'order_id' => $this->order_id, 'order_data' => $order_data, 'order_goods_data' => $order_goods_data, 'cart_ids' => $this->cart_ids, 'basic' => get_object_vars($this), 'main_type' => $main_type, 'main_id' => $main_id, 'time' => time() ]); - - Db::commit(); - - // 删除订单缓存 - $this->delOrderCache($this->order_key); - - // 订单创建后事件 - CoreOrderEventService::orderCreateAfter([ 'order_id' => $this->order_id, 'order_data' => $order_data, 'order_goods_data' => $order_goods_data, 'cart_ids' => $this->cart_ids, 'basic' => get_object_vars($this), 'main_type' => $main_type, 'main_id' => $main_id, 'time' => time() ]); -// event('AfterShopOrderCreate', ['order_id' => $this->order_id, 'order_data' => $order_data, 'order_goods_data' => $order_goods_data, 'cart_ids' => $this->cart_ids, 'basic' => get_object_vars($this), 'main_type' => $main_type, 'main_id' => $main_id, 'time' => time()]); - - // 订单金额为0的话,要直接支付 - if ($order_data[ 'order_money' ] == 0) { - ( new CoreOrderPayService() )->pay([ 'trade_id' => $this->order_id, 'main_type' => $main_type, 'main_id' => $main_id ]); - } - - return [ - 'trade_type' => $order_data[ 'order_type' ], - 'order_id' => $this->order_id - ]; - - } catch (Exception $e) { - Db::rollback(); - throw new CommonException($e->getMessage()); - } - } - - /** - * 校验库存 - * @param $order_goods_data - * @return void - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function checkStock($order_goods_data) - { - $sku_list = ( new GoodsSku() )->field('sku_id,goods_id,sku_name,stock')->where([ [ 'sku_id', 'in', array_column($order_goods_data, 'sku_id') ] ]) - ->with([ - 'goods' => function($query) { - $query->field('goods_id,goods_name'); - } - ])->select()->toArray(); - - // todo 赠品库存校验 - $sku_num = []; - foreach ($order_goods_data as $v) { - if (isset($sku_num[ 'num_' . $v[ 'sku_id' ] ])) { - $sku_num[ 'num_' . $v[ 'sku_id' ] ] += $v[ 'num' ]; - } else { - $sku_num[ 'num_' . $v[ 'sku_id' ] ] = $v[ 'num' ]; - } - } - - foreach ($sku_list as $v) { - $goods_name = count($sku_list) > 1 ? '“' . $v[ 'goods' ][ 'goods_name' ] . $v[ 'sku_name' ] . '”' : ''; - if ($v[ 'stock' ] < $sku_num[ 'num_' . $v[ 'sku_id' ] ]) throw new CommonException('商品' . $goods_name . '库存不足'); - } - } - - /** - * 发票整理 - * @return void - */ - public function invoice() - { - if ($this->config('invoice')) { - if (!empty($this->param[ 'invoice' ])) { -// $invoive_type = $this->param['invoice']['type'] ?? ''; - $this->invoice[ 'type' ] = $this->param[ 'invoice' ][ 'type' ] ?? ''; - $this->invoice[ 'name' ] = $this->param[ 'invoice' ][ 'name' ] ?? ''; - $this->invoice[ 'header_type' ] = $this->param[ 'invoice' ][ 'header_type' ] ?? ''; - $this->invoice[ 'header_name' ] = $this->param[ 'invoice' ][ 'header_name' ] ?? ''; - $this->invoice[ 'tax_number' ] = $this->param[ 'invoice' ][ 'tax_number' ] ?? ''; - $this->invoice[ 'mobile' ] = $this->param[ 'invoice' ][ 'mobile' ] ?? ''; - $this->invoice[ 'email' ] = $this->param[ 'invoice' ][ 'email' ] ?? ''; - $this->invoice[ 'telephone' ] = $this->param[ 'invoice' ][ 'telephone' ] ?? ''; - $this->invoice[ 'address' ] = $this->param[ 'invoice' ][ 'address' ] ?? ''; - $this->invoice[ 'bank_name' ] = $this->param[ 'invoice' ][ 'bank_name' ] ?? ''; - $this->invoice[ 'bank_card_number' ] = $this->param[ 'invoice' ][ 'bank_card_number' ] ?? ''; -// $this->invoice['money'] = $this->param['invoice']['money'] ?? ''; - } - } - - } - - /** - * 配置设置或查询 - * @param $key - * @return array|mixed - */ - public function config($key) - { - //查询购物配置 - $config = $this->config[ $key ] ?? []; - if (empty($this->config[ $key ])) { - switch ($key) { - case 'order'://交易配置 - $config = ( new CoreOrderConfigService() )->orderClose() ?? []; - break; - case 'point'://交易配置 - break; - case 'delivery_type': - $config = ( new CoreDeliveryService() )->getDeliveryConfig(); - break; - case 'invoice': - $config = ( new CoreOrderConfigService() )->invoice() ?? []; - break; - case 'local_delivery': - $config = (new CoreConfigService())->getLocalDeliveryConfig() ?? []; - } - $this->config[ $key ] = $config; - } - return $config; - } - - /** - * 计算订单项金额 - * @param $goods - * @return mixed - */ - public function calculateOrderGoodsMoney($goods) - { - $goods_money = $goods[ 'goods_money' ]; - $discount_money = $goods[ 'discount_money' ] ?? 0; - return $goods_money - $discount_money; - } - - /** - * 优惠写入 - * @return void - */ - public function useDiscount() - { - $insert_discount_data = []; - $discount_service = new CoreOrderDiscountService(); - if ($this->discount) { - foreach ($this->discount as $k => $v) { - $result = array_values(array_filter(event('ShopOrderDiscountCreate', [ 'data' => $v, 'order_object' => $this ]))); - if (empty($result)) { - switch ($k) { - case 'coupon': - //使用优惠券 - ( new CoreCouponMemberService() )->use([ -// 'member_id' => $this->member_id, - 'id' => $v[ 'discount_type_id' ], - 'trade_id' => $this->order_id - ]); - break; - } - } - if (isset($v[ 'discount_type' ])) { - $insert_discount_data[] = [ - 'type' => $v[ 'type' ], - 'num' => $v[ 'num' ], - 'money' => $v[ 'money' ], - 'discount_type' => $v[ 'discount_type' ], - 'discount_type_id' => $v[ 'discount_type_id' ], - 'content' => $v[ 'content' ] ?? $v[ 'title' ] ?? "", - 'order_id' => $this->order_id, - ]; - } else { - foreach ($v as $vv) { - if (isset($vv[ 'type' ])){ - $insert_discount_data[] = [ - 'type' => $vv[ 'type' ], - 'num' => $vv[ 'num' ], - 'money' => $vv[ 'money' ], - 'discount_type' => $vv[ 'discount_type' ], - 'discount_type_id' => $vv[ 'discount_type_id' ], - 'content' => $vv[ 'content' ] ?? $vv[ 'title' ] ?? "", - 'order_id' => $this->order_id, - ]; - }elsE{ - foreach ($vv as $vvv) { - $insert_discount_data[] = [ - 'type' => $vvv[ 'type' ], - 'num' => $vvv[ 'num' ], - 'money' => $vvv[ 'money' ], - 'discount_type' => $vvv[ 'discount_type' ], - 'discount_type_id' => $vvv[ 'discount_type_id' ], - 'content' => $vvv[ 'content' ] ?? $vvv[ 'title' ] ?? "", - 'order_id' => $this->order_id, - ]; - } - } - - } - } - - } - - $discount_service->addAll($insert_discount_data); - } - return true; - } - - - /** - * 获取参数 - * @param $key - * @param $default - * @return mixed|string - */ - public function param($key, $default = '') - { - return $this->param[ $key ] ?? $default; - } - - /** - * 订单优惠 - * @return void - */ - public function getDiscount() - { - //查询积分优惠 -// $this->getPoint(); - //查询可用优惠券 -// $this->getCoupon(); - } - - /** - * 获取有效的优惠券 - * @param $data - */ - public function getCoupon($data) - { - //参数赋值 - $this->setParam($data); - $order_key = $this->param[ 'order_key' ] ?? ''; - //获取订单数据的缓存 - $this->getOrderCache($order_key); - - $coupon_list = ( new CoreCouponMemberService() )->getUseCouponListByMemberId($this->member_id); - //如果有优惠券 - if (!empty($coupon_list)) { - foreach ($coupon_list as &$v) { - $type = (int) $v[ 'type' ]; - $goods_data = $v[ 'goods' ]; - $min_condition_money = $v[ 'min_condition_money' ]; - switch ($type) { - case CouponDict::ALL: - $v[ 'is_normal' ] = true; - //匹配的商品 - $match_goods_list = $this->goods_data; - $match_goods_money = $this->basic[ 'goods_money' ]; - break; - case CouponDict::CATEGORY: - $category_ids = array_column($goods_data, 'category_id'); - //匹配的商品 - $match_goods_list = []; - $match_goods_money = 0; - foreach ($this->goods_data as $goods_v) { - $item_goods_category = $goods_v[ 'goods' ][ 'goods_category' ];//商品分类数组 - if (!empty(array_intersect($category_ids, $item_goods_category))) { - $match_goods_list[] = $goods_v; - $match_goods_money += $goods_v[ 'goods_money' ]; - } - } - break; - case CouponDict::GOODS: - $goods_ids = array_column($goods_data, 'goods_id'); - //匹配的商品 - $match_goods_list = []; - $match_goods_money = 0; - foreach ($this->goods_data as $goods_v) { - if (in_array($goods_v[ 'goods_id' ], $goods_ids)) { - $match_goods_list[] = $goods_v; - $match_goods_money += $goods_v[ 'goods_money' ]; - } - } - break; - } - - if (empty($match_goods_list)) { - $v[ 'is_normal' ] = false; - $v[ 'error' ] = get_lang('SHOP_ORDER_COUPON_SUPPORT_GOODS');//没有支持可用的商品 - } else { - if ($match_goods_money < $min_condition_money) { - $v[ 'is_normal' ] = false; - $v[ 'error' ] = get_lang('SHOP_ORDER_COUPON_NOT_CONDITION');//没有达到商品最低使用条件 - } else { - $v[ 'is_normal' ] = true; - } - } - } - } - return $coupon_list; - } - - /** - * 给传参 - * @param $param - * @return true - */ - public function setParam($param) - { - $this->param = $param; - $this->extend_data = $this->param[ 'extend_data' ] ?? []; - return true; - } - - - /** - * 计算优惠 - * @return void - */ - public function calculateDiscount() - { - //查询积分优惠 -// $this->getPoint(); - //满减送优惠计算 - if($this->join_manjian){ - $this->calculateManjian(); - } - //查询可用优惠券 - $this->calculateCoupon(); - } - - /** - * 优惠券计算 - * @return void - */ - public function calculateCoupon() - { - $coupon_id = $this->param[ 'discount' ][ 'coupon_id' ] ?? 0;//使用优惠券id - - if ($coupon_id > 0) { - $coupon_data = ( new CoreCouponMemberService() )->getUseCouponById($coupon_id); - if (empty($coupon_data)) throw new CommonException('SHOP_ORDER_COUPON_EXPIRE_OR_NOT_FOUND');//优惠券已使用或不存在 - - $time = time(); - if ($time > strtotime($coupon_data[ 'expire_time' ])) { - throw new CommonException('SHOP_ORDER_COUPON_EXPIRE');//优惠券已使用或不存在 - } - $type = (int) $coupon_data[ 'type' ]; - $goods_data = $coupon_data[ 'goods' ]; - $min_condition_money = $coupon_data[ 'min_condition_money' ]; - $match_order_goods_money = 0; - switch ($type) { - case CouponDict::ALL: - //匹配的商品 - $match_goods_list = $this->goods_data; - $match_goods_money = $this->basic[ 'goods_money' ]; - $match_order_goods_money = $this->basic[ 'goods_money' ] - $this->basic[ 'discount_money' ]; - break; - case CouponDict::CATEGORY: - $category_ids = array_column($goods_data, 'category_id'); - //匹配的商品 - $match_goods_list = []; - $match_goods_money = 0; - foreach ($this->goods_data as $goods_v) { - $item_goods_category = $goods_v[ 'goods' ][ 'goods_category' ];//商品分类数组 - if (!empty(array_intersect($category_ids, $item_goods_category))) { - $match_goods_list[] = $goods_v; - $match_goods_money += $goods_v[ 'goods_money' ]; - $match_order_goods_money += $this->calculateOrderGoodsMoney($goods_v); - } - } - break; - case CouponDict::GOODS: - $goods_ids = array_column($goods_data, 'goods_id'); - //匹配的商品 - $match_goods_list = []; - $match_goods_money = 0; - foreach ($this->goods_data as $goods_v) { - if (in_array($goods_v[ 'goods_id' ], $goods_ids)) { - $match_goods_list[] = $goods_v; - $match_goods_money += $goods_v[ 'goods_money' ]; - $match_order_goods_money += $this->calculateOrderGoodsMoney($goods_v); - } - } - - break; - } - if (empty($match_goods_list)) { - $this->setError(get_lang('SHOP_ORDER_COUPON_NOT_SUPPORT_GOODS'));//没有支持可用的商品 - } else { - if ($match_goods_money < $min_condition_money) { - $this->setError(get_lang('SHOP_ORDER_COUPON_NOT_SUPPORT_MIN_MONEY'));//没有达到商品最低使用条件 - } else { - $coupon_money = $coupon_data[ 'price' ]; - if ($coupon_money > $match_order_goods_money) { - $coupon_money = $match_order_goods_money; - } - $surplus_money = $coupon_money; - $match_goods_list = array_values($match_goods_list); - $match_goods_list = array_filter($match_goods_list, function($item) { - return ( $item[ 'goods_money' ] - $item[ 'discount_money' ] ) != 0; - }); - $match_count = count($match_goods_list); - //根据商品金额计算个订单项享受的优惠 - foreach ($match_goods_list as $k => $v) { - $item_order_goods_money = $this->calculateOrderGoodsMoney($v); - $item_sku_id = $v[ 'sku_id' ]; - if ($k == ( $match_count - 1 )) { - $item_coupon_money = $surplus_money; - } else { - if ($match_order_goods_money == 0 || $coupon_money == 0) { - $item_coupon_money = 0; - } else { - $item_coupon_money = $this->moneyFormat($item_order_goods_money / $match_order_goods_money * $coupon_money); - if ($item_coupon_money == 0) { - $item_coupon_money = $item_order_goods_money; - } - if ($item_coupon_money > $surplus_money) { - $item_coupon_money = $surplus_money; - } - } - } - - $this->goods_data[ $item_sku_id ][ 'discount_money' ] += $item_coupon_money; -// $this->goods_data[$item_sku_id]['order_goods_money'] = $this->calculateOrderGoodsMoney($this->goods_data[$item_sku_id]); - - $surplus_money = bcsub($surplus_money, $item_coupon_money, 2); - } - //优惠累增 - $this->basic[ 'discount_money' ] += $coupon_money; - $this->basic[ 'coupon_money' ] += $coupon_money; -// $discount_money = $this->basic['discount']['discount_money']; - $this->discount[ 'coupon' ] = $this->discountFormat( - array_column($match_goods_list, 'sku_id'), - OrderDiscountDict::DISCOUNT, - 1, - $coupon_money, - 'coupon', - $coupon_id, - '', - $coupon_data[ 'title' ] - ); - } - } - - } - - } - - /** - * 优惠项格式 - * @param $match_goods_ids - * @param $type - * @param $num - * @param $money - * @param $discount_type - * @param $discount_type_id - * @param $content - * @return array - */ - public function discountFormat($match_goods_ids, $type, $num, $money, $discount_type, $discount_type_id, $content, $title = '') - { - return [ - 'match_goods_ids' => $match_goods_ids, - 'type' => $type, - 'num' => $num, - 'money' => $money, - 'discount_type' => $discount_type, - 'discount_type_id' => $discount_type_id, - 'content' => $content, - 'title' => $title - ]; - } - - /** - * 获取积分 - * @return true - */ - public function getPoint() - { - - $is_point = $this->param[ 'discount' ][ 'is_point' ] ?? 0;//是否使用积分 - if ($is_point) { - //todo 现在认为积分只能抵扣商品总额(单个商品不设置支持积分) - $goods_money = $this->basic[ 'goods_money' ]; - $member_point = $this->buyer[ 'point' ];//会员积分 - $point_config = $this->config('config'); - if ($point_config[ 'status' ]) {//启用 - $point_money = $member_point * $point_config[ 'rate' ]; - $point_money = $point_money > $goods_money ? $goods_money : $point_money; - $point = round($point_money / $point_config[ 'rate' ]);//todo 积分是否可以为小数 - - $this->discount[ 'point' ][ 'point' ] = $point; - $this->discount[ 'point' ][ 'point_money' ] = $point_money; - } - } - - return true; - } - - public function usePoint($data) - { - $member_account = $data[ 'member_account' ]; - } - - /** - * 计算积分 - * @return void - */ - public function calculatePoint() - { - } - - /** - * 使用优惠券 - * @param $data - * @return void - */ - public function useCoupon($data) - { - - } - - /** - * 查询订单支持的配送方式 - * @return void - */ - public function getDelivery() - { - //先判断商品项中是否存在实物商品 - $has_goods_types = $this->basic[ 'has_goods_types' ]; - //存在实物商品查询物流信息 - if (in_array(GoodsDict::REAL, $has_goods_types)) { - //todo 查询启用的配送方式 - $delivery_type_list = $this->config('delivery_type'); - foreach ($delivery_type_list as $k => $v) { - if ($v[ 'status' ] != 1) { - unset($delivery_type_list[ $k ]); - } - } -// $delivery_type_list = array_column($delivery_type_list, null, 'key'); - $this->delivery[ 'delivery_type_list' ] = $delivery_type_list; - } - $this->config('local_delivery'); - return true; - } - - /** - * 获取和计算配送信息和费用 - * @return void - */ - public function calculateDelivery() - { - //配送参数 - $delivery = $this->param[ 'delivery' ] ?? []; - $delivery_type = $delivery[ 'delivery_type' ] ?? '';//配送方式 - $has_goods_types = $this->basic[ 'has_goods_types' ]; - //存在实物商品查询物流信息 - if (in_array(GoodsDict::REAL, $has_goods_types)) { - $delivery_type_list = $this->delivery[ 'delivery_type_list' ]; - if (empty($delivery_type_list)) $this->setError('NOT_CONFIGURED_DELIVERY_TYPE');//商家尚未配置配送方式 - if ($delivery_type) { - //校验是否合法 - if (empty($delivery_type_list[ $delivery_type ])) throw new CommonException('SHOP_ORDER_PLEASE_SELECT_DELIVERY_TYPE');//配送方式非法 - } else { - //没有选择配送方式的话,默认选中第一个配送方式 - $default_delivery = reset($delivery_type_list); - $delivery_type = $default_delivery ? $default_delivery[ 'key' ] : ''; - } - } else { - //如果订单中只有虚拟商品 - if (in_array(GoodsDict::VIRTUAL, $has_goods_types)) { - $delivery_type = OrderDeliveryDict::VIRTUAL; - } - } - if (!$delivery_type) { - $this->setError('SHOP_ORDER_PLEASE_SELECT_DELIVERY_TYPE');//没有选中配送方式.... - } else { - $this->delivery[ 'delivery_type' ] = $delivery_type; - - //选中收货地址 - $this->selectTakeAddress(); - //选择配送/自提门店 - $this->selectTakeStore($delivery_type); - switch ($delivery_type) { - case OrderDeliveryDict::EXPRESS://物流 - CoreExpressService::calculate($this); - break; - case OrderDeliveryDict::LOCAL_DELIVERY://同城配送 - CoreLocalDeliveryService::calculate($this); - break; - case OrderDeliveryDict::STORE://门店自提 - CoreStoreService::calculate($this); - break; - } - - if (!empty($this->extend_data) && isset($this->extend_data[ 'delivery_money' ])) { - $this->basic[ 'delivery_money' ] = $this->extend_data[ 'delivery_money' ]; - } else { - $this->basic[ 'delivery_money' ] = round($this->basic[ 'delivery_money' ] ?? 0, 2); - } - - } - - return true; - } - - /** - * 选中收货地址 - * @return void - */ - public function selectTakeAddress() - { - //定义收货地址 - $has_goods_types = $this->basic[ 'has_goods_types' ]; - if (in_array(GoodsDict::REAL, $has_goods_types)) { - if ($this->delivery[ 'delivery_type' ] == OrderDeliveryDict::STORE) { - if (!empty($this->param[ 'delivery' ][ 'take_store_id' ])) { - $this->delivery[ 'take_store' ] = ( new CoreStoreService() )->getInfoById($this->param[ 'delivery' ][ 'take_store_id' ]); - } - } else { - //查询默认收货地址 - if (!empty($this->param[ 'delivery' ][ 'take_address_id' ])) { - $this->delivery[ 'take_address' ] = ( new CoreMemberAddressService() )->getMemberAddressById($this->param[ 'delivery' ][ 'take_address_id' ], $this->member_id); - } else { - $take_address = ( new CoreMemberAddressService() )->getDefaultAddressByMemberId($this->member_id); - if ($this->delivery[ 'delivery_type' ] == OrderDeliveryDict::LOCAL_DELIVERY && empty($take_address[ 'lng' ])) { - $take_address = ( new CoreMemberAddressService() )->getLngLatAddressByMemberId($this->member_id); - } - $this->delivery[ 'take_address' ] = $take_address; - } - - if ($this->delivery[ 'delivery_type' ] == OrderDeliveryDict::LOCAL_DELIVERY && !empty($this->delivery[ 'take_address' ]) && empty($this->delivery[ 'take_address' ][ 'lng' ])) { - $this->setError('SHOP_ORDER_PLEASE_SELECT_DELIVERY_EMPTY_LNG_LAT');//选中的配送方式没有设置经纬度.... - } - } - - } - return true; - } - - /** - * 选中配送/自提门店 - * @param $delivery_type - * @return true - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function selectTakeStore($delivery_type) - { - $delivery = $this->param[ 'delivery' ] ?? []; - $position = $this->param[ 'position' ] ?? []; - $this->delivery['take_store'] = []; - if (in_array($delivery_type, [DeliveryDict::LOCAL_DELIVERY, DeliveryDict::STORE])) { - $store_list = (new Store())->where([['status', '=', 1]])->withSearch(['pick_up_type'], ['pick_up_type' => $delivery_type])->select()->toArray(); - if (empty($store_list)) { - if ($delivery_type == DeliveryDict::LOCAL_DELIVERY) { - $this->delivery['error'] = empty($this->delivery['error']) ? get_lang('SHOP_NOT_SET_LOCAL_DELIVERY_STORE') : $this->delivery['error']; - } else { - $this->delivery['error'] = empty($this->delivery['error']) ? get_lang('SHOP_NOT_SET_PICK_UP_STORE') : $this->delivery['error']; - } - } - if (!empty($store_list) && !empty($position) && !empty($position[ 'latitude' ]) && !empty($position[ 'longitude' ])) { - $location = new Coordinate($position[ 'latitude' ], $position[ 'longitude' ]); - $store_list = array_map(function($item) use ($location) { - $distance = ( new Vincenty() )->getDistance($location, new Coordinate((float) $item[ 'latitude' ], (float) $item[ 'longitude' ])); - $item[ 'distance' ] = round($distance/1000, 3); - return $item; - }, $store_list); - array_multisort(array_column($store_list, 'distance'), SORT_ASC, $store_list); - } - $this->delivery['take_store_list'] = $store_list; - if (empty($delivery['take_store_id'])) { - if (!empty($store_list)) { - $this->delivery['take_store'] = $store_list[0] ?? []; - } - } else { - $store_column_list = array_column($store_list, null, 'store_id'); - $store = (new Store())->where([['store_id', '=', $delivery['take_store_id']]])->findOrEmpty()->toArray(); - if (empty($store)) { - $this->delivery['error'] = empty($this->delivery['error']) ? get_lang('DELIVERY_STORE_NOT_EXIST') : $this->delivery['error']; - } else { - switch ($delivery_type) { - case DeliveryDict::LOCAL_DELIVERY://同城配送 - if (!$store[ 'support_local_delivery' ]) { - $this->delivery['error'] = empty($this->delivery['error']) ? get_lang('STORE_NOT_SUPPORT_LOCAL_DELIVERY') : $this->delivery['error']; - } - break; - case DeliveryDict::STORE://门店自提 - if (!$store[ 'support_store' ]) { - $this->delivery['error'] = empty($this->delivery['error']) ? get_lang('STORE_NOT_SUPPORT_PICK_UP') : $this->delivery['error']; - } - break; - } - } - $store['distance'] = $store_column_list[$delivery['take_store_id']]['distance'] ?? 0; - $this->delivery['take_store'] = $store; - } - } - if (!empty($this->delivery['error'])) { - $this->setError($this->delivery['error']); - } - return true; - } - - /** - * 检测限购 - * @return bool - */ - public function checkGoodsLimitBuy() - { - $error = ( new CoreGoodsLimitBuyService() )->checkGoodsLimitBuy($this->member_id, $this->limit_buy); - if (!empty($error)) { - $this->setError($error); - } - return true; - } - - /** - * 满减送优惠计算 - * @return void - */ - public function calculateManjian() - { - ( new CoreManjianService() )->calculate($this); - } - - /** - * 商品计算运费 - * @param $goods - * @return void - */ - public function getDeliveryMoney($goods, $delivery_type) - { - - } - - /** - * 存在错误则抛出 - * @return void - */ - public function checkError() - { - $error = $this->getError(); - if ($error) throw new CommonException($error[ 0 ]); - } - - /** - * 获取错误 - * @return array|mixed - */ - public function getError() - { - return $this->error; - } - - /** - * 定义错误 - * @param $error - * @return void - */ - public function setError($error) - { - $this->error[] = $error; - } - - /** - * 获取整合后的数据 - * @return void - */ - public function getData() - { - - } - - /** - * 设置订单缓存 - * @return string - * @throws Exception - */ - public function setOrderCache($order_key = '', $order_cache = []) - { - if (empty($order_key)) { - $order_key = create_no('', $this->member_id); - } - Cache::tag('order_cache')->set($order_key, $order_cache, 300000); - return $order_key; - } - - /** - * 获取订单缓存 - * @param $order_key - * @return void - */ - public function getOrderCache($order_key) - { - - $order_cache = Cache::get($order_key, []); - if (empty($order_cache)) - throw new CommonException('SHOP_ORDER_CARTS_EXPIRE');//购物车数据已过期 - foreach ($order_cache as $k => $v) { - $this->$k = $v; - } - - return true; - } - - /** - * 清除订单缓存 - * @param $order_key - * @return true - */ - public function delOrderCache($order_key = '') - { - Cache::delete($order_key); - return true; - } - - /** - * 校验抵扣项是否可用 - * @return void - */ - public function checkDiscount() - { - - } - - /** - * 比例(向下取整) - * @param $rate - * @return float|int - */ - public function rateFormat($rate) - { - return floor(strval(( $rate ) * 100)) / 100; - } - - /** - * 金额计算 - * @return void - */ - public function moneyCalculate() - { - $args = func_get_args(); - $money = 0; - foreach ($args as $v) { - $money += $v * 100; - } - return $money / 100; - } - - /** - * 金额格式化 - * @param $money - * @return float|int - */ - public function moneyFormat($money) - { - - return floor(strval(( $money ) * 100)) / 100; - } - - /** - * 添加万能表单数据 - * @param $order_id - */ - public function addFormData($order_id) - { - if (!empty($this->form_data)) { - $diy_form_service = new CoreDiyFormRecordsService(); - $order_form = $this->form_data[ 'order' ] ?? []; - if (!empty($order_form)) { - $order_form[ 'member_id' ] = $this->member_id; - $order_form[ 'relate_id' ] = $order_id; - $form_record_id = $diy_form_service->add($order_form); - ( new Order() )->where([ - [ 'order_id', '=', $order_id ] - ])->update([ 'form_record_id' => $form_record_id ]); - } - - $goods_form = $this->form_data[ 'goods' ] ?? []; - if (!empty($goods_form)) { - $order_goods_model = new OrderGoods(); - $order_goods_list = $data = $order_goods_model->where([ [ 'order_id', '=', $order_id ] ]) - ->field('order_goods_id,sku_id')->select()->toArray(); - foreach ($goods_form as $k => $v) { - foreach ($order_goods_list as $ck => $cv) { - if ($cv[ 'sku_id' ] == $k) { - $v[ 'member_id' ] = $this->member_id; - $v[ 'relate_id' ] = $cv[ 'order_goods_id' ]; - $form_record_id = $diy_form_service->add($v); - $order_goods_model->where([ - [ 'order_id', '=', $order_id ], - [ 'order_goods_id', '=', $cv[ 'order_goods_id' ] ] - ])->update([ 'form_record_id' => $form_record_id ]); - break; - } - } - } - } - } - } - - /** - * 处理限时折扣 - */ - public function useDiscountActive() - { - if (!empty($this->goods_data)){ - $insert_discount_data = []; - $discount_service = new CoreOrderDiscountService(); - foreach ($this->goods_data as $k => $v) { - //排除赠品 - if (empty($v['is_gift']) && isset($v['show_type']) && $v['show_type'] == GoodsDict::DISCOUNT_PRICE) { - $insert_discount_data[] = [ - 'order_id' => $this->order_id, - 'member_id' => $this->member_id, - 'goods_id' => $v['goods_id'], - 'sku_id' => $v['sku_id'], - 'type' => 'discount', - 'num' => $v[ 'num' ], - 'money' => $v[ 'goods_money' ], - 'discount_type' => ActiveDict::DISCOUNT, - 'discount_type_id' => $v[ 'active_id' ], - 'content' => "", - ]; - } - } - - $discount_service->addAll($insert_discount_data); - } - return true; - } -} diff --git a/niucloud/addon/shop/app/service/core/order/CoreOrderDeliveryService.php b/niucloud/addon/shop/app/service/core/order/CoreOrderDeliveryService.php deleted file mode 100644 index c27a8ae2c..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreOrderDeliveryService.php +++ /dev/null @@ -1,719 +0,0 @@ -model = new Order(); - } - - /** - * 发货入口 - * @param $data - * @return true - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function delivery($data) - { - $order_id = $data['order_id']; - $order_goods_ids = $data['order_goods_ids'];//订单项id - //查询订单 - $where = array( - ['order_id', '=', $order_id] - ); - $order = $this->model->where($where)->findOrEmpty(); - if ($order->isEmpty()) throw new CommonException('SHOP_ORDER_NOT_FOUND');//订单不存在 - - if ($order['status'] != OrderDict::WAIT_DELIVERY && empty($data['delivery_ids'])) { - throw new CommonException('SHOP_ONLY_WAIT_DELIVERY_CAN_BE_DELIVERY');//只有待收货的订单才可以收货 - } - - //赠品跟随下单商品一起发货 - $gift_order_goods_ids = (new OrderGoods())->where([ - ['order_id', '=', $order_id], - ['is_gift', '=', 1], - ['status', '=', OrderGoodsDict::NORMAL], - ['delivery_status', '=', OrderDeliveryDict::WAIT_DELIVERY] - ])->column('order_goods_id'); - if (!empty($gift_order_goods_ids)) { - $order_goods_ids = array_merge($order_goods_ids, $gift_order_goods_ids); - $data['order_goods_ids'] = $order_goods_ids; - } - - //配送 - $delivery_type = $data['delivery_type']; - if (!empty($data['delivery_ids'])) { - $sub_where = [ - 'delivery_status', '=', OrderDeliveryDict::DELIVERY_FINISH - ]; - } else { - $sub_where = [ - 'delivery_status', '=', OrderDeliveryDict::WAIT_DELIVERY - ]; - } - //不用的订单项针对的发货方式不同 - $order_goods_where = [ - [ - 'order_id', '=', $order_id - ], - [ - 'order_goods_id', 'in', $order_goods_ids - ], - [ - 'status', '=', OrderGoodsDict::NORMAL - ], - $sub_where - ]; - $order_goods_data = (new OrderGoods())->with(['sku' => function ($q) { - $q->field('sku_id,weight'); - }, 'goods' => function ($q) { - $q->field('goods_id,unit'); - }])->where($order_goods_where)->select(); - if ($order_goods_data->count() != count($order_goods_ids)) throw new CommonException('SHOP_ORDER_DELIVERY_NOT_ALLOW_REFUND_OR_DELIVERY_FINISH');//存在退款的商品不能发货 - $has_goods_type_array = []; - foreach ($order_goods_data as $v) { - - if ($v['is_gift'] == 1) continue; - - if (!in_array($v['goods_type'], $has_goods_type_array)) { - $has_goods_type_array[] = $v['goods_type']; - } - } - if (count($has_goods_type_array) != 1) throw new CommonException('SHOP_ORDER_DELIVERY_ALLOW_ONE_GOODS_TYPE'); - //一次发货只能发送一种商品类型的订单项 - $goods_type = $has_goods_type_array[0]; - - $delivery_param = [ - 'order_data' => $order, - 'order_goods_data' => $order_goods_data, - 'param' => $data - ]; - Db::startTrans(); - try { - switch ($goods_type) { - case GoodsDict::VIRTUAL://只要有虚拟商品,就可以使用虚拟发货 - if ($delivery_type != OrderDeliveryDict::VIRTUAL) throw new CommonException('SHOP_ORDER_DELIVERY_VIRTUAL_ALLOW_VIRTUAL_DELIVERY');//虚拟商品只支持虚拟发货 - //虚拟发货 - $this->virtual($delivery_param); - break; - case GoodsDict::REAL: - if (in_array($delivery_type, OrderDeliveryDict::getChildType($order['delivery_type']))) throw new CommonException('SHOP_ORDER_DELIVERY_TYPE_NOT_ORDER_DELIVERY_TYPE');//不支持的配送方式 - switch ($order['delivery_type']) { - case OrderDeliveryDict::EXPRESS://快递 - $this->express($delivery_param); - break; - case OrderDeliveryDict::LOCAL_DELIVERY://配送 - $this->localDelivery($delivery_param); - break; - case OrderDeliveryDict::STORE://自提 - $this->store($delivery_param); - break; - } - break; - - //todo 可以扩展新的商品形式 - } - //校验是否全部发放完毕 - $this->checkFinish($data); - Db::commit(); - return true; - - } catch (AdminException $exception) { - Db::rollback(); - throw new AdminException($exception->getMessage()); - } - - - } - - /** - * 虚拟发货 - * @param $data - * @return void - */ - public function virtual($data) - { - $order_data = $data['order_data']; - $order_goods_data = $data['order_goods_data']; - $param = $data['param']; - $delivery_type = $param['delivery_type']; - $delivery_ids = $param['delivery_ids'] ?? []; - $insert_data = [ - 'delivery_ids' => $delivery_ids, - 'order_id' => $order_data['order_id'], - 'delivery_type' => $order_data['delivery_type'], - 'sub_delivery_type' => $delivery_type, - 'remark' => $param['remark'] ?? '', - ]; - $delivery_id = $this->package($insert_data); - if (empty($delivery_ids)) { - //todo 甚至可自动收货 - $order_goods_data->update([ - 'delivery_status' => OrderDeliveryDict::DELIVERY_FINISH, - 'delivery_id' => $delivery_id - ]); - //todo 实际调用虚拟配送的操作(类似生成核销码.....) - $goods_ids = array_column($order_goods_data->toArray(), 'goods_id'); - $temp_goods_list = (new Goods())->where([['goods_id', 'in', $goods_ids]])->column('*', 'goods_id'); - foreach ($order_goods_data as $v) { - $temp_goods = $temp_goods_list[$v['goods_id']]; - $virtual_receive_type = $temp_goods['virtual_receive_type']; - //如果需要核销,则生成核销码 - if ($virtual_receive_type == 'verify') {//生成核销码 - //待核销(todo 可能设置待核销状态) - if ($temp_goods['virtual_verify_type'] == 0) { - $expire_time = 0; - } else if ($temp_goods['virtual_verify_type'] == 1) { - $expire_time = time() + 86400 * $temp_goods['virtual_indate']; - } else { - $expire_time = $temp_goods['virtual_indate']; - } - //设置虚拟商品的核销有效期 - $order_goods_data->update([ - 'verify_expire_time' => $expire_time, - 'is_verify' => 1, - ]); -// (new CoreVerifyService())->create('virtual_verify', ['goods_id' => $v['goods_id'], 'sku_id' => $v['sku_id'], 'order_goods_id' => $v['order_goods_id']]); - } else if ($virtual_receive_type == 'auto') {//todo 自动收货 (订单发货后,校验订单项是否全部收货,如果已全部收货,订单就只接完成) - (new CoreOrderFinishService())->orderGoodsTake([ - 'order_id' => $order_data['order_id'], - 'order_goods_ids' => [$v['order_goods_id']] - ]); - } - } - } - - - return true; - } - - /** - * 订单配送包裹(order_delivery) - * @param $data - * @return mixed - */ - public function package($data) - { - if (isset($data['delivery_ids']) && !empty($data['delivery_ids'])) { - $delivery_ids = $data['delivery_ids']; - unset($data['delivery_ids']); - $delivery = (new OrderDelivery())->whereIn('id', $delivery_ids)->update($data); - } else { - $delivery = (new OrderDelivery())->create($data); - } - return $delivery->id ?? 0; - } - - /** - * 物流发货 - * @param $data - * @return true - */ - public function express($data) - { - - $order_data = $data['order_data']; - $order_goods_data = $data['order_goods_data']; - $param = $data['param']; - $delivery_type = $param['delivery_type']; - $order_goods_ids = $param['order_goods_ids']; // 订单项id - $delivery_way = $param['delivery_way']; // 发货方式,manual_write:手动填写,electronic_sheet:电子面单 - $electronic_sheet_id = $param['electronic_sheet_id']; // 电子面单模板 - $delivery_ids = $param['delivery_ids'] ?? []; - - $insert_data = array( - 'delivery_ids' => $delivery_ids, - 'order_id' => $order_data['order_id'], - 'delivery_type' => $order_data['delivery_type'], - 'sub_delivery_type' => $delivery_type, - 'express_company_id' => $param['express_company_id'], - 'express_number' => $param['express_number'], - 'remark' => $param['remark'], - ); - if (empty($delivery_ids)) { - // 手动填写 - if ($delivery_way == 'manual_write') { - if (!empty($param['express_number'])) { - $express_number_count = (new OrderDelivery())->where([ - ['order_id', '=', $order_data['order_id']], - ['express_number', '=', $param['express_number']] - ])->count(); - if ($express_number_count > 0) throw new CommonException('SHOP_ORDER_DELIVERY_EXPRESS_NUMBER_EXITS');//物流单号不能重复 - } - } elseif ($delivery_way == 'electronic_sheet') { - if ($delivery_type == OrderDeliveryDict::EXPRESS) { - // 电子面单 - $electronic_sheet_result = (new CoreElectronicSheetService())->printElectronicSheetByDelivery([ - 'order_id' => $order_data['order_id'], - 'electronic_sheet_id' => $electronic_sheet_id, - 'order_goods_data' => $order_goods_data->toArray() - ]); - if ($electronic_sheet_result['success']) { - $insert_data['express_number'] = $electronic_sheet_result['order_info']['LogisticCode']; // 获取电子面单返回的快递单号 - } else { - throw new CommonException($electronic_sheet_result['reason']); - } - } - } - - } - $delivery_id = $this->package($insert_data); - if (empty($delivery_ids)) { - $order_goods_data->update([ - 'delivery_status' => OrderDeliveryDict::DELIVERY_FINISH, - 'delivery_id' => $delivery_id - ]); - } - - - return true; - } - - /** - * 同城配送 - * @param $data - * @return true - */ - public function localDelivery($data) - { - $order_data = $data['order_data']; - $order_goods_data = $data['order_goods_data']; - $param = $data['param']; - $delivery_type = $param['delivery_type']; - //检查当前交易下是否有在进行中的配送订单 - $check = (new CoreLocalDeliveryOrderService())->getUnderwayDeliveryOrder([ - 'trade_no' => $order_data['order_no'], - ]); - if (!$check) throw new CommonException('LOCAL_DELIVERY_ORDER_EXIST');//该订单已存在正在进行中的配送订单 - $local_delivery_no = create_no(); - $insert_data = array( - 'delivery_ids' => $param['delivery_ids'] ?? [], - 'order_id' => $order_data['order_id'], - 'delivery_type' => $order_data['delivery_type'], - 'sub_delivery_type' => $delivery_type, - 'local_deliver_id' => $param['local_deliver_id'], - 'remark' => $param['remark'], - 'local_delivery_order_id' => $local_delivery_no - ); - $delivery_id = $this->package($insert_data); - $delivery_ids = $param['delivery_ids']; - if (empty($delivery_ids)) { - $order_goods_data->update([ - 'delivery_status' => OrderDeliveryDict::DELIVERY_FINISH, - 'delivery_id' => $delivery_id - ]); - } - //同城配送订单创建 - (new CoreLocalDeliveryOrderCreateService())->create([ - 'order_data' => $order_data, - 'trade_no' => $order_data['order_no'], - 'order_goods_data' => $order_goods_data, - 'local_delivery_no' => $local_delivery_no, - 'param' => $param, - ]); - return true; - } - - /** - * 门店自提 - * @param $data - * @return true - */ - public function store($data) - { - $order_data = $data['order_data']; - $order_goods_data = $data['order_goods_data']; - $param = $data['param']; - $delivery_type = $param['delivery_type']; - $delivery_ids = $param['delivery_ids'] ?? []; - $insert_data = array( - 'delivery_ids' => $delivery_ids, - 'order_id' => $order_data['order_id'], - 'delivery_type' => $order_data['delivery_type'], - 'sub_delivery_type' => $delivery_type, - 'remark' => $param['remark'], - ); - $delivery_id = $this->package($insert_data); - if (empty($delivery_ids)) { - $order_goods_data->update([ - 'delivery_status' => OrderDeliveryDict::DELIVERY_FINISH, - 'delivery_id' => $delivery_id - ]); - } - return true; - } - - /** - * 校验订单下的订单项是否全部发货 - * @param $data - * @return void - */ - public function checkFinish($data) - { - $order_id = $data['order_id']; - //校验订单下的有效的订单项是否全部发货完毕 - $where = array( - [ - 'delivery_status', '=', OrderDeliveryDict::WAIT_DELIVERY - ], - [ - 'order_id', '=', $order_id - ], - [ - 'status', '<>', OrderGoodsDict::REFUND_FINISH,//不包含退款完毕的 - ] - ); - $order_goods_count = (new OrderGoods())->where($where)->count(); - $where_delivery = array( - [ - 'delivery_status', 'in', [OrderDeliveryDict::DELIVERY_FINISH, OrderDeliveryDict::TAKED] - ], - [ - 'order_id', '=', $order_id - ], - [ - 'status', '<>', OrderGoodsDict::REFUND_FINISH,//不包含退款完毕的 - ] - ); - $order_goods_delivery_count = (new OrderGoods())->where($where_delivery)->count(); - //完成 - if ($order_goods_count == 0 && $order_goods_delivery_count > 0) { - $this->finish($data); - } - return true; - } - - /** - * 发货完成 - * @param $data - * @return void - */ - public function finish($data) - { - $order_id = $data['order_id']; - //查询订单 - if (!empty($data['delivery_ids'])) { - $sub_where = ['status', '=', OrderDict::REFUND_FINISH]; - } else { - $sub_where = ['status', '=', OrderDict::WAIT_DELIVERY]; - } - $where = array( - ['order_id', '=', $order_id], - $sub_where - ); - $order = $this->model->where($where)->findOrEmpty(); - if ($order->isEmpty()) throw new CommonException('SHOP_ORDER_NOT_FOUND');//订单不存在 - - $order_data = array( - 'delivery_time' => time(), - 'status' => OrderDict::WAIT_TAKE, - 'timeout' => 0 - ); - $order->save($order_data); - //订单发货后操作 - $data['order_data'] = $order->toArray(); - event('AfterShopOrderDelivery', $data); - //订单发货操作 - CoreOrderEventService::orderDelivery($data); - //订单发货后操作 -// CoreOrderEventService::orderDeliveryAfter($data); // 注释是为了解决小程序发货问题 - - //如果有且只有一个虚拟商品并且已经收货,则订单完成 - $order_goods_list = (new OrderGoods())->where([ - ['order_id', '=', $order_id], - ])->select()->toArray(); - if (count($order_goods_list) == 1) { - $first_order_goods = $order_goods_list[0]; - if ($first_order_goods['goods_type'] == GoodsDict::VIRTUAL && $first_order_goods['delivery_status'] == OrderDeliveryDict::TAKED) { - (new CoreOrderFinishService())->finish(['order_id' => $order_id]); - } - } - - return true; - } - - /** - * 配送费用计算 - * @param $data - * @return mixed - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function getDeliveryFee($data) - { - if ($data['delivery_type'] == 'local_delivery' && $data['delivery_way'] == 'third_party_delivery') { - $order_id = $data['order_id']; - $order_goods_ids = $data['order_goods_ids'];//订单项id - //查询订单 - $order_data = $this->model->where([['order_id', '=', $order_id]])->findOrEmpty(); - if ($order_data->isEmpty()) throw new CommonException('MALL_ORDER_NOT_FOUND');//订单不存在 - $order_goods_where = [ - ['order_id', '=', $order_id], - ['order_goods_id', 'in', $order_goods_ids], - ['status', '=', OrderGoodsDict::NORMAL] - ]; - $order_goods_data = (new OrderGoods())->with(['sku' => function ($q) { - $q->field('sku_id,weight'); - }, 'goods' => function ($q) { - $q->field('goods_id,unit'); - }])->where($order_goods_where)->select(); - $data['order_data'] = $order_data; - $data['order_goods_data'] = $order_goods_data; - return (new CoreLocalDeliveryOrderCreateService())->getDeliveryFee($data); - } - return 0; - } - - /** - * 微信小程序 发货信息录入接口 - * @param $params - * @return string - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - */ - public function orderShippingUploadShippingInfo($params) - { - try { - - $order_id = $params['order_id']; - - //查询订单 - $where = array( - ['order_id', '=', $order_id] - ); - $order_data = $this->model->where($where)->findOrEmpty(); - - //订单不存在 - if ($order_data->isEmpty()) { - return ''; - } - - //不用的订单项针对的发货方式不同 - $order_goods_where = [ - ['order_id', '=', $order_id], - ['status', '=', OrderGoodsDict::NORMAL] - ]; - - $order_goods_data = (new OrderGoods())->where($order_goods_where)->select(); - - if ($order_goods_data->count() == 0) { - return ''; - } - - $pay_model = new Pay(); - $where = array( - ['out_trade_no', '=', $order_data['out_trade_no']] - ); - $pay_info = $pay_model->where($where)->field('id,type')->findOrEmpty()->toArray(); - - if (empty($pay_info)) { - return ''; - } - - // 订单未使用微信支付,无须处理 - if ($pay_info['type'] != PayDict::WECHATPAY) { - return '订单未使用微信支付'; - } - - $weapp_delivery_service = new CoreWeappDeliveryService(); - - // 检测微信小程序是否已开通发货信息管理服务 - $is_trade_managed = $weapp_delivery_service->isTradeManaged(); - - if (empty($is_trade_managed['is_trade_managed'])) { - return '发货信息录入接口,报错:' . $is_trade_managed["errmsg"]; - } - - // 设置消息跳转路径设置接口 - $result_jump_path = $weapp_delivery_service->setMsgJumpPath('shop_order'); - if ($result_jump_path['errcode'] != 0) { - return '设置消息跳转路径设置接口,报错:' . $result_jump_path["errmsg"]; - } - - $logistics_type = 1; // 物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提 - - if ($order_data['delivery_type'] == OrderDeliveryDict::EXPRESS) { - - // 1、实体物流配送采用快递公司进行实体物流配送形式 - $logistics_type = 1; - - } else if ($order_data['delivery_type'] == OrderDeliveryDict::STORE) { - - // 门店自提 - $logistics_type = 4; - - } else if ($order_data['delivery_type'] == OrderDeliveryDict::LOCAL_DELIVERY) { - - // 同城配送 - $logistics_type = 2; - - } else if ($order_data['delivery_type'] == OrderDeliveryDict::VIRTUAL) { - - // 虚拟商品,例如话费充值,点卡等,无实体配送形式 - $logistics_type = 3; - - } - - $order_goods_list = $order_goods_data; - - $shipping_list = []; - $first_shipping_info = []; - - // 获取物流公司 - $delivery_list = []; - - $delivery_mode = 1; // 发货模式,发货模式枚举值:1、UNIFIED_DELIVERY(统一发货)2、SPLIT_DELIVERY(分拆发货) 示例值: UNIFIED_DELIVERY - if ($logistics_type == 1) { - $delivery_mode = count($order_goods_list) == 1 ? 1 : 2; - $result_delivery_list = $weapp_delivery_service->getDeliveryList(); - if ($result_delivery_list['errcode'] == 0 && !empty($result_delivery_list['delivery_list'])) { - $delivery_list = $result_delivery_list['delivery_list']; - } - - } - - // 查询商家默认发货地址 - $shop_address_field = 'contact_name,mobile,province_id,city_id,district_id,address,full_address,lat,lng'; - $shop_address = (new ShopAddress())->where([['is_default_delivery', '=', 1]])->field($shop_address_field)->findOrEmpty()->toArray(); - - foreach ($order_goods_list as $k => $v) { - - // 一笔支付单最多分拆成 10 个包裹 - if ($k == 9) { - break; - } - - $express_company = ''; // 物流公司编码,快递公司ID,参见「查询物流公司编码列表」,物流快递发货时必填, 示例值: DHL 字符字节限制: [1, 128] - $tracking_no = ''; // 物流单号,物流快递发货时必填,示例值: 323244567777 字符字节限制: [1, 128] - - if ($logistics_type == 1) { - - $field = 'id, order_id, delivery_type, sub_delivery_type, express_company_id,express_number'; - $info = (new OrderDelivery())->where([['id', '=', $v['delivery_id']]])->with([ - 'company' => function ($query) { - $query->field('company_id, company_name, express_no'); - } - ])->field($field)->findOrEmpty()->toArray(); - - if (!empty($info) && $info['express_company_id'] && !empty($delivery_list)) { - $tracking_no = $info['express_number']; - $index = array_search($info['company']['express_no'], array_column($delivery_list, 'delivery_id')); - if ($index !== false && isset($delivery_list[$index])) { - $express_company = $delivery_list[$index]['delivery_id']; - } - if (empty($express_company)) { - return '物流公司不支持,请更换其他物流公司'; - } - } else { - $logistics_type = 2; // 无需物流的情况,无实体配送形式 - $delivery_mode = 1; // 统一发货 - } - - } - - $item = [ - 'tracking_no' => $tracking_no, // 物流单号,物流快递发货时必填,示例值: 323244567777 字符字节限制: [1, 128] - 'express_company' => $express_company, // 物流公司编码,快递公司ID,参见「查询物流公司编码列表」,物流快递发货时必填, 示例值: DHL 字符字节限制: [1, 128] - 'item_desc' => str_sub($v['goods_name'] . $v['sku_name'], 90) . '*' . $v['num'], // 商品信息,例如:微信红包抱枕*1个,限120个字以内 - 'contact' => [ - 'consignor_contact' => '', - 'receiver_contact' => '' - ] - ]; - - // 寄件人联系方式,寄件人联系方式,采用掩码传输,最后4位数字不能打掩码 示例值: `189****1234, 021-****1234, ****1234, 0**2-***1234, 0**2-******23-10, ****123-8008` 值限制: 0 ≤ value ≤ 1024 - if (!empty($shop_address['mobile'])) { - $item['contact']['consignor_contact'] = substr($shop_address['mobile'], 0, 3) . '****' . substr($shop_address['mobile'], 7); - } - - // 收件人联系方式,收件人联系方式为,采用掩码传输,最后4位数字不能打掩码 示例值: `189****1234, 021-****1234, ****1234, 0**2-***1234, 0**2-******23-10, ****123-8008` 值限制: 0 ≤ value ≤ 1024 - if (!empty($order_data['taker_mobile'])) { - $item['contact']['receiver_contact'] = substr($order_data['taker_mobile'], 0, 3) . '****' . substr($order_data['taker_mobile'], 7); - } - - $shipping_list[] = $item; - if ($k == 0) { - $first_shipping_info = $item; - } - } - - // 统一发货,只能有一个物流信息,拼装商品信息 - if ($delivery_mode == 1) { - if (count($shipping_list) > 1) { - foreach ($shipping_list as $k => $v) { - if ($k > 0) { - $first_shipping_info['item_desc'] .= ',' . $v['item_desc']; - } - } - } - $first_shipping_info['item_desc'] = str_sub($first_shipping_info['item_desc'], 90); - } - - // 分拆发货模式时必填,用于标识分拆发货模式下是否已全部发货完成,只有全部发货完成的情况下才会向用户推送发货完成通知。示例值: true/false - $is_all_delivered = false; - if ($delivery_mode == 2) { - $is_all_delivered = true; - } - - $member_info = (new Member())->where([['member_id', '=', $order_data['member_id']]])->field('weapp_openid')->findOrEmpty()->toArray(); - - $data = [ - 'out_trade_no' => $order_data['out_trade_no'], - 'logistics_type' => $logistics_type, // 物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提 - 'delivery_mode' => $delivery_mode, // 发货模式,发货模式枚举值:1、UNIFIED_DELIVERY(统一发货)2、SPLIT_DELIVERY(分拆发货) 示例值: UNIFIED_DELIVERY - // 同城配送没有物流信息,只能传一个订单 - 'shipping_list' => $delivery_mode == 1 ? [$first_shipping_info] : $shipping_list, // 物流信息列表,发货物流单列表,支持统一发货(单个物流单)和分拆发货(多个物流单)两种模式,多重性: [1, 10] - 'weapp_openid' => $member_info['weapp_openid'], // 用户标识,用户在小程序appid下的唯一标识。 下单前需获取到用户的Openid 示例值: oUpF8uMuAJO_M2pxb1Q9zNjWeS6o 字符字节限制: [1, 128] - 'is_all_delivered' => $is_all_delivered - ]; - - $weapp_delivery_service->uploadShippingInfo($data); - } catch (\Exception $e) { - Log::write('商城订单发货失败' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - } - -} diff --git a/niucloud/addon/shop/app/service/core/order/CoreOrderDiscountService.php b/niucloud/addon/shop/app/service/core/order/CoreOrderDiscountService.php deleted file mode 100644 index 6f483f808..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreOrderDiscountService.php +++ /dev/null @@ -1,42 +0,0 @@ -model = new OrderDiscounts(); - } - - - /** - * 订单优惠 - * @param array $data - * @return true - */ - public function addAll(array $data) - { - $this->model->insertAll($data); - return true; - } - - -} diff --git a/niucloud/addon/shop/app/service/core/order/CoreOrderEditPriceService.php b/niucloud/addon/shop/app/service/core/order/CoreOrderEditPriceService.php deleted file mode 100644 index 899b6c726..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreOrderEditPriceService.php +++ /dev/null @@ -1,156 +0,0 @@ -model = new Order(); - } - - - /** - * 订单完成 - * @param array $data - * @return true - * @throws DbException - */ - public function finish(array $data) - { - $order_id = $data[ 'order_id' ]; - - //查询订单 - $where = array ( - [ 'order_id', '=', $order_id ], - ); - $order = $this->model->where($where)->findOrEmpty()->toArray(); - if (empty($order)) throw new CommonException('SHOP_ORDER_NOT_FOUND');//订单不存在 -// if ($order[ 'status' ] != OrderDict::WAIT_TAKE) throw new CommonException('SHOP_ONLY_WAIT_TAKE_CAN_BE_TAKE');//只有待收货的订单才可以收货 - - //存在退款中的订单项,订单就不可以收货 - $refunding_order_goods_count = ( new OrderGoods() )->where([ - [ 'order_id', '=', $order_id ], - [ 'status', '=', OrderGoodsDict::REFUNDING ] - ])->count(); - if ($refunding_order_goods_count > 0) throw new CommonException('SHOP_ORDER_HAS_REFUNDING_NOT_ALLOW_FINISH');//是否存在退款中的订单项 - $update_data = array ( - 'status' => OrderDict::FINISH, - 'finish_time' => time(), - 'timeout' => 0 - ); - $this->model->where($where)->update($update_data); - //订单项收货 - $this->orderGoodsTake($data); - $data[ 'order_data' ] = array_merge($order, $update_data); - //订单完成操作 - CoreOrderEventService::orderFinish($data); - //订单完成后操作 - CoreOrderEventService::orderFinishAfter($data); - return true; - } - - /** - * 订单项收货 - * @param $data - * @return void - */ - public function orderGoodsTake($data) - { - $order_id = $data[ 'order_id' ]; - $order_goods_ids = $data[ 'order_goods_ids' ] ?? []; - //将待收货的订单项设置已收货 - $order_goods_where = array ( - [ 'order_id', '=', $order_id ], - [ 'status', '=', OrderGoodsDict::NORMAL ], -// ['delivery_status', '=', OrderDeliveryDict::DELIVERY_FINISH] - ); - if(!empty($order_goods_ids)){ - $order_goods_where[] = ['order_goods_id', 'in', $order_goods_ids]; - } - $order_goods_data = array ( - 'delivery_status' => OrderDeliveryDict::TAKED - ); - ( new OrderGoods() )->where($order_goods_where)->update($order_goods_data); - return true; - } - - - /** - * 确认收货提醒接口 - * @param array $params - * @return string - */ - public function orderShippingNotifyConfirmReceive($params = []) - { - - try { - - $pay_model = new Pay(); - $where = array ( - [ 'out_trade_no', '=', $params[ 'out_trade_no' ] ] - ); - $pay_info = $pay_model->where($where)->field('id,type')->findOrEmpty()->toArray(); - - // 订单未使用微信支付,无须处理 - if ($pay_info[ 'type' ] != PayDict::WECHATPAY) { - return '订单未使用微信支付'; - } - - if ($params[ 'delivery_type' ] != OrderDeliveryDict::EXPRESS) { - return '只有物流订单才能进行提醒'; - } - - $weapp_delivery_service = new CoreWeappDeliveryService(); - - // 检测微信小程序是否已开通发货信息管理服务 - $is_trade_managed = $weapp_delivery_service->isTradeManaged(); - - if (empty($is_trade_managed[ 'is_trade_managed' ])) { - return '发货信息录入接口,报错:' . $is_trade_managed[ "errmsg" ]; - } - - // 设置消息跳转路径设置接口 - $result_jump_path = $weapp_delivery_service->setMsgJumpPath('shop_order'); - if ($result_jump_path[ 'errcode' ] != 0) { - return '设置消息跳转路径设置接口,报错:' . $result_jump_path[ "errmsg" ]; - } - - $data = [ - 'merchant_trade_no' => $params[ 'out_trade_no' ] // 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一 - ]; - $weapp_delivery_service->notifyConfirmReceive($data); - - } catch (\Exception $e) { - Log::write('确认收货提醒接口失败' . $e->getMessage() . $e->getFile() . $e->getLine()); - } - } - -} diff --git a/niucloud/addon/shop/app/service/core/order/CoreOrderEventService.php b/niucloud/addon/shop/app/service/core/order/CoreOrderEventService.php deleted file mode 100644 index af01c5181..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreOrderEventService.php +++ /dev/null @@ -1,155 +0,0 @@ -model = new Order(); - } - - /** - * 订单创建事件 - * @param $data - * @return true - */ - public static function orderCreate($data){ - event('ShopOrderCreate', $data); - return true; - } - - /** - * 订单创建后事件 - * @param $data - * @return true - */ - public static function orderCreateAfter($data){ - OrderCreateAfter::dispatch(['data' => $data]); - return true; - } - - /** - * 订单支付 - * @param $data - * @return true - */ - public static function orderPay($data){ - event('ShopOrderPay', $data); - return true; - } - - /** - * 订单支付后事件 - * @param $data - * @return true - */ - public static function orderPayAfter($data){ - OrderPayAfter::dispatch(['data' => $data]); - return true; - } - - /** - * 订单关闭 - * @param $data - * @return true - */ - public static function orderClose($data){ - event('ShopOrderClose', $data); - return true; - } - - /** - * 订单关闭后事件 - * @param $data - * @return true - */ - public static function orderCloseAfter($data){ - OrderCloseAfter::dispatch(['data' => $data]); - return true; - } - - - /** - * 订单发货 - * @param $data - * @return true - */ - public static function orderDelivery($data){ - event('ShopOrderDelivery', $data); - return true; - } - - /** - * 订单发货后事件 - * @param $data - * @return true - */ - public static function orderDeliveryAfter($data){ - OrderDeliveryAfter::dispatch(['data' => $data]); - return true; - } - - /** - * 订单完成 - * @param $data - * @return true - */ - public static function orderFinish($data){ - event('ShopOrderFinish', $data); - return true; - } - - /** - * 订单完成后事件 - * @param $data - * @return true - */ - public static function orderFinishAfter($data){ - OrderFinishAfter::dispatch(['data' => $data]); - return true; - } - - /** - * 订单改价 - * @param $data - * @return true - */ - public static function orderEditPrice($data){ - event('ShopOrderEditPrice', $data); - return true; - } - - /** - * 订单改价后事件 - * @param $data - * @return true - */ - public static function orderEditPriceAfter($data){ - OrderEditPriceAfter::dispatch(['data' => $data]); - return true; - } -} diff --git a/niucloud/addon/shop/app/service/core/order/CoreOrderFinishService.php b/niucloud/addon/shop/app/service/core/order/CoreOrderFinishService.php deleted file mode 100644 index 9b54208ae..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreOrderFinishService.php +++ /dev/null @@ -1,154 +0,0 @@ -model = new Order(); - } - - /** - * 订单完成 - * @param array $data - * @return true - * @throws DbException - */ - public function finish(array $data) - { - $order_id = $data[ 'order_id' ]; - - //查询订单 - $where = array( - [ 'order_id', '=', $order_id ], - ); - $order = $this->model->where($where)->findOrEmpty()->toArray(); - if (empty($order)) throw new CommonException('SHOP_ORDER_NOT_FOUND');//订单不存在 -// if ($order[ 'status' ] != OrderDict::WAIT_TAKE) throw new CommonException('SHOP_ONLY_WAIT_TAKE_CAN_BE_TAKE');//只有待收货的订单才可以收货 - - //存在退款中的订单项,订单就不可以收货 - $refunding_order_goods_count = ( new OrderGoods() )->where([ - [ 'order_id', '=', $order_id ], - [ 'status', '=', OrderGoodsDict::REFUNDING ] - ])->count(); - if ($refunding_order_goods_count > 0) throw new CommonException('SHOP_ORDER_HAS_REFUNDING_NOT_ALLOW_FINISH');//是否存在退款中的订单项 - $update_data = array( - 'status' => OrderDict::FINISH, - 'finish_time' => time(), - 'is_enable_refund' => 0, - 'timeout' => 0 - ); - $this->model->where($where)->update($update_data); - //订单项收货 - $this->orderGoodsTake($data); - $data[ 'order_data' ] = array_merge($order, $update_data); - //订单完成操作 - CoreOrderEventService::orderFinish($data); - //订单完成后操作 - CoreOrderEventService::orderFinishAfter($data); - return true; - } - - /** - * 订单项收货 - * @param $data - * @return void - */ - public function orderGoodsTake($data) - { - $order_id = $data[ 'order_id' ]; - $order_goods_ids = $data[ 'order_goods_ids' ] ?? []; - //将待收货的订单项设置已收货 - $order_goods_where = array( - [ 'order_id', '=', $order_id ], - [ 'status', '=', OrderGoodsDict::NORMAL ], -// ['delivery_status', '=', OrderDeliveryDict::DELIVERY_FINISH] - ); - if (!empty($order_goods_ids)) { - $order_goods_where[] = [ 'order_goods_id', 'in', $order_goods_ids ]; - } - $order_goods_data = array( - 'delivery_status' => OrderDeliveryDict::TAKED - ); - ( new OrderGoods() )->where($order_goods_where)->update($order_goods_data); - return true; - } - - /** - * 确认收货提醒接口 - * @param array $params - * @return string - */ - public function orderShippingNotifyConfirmReceive($params = []) - { - - try { - - $pay_model = new Pay(); - $where = array( - [ 'out_trade_no', '=', $params[ 'out_trade_no' ] ] - ); - $pay_info = $pay_model->where($where)->field('id,type')->findOrEmpty()->toArray(); - - // 订单未使用微信支付,无须处理 - if ($pay_info[ 'type' ] != PayDict::WECHATPAY) { - return '订单未使用微信支付'; - } - - if ($params[ 'delivery_type' ] != OrderDeliveryDict::EXPRESS) { - return '只有物流订单才能进行提醒'; - } - - $weapp_delivery_service = new CoreWeappDeliveryService(); - - // 检测微信小程序是否已开通发货信息管理服务 - $is_trade_managed = $weapp_delivery_service->isTradeManaged(); - - if (empty($is_trade_managed[ 'is_trade_managed' ])) { - return '发货信息录入接口,报错:' . $is_trade_managed[ "errmsg" ]; - } - - // 设置消息跳转路径设置接口 - $result_jump_path = $weapp_delivery_service->setMsgJumpPath('shop_order'); - if ($result_jump_path[ 'errcode' ] != 0) { - return '设置消息跳转路径设置接口,报错:' . $result_jump_path[ "errmsg" ]; - } - - $data = [ - 'merchant_trade_no' => $params[ 'out_trade_no' ] // 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一 - ]; - $weapp_delivery_service->notifyConfirmReceive($data); - - } catch (\Exception $e) { -// throw new CommonException($e->getMessage()); - } - } - -} diff --git a/niucloud/addon/shop/app/service/core/order/CoreOrderLogService.php b/niucloud/addon/shop/app/service/core/order/CoreOrderLogService.php deleted file mode 100644 index db537f88c..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreOrderLogService.php +++ /dev/null @@ -1,89 +0,0 @@ -model = new OrderLog(); - } - - /** - * 订单日志 - * @param array $data - * @return true - */ - public function add(array $data) - { - $this->model->create($data); - return true; - } - - /** - * 批量写入日志 - * @param array $data - * @return true - */ - public function addAll(array $data) - { - $this->model->insertAll($data); - return true; - } - - /** - * 操作人数据批量查询并转化(周) - * @param $data - * @return void[] - */ - public function getMainData($data) - { - $member_ids = []; - $uids = []; - foreach ($data as $v) { - $main_type = $v[ 'main_type' ]; - $main_id = $v[ 'main_id' ]; - if ($main_type == OrderLogDict::MEMBER) { - $member_ids[] = $main_id; - } elseif ($main_type == OrderLogDict::STORE) { - $uids[] = $main_id; - } - } - $member_names = !empty($member_ids) ? ( new Member() )->where([ [ 'member_id', 'in', $member_ids ] ])->column('nickname', 'member_id') : []; - $user_names = !empty($uids) ? ( new SysUser() )->where([ [ 'uid', 'in', $uids ] ])->column('username', 'uid') : []; - return array_map(function($value) use ($member_names, $user_names) { - $main_type = $value[ 'main_type' ]; - $main_id = $value[ 'main_id' ]; - if ($main_type == OrderLogDict::MEMBER) { - $main_name = $member_names[ $main_id ]; - } elseif ($main_type == OrderLogDict::STORE) { - $main_name = $user_names[ $main_id ]; - } else { - $main_name = ''; - } - $value[ 'main_name' ] = $main_name; - return $value; - }, $data); - } - -} diff --git a/niucloud/addon/shop/app/service/core/order/CoreOrderPayService.php b/niucloud/addon/shop/app/service/core/order/CoreOrderPayService.php deleted file mode 100644 index acc3d89b1..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreOrderPayService.php +++ /dev/null @@ -1,108 +0,0 @@ -model = new Order(); - } - - /** - * 订单已支付操作 - * @param array $data - * @return void - */ - public function pay(array $data) - { - $order_id = $data[ 'trade_id' ]; - $where = [ - [ - 'order_id', '=', $order_id - ] - ]; - $order = $this->model->where($where)->findOrEmpty(); - if ($order->isEmpty()) - throw new CommonException('SHOP_ORDER_NOT_FOUND');//订单不存在 - - //todo 状态判断 - if (!in_array($order[ 'status' ], [ OrderDict::WAIT_PAY, OrderDict::CLOSE ])) throw new CommonException('SHOP_ORDER_IS_PAY_FINISH');//订单支付 - $out_trade_no = $data[ 'out_trade_no' ] ?? ''; - //订单状态变成已支付 - $order_data = array( - 'status' => OrderDict::WAIT_DELIVERY, - 'pay_time' => time(), - 'timeout' => 0, - 'out_trade_no' => $out_trade_no, - 'is_enable_refund' => 1, - ); - $this->model->where($where)->update($order_data); - - //订单到达待发货状态 - $this->orderGoodsPay([ 'order_id' => $order_id ]); - - $data[ 'order_data' ] = $order->toArray(); - $data[ 'order_id' ] = $order_id; - -// event('AfterShopOrderPay', $data); - //订单支付操作 - CoreOrderEventService::orderPay($data); - //订单支付后操作 - CoreOrderEventService::orderPayAfter($data); - return true; - } - - - /** - * 订单项支付操作 - * @param $data - * @return true - */ - public function orderGoodsPay($data) - { - $order_id = $data[ 'order_id' ]; - $update_data = [ - 'delivery_status' => OrderDeliveryDict::WAIT_DELIVERY, - 'is_enable_refund' => 1 - ]; - $where = [ - [ 'order_id', '=', $order_id ] - ]; - ( new OrderGoods() )->where($where)->update($update_data); - return true; - } - - - /** - * to待配送状态 - * @param $data - * @return void - */ - public function toDelivery($data) - { - //todo 根据订单项类判断各个商品的配送操作 - - } -} diff --git a/niucloud/addon/shop/app/service/core/order/CoreOrderService.php b/niucloud/addon/shop/app/service/core/order/CoreOrderService.php deleted file mode 100644 index f4f8f892c..000000000 --- a/niucloud/addon/shop/app/service/core/order/CoreOrderService.php +++ /dev/null @@ -1,86 +0,0 @@ -model = new Order(); - } - - /** - * 查询订单 - * @param int $order_id - * @return array - */ - public function getInfo(int $order_id) - { - //查询订单 - $where = array( - [ 'order_id', '=', $order_id ] - ); - return $this->model->where($where)->findOrEmpty()->toArray(); - } - - /** - * 查询物流信息 - * @param $params - * @return mixed - */ - public function deliverySearch($params) - { - $class = new DeliverySearchLoader(); - $data = [ - 'company_id' => !empty($params[ 'company' ]) ? $params[ 'company' ][ 'company_id' ] : '', - 'express_no' => !empty($params[ 'company' ]) ? $params[ 'company' ][ 'express_no' ] : '', - 'logistic_no' => $params[ 'express_number' ], - 'mobile' => $params[ 'mobile' ], - ]; - - //获取缓存 - $traces = Cache::get('order_delivery:'.$data['express_no'].$params['id']); - if(empty($traces)){ - $traces = $class->search($data); - if (!empty($traces[ 'list' ])) { - //结果缓存2小时 - $traces[ 'list' ] = array_reverse($traces[ 'list' ]); - Cache::tag('order_delivery')->set('order_delivery:'.$data['express_no'], $traces, 7200); - } - } - $params[ 'traces' ] = $traces; - return $params; - } - - public function setInvoiceIdByOrderId($order_ids, $invoice_id = 0) - { - if (is_string($order_ids)){ - $order_ids = explode(',', $order_ids); - } - $this->model->whereIn('order_id', $order_ids)->update(['invoice_id' => $invoice_id]); - } - public function cancelInvoiceId($invoice_id = 0) - { - $this->model->whereIn('invoice_id', $invoice_id)->update(['invoice_id' => 0]); - } -} diff --git a/niucloud/addon/shop/app/service/core/pointexchange/CoreGoodsSaleNumService.php b/niucloud/addon/shop/app/service/core/pointexchange/CoreGoodsSaleNumService.php deleted file mode 100644 index 8754a58a0..000000000 --- a/niucloud/addon/shop/app/service/core/pointexchange/CoreGoodsSaleNumService.php +++ /dev/null @@ -1,62 +0,0 @@ -model = new Exchange(); - } - - /** - * 增加 - * @param $data - * @return void - */ - public function inc($data) - { - $this->model->where([['id', '=', $data['id']]])->inc('total_exchange_num', $data['num'])->inc('total_member_num', 1)->inc('total_point_num', $data['point'])->inc('total_price_num', $data['goods_money'])->inc('total_order_num', 1)->update(); - return true; - } - /** - * 增加 - * @param $data - * @return void - */ - public function batchUpdate($data) - { - $this->model->saveAll($data); - return true; - } - - /** - * 减少 - * @param $data - * @return void - */ - public function dec($data) - { - $this->model->where([['id', '=', $data['id']]])->dec('total_exchange_num', $data['num'])->dec('total_member_num', 1)->dec('total_point_num', $data['point'])->dec('total_price_num', $data['goods_money'])->dec('total_order_num', 1)->update(); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/pointexchange/CoreGoodsStockService.php b/niucloud/addon/shop/app/service/core/pointexchange/CoreGoodsStockService.php deleted file mode 100644 index 6194ab817..000000000 --- a/niucloud/addon/shop/app/service/core/pointexchange/CoreGoodsStockService.php +++ /dev/null @@ -1,88 +0,0 @@ -model = new Exchange(); - } - - - /** - * 增加库存 - * @param $data - * @return void - */ - public function inc($data) - { - $where[ 'sku_id' ] = $data[ 'sku_id' ]; - $exchange_goods_info = ( new CorePointexChangeService )->getInfo($where); - if (!empty($exchange_goods_info)) { - $sku_key = array_search($data[ 'sku_id' ], array_column($exchange_goods_info[ 'product_detail' ], 'sku_id')); - $exchange_sku_info = $exchange_goods_info[ 'product_detail' ][ $sku_key ]; - $exchange_goods_info[ 'product_detail' ][ $sku_key ][ 'stock' ] += $data[ 'num' ]; - $update_array[ 'stock' ] = $exchange_sku_info[ 'stock' ] + $data[ 'num' ]; - $update_array[ 'product_detail' ] = json_encode($exchange_goods_info[ 'product_detail' ]); - $this->model->where([ [ 'id', '=', $exchange_goods_info[ 'id' ] ] ])->update($update_array); - return true; - } - } - - /** - * 减少库存 - * @param $data - * @return void - */ - public function dec($data) - { - - $where[ 'sku_id' ] = $data[ 'sku_id' ]; - $exchange_goods_info = ( new CorePointexChangeService )->getInfo($where); - if (!empty($exchange_goods_info)) { - $sku_key = array_search($data[ 'sku_id' ], array_column($exchange_goods_info[ 'product_detail' ], 'sku_id')); - $exchange_sku_info = $exchange_goods_info[ 'product_detail' ][ $sku_key ]; - $sku_where[] = [ 'sku_id', '=', $exchange_sku_info[ 'sku_id' ] ]; - $goods_sku_info = ( new GoodsSku() )->where($sku_where)->field('stock')->findOrEmpty()->toArray(); - if ($exchange_sku_info[ 'stock' ] < $goods_sku_info[ 'stock' ]) { - $exchange_goods_info[ 'product_detail' ][ $sku_key ][ 'stock' ] -= $data[ 'num' ]; - } else { - $exchange_goods_info[ 'product_detail' ][ $sku_key ][ 'stock' ] = $goods_sku_info[ 'stock' ]; - } - $stock = array_sum(array_column($exchange_goods_info[ 'product_detail' ], 'stock')); - $update_array[ 'product_detail' ] = json_encode($exchange_goods_info[ 'product_detail' ]); - //数量不足直接下架 - $update_array[ 'stock' ] = max($stock, 0); - //todo 目前不考虑 切默认展示的sku 限购等数据 - // array_multisort(array_column($exchange_goods_info['product_detail'], "point"), SORT_ASC, $product_detail); - // $update_array['point'] = $product_detail[0]['point']; - // $update_array['price'] = $product_detail[0]['price']; - // $update_array['limit_num'] = $product_detail[0]['limit_num']; - $this->model->where([ [ 'id', '=', $exchange_goods_info[ 'id' ] ] ])->update($update_array); - return true; - } - - } - -} diff --git a/niucloud/addon/shop/app/service/core/pointexchange/CoreOrderCreateService.php b/niucloud/addon/shop/app/service/core/pointexchange/CoreOrderCreateService.php deleted file mode 100644 index 05906492e..000000000 --- a/niucloud/addon/shop/app/service/core/pointexchange/CoreOrderCreateService.php +++ /dev/null @@ -1,301 +0,0 @@ -model = new Order(); - } - - /** - * 订单创建 - * @param array $data - * @return array - */ - public function create(array $data) - { - - //参数赋值 - $this->setParam($data); - $order_key = $this->param[ 'order_key' ] ?? ''; - //获取订单缓存缓存 - $this->getOrderCache($order_key); - //校验错误 - $this->checkError(); - //基础校验库存/活动信息 - $this->checkExchangeGoods($this->goods_data); - $local_delivery_type = $data[ 'delivery' ]['local_delivery_type'] ?? ''; - $order_data = [ - //订单整体 - 'order_type' => OrderDict::TYPE, - 'status' => OrderDict::WAIT_PAY, - 'body' => $this->basic[ 'body' ], - 'member_id' => $this->member_id, - 'goods_money' => $this->basic[ 'goods_money' ], - 'delivery_money' => $this->basic[ 'delivery_money' ] ?? 0, - 'discount_money' => $this->basic[ 'discount_money' ] ?? 0, - 'order_money' => $this->basic[ 'order_money' ], - 'has_goods_types' => $this->basic[ 'has_goods_types' ],//包含的商品形式 - //收发货相关 - 'delivery_type' => $this->delivery[ 'delivery_type' ] ?? '', - 'taker_name' => $this->delivery[ 'take_address' ][ 'name' ] ?? $data[ 'delivery' ]['taker_name']??'', - 'taker_mobile' => $this->delivery[ 'take_address' ][ 'mobile' ] ?? $data[ 'delivery' ]['taker_mobile']?? '', - 'taker_province' => $this->delivery[ 'take_address' ][ 'province_id' ] ?? 0, - 'taker_city' => $this->delivery[ 'take_address' ][ 'city_id' ] ?? 0, - 'taker_district' => $this->delivery[ 'take_address' ][ 'district_id' ] ?? 0, - 'taker_address' => $this->delivery[ 'take_address' ][ 'address' ] ?? '', - 'taker_full_address' => $this->delivery[ 'take_address' ][ 'full_address' ] ?? '', - 'taker_longitude' => $this->delivery[ 'take_address' ][ 'lng' ] ?? '', - 'taker_latitude' => $this->delivery[ 'take_address' ][ 'lat' ] ?? '', - 'take_store_id' => $this->delivery[ 'take_store' ][ 'store_id' ] ?? 0, - - 'buyer_ask_delivery_time' =>$local_delivery_type == 'now' ? "" : $data[ 'delivery' ][ 'buyer_ask_delivery_time' ] ?? '', // 购买者期望的时间 - - //附属信息 - 'member_remark' => $this->param[ 'member_remark' ] ?? '',//买家留言 - 'point' => $this->basic[ 'point_sum' ] ?? 0,//买家留言 - 'relate_id' => $this->discount[ 'discount' ][ 'discount_type_id' ] ?? 0,//关联id - 'activity_type' => ExchangeDict::DISCOUNT, // 活动类型 - ]; - $order_goods_data = [];//项 - foreach ($this->goods_data as $v) { - $order_goods_data[] = [ - 'member_id' => $data[ 'member_id' ], - 'goods_id' => $v[ 'goods_id' ], - 'sku_id' => $v[ 'sku_id' ], - 'goods_name' => $v[ 'goods' ][ 'goods_name' ], - 'sku_name' => $v[ 'sku_name' ], - 'goods_image' => $v[ 'goods' ][ 'goods_cover' ], - 'sku_image' => $v[ 'sku_image' ], - 'price' => $v[ 'price' ], - 'original_price' => $v[ 'original_price' ] ?? 0, - 'num' => $v[ 'num' ], - 'goods_money' => $v[ 'goods_money' ], - 'goods_type' => $v[ 'goods' ][ 'goods_type' ], - 'order_id' => &$this->order_id, - 'discount_money' => $v[ 'discount_money' ] ?? 0, - 'status' => OrderGoodsDict::NORMAL, - 'extend' => json_encode($v[ 'exchange_info' ]) - ]; - } - $create_order_data = array( - 'order_data' => $order_data, - 'order_goods_data' => $order_goods_data, - ); - return $this->createOrder($create_order_data); - } - - /** - * @param array $data - * @return array - * @throws \Exception - */ - public function calculate(array $data) - { - - //参数赋值 - $this->setParam($data); - $this->order_key = $this->param[ 'order_key' ] ?? ''; - if (empty($this->order_key)) { - $this->confirm(); - } - //获取订单数据的缓存 - $this->getOrderCache($this->order_key . '_basic'); - // todo 计算优惠和营销 - //$this->calculateDiscount(); - $this->setOrderCache($this->order_key); - //计算运费 - $this->calculateDelivery(); - //金额格式化 - $discount_money = $this->moneyFormat($this->basic[ 'discount_money' ] ?? 0);//优惠金额 - $delivery_money = $this->moneyFormat($this->basic[ 'delivery_money' ] ?? 0); - $goods_money = $this->moneyFormat($this->basic[ 'goods_money' ] ?? 0); - - $order_money = $this->moneyFormat($this->moneyCalculate($delivery_money, $goods_money, -$discount_money)); - $this->basic[ 'discount_money' ] = $discount_money; - $this->basic[ 'delivery_money' ] = $delivery_money; - $this->basic[ 'goods_money' ] = $goods_money; - //todo 校验控制,不能小于0 - $order_money = $order_money < 0 ? 0 : $order_money; - $this->basic[ 'order_money' ] = $order_money; -// $this->basic['pay_money'] = $this->basic['pay_money'] ?? $order_money; - //订单创建数据写入缓存,并将标识返回给前端 - $order_cache = get_object_vars($this); - unset($order_cache[ 'param' ]); - $this->setOrderCache($this->order_key, $order_cache); - return $order_cache; - } - - /** - * 订单确认(基础信息查询并缓存) - * @param array $data - * @return array|mixed - */ - public function confirm() - { - //查看会员信息 - $member_id = $this->param[ 'member_id' ]; - $this->member_id = $member_id; - $member_info = ( new CoreMemberService() )->getInfoByMemberId($member_id, 'nickname, point, member_level'); - if (empty($member_info)) throw new CommonException('SHOP_ORDER_BUYER_NOT_FOUND');//无效的账号 - // 查询会员等级信息 - $member_info[ 'member_level' ] = ( new MemberLevel() )->where([ [ 'level_id', '=', $member_info[ 'member_level' ] ] ])->field('level_id,level_benefits')->findOrEmpty()->toArray(); - //会员账户信息 - $this->buyer = $member_info; - //查询商品信息 - $this->getGoodsData(); - //配送相关信息 - $this->getDelivery(); - $order_cache = get_object_vars($this); - unset($order_cache[ 'param' ]); - unset($order_cache[ 'order_key' ]); - $order_key = $this->setOrderCache('', $order_cache); - //将基础订单数据单独存放一个缓存 - $order_basic_key = $order_key . '_basic'; - $this->setOrderCache($order_basic_key, $order_cache); - $this->order_key = $order_key; - return true; - } - - /** - * 商品相关数据 - * @return array - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function getGoodsData() - { - $sku_data = $this->param[ 'sku_data' ] ?? []; - $sku_ids = array_column($sku_data, 'sku_id'); - $sku_id = $sku_ids[ 0 ]; - $sku_where = []; - $field = 'names,total_exchange_num,stock,id,type,names,title,image,status,product_detail,point,price,limit_num,content,sort,total_point_num,total_price_num,total_order_num,total_member_num,update_time,create_time'; - $exchange_goods_info = ( new Exchange() )->where(array_merge($sku_where, [ [ 'product_detail', 'like', '%' . '"sku_id":' . $sku_ids[ 0 ] . ',' . '%' ] ]))->append([ 'type_name', 'status_name' ])->field($field)->findOrEmpty()->toArray(); - if (empty($exchange_goods_info)) throw new CommonException('EXCHANGE_DATA_NOT_FOUND');//无效的商品 - $sku_key = array_search($sku_id, array_column($exchange_goods_info[ 'product_detail' ], 'sku_id')); - //todo 限制兑换 业务 - $sku_info = $exchange_goods_info[ 'product_detail' ][ $sku_key ]; - $exchange_goods_info = array_merge2($exchange_goods_info, $sku_info); - $sku_list = ( new GoodsSku() )->where(array_merge($sku_where, [ [ 'sku_id', 'in', $sku_ids ] ]))->with([ 'goods' ])->field('sku_id, sku_name, sku_image, goods_id, price, stock, weight, volume,sku_id, sku_spec_format,member_price, sale_price')->select()->toArray(); - $sku_list = array_column($sku_list, null, 'sku_id'); - $order_data = []; - $goods_list = []; - $order_money = $goods_money = $delivery_money = 0; - $total_num = 0; - $point_sum = 0; - $body = ''; - //订单中包含的商品形式 - $has_goods_types = []; - foreach ($sku_data as $v) { - $sku_id = $v[ 'sku_id' ]; - $num = $v[ 'num' ]; - $total_num += $num; - $sku_info = $sku_list[ $sku_id ] ?? []; - if (empty($sku_info)) throw new CommonException('SHOP_ORDER_CARTS_EXPIRE');//无效的商品 - //商品原价 - $sku_info[ 'original_price' ] = $sku_info[ 'price' ]; - $sku_info[ 'member_price' ] = $exchange_goods_info[ 'price' ]; - $sku_info[ 'price' ] = $exchange_goods_info[ 'price' ]; - //默认金额填充 - $sku_info[ 'discount_money' ] = 0; - $item_goods_type = $sku_info[ 'goods' ][ 'goods_type' ]; - if (!in_array($item_goods_type, $has_goods_types)) $has_goods_types[] = $item_goods_type; - $sku_info[ 'num' ] = $num; - $sku_info[ 'market_type' ] = '积分兑换';//活动类型 - $sku_info[ 'market_type_id' ] = $exchange_goods_info[ 'id' ];//活动id - //优化业务录入 todo 目前不考虑 数量 - $this->discount[ 'discount' ] = $this->discountFormat( - [ $sku_info[ 'sku_id' ] ], - OrderDiscountDict::DISCOUNT, - $exchange_goods_info[ 'point' ] * $num, - ( $sku_info[ 'original_price' ] - $sku_info[ 'price' ] ) * $num, - ExchangeDict::DISCOUNT, - $exchange_goods_info[ 'id' ], - '积分兑换', - $exchange_goods_info[ 'names' ] ?? '' - ); - $price = $sku_info[ 'price' ]; - $sku_info[ 'goods_money' ] = $price * $num;//小计 - $sku_info[ 'point_sum' ] = $exchange_goods_info[ 'point' ] * $num;//小计 - $goods_money += $sku_info[ 'goods_money' ]; - $point_sum += $sku_info[ 'point_sum' ]; - $body = $body ? $body . ( $sku_info[ 'sku_name' ] . $sku_info[ 'goods' ][ 'goods_name' ] ) : ( $sku_info[ 'sku_name' ] . $sku_info[ 'goods' ][ 'goods_name' ] ); - $body = $exchange_goods_info[ 'names' ] . " " . $body; - $sku_info[ 'goods_name' ] = $exchange_goods_info[ 'names' ]; - $sku_info[ 'sku_image' ] = $exchange_goods_info[ 'image' ]; - $sku_info[ 'exchange_id' ] = $exchange_goods_info[ 'id' ]; - $sku_info[ 'exchange_info' ] = $exchange_goods_info[ 'product_detail' ][ $sku_key ]; - $goods_list[ $sku_id ] = $sku_info; - } - $this->basic[ 'has_goods_types' ] = $has_goods_types; - $this->basic[ 'total_num' ] = $total_num; - $this->basic[ 'point_sum' ] = $point_sum ?? 0; - $this->goods_data = $goods_list; - $this->basic[ 'goods_money' ] = $goods_money; - $this->basic[ 'body' ] = $body; - return $order_data; - } - - /** - * 自身业务检测 - * @param $sku_info - * @return string - */ - public function checkExchangeGoods($order_goods_data) - { - //不走后续的扣款判断改变提示语 - if ($this->basic[ 'point_sum' ] > $this->buyer[ 'point' ]) { - throw new CommonException('SHOP_ORDER_EXCHANGE_POINT_INSUFFICIENT'); - } - $order_goods_data_column = array_column($order_goods_data, 'num', 'sku_id'); - $sku_list = ( new GoodsSku() )->where([ [ 'sku_id', 'in', array_column($order_goods_data, 'sku_id') ] ])->select(); - foreach ($sku_list as $v) { - $sku_where = []; - $field = 'names,total_exchange_num,stock,id,type,names,title,image,status,product_detail,point,price,limit_num,content,sort,total_point_num,total_price_num,total_order_num,total_member_num,update_time,create_time'; - $exchange_goods_info = ( new Exchange() )->where(array_merge($sku_where, [ [ 'product_detail', 'like', '%' . '"sku_id":' . $v[ 'sku_id' ] . ',' . '%' ] ]))->append([ 'type_name', 'status_name' ])->field($field)->findOrEmpty()->toArray(); - if (empty($exchange_goods_info)) throw new CommonException('EXCHANGE_DATA_NOT_FOUND');//无效的商品 - if ($exchange_goods_info[ 'status' ] != 1) throw new CommonException('EXCHANGE_ACTIVITY_REMOVE');//下架判断 - $sku_key = array_search($v[ 'sku_id' ], array_column($exchange_goods_info[ 'product_detail' ], 'sku_id')); - //todo 限制兑换 业务 - $sku_info = $exchange_goods_info[ 'product_detail' ][ $sku_key ]; - if ($sku_info[ 'limit_num' ] < $order_goods_data_column[ $v[ 'sku_id' ] ]) throw new CommonException('SHOP_ORDER_EXCHANGE_EXCEEDING_LIMIT');// 限购判断 - if ($v[ 'stock' ] < $order_goods_data_column[ $v[ 'sku_id' ] ]) throw new CommonException('SHOP_ORDER_GOODS_INSUFFICIENT'); - if ($sku_info[ 'stock' ] < $order_goods_data_column[ $v[ 'sku_id' ] ]) throw new CommonException('SHOP_ORDER_EXCHANGE_INSUFFICIENT_EXCHANGE_QUANTITY');//兑换数判断 - } - } - -} diff --git a/niucloud/addon/shop/app/service/core/pointexchange/CorePointexChangeService.php b/niucloud/addon/shop/app/service/core/pointexchange/CorePointexChangeService.php deleted file mode 100644 index d97aae523..000000000 --- a/niucloud/addon/shop/app/service/core/pointexchange/CorePointexChangeService.php +++ /dev/null @@ -1,42 +0,0 @@ -model = new Exchange(); - } - - /** - * 获取积分商城详情 - * @param int $active_id - * @return array - */ - public function getInfo($where) - { - $field = 'stock,total_exchange_num,id,type,names,title,image,status,product_detail,point,price,limit_num,content,sort,total_point_num,total_price_num,total_order_num,total_member_num,update_time,create_time'; - $info = $this->model->withSearch([ 'names', 'status', 'create_time', 'product_detail', 'sku_id', 'goods_id' ], $where)->append([ 'type_name' ])->field($field)->findOrEmpty()->toArray(); - return $info; - } - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/service/core/refund/CoreRefundActionService.php b/niucloud/addon/shop/app/service/core/refund/CoreRefundActionService.php deleted file mode 100644 index 27306ff56..000000000 --- a/niucloud/addon/shop/app/service/core/refund/CoreRefundActionService.php +++ /dev/null @@ -1,232 +0,0 @@ -model = new OrderRefund(); - } - - /** - * 审核退款申请 - * @param $data ['is-agree] - * @return void - */ - public function auditApply($data) - { - $is_agree = $data[ 'is_agree' ]; - $order_refund_no = $data[ 'order_refund_no' ]; - //查询订单项信息 - $order_refund_info = $this->model->where([ - [ 'order_refund_no', '=', $order_refund_no ] - ])->findOrEmpty(); - if ($order_refund_info->isEmpty()) throw new CommonException('SHOP_ORDER_REFUND_IS_INVALID');//退款已失效 - if ($order_refund_info[ 'status' ] != OrderRefundDict::APPLY) throw new CommonException('SHOP_ORDER_REFUND_IS_ONLY_WAIT_REFUND');//退款已失效(只有申请中的退款才可以审核) - - $order_goods_id = $order_refund_info[ 'order_goods_id' ]; - //查询订单项信息 - $order_goods_info = ( new OrderGoods() )->where([ - [ 'order_goods_id', '=', $order_goods_id ], - ])->findOrEmpty(); - if ($order_goods_info->isEmpty()) throw new CommonException('SHOP_ORDER_IS_INVALID');//订单已失效 - - $order_id = $order_goods_info[ 'order_id' ];//订单id - $order = ( new Order() )->where([ [ 'order_id', '=', $order_id ] ])->findOrEmpty(); - if ($order->isEmpty()) throw new CommonException('SHOP_ORDER_IS_INVALID');//订单已失效 - - //根据退款方式来判断下一步的状态 - $update_data = []; - - $is_refund_delivery = $order_refund_info[ 'is_refund_delivery' ]; - //当前订单项最大可退金额 - $max_refund_money = $order_goods_info[ 'goods_money' ] - $order_goods_info[ 'discount_money' ];//可退金额 - if ($is_refund_delivery == 1) { - $max_refund_money += $order[ 'delivery_money' ]; - } - - if ($is_agree) { - $money = $data[ 'money' ]; - //退款金额不能大于可退款总额 - $comparison = bccomp(bcsub($money, $max_refund_money), 0);//浮点数直接进行比较会出现精度问题 - if ($comparison > 0) throw new CommonException('SHOP_ORDER_REFUND_MONEY_GT_ORDER_MONEY');//退款金额不能大于可退款总额 - $update_data[ 'money' ] = $money; - //只退款 - if ($order_refund_info[ 'refund_type' ] == OrderRefundDict::ONLY_REFUND) { - - $update_data[ 'status' ] = OrderRefundDict::STORE_AGREE_REFUND_WAIT_TRANSFER; - } else { - $refund_address_id = $data[ 'refund_address_id' ] ?? 0; - $shop_address_field = 'contact_name,mobile,province_id,city_id,district_id,address,full_address,lat,lng'; - $shop_address = ( new ShopAddress() )->where([ [ 'id', '=', $refund_address_id ] ])->field($shop_address_field)->findOrEmpty(); - if ($shop_address->isEmpty()) throw new CommonException('SHOP_ORDER_REFUND_SELECT_ADDRESS');//订单已失效 - $update_data[ 'refund_address' ] = $shop_address->toArray(); -// $update_data['timeout'] = 0; - $update_data[ 'status' ] = OrderRefundDict::STORE_AGREE_REFUND_GOODS_APPLY_WAIT_BUYER; - } - } else { - $update_data[ 'status' ] = OrderRefundDict::STORE_REFUSE_REFUND_GOODS_APPLY_WAIT_BUYER; - $update_data[ 'shop_reason' ] = $data[ 'shop_reason' ]; - } - $order_refund_info->save($update_data); - //审核完毕后续事件 - $data[ 'order_refund_no' ] = $order_refund_no; - $data[ 'refund_data' ] = array_merge($order_refund_info->toArray(), $update_data); - - event('AfterShopOrderRefundAuditApply', $data); - return true; - } - - /** - * 审核是否确认收货 - * @param $data - * @return true - */ - public function auditRefundGoods($data) - { - $is_agree = $data[ 'is_agree' ]; - $order_refund_no = $data[ 'order_refund_no' ]; - //查询订单项信息 - $order_refund_info = $this->model->where([ - [ 'order_refund_no', '=', $order_refund_no ] - ])->findOrEmpty(); - if ($order_refund_info->isEmpty()) throw new CommonException('SHOP_ORDER_REFUND_IS_INVALID');//退款已失效 - if ($order_refund_info[ 'status' ] != OrderRefundDict::BUYER_REFUND_GOODS_WAIT_STORE) throw new CommonException('SHOP_ORDER_REFUND_IS_ONLY_WAIT_REFUND_GOODS');//退款已失效(只有待确认收货请求才可以修改退款) - - $order_goods_id = $order_refund_info[ 'order_goods_id' ]; - //查询订单项信息 - $order_goods_info = ( new OrderGoods() )->where([ - [ 'order_goods_id', '=', $order_goods_id ], - ])->findOrEmpty(); - if ($order_goods_info->isEmpty()) throw new CommonException('SHOP_ORDER_IS_INVALID');//订单已失效 - //根据退款方式来判断下一步的状态 - $update_data = array(); - if ($is_agree) { - $update_data[ 'status' ] = OrderRefundDict::STORE_AGREE_REFUND_WAIT_TRANSFER; - } else { - $update_data[ 'status' ] = OrderRefundDict::STORE_REFUSE_TAKE_REFUND_GOODS_WAIT_BUYER; - $update_data[ 'shop_reason' ] = $data[ 'shop_reason' ]; - } - $order_refund_info->save($update_data); - $data[ 'order_refund_no' ] = $order_refund_no; - $data[ 'refund_data' ] = array_merge($order_refund_info->toArray(), $update_data); - //确认收货审核完毕后续事件 - event('AfterShopOrderRefundAuditRefundGoods', $data); - return true; - } - - /** - * 退款关闭 - * @param $data - * @return void - */ - public function close($data,$refund_status=OrderRefundDict::CLOSE) - { - $order_refund_no = $data[ 'order_refund_no' ]; - //查询订单项信息 - $main_type = $data[ 'main_type' ] ?? ''; - $where = [ - [ 'order_refund_no', '=', $order_refund_no ], - - ]; - if ($main_type == OrderRefundLogDict::MEMBER) { - $where[] = [ 'member_id', '=', $data[ 'main_id' ] ]; - } - $order_refund_info = $this->model->where($where)->findOrEmpty(); - if ($order_refund_info->isEmpty()) throw new CommonException('SHOP_ORDER_REFUND_IS_INVALID');//退款已失效 - if (in_array($order_refund_info[ 'status' ], [ OrderRefundDict::STORE_AGREE_REFUND_WAIT_TRANSFER, OrderRefundDict::STORE_REFUND_TRANSFERING, OrderRefundDict::FINISH, OrderRefundDict::CLOSE, OrderRefundDict::SHOP_ACTIVE_CLOSE_REFUND ])) throw new CommonException('SHOP_ORDER_REFUND_IS_INVALID_OR_FINISH');//退款已失效(退款已完成或已关闭) - $update_data = array( - 'status' => $refund_status, - 'close_time' => time() - ); - $order_refund_info->save($update_data); - - //对应的要将订单项还原 - $order_goods_where = array( - [ 'order_refund_no', '=', $order_refund_no ] - ); - $order_goods_update_data = array( - 'status' => OrderGoodsDict::NORMAL - ); - ( new OrderGoods() )->where($order_goods_where)->update($order_goods_update_data); - //订单申请退款后事件 - $data[ 'order_refund_no' ] = $order_refund_no; - $data[ 'refund_data' ] = array_merge($order_refund_info->toArray(), $update_data); - event('AfterShopOrderRefundClose', $data); - return true; - } - - /** - * 商家主动退款 - * @param $data - * @return true - */ - public function shopActiveRefund($data) - { - $order_goods_ids = $data[ 'order_goods_ids' ]; - $shop_active_refund_money = $data[ 'shop_active_refund_money' ]; - - $check_data = ( new CoreRefundService() )->refundCheck($order_goods_ids, $shop_active_refund_money); - $order_goods_list = $check_data[ 'order_goods_list' ]; - - foreach ($order_goods_list as $order_goods_info) { - $order_refund_no = create_no(); - $insert_data = [ - 'order_id' => $order_goods_info[ 'order_id' ], - 'order_goods_id' => $order_goods_info[ 'order_goods_id' ], - 'order_refund_no' => $order_refund_no, - 'refund_type' => OrderRefundDict::ONLY_REFUND, - 'reason' => get_lang('dict_shop_order_refund_action.shop_active_refund'), - 'member_id' => $order_goods_info[ 'member_id' ], - 'apply_money' => $order_goods_info[ 'item_refund_money' ], - 'money' => $order_goods_info[ 'item_refund_money' ], - 'status' => OrderRefundDict::STORE_AGREE_REFUND_WAIT_TRANSFER, - 'remark' => $data[ 'shop_active_refund_remark' ], - 'voucher' => [], - 'source' => OrderRefundDict::ACTIVE_REFUND, - 'is_refund_delivery' => $order_goods_info[ 'is_refund_delivery' ], - ]; - $order_refund_info = $this->model->create($insert_data); - - //将订单项的退款单号覆盖 - $order_goods_info->save([ - 'order_refund_no' => $order_refund_no, - 'shop_active_refund' => 1, - 'shop_active_refund_money' => $order_goods_info[ 'item_refund_money' ], - 'status' => OrderGoodsDict::REFUNDING - ]); - - $data[ 'refund_data' ] = $order_refund_info->toArray(); - $data[ 'order_goods_data' ] = $order_goods_info->toArray(); - event('AfterShopOrderRefundActiveCreate', $data); - } - return true; - } - - -} diff --git a/niucloud/addon/shop/app/service/core/refund/CoreRefundLogService.php b/niucloud/addon/shop/app/service/core/refund/CoreRefundLogService.php deleted file mode 100644 index 5cc450450..000000000 --- a/niucloud/addon/shop/app/service/core/refund/CoreRefundLogService.php +++ /dev/null @@ -1,40 +0,0 @@ -model = new OrderRefundLog(); - } - - /** - * 添加日志 - * @param $data - * @return true - */ - public function add($data) - { - $this->model->create($data); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/refund/CoreRefundService.php b/niucloud/addon/shop/app/service/core/refund/CoreRefundService.php deleted file mode 100644 index 1b3b56cc1..000000000 --- a/niucloud/addon/shop/app/service/core/refund/CoreRefundService.php +++ /dev/null @@ -1,232 +0,0 @@ -model = new OrderRefund(); - } - - /** - * 查询退款信息 - * @param $order_refund_no - * @return array - */ - public function getInfo($order_refund_no) - { - //查询订单 - $where = array( - ['order_refund_no', '=', $order_refund_no] - ); - return $this->model->where($where)->with(['order_main'])->findOrEmpty()->toArray(); - } - - /** - * 退款转账完成 - * @param $data - * @return void - */ - public function transferSuccess($data) - { - $order_refund_no = $data['order_refund_no']; - $refund_no = $data['refund_no']; - $update_data = array( - 'transfer_time' => time(), - 'refund_no' => $refund_no - ); - $this->model->where([ - [ - 'order_refund_no', '=', $order_refund_no - ] - ])->update($update_data); - $this->finish([ - 'order_refund_no' => $order_refund_no, - 'main_type' => OrderLogDict::SYSTEM, - ]); - return true; - } - - /** - * 完成 - * @param $data - * @return void - */ - public function finish($data) - { - $order_refund_no = $data['order_refund_no']; - //查询订单项信息 - $order_refund_info = $this->model->where([ - ['order_refund_no', '=', $order_refund_no], - ])->findOrEmpty(); - if ($order_refund_info->isEmpty()) throw new CommonException('SHOP_ORDER_REFUND_IS_NOT_FOUND');//退款已失效 - if ($order_refund_info['status'] == OrderRefundDict::FINISH) throw new CommonException('SHOP_ORDER_REFUND_IS_INVALID_OR_FINISH');//退款已完成或已失效 - $update_data = array( - 'status' => OrderRefundDict::FINISH, - ); - $order_refund_info->save($update_data); - - //对应的要将订单项设置为已完成 - $order_goods_where = array( - ['order_refund_no', '=', $order_refund_no] - ); - $order_goods_update_data = array( - 'status' => OrderGoodsDict::REFUND_FINISH, - 'is_enable_refund' => 0,//禁用退款 - ); - (new OrderGoods())->where($order_goods_where)->update($order_goods_update_data); - //订单完成退款后事件 - $data['order_refund_no'] = $order_refund_no; - $data['refund_data'] = array_merge($order_refund_info->toArray(), $update_data); - event('AfterShopOrderRefundFinish', $data); - - //新人专享活动退还参与资格 - $newcomerRecords = (new NewcomerRecords())->field('sku_ids')->where([ - ['member_id', '=', $order_refund_info->member_id], - ['order_id', '=', $order_refund_info->order_id], - ['is_join', '=', 1] - ])->findOrEmpty()->toArray(); - if (!empty($newcomerRecords)) { - //判断是否还有未退款的 - $not_refund_count = (new OrderGoods())->where([ - ['order_id', '=', $order_refund_info->order_id], - ['sku_id', 'in', $newcomerRecords['sku_ids']], - ['status', '<>', OrderGoodsDict::REFUND_FINISH] - ])->count(); - if ($not_refund_count == 0) { - event("NewcomerActiveJoin", ['member_id' => $order_refund_info->member_id, 'is_join' => 0, 'order_id' => $order_refund_info->order_id]); - } - } - return true; - } - - /** - * 待转账 - * @param $order_refund_data - * @param $main_type - * @param $main_id - * @return true - */ - public function toTransfer($order_refund_data, $main_type, $main_id) - { - if ($order_refund_data['money'] > 0) { - $core_refund_service = new \app\service\core\pay\CoreRefundService(); - $order = (new Order())->where([ - ['order_id', '=', $order_refund_data['order_id']] - ])->findOrEmpty(); - if ($order->isEmpty()) throw new CommonException('SHOP_ORDER_NOT_FOUND'); - $refund_no = $core_refund_service->create($order['out_trade_no'], $order_refund_data['money'], get_lang('SHOP_ORDER_BUYER_APPLY_REFUND'), OrderDict::TYPE, $order_refund_data['order_refund_no']); - $this->model->where( - [ - ['order_refund_no', '=', $order_refund_data['order_refund_no']] - ] - )->update( - [ - 'refund_no' => $refund_no, - 'status' => OrderRefundDict::STORE_REFUND_TRANSFERING - ] - ); - $core_refund_service->refund($refund_no, '', RefundDict::BACK, $main_type, $main_id); - } - //状态改变 - return true; - } - - /** - * 退款校验 - * @param $order_goods_ids - * @param $apply_refund_money - * @return array - */ - public function refundCheck($order_goods_ids, $apply_refund_money) - { - if ($apply_refund_money < 0) throw new CommonException('SHOP_ORDER_REFUND_MONEY_LESS_THAN_ZERO');//退款金额不能小于0 - //查询最大可退款总额 - $refund_money_array = $this->getOrderRefundMoney($order_goods_ids); - $refund_money = $refund_money_array['refund_money']; - $comparison = bccomp(bcsub($apply_refund_money, $refund_money), 0);//浮点数直接进行比较会出现精度问题 - if ($comparison > 0) throw new CommonException('SHOP_ORDER_REFUND_MONEY_GT_ORDER_MONEY');//退款金额不能大于可退款总额 - return $refund_money_array; - } - - - /** - * 获取订单最大可退金额 - * @param $order_goods_ids - * @return array - */ - public function getOrderRefundMoney($order_goods_ids) - { - //查询订单项信息 - $refund_money = 0; - $order_goods_model = new OrderGoods(); - $order_goods_list = $order_goods_model->where([['order_goods_id', 'in', $order_goods_ids]])->select(); - if ($order_goods_list->isEmpty()) throw new CommonException('SHOP_ORDER_IS_INVALID');//订单已失效 - $order_id = $order_goods_list[0]['order_id'];//订单id - $order = (new Order())->where([['order_id', '=', $order_id]])->findOrEmpty(); - if ($order->isEmpty()) throw new CommonException('SHOP_ORDER_IS_INVALID');//订单已失效 - if (!in_array($order['status'], [OrderDict::WAIT_DELIVERY, OrderDict::WAIT_TAKE, OrderDict::FINISH])) throw new CommonException('SHOP_ORDER_REFUND_WAIT_PAY_OR_CLOSE'); - //查询是否是最后一笔退款且还没有退运费 - $order_goods_count = $order_goods_model->where([['order_id', '=', $order_id], ['is_gift', '=', 0]])->count(); - $refund_count = $this->model->where([['order_id', '=', $order_id]])->whereNotIn( - 'status', [OrderRefundDict::CLOSE, OrderRefundDict::SHOP_ACTIVE_CLOSE_REFUND] - )->count(); - //是否包含运费 - $is_refund_delivery = 0; - if (($refund_count + count($order_goods_ids)) >= $order_goods_count) {//最后一笔退款 - //判断是否已经退过运费 - $refund_delivery_count = $this->model->where([['order_id', '=', $order_id], ['is_refund_delivery', '=', 1]])->whereNotIn( - 'status', [OrderRefundDict::CLOSE, OrderRefundDict::SHOP_ACTIVE_CLOSE_REFUND] - )->count(); - if ($refund_delivery_count == 0) {//已经退过运费的,就不需要重复再退了 - $is_refund_delivery = 1; - } - } - foreach ($order_goods_list as $key => $value) { - if (!$value['is_enable_refund']) throw new CommonException('SHOP_ORDER_IS_NOT_ENABLE_REFUND');//订单不允许退款 - //查询有没有正没有关闭的退款 - if ($value['status'] != OrderGoodsDict::NORMAL) throw new CommonException('SHOP_ORDER_REFUND_IS_REFUND_FINISH');//订单已退款或存在未完成的退款 - //当前订单项最大可退金额 - $item_refund_money = $value['goods_money'] - $value['discount_money'] - $value['shop_active_refund_money'];//可退金额 - if ($is_refund_delivery == 1 && $key == 0) { - $item_refund_money += $order['delivery_money']; - $order_goods_list[$key]['is_refund_delivery'] = $is_refund_delivery; - } else { - $order_goods_list[$key]['is_refund_delivery'] = 0; - } - $order_goods_list[$key]['item_refund_money'] = $item_refund_money; - $refund_money += $item_refund_money; - } - return [ - 'refund_money' => $refund_money, - 'order_goods_list' => $order_goods_list - ]; - } -} diff --git a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderCloseService.php b/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderCloseService.php deleted file mode 100644 index 4d953323a..000000000 --- a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderCloseService.php +++ /dev/null @@ -1,87 +0,0 @@ -model = new ShopDeliveryOrder(); - } - - /** - * 取消订单 - * @param array $data - * @return bool - */ - public function closeOrder(array $data) - { - $id = $data['id'] ?? 0; - $out_delivery_no = $data['out_delivery_no'] ?? ''; - if (empty($id) && empty($out_delivery_no)) { - throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - } - $condition = []; - if (!empty($id)) { - $condition[] = ['id', '=', $id]; - } else { - $condition[] = ['out_delivery_no', '=', $out_delivery_no]; - } - $info = $this->model->where($condition)->findOrEmpty(); - if ($info->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - $res = $info->save([ - 'status' => ShopDeliveryStatusDict::CANCELED, - 'cancel_time' => time(), - 'remark' => $data['cancel_reason'] ?? '', - ]); - if ($res) { - // 订单状态回调 - $notify_data = [ - 'status' => ShopDeliveryStatusDict::CANCELED, - 'cancel_time' => time(), - 'out_delivery_no' => $data['out_delivery_no'] ?? $info['out_delivery_no'], - 'cancel_reason' => $data['cancel_reason'] ?? '', - 'main_id' => $data['main_id'] ?? 0, - 'main_type' => $data['main_type'] ?? '', - 'main_name' => $data['main_name'] ?? '', - ]; - (new CoreLocalDeliveryOrderNotifyService())->notify(ShopDeliveryDict::MERCHANT, $info['out_delivery_no'], 'order', $notify_data); - //添加配送订单日志 - $operate = OrderLogDict::getOperate(ShopDeliveryStatusDict::convertStatus(ShopDeliveryStatusDict::CANCELED)); - (new CoreShopDeliveryOrderLogService())->addLog([ - 'order_id' => $info['id'], - 'main_id' => $data['main_id'] ?? 0, - 'main_type' => OrderLogDict::STORE, - 'main_name' => $data['main_name'] ?? '', - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => ShopDeliveryStatusDict::CANCELED, - 'remark' => $operate['operate_desc'], - ]); - } - return $res; - } -} diff --git a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderCreateService.php b/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderCreateService.php deleted file mode 100644 index a02605f44..000000000 --- a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderCreateService.php +++ /dev/null @@ -1,117 +0,0 @@ -model = new ShopDeliveryOrder(); - } - - /** - * 创建配送订单 - * @param $params - * @return array - * @throws \Exception - */ - public function createOrder($params) - { - $order_data = $params['order_data']; - $deliver = (new Deliver())->field('deliver_name,deliver_mobile')->where([['deliver_id', '=', $params['deliver_id']]])->findOrEmpty()->toArray(); - $delivery_store = (new Store())->where([['store_id', '=', $order_data['take_store_id']]])->findOrEmpty()->toArray(); - // 收货地址 - $receiver_address_point = new Coordinate($order_data[ 'taker_latitude' ], $order_data[ 'taker_longitude' ]); - // 取货地址 - $local_address_point = new Coordinate($delivery_store[ 'latitude' ], $delivery_store[ 'longitude' ]); - // 计算收货地址与取货地址的距离 - $distance = round(( new Vincenty() )->getDistance($receiver_address_point, $local_address_point) / 1000, 2); - - $delivery_no = create_no();//创建商家配送单号 - $data = [ - 'delivery_no' => $delivery_no, - 'out_delivery_no' => $params['delivery_no'], - 'trade_id' => $order_data['order_id'], - 'trade_no' => $params['trade_no'], - 'delivery_money' => $order_data['delivery_money'], - 'delivery_start' => $delivery_store['full_address'], - 'delivery_start_province_id' => $delivery_store['province_id'] ?? 0, - 'delivery_start_city_id' => $delivery_store['city_id'] ?? 0, - 'delivery_start_district_id' => $delivery_store['district_id'] ?? 0, - 'delivery_start_lng' => $delivery_store['longitude'] ?? '', - 'delivery_start_lat' => $delivery_store['latitude'] ?? '', - 'delivery_end' => $order_data['taker_full_address'], - 'delivery_end_province_id' => $order_data['taker_province'] ?? 0, - 'delivery_end_city_id' => $order_data['taker_city'] ?? 0, - 'delivery_end_district_id' => $order_data['taker_district'] ?? 0, - 'delivery_end_lng' => $order_data['taker_longitude'] ?? '', - 'delivery_end_lat' => $order_data['taker_latitude'] ?? '', - 'delivery_distance' => $distance, - 'deliver_id' => $params['deliver_id'], - 'deliver_name' => $deliver['deliver_name'], - 'deliver_mobile' => $deliver['deliver_mobile'], - 'status' => ShopDeliveryStatusDict::IN_DELIVERY,//配送中 - 'remark' => $params['remark'] ?? '', - 'body' => $params['body'] ?? '' - ]; - //添加配送订单记录 - $res = $this->model->create($data); - if ($res->id) { - $res = $res->toArray(); - // 商家订单状态回调 - (new CoreLocalDeliveryOrderNotifyService())->notify(ShopDeliveryDict::MERCHANT, $res['out_delivery_no'], 'order', [ - 'main_id' => $res['deliver_id'], - 'main_name' => $res['deliver_name'], - 'delivery_no' => $res['delivery_no'], - 'out_delivery_no' => $res['out_delivery_no'], - 'status' => ShopDeliveryStatusDict::IN_DELIVERY - ]); - //添加配送订单日志 - $operate = OrderLogDict::getOperate(ShopDeliveryStatusDict::convertStatus($res['status'])); - (new CoreShopDeliveryOrderLogService())->addLog([ - 'order_id' => $res['id'], - 'main_id' => $res['deliver_id'], - 'main_type' => OrderLogDict::RIDER, - 'main_name' => $res['deliver_name'], - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => ShopDeliveryStatusDict::IN_DELIVERY, - 'remark' => $operate['operate_desc'].',骑手'.$res['deliver_name'] - ]); - return [ - 'out_delivery_no' => $res['delivery_no'],//商家配送的配送单号就是同城配送的三方配送单号 - 'delivery_money' => $res['delivery_money'], - 'delivery_distance' => $res['delivery_distance'], - 'rider_name' => $res['deliver_name'], - 'rider_mobile' => $res['deliver_mobile'], - ]; - } - return []; - } -} diff --git a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderEventService.php b/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderEventService.php deleted file mode 100644 index be52378c0..000000000 --- a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderEventService.php +++ /dev/null @@ -1,147 +0,0 @@ -model = new LocalDeliveryOrder(); - } - - - public function create(){ - - } - - /** - * 骑手已取货 - * @param $param - * @param $delivery_no - * @return true - */ - public function riderPickedUp($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::IN_DELIVERY) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::IN_DELIVERY, - 'out_status' => $notify_data['status'], - ]; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - //todo 消息发送 -// (new NoticeService())->send('', []); - //添加配送订单日志 - $operate = OrderLogDict::getOperate(LocalDeliveryStatusDict::IN_DELIVERY); - $log_data = [ - 'order_id' => $local_delivery_order->id, - 'main_id' => $notify_data['main_id'] ?? 0, - 'main_name' => $notify_data['main_name'] ?? '', - 'main_type' => OrderLogDict::RIDER, - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => LocalDeliveryStatusDict::IN_DELIVERY, - 'remark' => $operate['operate_desc'].',骑手'.($notify_data['main_name'] ?? ''), - ]; - (new CoreLocalDeliveryOrderLogService())->addLog($log_data); - return true; - } - - public function cancel($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::CANCELED) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::CANCELED, - 'out_status' => $notify_data['status'], - 'remark' => $notify_data['cancel_reason'] ?? '', - 'cancel_time' => time() - ]; - $delivery_order_data = $local_delivery_order->toArray(); - $delivery_order_data['event'] = 'cancel'; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - event('LocalDeliveryEvent', $delivery_order_data); - - //添加配送订单日志 - $operate = OrderLogDict::getOperate(LocalDeliveryStatusDict::CANCELED); - $log_data = [ - 'order_id' => $local_delivery_order->id, - 'main_id' => $notify_data['main_id'] ?? 0, - 'main_name' => $notify_data['main_name'] ?? '', - 'main_type' => OrderLogDict::SYSTEM, - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => $notify_data['status'], - 'remark' => $operate['operate_desc'], - ]; - (new CoreLocalDeliveryOrderLogService())->addLog($log_data); - return true; - } - - public function finish($param, $delivery_no){ - $local_delivery_order = $this->model->where([['delivery_no', '=', $delivery_no]])->findOrEmpty(); - if ($local_delivery_order->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - if ($local_delivery_order->status == LocalDeliveryStatusDict::COMPLETED) { - return true; - } - - $notify_data = $param['notify_data']; - - $data = [ - 'status' => LocalDeliveryStatusDict::COMPLETED, - 'out_status' => $notify_data['status'], - 'finish_time' => time() - ]; - $delivery_order_data = $local_delivery_order->toArray(); - $delivery_order_data['event'] = 'finish'; - $this->model->where([['delivery_no', '=', $delivery_no]])->update($data); - event('LocalDeliveryEvent', $delivery_order_data); - //添加配送订单日志 - $operate = OrderLogDict::getOperate(LocalDeliveryStatusDict::COMPLETED); - $log_data = [ - 'order_id' => $local_delivery_order->id, - 'main_id' => $notify_data['main_id'] ?? 0, - 'main_name' => $notify_data['main_name'] ?? '', - 'main_type' => OrderLogDict::SYSTEM, - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => LocalDeliveryStatusDict::COMPLETED, - 'remark' => $operate['operate_desc'], - ]; - (new CoreLocalDeliveryOrderLogService())->addLog($log_data); - return true; - } - -} diff --git a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderFinishService.php b/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderFinishService.php deleted file mode 100644 index e6d3ca5a3..000000000 --- a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderFinishService.php +++ /dev/null @@ -1,85 +0,0 @@ -model = new ShopDeliveryOrder(); - } - - /** - * 完成订单 - * @param array $data - * @return bool - */ - public function finishOrder(array $data) - { - $id = $data['id'] ?? 0; - $out_delivery_no = $data['out_delivery_no'] ?? ''; - if (empty($id) && empty($out_delivery_no)) { - throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - } - $condition = []; - if (!empty($id)) { - $condition[] = ['id', '=', $id]; - } else { - $condition[] = ['out_delivery_no', '=', $out_delivery_no]; - } - $info = $this->model->where($condition)->findOrEmpty(); - if ($info->isEmpty()) throw new CommonException('DELIVERY_ORDER_NOT_EXIT'); - $res = $info->save([ - 'status' => ShopDeliveryStatusDict::COMPLETED, - 'finish_time' => time() - ]); - if ($res) { - // 订单状态回调 - $notify_data = [ - 'status' => ShopDeliveryStatusDict::COMPLETED, - 'finish_time' => time(), - 'out_delivery_no' => $data['out_delivery_no'] ?? $info['out_delivery_no'], - 'main_id' => $data['main_id'] ?? 0, - 'main_type' => $data['main_type'] ?? '', - 'main_name' => $data['main_name'] ?? '', - ]; - (new CoreLocalDeliveryOrderNotifyService())->notify(ShopDeliveryDict::MERCHANT, $info['out_delivery_no'], 'order', $notify_data); - //添加配送订单日志 - $operate = OrderLogDict::getOperate(ShopDeliveryStatusDict::convertStatus(ShopDeliveryStatusDict::COMPLETED)); - (new CoreShopDeliveryOrderLogService())->addLog([ - 'order_id' => $info['id'], - 'main_id' => $data['main_id'] ?? 0, - 'main_type' => OrderLogDict::STORE, - 'main_name' => $data['main_name'] ?? '', - 'operate' => $operate['operate'], - 'operate_desc' => $operate['operate_desc'], - 'status' => ShopDeliveryStatusDict::COMPLETED, - 'remark' => $operate['operate_desc'], - ]); - } - return $res; - } -} diff --git a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderLogService.php b/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderLogService.php deleted file mode 100644 index 0e7b50ad5..000000000 --- a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderLogService.php +++ /dev/null @@ -1,51 +0,0 @@ -model = new ShopDeliveryOrderLog(); - } - - /** - * 添加配送订单日志 - * @param $params - * @return ShopDeliveryOrderLog|\think\Model - */ - public function addLog($params) - { - $data = [ - 'order_id' => $params['order_id'], - 'main_id' => $params['main_id'] ?? 0, - 'main_type' => $params['main_type'], - 'main_name' => $params['main_name'] ?? '', - 'operate' => $params['operate'], - 'operate_desc' => $params['operate_desc'], - 'status' => $params['status'], - 'remark' => $params['remark'] ?? '', - ]; -// dd($data); - return $this->model->create($data); - } - -} diff --git a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderMessageService.php b/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderMessageService.php deleted file mode 100644 index 50a5b6047..000000000 --- a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderMessageService.php +++ /dev/null @@ -1,58 +0,0 @@ -riderPickedUp(['notify_data' => $data], $delivery_no); - break; - case LocalDeliveryStatusDict::CANCELED: - $core_order_event_service->cancel(['notify_data' => $data], $delivery_no); - break; - case LocalDeliveryStatusDict::COMPLETED: - $core_order_event_service->finish(['notify_data' => $data], $delivery_no); - break; - default: - break; - } - } - -} diff --git a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderService.php b/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderService.php deleted file mode 100644 index 29341ea30..000000000 --- a/niucloud/addon/shop/app/service/core/shop_delivery/CoreShopDeliveryOrderService.php +++ /dev/null @@ -1,35 +0,0 @@ -model = new ShopDeliveryOrder(); - } - - public function getOrderInfo($data) - { - return $this->model->where($data)->findOrEmpty()->toArray(); - } - -} diff --git a/niucloud/addon/shop/app/service/core/third_addon/order/CoreCreateOrderService.php b/niucloud/addon/shop/app/service/core/third_addon/order/CoreCreateOrderService.php deleted file mode 100644 index 90b4672ea..000000000 --- a/niucloud/addon/shop/app/service/core/third_addon/order/CoreCreateOrderService.php +++ /dev/null @@ -1,733 +0,0 @@ - $relate_order_info) { - $order_index = $index + 1; - //兼容以后得数据 如果不是商城的订单全部跳过 - if ($relate_order_info['source'] != 'shop') { - Log::warning("SHOP_PINTUAN - pintuanCreateOrder 接收到的订单数据 商品来源非商城 跳过,来源ID: {$source_id} 拼团数据来源:" . $relate_order_info['source']); - continue; - } - try { - // 提取SKU和商品信息 - $sku_info = $relate_order_info['sku'] ?? []; - $goods_id = $sku_info['source_id'] ?? 0; - $sku_id = $sku_info['source_sku_id'] ?? 0; - $relate_order_id = $relate_order_info['id'] ?? 0; - - list($check_res, $reason) = $this->checkGoods($goods_id, $sku_id, $relate_order_info['num']); - if (!$check_res) { - $failed_orders[] = "第{$order_index}个订单(ID: {$relate_order_id})" . $reason; - $return_order_list[$relate_order_id] = [ - 'relate_order_id' => 0, - 'relate_order_item_id' => 0, - 'is_success' => 0, - 'reason' => $reason - ]; - continue; - } - - - // 检查必要参数 - if (empty($goods_id) || empty($sku_id)) { - $failed_orders[] = "第{$order_index}个订单(ID: {$relate_order_id})缺少商品或SKU信息"; - continue; - } - - // 获取商品类型 - $goods_model_info = (new Goods())->where([ - 'goods_id' => $goods_id, - ])->field('goods_type')->findOrEmpty()->toArray(); - - $goods_type = $goods_model_info['goods_type'] ?? ''; - $third_type = $goods_type == GoodsDict::VIRTUAL - ? OrderDeliveryDict::VIRTUAL - : OrderDeliveryDict::EXPRESS; - $has_goods_types = [$goods_type]; - - $third_cost_list = array_column($relate_order_info['third_cost_list'], null, 'key'); - // 构建订单数据 - $temp_order_data = [ - 'order_type' => OrderDict::TYPE, - 'status' => OrderDict::WAIT_DELIVERY, - 'body' => $relate_order_info['body'] ?? '', - 'member_id' => $relate_order_info['member_id'] ?? 0, - 'goods_money' => $relate_order_info['goods_money'] ?? 0, - 'delivery_money' => $third_cost_list['delivery_money']['amount'] ?? 0, - 'discount_money' => 0, - 'order_from' => $relate_order_info['order_from'], - 'order_money' => $relate_order_info['order_money'] ?? 0, - 'has_goods_types' => $has_goods_types, - 'delivery_type' => $third_type, - 'taker_name' => $relate_order_info['taker_name'] ?? '', - 'taker_mobile' => $relate_order_info['taker_mobile'] ?? '', - 'buyer_ask_delivery_time' => '', - 'taker_province' => $relate_order_info['taker_province'] ?? 0, - 'taker_city' => $relate_order_info['taker_city'] ?? 0, - 'taker_district' => $relate_order_info['taker_district'] ?? 0, - 'taker_address' => $relate_order_info['taker_address'] ?? '', - 'taker_full_address' => $relate_order_info['taker_full_address'] ?? '', - 'taker_longitude' => $relate_order_info['taker_longitude'] ?? '', - 'taker_latitude' => $relate_order_info['taker_latitude'] ?? '', - 'take_store_id' => 0, - 'member_remark' => '', - 'order_no' => create_no(), - 'is_enable_refund' => 1, - 'invoice_id' => 0, - 'out_trade_no' => $relate_order_info['out_trade_no'] ?? '', - 'relate_id' => $source_id, - 'relate_order_id' => $relate_order_id, - 'relate_source' => $source, - 'activity_type' => $source, - 'create_time' => strtotime($relate_order_info['create_time']), - 'pay_time' => strtotime($relate_order_info['pay_time']), - 'pay_money' => $relate_order_info['pay_money'] ?? 0, - ]; - $order_info = (new Order())->where([ - 'relate_id' => $source_id, - 'relate_source' => $source, - 'relate_order_id' => $relate_order_id, - ])->findOrEmpty(); - if (!$order_info->isEmpty()) { - // 修改订单 - $shop_order_id = $order_info['order_id']; - Log::write("SHOP_PINTUAN - pintuanCreateOrder 订单已存在 订单ID: {$shop_order_id}"); - } else { - // 创建订单 - $shop_order_id = (new Order())->insertGetId($temp_order_data); - Log::write("SHOP_PINTUAN - pintuanCreateOrder 创建订单成功 订单ID: {$shop_order_id}"); - } - - - if (!$shop_order_id) { - $failed_orders[] = "第{$order_index}个订单(ID: {$relate_order_id})创建失败"; - continue; - } - - // 构建订单商品数据 - $goods_info = $sku_info['goods'] ?? []; - $goods_single_money = ($relate_order_info['goods_money'] ?? 0) / ($relate_order_info['num'] ?? 1); - $order_goods_data = [ - 'member_id' => $relate_order_info['member_id'] ?? 0, - 'goods_id' => $goods_id, - 'sku_id' => $sku_id, - 'goods_name' => $goods_info['title'] ?? '', - 'sku_name' => $sku_info['sku_name'] ?? '', - 'goods_image' => $goods_info['cover'] ?? '', - 'sku_image' => $sku_info['sku_image'] ?? '', - 'price' => $goods_single_money, - 'original_price' => $sku_info['price_config']['original'] ?? 0, - 'num' => $relate_order_info['num'] ?? 0, - 'goods_money' => ($relate_order_info['goods_money'] ?? 0), - 'goods_type' => $goods_type, - 'order_goods_money' => ($relate_order_info['goods_money'] ?? 0), - 'order_id' => $shop_order_id, - 'discount_money' => 0, - 'status' => OrderGoodsDict::NORMAL, - 'delivery_status' => OrderDeliveryDict::WAIT_DELIVERY, - 'extend' => '', - 'is_gift' => 0, - 'is_enable_refund' => 1, - ]; - $order_goods_id = (new OrderGoods())->insertGetId($order_goods_data); - Log::write("SHOP_PINTUAN - pintuanCreateOrder 创建订单商品成功 订单商品ID: {$order_goods_id}"); - - $return_order_list[$relate_order_id] = [ - 'relate_order_id' => $shop_order_id, - 'relate_order_item_id' => $order_goods_id, - 'is_success' => 1 - ]; - $temp_order_data['order_id'] = $shop_order_id; - Log::write("SHOP_PINTUAN - orderCreateAfter 触发事件"); - - CoreOrderEventService::orderCreateAfter([ - 'order_id' => $shop_order_id, - 'order_data' => $temp_order_data, - 'order_goods_data' => [$order_goods_data], - 'cart_ids' => [], - 'basic' => [], - 'main_type' => OrderLogDict::MEMBER, - 'main_id' => $relate_order_info['member_id'] ?? 0, - 'time' => time() - ]); - Log::write("SHOP_PINTUAN - orderPayAfter 触发事件"); - - CoreOrderEventService::orderPayAfter([ - 'order_id' => $shop_order_id, - 'order_data' => $temp_order_data, - 'order_goods_data' => [$order_goods_data], - 'cart_ids' => [], - 'basic' => [], - 'main_type' => OrderLogDict::MEMBER, - 'main_id' => $relate_order_info['member_id'] ?? 0, - 'time' => time(), - 'send_notice' => 0 - ]); - $processed_orders++; - } catch (\Exception $e) { - $failed_orders[] = "第{$order_index}个订单(ID: {$shop_order_id})处理异常: {$e->getMessage()}"; - Log::error("SHOP_PINTUAN - pintuanCreateOrder 拼团订单处理失败," . $e->getFile() . $e->getFile() . $e->getMessage() . $e->getTraceAsString()); - - } - } - // 合并结果日志:包含统计和失败信息 - $result_log = ["总订单数: {$total_orders}", "成功处理: {$processed_orders}", "失败订单: " . count($failed_orders)]; - if (!empty($failed_orders)) { - $result_log[] = "失败详情: " . implode('; ', $failed_orders); - } - Log::write("SHOP_PINTUAN - pintuanCreateOrder 拼团订单处理完成," . implode('; ', $result_log)); - - return $return_order_list; - } - public function friendHelpCreateOrder(array $data) - { - $return_order_list = []; - $source_id = $data['source_id'] ?? 0; - $source = $data['source'] ?? ''; - $relate_order_list = $data['order_data'] ?? []; - $total_orders = count($relate_order_list); - - // 合并初始日志:包含关键参数和总数 - Log::write("SHOP_FRIEND_HELP - friend_helpCreateOrder 开始处理好友助力订单,订单信息" . json_encode($relate_order_list, 256)); - Log::write("SHOP_FRIEND_HELP - friend_helpCreateOrder 开始处理好友助力订单,来源ID: {$source_id},总订单数: {$total_orders}"); - - if (empty($relate_order_list)) { - Log::warning("SHOP_FRIEND_HELP - friend_helpCreateOrder 接收到的订单数据为空,来源ID: {$source_id}"); - return; - } - - $processed_orders = 0; - $failed_orders = []; // 记录失败订单信息 - - foreach ($relate_order_list as $index => $relate_order_info) { - $order_index = $index + 1; - //兼容以后得数据 如果不是商城的订单全部跳过 - if ($relate_order_info['source'] != 'shop') { - Log::warning("SHOP_FRIEND_HELP - friend_helpCreateOrder 接收到的订单数据 商品来源非商城 跳过,来源ID: {$source_id} 好友助力数据来源:" . $relate_order_info['source']); - continue; - } - try { - // 提取SKU和商品信息 - $sku_info = $relate_order_info['sku'] ?? []; - $goods_id = $sku_info['source_id'] ?? 0; - $sku_id = $sku_info['source_sku_id'] ?? 0; - $relate_order_id = $relate_order_info['id'] ?? 0; - - list($check_res, $reason) = $this->checkGoods($goods_id, $sku_id, $relate_order_info['num']); - if (!$check_res) { - $failed_orders[] = "第{$order_index}个订单(ID: {$relate_order_id})" . $reason; - $return_order_list[$relate_order_id] = [ - 'relate_order_id' => 0, - 'relate_order_item_id' => 0, - 'is_success' => 0, - 'reason' => $reason - ]; - continue; - } - - - // 检查必要参数 - if (empty($goods_id) || empty($sku_id)) { - $failed_orders[] = "第{$order_index}个订单(ID: {$relate_order_id})缺少商品或SKU信息"; - continue; - } - - // 获取商品类型 - $goods_model_info = (new Goods())->where([ - 'goods_id' => $goods_id, - ])->field('goods_type')->findOrEmpty()->toArray(); - - $goods_type = $goods_model_info['goods_type'] ?? ''; - $third_type = $goods_type == GoodsDict::VIRTUAL - ? OrderDeliveryDict::VIRTUAL - : OrderDeliveryDict::EXPRESS; - $has_goods_types = [$goods_type]; - - $third_cost_list = array_column($relate_order_info['third_cost_list'], null, 'key'); - // 构建订单数据 - $temp_order_data = [ - 'order_type' => OrderDict::TYPE, - 'status' => OrderDict::WAIT_DELIVERY, - 'body' => $relate_order_info['body'] ?? '', - 'member_id' => $relate_order_info['member_id'] ?? 0, - 'goods_money' => $relate_order_info['goods_money'] ?? 0, - 'delivery_money' => $third_cost_list['delivery_money']['amount'] ?? 0, - 'discount_money' => 0, - 'order_from' => $relate_order_info['order_from'], - 'order_money' => $relate_order_info['order_money'] ?? 0, - 'has_goods_types' => $has_goods_types, - 'delivery_type' => $third_type, - 'taker_name' => $relate_order_info['taker_name'] ?? '', - 'taker_mobile' => $relate_order_info['taker_mobile'] ?? '', - 'buyer_ask_delivery_time' => '', - 'taker_province' => $relate_order_info['taker_province'] ?? 0, - 'taker_city' => $relate_order_info['taker_city'] ?? 0, - 'taker_district' => $relate_order_info['taker_district'] ?? 0, - 'taker_address' => $relate_order_info['taker_address'] ?? '', - 'taker_full_address' => $relate_order_info['taker_full_address'] ?? '', - 'taker_longitude' => $relate_order_info['taker_longitude'] ?? '', - 'taker_latitude' => $relate_order_info['taker_latitude'] ?? '', - 'take_store_id' => 0, - 'member_remark' => '', - 'order_no' => create_no(), - 'is_enable_refund' => 1, - 'invoice_id' => 0, - 'out_trade_no' => $relate_order_info['out_trade_no'] ?? '', - 'relate_id' => $source_id, - 'relate_order_id' => $relate_order_id, - 'relate_source' => $source, - 'activity_type' => $source, - 'create_time' => strtotime($relate_order_info['create_time']), - 'pay_time' => strtotime($relate_order_info['pay_time']), - 'pay_money' => $relate_order_info['pay_money'] ?? 0, - ]; - $order_info = (new Order())->where([ - 'relate_id' => $source_id, - 'relate_source' => $source, - 'relate_order_id' => $relate_order_id, - ])->findOrEmpty(); - if (!$order_info->isEmpty()) { - // 修改订单 - $shop_order_id = $order_info['order_id']; - Log::write("SHOP_FRIEND_HELP - friend_helpCreateOrder 订单已存在 订单ID: {$shop_order_id}"); - } else { - // 创建订单 - $shop_order_id = (new Order())->insertGetId($temp_order_data); - Log::write("SHOP_FRIEND_HELP - friend_helpCreateOrder 创建订单成功 订单ID: {$shop_order_id}"); - } - - - if (!$shop_order_id) { - $failed_orders[] = "第{$order_index}个订单(ID: {$relate_order_id})创建失败"; - continue; - } - - // 构建订单商品数据 - $goods_info = $sku_info['goods'] ?? []; - $goods_single_money = ($relate_order_info['goods_money'] ?? 0) / ($relate_order_info['num'] ?? 1); - $order_goods_data = [ - 'member_id' => $relate_order_info['member_id'] ?? 0, - 'goods_id' => $goods_id, - 'sku_id' => $sku_id, - 'goods_name' => $goods_info['title'] ?? '', - 'sku_name' => $sku_info['sku_name'] ?? '', - 'goods_image' => $goods_info['cover'] ?? '', - 'sku_image' => $sku_info['sku_image'] ?? '', - 'price' => $goods_single_money, - 'original_price' => $sku_info['price_config']['original'] ?? 0, - 'num' => $relate_order_info['num'] ?? 0, - 'goods_money' => ($relate_order_info['goods_money'] ?? 0), - 'goods_type' => $goods_type, - 'order_goods_money' => $goods_single_money, - 'order_id' => $shop_order_id, - 'discount_money' => 0, - 'status' => OrderGoodsDict::NORMAL, - 'delivery_status' => OrderDeliveryDict::WAIT_DELIVERY, - 'extend' => '', - 'is_gift' => 0, - 'is_enable_refund' => 1, - ]; - $order_goods_id = (new OrderGoods())->insertGetId($order_goods_data); - Log::write("SHOP_FRIEND_HELP - friend_helpCreateOrder 创建订单商品成功 订单商品ID: {$order_goods_id}"); - - $return_order_list[$relate_order_id] = [ - 'relate_order_id' => $shop_order_id, - 'relate_order_item_id' => $order_goods_id, - 'is_success' => 1 - ]; - $temp_order_data['order_id'] = $shop_order_id; - Log::write("SHOP_FRIEND_HELP - orderCreateAfter 触发事件"); - - CoreOrderEventService::orderCreateAfter([ - 'order_id' => $shop_order_id, - 'order_data' => $temp_order_data, - 'order_goods_data' => [$order_goods_data], - 'cart_ids' => [], - 'basic' => [], - 'main_type' => OrderLogDict::MEMBER, - 'main_id' => $relate_order_info['member_id'] ?? 0, - 'time' => time() - ]); - Log::write("SHOP_FRIEND_HELP - orderPayAfter 触发事件"); - - CoreOrderEventService::orderPayAfter([ - 'order_id' => $shop_order_id, - 'order_data' => $temp_order_data, - 'order_goods_data' => [$order_goods_data], - 'cart_ids' => [], - 'basic' => [], - 'main_type' => OrderLogDict::MEMBER, - 'main_id' => $relate_order_info['member_id'] ?? 0, - 'time' => time(), - 'send_notice' => 0 - ]); - $processed_orders++; - } catch (\Exception $e) { - $failed_orders[] = "第{$order_index}个订单(ID: {$shop_order_id})处理异常: {$e->getMessage()}"; - Log::error("SHOP_FRIEND_HELP - friend_helpCreateOrder 好友助力订单处理失败," . $e->getFile() . $e->getFile() . $e->getMessage() . $e->getTraceAsString()); - - } - } - // 合并结果日志:包含统计和失败信息 - $result_log = ["总订单数: {$total_orders}", "成功处理: {$processed_orders}", "失败订单: " . count($failed_orders)]; - if (!empty($failed_orders)) { - $result_log[] = "失败详情: " . implode('; ', $failed_orders); - } - Log::write("SHOP_FRIEND_HELP - friend_helpCreateOrder 好友助力订单处理完成," . implode('; ', $result_log)); - - return $return_order_list; - } - - /** - * 接龙订单处理 - * @param array $data - * @return array - */ - public function relayCreateOrder(array $data): array - { - // 初始化返回数据 - $return_order_list = []; - - // 提取基础参数并设置默认值 - $source_id = $data['source_id'] ?? 0;//接龙 一个订单的订单项可以来自不同的活动 - $source = $data['source'] ?? ''; - $relate_order_list = $data['order_data'] ?? []; - $total_orders = count($relate_order_list); - - // 记录开始日志 - Log::write("SHOP_RELAY - 开始处理接龙订单,来源ID: {$source_id},总订单数: {$total_orders}"); - Log::write("SHOP_RELAY - 订单数据: " . json_encode($relate_order_list, JSON_UNESCAPED_UNICODE)); - - // 订单数据为空时直接返回 - if (empty($relate_order_list)) { - Log::warning("SHOP_RELAY - 接收到的订单数据为空,来源ID: {$source_id}"); - return $return_order_list; - } - - // 初始化统计变量 - $processed_orders = 0; - $failed_orders = []; - - // 遍历处理每个订单 - foreach ($relate_order_list as $index => $relate_order_info) { - - $order_index = $index + 1; - $relay_order_id = $relate_order_info['id'] ?? 0; - - // 过滤非商城来源订单 - if ($relate_order_info['source'] != 'shop') { - Log::warning("SHOP_RELAY - 订单来源非商城,跳过处理,索引: {$order_index},来源: {$relate_order_info['source']}"); - continue; - } - - try { - // 1. 商品校验与类型获取 - $goods_types = []; - $all_check_res = true; - //检测订单项 商品是否可用 主要是为了获取订单项的goods_type - foreach ($relate_order_info['goods'] as $order_item) { - if ($order_item['source'] != 'shop'){ - continue; - } - $relay_order_goods_id = $order_item['id'] ?? 0; - $goods_id = $order_item['sku']['source_id'] ?? 0; - $sku_id = $order_item['sku']['source_sku_id'] ?? 0; - $num = $order_item['num'] ?? 1; - - // 获取商品类型 - $goods_model_info = (new Goods())->where([ - 'goods_id' => $goods_id, - ])->field('goods_type')->findOrEmpty()->toArray(); - - $goods_type = $goods_model_info['goods_type'] ?? ''; - $goods_types[$order_item['order_id']] = $goods_type; - - // 商品规格校验 - list($check_res, $reason) = $this->checkGoods($goods_id, $sku_id, $num); - if (!$check_res) { - $all_check_res = false; - $return_order_list[$relay_order_goods_id] = [ - 'source_order_id' => $relay_order_id, - 'source_order_item_id' => $relay_order_goods_id, - 'relate_order_id' => 0, - 'relate_order_item_id' => 0, - 'is_success' => 0, - 'reason' => $reason, - ]; - } - } - - // 校验失败处理 - if (!$all_check_res) { - //有校验未通过的订单项,停止同步订单 - break; - } - - // 2. 构建订单数据 - $third_cost_list = array_column($relate_order_info['third_cost_list'], null, 'key'); - $has_goods_types = array_values($goods_types); - $delivery_type = in_array(OrderDeliveryDict::EXPRESS, $has_goods_types) - ? OrderDeliveryDict::EXPRESS - : OrderDeliveryDict::VIRTUAL; - - $temp_order_data = [ - 'order_type' => OrderDict::TYPE, - 'status' => OrderDict::WAIT_DELIVERY, - 'body' => $relate_order_info['body'] ?? '', - 'member_id' => $relate_order_info['member_id'] ?? 0, - 'goods_money' => $relate_order_info['goods_money'] ?? 0, - 'delivery_money' => $third_cost_list['delivery_money']['amount'] ?? 0, - 'discount_money' => 0, - 'order_from' => $relate_order_info['order_from'] ?? '', - 'order_money' => $relate_order_info['order_money'] ?? 0, - 'has_goods_types' => $has_goods_types, - 'delivery_type' => $delivery_type, - 'taker_name' => $relate_order_info['taker_name'] ?? '', - 'taker_mobile' => $relate_order_info['taker_mobile'] ?? '', - 'buyer_ask_delivery_time' => '', - 'taker_province' => $relate_order_info['taker_province'] ?? 0, - 'taker_city' => $relate_order_info['taker_city'] ?? 0, - 'taker_district' => $relate_order_info['taker_district'] ?? 0, - 'taker_address' => $relate_order_info['taker_address'] ?? '', - 'taker_full_address' => $relate_order_info['taker_full_address'] ?? '', - 'taker_longitude' => $relate_order_info['taker_longitude'] ?? '', - 'taker_latitude' => $relate_order_info['taker_latitude'] ?? '', - 'take_store_id' => 0, - 'member_remark' => '', - 'order_no' => create_no(), - 'is_enable_refund' => 1, - 'invoice_id' => 0, - 'out_trade_no' => $relate_order_info['out_trade_no'] ?? '', - 'relate_id' => $source_id, - 'relate_order_id' => $relay_order_id, - 'relate_source' => $source, - 'activity_type' => $source, - 'create_time' => strtotime($relate_order_info['create_time'] ?? ''), - 'pay_time' => strtotime($relate_order_info['pay_time'] ?? ''), - 'pay_money' => $relate_order_info['pay_money'] ?? 0, - ]; - - // 3. 检查订单是否已存在,存在则更新,不存在则创建 - $order_model = new Order(); - $order_info = $order_model->where([ - 'relate_id' => $source_id, - 'relate_source' => $source, - 'relate_order_id' => $relay_order_id, - ])->findOrEmpty(); - - if (!$order_info->isEmpty()) { - $shop_order_id = $order_info['order_id']; - Log::write("SHOP_RELAY - 订单已存在 订单ID: {$shop_order_id}"); - } else { - $shop_order_id = $order_model->insertGetId($temp_order_data); - Log::write("SHOP_RELAY - 创建订单成功 订单ID: {$shop_order_id}"); - } - - // 订单创建失败处理 - if (!$shop_order_id) { - $fail_msg = "第{$order_index}个订单(ID: {$relay_order_id})创建失败"; - $failed_orders[] = $fail_msg; - $return_order_list['main_order'] = [ - 'source_order_id' => $relay_order_id, - 'source_order_item_id' => 0, - 'relate_order_id' => $shop_order_id, - 'relate_order_item_id' => 0, - 'is_success' => 0, - 'reason' => $fail_msg, - ]; - continue; - }else{ - $return_order_list['main_order'] = [ - 'source_order_id' => $relay_order_id, - 'source_order_item_id' => 0, - 'relate_order_id' => $shop_order_id, - 'relate_order_item_id' => 0, - 'is_success' => 1, - 'reason' => '', - ]; - } - - // 4. 处理订单商品 - $order_goods_data = []; - $order_goods_ids = []; - foreach ($relate_order_info['goods'] as $order_item) { - if ($order_item['source'] != 'shop'){ - continue; - } - $relay_order_goods_id = $order_item['id'] ?? []; - $goods_info = $order_item['sku']['goods'] ?? []; - $sku_info = $order_item['sku'] ?? []; - $goods_single_money = ($order_item['goods_money'] ?? 0) / ($order_item['num'] ?? 1); - - $order_goods_item = [ - 'order_id' => $shop_order_id, - 'member_id' => $order_item['member_id'] ?? 0, - 'goods_id' => $goods_info['source_id'] ?? 0, - 'sku_id' => $sku_info['source_sku_id'] ?? 0, - 'goods_name' => $goods_info['title'] ?? '', - 'sku_name' => $sku_info['sku_name'] ?? '', - 'goods_image' => $goods_info['cover'] ?? '', - 'sku_image' => $sku_info['sku_image'] ?? '', - 'price' => $goods_single_money, - 'original_price' => $sku_info['price_config']['original'] ?? 0, - 'num' => $order_item['num'] ?? 0, - 'goods_money' => $order_item['goods_money'] ?? 0, - 'goods_type' => $goods_types[$order_item['id']] ?? '', - 'order_goods_money' => $goods_single_money, - 'discount_money' => 0, - 'status' => OrderGoodsDict::NORMAL, - 'delivery_status' => OrderDeliveryDict::WAIT_DELIVERY, - 'extend' => '', - 'is_gift' => 0, - 'is_enable_refund' => 1, - ]; - $relate_order_goods_info = (new OrderGoods())->where([ - 'order_id' => $shop_order_id, - 'member_id' => $order_item['member_id'] ?? 0, - 'goods_id' => $goods_info['source_id'] ?? 0, - 'sku_id' => $sku_info['source_sku_id'] ?? 0, - ])->findOrEmpty(); - if (!$relate_order_goods_info->isEmpty()) { - $relate_order_goods_id = $relate_order_goods_info->order_goods_id; - }else{ - $relate_order_goods_id = (new OrderGoods())->insertGetId($order_goods_item); - } - //记录成功订单项 - $return_order_list[$relay_order_goods_id] = [ - 'source_order_id' => $relay_order_id, - 'source_order_item_id' => $relay_order_goods_id, - 'relate_order_id' => $shop_order_id, - 'relate_order_item_id' => $relate_order_goods_id, - 'is_success' => 1, - 'reason' => '', - ]; - Log::write("SHOP_RELAY - 创建订单商品成功 订单商品ID: {$relay_order_goods_id}"); - - $order_goods_ids[$order_item['id']] = $relay_order_goods_id; - $order_goods_data[] = $order_goods_item; - } - - // 5. 触发订单后续事件 - $temp_order_data['order_id'] = $shop_order_id; - Log::write("SHOP_RELAY - 触发 orderCreateAfter 事件"); - - CoreOrderEventService::orderCreateAfter([ - 'order_id' => $shop_order_id, - 'order_data' => $temp_order_data, - 'order_goods_data' => $order_goods_data, - 'cart_ids' => [], - 'basic' => [], - 'main_type' => OrderLogDict::MEMBER, - 'main_id' => $relate_order_info['member_id'] ?? 0, - 'time' => time() - ]); - - Log::write("SHOP_RELAY - 触发 orderPayAfter 事件"); - CoreOrderEventService::orderPayAfter([ - 'order_id' => $shop_order_id, - 'order_data' => $temp_order_data, - 'order_goods_data' => $order_goods_data, - 'cart_ids' => [], - 'basic' => [], - 'main_type' => OrderLogDict::MEMBER, - 'main_id' => $relate_order_info['member_id'] ?? 0, - 'time' => time(), - 'send_notice' => 0 - ]); - $processed_orders++; - - } catch (\Exception $e) { - $failed_orders[] = "第{$order_index}个订单 处理异常: {$e->getMessage()}"; - Log::error("SHOP_RELAY - relayCreateOrder 拼团订单处理失败," . $e->getFile() . $e->getFile() . $e->getMessage()); - } - } - - // 记录处理结果日志 - $result_log = [ - "总订单数: {$total_orders}", - "成功处理: {$processed_orders}", - "失败订单: " . count($failed_orders) - ]; - if (!empty($failed_orders)) { - $result_log[] = "失败详情: " . implode('; ', $failed_orders); - } - Log::write("SHOP_RELAY - 接龙订单处理完成," . implode('; ', $result_log)); - Log::write("SHOP_RELAY - 接龙订单处理完成, 返回数据:" . json_encode($return_order_list)); - - return $return_order_list; - } - - private function checkGoods($goods_id, $sku_id, $num = 1) - { - $goods_info = (new Goods())->where([ - 'goods_id' => $goods_id, - ])->findOrEmpty(); - if ($goods_info->isEmpty()) { - return [false, get_lang('SHOP_GOODS_NOT_EXIST')]; - } - $sku_info = (new GoodsSku())->where([ - 'goods_id' => $goods_id, - 'sku_id' => $sku_id, - ])->findOrEmpty(); - if ($sku_info->isEmpty()) { - return [false, get_lang('SHOP_GOODS_NOT_EXIST')]; - } - $stock = $sku_info['stock'] ?? 0; - return [$stock >= $num, get_lang('SHOP_ORDER_GOODS_INSUFFICIENT')]; - } -} diff --git a/niucloud/addon/shop/app/service/core/third_addon/order/CoreOrderDeliveryService.php b/niucloud/addon/shop/app/service/core/third_addon/order/CoreOrderDeliveryService.php deleted file mode 100644 index d61e43837..000000000 --- a/niucloud/addon/shop/app/service/core/third_addon/order/CoreOrderDeliveryService.php +++ /dev/null @@ -1,166 +0,0 @@ -model = new Order(); - } - - /** - * 订单参数设置 - * @param $params - * @return void - */ - public function setParams($params) - { - $param = [ - 'delivery' => [ - 'delivery_type' => 'express', - ], - 'take_address' => [ - 'province_id' => $params['province_id'] ?? '', - 'city_id' => $params['city_id'] ?? '', - 'district_id' => $params['district_id'] ?? '', - ], - 'sku_data' => [ - [ - 'sku_id' => $params['source_sku_id'], - 'num' => $params['num'], - ] - ], - 'member_id'=>$params['member_id'] ?? '' - ]; - - if(empty($param['take_address']['province_id'])){ - // 获取默认地址 - $param['take_address'] = ( new CoreMemberAddressService() )->getDefaultAddressByMemberId($params['member_id']); - } - $this->member_id = $param['member_id']; - $this->delivery = $param['take_address']; - $this->param = $param; - $this->extend_data = $this->param[ 'extend_data' ] ?? []; - } - - - /** - * 计算运费 - * @param array $data - * @return void - */ - public function calculate(array $data) - { - //参数初始化 - $this->setParams($data); - //查询商品信息 - $this->getGoodsData(); - if (in_array(GoodsDict::VIRTUAL, $this->basic['has_goods_types'])) { - $this->delivery['delivery_type'] = OrderDeliveryDict::VIRTUAL; - } else { - $this->delivery['delivery_type'] = 'express'; - } - $this->getDelivery(); - //计算运费 - $this->calculateDelivery(); - return $this->basic[ 'delivery_money' ]; - } - - - - /** - * 商品相关数据 - * @return array - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function getGoodsData() - { - $this->extend_data = $this->param['extend_data'] ?? []; - $sku_data = $this->param['sku_data'] ?? []; - if (empty($sku_data)) throw new CommonException(get_lang('SHOP_GOODS_DELISTED'));//无效的数据 - $sku_ids = array_column($sku_data, 'sku_id'); - $sku_condition = array( - ['sku_id', 'in', $sku_ids] - ); - $sku_list = (new GoodsSku())->where($sku_condition)->with(['goods'])->field('sku_id, sku_name, sku_image, goods_id, price, stock, weight, volume,sku_id, sku_spec_format,member_price, sale_price')->select()->toArray(); - $sku_list = array_column($sku_list, null, 'sku_id'); - //商品数据 查询商品列表 - $order_data = []; - $goods_list = []; - $goods_money = 0; - $total_num = 0; - $body = ''; - //订单中包含的商品形式 - $has_goods_types = []; - foreach ($sku_data as $v) { - $sku_id = $v['sku_id']; - $num = $v['num']; - $total_num += $num; - $market_type = $v['market_type'] ?? ''; - $market_type_id = $v['market_type_id'] ?? 0; - $sku_info = $sku_list[$sku_id] ?? []; - if (empty($sku_info) || empty($sku_info['goods'])) throw new CommonException(get_lang('SHOP_GOODS_DELISTED'));//无效的商品 - $sku_info['member_discount'] = $sku_info['goods']['member_discount'] ?? ''; - //商品原价 - $sku_info['original_price'] = $sku_info['price']; - //获取活动价格 - $sku_info['show_type'] = 'original_price'; - $sku_info['discount_money'] = 0; - $item_goods_type = $sku_info['goods']['goods_type']; - - if (!in_array($item_goods_type, $has_goods_types)) $has_goods_types[] = $item_goods_type; - - $sku_info['num'] = $num; - $sku_info['market_type'] = $market_type;//活动类型 - $sku_info['market_type_id'] = $market_type_id;//活动id - // 计算商品小计 - $price = $sku_info['price']; - $sku_info['goods_money'] = $price * $num; - $goods_money += $sku_info['goods_money']; - $body = $body ? $body . ($sku_info['sku_name'] . $sku_info['goods']['goods_name']) : ($sku_info['sku_name'] . $sku_info['goods']['goods_name']); - $goods_list[$sku_id] = $sku_info; - } - - $this->basic['has_goods_types'] = $has_goods_types; - $this->basic['total_num'] = $total_num; - $this->goods_data = $goods_list; - $this->basic['goods_money'] = $goods_money; - $this->basic['body'] = $body; - return $order_data; - } - - -} diff --git a/niucloud/addon/shop/app/service/core/third_addon/order/CoreOrderNoticeService.php b/niucloud/addon/shop/app/service/core/third_addon/order/CoreOrderNoticeService.php deleted file mode 100644 index 77be8c5a8..000000000 --- a/niucloud/addon/shop/app/service/core/third_addon/order/CoreOrderNoticeService.php +++ /dev/null @@ -1,89 +0,0 @@ - 'shop', - 'source_order_id' => $refund_data['order_id'], - 'relate_source' => $relate_source, - 'relate_order_id' => $relate_order_id, - 'refund_type' => $refund_data[ 'refund_type' ], - 'refund_reason' => $refund_data[ 'reason' ], - 'remark' => $refund_data[ 'remark' ], - 'refund_voucher' => $refund_data[ 'voucher' ], - 'order_refund_no'=>$refund_data['order_refund_no'], - ]); - } - - /** - * 发送给插件 - 商城订单退款关闭通知 - * @param $refund_data - * @param $relate_source - * @param $relate_order_id - * @return void - */ - public function sendRefundCloseNotice($refund_data, $relate_source, $relate_order_id) - { - event('ThirdOrderRefundCloseNotice', [ - 'source' => 'shop', - 'source_order_id' => $refund_data['order_id'], - 'relate_source' => $relate_source, - 'relate_order_id' => $relate_order_id, - 'reason' => $refund_data['reason'], - 'refund_no' => $refund_data['refund_no'], - ]); - } - /** - * 发送给插件 - 商城订单退款完成通知 - * @param $refund_data - * @param $relate_source - * @param $relate_order_id - * @return void - */ - public function sendRefundFinishNotice($refund_data, $relate_source, $relate_order_id) - { - event('ThirdOrderRefundFinishNotice', [ - 'source' => 'shop', - 'source_order_id' => $refund_data['order_id'], - 'source_order_item_id' => $refund_data['order_goods_id'], - 'relate_source' => $relate_source, - 'relate_order_id' => $relate_order_id, - 'reason' => $refund_data['reason'], - 'refund_type' => $refund_data['refund_type'], - 'apply_time' => $refund_data['create_time'], - 'apply_money' => $refund_data['apply_money'], - 'is_refund_third_cost' => $refund_data['is_refund_delivery'],//是否退三方费用 比如退配送费 - 'money' => $refund_data['money'], - 'refund_no' => $refund_data['refund_no'], - 'order_refund_no'=>$refund_data['order_refund_no'], - ]); - } - - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/service/core/third_addon/order/CoreSeckillOrderCreateService.php b/niucloud/addon/shop/app/service/core/third_addon/order/CoreSeckillOrderCreateService.php deleted file mode 100644 index 599c3a849..000000000 --- a/niucloud/addon/shop/app/service/core/third_addon/order/CoreSeckillOrderCreateService.php +++ /dev/null @@ -1,375 +0,0 @@ -model = new Order(); - } - - - /** - * 秒杀订单参数设置 - * @param $params - * @return void - */ - public function setSeckillParam($params) - { - $param = [ - 'order_from' => $params['order_from'] ?? '', - 'member_id' => $params['member_id'], - 'extend_data' => [ - 'relate_id' => $params['seckill_id'], - 'relate_order_id' => $params['id'], - 'relate_source' => 'seckill' - ], - 'delivery' => [ - 'delivery_type' => 'express', - ], - 'take_address' => [ - 'taker_name' => $params['taker_name'], - 'taker_mobile' => $params['taker_mobile'], - 'taker_province' => $params['taker_province'], - 'taker_city' => $params['taker_city'], - 'taker_district' => $params['taker_district'], - 'taker_address' => $params['taker_address'], - 'taker_full_address' => $params['taker_full_address'], - 'taker_longitude' => $params['taker_longitude'] ?? '', - 'taker_latitude' => $params['taker_latitude'] ?? '', - ], - 'sku_data' => [ - [ - 'sku_id' => $params['source_sku_id'], - 'num' => $params['num'], - 'seckill_price' => $params['goods_price'] - ] - ], - 'pay' => $params['pay'], - 'delivery_money'=>$params['delivery_money'] ?? 0, - ]; - $this->param = $param; - $this->extend_data = $this->param[ 'extend_data' ] ?? []; - } - - - /** - * 秒杀订单创建 - * @param array $data - * @return array - */ - public function create(array $data) - { - //参数赋值 - $this->setSeckillParam($data); - //检查会员 - $this->checkMember($data); - //订单计算 - $this->calculate($data); - //普通订单校验库存 - $this->checkStock($this->goods_data); - - $order_data = [ - //订单整体 - 'order_no' => create_no(), - 'ip' => request()->ip(), - 'order_from' => $data['order_from'], - 'order_type' => OrderDict::TYPE, - 'status' => OrderDict::WAIT_PAY, - 'body' => $this->basic['body'], - 'member_id' => $data['member_id'], - 'goods_money' => $this->basic['goods_money'], - 'delivery_money' => $this->basic['delivery_money'] ?? 0, - 'discount_money' => $this->basic['discount_money'] ?? 0, - 'order_money' => $this->basic['order_money'], - 'pay_money' => $this->basic['order_money'], - 'has_goods_types' => $this->basic['has_goods_types'],//包含的商品形式 - 'delivery_type' => $this->delivery['delivery_type'] ?? '', - 'taker_name' => $this->delivery['take_address']['taker_name'] ?? '', - 'taker_mobile' => $this->delivery['take_address']['taker_mobile'] ?? '', - 'taker_province' => $this->delivery['take_address']['taker_province'] ?? 0, - 'taker_city' => $this->delivery['take_address']['taker_city'] ?? 0, - 'taker_district' => $this->delivery['take_address']['taker_district'] ?? 0, - 'taker_address' => $this->delivery['take_address']['taker_address'] ?? '', - 'taker_full_address' => $this->delivery['take_address']['taker_full_address'] ?? '', - 'taker_longitude' => $this->delivery['take_address']['taker_longitude'] ?? '', - 'taker_latitude' => $this->delivery['take_address']['taker_latitude'] ?? '', - 'take_store_id' => $this->delivery['take_store']['store_id'] ?? 0, - 'member_remark' => $this->param['member_remark'] ?? '',//买家留言 - 'relate_id' => $this->extend_data['relate_id'] ?? 0,//关联id - 'activity_type' => $this->extend_data['relate_source'] ?? '', // 活动类型 - 'relate_order_id' => $this->extend_data['relate_order_id'] ?? 0, - 'relate_source' => $this->extend_data['relate_source'] ?? '', - 'out_trade_no' => isset($data['pay']) ? $data['pay']['out_trade_no'] : '', - ]; - - $order_goods_data = [];//项 - $write_goods_data = array_merge($this->goods_data, $this->impulse_buy_list); - foreach ($write_goods_data as $v) { - $order_goods_data[] = [ - 'member_id' => $data['member_id'], - 'goods_id' => $v['goods_id'], - 'sku_id' => $v['sku_id'], - 'goods_name' => $v['goods']['goods_name'], - 'sku_name' => $v['sku_name'], - 'goods_image' => $v['goods']['goods_cover'], - 'sku_image' => $v['sku_image'], - 'price' => $v['price'], - 'original_price' => $v['original_price'] ?? 0, - 'num' => $v['num'], - 'goods_money' => $v['goods_money'], - 'goods_type' => $v['goods']['goods_type'], - 'order_id' => &$this->order_id, - 'discount_money' => $v['discount_money'] ?? 0, - 'status' => OrderGoodsDict::NORMAL, - 'extend' => $v['extend'] ?? '', - 'is_gift' => $v['is_gift'] ?? 0, - 'order_goods_money' => $v['goods_money'] - ]; - } - - $result = $this->model->transaction(function () use ($data, $order_data, $order_goods_data) { - //生成订单 - $order = (new Order())->create($order_data); - $this->order_id = $order['order_id']; - //添加订单项目表 - $order_goods_model = new OrderGoods(); - $order_goods_model->insertAll($order_goods_data); - $order_data['order_id'] = $this->order_id; - $main_type = OrderLogDict::MEMBER; - $main_id = $order_data['member_id']; - //订单创建后事件 - CoreOrderEventService::orderCreateAfter([ 'order_id' => $this->order_id, 'order_data' => $order_data, 'order_goods_data' => $order_goods_data, 'cart_ids' => $this->cart_ids, 'basic' => get_object_vars($this), 'main_type' => $main_type, 'main_id' => $main_id, 'time' => time() ]); - //支付 - - $this->pay($data['pay'] ?? [], $order_data); - - $order_goods_ids = $order_goods_model->where(['order_id' => $this->order_id])->column("order_goods_id"); - return [ - 'trade_type' => $order_data['order_type'], - 'order_id' => $this->order_id, - 'order_goods_id' => $order_goods_ids, - 'seckill_order_id' => $order_data['relate_order_id'] - ]; - }); - - return $result; - } - - - public function pay($pay_info, $order_data) - { - $data = array( - 'out_trade_no' => $pay_info['out_trade_no'] ?? '', - 'trade_type' => 'shop', - 'trade_id' => $order_data['order_id'], - 'main_id' => $pay_info['main_id'] ?? '', - ); - //秒杀推送的订单不添加交易记录 - // $pay_model = new \app\model\pay\Pay(); - // $pay_model->create($data); - if ($order_data['pay_money'] > 0) { - event('PaySuccess', ['out_trade_no' => $data['out_trade_no'], 'trade_type' => $data['trade_type'], 'trade_id' => $data['trade_id'], 'main_id' => $data['main_id']]); - } else { - (new CoreOrderPayService())->pay($data); - } - } - - public function checkMember($data): void - { - $this->delivery['take_address'] = $data['take_address'] ?? []; - $member_info = (new CoreMemberService())->getInfoByMemberId($data['member_id'], 'status'); - if (empty($member_info)) throw new CommonException(get_lang('SHOP_ORDER_BUYER_NOT_FOUND'));//无效的账号 - if ($member_info['status'] == MemberDict::OFF) throw new CommonException(get_lang('SHOP_ORDER_BUYER_LOCKED'));//账号被锁定 - } - - /** - * 整理 - * @param array $data - * @return void - */ - public function calculate(array $data) - { - //参数赋值 - $this->delivery['take_address'] = $data['take_address'] ?? []; - $this->order_key = $this->param['order_key'] ?? ''; - $is_need_recalculate = $data['is_need_recalculate'] ?? 0; - if (empty($this->order_key) || $is_need_recalculate == 1) { - $this->confirm($this->order_key); - } - if (in_array(GoodsDict::VIRTUAL, $this->basic['has_goods_types'])) { - $this->delivery['delivery_type'] = OrderDeliveryDict::VIRTUAL; - } else { - $this->delivery['delivery_type'] = 'express'; - } - - //金额格式化 - $discount_money = $this->moneyFormat($this->basic['discount_money'] ?? 0);//优惠金额 - $delivery_money = $this->moneyFormat($this->param['delivery_money'] ?? 0); - $goods_money = $this->moneyFormat($this->basic['goods_money'] ?? 0); - $order_money = $this->moneyFormat($this->basic['order_money'] ?? 0); - $order_money = $this->moneyFormat($this->moneyCalculate($order_money, $delivery_money, $goods_money, -$discount_money)); - $this->basic['discount_money'] = $discount_money; - $this->basic['delivery_money'] = $delivery_money; - $this->basic['goods_money'] = $goods_money; - $this->basic['order_money'] = $order_money; - } - - /** - * 订单确认(基础信息查询并缓存) - * @return array|mixed - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function confirm($order_key = '') - { - //查看会员信息 - $member_id = $this->param['member_id']; - $this->member_id = $member_id; - $member_info = (new CoreMemberService())->getInfoByMemberId($member_id, 'nickname, headimg, balance, point, member_level,member_label'); - if (empty($member_info)) throw new CommonException(get_lang('SHOP_ORDER_BUYER_NOT_FOUND'));//无效的账号 - // 查询会员等级信息 - $member_info['member_level_id'] = $member_info['member_level']; - $member_info['member_level'] = (new MemberLevel())->where([['level_id', '=', $member_info['member_level']]])->field('level_id,level_benefits')->findOrEmpty()->toArray(); - //会员账户信息 - $this->buyer = $member_info; - $order_config = (new CoreOrderConfigService())->getConfig() ?? []; - $this->form_id = $order_config['form_id']; - //查询商品信息 - $this->getGoodsData(); - return true; - } - - - /** - * 商品相关数据 - * @return array - * @throws DataNotFoundException - * @throws DbException - * @throws ModelNotFoundException - */ - public function getGoodsData() - { - $this->extend_data = $this->param['extend_data'] ?? []; - $sku_data = $this->param['sku_data'] ?? []; - if (empty($sku_data)) throw new CommonException(get_lang('SHOP_GOODS_DELISTED'));//无效的数据 - $sku_ids = array_column($sku_data, 'sku_id'); - $sku_condition = array( - ['sku_id', 'in', $sku_ids] - ); - $sku_list = (new GoodsSku())->where($sku_condition)->with(['goods'])->field('sku_id, sku_name, sku_image, goods_id, price, stock, weight, volume,sku_id, sku_spec_format,member_price, sale_price')->select()->toArray(); - $sku_list = array_column($sku_list, null, 'sku_id'); - //商品数据 查询商品列表 - $order_data = []; - $goods_list = []; - $goods_money = 0; - $total_num = 0; - $body = ''; - //订单中包含的商品形式 - $has_goods_types = []; - foreach ($sku_data as $v) { - $sku_id = $v['sku_id']; - $num = $v['num']; - $total_num += $num; - $market_type = $v['market_type'] ?? ''; - $market_type_id = $v['market_type_id'] ?? 0; - $sku_info = $sku_list[$sku_id] ?? []; - if (empty($sku_info)) throw new CommonException(get_lang('SHOP_GOODS_DELISTED'));//无效的商品 - $sku_info['member_discount'] = $sku_info['goods']['member_discount'] ?? ''; - //商品原价 - $sku_info['original_price'] = $sku_info['price']; - //获取活动价格 - $sku_info['show_type'] = 'original_price'; - $sku_info['price'] = $v['seckill_price']; - $sku_info['active_id'] = $v['seckill_id'] ?? ''; - $sku_info['discount_money'] = 0; - $item_goods_type = $sku_info['goods']['goods_type']; - - // 商品限购处理 - if (isset($this->limit_buy['goods_' . $sku_info['goods_id']])) { - $this->limit_buy['goods_' . $sku_info['goods_id']]['num'] += $num; - } else { - $this->limit_buy['goods_' . $sku_info['goods_id']] = [ - 'goods_id' => $sku_info['goods_id'], - 'goods_name' => $sku_info['goods']['goods_name'], - 'stock' => $sku_info['goods']['stock'], - 'num' => $num, - 'is_limit' => $sku_info['goods']['is_limit'], - 'limit_type' => $sku_info['goods']['limit_type'], - 'max_buy' => $sku_info['goods']['max_buy'], - 'min_buy' => $sku_info['goods']['min_buy'] - ]; - } - - if (!in_array($item_goods_type, $has_goods_types)) $has_goods_types[] = $item_goods_type; - - $sku_info['num'] = $num; - $sku_info['market_type'] = $market_type;//活动类型 - $sku_info['market_type_id'] = $market_type_id;//活动id - - // 计算商品小计 - $price = $sku_info['price']; - $sku_info['goods_money'] = $price * $num; - $goods_money += $sku_info['goods_money']; - $body = $body ? $body . ($sku_info['sku_name'] . $sku_info['goods']['goods_name']) : ($sku_info['sku_name'] . $sku_info['goods']['goods_name']); - $goods_list[$sku_id] = $sku_info; - } - - $this->basic['has_goods_types'] = $has_goods_types; - $this->basic['total_num'] = $total_num; - $this->goods_data = $goods_list; - $this->basic['goods_money'] = $goods_money; - $this->basic['body'] = $body; - return $order_data; - } - - -} diff --git a/niucloud/addon/shop/app/upgrade/v621/upgrade.sql b/niucloud/addon/shop/app/upgrade/v621/upgrade.sql deleted file mode 100644 index 672e6c30a..000000000 --- a/niucloud/addon/shop/app/upgrade/v621/upgrade.sql +++ /dev/null @@ -1,149 +0,0 @@ - -CREATE TABLE `shop_point_exchange_order` ( - `order_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '兑换记录id', - `order_no` varchar(255) NOT NULL DEFAULT '' COMMENT '订单编号', - `out_trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '支付流水表', - `exchange_id` int(11) NOT NULL DEFAULT '0' COMMENT '兑换活动id', - `exchange_name` varchar(255) NOT NULL DEFAULT '' COMMENT '兑换商品名称', - `exchange_image` varchar(600) NOT NULL DEFAULT '' COMMENT '兑换商品图片 ', - `type` varchar(50) NOT NULL DEFAULT '' COMMENT '兑换类型', - `member_id` int(11) NOT NULL DEFAULT '0' COMMENT '消费会员id', - `member_address_id` int(11) NOT NULL DEFAULT '0' COMMENT '会员地址id', - `relate_id` int(11) NOT NULL DEFAULT '0' COMMENT '关联业务id', - `relate_order_id` int(11) NOT NULL DEFAULT '0' COMMENT '关联订单id', - `point` int(11) NOT NULL DEFAULT '0' COMMENT '使用积分', - `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '支付金额', - `balance` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '赠送余额', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `pay_time` int(11) NOT NULL DEFAULT '0' COMMENT '兑换时间', - `close_time` int(11) NOT NULL DEFAULT '0' COMMENT '关闭时间', - `delete_time` int(11) NOT NULL DEFAULT '0' COMMENT '订单删除', - `num` int(11) NOT NULL DEFAULT '0' COMMENT '兑换数量', - `status` varchar(50) NOT NULL DEFAULT '' COMMENT '订单状态', - `order_money` decimal(10,2) NOT NULL COMMENT '订单金额', - PRIMARY KEY (`order_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='积分兑换订单表'; - - -CREATE TABLE `shop_point_exchange` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '兑换活动主键id', - `type` varchar(255) NOT NULL DEFAULT '' COMMENT '兑换类型(商品、优惠券、红包)', - `names` varchar(255) NOT NULL DEFAULT '' COMMENT '兑换标题', - `title` varchar(255) NOT NULL COMMENT '副标题', - `image` text COMMENT '图片', - `status` int(11) NOT NULL DEFAULT '0' COMMENT '兑换状态 0 下架 1上架 -1 删除', - `product_detail` text COMMENT '兑换产品信息', - `point` int(11) NOT NULL DEFAULT '0' COMMENT '兑换所需积分', - `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '兑换所需金额', - `limit_num` int(11) NOT NULL DEFAULT '0' COMMENT '限制数量', - `content` text COMMENT '产品介绍', - `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序', - `total_point_num` int(11) DEFAULT '0' COMMENT '积分消费总额', - `total_price_num` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '总支付金额', - `total_order_num` int(11) DEFAULT '0' COMMENT '订单笔数', - `total_member_num` int(11) DEFAULT '0' COMMENT '参与会员数', - `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `stock` int(11) NOT NULL DEFAULT '0' COMMENT '库存', - `total_exchange_num` int(11) NOT NULL DEFAULT '0' COMMENT '兑换数量', - PRIMARY KEY (`id`,`total_price_num`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='积分兑换表'; - - -ALTER TABLE `shop_order_goods` ADD COLUMN `extend` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '数据项扩展'; - -ALTER TABLE `shop_order_goods` ADD COLUMN `verify_count` INT(11) NOT NULL DEFAULT 0 COMMENT '已核销次数'; - -ALTER TABLE `shop_order_goods` ADD COLUMN `verify_expire_time` INT(11) NOT NULL DEFAULT 0 COMMENT '过期时间 0 为永久'; - -ALTER TABLE `shop_order_goods` ADD COLUMN `is_verify` INT(11) NOT NULL DEFAULT 0 COMMENT '是否需要核销'; - -ALTER TABLE `shop_order` ADD COLUMN `relate_id` INT(11) NOT NULL DEFAULT 0 COMMENT '关联id'; - -ALTER TABLE `shop_order` ADD COLUMN `point` INT(11) NOT NULL DEFAULT 0 COMMENT '积分兑换'; - -ALTER TABLE `shop_order` ADD COLUMN `activity_type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '营销类型'; - -ALTER TABLE `shop_goods_sku` ADD COLUMN `member_price` TEXT DEFAULT NULL COMMENT '会员价,json格式,指定会员价,数据结构为:{"level_1":"10.00","level_2":"10.00"}'; - -CREATE TABLE `shop_goods_attr` ( - `attr_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '商品参数id', - `attr_name` varchar(255) NOT NULL DEFAULT '' COMMENT '参数名称', - `attr_value_format` text COMMENT '参数值,json格式', - `sort` int(11) NOT NULL DEFAULT '0' COMMENT '参数排序号', - PRIMARY KEY (`attr_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='商品参数表'; - - -ALTER TABLE `shop_goods` ADD COLUMN `virtual_auto_delivery` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '虚拟商品是否自动发货'; - -ALTER TABLE `shop_goods` ADD COLUMN `virtual_receive_type` VARCHAR(255) NOT NULL DEFAULT 'artificial' COMMENT '虚拟商品收货方式,auto:自动收货,artificial:买家确认收货,verify:到店核销'; - -ALTER TABLE `shop_goods` ADD COLUMN `virtual_verify_type` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '虚拟商品核销有效期类型,0:不限,1:购买后几日有效,2:指定过期日期'; - -ALTER TABLE `shop_goods` ADD COLUMN `virtual_indate` INT(11) NOT NULL DEFAULT 0 COMMENT '虚拟到期时间'; - -ALTER TABLE `shop_goods` ADD COLUMN `attr_id` INT(11) NOT NULL DEFAULT 0 COMMENT '商品参数id'; - -ALTER TABLE `shop_goods` ADD COLUMN `attr_format` TEXT DEFAULT NULL COMMENT '商品参数内容,json格式'; - -ALTER TABLE `shop_goods` ADD COLUMN `is_discount` INT(11) NOT NULL DEFAULT 0 COMMENT '是否参与限时折扣'; - -ALTER TABLE `shop_goods` ADD COLUMN `member_discount` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '会员等级折扣,不参与:空,会员折扣:discount,指定会员价:fixed_price'; - -ALTER TABLE `shop_goods` ADD COLUMN `poster_id` INT(11) NOT NULL DEFAULT 0 COMMENT '海报id'; - -ALTER TABLE `shop_goods` MODIFY `supplier_id` INT(11) NOT NULL DEFAULT 0 COMMENT '供应商id' AFTER `virtual_indate`; - -ALTER TABLE `shop_goods` MODIFY `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间' AFTER `poster_id`; - -ALTER TABLE `shop_goods` MODIFY `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '修改时间' AFTER `create_time`; - -ALTER TABLE `shop_goods` MODIFY `delete_time` INT(11) NOT NULL DEFAULT 0 COMMENT '删除时间' AFTER `update_time`; - - -CREATE TABLE `shop_active` ( - `active_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '活动id', - `active_name` varchar(255) NOT NULL DEFAULT '' COMMENT '活动名称', - `active_desc` text COMMENT '活动说明', - `active_type` varchar(255) NOT NULL DEFAULT '' COMMENT '活动类型(店铺活动,会员活动,商品活动)', - `active_goods_type` varchar(255) NOT NULL DEFAULT '' COMMENT '商品活动类型(单品,独立商品,店铺整体商品)', - `active_goods_info` text COMMENT '参与活动商品信息', - `active_class` varchar(255) NOT NULL DEFAULT '' COMMENT '活动类别', - `active_class_category` varchar(255) NOT NULL DEFAULT '' COMMENT '活动类别子分类(活动管理)', - `relate_member` varchar(1000) NOT NULL DEFAULT '' COMMENT '参与会员条件(默认全部)', - `active_value` text COMMENT '活动扩展信息数据', - `start_time` int(11) NOT NULL DEFAULT '0' COMMENT '活动开始时间', - `end_time` int(11) NOT NULL DEFAULT '0' COMMENT '活动结束时间', - `active_status` varchar(50) NOT NULL DEFAULT '' COMMENT '活动状态', - `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '添加时间', - `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', - `active_order_money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '活动累计金额', - `active_order_num` int(11) NOT NULL DEFAULT '0' COMMENT '活动累计订单数', - `active_member_num` int(11) NOT NULL DEFAULT '0' COMMENT '活动参与会员数', - `active_success_num` int(11) NOT NULL DEFAULT '0' COMMENT '活动成功参与会员数', - PRIMARY KEY (`active_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='店铺营销活动表(整体活动)'; - - -CREATE TABLE `shop_active_goods` ( - `active_goods_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '活动商品id', - `active_id` int(11) NOT NULL DEFAULT '0' COMMENT '活动id', - `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '商品id', - `active_goods_type` varchar(255) NOT NULL DEFAULT '' COMMENT '商品活动类型(单品,独立商品,店铺整体商品)', - `active_class` varchar(255) NOT NULL DEFAULT '' COMMENT '商品活动类别', - `active_goods_label` varchar(1000) NOT NULL DEFAULT '' COMMENT '活动商品标签(针对活动有标签)', - `active_goods_category` varchar(1000) NOT NULL DEFAULT '' COMMENT '活动商品分类(针对活动有分类)', - `active_goods_value` text COMMENT '活动商品信息数据', - `active_goods_status` varchar(50) NOT NULL DEFAULT '' COMMENT '活动状态', - `active_goods_point` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '活动商品积分(展示,搜索)', - `active_goods_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '活动商品价格(展示,搜索)', - `active_goods_stock` int(11) NOT NULL DEFAULT '0' COMMENT '活动商品库存(针对参与库存)', - `active_goods_order_money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '活动累计金额', - `active_goods_order_num` int(11) NOT NULL DEFAULT '0' COMMENT '活动累计订单数', - `active_goods_member_num` int(11) NOT NULL DEFAULT '0' COMMENT '活动参与会员数', - `active_goods_success_num` int(11) NOT NULL DEFAULT '0' COMMENT '活动成功参与会员数', - PRIMARY KEY (`active_goods_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='店铺营销活动'; - -ALTER TABLE `shop_order_refund` ADD COLUMN `is_refund_delivery` INT(11) NOT NULL DEFAULT 0 COMMENT '是否退运费'; diff --git a/niucloud/addon/shop/app/upgrade/v630/Upgrade.php b/niucloud/addon/shop/app/upgrade/v630/Upgrade.php deleted file mode 100644 index f3e0fed5f..000000000 --- a/niucloud/addon/shop/app/upgrade/v630/Upgrade.php +++ /dev/null @@ -1,50 +0,0 @@ -handleData(); - } - - /** - * 处理商品数据 - */ - private function handleData() - { - - $poster = new CorePosterService(); - $poster_model = new Poster(); - - // 删除旧模板 - $poster_model->where([ [ 'addon', '=', 'shop' ] ])->delete(); - - // 创建默认商品海报 - $template = $poster->getTemplateList('shop', 'shop_goods')[ 0 ]; - $poster->add('shop', [ - 'name' => $template[ 'name' ], - 'type' => $template[ 'type' ], - 'value' => $template[ 'data' ], - 'status' => 1, - 'is_default' => 1 - ]); - - // 创建默认积分商品海报 - $template = $poster->getTemplateList('shop', 'shop_point_goods')[ 0 ]; - $poster->add('shop', [ - 'name' => $template[ 'name' ], - 'type' => $template[ 'type' ], - 'value' => $template[ 'data' ], - 'status' => 1, - 'is_default' => 1 - ]); - - } - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/upgrade/v630/upgrade.sql b/niucloud/addon/shop/app/upgrade/v630/upgrade.sql deleted file mode 100644 index 4ad2ade40..000000000 --- a/niucloud/addon/shop/app/upgrade/v630/upgrade.sql +++ /dev/null @@ -1,64 +0,0 @@ - -ALTER TABLE `shop_point_exchange` CHANGE COLUMN `product_detail` `product_detail` TEXT DEFAULT NULL COMMENT '兑换产品信息'; - -DROP TABLE IF EXISTS `shop_order_batch_delivery`; -CREATE TABLE `shop_order_batch_delivery` ( - `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `main_id` INT(11) NOT NULL DEFAULT 0 COMMENT '操作人id', - `status` INT(11) NOT NULL DEFAULT 1 COMMENT '状态 进行中 已完成 已失败', - `type` VARCHAR(255) NOT NULL DEFAULT '操作类型 批量发货 批量打单 ....' COMMENT '操作类型', - `total_num` INT(11) NOT NULL DEFAULT 0 COMMENT '总发货单数', - `success_num` INT(11) NOT NULL DEFAULT 0 COMMENT '成功发货单数', - `fail_num` INT(11) NOT NULL DEFAULT 0 COMMENT '失败发货单数', - `data` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '导入文件的路径', - `output` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '对外输出记录', - `fail_output` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '失败记录', - `fail_remark` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '失败原因', - `create_time` INT(11) NOT NULL COMMENT '创建时间', - `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '操作时间', - PRIMARY KEY (`id`) -) -ENGINE = INNODB, -CHARACTER SET utf8mb4, -COLLATE utf8mb4_general_ci, -COMMENT = '订单批量发货表'; - - -DROP TABLE IF EXISTS `shop_delivery_electronic_sheet`; -CREATE TABLE `shop_delivery_electronic_sheet` ( - `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - `template_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '模板名称', - `express_company_id` INT(11) NOT NULL DEFAULT 0 COMMENT '物流公司id', - `customer_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '电子面单客户账号(CustomerName)', - `customer_pwd` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '电子面单密码(CustomerPwd)', - `send_site` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'SendSite', - `send_staff` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'SendStaff', - `month_code` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'MonthCode', - `pay_type` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '邮费支付方式(1:现付,2:到付,3:月结)', - `is_notice` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '快递员上门揽件(0:否,1:是)', - `status` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '状态(1:开启,0:关闭)', - `exp_type` INT(11) NOT NULL DEFAULT 0 COMMENT '物流公司业务类型', - `print_style` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '电子面单打印模板样式', - `is_default` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否默认(1:是,0:否)', - `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间', - `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '修改时间', - PRIMARY KEY (`id`) -) -ENGINE = INNODB, -CHARACTER SET utf8mb4, -COLLATE utf8mb4_general_ci, -COMMENT = '电子面单'; - -ALTER TABLE `shop_delivery_company` CHANGE COLUMN `express_no` `express_no` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '物流公司编号(用于物流跟踪)'; - -ALTER TABLE `shop_delivery_company` ADD COLUMN `express_no_electronic_sheet` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '物流公司编号(用于电子面单)'; - -ALTER TABLE `shop_delivery_company` ADD COLUMN `electronic_sheet_switch` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否支持电子面单(0:不支持,1:支持)'; - -ALTER TABLE `shop_delivery_company` ADD COLUMN `print_style` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '电子面单打印模板样式,json字符串'; - -ALTER TABLE `shop_delivery_company` ADD COLUMN `exp_type` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '物流公司业务类型,json字符串'; - -ALTER TABLE `shop_delivery_company` MODIFY `create_time` INT(11) NOT NULL DEFAULT 0 AFTER `exp_type`; - -ALTER TABLE `shop_delivery_company` MODIFY `update_time` INT(11) NOT NULL DEFAULT 0 AFTER `create_time`; diff --git a/niucloud/addon/shop/app/upgrade/v631/Upgrade.php b/niucloud/addon/shop/app/upgrade/v631/Upgrade.php deleted file mode 100644 index e97a676d4..000000000 --- a/niucloud/addon/shop/app/upgrade/v631/Upgrade.php +++ /dev/null @@ -1,49 +0,0 @@ -handleData(); - } - - /** - * 处理商品数据 - */ - private function handleData() - { - $diy_model = new Diy(); - $where = [ - [ 'value', '<>', '' ] - ]; - $field = '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' ] == 'ShopMemberInfo') { - if (!isset($diy_data[ 'value' ][ $ck ][ 'isShowAccount' ])) { - $diy_data[ 'value' ][ $ck ][ 'isShowAccount' ] = true; - } - - } - } - - $diy_data = json_encode($diy_data); - $diy_model->where([ [ 'id', '=', $v[ 'id' ] ] ])->update([ 'value' => $diy_data ]); - } - } - - } - -} \ No newline at end of file diff --git a/niucloud/addon/shop/app/upgrade/v631/upgrade.sql b/niucloud/addon/shop/app/upgrade/v631/upgrade.sql deleted file mode 100644 index 65eb4c254..000000000 --- a/niucloud/addon/shop/app/upgrade/v631/upgrade.sql +++ /dev/null @@ -1,2 +0,0 @@ - -ALTER TABLE `shop_order_refund` CHANGE COLUMN `delivery` `delivery` VARCHAR(3000) NOT NULL DEFAULT '' COMMENT '退货配送信息'; diff --git a/niucloud/addon/shop/app/upgrade/v640/Upgrade.php b/niucloud/addon/shop/app/upgrade/v640/Upgrade.php deleted file mode 100644 index 1d4d87a49..000000000 --- a/niucloud/addon/shop/app/upgrade/v640/Upgrade.php +++ /dev/null @@ -1,750 +0,0 @@ -handleData(); - } - - /** - * 处理商品数据 - */ - private function handleData() - { - - $label_group_model = new LabelGroup(); - $label_model = new Label(); - - // 添加默认商品标签分组 - $label_group_info = $label_group_model->where([ - [ 'group_name', '=', '默认' ] - ])->field('group_id')->findOrEmpty()->toArray(); - - if (!empty($label_group_info)) { - $group_id = $label_group_info[ 'group_id' ]; - } else { - $res = $label_group_model->create([ - 'group_name' => '默认', - 'create_time' => time(), - ]); - $group_id = $res->group_id; - } - - // 更新商品标签数据,标签分组id、效果设置、自定义颜色、图标、状态 - $label_model->where([ [ 'label_id', '>', 0 ] ])->update([ - 'group_id' => $group_id, - 'status' => 1, - 'style_type' => 'diy', - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(255, 65, 66, 1)', - 'border_color' => '' - ] - ]); - - $label_model = new Label(); - $label_list = $label_model->where([ - [ 'icon', 'in', [ 'addon/shop/goods/label/icon1.jpg', 'addon/shop/goods/label/icon2.jpg', 'addon/shop/goods/label/icon3.jpg' ] ] - ])->field('label_id,icon')->select()->toArray(); - if(!empty($label_list)) { - foreach ($label_list as $k => $v) { - if ($v[ 'icon' ] == 'addon/shop/goods/label/icon1.jpg') { - $label_model->where([ [ 'label_id', '=', $v[ 'label_id' ] ] ])->update([ - 'icon' => 'addon/shop/goods/label/icon1.png' - ]); - } else if ($v[ 'icon' ] == 'addon/shop/goods/label/icon2.jpg') { - $label_model->where([ [ 'label_id', '=', $v[ 'label_id' ] ] ])->update([ - 'icon' => 'addon/shop/goods/label/icon2.png' - ]); - } else if ($v[ 'icon' ] == 'addon/shop/goods/label/icon3.jpg') { - $label_model->where([ [ 'label_id', '=', $v[ 'label_id' ] ] ])->update([ - 'icon' => 'addon/shop/goods/label/icon3.png' - ]); - } - } - }else{ - // 添加商品标签 - $label_list = [ - [ - 'label_name' => '热卖', - 'group_id' => $group_id, - 'style_type' => 'diy', - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(250, 35, 28, 1)', - 'border_color' => '' - ], - 'icon' => '', - 'status' => 1, - 'sort' => 0, - 'create_time' => time() - ], - [ - 'label_name' => '新品推荐', - 'group_id' => $group_id, - 'style_type' => 'diy', - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(250, 35, 28, 1)', - 'border_color' => '' - ], - 'icon' => '', - 'status' => 1, - 'sort' => 1, - 'create_time' => time() - ], - [ - 'label_name' => '甄选优品', - 'group_id' => $group_id, - 'style_type' => 'diy', - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(250, 35, 28, 1)', - 'border_color' => '' - ], - 'icon' => '', - 'status' => 1, - 'sort' => 2, - 'create_time' => time() - ], - [ - 'label_name' => '百亿补贴', - 'group_id' => $group_id, - 'style_type' => 'icon', - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(250, 35, 28, 1)', - 'border_color' => '' - ], - 'icon' => 'addon/shop/goods/label/icon1.png', - 'status' => 1, - 'sort' => 3, - 'create_time' => time() - ], - [ - 'label_name' => '双11', - 'group_id' => $group_id, - 'style_type' => 'icon', - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(250, 35, 28, 1)', - 'border_color' => '' - ], - 'icon' => 'addon/shop/goods/label/icon2.png', - 'status' => 1, - 'sort' => 4, - 'create_time' => time() - ], - [ - 'label_name' => '双12', - 'group_id' => $group_id, - 'style_type' => 'icon', - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(250, 35, 28, 1)', - 'border_color' => '' - ], - 'icon' => 'addon/shop/goods/label/icon3.png', - 'status' => 1, - 'sort' => 5, - 'create_time' => time() - ] - ]; - $exist_label_list = $label_model->where([ - [ 'label_name', 'in', array_column($label_list, 'label_name', '') ] - ])->field('label_name')->select()->toArray(); - - if (!empty($exist_label_list)) { - $label_name_list = array_column($exist_label_list, 'label_name', ''); - - foreach ($label_list as $k => $v) { - if (in_array($v[ 'label_name' ], $label_name_list)) { - unset($label_list[ $k ]); - } - } - $label_list = array_values($label_list); - } - if (!empty($label_list)) { - $label_model->insertAll($label_list); - } - } - - // 创建素材 - $category_model = new SysAttachmentCategory(); - $category_info = $category_model->where([ - [ 'name', '=', '商城素材' ] - ])->field('id')->findOrEmpty()->toArray(); - - if (!empty($category_info)) { - $category_id = $category_info[ 'id' ]; - } else { - $attachment_category = $category_model->create([ - 'pid' => 0, - 'type' => 'image', - 'name' => '商城素材', - 'sort' => 1 - ]); - $category_id = $attachment_category->id; - } - - $attachment_model = new SysAttachment(); - $attachment_list = [ - [ - 'name' => time() . $category_id . 'banner1.jpg', // 附件名称 - 'real_name' => '轮播素材01', // 原始文件名 - 'path' => 'addon/shop/attachment/banner1.jpg', // 完整地址 - 'url' => 'addon/shop/attachment/banner1.jpg', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '82918', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'banner2.png', // 附件名称 - 'real_name' => '轮播素材02', // 原始文件名 - 'path' => 'addon/shop/attachment/banner2.png', // 完整地址 - 'url' => 'addon/shop/attachment/banner2.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '95324', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'banner3.png', // 附件名称 - 'real_name' => '轮播素材03', // 原始文件名 - 'path' => 'addon/shop/attachment/banner3.png', // 完整地址 - 'url' => 'addon/shop/attachment/banner3.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '97570', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'logo.png', // 附件名称 - 'real_name' => '生活圈', // 原始文件名 - 'path' => 'addon/shop/attachment/logo.png', // 完整地址 - 'url' => 'addon/shop/attachment/logo.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '1517', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_coupon.png', // 附件名称 - 'real_name' => '优惠券', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_coupon.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_coupon.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '30937', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_discount.png', // 附件名称 - 'real_name' => '限时折扣', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_discount.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_discount.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '33870', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_fenxiao.png', // 附件名称 - 'real_name' => '分销管理', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_fenxiao.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_fenxiao.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '24026', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_fenxiao_zone.png', // 附件名称 - 'real_name' => '分销专区', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_fenxiao_zone.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_fenxiao_zone.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '33429', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_giftcard.png', // 附件名称 - 'real_name' => '礼品卡', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_giftcard.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_giftcard.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '29399', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_my_address.png', // 附件名称 - 'real_name' => '收货地址', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_my_address.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_my_address.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '25280', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_my_newcomer.png', // 附件名称 - 'real_name' => '新人专享', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_my_newcomer.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_my_newcomer.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '32123', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_news_info.png', // 附件名称 - 'real_name' => '新闻资讯', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_news_info.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_news_info.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '27934', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_point_index.png', // 附件名称 - 'real_name' => '积分商城', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_point_index.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_point_index.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '27946 ', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_sign_in.png', // 附件名称 - 'real_name' => '签到', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_sign_in.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_sign_in.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '33576', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'notice.png', // 附件名称 - 'real_name' => '新闻咨询', // 原始文件名 - 'path' => 'addon/shop/attachment/notice.png', // 完整地址 - 'url' => 'addon/shop/attachment/notice.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '3069', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'picture_show_head_text2.png', // 附件名称 - 'real_name' => '品牌特卖', // 原始文件名 - 'path' => 'addon/shop/attachment/picture_show_head_text2.png', // 完整地址 - 'url' => 'addon/shop/attachment/picture_show_head_text2.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '2825', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'picture_show_head_text3.png', // 附件名称 - 'real_name' => '官方补贴', // 原始文件名 - 'path' => 'addon/shop/attachment/picture_show_head_text3.png', // 完整地址 - 'url' => 'addon/shop/attachment/picture_show_head_text3.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '2549', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'single_recommend_banner1.png', // 附件名称 - 'real_name' => '精选推荐01', // 原始文件名 - 'path' => 'addon/shop/attachment/single_recommend_banner1.png', // 完整地址 - 'url' => 'addon/shop/attachment/single_recommend_banner1.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '73548', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'single_recommend_banner2.png', // 附件名称 - 'real_name' => '精选推荐02', // 原始文件名 - 'path' => 'addon/shop/attachment/single_recommend_banner2.png', // 完整地址 - 'url' => 'addon/shop/attachment/single_recommend_banner2.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '61033', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'single_recommend_text1.png', // 附件名称 - 'real_name' => '精选推荐', // 原始文件名 - 'path' => 'addon/shop/attachment/single_recommend_text1.png', // 完整地址 - 'url' => 'addon/shop/attachment/single_recommend_text1.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '3664', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'my_cart.png', // 附件名称 - 'real_name' => '购物车', // 原始文件名 - 'path' => 'addon/shop/attachment/my_cart.png', // 完整地址 - 'url' => 'addon/shop/attachment/my_cart.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '31921', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'home_delivery.png', // 附件名称 - 'real_name' => '送货上门', // 原始文件名 - 'path' => 'addon/shop/attachment/home_delivery.png', // 完整地址 - 'url' => 'addon/shop/attachment/home_delivery.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '30811', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_all_class.png', // 附件名称 - 'real_name' => '全部分类', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_all_class.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_all_class.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '25427', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_balance.png', // 附件名称 - 'real_name' => '我的余额', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_balance.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_balance.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '31437', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_collect.png', // 附件名称 - 'real_name' => '我的收藏', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_collect.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_collect.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '24533', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_coupon_01.png', // 附件名称 - 'real_name' => '瓜分好券', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_coupon_01.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_coupon_01.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '27068', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_leaderboard.png', // 附件名称 - 'real_name' => '排行榜', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_leaderboard.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_leaderboard.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '30098', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_member.png', // 附件名称 - 'real_name' => '会员中心', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_member.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_member.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '30793', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_point.png', // 附件名称 - 'real_name' => '我的积分', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_point.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_point.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '28112', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_shop.png', // 附件名称 - 'real_name' => '线上商城', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_shop.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_shop.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '23057', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nav_travel.png', // 附件名称 - 'real_name' => '旅游出行', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_travel.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_travel.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '27429', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'nva_group_booking.png', // 附件名称 - 'real_name' => '拼团返利', // 原始文件名 - 'path' => 'addon/shop/attachment/nva_group_booking.png', // 完整地址 - 'url' => 'addon/shop/attachment/nva_group_booking.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '30421', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'head_01.png', // 附件名称 - 'real_name' => '超值爆款', // 原始文件名 - 'path' => 'addon/shop/attachment/head_01.png', // 完整地址 - 'url' => 'addon/shop/attachment/head_01.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '3958', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'head_02.png', // 附件名称 - 'real_name' => '限时折扣', // 原始文件名 - 'path' => 'addon/shop/attachment/head_02.png', // 完整地址 - 'url' => 'addon/shop/attachment/head_02.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '2408', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'head_03.png', // 附件名称 - 'real_name' => '商品榜单', // 原始文件名 - 'path' => 'addon/shop/attachment/head_03.png', // 完整地址 - 'url' => 'addon/shop/attachment/head_03.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '2621', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'image_ads_01.png', // 附件名称 - 'real_name' => '商品低至五折', // 原始文件名 - 'path' => 'addon/shop/attachment/image_ads_01.png', // 完整地址 - 'url' => 'addon/shop/attachment/image_ads_01.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '44566', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_01.png', // 附件名称 - 'real_name' => '魔方素材01', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_01.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_01.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '36850', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_02.png', // 附件名称 - 'real_name' => '魔方素材02', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_02.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_02.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '26463', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_03.png', // 附件名称 - 'real_name' => '魔方素材03', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_03.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_03.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '29142', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_04.png', // 附件名称 - 'real_name' => '魔方素材04', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_04.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_04.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '26068', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_05.png', // 附件名称 - 'real_name' => '魔方素材05', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_05.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_05.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '107422', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_06.png', // 附件名称 - 'real_name' => '魔方素材06', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_06.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_06.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '130868', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_07.png', // 附件名称 - 'real_name' => '魔方素材07', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_07.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_07.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '129386', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ], - [ - 'name' => time() . $category_id . 'active_cube_08.png', // 附件名称 - 'real_name' => '魔方素材08', // 原始文件名 - 'path' => 'addon/shop/attachment/active_cube_08.png', // 完整地址 - 'url' => 'addon/shop/attachment/active_cube_08.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '81778', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ] - ]; - $exist_attachment_list = $attachment_model->where([ - [ '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); - } - - } - -} diff --git a/niucloud/addon/shop/app/upgrade/v640/upgrade.sql b/niucloud/addon/shop/app/upgrade/v640/upgrade.sql deleted file mode 100644 index 53766094d..000000000 --- a/niucloud/addon/shop/app/upgrade/v640/upgrade.sql +++ /dev/null @@ -1,140 +0,0 @@ - -ALTER TABLE `shop_order_refund` CHANGE COLUMN `delivery` `delivery` VARCHAR(3000) NOT NULL DEFAULT '' COMMENT '退货配送信息'; - -ALTER TABLE `shop_order_goods` ADD COLUMN `shop_active_refund` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '商家主动退款(0否 1是)'; - -ALTER TABLE `shop_order_goods` ADD COLUMN `shop_active_refund_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '商家主动退款金额'; - -DROP TABLE IF EXISTS `shop_newcomer_member_records`; -CREATE TABLE `shop_newcomer_member_records` ( - `record_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', - `member_id` INT(11) NOT NULL DEFAULT 0 COMMENT '会员id', - `validity_time` INT(11) NOT NULL DEFAULT 0 COMMENT '有效期', - `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '参与时间', - `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间', - `is_join` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否参与', - `order_id` INT(11) NOT NULL DEFAULT 0 COMMENT '参与订单id', - `goods_ids` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '参与商品id集合', - `sku_ids` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '参与商品规格id集合', - PRIMARY KEY (`record_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='新人专享会员参与记录表'; - - -DROP TABLE IF EXISTS `shop_goods_stat`; -CREATE TABLE `shop_goods_stat` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `date` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '日期', - `date_time` INT(11) NOT NULL DEFAULT 0 COMMENT '时间戳', - `goods_id` INT(11) NOT NULL DEFAULT 0 COMMENT '商品id', - `cart_num` INT(11) NOT NULL DEFAULT 0 COMMENT '加入购物车数量', - `sale_num` INT(11) NOT NULL DEFAULT 0 COMMENT '商品销量(下单数)', - `pay_num` INT(11) NOT NULL DEFAULT 0 COMMENT '支付件数', - `pay_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '支付总金额', - `refund_num` INT(11) NOT NULL DEFAULT 0 COMMENT '退款件数', - `refund_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '退款总额', - `access_num` INT(11) NOT NULL DEFAULT 0 COMMENT '访问次数(浏览量)', - `collect_num` INT(11) NOT NULL DEFAULT 0 COMMENT '收藏数量', - `evaluate_num` INT(11) NOT NULL DEFAULT 0 COMMENT '评论数量', - `goods_visit_member_count` INT(11) NOT NULL DEFAULT 0 COMMENT '商品访客数', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='商品数据统计'; - - -DROP TABLE IF EXISTS `shop_goods_label_group`; -CREATE TABLE `shop_goods_label_group` ( - group_id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '分组ID', - group_name VARCHAR(255) NOT NULL DEFAULT '' COMMENT '分组名称', - sort INT(11) NOT NULL DEFAULT 0 COMMENT '排序', - create_time INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间', - update_time INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间', - PRIMARY KEY (group_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='商品标签分组表'; - -ALTER TABLE `shop_goods_label` ADD COLUMN `group_id` INT(11) NOT NULL DEFAULT 0 COMMENT '标签分组id'; - -ALTER TABLE `shop_goods_label` ADD COLUMN `style_type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '效果设置,diy:自定义,icon:图片'; - -ALTER TABLE `shop_goods_label` ADD COLUMN `color_json` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '自定义颜色(文字、背景、边框),json格式'; - -ALTER TABLE `shop_goods_label` ADD COLUMN `icon` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '图标'; - -ALTER TABLE `shop_goods_label` ADD COLUMN status INT(11) NOT NULL DEFAULT 0 COMMENT '状态,1:启用,0;关闭'; - -ALTER TABLE `shop_goods_label` MODIFY `memo` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '标签说明' AFTER `status`; - -ALTER TABLE `shop_goods_label` MODIFY `sort` INT(11) NOT NULL DEFAULT 0 COMMENT '排序' AFTER `memo`; - -ALTER TABLE `shop_goods_label` MODIFY `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间' AFTER `sort`; - -ALTER TABLE `shop_goods_label` MODIFY `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间' AFTER `create_time`; - - -DROP TABLE IF EXISTS `shop_goods_browse`; -CREATE TABLE `shop_goods_browse` ( - `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - `member_id` INT(11) NOT NULL DEFAULT 0 COMMENT '浏览人', - `sku_id` INT(11) NOT NULL DEFAULT 0 COMMENT 'sku_id', - `goods_id` INT(11) NOT NULL DEFAULT 0 COMMENT '商品id', - `browse_time` INT(11) NOT NULL DEFAULT 0 COMMENT '浏览时间', - `goods_cover` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '商品图片', - `goods_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '商品名称', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='商品浏览历史'; - -ALTER TABLE `shop_goods` ADD COLUMN `goods_video` VARCHAR(555) DEFAULT '' COMMENT '商品视频'; - -ALTER TABLE `shop_goods` ADD COLUMN `is_limit` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '商品是否限购(0:否 1:是)'; - -ALTER TABLE `shop_goods` ADD COLUMN `limit_type` TINYINT(4) NOT NULL DEFAULT 1 COMMENT '限购类型,1:单次限购,2:单人限购'; - -ALTER TABLE `shop_goods` ADD COLUMN `max_buy` INT(11) NOT NULL DEFAULT 0 COMMENT '限购数'; - -ALTER TABLE `shop_goods` ADD COLUMN `min_buy` INT(11) NOT NULL DEFAULT 0 COMMENT '起购数'; - -ALTER TABLE `shop_goods` ADD COLUMN `is_gift` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '商品是否赠品(0:否 1:是)'; - -ALTER TABLE `shop_goods` ADD COLUMN `access_num` INT(11) NOT NULL DEFAULT 0 COMMENT '访问次数(浏览量)'; - -ALTER TABLE `shop_goods` ADD COLUMN `cart_num` INT(11) NOT NULL DEFAULT 0 COMMENT '加入购物车数量'; - -ALTER TABLE `shop_goods` ADD COLUMN `pay_num` INT(11) NOT NULL DEFAULT 0 COMMENT '支付件数'; - -ALTER TABLE `shop_goods` ADD COLUMN `pay_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '支付总金额'; - -ALTER TABLE `shop_goods` ADD COLUMN `collect_num` INT(11) NOT NULL DEFAULT 0 COMMENT '收藏数量'; - -ALTER TABLE `shop_goods` ADD COLUMN `evaluate_num` INT(11) NOT NULL DEFAULT 0 COMMENT '评论数量'; - -ALTER TABLE `shop_goods` ADD COLUMN `refund_num` INT(11) NOT NULL DEFAULT 0 COMMENT '退款件数'; - -ALTER TABLE `shop_goods` ADD COLUMN `refund_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '退款总额'; - -ALTER TABLE `shop_goods` MODIFY `goods_video` VARCHAR(555) DEFAULT '' COMMENT '商品视频' AFTER `goods_image`; - -ALTER TABLE `shop_goods` MODIFY `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间' AFTER `refund_money`; - -ALTER TABLE `shop_goods` MODIFY `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '修改时间' AFTER `create_time`; - -ALTER TABLE `shop_goods` MODIFY `delete_time` INT(11) NOT NULL DEFAULT 0 COMMENT '删除时间' AFTER `update_time`; - -ALTER TABLE `shop_delivery_local_delivery` ADD COLUMN `time_is_open` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '配送时间设置 0 关闭 1 开启'; - -ALTER TABLE `shop_delivery_local_delivery` ADD COLUMN `time_type` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '时间选取类型 0 每天 1 自定义'; - -ALTER TABLE `shop_delivery_local_delivery` ADD COLUMN `time_week` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '营业时间 周一 周二.......'; - -ALTER TABLE `shop_delivery_local_delivery` ADD COLUMN `time_interval` INT(11) NOT NULL DEFAULT 30 COMMENT '时段设置单位分钟'; - -ALTER TABLE `shop_delivery_local_delivery` ADD COLUMN `advance_day` INT(11) NOT NULL DEFAULT 0 COMMENT '时间选择需提前多少天'; - -ALTER TABLE `shop_delivery_local_delivery` ADD COLUMN `most_day` INT(11) NOT NULL DEFAULT 7 COMMENT '最多可预约多少天'; - -ALTER TABLE `shop_delivery_local_delivery` ADD COLUMN `start_time` INT(11) NOT NULL DEFAULT 0 COMMENT '当日的起始时间'; - -ALTER TABLE `shop_delivery_local_delivery` ADD COLUMN `end_time` INT(11) NOT NULL DEFAULT 0 COMMENT '当日的营业结束时间'; - -ALTER TABLE `shop_delivery_local_delivery` ADD COLUMN `delivery_time` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '配送时间段'; - -ALTER TABLE `shop_active_goods` ADD COLUMN `sku_id` INT(11) DEFAULT 0 COMMENT '商品规格id'; - -ALTER TABLE `shop_active_goods` MODIFY `sku_id` INT(11) DEFAULT 0 COMMENT '商品规格id' AFTER `goods_id`; diff --git a/niucloud/addon/shop/app/upgrade/v641/Upgrade.php b/niucloud/addon/shop/app/upgrade/v641/Upgrade.php deleted file mode 100644 index 720e44c49..000000000 --- a/niucloud/addon/shop/app/upgrade/v641/Upgrade.php +++ /dev/null @@ -1,82 +0,0 @@ -handleData(); - } - - /** - * 处理商品数据 - */ - private function handleData() - { - - // 同步最近两天的商品统计 - $start_time = Carbon::today()->getTimestamp(); - $date_arr = []; - for ($i = 1; $i >= 0; $i--) { - $date_arr[] = date('Y-m-d', $start_time - ( 86400 * $i )); - } - ( new StatisticsService() )->syncStatGoods($date_arr); - - $diy_model = new Diy(); - $where = [ - [ 'value', '<>', '' ] - ]; - $field = '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' ] == 'SingleRecommend') { - - if ($diy_data[ 'value' ][ $ck ][ 'list' ]) { - - foreach ($diy_data[ 'value' ][ $ck ][ 'list' ] as $ps_k => $ps_v) { - if ($ps_v[ 'imageUrl' ] == 'addon/shop/diy/index/style3/single_recommend_banner1.png') { - $diy_data[ 'value' ][ $ck ][ 'list' ][ $ps_k ][ 'imageUrl' ] = 'addon/shop/diy/index/style3/single_recommend_banner1.jpg'; - } else if ($ps_v[ 'imageUrl' ] == 'addon/shop/diy/index/style3/single_recommend_banner2.png') { - $diy_data[ 'value' ][ $ck ][ 'list' ][ $ps_k ][ 'imageUrl' ] = 'addon/shop/diy/index/style3/single_recommend_banner2.jpg'; - } - } - } - - } - - // 轮播搜索 组件 - if ($cv[ 'componentName' ] == 'CarouselSearch') { - - if (!empty($diy_data[ 'value' ][ $ck ][ 'swiper' ][ 'list' ]) && $diy_data[ 'value' ][ $ck ][ 'swiper' ][ 'list' ][ 0 ][ 'imageUrl' ] == 'addon/shop/diy/index/style3/banner1.jpg') { - $diy_data[ 'value' ][ $ck ][ 'swiper' ][ 'imageHeight' ] = 274; - $diy_data[ 'value' ][ $ck ][ 'swiper' ][ 'list' ][ 0 ][ 'imgWidth' ] = 750; - $diy_data[ 'value' ][ $ck ][ 'swiper' ][ 'list' ][ 0 ][ 'imgHeight' ] = 580; - $diy_data[ 'value' ][ $ck ][ 'swiper' ][ 'list' ][ 0 ][ 'width' ] = 355; - $diy_data[ 'value' ][ $ck ][ 'swiper' ][ 'list' ][ 0 ][ 'height' ] = 274.53; - } - - } - - } - - $diy_data = json_encode($diy_data); - $diy_model->where([ [ 'id', '=', $v[ 'id' ] ] ])->update([ 'value' => $diy_data ]); - } - } - - } - -} diff --git a/niucloud/addon/shop/app/upgrade/v641/upgrade.sql b/niucloud/addon/shop/app/upgrade/v641/upgrade.sql deleted file mode 100644 index fd3e72791..000000000 --- a/niucloud/addon/shop/app/upgrade/v641/upgrade.sql +++ /dev/null @@ -1,84 +0,0 @@ - -DROP TABLE IF EXISTS `shop_manjian_record`; - -ALTER TABLE `shop_order_goods` ADD COLUMN `is_gift` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '是否是赠品(0否 1是)'; - - -DROP TABLE IF EXISTS `shop_manjian_give_records`; -CREATE TABLE `shop_manjian_give_records` ( - `record_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '赠送记录id', - `manjian_id` INT(11) NOT NULL DEFAULT 0 COMMENT '满减送活动id', - `order_id` INT(11) NOT NULL DEFAULT 0 COMMENT '订单id', - `member_id` INT(11) NOT NULL DEFAULT 0 COMMENT '会员id', - `level` INT(11) NOT NULL DEFAULT 0 COMMENT '优惠层级', - `point` INT(11) NOT NULL DEFAULT 0 COMMENT '赠送积分数量', - `balance` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '赠送余额', - `coupon_json` TEXT DEFAULT NULL COMMENT '赠送优惠券', - `goods_json` TEXT DEFAULT NULL COMMENT '赠送商品', - `sku_ids` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '满足条件的商品规格id', - `create_time` int NOT NULL DEFAULT 0 COMMENT '创建时间', - PRIMARY KEY (`record_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='满减送记录表'; - - -ALTER TABLE `shop_goods` CHANGE COLUMN `is_gift` `is_gift` TINYINT NOT NULL DEFAULT 0 COMMENT '商品是否赠品(0:否 1:是)'; - - -DROP TABLE IF EXISTS `shop_manjian_goods`; -CREATE TABLE `shop_manjian_goods` ( - `manjian_goods_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '满减商品活动id', - `manjian_id` INT(11) NOT NULL DEFAULT 0 COMMENT '满减活动id', - `goods_id` INT(11) NOT NULL DEFAULT 0 COMMENT '商品id', - `sku_id` INT(11) NOT NULL DEFAULT 0 COMMENT '规格id', - `goods_type` VARCHAR(255) NOT NULL DEFAULT 'all_goods' COMMENT '参与商品 all_goods:全部商品参与 selected_goods:指定商品 selected_goods_not:指定商品不参与 ', - `status` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '状态(0未开始1进行中2已结束-1已关闭)', - PRIMARY KEY (`manjian_goods_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='满减商品表'; - - -DROP TABLE IF EXISTS `shop_manjian`; -CREATE TABLE `shop_manjian` ( - `manjian_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '满减活动id', - `manjian_name` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '名称', - `condition_type` VARCHAR(255) NOT NULL DEFAULT 'over_n_yuan' COMMENT '条件类型 over_n_yuan:满N元 over_n_piece:满N件', - `goods_type` VARCHAR(255) NOT NULL DEFAULT 'all_goods' COMMENT '参与商品 all_goods:全部商品参与 selected_goods:指定商品 selected_goods_not:指定商品不参与 ', - `join_member_type` VARCHAR(255) NOT NULL DEFAULT 'all_member' COMMENT '参与会员 all_member:所有会员参与 selected_member_level:指定会员等级 selected_member_label:指定会员标签 ', - `rule_type` VARCHAR(255) NOT NULL DEFAULT 'ladder' COMMENT '优惠规格 ladder:阶梯优惠 cycle:循环优惠', - `rule_json` TEXT DEFAULT NULL COMMENT '优惠规则json', - `goods_ids` TEXT DEFAULT NULL COMMENT '商品id集', - `level_ids` TEXT DEFAULT NULL COMMENT '会员等级id集', - `label_ids` TEXT DEFAULT NULL COMMENT '会员标签id集', - `status` INT(11) NOT NULL DEFAULT 0 COMMENT '状态(0未开始1进行中2已结束-1已关闭)', - `start_time` INT(11) NOT NULL DEFAULT 0 COMMENT '开始时间', - `end_time` INT(11) NOT NULL DEFAULT 0 COMMENT '结束时间', - `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间', - `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '修改时间', - `remark` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '备注', - `total_order_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '活动累计金额', - `total_order_num` INT(11) NOT NULL DEFAULT 0 COMMENT '活动累计订单数', - `total_member_num` INT(11) NOT NULL DEFAULT 0 COMMENT '活动参与会员数', - `total_point` INT(11) NOT NULL DEFAULT 0 COMMENT '活动累计赠送积分', - `total_balance` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '活动累计赠送余额', - `total_coupon_num` INT(11) NOT NULL DEFAULT 0 COMMENT '活动累计赠送优惠券数', - `total_goods_num` INT(11) NOT NULL DEFAULT 0 COMMENT '活动累计赠送商品数', - PRIMARY KEY (`manjian_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='满减活动表'; - - -DROP TABLE IF EXISTS `shop_goods_rank`; -CREATE TABLE `shop_goods_rank` ( - `rank_id` INT(11) NOT NULL AUTO_INCREMENT, - `name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '榜单名称', - `rank_type` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '排行周期 day=天,week=周,month=月, quarter=季度', - `goods_source` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '来源类型 goods=指定商品,category=指定分类,brand=指定品牌, label=指定标签', - `rule_type` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '排序规则 sale=按照销量,collect=按收藏数,evaluate=按评价数, access=按照浏览量', - `goods_json` TEXT DEFAULT NULL COMMENT '商品信息', - `category_ids` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '商品分类id', - `brand_ids` VARCHAR(255) NOT NULL DEFAULT '0' COMMENT '商品品牌id', - `label_ids` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '商品标签id,多个逗号隔开', - `sort` INT(11) NOT NULL DEFAULT 0 COMMENT '排序号', - `status` INT(11) NOT NULL DEFAULT 1 COMMENT '显示状态(0不显示 1显示)', - `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间', - `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '修改时间', - PRIMARY KEY (`rank_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='商品排行榜'; diff --git a/niucloud/addon/shop/app/upgrade/v643/Upgrade.php b/niucloud/addon/shop/app/upgrade/v643/Upgrade.php deleted file mode 100644 index c9b5b4618..000000000 --- a/niucloud/addon/shop/app/upgrade/v643/Upgrade.php +++ /dev/null @@ -1,63 +0,0 @@ -handleData(); - } - - /** - * 处理商品数据 - */ - private function handleData() - { - // 创建素材 - $category_model = new SysAttachmentCategory(); - $category_info = $category_model->where([ - [ 'name', '=', '商城素材' ] - ])->field('id')->findOrEmpty()->toArray(); - - if (!empty($category_info)) { - $category_id = $category_info[ 'id' ]; - } else { - $attachment_category = $category_model->create([ - 'pid' => 0, - 'type' => 'image', - 'name' => '商城素材', - 'sort' => 1 - ]); - $category_id = $attachment_category->id; - } - - $attachment_model = new SysAttachment(); - - $attachment_list = [ - 'name' => time() . $category_id . 'nav_sow_community.png', // 附件名称 - 'real_name' => '种草社区', // 原始文件名 - 'path' => 'addon/shop/attachment/nav_sow_community.png', // 完整地址 - 'url' => 'addon/shop/attachment/nav_sow_community.png', // 网络地址 - 'dir' => 'addon/shop/attachment', // 附件路径 - 'att_size' => '24576', // 附件大小 - 'att_type' => 'image', // 附件类型image,video - 'storage_type' => 'local', // 图片上传类型 local本地 aliyun 阿里云oss qiniu 七牛 .... - 'cate_id' => $category_id, // 素材分类id - 'create_time' => time() - ]; - $exist_attachment_list = $attachment_model->where([ - [ 'path', '=', 'addon/shop/attachment/nav_sow_community.png' ] - ])->field('path')->findOrEmpty()->toArray(); - - if (empty($exist_attachment_list)) { - $attachment_model->create($attachment_list); - } - - } - -} diff --git a/niucloud/addon/shop/app/upgrade/v643/upgrade.sql b/niucloud/addon/shop/app/upgrade/v643/upgrade.sql deleted file mode 100644 index 6cd1523ea..000000000 --- a/niucloud/addon/shop/app/upgrade/v643/upgrade.sql +++ /dev/null @@ -1,12 +0,0 @@ - -ALTER TABLE `shop_order_goods` ADD COLUMN `form_record_id` INT(11) NOT NULL DEFAULT 0 COMMENT '万能表单记录id'; - -ALTER TABLE `shop_order` ADD COLUMN `form_record_id` INT(11) NOT NULL DEFAULT 0 COMMENT '万能表单记录id'; - -ALTER TABLE `shop_goods` ADD COLUMN `form_id` INT(11) NOT NULL DEFAULT 0 COMMENT '万能表单id'; - -ALTER TABLE `shop_goods` MODIFY `form_id` INT(11) NOT NULL DEFAULT 0 COMMENT '万能表单id' AFTER `poster_id`; - -ALTER TABLE `shop_goods_brand` ADD COLUMN `color_json` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '自定义颜色(文字、背景、边框),json格式'; - -ALTER TABLE `shop_goods_brand` MODIFY `color_json` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '自定义颜色(文字、背景、边框),json格式' AFTER `desc`; diff --git a/niucloud/addon/shop/app/upgrade/v644/Upgrade.php b/niucloud/addon/shop/app/upgrade/v644/Upgrade.php deleted file mode 100644 index 3ecdd92d6..000000000 --- a/niucloud/addon/shop/app/upgrade/v644/Upgrade.php +++ /dev/null @@ -1,51 +0,0 @@ -handleData(); - $this->handleThemeColorData(); - } - - /** - * 处理商品数据 - */ - private function handleData() - { - try { - - $brand_model = new Brand(); - // 更新商品品牌自定义颜色 - $brand_model->where([ [ 'brand_id', '>', 0 ] ])->update([ - 'color_json' => [ - 'text_color' => 'rgba(255, 255, 255, 1)', - 'bg_color' => 'rgba(255, 65, 66, 1)', - 'border_color' => '' - ] - ]); - } catch (\Exception $e) { - - } - - } - - /** - * 处理主题风格配色数据 - */ - private function handleThemeColorData() - { - $listener = new ThemeColorListener(); - $addon_theme = $listener->handle([ 'key' => 'shop' ]); - $diy_service = new DiyService(); - $diy_service->initAddonThemeColorData('shop', $addon_theme); - } - -} diff --git a/niucloud/addon/shop/app/upgrade/v644/upgrade.sql b/niucloud/addon/shop/app/upgrade/v644/upgrade.sql deleted file mode 100644 index e7094cd5e..000000000 --- a/niucloud/addon/shop/app/upgrade/v644/upgrade.sql +++ /dev/null @@ -1,4 +0,0 @@ - -ALTER TABLE `shop_coupon` ADD COLUMN `give_count` INT(11) NOT NULL DEFAULT 0 COMMENT '已发放数量'; - -ALTER TABLE `shop_coupon` MODIFY `give_count` INT(11) NOT NULL DEFAULT 0 COMMENT '已发放数量' AFTER `receive_count`; diff --git a/niucloud/addon/shop/app/upgrade/v645/Upgrade.php b/niucloud/addon/shop/app/upgrade/v645/Upgrade.php deleted file mode 100644 index 741091af1..000000000 --- a/niucloud/addon/shop/app/upgrade/v645/Upgrade.php +++ /dev/null @@ -1,86 +0,0 @@ -handleDiscountData(); - } - - /** - * 处理限时折扣数据 - */ - private function handleDiscountData() - { - $data = ( new Active() )->where([ [ 'active_class', '=', ActiveDict::DISCOUNT ] ])->with([ 'activeGoods' ])->select()->toArray(); - try { - if (!empty($data)) { - $discount_data = $discount_goods_data = []; - foreach ($data as $value) { - $discount_data[] = [ - 'discount_id' => $value[ 'active_id' ], - 'name' => $value[ 'active_name' ], - 'remark' => $value[ 'active_desc' ], - 'start_time' => $this->getFormatTime($value[ 'start_time' ]), - 'end_time' => $this->getFormatTime($value[ 'end_time' ]), - 'status' => $value[ 'active_status' ], - 'create_time' => $this->getFormatTime($value[ 'create_time' ]), - 'update_time' => $this->getFormatTime($value[ 'update_time' ]), - ]; - if (!empty($value[ 'activeGoods' ])) { - foreach ($value[ 'activeGoods' ] as $v) { - $active_goods_value = json_decode($v[ 'active_goods_value' ], true); - if (!empty($active_goods_value)) { - foreach ($active_goods_value as $item) { - $discount_goods_data[] = [ - 'discount_id' => $v[ 'active_id' ], - 'goods_id' => $v[ 'goods_id' ], - 'sku_id' => $item[ 'sku_id' ], - 'status' => $v[ 'active_goods_status' ], - 'type' => $item[ 'discount_type' ], - 'rate' => $item[ 'discount_rate' ], - 'reduce_money' => $item[ 'reduce_money' ], - 'discount_price' => $item[ 'discount_price' ], - 'is_enabled' => $item[ 'is_enabled' ] ?? 0, - ]; - } - } - } - } - } - } - Db::startTrans(); - if (!empty($discount_data) && !empty($discount_goods_data)) { - ( new Discount() )->where([ [ 'discount_id', '>', 0 ] ])->delete(); - ( new DiscountGoods() )->where([ [ 'discount_goods_id', '>', 0 ] ])->delete(); - ( new Discount() )->insertAll($discount_data); - ( new DiscountGoods() )->insertAll($discount_goods_data); - } - Db::commit(); - return true; - } catch (\Exception $e) { - Db::rollback(); - } - } - - public function getFormatTime($time) - { - if (is_numeric($time) && ( strlen($time) == 10 || strlen($time) == 13 )) { - return (int) $time; - } - - $timestamp = strtotime($time); - - return $timestamp !== false ? $timestamp : 0; - } - -} diff --git a/niucloud/addon/shop/app/upgrade/v645/upgrade.sql b/niucloud/addon/shop/app/upgrade/v645/upgrade.sql deleted file mode 100644 index 165dd04d1..000000000 --- a/niucloud/addon/shop/app/upgrade/v645/upgrade.sql +++ /dev/null @@ -1,89 +0,0 @@ - -DROP TABLE IF EXISTS `shop_discount`; -CREATE TABLE `shop_discount` -( - `discount_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '活动id', - `name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '活动名称', - `remark` TEXT NOT NULL COMMENT '活动说明', - `start_time` INT(11) NOT NULL DEFAULT 0 COMMENT '活动开始时间', - `end_time` INT(11) NOT NULL DEFAULT 0 COMMENT '活动结束时间', - `status` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '活动状态', - `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '添加时间', - `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '修改时间', - `order_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '活动累计金额', - `order_num` INT(11) NOT NULL DEFAULT 0 COMMENT '活动累计订单数', - `member_num` INT(11) NOT NULL DEFAULT 0 COMMENT '活动参与会员数', - `success_num` INT(11) NOT NULL DEFAULT 0 COMMENT '活动成功参与会员数', - PRIMARY KEY (`discount_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='限时折扣表'; - - -DROP TABLE IF EXISTS `shop_discount_goods`; -CREATE TABLE `shop_discount_goods` -( - `discount_goods_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '活动商品id', - `discount_id` INT(11) NOT NULL DEFAULT 0 COMMENT '活动id', - `goods_id` INT(11) NOT NULL DEFAULT 0 COMMENT '商品id', - `sku_id` INT(11) NOT NULL DEFAULT 0 COMMENT '商品规格id', - `status` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '商品状态', - `type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '折扣类型', - `rate` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '折扣', - `reduce_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '减钱', - `discount_price` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '活动商品价格(展示,搜索)', - `order_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '活动累计金额', - `order_num` INT(11) NOT NULL DEFAULT 0 COMMENT '活动累计订单数', - `member_num` INT(11) NOT NULL DEFAULT 0 COMMENT '活动参与会员数', - `success_num` INT(11) NOT NULL DEFAULT 0 COMMENT '活动成功参与会员数', - `is_enabled` INT(11) NOT NULL DEFAULT 1 COMMENT '是否参与活动', - PRIMARY KEY (`discount_goods_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='限时折扣商品表'; - - -DROP TABLE IF EXISTS `shop_coupon_send_records`; -CREATE TABLE `shop_coupon_send_records` -( - `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', - `coupon_id` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券id', - `send_num` INT(11) NOT NULL COMMENT '每位会员发放数量', - `range_type` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '发券范围', - `range_param` TEXT DEFAULT NULL COMMENT '范围对应参数', - `success_num` INT(11) NOT NULL DEFAULT 0 COMMENT '发放成功数', - `status` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '状态 wait-待发送 process-发送中 finish-结束', - `member_num` INT(11) NOT NULL DEFAULT 0 COMMENT '发放会员数', - `end_time` INT(11) NOT NULL DEFAULT 0 COMMENT '发放结束时间', - `admin_uid` INT(11) NOT NULL DEFAULT 0 COMMENT '操作人id', - `admin_username` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '操作人名称', - `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间', - `update_time` INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='优惠券发券记录表'; - -ALTER TABLE `shop_store` CHANGE COLUMN `trade_time` `trade_time` VARCHAR (255) NOT NULL DEFAULT '' COMMENT '营业时间(文本展示使用)'; - -ALTER TABLE `shop_store` ADD COLUMN `time_week` TEXT DEFAULT NULL COMMENT '自定义的营业时间["0","1","2","3","4","5","6"]周日-周六'; - -ALTER TABLE `shop_store` ADD COLUMN `trade_time_json` TEXT DEFAULT NULL COMMENT '营业时间'; - -ALTER TABLE `shop_store` ADD COLUMN `time_interval` INT(11) NOT NULL DEFAULT 0 COMMENT '时段设置(分钟)'; - -ALTER TABLE `shop_store` MODIFY `create_time` INT (11) NOT NULL DEFAULT 0 COMMENT '添加时间' AFTER `time_interval`; - -ALTER TABLE `shop_store` MODIFY `update_time` INT (11) NOT NULL DEFAULT 0 COMMENT '更新时间' AFTER `create_time`; - -ALTER TABLE `shop_order` CHANGE COLUMN `delivery_time` `delivery_time` INT NOT NULL DEFAULT 0 COMMENT '订单发货时间/自提订单自提时间'; - -ALTER TABLE `shop_order` ADD COLUMN `buyer_ask_delivery_time` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '购买人要求的配送/发货/自提时间(文本)'; - -ALTER TABLE `shop_order` MODIFY `buyer_ask_delivery_time` VARCHAR (255) NOT NULL DEFAULT '' COMMENT '购买人要求的配送/发货/自提时间(文本)' AFTER `delivery_time`; - -ALTER TABLE `shop_point_exchange_order` MODIFY COLUMN `order_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '订单金额'; - -ALTER TABLE `shop_order_batch_delivery` CHANGE COLUMN type type VARCHAR(255) NOT NULL DEFAULT '' COMMENT '操作类型 批量发货 批量打单 ....'; - -ALTER TABLE `shop_order_batch_delivery` MODIFY COLUMN create_time INT NOT NULL DEFAULT 0 COMMENT '创建时间'; - -ALTER TABLE `shop_goods_evaluate` MODIFY COLUMN content VARCHAR(3000) NOT NULL DEFAULT '' COMMENT '评价内容'; - -ALTER TABLE `shop_delivery_local_delivery` COMMENT = '自提点表'; - -ALTER TABLE `shop_delivery_company` COMMENT = '站点快递表'; diff --git a/niucloud/addon/shop/app/upgrade/v647/Upgrade.php b/niucloud/addon/shop/app/upgrade/v647/Upgrade.php deleted file mode 100644 index eed4c5e71..000000000 --- a/niucloud/addon/shop/app/upgrade/v647/Upgrade.php +++ /dev/null @@ -1,55 +0,0 @@ -handleGoodsData(); - } - - /** - * 处理商品数据,参数模板结构调整 - */ - private function handleGoodsData() - { - try { - $delete_list = ( new Goods() )->onlyTrashed()->where([ [ 'attr_ids', '<>', '' ] ])->field('goods_id,attr_ids')->select()->toArray(); - if (!empty($delete_list)) { - foreach ($delete_list as $k => $v) { - if (gettype($v[ 'attr_ids' ]) != 'array') { - if (!empty($v[ 'attr_ids' ])) { - $delete_list[ $k ][ 'attr_ids' ] = [ $v[ 'attr_ids' ] ]; - } else { - $delete_list[ $k ][ 'attr_ids' ] = []; - } - ( new Goods() )->onlyTrashed()->where([ [ 'goods_id', '=', $v[ 'goods_id' ] ] ])->update([ 'attr_ids' => $delete_list[ $k ][ 'attr_ids' ] ]); - } - } - } - - $list = ( new Goods() )->where([ [ 'attr_ids', '<>', '' ] ])->field('goods_id,attr_ids')->select()->toArray(); - if (!empty($list)) { - foreach ($list as $k => $v) { - if (gettype($v[ 'attr_ids' ]) != 'array') { - if (!empty($v[ 'attr_ids' ])) { - $list[ $k ][ 'attr_ids' ] = [ $v[ 'attr_ids' ] ]; - } else { - $list[ $k ][ 'attr_ids' ] = []; - } - ( new Goods() )->where([ [ 'goods_id', '=', $v[ 'goods_id' ] ] ])->update([ 'attr_ids' => $list[ $k ][ 'attr_ids' ] ]); - } - } - } - - } catch (\Exception $e) { - Log::write('商城插件升级v6.4.7版本,发生错误,Line:' . $e->getLine() . ',Message:' . $e->getMessage() . ',File:' . $e->getFile()); - } - } - -} diff --git a/niucloud/addon/shop/app/upgrade/v647/upgrade.sql b/niucloud/addon/shop/app/upgrade/v647/upgrade.sql deleted file mode 100644 index 37fd49c3a..000000000 --- a/niucloud/addon/shop/app/upgrade/v647/upgrade.sql +++ /dev/null @@ -1,10 +0,0 @@ - -ALTER TABLE `shop_order_delivery` ADD COLUMN third_delivery VARCHAR(50) NOT NULL DEFAULT '' COMMENT '配送方(三方配送)'; - -ALTER TABLE `shop_order_delivery` MODIFY `remark` VARCHAR(1000) NOT NULL DEFAULT '' AFTER `third_delivery`; - -ALTER TABLE `shop_order_delivery` MODIFY `create_time` INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间' AFTER `remark`; - -ALTER TABLE `shop_goods` CHANGE COLUMN `attr_id` `attr_ids` TEXT DEFAULT NULL COMMENT '商品参数id,支持多个'; - -ALTER TABLE `shop_delivery_local_delivery` CHANGE COLUMN `delivery_time` `delivery_time` TEXT DEFAULT NULL COMMENT '配送时间段'; diff --git a/niucloud/addon/shop/app/upgrade/v648/Upgrade.php b/niucloud/addon/shop/app/upgrade/v648/Upgrade.php deleted file mode 100644 index 4511274c7..000000000 --- a/niucloud/addon/shop/app/upgrade/v648/Upgrade.php +++ /dev/null @@ -1,15 +0,0 @@ -handle(); - } - -} diff --git a/niucloud/addon/shop/app/upgrade/v648/upgrade.sql b/niucloud/addon/shop/app/upgrade/v648/upgrade.sql deleted file mode 100644 index e29d9a49d..000000000 --- a/niucloud/addon/shop/app/upgrade/v648/upgrade.sql +++ /dev/null @@ -1,60 +0,0 @@ - -ALTER TABLE `shop_discount_goods` CHANGE COLUMN `rate` `rate` DECIMAL (10, 2) NOT NULL DEFAULT 0.00 COMMENT '折扣'; - -ALTER TABLE `shop_order_refund_log` CHANGE COLUMN `main_type` `main_type` VARCHAR (255) NOT NULL DEFAULT '' COMMENT '操作人类型'; - -ALTER TABLE `shop_order_refund_log` CHANGE COLUMN `status` `status` INT NOT NULL DEFAULT 0 COMMENT '退款状态'; - -ALTER TABLE `shop_order_refund_log` CHANGE COLUMN `content` `content` VARCHAR (255) NOT NULL DEFAULT '' COMMENT '日志内容'; - -ALTER TABLE `shop_order_refund_log` CHANGE COLUMN `create_time` `create_time` INT NOT NULL DEFAULT 0 COMMENT '创建时间'; - -ALTER TABLE `shop_order_refund` ADD COLUMN `delete_time` INT(11) NOT NULL DEFAULT 0 COMMENT '是否删除(针对后台)'; - -ALTER TABLE `shop_order_log` CHANGE COLUMN `main_type` `main_type` VARCHAR (255) NOT NULL DEFAULT '' COMMENT '操作人类型'; - -ALTER TABLE `shop_order_log` CHANGE COLUMN `content` `content` VARCHAR (255) NOT NULL DEFAULT '' COMMENT '日志内容'; - -ALTER TABLE `shop_order_goods` ADD COLUMN `delete_time` INT(11) NOT NULL DEFAULT 0 COMMENT '是否删除(针对后台)'; - -ALTER TABLE `shop_order_discount` ADD COLUMN `member_id` INT(11) NOT NULL DEFAULT 0 COMMENT '会员id'; - -ALTER TABLE `shop_order_discount` ADD COLUMN `goods_id` INT(11) NOT NULL DEFAULT 0 COMMENT '商品id'; - -ALTER TABLE `shop_order_discount` ADD COLUMN `sku_id` INT(11) NOT NULL DEFAULT 0 COMMENT 'sku_id'; - -ALTER TABLE `shop_order_delivery` CHANGE COLUMN `third_delivery` `third_delivery` VARCHAR (50) NOT NULL DEFAULT '' COMMENT '配送方(三方配送)'; - -ALTER TABLE `shop_order_delivery` CHANGE COLUMN `remark` `remark` VARCHAR (1000) NOT NULL DEFAULT '' COMMENT '备注'; - -ALTER TABLE `shop_order` ADD COLUMN `relate_order_id` INT(11) NOT NULL DEFAULT 0 COMMENT '关联活动来源订单id'; - -ALTER TABLE `shop_order` ADD COLUMN `relate_source` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'seckill 秒杀系统 '; - -ALTER TABLE `shop_goods` ADD COLUMN `diy_detail_id` INT(11) NOT NULL DEFAULT 0 COMMENT '自定义详情id'; - -ALTER TABLE `shop_goods` MODIFY `diy_detail_id` INT (11) NOT NULL DEFAULT 0 COMMENT '自定义详情id' AFTER form_id; - -ALTER TABLE `shop_delivery_electronic_sheet` ADD COLUMN `interface_type` CHAR(20) NOT NULL DEFAULT '' COMMENT '快递公司类型 kdbird:快递鸟 kd100:快递100'; - -ALTER TABLE `shop_delivery_electronic_sheet` ADD COLUMN `exp_type_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '物流公司业务类型名称'; - -ALTER TABLE `shop_delivery_electronic_sheet` ADD COLUMN `temp_id` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '主模版:快递100用'; - -ALTER TABLE `shop_delivery_electronic_sheet` ADD COLUMN `child_temp_id` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '子模版:快递100用'; - -ALTER TABLE `shop_delivery_electronic_sheet` ADD COLUMN `back_temp_id` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '回单模版:快递100用'; - -ALTER TABLE `shop_delivery_electronic_sheet` ADD COLUMN `interface_data` TEXT DEFAULT NULL COMMENT '接口参数'; - -ALTER TABLE `shop_delivery_company` CHANGE COLUMN `express_no` `express_no` VARCHAR (255) NOT NULL DEFAULT '' COMMENT '快递鸟:物流公司编号(用于物流跟踪)'; - -ALTER TABLE `shop_delivery_company` CHANGE COLUMN `express_no_electronic_sheet` `express_no_electronic_sheet` VARCHAR (255) NOT NULL DEFAULT '' COMMENT '快递鸟:物流公司编号(用于电子面单)'; - -ALTER TABLE `shop_delivery_company` ADD COLUMN `kd100_express_no` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '快递100:物流公司编号(用于物流跟踪)'; - -ALTER TABLE `shop_delivery_company` ADD COLUMN `kd100_express_no_electronic_sheet` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '快递100:物流公司编号(用于电子面单)'; - -ALTER TABLE `shop_point_exchange` MODIFY COLUMN `title` VARCHAR (255) NOT NULL DEFAULT '' COMMENT '副标题'; - -ALTER TABLE `shop_coupon_send_records` MODIFY COLUMN `send_num` INT NOT NULL DEFAULT 0 COMMENT '每位会员发放数量'; diff --git a/niucloud/addon/shop/app/upgrade/v649/upgrade.sql b/niucloud/addon/shop/app/upgrade/v649/upgrade.sql deleted file mode 100644 index 2b13e8cbf..000000000 --- a/niucloud/addon/shop/app/upgrade/v649/upgrade.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE `shop_invoice` - CHANGE COLUMN trade_id trade_id VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '业务id集'; - -ALTER TABLE `shop_invoice` - ADD COLUMN pay_voucher TEXT DEFAULT NULL COMMENT '支付凭证'; \ No newline at end of file diff --git a/niucloud/addon/shop/app/upgrade/v650/Upgrade.php b/niucloud/addon/shop/app/upgrade/v650/Upgrade.php deleted file mode 100644 index 0fa2ead8b..000000000 --- a/niucloud/addon/shop/app/upgrade/v650/Upgrade.php +++ /dev/null @@ -1,35 +0,0 @@ -handleStoreData(); - } - - /** - * 处理门店数据 - * @return true - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function handleStoreData() - { - $store_list = (new Store())->where([['store_no', '=', '']])->select()->toArray(); - - foreach ($store_list as $store) { - $store_id = $store['store_id']; - (new Store())->where('store_id', $store_id)->update([ - 'store_no' => create_no('', $store['store_id']), - ]); - } - return true; - } - -} diff --git a/niucloud/addon/shop/app/upgrade/v650/upgrade.sql b/niucloud/addon/shop/app/upgrade/v650/upgrade.sql deleted file mode 100644 index 7bea9450e..000000000 --- a/niucloud/addon/shop/app/upgrade/v650/upgrade.sql +++ /dev/null @@ -1,176 +0,0 @@ -ALTER TABLE `shop_store` - ADD COLUMN `store_no` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '门店编号' AFTER store_id; - -ALTER TABLE `shop_store` - ADD COLUMN `contact_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '联系人' AFTER store_mobile; - -ALTER TABLE `shop_store` - ADD COLUMN `support_delivery` TEXT DEFAULT NULL COMMENT '支持的配送服务商'; - -ALTER TABLE `shop_store` - ADD COLUMN `extend_data` TEXT DEFAULT NULL COMMENT '配送服务商扩展数据'; - -ALTER TABLE `shop_store` - ADD COLUMN `time_is_open` TINYINT NOT NULL DEFAULT 0 COMMENT '配送时间设置 0 关闭1 开启'; - -ALTER TABLE `shop_store` - ADD COLUMN `support_local_delivery` TINYINT NOT NULL DEFAULT 0 COMMENT '支持同城配送'; - -ALTER TABLE `shop_store` - ADD COLUMN `support_store` TINYINT NOT NULL DEFAULT 0 COMMENT '支持门店自提'; - -ALTER TABLE `shop_store` - ADD COLUMN `status` TINYINT NOT NULL DEFAULT 0 COMMENT '开启状态(1开启,0关闭)'; - -ALTER TABLE `shop_store` - ADD COLUMN `area` LONGTEXT DEFAULT NULL COMMENT '配送区域'; - -ALTER TABLE `shop_order_delivery` - ADD COLUMN `local_delivery_order_id` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '同城配送单号'; - -ALTER TABLE `shop_goods_evaluate` - CHANGE COLUMN `member_name` `member_name` VARCHAR (255) NOT NULL DEFAULT '' COMMENT '会员名称'; - -ALTER TABLE `shop_goods` - ADD COLUMN `goods_image_width` INT NOT NULL DEFAULT 800 COMMENT '商品详情首图宽' AFTER `goods_image`; -ALTER TABLE `shop_goods` - ADD COLUMN `goods_image_height` INT NOT NULL DEFAULT 800 COMMENT '商品详情首图高' AFTER `goods_image_width`; - - -ALTER TABLE `shop_delivery_company` - COMMENT = '物流公司表'; - - -DROP TABLE IF EXISTS `shop_delivery_shop_delivery_order_log`; -CREATE TABLE `shop_delivery_shop_delivery_order_log` -( - `id` INT NOT NULL AUTO_INCREMENT, - `order_id` INT NOT NULL DEFAULT 0 COMMENT '订单id', - `main_id` INT NOT NULL DEFAULT 0 COMMENT '操作人id', - `main_type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '操作人类型', - `main_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '操作人名称', - `operate` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '操作类型', - `operate_desc` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '操作描述', - `status` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '操作后配送状态', - `create_time` INT NOT NULL DEFAULT 0 COMMENT '配送时间', - `remark` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '备注', - PRIMARY KEY (`id`) -) ENGINE = INNODB, -CHARACTER SET utf8mb4, -COLLATE utf8mb4_general_ci, -COMMENT = '商家配送服务订单操作表'; - -DROP TABLE IF EXISTS `shop_delivery_shop_delivery_order`; -CREATE TABLE `shop_delivery_shop_delivery_order` -( - `id` INT NOT NULL AUTO_INCREMENT, - `delivery_no` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送单号', - `out_delivery_no` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '三方配送单号', - `trade_type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '交易类型,mall商城 supply供货商', - `trade_no` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '交易单号', - `trade_id` INT NOT NULL DEFAULT 0 COMMENT '交易id', - `delivery_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '配送费用', - `delivery_start` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送起点(发货点)', - `delivery_start_province_id` INT NOT NULL DEFAULT 0 COMMENT '配送起点省', - `delivery_start_city_id` INT NOT NULL DEFAULT 0 COMMENT '配送起点市', - `delivery_start_district_id` INT NOT NULL DEFAULT 0 COMMENT '配送起点区', - `delivery_start_lng` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送起点经度', - `delivery_start_lat` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送起点纬度', - `delivery_end` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送终点(收货点)', - `delivery_end_province_id` INT NOT NULL DEFAULT 0 COMMENT '配送终点省', - `delivery_end_city_id` INT NOT NULL DEFAULT 0 COMMENT '配送终点市', - `delivery_end_district_id` INT NOT NULL DEFAULT 0 COMMENT '配送终点区', - `delivery_end_lng` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送终点经度', - `delivery_end_lat` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送终点纬度', - `delivery_distance` DECIMAL(10, 4) NOT NULL DEFAULT 0.0000 COMMENT '配送距离', - `deliver_id` INT NOT NULL DEFAULT 0 COMMENT '配送员id', - `deliver_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送员姓名', - `deliver_mobile` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送员手机号', - `status` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送状态', - `create_time` INT NOT NULL DEFAULT 0 COMMENT '配送时间', - `finish_time` INT NOT NULL DEFAULT 0 COMMENT '送达时间', - `cancel_time` INT NOT NULL DEFAULT 0 COMMENT '取消时间', - `remark` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '备注', - `body` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '商品信息', - PRIMARY KEY (`id`) -) ENGINE = INNODB, -CHARACTER SET utf8mb4, -COLLATE utf8mb4_general_ci, -COMMENT = '商家配送服务订单表'; - -DROP TABLE IF EXISTS `shop_delivery_local_delivery_service`; -CREATE TABLE `shop_delivery_local_delivery_service` -( - `id` INT NOT NULL AUTO_INCREMENT, - `key` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '三方配送key', - `name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '三方配送名称', - `config` TEXT DEFAULT NULL COMMENT '三方配送接入参数', - `is_merchant` TINYINT NOT NULL DEFAULT 0 COMMENT '是否商家自配送', - `is_use` TINYINT NOT NULL DEFAULT 0 COMMENT '是否启用(0否,1是)', - PRIMARY KEY (`id`) -) ENGINE = INNODB, -CHARACTER SET utf8mb4, -COLLATE utf8mb4_general_ci, -COMMENT = '同城配送服务商表'; - - -DROP TABLE IF EXISTS `shop_delivery_local_delivery_order_log`; -CREATE TABLE `shop_delivery_local_delivery_order_log` -( - `id` INT NOT NULL AUTO_INCREMENT, - `order_id` INT NOT NULL DEFAULT 0 COMMENT '订单id', - `main_id` INT NOT NULL DEFAULT 0 COMMENT '操作人id', - `main_type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '操作人类型', - `main_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '操作人名称', - `operate` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '操作类型', - `operate_desc` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '操作描述', - `status` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '操作后配送状态', - `create_time` INT NOT NULL DEFAULT 0 COMMENT '配送时间', - `remark` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '备注', - PRIMARY KEY (`id`) -) ENGINE = INNODB, -CHARACTER SET utf8mb4, -COLLATE utf8mb4_general_ci, -COMMENT = '同城配送服务订单操作表'; - - -DROP TABLE IF EXISTS `shop_delivery_local_delivery_order`; -CREATE TABLE `shop_delivery_local_delivery_order` -( - `id` INT NOT NULL AUTO_INCREMENT, - `delivery_service` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送方标识', - `delivery_no` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送单号', - `out_delivery_no` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '三方配送单号', - `trade_type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '交易类型,mall商城', - `trade_no` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '交易单号', - `trade_id` INT NOT NULL DEFAULT 0 COMMENT '交易id', - `delivery_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '配送费用', - `delivery_start` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '配送起点(发货点)', - `delivery_start_province_id` INT NOT NULL DEFAULT 0 COMMENT '配送起点省', - `delivery_start_city_id` INT NOT NULL DEFAULT 0 COMMENT '配送起点市', - `delivery_start_district_id` INT NOT NULL DEFAULT 0 COMMENT '配送起点区', - `delivery_start_lng` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送起点经度', - `delivery_start_lat` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送起点纬度', - `delivery_end` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '配送终点(收货点)', - `delivery_end_province_id` INT NOT NULL DEFAULT 0 COMMENT '配送终点省', - `delivery_end_city_id` INT NOT NULL DEFAULT 0 COMMENT '配送终点市', - `delivery_end_district_id` INT NOT NULL DEFAULT 0 COMMENT '配送终点区', - `delivery_end_lng` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送终点经度', - `delivery_end_lat` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送终点纬度', - `delivery_distance` DECIMAL(10, 4) NOT NULL DEFAULT 0.0000 COMMENT '配送距离', - `status` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送状态', - `out_status` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '三方配送状态', - `create_time` INT NOT NULL DEFAULT 0 COMMENT '配送时间', - `finish_time` INT NOT NULL DEFAULT 0 COMMENT '送达时间', - `cancel_time` INT NOT NULL DEFAULT 0 COMMENT '取消时间', - `rider_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '骑手姓名', - `rider_mobile` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '骑手电话', - `deduct_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '违约金', - `remark` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '备注', - `body` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配送产品信息', - `actual_money` DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '实际消费费用(订单取消或完成后实际定义)', - PRIMARY KEY (`id`) -) ENGINE = INNODB, -CHARACTER SET utf8mb4, -COLLATE utf8mb4_general_ci, -COMMENT = '同城配送服务订单表'; diff --git a/niucloud/addon/shop/app/validate/cart/Cart.php b/niucloud/addon/shop/app/validate/cart/Cart.php deleted file mode 100644 index b6f5f1f25..000000000 --- a/niucloud/addon/shop/app/validate/cart/Cart.php +++ /dev/null @@ -1,42 +0,0 @@ - 'require|gt:0', - 'goods_id' => 'require|gt:0', - 'sku_id' => 'require|gt:0', - 'num' => 'require', - ]; - - protected $message = [ - 'goods_id.require' => [ 'common_validate.require', [ 'goods_id' ] ], - 'sku_id.require' => [ 'common_validate.require', [ 'sku_id' ] ], - 'num.require' => [ 'common_validate.require', [ 'num' ] ], - ]; - - protected $scene = [ - "add" => [ 'member_id', 'goods_id', 'sku_id', 'num', 'status', 'invalid_remark' ], - "edit" => [ 'member_id', 'sku_id', 'num', 'status', 'invalid_remark' ] - ]; - -} diff --git a/niucloud/addon/shop/app/validate/delivery/Company.php b/niucloud/addon/shop/app/validate/delivery/Company.php deleted file mode 100644 index fc3b616c6..000000000 --- a/niucloud/addon/shop/app/validate/delivery/Company.php +++ /dev/null @@ -1,37 +0,0 @@ - 'require', - ]; - - protected $message = [ - 'company_name.require' => [ 'common_validate.require', [ 'company_name' ] ], - ]; - - protected $scene = [ - "add" => [ 'company_name' ], - "edit" => [ 'company_name' ] - ]; - -} diff --git a/niucloud/addon/shop/app/validate/delivery/ElectronicSheet.php b/niucloud/addon/shop/app/validate/delivery/ElectronicSheet.php deleted file mode 100644 index 8eaa72386..000000000 --- a/niucloud/addon/shop/app/validate/delivery/ElectronicSheet.php +++ /dev/null @@ -1,39 +0,0 @@ - 'require', - 'express_company_id' => 'require', - ]; - - protected $message = [ - 'template_name.require' => [ 'common_validate.require', [ 'template_name' ] ], - 'express_company_id.require' => [ 'common_validate.require', [ 'express_company_id' ] ], - ]; - - protected $scene = [ - "add" => [ 'template_name', 'express_company_id' ], - "edit" => [ 'template_name', 'express_company_id' ] - ]; - -} diff --git a/niucloud/addon/shop/app/validate/delivery/Store.php b/niucloud/addon/shop/app/validate/delivery/Store.php deleted file mode 100644 index a8eccd331..000000000 --- a/niucloud/addon/shop/app/validate/delivery/Store.php +++ /dev/null @@ -1,44 +0,0 @@ - 'require', - 'store_mobile' => 'require|mobile', - 'address' => 'require', - 'trade_time' => 'require', - ]; - - protected $message = [ - 'store_name.require' => [ 'common_validate.require', [ 'store_name' ] ], - 'store_mobile.require' => [ 'common_validate.require', [ 'store_mobile' ] ], - 'store_mobile.mobile' => [ 'common_validate.mobile', [ 'store_mobile' ] ], - 'address.require' => [ 'common_validate.require', [ 'address' ] ], - 'trade_time.require' => [ 'common_validate.require', [ 'trade_time' ] ], - ]; - - protected $scene = [ - "add" => [ 'store_name', 'store_mobile', 'address', 'trade_time' ], - "edit" => [ 'store_name', 'store_mobile', 'address', 'trade_time' ] - ]; - -} diff --git a/niucloud/addon/shop/app/validate/goods/Attr.php b/niucloud/addon/shop/app/validate/goods/Attr.php deleted file mode 100644 index b19bc041c..000000000 --- a/niucloud/addon/shop/app/validate/goods/Attr.php +++ /dev/null @@ -1,39 +0,0 @@ - 'require', - 'attr_value_format' => 'require', - ]; - - protected $message = [ - 'attr_name.require' => [ 'common_validate.require', [ 'attr_name' ] ], - 'attr_value_format.require' => [ 'common_validate.require', [ 'attr_value_format' ] ], - ]; - - protected $scene = [ - "add" => [ 'attr_name', 'sort' ], - "edit" => [ 'attr_name', 'sort' ] - ]; - -} diff --git a/niucloud/addon/shop/app/validate/goods/Brand.php b/niucloud/addon/shop/app/validate/goods/Brand.php deleted file mode 100644 index 408cfde27..000000000 --- a/niucloud/addon/shop/app/validate/goods/Brand.php +++ /dev/null @@ -1,37 +0,0 @@ - 'require', - ]; - - protected $message = [ - 'brand_name.require' => [ 'common_validate.require', [ 'brand_name' ] ], - ]; - - protected $scene = [ - "add" => [ 'brand_name', 'logo', 'desc', 'sort' ], - "edit" => [ 'brand_name', 'logo', 'desc', 'sort' ] - ]; - -} diff --git a/niucloud/addon/shop/app/validate/goods/Category.php b/niucloud/addon/shop/app/validate/goods/Category.php deleted file mode 100644 index c601049a5..000000000 --- a/niucloud/addon/shop/app/validate/goods/Category.php +++ /dev/null @@ -1,39 +0,0 @@ - 'require', - 'pid' => 'require', - ]; - - protected $message = [ - 'category_name.require' => [ 'common_validate.require', [ 'category_name' ] ], - 'pid.require' => [ 'common_validate.require', [ 'pid' ] ], - ]; - - protected $scene = [ - "add" => [ 'category_name', 'pid' ], - "edit" => [ 'category_name', 'pid' ] - ]; - -} diff --git a/niucloud/addon/shop/app/validate/goods/Evaluate.php b/niucloud/addon/shop/app/validate/goods/Evaluate.php deleted file mode 100644 index 6713f7041..000000000 --- a/niucloud/addon/shop/app/validate/goods/Evaluate.php +++ /dev/null @@ -1,66 +0,0 @@ - 'require', - 'order_goods_id' => 'require', - 'goods_id' => 'require', - 'member_id' => 'require', - 'content' => 'require', - 'images' => 'require', - 'is_anonymous' => 'require', - 'scores' => 'require', - 'is_audit' => 'require', - 'explain_first' => 'require', - 'again_content' => 'require', - 'again_images' => 'require', - 'again_explain' => 'require', - 'again_time' => 'require', - 'again_is_audit' => 'require', - 'is_show' => 'require', - ]; - - protected $message = [ - 'order_id.require' => [ 'common_validate.require', [ 'order_id' ] ], - 'order_goods_id.require' => [ 'common_validate.require', [ 'order_goods_id' ] ], - 'goods_id.require' => [ 'common_validate.require', [ 'goods_id' ] ], - 'member_id.require' => [ 'common_validate.require', [ 'member_id' ] ], - 'content.require' => [ 'common_validate.require', [ 'content' ] ], - 'images.require' => [ 'common_validate.require', [ 'images' ] ], - 'is_anonymous.require' => [ 'common_validate.require', [ 'is_anonymous' ] ], - 'scores.require' => [ 'common_validate.require', [ 'scores' ] ], - 'is_audit.require' => [ 'common_validate.require', [ 'is_audit' ] ], - 'explain_first.require' => [ 'common_validate.require', [ 'explain_first' ] ], - 'again_content.require' => [ 'common_validate.require', [ 'again_content' ] ], - 'again_images.require' => [ 'common_validate.require', [ 'again_images' ] ], - 'again_explain.require' => [ 'common_validate.require', [ 'again_explain' ] ], - 'again_time.require' => [ 'common_validate.require', [ 'again_time' ] ], - 'again_is_audit.require' => [ 'common_validate.require', [ 'again_is_audit' ] ], - 'is_show.require' => [ 'common_validate.require', [ 'is_show' ] ], - ]; - - protected $scene = [ - "add" => [ 'goods_id', 'content', 'is_anonymous', 'scores', 'is_show' ], - ]; - -} diff --git a/niucloud/addon/shop/app/validate/goods/Goods.php b/niucloud/addon/shop/app/validate/goods/Goods.php deleted file mode 100644 index be75cc5c9..000000000 --- a/niucloud/addon/shop/app/validate/goods/Goods.php +++ /dev/null @@ -1,49 +0,0 @@ - 'require', - 'goods_type' => 'require', - 'goods_image' => 'require', - 'goods_category' => 'require', - 'stock' => 'require', - 'status' => 'number|between:0,1', - 'goods_desc' => 'require', - ]; - - protected $message = [ - 'goods_name.require' => [ 'common_validate.require', [ 'goods_name' ] ], - 'goods_type.require' => [ 'common_validate.require', [ 'goods_type' ] ], - 'goods_image.require' => [ 'common_validate.require', [ 'goods_image' ] ], - 'goods_category.require' => [ 'common_validate.require', [ 'goods_category' ] ], - 'stock.require' => [ 'common_validate.require', [ 'stock' ] ], - 'status.require' => [ 'common_validate.require', [ 'status' ] ], - 'goods_desc.require' => [ 'common_validate.require', [ 'goods_desc' ] ], - ]; - - protected $scene = [ - "add" => [ 'goods_name', 'goods_type', 'goods_cover', 'goods_image', 'goods_desc', 'brand_id', 'goods_category', 'label_ids', 'service_ids', 'unit', 'stock', 'sale_num', 'virtual_sale_num', 'status', 'sort', 'delivery_type', 'is_free_shipping', 'fee_type', 'delivery_money', 'delivery_template_id' ], - "edit" => [ 'goods_name', 'goods_type', 'goods_cover', 'goods_image', 'goods_desc', 'brand_id', 'goods_category', 'label_ids', 'service_ids', 'unit', 'stock', 'sale_num', 'virtual_sale_num', 'status', 'sort', 'delivery_type', 'is_free_shipping', 'fee_type', 'delivery_money', 'delivery_template_id' ], - ]; - -} diff --git a/niucloud/addon/shop/app/validate/goods/Label.php b/niucloud/addon/shop/app/validate/goods/Label.php deleted file mode 100644 index 1fd68cc9d..000000000 --- a/niucloud/addon/shop/app/validate/goods/Label.php +++ /dev/null @@ -1,37 +0,0 @@ - 'require', - ]; - - protected $message = [ - 'label_name.require' => [ 'common_validate.require', [ 'label_name' ] ], - ]; - - protected $scene = [ - "add" => [ 'label_name', 'memo', 'sort' ], - "edit" => [ 'label_name', 'memo', 'sort' ] - ]; - -} diff --git a/niucloud/addon/shop/app/validate/goods/LabelGroup.php b/niucloud/addon/shop/app/validate/goods/LabelGroup.php deleted file mode 100644 index 9bd2766b5..000000000 --- a/niucloud/addon/shop/app/validate/goods/LabelGroup.php +++ /dev/null @@ -1,37 +0,0 @@ - 'require', - ]; - - protected $message = [ - 'group_name.require' => [ 'common_validate.require', [ 'group_name' ] ], - ]; - - protected $scene = [ - "add" => [ 'group_name', 'sort' ], - "edit" => [ 'group_name', 'sort' ] - ]; - -} diff --git a/niucloud/addon/shop/app/validate/goods/Rank.php b/niucloud/addon/shop/app/validate/goods/Rank.php deleted file mode 100644 index 9edecc086..000000000 --- a/niucloud/addon/shop/app/validate/goods/Rank.php +++ /dev/null @@ -1,82 +0,0 @@ - 'require', - 'banner' => 'require', - 'rank_type' => 'require|in:day,week,month,quarter', - 'goods_source' => 'require|in:goods,category,brand,label,all', - 'rule_type' => 'require|in:sale,collect,evaluate,access', - 'goods_json' => 'checkGoodsSource', - 'category_ids' => 'checkGoodsSource', - 'brand_ids' => 'checkGoodsSource', - 'label_ids' => 'checkGoodsSource', - ]; - - protected $message = [ - 'name.require' => [ 'common_validate.require', [ 'name' ] ], - 'banner.require' => [ 'common_validate.require', [ 'banner' ] ], - 'rank_type.require' => [ 'common_validate.require', [ 'rank_type' ] ], - 'goods_source.require' => [ 'common_validate.require', [ 'goods_source' ] ], - 'rule_type.require' => [ 'common_validate.require', [ 'rule_type' ] ], - ]; - - protected $scene = [ - "add" => [ 'name', 'rank_type', 'goods_source', 'rule_type', 'goods_json', 'category_ids', 'brand_ids', 'label_ids', 'sort','status'], - "edit" => [ 'name', 'rank_type', 'goods_source', 'rule_type', 'goods_json', 'category_ids', 'brand_ids', 'label_ids', 'sort','status'] - ]; - - // 自定义验证规则 - protected function checkGoodsSource($value, $rule, $data=[]) - { - if ($data['goods_source'] == RankDict::GOODS) { - if (empty($data['goods_json'])) { - return 'goods_json不能为空'; - } - return true; - } - if ($data['goods_source'] == RankDict::CATEGORY) { - if (empty($data['category_ids'])) { - return 'category_ids不能为空'; - } - return true; - } - if ($data['goods_source'] == RankDict::BRAND) { - if (empty($data['brand_ids'])) { - return 'brand_ids不能为空'; - } - return true; - } - if ($data['goods_source'] == RankDict::LABEL) { - if (empty($data['label_ids'])) { - return 'label_ids不能为空'; - } - return true; - } - if ($data['goods_source'] == RankDict::ALL) { - return true; - } - } - -} diff --git a/niucloud/addon/shop/app/validate/goods/Service.php b/niucloud/addon/shop/app/validate/goods/Service.php deleted file mode 100644 index 1b43a46e7..000000000 --- a/niucloud/addon/shop/app/validate/goods/Service.php +++ /dev/null @@ -1,37 +0,0 @@ - 'require', - ]; - - protected $message = [ - 'service_name.require' => [ 'common_validate.require', [ 'service_name' ] ], - ]; - - protected $scene = [ - "add" => [ 'service_name', 'desc' ], - "edit" => [ 'service_name', 'desc' ] - ]; - -} diff --git a/niucloud/addon/shop/app/validate/marketing/Coupon.php b/niucloud/addon/shop/app/validate/marketing/Coupon.php deleted file mode 100644 index dab024631..000000000 --- a/niucloud/addon/shop/app/validate/marketing/Coupon.php +++ /dev/null @@ -1,46 +0,0 @@ - 'require', - 'price' => 'require', - 'receive_type' => 'require', - 'type' => 'require', - 'start_time' => 'require', - 'end_time' => 'require', - ]; - - protected $message = [ - 'title.require' => [ 'common_validate.require', [ 'title' ] ], - 'price.require' => [ 'common_validate.require', [ 'price' ] ], - 'receive_type.require' => [ 'common_validate.require', [ 'receive_type' ] ], - 'type.require' => [ 'common_validate.require', [ 'type' ] ], - 'start_time.require' => [ 'common_validate.require', [ 'start_time' ] ], - 'end_time.require' => [ 'common_validate.require', [ 'end_time' ] ], - ]; - - protected $scene = [ - "add" => [ 'title', 'price', 'receive_type', 'type', 'start_time', 'end_time' ], - ]; - -} diff --git a/niucloud/addon/shop/app/validate/shop_address/ShopAddress.php b/niucloud/addon/shop/app/validate/shop_address/ShopAddress.php deleted file mode 100644 index 1403298ff..000000000 --- a/niucloud/addon/shop/app/validate/shop_address/ShopAddress.php +++ /dev/null @@ -1,61 +0,0 @@ - 'require', - 'mobile' => 'require', - 'province_id' => 'require', - 'city_id' => 'require', - 'district_id' => 'require', - 'address' => 'require', - 'full_address' => 'require', - 'lat' => 'require', - 'lng' => 'require', - 'is_delivery_address' => 'require', - 'is_refund_address' => 'require', - 'is_default_delivery' => 'require', - 'is_default_refund' => 'require', - ]; - - protected $message = [ - 'contact_name.require' => [ 'common_validate.require', [ 'contact_name' ] ], - 'mobile.require' => [ 'common_validate.require', [ 'mobile' ] ], - 'province_id.require' => [ 'common_validate.require', [ 'province_id' ] ], - 'city_id.require' => [ 'common_validate.require', [ 'city_id' ] ], - 'district_id.require' => [ 'common_validate.require', [ 'district_id' ] ], - 'address.require' => [ 'common_validate.require', [ 'address' ] ], - 'full_address.require' => [ 'common_validate.require', [ 'full_address' ] ], - 'lat.require' => [ 'common_validate.require', [ 'lat' ] ], - 'lng.require' => [ 'common_validate.require', [ 'lng' ] ], - 'is_delivery_address.require' => [ 'common_validate.require', [ 'is_delivery_address' ] ], - 'is_refund_address.require' => [ 'common_validate.require', [ 'is_refund_address' ] ], - 'is_default_delivery.require' => [ 'common_validate.require', [ 'is_default_delivery' ] ], - 'is_default_refund.require' => [ 'common_validate.require', [ 'is_default_refund' ] ], - ]; - - protected $scene = [ - "add" => [ 'contact_name', 'mobile', 'province_id', 'city_id', 'district_id', 'address', 'full_address', 'lat', 'lng', 'is_delivery_address', 'is_refund_address', 'is_default_delivery', 'is_default_refund' ], - "edit" => [ 'contact_name', 'mobile', 'province_id', 'city_id', 'district_id', 'address', 'full_address', 'lat', 'lng', 'is_delivery_address', 'is_refund_address', 'is_default_delivery', 'is_default_refund' ] - ]; - -} diff --git a/niucloud/addon/shop/config/local_delivery.php b/niucloud/addon/shop/config/local_delivery.php deleted file mode 100644 index ad1fba65e..000000000 --- a/niucloud/addon/shop/config/local_delivery.php +++ /dev/null @@ -1,27 +0,0 @@ - 'merchant', - 'drivers' => [ - //商家自配送 - 'merchant' => [], - //达达 - 'dada' => [ - 'driver' => 'addon\shop\core\local_delivery\Dada', //反射类的名字 - ] - ] -]; -$system['drivers'] = (new DictLoader("Config"))->load(['data' => $system['drivers'], 'name' => 'local_delivery']); -return $system; diff --git a/niucloud/addon/shop/config/third_delivery.php b/niucloud/addon/shop/config/third_delivery.php deleted file mode 100644 index db86d8eb9..000000000 --- a/niucloud/addon/shop/config/third_delivery.php +++ /dev/null @@ -1,28 +0,0 @@ - 'dada', - 'drivers' => [ - //达达 - 'dada' => [ - 'driver' => 'addon\shop\app\service\core\delivery\third_delivery\Dada', //反射类的名字 - 'app_key' => '', - 'secret_key' => '', - 'sign' => '', - ], - ] -]; - -return (new DictLoader("Config"))->load(['data' => $system, 'name' => 'third_delivery']); diff --git a/niucloud/addon/shop/core/local_delivery/BaseLocalDelivery.php b/niucloud/addon/shop/core/local_delivery/BaseLocalDelivery.php deleted file mode 100644 index e315282a8..000000000 --- a/niucloud/addon/shop/core/local_delivery/BaseLocalDelivery.php +++ /dev/null @@ -1,50 +0,0 @@ -Niucloud Team -// +---------------------------------------------------------------------- -namespace addon\shop\core\local_delivery; - -use addon\shop\app\dict\local_delivery\dada\DadaDeliveryStatusDict; -use addon\shop\app\dict\local_delivery\LocalDeliveryDict; -use addon\shop\app\service\core\local_delivery\dada\CoreOrderMessageService; -use addon\shop\core\local_delivery\sdk\dada\OrderCancelRequest; -use addon\shop\core\local_delivery\sdk\dada\OrderCreateByFeeOrderNoRequest; -use addon\shop\core\local_delivery\sdk\dada\OrderCreateRequest; -use addon\shop\core\local_delivery\sdk\dada\OrderFeeRequest; -use addon\shop\core\local_delivery\sdk\dada\OrderInfoRequest; -use addon\shop\core\local_delivery\sdk\dada\OrderTransporterPositionH5Request; -use addon\shop\core\local_delivery\sdk\dada\OrderTransporterPositionRequest; -use addon\shop\core\local_delivery\sdk\dada\ShopAddRequest; -use addon\shop\core\local_delivery\sdk\dada\ShopEditRequest; -use think\facade\Log; - -class Dada extends BaseLocalDelivery -{ - public $app_secret;//App_secret - public $app_key;//App_key - public $source_id;//商户ID - public $shop_no;//门店编号 - public $config; - public $callback;//回调地址 - - public function initialize(array $config = []) - { - $this->app_secret = $config['app_secret'] ?? ''; - $this->app_key = $config['app_key'] ?? ''; - $this->source_id = $config['source_id'] ?? ''; - $this->shop_no = $config['store_no'] ?? ''; - $this->callback = $config['notify_url'] ?? ''; - $this->config = $config; - } - - /** - * ADMINAPI 发货使用 - * @param $data - * @return array - * @throws \Exception - */ - public function createOrder($data) - { - $order_data = $data['order_data']; - $order_goods_data = $data['order_goods_data']; - $param = $data['param']; - $delivery_no = $data['delivery_no']; - - $request = new OrderCreateRequest(); - $product_list = []; -// $weight = $num = 0; - $weight = max($param['goods_weight'], 1); - $num = 0; - foreach ($order_goods_data as $sku_info) { - $product_list[] = [ - 'count' => $sku_info['num'], - 'sku_name' => $sku_info['goods_name'] . $sku_info['sku_name'], - 'src_product_no' => $sku_info['sku_id'], - 'unit' => $sku_info['goods']['unit'], - ]; -// $weight += $sku_info['sku']['weight'] * $sku_info['num']; - $num += $sku_info['num']; - } - // 创建请求对象并链式设置参数 - $request->setBaseParams($this->config) - ->setCallback($this->callback) - ->setShopNo($this->shop_no) - ->setOriginId($delivery_no) - ->setReceiverName($order_data->taker_name) - ->setReceiverPhone($order_data->taker_mobile) - ->setReceiverAddress($order_data->taker_address) - ->setReceiverLat($order_data->taker_latitude) - ->setReceiverLng($order_data->taker_longitude) - ->setCargoNum($num) - ->setCargoWeight($weight) - ->setCargoPrice($order_data->order_money) - ->setProductList($product_list); - if (!empty($order_data['buyer_ask_delivery_time'])) { - //2025-06-16 08:21~09:21 - $buyer_ask_delivery_time_array = explode(' ', $order_data['buyer_ask_delivery_time']); - $buyer_ask_delivery_time_date = $buyer_ask_delivery_time_array[0]; - $buyer_ask_delivery_time_hour = $buyer_ask_delivery_time_array[1]; - $buyer_ask_delivery_time_hour_array = explode('~',$buyer_ask_delivery_time_hour); - $expect_finish_time_limit = strtotime($buyer_ask_delivery_time_date . ' ' . $buyer_ask_delivery_time_hour_array[1]); - $request->setIsExpectFinishOrder(1)->setExpectFinishTimeLimit($expect_finish_time_limit); - } - try { - $res = $request->sendRequest(); - Log::write('达达接口请求:' . json_encode($res)); - $result = $res['result'] ?? []; - if (empty($result)) { - return []; - } - return [ - 'delivery_money' => $result['fee'] ?? 0, - 'delivery_distance' => ($result['distance'] ?? 0) / 1000,//转km - ]; - } catch (\Exception $e) { - Log::write('达达接口请求异常:' . $e->getMessage()); - throw new \Exception($e->getMessage()); - - } - - } - - /** - * ADMINAPI 重新下单 - * @param $data - * @return array - * @throws \Exception - */ - public function reCreateOrder($data) - { - $order_data = $data['order_data']; - $order_goods_data = $data['order_goods_data']; - $param = $data['param']; - $delivery_no = $data['delivery_no']; -// return [//调试数据 -// 'delivery_price' => 100,//$res['fee'], -// 'third_order_no' => $order_no,//$res['fee'], -// ]; - $request = new OrderCreateRequest(); - $product_list = []; -// $weight = $num = 0; - $weight = max($param['goods_weight'], 1); - $num = 0; - foreach ($order_goods_data as $sku_info) { - $product_list[] = [ - 'count' => $sku_info['num'], - 'sku_name' => $sku_info['goods_name'] . $sku_info['sku_name'], - 'src_product_no' => $sku_info['sku_id'], - 'unit' => $sku_info['goods']['unit'], - ]; -// $weight += $sku_info['sku']['weight'] * $sku_info['num']; - $num += $sku_info['num']; - } - // 创建请求对象并链式设置参数 - $request = $request->setBaseParams($this->config) - ->setCallback($this->callback) - ->setShopNo($this->shop_no) - ->setOriginId($delivery_no) - ->setReceiverName($order_data->taker_name) - ->setReceiverPhone($order_data->taker_mobile) - ->setReceiverAddress($order_data->taker_address) - ->setReceiverLat($order_data->taker_latitude) - ->setReceiverLng($order_data->taker_longitude) - ->setCargoNum($num) - ->setCargoWeight($weight) - ->setCargoPrice($order_data->order_money) - ->setProductList($product_list); - if (!empty($order_data['buyer_ask_delivery_time'])) { - //2025-06-16 08:21~09:21 - $buyer_ask_delivery_time_array = explode(' ', $order_data['buyer_ask_delivery_time']); - $buyer_ask_delivery_time_date = $buyer_ask_delivery_time_array[0]; - $buyer_ask_delivery_time_hour = $buyer_ask_delivery_time_array[1]; - $buyer_ask_delivery_time_hour_array = explode('~',$buyer_ask_delivery_time_hour); - $expect_finish_time_limit = strtotime($buyer_ask_delivery_time_date . ' ' . $buyer_ask_delivery_time_hour_array[1]); - $request->setIsExpectFinishOrder(1) - ->setExpectFinishTimeLimit($expect_finish_time_limit); - } - try { - $res = $request->sendRequest(); - return $res['result'] ?? []; - } catch (\Exception $e) { - Log::write('达达接口请求异常:' . $e->getMessage()); - throw new \Exception($e->getMessage()); - - } - - } - - /** - * API使用 - * @param $data - * @return array - * @throws \Exception - */ - public function calculate($data) - { - $order_data = $data['order_data']; - $order_goods_data = $data['order_goods_data']; - $param = $data['param']; - $delivery_no = $data['delivery_no']; - $request = new OrderFeeRequest(); - $product_list = []; - $weight = max($param['goods_weight'] ?? 0, 1); - $num = 0; - foreach ($order_goods_data as $sku_info) { - $product_list[] = [ - 'count' => $sku_info['num'], - 'sku_name' => $sku_info['goods_name'] . $sku_info['sku_name'], - 'src_product_no' => $sku_info['sku_id'], - 'unit' => $sku_info['goods']['unit'], - ]; -// $weight += $sku_info['weight'] * $sku_info['num']; - $num += $sku_info['num']; - } - // 创建请求对象并链式设置参数 - $request = $request->setBaseParams($this->config) - ->setCallback($this->callback) - ->setShopNo($this->shop_no) - ->setOriginId($delivery_no) - ->setCargoPrice($order_data->order_money) - ->setReceiverName($order_data->taker_name) - ->setReceiverPhone($order_data->taker_mobile) - ->setReceiverAddress($order_data->taker_address) - ->setReceiverLat($order_data->taker_latitude) - ->setReceiverLng($order_data->taker_longitude) - ->setCargoNum($num) - ->setCargoWeight($weight) - ->setProductList($product_list); - try { - $res = $request->sendRequest(); - $result = $res['result'] ?? []; - return [ - 'delivery_money' => $result['fee'] ?? 0, - ]; - } catch (\Exception $e) { - Log::write('达达接口请求异常:' . $e->getMessage()); - throw new \Exception($e->getMessage()); - } - } - - /** - * - * @param $delivery_third_order_no `计算运费接口返回的 配送方单号 queryFeeMoney.response.delivery_third_order_no` - * @return string[] - * @throws \Exception - */ - public function createOrderAfterCalculate($delivery_third_order_no) - { - try { - $res = (new OrderCreateByFeeOrderNoRequest()) - ->setBaseParams($this->config) - ->setDeliveryNo($delivery_third_order_no) - ->sendRequest(); - return $res['result'] ?? []; - } catch (\Exception $e) { - Log::write('达达接口请求异常:' . $e->getMessage()); - throw new \Exception($e->getMessage()); - } - } - - /** - * @param $order_no `订单号` - * @return string[] - */ - public function queryOrderInfo($data) - { - try { - $res = (new OrderInfoRequest()) - ->setBaseParams($this->config) - ->setOrderId($data['delivery_no']) - ->sendRequest(); - $result = $res['result'] ?? []; - if (empty($result)) { - return []; - } - $status = DadaDeliveryStatusDict::convertStatus($result['statusCode']); - return [ - 'status' => $status, - 'out_status' => $result['statusCode'], - 'rider_name' => $result['transporterName'], - 'rider_mobile' => $result['transporterPhone'], - 'delivery_money' => $result['actualFee'], - 'delivery_distance' => ($result['distance'] ?? 0) / 1000,//转km - 'create_time' => !empty($result['createTime']) && is_string($result['createTime']) ? strtotime($result['createTime']) : 0, - 'finish_time' => !empty($result['finishTime']) && is_string($result['finishTime']) ? strtotime($result['finishTime']) : 0, - 'cancel_time' => !empty($result['cancelTime']) && is_string($result['cancelTime']) ? strtotime($result['cancelTime']) : 0, - 'deduct_money' => $result['deductFee'] ?? 0, - ]; - } catch (\Exception $e) { - Log::write('达达接口请求异常:' . $e->getMessage()); - return []; - } - - } - - /** - * @param array $data - * @return int[] - * @throws \Exception - */ - public function closeOrder($data) - { - try { - $res = (new OrderCancelRequest()) - ->setBaseParams($this->config) - ->setOrderId($data['delivery_no']) - ->setCancelReasonId($data['cancel_reason_id']) - ->setCancelReason($data['cancel_reason']) - ->sendRequest(); - $result = $res['result'] ?? []; - return [ - 'deduct_money' => $result['deductFee'] ?? 0, - ]; - } catch (\Exception $e) { - Log::write('达达接口请求异常:' . $e->getMessage()); - throw new \Exception($e->getMessage()); - } - - } - - /** - * 完成订单 - * @param $data - * @return void - */ - public function finishOrder($data) - { - - } - - public function getTransporterPosition($data) - { - try { - if (!empty($data['is_h5'])) { - $res = (new OrderTransporterPositionH5Request()) - ->setBaseParams($this->config) - ->setOrderId($data['delivery_no']) - ->sendRequest(); - return $res['result'] ?? []; - } else { - $res = (new OrderTransporterPositionRequest()) - ->setBaseParams($this->config) - ->setOrderIds([$data['delivery_no']]) - ->sendRequest(); - $result = $res['result'] ?? []; - if (empty($result)) { - return []; - } - return [ - 'rider_latitude' => $result[0]['transporterLat'] ?? '', - 'rider_longitude' => $result[0]['transporterLng'] ?? '', - 'rider_name' => $result[0]['transporterName'] ?? '', - 'rider_mobile' => $result[0]['transporterPhone'] ?? '', - ]; - } - } catch (\Exception $e) { - Log::write('达达接口请求异常:' . $e->getMessage()); - throw new \Exception($e->getMessage()); - } - } - - /** - * 添加门店 - * @param $data - * @return array[] - * @throws \Exception - */ - public function addShop($data) - { - $delivery_type = $data['delivery_type']; - $delivery_store = $data['delivery_store']; - try { - $res = (new ShopAddRequest()) - ->setBaseParams($this->config) - ->setStationName($delivery_store['store_name']) - ->setBusiness($data['business']) - ->setStationAddress($delivery_store['full_address']) - ->setLng($delivery_store['longitude']) - ->setLat($delivery_store['latitude']) - ->setContactName($delivery_store['contact_name']) - ->setPhone($delivery_store['store_mobile']) - ->setOriginShopId($delivery_store['store_no']) - ->sendRequest(); - $result = $res['result'] ?? []; - $support_delivery_array = []; - if (!empty($result)) { - if (!empty($result['successList'])) { - $support_delivery_array[$delivery_type] = [ - 'delivery_type' => $delivery_type, - 'business' => $data['business'], - 'store_no' => $result['successList'][0]['originShopId'], - 'open_status' => LocalDeliveryDict::OPEN_PASS, - 'edit_status' => '', - 'reason' => '' - ]; - } - if (!empty($result['failedList'])) { - $support_delivery_array[$delivery_type] = [ - 'delivery_type' => $delivery_type, - 'business' => '', - 'store_no' => '', - 'open_status' => LocalDeliveryDict::OPEN_REFUND, - 'edit_status' => '', - 'reason' => $result['failedList'][0]['msg'] - ]; - } - } - return [ - 'support_delivery' => $support_delivery_array, - ]; - } catch (\Exception $e) { - Log::write('达达接口请求异常:' . $e->getMessage()); - throw new \Exception($e->getMessage()); - } - } - - /** - * 更新门店 - * @param $data - * @return array[] - */ - public function editShop($data) - { - $delivery_type = $data['delivery_type']; - $delivery_store = $data['delivery_store']; - $support_delivery_array = $delivery_store['support_delivery']; - if (!empty($support_delivery_array[$delivery_type])) { - try { - $request = (new ShopEditRequest()) - ->setBaseParams($this->config) - ->setOriginShopId($delivery_store['store_no']); - - if (!empty($delivery_store['store_name'])) { - $request->setStationName($delivery_store['store_name']); - } - if (!empty($data['business'])) { - $request->setBusiness($data['business']); - } - if (!empty($delivery_store['full_address'])) { - $request->setStationAddress($delivery_store['full_address']); - } - if (!empty($delivery_store['longitude'])) { - $request->setLng($delivery_store['longitude']); - } - if (!empty($delivery_store['latitude'])) { - $request->setLat($delivery_store['latitude']); - } - if (!empty($delivery_store['contact_name'])) { - $request->setContactName($delivery_store['contact_name']); - } - if (!empty($delivery_store['store_mobile'])) { - $request->setPhone($delivery_store['store_mobile']); - } - $res = $request->sendRequest(); - if ($res['code'] == 0) { - $support_delivery_array[$delivery_type]['edit_status'] = LocalDeliveryDict::EDIT_PASS; - $support_delivery_array[$delivery_type]['business'] = $data['business']; - $support_delivery_array[$delivery_type]['reason'] = ''; - } - } catch (\Exception $e) { - Log::write('达达接口请求异常:' . $e->getMessage()); - $support_delivery_array[$delivery_type]['edit_status'] = LocalDeliveryDict::EDIT_REFUND; - $support_delivery_array[$delivery_type]['reason'] = $e->getMessage(); - } - } - return [ - 'support_delivery' => $support_delivery_array, - ]; - } - - /** - * 达达订单状态通知异步回调 - * @param string $action - * @param array $params - * @return \think\Response - */ - function notify(string $action, array $params = []) - { - try { - Log::write('达达订单状态通知回调:' . json_encode($params)); - switch ($action) { - case 'order'://订单状态通知 - (new CoreOrderMessageService())->orderNotify($params); - break; - // case 'store'://商户//todo - // break; - // case 'recharge'://充值//todo - // break; - } - return $this->success(); - } catch (\Exception $e) { - Log::write('达达订单状态通知回调异常:' . $e->getMessage()); - return $this->fail($e->getMessage()); - } - } - - public function success($message = '') - { - $response = [ - 'code' => 200, - 'message' => $message ?: '成功', - ]; - return response($response, 200, [], 'json'); - } - - public function fail($message = '') - { - $response = [ - 'code' => 400, - 'message' => $message ?: '失败', - ]; - return response($response, 400, [], 'json'); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/core/local_delivery/LocalDeliveryLoader.php b/niucloud/addon/shop/core/local_delivery/LocalDeliveryLoader.php deleted file mode 100644 index 81288acfc..000000000 --- a/niucloud/addon/shop/core/local_delivery/LocalDeliveryLoader.php +++ /dev/null @@ -1,39 +0,0 @@ -Niucloud Team -// +---------------------------------------------------------------------- -namespace addon\shop\core\local_delivery; - -use addon\shop\app\service\core\shop_delivery\CoreShopDeliveryOrderCloseService; -use addon\shop\app\service\core\shop_delivery\CoreShopDeliveryOrderCreateService; -use addon\shop\app\service\core\shop_delivery\CoreShopDeliveryOrderFinishService; -use addon\shop\app\service\core\shop_delivery\CoreShopDeliveryOrderMessageService; -use addon\shop\app\service\core\shop_delivery\CoreShopDeliveryOrderService; -use think\facade\Log; - -class Merchant extends BaseLocalDelivery -{ - - public function initialize(array $config = []) - { - $this->config = $config; - } - - /** - * ADMINAPI 发货使用 - * @param $data - * @return array - */ - public function createOrder($data) - { - return (new CoreShopDeliveryOrderCreateService())->createOrder($data); - } - - /** - * ADMINAPI 重新下单 - * @param $data - * @return array - */ - public function reCreateOrder($data) - { - - } - - /** - * API使用 - * @param $data - * @return array - */ - public function calculate($data) - { - - } - - /** - * - * @param $delivery_third_order_no - * @return string[] - */ - public function createOrderAfterCalculate($delivery_third_order_no) - { - - } - - /** - * @param $order_no `订单号` - * @return string[] - */ - public function queryOrderInfo($data) - { - - } - - /** - * @param $order_no `订单号` - * @param $cancel_reason_id `取消原因类型ID` - * @param $cancel_reason `取消原因` - * @return false|string[] - */ - public function closeOrder($data) - { - $param = [ - 'out_delivery_no' => $data['delivery_no'], - 'cancel_reason' => $data['cancel_reason'], - 'main_id' => $data['main_id'] ?? 0, - 'main_type' => $data['main_type'] ?? '', - 'main_name' => $data['main_name'] ?? '', - ]; - $res = (new CoreShopDeliveryOrderCloseService())->closeOrder($param); - if ($res) { - return ['cancel_time' => time()]; - } else { - return []; - } - } - - /** - * 完成订单 - * @param $data - * @return false|string[] - */ - public function finishOrder($data) - { - $param = [ - 'out_delivery_no' => $data['delivery_no'], - 'main_id' => $data['main_id'] ?? 0, - 'main_type' => $data['main_type'] ?? '', - 'main_name' => $data['main_name'] ?? '', - ]; - $res = (new CoreShopDeliveryOrderFinishService())->finishOrder($param); - if ($res) { - return ['finish_time' => time()]; - } else { - return []; - } - } - - public function getTransporterPosition($data) - { - $param = [ - 'out_delivery_no' => $data['delivery_no'] - ]; - $res = (new CoreShopDeliveryOrderService())->getOrderInfo($param); - if ($res) { - return [ - 'rider_latitude' => $res['delivery_start_lat'] ?? '', - 'rider_longitude' => $res['delivery_start_lng'] ?? '', - 'rider_name' => $res['deliver_name'] ?? '', - 'rider_mobile' => $res['deliver_mobile'] ?? '', - ]; - } else { - return []; - } - } - - /** - * 添加门店 - * @param $data - * @return false|mixed - */ - public function addShop($data) - { - - } - - /** - * 更新门店 - * @param $data - * @return false|mixed - */ - public function editShop($data) - { - - } - - function notify(string $action, array $params) - { - try { - Log::write('商家配送订单状态通知回调:' . json_encode($params)); - switch ($action) { - case 'order'://订单状态通知 - (new CoreShopDeliveryOrderMessageService())->orderNotify($params); - break; - // case 'store'://商户//todo - // break; - // case 'recharge'://充值//todo - // break; - } - return true; - } catch (\Exception $e) { - Log::write('商家配送订单状态通知回调异常:' . $e->getMessage()); - return false; - } - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/core/local_delivery/sdk/dada/BaseRequest.php b/niucloud/addon/shop/core/local_delivery/sdk/dada/BaseRequest.php deleted file mode 100644 index cca439a4f..000000000 --- a/niucloud/addon/shop/core/local_delivery/sdk/dada/BaseRequest.php +++ /dev/null @@ -1,150 +0,0 @@ -app_secret = $app_secret; - return $this; - } - - public function getAppSecret(): string - { - return $this->app_secret; - } - - // 设置App Key - public function setAppKey(string $app_key): self - { - $this->app_key = $app_key; - return $this; - } - - public function getAppKey(): string - { - return $this->app_key; - } - - // 设置商户ID - public function setSourceId(string $source_id): self - { - $this->source_id = $source_id; - return $this; - } - - public function getSourceId(): string - { - return $this->source_id; - } - - // 回调地址 - public function setCallback(string $callback): self - { - $this->callback = $callback; - return $this; - } - - public function getCallback() - { - return $this->callback; - } - - // 获取基础参数 - public function getBaseParams(): array - { - return [ - 'app_key' => $this->app_key, - 'source_id' => $this->source_id, - 'app_secret' => $this->app_secret, - ]; - } - - // 获取基础参数 - public function setBaseParams($config) - { - $this->app_key = $config['app_key']; - $this->source_id = $config['source_id']; - $this->app_secret = $config['app_secret']; - return $this; - } - - - /** - * 构建请求参数 - * - * @param mixed $body 接口的body参数内容 - * @return array 构建真正的api接口参数 - */ - protected function generateParams($body) - { - $data = [ - 'source_id' => $this->source_id, - 'app_key' => $this->app_key, - 'timestamp' => time(), - 'format' => 'json', - 'v' => '1.0', - 'body' => empty($body) ? '' : json_encode($body), - ]; - - $data['signature'] = $this->signature($data); - return $data; - } - - /** - * 生成签名 - * - * @param array $data 请求参数 - * @param string $app_secret 应用密钥 - * @return string 签名结果 - */ - private function signature($data) - { - // 请求参数按照【属性名】字典升序排序 - ksort($data); - - // 按照属性名+属性值拼接 - $signStr = ''; - foreach ($data as $key => $value) { - $signStr .= $key . $value; - } - - // 拼接后的结果首尾加上appSecret - $finalSignStr = $this->app_secret . $signStr . $this->app_secret; - - // MD5加密并转为大写 - return strtoupper(md5($finalSignStr)); - } - - protected function request($body, $method_url) - { - Log::write('dada:请求参数:' . json_encode($body)); - $product_type = env('product_type'); - if ($product_type != 'product') { - $domain = $this->test_domain; - } else { - $domain = $this->domain; - } - $request_data = $this->generateParams($body); - $res = (new HttpClient())->httpPost($domain . $method_url, $request_data, [ - 'verify' => false - ]); - Log::write('dada:响应参数:' . json_encode($res)); - if ($res['code'] != 0) { - throw new \Exception($res['msg']); - } - return $res; - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/core/local_delivery/sdk/dada/ConfigRequest.php b/niucloud/addon/shop/core/local_delivery/sdk/dada/ConfigRequest.php deleted file mode 100644 index 0d44e6e39..000000000 --- a/niucloud/addon/shop/core/local_delivery/sdk/dada/ConfigRequest.php +++ /dev/null @@ -1,12 +0,0 @@ -request([], $this->cancel_reason_url); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderCancelRequest.php b/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderCancelRequest.php deleted file mode 100644 index 4dabd7547..000000000 --- a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderCancelRequest.php +++ /dev/null @@ -1,83 +0,0 @@ -cancel_reason = $cancel_reason; - return $this; - } - - public function getCancelReason(): string - { - return $this->cancel_reason; - } - - public function setCancelReasonId(int $cancel_reason_id): self - { - $this->cancel_reason_id = $cancel_reason_id; - return $this; - } - - public function getCancelReasonId(): int - { - return $this->cancel_reason_id; - } - - public function setOrderId(string $order_id): self - { - $this->order_id = $order_id; - return $this; - } - - public function getOrderId(): string - { - return $this->order_id; - } - - public function toArray(): array - { - return [ - 'cancel_reason' => $this->cancel_reason, - 'cancel_reason_id' => $this->cancel_reason_id, - 'order_id' => $this->order_id, - ]; - } - - public function toJson(): string - { - return json_encode($this->toArray(), JSON_UNESCAPED_UNICODE); - } - - private function validate() - { - if (empty($this->order_id)) { - throw new \Exception('订单编号不能为空'); - } - if (empty($this->cancel_reason_id)) { - throw new \Exception('取消原因ID不能为空'); - } - if ($this->cancel_reason_id == 10000 && empty($this->cancel_reason)) { - throw new \Exception('取消原因不能为空'); - } - } - - public function sendRequest() - { - $this->validate(); - $body = $this->toArray(); - foreach ($body as $key => $value) { - if (is_null($value)) { - unset($body[$key]); - } - } - return $this->request($body, $this->request_url); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderCreateByFeeOrderNoRequest.php b/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderCreateByFeeOrderNoRequest.php deleted file mode 100644 index 40d48ea0b..000000000 --- a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderCreateByFeeOrderNoRequest.php +++ /dev/null @@ -1,76 +0,0 @@ -delivery_no = $delivery_no; - return $this; - } - - public function getDeliveryNo() - { - return $this->delivery_no; - } - - public function setEnableReset($enable_reset) - { - $this->enable_reset = $enable_reset; - return $this; - } - - public function getEnableReset() - { - return $this->enable_reset; - } - - public function setInfo($info) - { - $this->info = $info; - return $this; - } - - public function getInfo() - { - return $this->info; - } - - public function toArray() - { - return [ - 'delivery_no' => $this->delivery_no, - 'enable_reset' => $this->enable_reset, - 'info' => $this->info, - ]; - } - - public function toJson(): string - { - return json_encode($this->toArray(), JSON_UNESCAPED_UNICODE); - } - private function validate() - { - if (empty($this->delivery_no)) { - throw new \Exception('单号不能为空'); - } - } - public function sendRequest() - { - $this->validate(); - $body = $this->toArray(); - foreach ($body as $key => $value) { - if (is_null($value)) { - unset($body[$key]); - } - } - return $this->request($body,$this->request_url); - } - -} \ No newline at end of file diff --git a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderCreateRequest.php b/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderCreateRequest.php deleted file mode 100644 index c7d3efe02..000000000 --- a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderCreateRequest.php +++ /dev/null @@ -1,468 +0,0 @@ -cargo_num = $cargo_num; - return $this; - } - - public function getCargoNum() - { - return $this->cargo_num; - } - - // 货物价格 - public function setCargoPrice($cargo_price) - { - $this->cargo_price = $cargo_price; - return $this; - } - - public function getCargoPrice() - { - return $this->cargo_price; - } - - // 货物类型 - public function setCargoType($cargo_type) - { - $this->cargo_type = $cargo_type; - return $this; - } - - public function getCargoType() - { - return $this->cargo_type; - } - - // 货物重量 - public function setCargoWeight($cargo_weight) - { - $this->cargo_weight = $cargo_weight; - return $this; - } - - public function getCargoWeight() - { - return $this->cargo_weight; - } - - // 备注信息 - public function setInfo($info) - { - $this->info = $info; - return $this; - } - - public function getInfo() - { - return $this->info; - } - - // 发票抬头 - public function setInvoiceTitle($invoice_title) - { - $this->invoice_title = $invoice_title; - return $this; - } - - public function getInvoiceTitle() - { - return $this->invoice_title; - } - - // 是否需要收货码 - public function setIsFinishCodeNeeded($is_finish_code_needed) - { - $this->is_finish_code_needed = $is_finish_code_needed; - return $this; - } - - public function getIsFinishCodeNeeded() - { - return $this->is_finish_code_needed; - } - - // 是否垫付 - public function setIsPrepay($is_prepay) - { - $this->is_prepay = $is_prepay; - return $this; - } - - public function getIsPrepay() - { - return $this->is_prepay; - } - - // 是否保价 - public function setIsUseInsurance($is_use_insurance) - { - $this->is_use_insurance = $is_use_insurance; - return $this; - } - - public function getIsUseInsurance() - { - return $this->is_use_insurance; - } // 是否保价 - - // 预约发单时间 - public function setDelayPublishTime($delay_publish_time) - { - $this->delay_publish_time = $delay_publish_time; - return $this; - } - - public function getDelayPublishTime() - { - return $this->delay_publish_time; - } - - // 是否根据期望送达时间预约发单 - public function setIsExpectFinishOrder($is_expect_finish_order) - { - $this->is_expect_finish_order = $is_expect_finish_order; - return $this; - } - - public function getIsExpectFinishOrder() - { - return $this->is_expect_finish_order; - } - - // 期望送达时间 - public function setExpectFinishTimeLimit($expect_finish_time_limit) - { - $this->expect_finish_time_limit = $expect_finish_time_limit; - return $this; - } - - public function getExpectFinishTimeLimit() - { - return $this->expect_finish_time_limit; - } - - // 订单ID - public function setOriginId($origin_id) - { - $this->origin_id = $origin_id; - return $this; - } - - public function getOriginId() - { - return $this->origin_id; - } - - // 取货位置 - public function setPickUpPos($pick_up_pos) - { - $this->pick_up_pos = $pick_up_pos; - return $this; - } - - public function getPickUpPos() - { - return $this->pick_up_pos; - } - - // 商品列表 - public function setProductList($product_list) - { - $this->product_list = $product_list; - return $this; - } - - public function getProductList() - { - return $this->product_list; - } - - // 添加单个商品 - public function addProductItem($product_item) - { - $this->product_list[] = $product_item; - return $this; - } - - // 收货人地址 - public function setReceiverAddress($receiver_address) - { - $this->receiver_address = $receiver_address; - return $this; - } - - public function getReceiverAddress() - { - return $this->receiver_address; - } - - // 收货人纬度 - public function setReceiverLat($receiver_lat) - { - $this->receiver_lat = $receiver_lat; - return $this; - } - - public function getReceiverLat() - { - return $this->receiver_lat; - } - - // 收货人经度 - public function setReceiverLng($receiver_lng) - { - $this->receiver_lng = $receiver_lng; - return $this; - } - - public function getReceiverLng() - { - return $this->receiver_lng; - } - - // 收货人姓名 - public function setReceiverName($receiver_name) - { - $this->receiver_name = $receiver_name; - return $this; - } - - public function getReceiverName() - { - return $this->receiver_name; - } - - // 收货人电话 - public function setReceiverPhone($receiver_phone) - { - $this->receiver_phone = $receiver_phone; - return $this; - } - - public function getReceiverPhone() - { - return $this->receiver_phone; - } - - // 门店编号 - public function setShopNo($shop_no) - { - $this->shop_no = $shop_no; - return $this; - } - - public function getShopNo() - { - return $this->shop_no; - } - - // 小费 - public function setTips($tips) - { - $this->tips = $tips; - return $this; - } - - public function getTips() - { - return $this->tips; - } - - // 业务类型 - public function setBusinessType($business_type) - { - $this->business_type = $business_type; - return $this; - } - - public function getBusinessType() - { - return $this->business_type; - } - - // 商家地址 - public function setSupplierAddress($supplier_address) - { - $this->supplier_address = $supplier_address; - return $this; - } - - public function getSupplierAddress() - { - return $this->supplier_address; - } - - // 商家纬度 - public function setSupplierLat($supplier_lat) - { - $this->supplier_lat = $supplier_lat; - return $this; - } - - public function getSupplierLat() - { - return $this->supplier_lat; - } - - // 商家经度 - public function setSupplierLng($supplier_lng) - { - $this->supplier_lng = $supplier_lng; - return $this; - } - - public function getSupplierLng() - { - return $this->supplier_lng; - } - - // 商家名称 - public function setSupplierName($supplier_name) - { - $this->supplier_name = $supplier_name; - return $this; - } - - public function getSupplierName() - { - return $this->supplier_name; - } - - // 商家电话 - public function setSupplierPhone($supplier_phone) - { - $this->supplier_phone = $supplier_phone; - return $this; - } - - public function getSupplierPhone() - { - return $this->supplier_phone; - } - - // 将对象转换为数组 - public function toArray() - { - return [ - 'callback' => $this->callback, - 'cargo_num' => $this->cargo_num, - 'cargo_price' => $this->cargo_price, - 'cargo_type' => $this->cargo_type, - 'cargo_weight' => $this->cargo_weight, - 'info' => $this->info, - 'invoice_title' => $this->invoice_title, - 'is_finish_code_needed' => $this->is_finish_code_needed ? 1 : 0, - 'delay_publish_time' => $this->delay_publish_time, - 'is_expect_finish_order' => $this->is_expect_finish_order ? 1 : 0, - 'expect_finish_time_limit' => $this->expect_finish_time_limit, - 'is_prepay' => $this->is_prepay ? 1 : 0, - 'is_use_insurance' => $this->is_use_insurance ? 1 : 0, - 'origin_id' => $this->origin_id, - 'pick_up_pos' => $this->pick_up_pos, - 'product_list' => $this->product_list, - 'receiver_address' => $this->receiver_address, - 'receiver_lat' => $this->receiver_lat, - 'receiver_lng' => $this->receiver_lng, - 'receiver_name' => $this->receiver_name, - 'receiver_phone' => $this->receiver_phone, - 'shop_no' => $this->shop_no, - 'tips' => $this->tips, - 'business_type' => $this->business_type, - 'supplier_address' => $this->supplier_address, - 'supplier_lat' => $this->supplier_lat, - 'supplier_lng' => $this->supplier_lng, - 'supplier_name' => $this->supplier_name, - 'supplier_phone' => $this->supplier_phone, - ]; - } - - // 将对象转换为JSON - public function toJson() - { - return json_encode($this->toArray(), JSON_UNESCAPED_UNICODE); - } - - private function validate() - { - if (empty($this->shop_no)) { - throw new \Exception('门店编号不能为空'); - } - if (empty($this->origin_id)) { - throw new \Exception('第三方订单ID不能为空'); - } - if (empty($this->cargo_price)) { - throw new \Exception('订单金额不能为空'); - } - if (empty($this->receiver_name)) { - throw new \Exception('收货人名称不能为空'); - } - if (empty($this->receiver_address)) { - throw new \Exception('收货人地址不能为空'); - } - if (empty($this->receiver_lat) || empty($this->receiver_lng)) { - throw new \Exception('收货人地址经纬度不能为空'); - } - if (empty($this->callback)) { - throw new \Exception('回调URL不能为空'); - } - if ($this->cargo_weight <= 0) { - throw new \Exception('订单重量必须大于0'); - } - if (empty($this->receiver_phone)) { - throw new \Exception('收货人手机号不能为空'); - } - if (!empty($this->is_expect_finish_order) && empty($this->expect_finish_time_limit)) { - throw new \Exception('期望送达时间不能为空'); - } - } - - public function sendRequest() - { - $this->validate(); - $body = $this->toArray(); -// dd($body); - foreach ($body as $key => $value) { - if (is_null($value)) { - unset($body[$key]); - } - } - return $this->request($body,$this->request_url); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderFeeRequest.php b/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderFeeRequest.php deleted file mode 100644 index 0dc41d65d..000000000 --- a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderFeeRequest.php +++ /dev/null @@ -1,430 +0,0 @@ -cargo_num = $cargo_num; - return $this; - } - - public function getCargoNum() - { - return $this->cargo_num; - } - - // 货物价格 - public function setCargoPrice($cargo_price) - { - $this->cargo_price = $cargo_price; - return $this; - } - - public function getCargoPrice() - { - return $this->cargo_price; - } - - // 货物类型 - public function setCargoType($cargo_type) - { - $this->cargo_type = $cargo_type; - return $this; - } - - public function getCargoType() - { - return $this->cargo_type; - } - - // 货物重量 - public function setCargoWeight($cargo_weight) - { - $this->cargo_weight = $cargo_weight; - return $this; - } - - public function getCargoWeight() - { - return $this->cargo_weight; - } - - // 备注信息 - public function setInfo($info) - { - $this->info = $info; - return $this; - } - - public function getInfo() - { - return $this->info; - } - - // 发票抬头 - public function setInvoiceTitle($invoice_title) - { - $this->invoice_title = $invoice_title; - return $this; - } - - public function getInvoiceTitle() - { - return $this->invoice_title; - } - - // 是否需要收货码 - public function setIsFinishCodeNeeded($is_finish_code_needed) - { - $this->is_finish_code_needed = $is_finish_code_needed; - return $this; - } - - public function getIsFinishCodeNeeded() - { - return $this->is_finish_code_needed; - } - - // 是否垫付 - public function setIsPrepay($is_prepay) - { - $this->is_prepay = $is_prepay; - return $this; - } - - public function getIsPrepay() - { - return $this->is_prepay; - } - - // 是否保价 - public function setIsUseInsurance($is_use_insurance) - { - $this->is_use_insurance = $is_use_insurance; - return $this; - } - - public function getIsUseInsurance() - { - return $this->is_use_insurance; - } - - // 订单ID - public function setOriginId($origin_id) - { - $this->origin_id = $origin_id; - return $this; - } - - public function getOriginId() - { - return $this->origin_id; - } - - // 取货位置 - public function setPickUpPos($pick_up_pos) - { - $this->pick_up_pos = $pick_up_pos; - return $this; - } - - public function getPickUpPos() - { - return $this->pick_up_pos; - } - - // 商品列表 - public function setProductList($product_list) - { - $this->product_list = $product_list; - return $this; - } - - public function getProductList() - { - return $this->product_list; - } - - // 收货人地址 - public function setReceiverAddress($receiver_address) - { - $this->receiver_address = $receiver_address; - return $this; - } - - public function getReceiverAddress() - { - return $this->receiver_address; - } - - // 收货人纬度 - public function setReceiverLat($receiver_lat) - { - $this->receiver_lat = $receiver_lat; - return $this; - } - - public function getReceiverLat() - { - return $this->receiver_lat; - } - - // 收货人经度 - public function setReceiverLng($receiver_lng) - { - $this->receiver_lng = $receiver_lng; - return $this; - } - - public function getReceiverLng() - { - return $this->receiver_lng; - } - - // 收货人姓名 - public function setReceiverName($receiver_name) - { - $this->receiver_name = $receiver_name; - return $this; - } - - public function getReceiverName() - { - return $this->receiver_name; - } - - // 收货人电话 - public function setReceiverPhone($receiver_phone) - { - $this->receiver_phone = $receiver_phone; - return $this; - } - - public function getReceiverPhone() - { - return $this->receiver_phone; - } - - // 门店编号 - public function setShopNo($shop_no) - { - $this->shop_no = $shop_no; - return $this; - } - - public function getShopNo() - { - return $this->shop_no; - } - - // 小费 - public function setTips($tips) - { - $this->tips = $tips; - return $this; - } - - public function getTips() - { - return $this->tips; - } - - // 业务类型 - public function setBusinessType($business_type) - { - $this->business_type = $business_type; - return $this; - } - - public function getBusinessType() - { - return $this->business_type; - } - - // 商家地址 - public function setSupplierAddress($supplier_address) - { - $this->supplier_address = $supplier_address; - return $this; - } - - public function getSupplierAddress() - { - return $this->supplier_address; - } - - // 商家纬度 - public function setSupplierLat($supplier_lat) - { - $this->supplier_lat = $supplier_lat; - return $this; - } - - public function getSupplierLat() - { - return $this->supplier_lat; - } - - // 商家经度 - public function setSupplierLng($supplier_lng) - { - $this->supplier_lng = $supplier_lng; - return $this; - } - - public function getSupplierLng() - { - return $this->supplier_lng; - } - - // 商家名称 - public function setSupplierName($supplier_name) - { - $this->supplier_name = $supplier_name; - return $this; - } - - public function getSupplierName() - { - return $this->supplier_name; - } - - // 商家电话 - public function setSupplierPhone($supplier_phone) - { - $this->supplier_phone = $supplier_phone; - return $this; - } - - public function getSupplierPhone() - { - return $this->supplier_phone; - } - - // 将对象转换为数组 - public function toArray() - { - return [ - 'callback' => $this->callback, - 'cargo_num' => $this->cargo_num, - 'cargo_price' => $this->cargo_price, - 'cargo_type' => $this->cargo_type, - 'cargo_weight' => $this->cargo_weight, - 'info' => $this->info, - 'invoice_title' => $this->invoice_title, - 'is_finish_code_needed' => $this->is_finish_code_needed, - 'is_prepay' => $this->is_prepay, - 'is_use_insurance' => $this->is_use_insurance, - 'origin_id' => $this->origin_id, - 'pick_up_pos' => $this->pick_up_pos, - 'product_list' => $this->product_list, - 'receiver_address' => $this->receiver_address, - 'receiver_lat' => $this->receiver_lat, - 'receiver_lng' => $this->receiver_lng, - 'receiver_name' => $this->receiver_name, - 'receiver_phone' => $this->receiver_phone, - 'shop_no' => $this->shop_no, - 'tips' => $this->tips, - 'business_type' => $this->business_type, - 'supplier_address' => $this->supplier_address, - 'supplier_lat' => $this->supplier_lat, - 'supplier_lng' => $this->supplier_lng, - 'supplier_name' => $this->supplier_name, - 'supplier_phone' => $this->supplier_phone, - ]; - } - - public function toJson(): string - { - $body = $this->toArray(); - foreach ($body as $key => $value) { - if (is_null($value)) { - unset($body[$key]); - } - } - return json_encode($body, JSON_UNESCAPED_UNICODE); - } - - private function validate() - { - if (empty($this->shop_no)) { - throw new \Exception('门店编号不能为空'); - } - if (empty($this->origin_id)) { - throw new \Exception('第三方订单ID不能为空'); - } - if (empty($this->cargo_price)) { - throw new \Exception('订单金额不能为空'); - } - if (empty($this->receiver_name)) { - throw new \Exception('收货人名称不能为空'); - } - if (empty($this->receiver_address)) { - throw new \Exception('收货人地址不能为空'); - } - if (empty($this->receiver_lat) || empty($this->receiver_lng)) { - throw new \Exception('收货人地址经纬度不能为空'); - } - if (empty($this->callback)) { - throw new \Exception('回调URL不能为空'); - } - if ($this->cargo_weight <= 0) { - throw new \Exception('订单重量必须大于0'); - } - if (empty($this->receiver_phone)) { - throw new \Exception('收货人手机号不能为空'); - } - } - - public function sendRequest() - { - $this->validate(); - $body = $this->toArray(); - foreach ($body as $key => $value) { - if (is_null($value)) { - unset($body[$key]); - } - } - return $this->request($body,$this->request_url); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderInfoRequest.php b/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderInfoRequest.php deleted file mode 100644 index c231a643f..000000000 --- a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderInfoRequest.php +++ /dev/null @@ -1,51 +0,0 @@ -order_id = $order_id; - return $this; - } - - public function getOrderId(): string - { - return $this->order_id; - } - - public function toArray(): array - { - return [ - 'order_id' => $this->order_id, - ]; - } - - public function toJson(): string - { - return json_encode($this->toArray(), JSON_UNESCAPED_UNICODE); - } - - private function validate() - { - if (empty($this->order_id)) { - throw new \Exception('订单ID不能为空'); - } - } - - public function sendRequest() - { - $this->validate(); - $body = $this->toArray(); - foreach ($body as $key => $value) { - if (is_null($value)) { - unset($body[$key]); - } - } - return $this->request($body, $this->request_url); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderReCreateRequest.php b/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderReCreateRequest.php deleted file mode 100644 index 70c2433ef..000000000 --- a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderReCreateRequest.php +++ /dev/null @@ -1,472 +0,0 @@ -cargo_num = $cargo_num; - return $this; - } - - public function getCargoNum() - { - return $this->cargo_num; - } - - // 货物价格 - public function setCargoPrice($cargo_price) - { - $this->cargo_price = $cargo_price; - return $this; - } - - public function getCargoPrice() - { - return $this->cargo_price; - } - - // 货物类型 - public function setCargoType($cargo_type) - { - $this->cargo_type = $cargo_type; - return $this; - } - - public function getCargoType() - { - return $this->cargo_type; - } - - // 货物重量 - public function setCargoWeight($cargo_weight) - { - $this->cargo_weight = $cargo_weight; - return $this; - } - - public function getCargoWeight() - { - return $this->cargo_weight; - } - - // 备注信息 - public function setInfo($info) - { - $this->info = $info; - return $this; - } - - public function getInfo() - { - return $this->info; - } - - // 发票抬头 - public function setInvoiceTitle($invoice_title) - { - $this->invoice_title = $invoice_title; - return $this; - } - - public function getInvoiceTitle() - { - return $this->invoice_title; - } - - // 是否需要收货码 - public function setIsFinishCodeNeeded($is_finish_code_needed) - { - $this->is_finish_code_needed = $is_finish_code_needed; - return $this; - } - - public function getIsFinishCodeNeeded() - { - return $this->is_finish_code_needed; - } - - // 是否垫付 - public function setIsPrepay($is_prepay) - { - $this->is_prepay = $is_prepay; - return $this; - } - - public function getIsPrepay() - { - return $this->is_prepay; - } - - // 是否保价 - public function setIsUseInsurance($is_use_insurance) - { - $this->is_use_insurance = $is_use_insurance; - return $this; - } - - public function getIsUseInsurance() - { - return $this->is_use_insurance; - } // 是否保价 - - // 预约发单时间 - public function setDelayPublishTime($delay_publish_time) - { - $this->delay_publish_time = $delay_publish_time; - return $this; - } - - public function getDelayPublishTime() - { - return $this->delay_publish_time; - } - - // 是否根据期望送达时间预约发单 - public function setIsExpectFinishOrder($is_expect_finish_order) - { - $this->is_expect_finish_order = $is_expect_finish_order; - return $this; - } - - public function getIsExpectFinishOrder() - { - return $this->is_expect_finish_order; - } - - // 期望送达时间 - public function setExpectFinishTimeLimit($expect_finish_time_limit) - { - $this->expect_finish_time_limit = $expect_finish_time_limit; - return $this; - } - - public function getExpectFinishTimeLimit() - { - return $this->expect_finish_time_limit; - } - - // 订单ID - public function setOriginId($origin_id) - { - $this->origin_id = $origin_id; - return $this; - } - - public function getOriginId() - { - return $this->origin_id; - } - - // 取货位置 - public function setPickUpPos($pick_up_pos) - { - $this->pick_up_pos = $pick_up_pos; - return $this; - } - - public function getPickUpPos() - { - return $this->pick_up_pos; - } - - // 商品列表 - public function setProductList($product_list) - { - $this->product_list = $product_list; - return $this; - } - - public function getProductList() - { - return $this->product_list; - } - - // 添加单个商品 - public function addProductItem($product_item) - { - $this->product_list[] = $product_item; - return $this; - } - - // 收货人地址 - public function setReceiverAddress($receiver_address) - { - $this->receiver_address = $receiver_address; - return $this; - } - - public function getReceiverAddress() - { - return $this->receiver_address; - } - - // 收货人纬度 - public function setReceiverLat($receiver_lat) - { - $this->receiver_lat = $receiver_lat; - return $this; - } - - public function getReceiverLat() - { - return $this->receiver_lat; - } - - // 收货人经度 - public function setReceiverLng($receiver_lng) - { - $this->receiver_lng = $receiver_lng; - return $this; - } - - public function getReceiverLng() - { - return $this->receiver_lng; - } - - // 收货人姓名 - public function setReceiverName($receiver_name) - { - $this->receiver_name = $receiver_name; - return $this; - } - - public function getReceiverName() - { - return $this->receiver_name; - } - - // 收货人电话 - public function setReceiverPhone($receiver_phone) - { - $this->receiver_phone = $receiver_phone; - return $this; - } - - public function getReceiverPhone() - { - return $this->receiver_phone; - } - - // 门店编号 - public function setShopNo($shop_no) - { - $this->shop_no = $shop_no; - return $this; - } - - public function getShopNo() - { - return $this->shop_no; - } - - // 小费 - public function setTips($tips) - { - $this->tips = $tips; - return $this; - } - - public function getTips() - { - return $this->tips; - } - - // 业务类型 - public function setBusinessType($business_type) - { - $this->business_type = $business_type; - return $this; - } - - public function getBusinessType() - { - return $this->business_type; - } - - // 商家地址 - public function setSupplierAddress($supplier_address) - { - $this->supplier_address = $supplier_address; - return $this; - } - - public function getSupplierAddress() - { - return $this->supplier_address; - } - - // 商家纬度 - public function setSupplierLat($supplier_lat) - { - $this->supplier_lat = $supplier_lat; - return $this; - } - - public function getSupplierLat() - { - return $this->supplier_lat; - } - - // 商家经度 - public function setSupplierLng($supplier_lng) - { - $this->supplier_lng = $supplier_lng; - return $this; - } - - public function getSupplierLng() - { - return $this->supplier_lng; - } - - // 商家名称 - public function setSupplierName($supplier_name) - { - $this->supplier_name = $supplier_name; - return $this; - } - - public function getSupplierName() - { - return $this->supplier_name; - } - - // 商家电话 - public function setSupplierPhone($supplier_phone) - { - $this->supplier_phone = $supplier_phone; - return $this; - } - - public function getSupplierPhone() - { - return $this->supplier_phone; - } - - // 将对象转换为数组 - public function toArray() - { - return [ - 'callback' => $this->callback, - 'cargo_num' => $this->cargo_num, - 'cargo_price' => $this->cargo_price, - 'cargo_type' => $this->cargo_type, - 'cargo_weight' => $this->cargo_weight, - 'info' => $this->info, - 'invoice_title' => $this->invoice_title, - 'is_finish_code_needed' => $this->is_finish_code_needed ? 1 : 0, - 'delay_publish_time' => $this->delay_publish_time, - 'is_expect_finish_order' => $this->is_expect_finish_order ? 1 : 0, - 'expect_finish_time_limit' => $this->expect_finish_time_limit, - 'is_prepay' => $this->is_prepay ? 1 : 0, - 'is_use_insurance' => $this->is_use_insurance ? 1 : 0, - 'origin_id' => $this->origin_id, - 'pick_up_pos' => $this->pick_up_pos, - 'product_list' => $this->product_list, - 'receiver_address' => $this->receiver_address, - 'receiver_lat' => $this->receiver_lat, - 'receiver_lng' => $this->receiver_lng, - 'receiver_name' => $this->receiver_name, - 'receiver_phone' => $this->receiver_phone, - 'shop_no' => $this->shop_no, - 'tips' => $this->tips, - 'business_type' => $this->business_type, - 'supplier_address' => $this->supplier_address, - 'supplier_lat' => $this->supplier_lat, - 'supplier_lng' => $this->supplier_lng, - 'supplier_name' => $this->supplier_name, - 'supplier_phone' => $this->supplier_phone, - ]; - } - - // 将对象转换为JSON - public function toJson() - { - return json_encode($this->toArray(), JSON_UNESCAPED_UNICODE); - } - - private function validate() - { - if (empty($this->shop_no)) { - throw new \Exception('门店编号不能为空'); - } - if (empty($this->origin_id)) { - throw new \Exception('第三方订单ID不能为空'); - } - if (empty($this->cargo_price)) { - throw new \Exception('订单金额不能为空'); - } - if (empty($this->receiver_name)) { - throw new \Exception('收货人名称不能为空'); - } - if (empty($this->receiver_address)) { - throw new \Exception('收货人地址不能为空'); - } - if (empty($this->receiver_lat) || empty($this->receiver_lng)) { - throw new \Exception('收货人地址经纬度不能为空'); - } - if (empty($this->callback)) { - throw new \Exception('回调URL不能为空'); - } - if ($this->cargo_weight <= 0) { - throw new \Exception('订单重量必须大于0'); - } - if (empty($this->receiver_phone)) { - throw new \Exception('收货人手机号不能为空'); - } - if (!empty($this->is_expect_finish_order) && empty($this->expect_finish_time_limit)) { - throw new \Exception('期望送达时间不能为空'); - } - } - - public function sendRequest() - { - $this->validate(); - $body = $this->toArray(); - foreach ($body as $key => $value) { - if (is_null($value)) { - unset($body[$key]); - } - } - return $this->request($body,$this->request_url); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderTransporterPositionH5Request.php b/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderTransporterPositionH5Request.php deleted file mode 100644 index da4dda245..000000000 --- a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderTransporterPositionH5Request.php +++ /dev/null @@ -1,54 +0,0 @@ -order_id = $order_id; - return $this; - } - - public function getOrderId() - { - return $this->order_id; - } - - - public function toArray() - { - return [ - 'order_id' => $this->order_id, - ]; - } - - public function toJson() - { - return json_encode($this->toArray(), JSON_UNESCAPED_UNICODE); - } - - private function validate() - { - if (empty($this->order_id)) { - throw new \Exception('订单ID不能为空'); - } - } - - public function sendRequest() - { - $this->validate(); - $body = $this->toArray(); - foreach ($body as $key => $value) { - if (is_null($value)) { - unset($body[$key]); - } - } - return $this->request($body, $this->request_url); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderTransporterPositionRequest.php b/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderTransporterPositionRequest.php deleted file mode 100644 index b115a0b35..000000000 --- a/niucloud/addon/shop/core/local_delivery/sdk/dada/OrderTransporterPositionRequest.php +++ /dev/null @@ -1,60 +0,0 @@ -order_ids = $order_ids; - return $this; - } - - public function getOrderIds() - { - return $this->order_ids; - } - - // 添加单个商品 - public function addProductItem($order_id) - { - $this->order_ids[] = $order_id; - return $this; - } - - public function toArray() - { - return [ - 'orderIds' => $this->order_ids, - ]; - } - - public function toJson() - { - return json_encode($this->toArray(), JSON_UNESCAPED_UNICODE); - } - - private function validate() - { - if (empty($this->order_ids)) { - throw new \Exception('订单ID不能为空'); - } - } - - public function sendRequest() - { - $this->validate(); - $body = $this->toArray(); - foreach ($body as $key => $value) { - if (is_null($value)) { - unset($body[$key]); - } - } - return $this->request($body, $this->request_url); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/core/local_delivery/sdk/dada/ShopAddRequest.php b/niucloud/addon/shop/core/local_delivery/sdk/dada/ShopAddRequest.php deleted file mode 100644 index fec0785cb..000000000 --- a/niucloud/addon/shop/core/local_delivery/sdk/dada/ShopAddRequest.php +++ /dev/null @@ -1,228 +0,0 @@ -station_name = $station_name; - return $this; - } - - public function getStationName() - { - return $this->station_name; - } - - public function setBusiness($business) - { - $this->business = $business; - return $this; - } - - public function getBusiness() - { - return $this->business; - } - - public function setStationAddress($station_address) - { - $this->station_address = $station_address; - return $this; - } - - public function getStationAddress() - { - return $this->station_address; - } - - public function setLng($lng) - { - $this->lng = $lng; - return $this; - } - - public function getLng() - { - return $this->lng; - } - - public function setLat($lat) - { - $this->lat = $lat; - return $this; - } - - public function getLat() - { - return $this->lat; - } - - public function setContactName($contact_name) - { - $this->contact_name = $contact_name; - return $this; - } - - public function getContactName() - { - return $this->contact_name; - } - - public function setPhone($phone) - { - $this->phone = $phone; - return $this; - } - - public function getPhone() - { - return $this->phone; - } - - public function setOriginShopId($origin_shop_id) - { - $this->origin_shop_id = $origin_shop_id; - return $this; - } - - public function getOriginShopId() - { - return $this->origin_shop_id; - } - - public function setIdCard($id_card) - { - $this->id_card = $id_card; - return $this; - } - - public function getIdCard() - { - return $this->id_card; - } - - public function setUsername($username) - { - $this->username = $username; - return $this; - } - - public function getUsername() - { - return $this->username; - } - - public function setPassword($password) - { - $this->password = $password; - return $this; - } - - public function getPassword() - { - return $this->password; - } - - public function setSettlementType($settlement_type) - { - $this->settlement_type = $settlement_type; - return $this; - } - - public function getSettlementType() - { - return $this->settlement_type; - } - - // 将对象转换为数组 - public function toArray() - { - return [ - 'station_name' => $this->station_name, - 'business' => $this->business, - 'station_address' => $this->station_address, - 'lng' => $this->lng, - 'lat' => $this->lat, - 'contact_name' => $this->contact_name, - 'phone' => $this->phone, - 'origin_shop_id' => $this->origin_shop_id, - 'id_card' => $this->id_card, - 'username' => $this->username, - 'password' => $this->password, - 'settlement_type' => $this->settlement_type, - ]; - } - - // 将对象转换为JSON - public function toJson() - { - return json_encode($this->toArray(), JSON_UNESCAPED_UNICODE); - } - - private function validate() - { - if (empty($this->station_name)) { - throw new \Exception('门店名称不能为空'); - } - if (empty($this->business)) { - throw new \Exception('门店所属行业类别不能为空'); - } - if (empty($this->station_address)) { - throw new \Exception('门店地址不能为空'); - } - if (empty($this->lng) || empty($this->lat)) { - throw new \Exception('门店经纬度不能为空'); - } - if (empty($this->contact_name)) { - throw new \Exception('联系人姓名不能为空'); - } - if (empty($this->phone)) { - throw new \Exception('联系人电话不能为空'); - } - if (empty($this->origin_shop_id)) { - throw new \Exception('门店编号不能为空'); - } - } - - public function sendRequest() - { - $this->validate(); - $body = $this->toArray(); - foreach ($body as $key => $value) { - if (is_null($value)) { - unset($body[$key]); - } - } - $body = [$body]; - return $this->request($body,$this->request_url); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/core/local_delivery/sdk/dada/ShopEditRequest.php b/niucloud/addon/shop/core/local_delivery/sdk/dada/ShopEditRequest.php deleted file mode 100644 index eecf6ef9d..000000000 --- a/niucloud/addon/shop/core/local_delivery/sdk/dada/ShopEditRequest.php +++ /dev/null @@ -1,167 +0,0 @@ -station_name = $station_name; - return $this; - } - - public function getStationName() - { - return $this->station_name; - } - - public function setBusiness($business) - { - $this->business = $business; - return $this; - } - - public function getBusiness() - { - return $this->business; - } - - public function setStationAddress($station_address) - { - $this->station_address = $station_address; - return $this; - } - - public function getStationAddress() - { - return $this->station_address; - } - - public function setLng($lng) - { - $this->lng = $lng; - return $this; - } - - public function getLng() - { - return $this->lng; - } - - public function setLat($lat) - { - $this->lat = $lat; - return $this; - } - - public function getLat() - { - return $this->lat; - } - - public function setContactName($contact_name) - { - $this->contact_name = $contact_name; - return $this; - } - - public function getContactName() - { - return $this->contact_name; - } - - public function setPhone($phone) - { - $this->phone = $phone; - return $this; - } - - public function getPhone() - { - return $this->phone; - } - - public function setOriginShopId($origin_shop_id) - { - $this->origin_shop_id = $origin_shop_id; - return $this; - } - - public function getOriginShopId() - { - return $this->origin_shop_id; - } - - public function setSettlementType($settlement_type) - { - $this->settlement_type = $settlement_type; - return $this; - } - - public function getSettlementType() - { - return $this->settlement_type; - } - - // 将对象转换为数组 - public function toArray() - { - return [ - 'station_name' => $this->station_name, - 'business' => $this->business, - 'station_address' => $this->station_address, - 'lng' => $this->lng, - 'lat' => $this->lat, - 'contact_name' => $this->contact_name, - 'phone' => $this->phone, - 'origin_shop_id' => $this->origin_shop_id, - 'settlement_type' => $this->settlement_type, - ]; - } - - // 将对象转换为JSON - public function toJson() - { - return json_encode($this->toArray(), JSON_UNESCAPED_UNICODE); - } - - private function validate() - { - if (empty($this->origin_shop_id)) { - throw new \Exception('门店编号不能为空'); - } - } - - public function sendRequest() - { - $this->validate(); - $body = $this->toArray(); - foreach ($body as $key => $value) { - if (is_null($value)) { - unset($body[$key]); - } - } - return $this->request($body,$this->request_url); - } -} \ No newline at end of file diff --git a/niucloud/addon/shop/info.json b/niucloud/addon/shop/info.json deleted file mode 100644 index 6e5fdc276..000000000 --- a/niucloud/addon/shop/info.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "title": "商城系统", - "desc": "实物虚拟商品,订单,物流同城配送,门店自提", - "key": "shop", - "version": "6.5.0", - "author": "niucloud", - "type": "app", - "support_app": "", - "support_version": "1.5.8" -} diff --git a/niucloud/addon/shop/install.php b/niucloud/addon/shop/install.php deleted file mode 100644 index 92ff839a9..000000000 --- a/niucloud/addon/shop/install.php +++ /dev/null @@ -1,61 +0,0 @@ - 'NIUSHOP', - // logo - 'logo' => 'niushop_logo.jpg', - // 官网地址 - 'website_url' => 'https://www.niushop.com', - // 论坛地址 - 'bbs_url' => 'https://www.niushop.com/web/community/index.html', - // 编译帮助手册 - 'build_manual' => 'https://www.kancloud.cn/niushop/niushop_v6/3224842', - // 安装协议 - 'agreement' => '版权所有 (c)2016,Niushop开源商城团队保留所有权利。 -

- 感谢您选择Niushop开源商城(以下简称NiuShop)NiuShop基于 PHP + MySQL的技术开发,全部源码开放。
- 为了使你正确并合法的使用本软件,请你在使用前务必阅读清楚下面的协议条款: -

-

- 一、本授权协议适用且仅适用于Niushop开源商城系统(以下简称Niushop)任何版本,Niushop开源商城官方对本授权协议的最终解释权。 -

-

- 二、协议许可的权利 -

    -
  1. 非授权用户允许商用,严禁去除Niushop相关的版权信息。
  2. -
  3. 请尊重Niushop开发人员劳动成果,严禁使用本系统转卖、销售或二次开发后转卖、销售等商业行为。
  4. -
  5. 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
  6. -
  7. 您可以在协议规定的约束和限制范围内修改Niushop开源商城源代码或界面风格以适应您的网站要求。
  8. -
  9. 您拥有使用本软件构建的网站全部内容所有权,并独立承担与这些内容的相关法律义务。
  10. -
  11. - 获得商业授权之后,您可以将本软件应用于商业用途,同时依据所购买的授权类型中确定的技术支持内容,自购买时刻起,在技术支持期限内拥有通过指定的方式获得指定范围内的技术支持服务。商业授权用户享有反映和提出意见的权力,相关意见将被作为首要考虑,但没有一定被采纳的承诺或保证。 -
  12. -
-

-

- 三、协议规定的约束和限制 -

    -
  1. 未获商业授权之前,允许您对Niushop应用于商业用途,但严禁去除Niushop任何相关的版权信息。
  2. -
  3. 未经官方许可,不得对本软件或与之关联的商业授权进行出租、出售、抵押或发放子许可证。
  4. -
  5. 未经官方许可,禁止在Niushop开源商城的整体或任何部分基础上以发展任何派生版本、修改版本或第三方版本用于重新分发。
  6. -
  7. 如果您未能遵守本协议的条款,您的授权将被终止,所被许可的权利将被收回,并承担相应法律责任。
  8. -
-

-

- 四、有限担保和免责声明 -

    -
  1. 本软件及所附带的文件是作为不提供任何明确的或隐含的赔偿或担保的形式提供的。
  2. -
  3. 用户出于自愿而使用本软件,您必须了解使用本软件的风险,在尚未购买产品技术服务之前,我们不承诺对免费用户提供任何形式的技术支持、使用担保,也不承担任何因使用本软件而产生问题的相关责任。
  4. -
  5. 电子文本形式的授权协议如同双方书面签署的协议一样,具有完全的和等同的法律效力。您一旦开始确认本协议并安装 - Niushop,即被视为完全理解并接受本协议的各项条款,在享有上述条款授予的权力的同时,受到相关的约束和限制。协议许可范围以外的行为,将直接违反本授权协议并构成侵权,我们有权随时终止授权,责令停止损害,并保留追究相关责任的权力。 -
  6. -
  7. 如果本软件带有其它软件的整合API示范例子包,这些文件版权不属于本软件官方,并且这些文件是没经过授权发布的,请参考相关软件的使用许可合法的使用。
  8. -
-

', - // 站点名称 - 'admin_site_name' => 'NIUSHOP V6', - // admin 端登录页默认图 - 'admin_login_bg' => 'install/img/niushop_login_index_left.jpg', - // admin 端默认logo - 'admin_logo' => 'install/img/niushop_logo.jpg' -]; diff --git a/niucloud/addon/shop/package/uni-app-pages.php b/niucloud/addon/shop/package/uni-app-pages.php deleted file mode 100644 index 4885108e1..000000000 --- a/niucloud/addon/shop/package/uni-app-pages.php +++ /dev/null @@ -1,287 +0,0 @@ - <<) { - return request.get(`shop/cart`, params) -} - -/** - * 获取购物车商品列表 - */ -export function getCartGoodsList(params: Record) { - return request.get(`shop/cart/goods`, params) -} - -/** - * 获取购物车数量 - */ -export function getCartSum(params: Record) { - return request.get(`shop/cart/sum`, params) -} - -/** - * 购物车计算 - */ -export function getCartCalculate(params: Record) { - return request.get(`shop/cart/calculate`, params) -} diff --git a/niucloud/addon/shop/uni-app/api/config.ts b/niucloud/addon/shop/uni-app/api/config.ts deleted file mode 100644 index 71a3541ac..000000000 --- a/niucloud/addon/shop/uni-app/api/config.ts +++ /dev/null @@ -1,8 +0,0 @@ -import request from '@/utils/request' - -/** - * 获取发票配置 - */ -export function getInvoiceConfig() { - return request.get(`shop/config/invoice`) -} diff --git a/niucloud/addon/shop/uni-app/api/coupon.ts b/niucloud/addon/shop/uni-app/api/coupon.ts deleted file mode 100644 index 27b1b4c99..000000000 --- a/niucloud/addon/shop/uni-app/api/coupon.ts +++ /dev/null @@ -1,65 +0,0 @@ -import request from '@/utils/request' - -/** - * 优惠券列表 - */ -export function getShopCouponList(params: Record) { - return request.get(`shop/coupon`, params) -} - -/** - * 优惠券详情 - */ -export function getShopCouponInfo(id: number) { - return request.get(`shop/coupon/${ id }`) -} - -/** - * 优惠券二维码 - */ -export function getShopCouponQrocde(id: number) { - return request.get(`shop/coupon/qrcode/${ id }`) -} - -/** - * 领取优惠券 - */ -export function getCoupon(params: Record) { - return request.post(`shop/coupon`, params, { showSuccessMessage: true }) -} - -/** - * 获取我的优惠券 - */ -export function getMyCouponList(params: Record) { - return request.get(`shop/member/coupon`, params) -} - -/** - * 获取优惠券列表供组件调用 - */ -export function getShopCouponComponents(params: Record) { - return request.get(`shop/coupon/components`, params) -} - -/** - * 获取我的优惠券数量 - * status 1:待使用,2:已使用,3:已过期,4:已失效 - */ -export function getMyCouponCount(params: Record) { - return request.get(`shop/member/coupon/count`, params) -} - -/** - * 获取我的优惠券类型 - */ -export function getMyCouponType() { - return request.get(`shop/coupon_type`) -} - -/** - * 获取我的优惠数量 - */ -export function getMyCouponStatusCount() { - return request.get(`shop/member/coupon/status_count`) -} diff --git a/niucloud/addon/shop/uni-app/api/discount.ts b/niucloud/addon/shop/uni-app/api/discount.ts deleted file mode 100644 index db42d5535..000000000 --- a/niucloud/addon/shop/uni-app/api/discount.ts +++ /dev/null @@ -1,25 +0,0 @@ -import request from '@/utils/request' - -/** - * 获取限时折扣轮播 - * @returns - */ -export function getActiveDiscountConfig() { - return request.get(`shop/discount/config`); -} - -/** - * 获取限时折扣列表 - * @returns - */ -export function getActiveDiscountList(params: Record) { - return request.get(`shop/discount`, params) -} - -/** - * 获取限时折扣商品列表 - * @returns - */ -export function getActiveDiscountGoodsList(params: Record) { - return request.get(`shop/discount/goods`, params) -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/api/evaluate.ts b/niucloud/addon/shop/uni-app/api/evaluate.ts deleted file mode 100644 index 1d022b2c9..000000000 --- a/niucloud/addon/shop/uni-app/api/evaluate.ts +++ /dev/null @@ -1,29 +0,0 @@ -import request from '@/utils/request' - -/** - * 获取商品评价 - */ -export function getEvaluateList(params: Record) { - return request.get(`shop/goods/evaluate`, params) -} - -/** - * 获取评价详情 - */ -export function getEvaluateInfo(id: any) { - return request.get(`shop/goods/evaluate/${ id }`) -} - -/** - * 提交评论 - */ -export function setOrderEvaluate(params: Record) { - return request.post('shop/goods/evaluate', params, { showSuccessMessage: true }) -} - -/** - * 获取订单评价 - */ -export function getOrderEvaluate(id: any) { - return request.get(`shop/order/evaluate/${ id }`) -} diff --git a/niucloud/addon/shop/uni-app/api/goods.ts b/niucloud/addon/shop/uni-app/api/goods.ts deleted file mode 100644 index bd04ff084..000000000 --- a/niucloud/addon/shop/uni-app/api/goods.ts +++ /dev/null @@ -1,114 +0,0 @@ -import request from '@/utils/request' - -/** - * 获取商品分类模板配置 - */ -export function getGoodsCategoryConfig() { - return request.get(`shop/goods/category/config`) -} - -/** - * 获取商品分类树结构 - */ -export function getGoodsCategoryTree() { - return request.get(`shop/goods/category/tree`) -} - -/** - * 获取商品分类列表 - */ -export function getGoodsCategoryList(params: Record) { - return request.get(`shop/goods/category/list`, params) -} - -/** - * 获取商品列表 - */ -export function getGoodsPages(params: Record) { - return request.get(`shop/goods/pages`, params) -} - -/** - * 获取商品详情 - */ -export function getGoodsDetail(params: Record) { - return request.get(`shop/goods/detail`, params) -} - -/** - * 获取商品规格 - */ -export function getGoodsSku(sku_id: any) { - return request.get(`shop/goods/sku/${ sku_id }`) -} - -/** - * 收藏列表 - */ -export function getCollectList(params: Record) { - return request.get(`shop/goods/collect`, params) -} - -/** - * 取消收藏 - */ -export function cancelCollect(params: Record) { - return request.put(`shop/goods/collect`, params, { showSuccessMessage: true }) -} - -/** - * 收藏 - */ -export function collect(goods_id: any) { - return request.post(`shop/goods/collect/${ goods_id }`) -} - - -/** - * 获取评价 - */ -export function getEvaluateList(goods_id: any) { - return request.get(`shop/goods/evaluate/list`, { goods_id }) -} - -/** - * 获取商品列表供组件调用 - */ -export function getGoodsComponents(params: Record) { - return request.get(`shop/goods/components`, params) -} - -/** - * 获取商品满减信息 - */ -export function getManjian(params: Record) { - return request.get(`shop/manjian/info`, params) -} - -/** - * 商品足迹添加 - */ -export function browse(params: Record) { - return request.post(`shop/goods/browse`, params, { showSuccessMessage: false }) -} - -/** - * 商品足迹列表 - */ -export function getBrowse(params: Record) { - return request.get(`shop/goods/browse`, params) -} - -/** - * 商品足迹删除 - */ -export function delBrowse(params: Record) { - return request.delete(`shop/goods/browse`, params) -} - -/** - * 获取商品搜索配置 - */ -export function getGoodsConfigSearch() { - return request.get(`shop/goods/config/search`) -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/api/impulse_buy.ts b/niucloud/addon/shop/uni-app/api/impulse_buy.ts deleted file mode 100644 index 2169c1a24..000000000 --- a/niucloud/addon/shop/uni-app/api/impulse_buy.ts +++ /dev/null @@ -1,22 +0,0 @@ -import request from '@/utils/request' - -/** - * 获取顺手买配置 - */ -export function getShopImpulseBuyConfig() { - return request.get(`shop_impulse_buy/config`) -} - -/** - * 获取顺手买商品列表 - */ -export function getShopImpulseBuyList(params: Record) { - return request.get(`shop_impulse_buy/list`, params) -} - -/** - * 获取顺手买商品详情 - */ -export function getShopImpulseBuyDetail(params: Record) { - return request.get(`shop_impulse_buy/detail/${params.impulse_buy_goods_id}`, params) -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/api/invoice.ts b/niucloud/addon/shop/uni-app/api/invoice.ts deleted file mode 100644 index 5100a79ca..000000000 --- a/niucloud/addon/shop/uni-app/api/invoice.ts +++ /dev/null @@ -1,31 +0,0 @@ -import request from '@/utils/request' - -// 发票列表 -export function getInvoiceList(params: Record) { - return request.get(`shop/order/invoice/list`,params) -} - -// 发票详情 -export function getInvoiceInfo(id: number) { - return request.get(`shop/order/invoice/${id}`) -} - -// 计算发票金额 -export function calculateInvoice(params: Record) { - return request.post(`shop/order/invoice/calculate`,params) -} - -// 添加发票 -export function addInvoice(params: Record) { - return request.post(`shop/order/invoice/apply`, params) -} - -// 编辑发票 -export function editInvoice(id:number, params: Record) { - return request.post(`shop/order/invoice/edit/${id}`, params) -} - -// 取消申请 -export function cancelInvoice(id: number) { - return request.delete(`shop/order/invoice/cancel/${id}`) -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/api/newcomer.ts b/niucloud/addon/shop/uni-app/api/newcomer.ts deleted file mode 100644 index e8ba10f44..000000000 --- a/niucloud/addon/shop/uni-app/api/newcomer.ts +++ /dev/null @@ -1,14 +0,0 @@ -import request from '@/utils/request' - -// 新人专区列表 -export function getNewcomerGoodsList(params: Record) { - return request.get(`shop/newcomer/goods`, params) -} -export function getNewcomersConfig() { - return request.get(`shop/newcomer/config`) -} - -// 首页新人专享列表 -export function getNewcomersComponentsList(params: Record) { - return request.get(`shop/newcomer/goods/components`, params) -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/api/order.ts b/niucloud/addon/shop/uni-app/api/order.ts deleted file mode 100644 index c37da0b72..000000000 --- a/niucloud/addon/shop/uni-app/api/order.ts +++ /dev/null @@ -1,100 +0,0 @@ -import request from '@/utils/request' - -/***************************************************** 订单列表 ****************************************************/ -/** - * 获取订单设置 - */ -export function getShopOrderConfig() { - return request.get(`shop/order/config`) -} - -/** - * 获取订单状态列表 - */ -export function getShopOrderStatus() { - return request.get(`shop/order/status`) -} - -/** - * 获取订单列表 - */ -export function getShopOrder(params: Record) { - return request.get(`shop/order`, params) -} - -/** - * 获取订单角标数据 - */ -export function getShopOrderNum() { - return request.get(`shop/order/num`) -} - -/** - * 获取订单详情 - */ -export function getShopOrderDetail(order_id: any) { - return request.get(`shop/order/${ order_id }`) -} - -/** - * 关闭订单 - */ -export function orderClose(order_id: number) { - return request.put(`shop/order/close/${ order_id }`) -} - -/** - * 订单完成 - */ -export function orderFinish(order_id: number) { - return request.put(`shop/order/finish/${ order_id }`) -} - -/** - * 订单创建计算 - */ -export function orderCreateCalculate(params: Record) { - return request.get('shop/order_create/calculate', params) -} - -/** - * 订单创建 - */ -export function orderCreate(params: Record) { - return request.post('shop/order_create/create', params) -} - -/** - * 查询订单可用优惠券 - */ -export function orderCoupon(params: Record) { - return request.get('shop/order_create/coupon', params) -} - -/** - * 查询自提点 - */ -export function getStoreList(params: Record) { - return request.get('shop/order_create/store', params) -} - -/** - * 查询物流信息 - */ -export function getMaterialflowList(params: Record) { - return request.get('shop/order/logistics', params) -} - -/** - * 查询同城配送预约配置 - */ -export function getLocal() { - return request.get('shop/order_create/local') -} - -/** - * 查询同城配送地图 - */ -export function getTrackOfLocal(params: Record) { - return request.get('shop/delivery/track_of_local', params) -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/api/point.ts b/niucloud/addon/shop/uni-app/api/point.ts deleted file mode 100644 index c94ebcbf6..000000000 --- a/niucloud/addon/shop/uni-app/api/point.ts +++ /dev/null @@ -1,46 +0,0 @@ -import request from '@/utils/request' - -/** - * 获取个人积分信息 - * @returns - */ -export function getExchangePoint() { - return request.get(`shop/exchange/point`); -} - -/** - * 获取积分商城推荐列表 - * @returns - */ -export function getExchangeComponentsList(params: Record) { - return request.get(`shop/exchange/components`, params) -} - -/** - * 获取积分商城列表 - * @returns - */ -export function getExchangeGoodsList(params: Record) { - return request.get(`shop/exchange`, params) -} - -/** - * 获取积分商品详情 - */ -export function getExchangeGoodsDetail(id: any) { - return request.get(`shop/exchange/goods/${ id }`) -} - -/** - * 订单创建计算 - */ -export function orderCreateCalculate(params: Record) { - return request.get('shop/exchange_order/calculate', params) -} - -/** - * 订单创建 - */ -export function orderCreate(params: Record) { - return request.post('shop/exchange_order/create', params) -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/api/rank.ts b/niucloud/addon/shop/uni-app/api/rank.ts deleted file mode 100644 index faaac6bcd..000000000 --- a/niucloud/addon/shop/uni-app/api/rank.ts +++ /dev/null @@ -1,21 +0,0 @@ -import request from '@/utils/request' - -// 榜单分类列表 -export function getRankList() { - return request.get(`shop/rank`) -} - -// 榜单商品列表 -export function getRankGoodsList(params: Record) { - return request.get(`shop/rank/goods`, params) -} - -// 获取排行榜配置 -export function getRankConfig() { - return request.get(`shop/rank/getRankConfig`) -} - -// 榜单组件商品列表 -export function getRankComponentsGoodsList(params: Record) { - return request.get(`shop/rank/components`, params) -} diff --git a/niucloud/addon/shop/uni-app/api/refund.ts b/niucloud/addon/shop/uni-app/api/refund.ts deleted file mode 100644 index e31b3c68c..000000000 --- a/niucloud/addon/shop/uni-app/api/refund.ts +++ /dev/null @@ -1,71 +0,0 @@ -import request from '@/utils/request' - -/** - * 申请退款 - */ -export function applyRefund(params: Record) { - return request.post(`shop/refund/apply`, params, { showSuccessMessage: true }) -} - -/** - * 修改退款申请 - */ -export function editRefund(params: Record) { - return request.put(`shop/refund/${ params.order_refund_no }`, params, { showSuccessMessage: true }) -} - -/** - * 申请退款退货 - */ -export function refundDelivery(params: Record) { - return request.post(`shop/refund/delivery/${ params.order_refund_no }`, params, { showSuccessMessage: true }) -} - -/** - * 修改退款申请 - */ -export function editRefundDelivery(params: Record) { - return request.put(`shop/refund/delivery/${ params.order_refund_no }`, params, { showSuccessMessage: true }) -} - -/** - * 获取退款原因 - */ -export function getRefundReason() { - return request.get('shop/refund/reason') -} - -/** - * 获取退款列表 - */ -export function getRefundList() { - return request.get('shop/order/refund') -} - -/** - * 获取退款详情 - */ -export function getRefundDetail(orderRefundNo: string) { - return request.get(`shop/order/refund/${ orderRefundNo }`) -} - -/** - * 获取退款金额 - */ -export function getRefundMoney(params: Record) { - return request.get(`shop/refund/refund_data`, params) -} - -/** - * 编辑退款金额 - */ -export function getRefundMoneyAgain(params: Record) { - return request.get(`shop/refund/refund_data_by_no`, params) -} - -/** - * 取消售后 - */ -export function closeRefund(orderRefundNo: string) { - return request.put(`shop/refund/close/${ orderRefundNo }`, {}, { showSuccessMessage: true }) -} diff --git a/niucloud/addon/shop/uni-app/api/shop.ts b/niucloud/addon/shop/uni-app/api/shop.ts deleted file mode 100644 index eb0ac14bc..000000000 --- a/niucloud/addon/shop/uni-app/api/shop.ts +++ /dev/null @@ -1,8 +0,0 @@ -import request from '@/utils/request' - -/** - * 获取评论设置 - */ -export function getEvaluateConfig() { - return request.get(`shop/goods/evaluate/config`) -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/components/diy/goods-coupon/index.vue b/niucloud/addon/shop/uni-app/components/diy/goods-coupon/index.vue deleted file mode 100644 index 86de32ae3..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/goods-coupon/index.vue +++ /dev/null @@ -1,442 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/goods-list/index.vue b/niucloud/addon/shop/uni-app/components/diy/goods-list/index.vue deleted file mode 100644 index 28d6b0f3b..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/goods-list/index.vue +++ /dev/null @@ -1,716 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/many-goods-list/index.vue b/niucloud/addon/shop/uni-app/components/diy/many-goods-list/index.vue deleted file mode 100644 index 28260eb2c..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/many-goods-list/index.vue +++ /dev/null @@ -1,402 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-exchange-goods/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-exchange-goods/index.vue deleted file mode 100644 index a19b330e2..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-exchange-goods/index.vue +++ /dev/null @@ -1,290 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-exchange-info/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-exchange-info/index.vue deleted file mode 100644 index 4e5c89d70..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-exchange-info/index.vue +++ /dev/null @@ -1,119 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-attr/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-attr/index.vue deleted file mode 100644 index b83f0a870..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-attr/index.vue +++ /dev/null @@ -1,147 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-basic-info/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-basic-info/index.vue deleted file mode 100644 index dc987e126..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-basic-info/index.vue +++ /dev/null @@ -1,738 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-bottom/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-bottom/index.vue deleted file mode 100644 index 8868f4d0b..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-bottom/index.vue +++ /dev/null @@ -1,315 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-desc/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-desc/index.vue deleted file mode 100644 index bafe83ad3..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-desc/index.vue +++ /dev/null @@ -1,89 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-evaluate/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-evaluate/index.vue deleted file mode 100644 index 6075675db..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-evaluate/index.vue +++ /dev/null @@ -1,162 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-purchase-service/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-purchase-service/index.vue deleted file mode 100644 index aa12ef2b0..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-purchase-service/index.vue +++ /dev/null @@ -1,323 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-sow/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-sow/index.vue deleted file mode 100644 index bcbdc37c8..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-goods-detail-sow/index.vue +++ /dev/null @@ -1,125 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-goods-hot/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-goods-hot/index.vue deleted file mode 100644 index 473b97148..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-goods-hot/index.vue +++ /dev/null @@ -1,235 +0,0 @@ - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-goods-ranking/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-goods-ranking/index.vue deleted file mode 100644 index fdb4e835a..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-goods-ranking/index.vue +++ /dev/null @@ -1,197 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-goods-recommend/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-goods-recommend/index.vue deleted file mode 100644 index 6f6fbcfa8..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-goods-recommend/index.vue +++ /dev/null @@ -1,227 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-member-info/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-member-info/index.vue deleted file mode 100644 index 47f975028..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-member-info/index.vue +++ /dev/null @@ -1,263 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-newcomer/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-newcomer/index.vue deleted file mode 100644 index 1f1b9b18d..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-newcomer/index.vue +++ /dev/null @@ -1,521 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-order-info/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-order-info/index.vue deleted file mode 100644 index 91cbfd203..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-order-info/index.vue +++ /dev/null @@ -1,124 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/shop-search/index.vue b/niucloud/addon/shop/uni-app/components/diy/shop-search/index.vue deleted file mode 100644 index 9e4836768..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/shop-search/index.vue +++ /dev/null @@ -1,102 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/diy/single-recommend/index.vue b/niucloud/addon/shop/uni-app/components/diy/single-recommend/index.vue deleted file mode 100644 index 875f15499..000000000 --- a/niucloud/addon/shop/uni-app/components/diy/single-recommend/index.vue +++ /dev/null @@ -1,260 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/ns-goods-manjian/ns-goods-manjian.vue b/niucloud/addon/shop/uni-app/components/ns-goods-manjian/ns-goods-manjian.vue deleted file mode 100644 index 32e785035..000000000 --- a/niucloud/addon/shop/uni-app/components/ns-goods-manjian/ns-goods-manjian.vue +++ /dev/null @@ -1,180 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/ns-goods-recommend/ns-goods-recommend.vue b/niucloud/addon/shop/uni-app/components/ns-goods-recommend/ns-goods-recommend.vue deleted file mode 100644 index fb925f9a1..000000000 --- a/niucloud/addon/shop/uni-app/components/ns-goods-recommend/ns-goods-recommend.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/ns-goods-sku/ns-goods-sku.vue b/niucloud/addon/shop/uni-app/components/ns-goods-sku/ns-goods-sku.vue deleted file mode 100644 index 2847866c6..000000000 --- a/niucloud/addon/shop/uni-app/components/ns-goods-sku/ns-goods-sku.vue +++ /dev/null @@ -1,478 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/ns-impulse-buy/ns-impulse-buy.vue b/niucloud/addon/shop/uni-app/components/ns-impulse-buy/ns-impulse-buy.vue deleted file mode 100644 index 710b2d007..000000000 --- a/niucloud/addon/shop/uni-app/components/ns-impulse-buy/ns-impulse-buy.vue +++ /dev/null @@ -1,255 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/components/ns-select-time/date.js b/niucloud/addon/shop/uni-app/components/ns-select-time/date.js deleted file mode 100644 index c9e5a907a..000000000 --- a/niucloud/addon/shop/uni-app/components/ns-select-time/date.js +++ /dev/null @@ -1,221 +0,0 @@ -//字符串拼接 -function strFormat(str) { - return str < 10 ? `0${ str }` : str -} - -// 获取当前时间 -export function currentTime() { - const myDate = new Date(); - const y = myDate.getFullYear() - const m = myDate.getMonth() + 1; - const d = myDate.getDate(); - const date = y + '-' + strFormat(m) + '-' + strFormat(d)//年月日 - const mdTime = strFormat(m) + '-' + strFormat(d) - const md = strFormat(m) + '月' + strFormat(d) + '日' - const hour = myDate.getHours() - const min = myDate.getMinutes() - const secon = myDate.getSeconds() - const seconTime = Math.floor(Date.now() / 1000) - const time = strFormat(hour) + ':' + strFormat(min) + ':' + strFormat(secon); - return { - y, - md, - mdTime, - date, - time, - seconTime - } -} - -//时间戳转日期 -export function timeStamp(time, isQuantum) { - const dates = new Date(time) - const year = dates.getFullYear() - const month = dates.getMonth() + 1 - const date = dates.getDate() - const day = dates.getDay() - const hour = dates.getHours() - const min = dates.getMinutes() - const days = ['日', '一', '二', '三', '四', '五', '六'] - const xinqi = [0, 1, 2, 3, 4, 5, 6] - return { - allDate: `${ year }/${ strFormat(month) }/${ strFormat(date) }`, - date: `${ strFormat(year) }-${ strFormat(month) }-${ strFormat(date) }`, //返回的日期 2000-07-01 - md: `${ strFormat(month) }月${ strFormat(date) }日`,//返回的日期 07月01日 - mdTime: `${ strFormat(month) }-${ strFormat(date) }`, //返回的日期 07-01 - day: `周${ days[day] }`, //返回的礼拜天数 星期一 - dayNum: `${ xinqi[day] }`, //返回的礼拜天数 用于判断左侧设置 - hour: strFormat(hour) + ':' + strFormat(min) + (isQuantum ? "" : ':00') //返回的时钟 08:00 - } -} - -//获取最近7天的日期和礼拜天数 -export function initData() { - const time = [] - const date = new Date() - - const now = date.getTime() //获取当前日期的时间戳 - let timeStr = 3600 * 24 * 1000 //一天的时间戳 - let obj = { - 0: "今天", - 1: "明天", - 2: "后天" - } - for (let i = 0; i < 7; i++) { - time.push({ - date: timeStamp(now + timeStr * i).date, //保存日期(年月日) - mdTime: timeStamp(now + timeStr * i).md, - md: obj[i] ? obj[i] : timeStamp(now + timeStr * i).md, - timeStamp: now + timeStr * i, //保存时间戳 - week: timeStamp(now + timeStr * i).day, - dayNum: timeStamp(now + timeStr * i).dayNum, - disable: false - }) - } - return time -} -// 预约 -export function initAppointmentData(advanceDay, mostDay) { - const time = []; - const date = new Date() - let timeStr = 3600 * 24 * 1000 //一天的时间戳 - - // 加上今天 - const now = date.getTime() //获取当前日期的时间戳 - // time.push({ - // date: timeStamp(now).date, //保存日期(年月日) - // mdTime: timeStamp(now).md, - // md: '今天', - // timeStamp: now , //保存时间戳 - // week: timeStamp(now).day, - // dayNum: timeStamp(now).dayNum, - // disable: false - // }); - - // 正常预约范围 - for (let i = advanceDay; i <= mostDay; i++) { - time.push({ - date: timeStamp(now + timeStr * i).date, //保存日期(年月日) - mdTime: timeStamp(now + timeStr * i).md, - md: i === 0 ? '今天' : i === 1 ? '明天' : i === 2 ? '后天' : timeStamp(now + timeStr * i).md, - timeStamp: now + timeStr * i, //保存时间戳 - week: timeStamp(now + timeStr * i).day, - dayNum: timeStamp(now + timeStr * i).dayNum, - disable: false - }); - } - - return time; -} -/** - * 仅返回“今天”这一项,用于只展示今天场景 - */ -export function initTodayData() { - const time = []; - const date = new Date() - let timeStr = 3600 * 24 * 1000 //一天的时间戳 - - // 加上今天 - const now = date.getTime() //获取当前日期的时间戳 - time.push({ - date: timeStamp(now).date, //保存日期(年月日) - mdTime: timeStamp(now).md, - md: '今天', - timeStamp: now , //保存时间戳 - week: timeStamp(now).day, - dayNum: timeStamp(now).dayNum, - disable: false - }); - - return time; -} - - -//时间数组 -export function initTime(trade_time_json, timeInterval = 0.5, isQuantum = true) { - const time = []; - const timeStr = 3600 * timeInterval; // 间隔时间转换成秒 - - trade_time_json.forEach(slot => { - let start = slot.start_time; - let end = slot.end_time; - - for (let i = start; i < end; i += timeStr) { - let nextTime = i + timeStr > end ? end : i + timeStr; - - if (isQuantum) { - time.push({ - begin: timestampTransition(i), - end: timestampTransition(nextTime), - disable: false - }); - } else { - time.push({ - time: timestampTransition(i), - disable: false - }); - } - } - }); - - return time; -} - -// 带“立即送出”的时间数组,仅用于预约 -export function initTimeWithImmediate(trade_time_json, timeInterval = 0.5, isQuantum = true) { - const time = []; - - // 先插入立即送出 - time.push({ - begin: '立即', - end: '送出', - value: 'immediate', - disable: false - }); - - const timeStr = 3600 * timeInterval; // 间隔时间转秒 - - trade_time_json.forEach(slot => { - let start = slot.start_time; - let end = slot.end_time; - - for (let i = start; i < end; i += timeStr) { - let nextTime = i + timeStr > end ? end : i + timeStr; - - if (isQuantum) { - time.push({ - begin: timestampTransition(i), - end: timestampTransition(nextTime), - disable: false - }); - } else { - time.push({ - time: timestampTransition(i), - disable: false - }); - } - } - }); - - return time; -} - - -// 时间戳转时间 -export function timestampTransition(timeStamp) { - let hour = Math.floor(timeStamp / (60 * 60)) - let minute = Math.floor(timeStamp / 60) - (hour * 60) - let second = timeStamp % 60 - hour = hour < 10 ? ('0' + hour) : hour - minute = minute < 10 ? ('0' + minute) : minute - // second = second < 10 ? ( '0' + second ) : second - return hour + ':' + minute -} - -// 时间转时间戳 -export function timeTransition(time) { - const arr = time.split(':'); - const hours = Number(arr[0]) * 60 * 60; - const minutes = Number(arr[1]) * 60; - return hours + minutes; -} diff --git a/niucloud/addon/shop/uni-app/components/ns-select-time/index.vue b/niucloud/addon/shop/uni-app/components/ns-select-time/index.vue deleted file mode 100644 index 55af3e9e8..000000000 --- a/niucloud/addon/shop/uni-app/components/ns-select-time/index.vue +++ /dev/null @@ -1,277 +0,0 @@ - - - diff --git a/niucloud/addon/shop/uni-app/hooks/useDiyGoodsDetail.ts b/niucloud/addon/shop/uni-app/hooks/useDiyGoodsDetail.ts deleted file mode 100644 index 86d764b70..000000000 --- a/niucloud/addon/shop/uni-app/hooks/useDiyGoodsDetail.ts +++ /dev/null @@ -1,317 +0,0 @@ -import { computed, reactive, ref, watch } from 'vue'; -import { onHide, onLoad, onPageScroll, onShow, onUnload } from '@dcloudio/uni-app'; -import { deepClone, goback, handleOnloadParams, img, getToken } from '@/utils/common'; -import useDiyStore from '@/app/stores/diy'; -import { getDiyInfo } from '@/app/api/diy'; -import { getGoodsDetail, browse } from '@/addon/shop/api/goods'; -import useGoodsDetailStore from '@/addon/shop/stores/goodsDetail' - -export function useDiyGoodsDetail(params: any = {}) { - - const loading = ref(true); - const diyStore = useDiyStore(); - - const id = ref(0) - const name = ref(params.name || '') - const template = ref('') - const currRoute = ref('') //当前路由 - const requestData: any = reactive({}); - - // 自定义页面 数据 - const diyData = reactive({ - pageMode: 'diy', - title: '', - global: {}, - value: [] - }) - - // 商品详情参数 - const goodsDetailParameter: any = reactive({ - goods_id: '', - sku_id: '', - type: '' // 来源营销活动类型,例如:discount:限时折扣,newcomer_discount:新人价 - }); - - const getLoading = () => { - return loading.value; - } - - const data: any = computed(() => { - if (diyStore.mode == 'decorate') { - return diyStore; - } else { - return diyData; - } - }) - - const isShowTopTabbar = ref(false); - - const pageStyle = () => { - let style = ''; - if (data.value.global.pageStartBgColor) { - if (data.value.global.pageStartBgColor && data.value.global.pageEndBgColor) style += `background:linear-gradient(${ data.value.global.pageGradientAngle },${ data.value.global.pageStartBgColor },${ data.value.global.pageEndBgColor });`; - else style += 'background-color:' + data.value.global.pageStartBgColor + ';'; - } - if (data.value.global.bottomTabBar && data.value.global.bottomTabBar.isShow) { - style += 'min-height:calc(100vh - 50px);'; - } else { - style += 'min-height:calc(100vh);'; - } - if (data.value.global.bgUrl) { - style += `background-image:url('${ img(data.value.global.bgUrl) }');`; - } - - if (data.value.global.bgHeightScale) { - style += `background-size: 100% ${ data.value.global.bgHeightScale }%;`; - } - return style; - }; - - // 监听页面加载 - const onLoadLifeCycle = () => { - onLoad((option: any) => { - // #ifdef MP-WEIXIN - // 处理小程序场景值参数 - option = handleOnloadParams(option); - // #endif - - // #ifdef H5 - // 装修模式 - diyStore.mode = option.mode || ''; - if (diyStore.mode == 'decorate') { - loading.value = false; - } - // #endif - - goodsDetailParameter.goods_id = option.goods_id || ''; - goodsDetailParameter.sku_id = option.sku_id || ''; - goodsDetailParameter.type = option.type == 'nd' ? 'newcomer_discount' : option.type || ''; - - id.value = option.id || ''; - if (name.value == '') name.value = option.name || ''; - template.value = option.template || ''; - }); - } - - // 监听页面显示 - const onShowLifeCycle = (callback: any = null) => { - onShow(() => { - /******** 解决跳转自定义页面空白问题-第二步-start **********/ - let curPage: any = getCurrentPages(); - currRoute.value = curPage[curPage.length - 1] ? curPage[curPage.length - 1].route : ''; //获取当前页面的路由 - let urlArr = [] - if (uni.getStorageSync('diyPageBlank')) { - urlArr = uni.getStorageSync('diyPageBlank'); - } - if (!urlArr.length || urlArr.length && urlArr.indexOf(currRoute.value) == -1) { - diyStore.topFixedStatus = 'home' - } else if (urlArr.length && urlArr.indexOf(currRoute.value) != -1) { - diyStore.topFixedStatus = 'diy' - } - /******** 解决跳转自定义页面空白问题-第二步-end **********/ - // 装修模式 - if (diyStore.mode == 'decorate') { - diyStore.init(); - } else if(id.value){ - // 用于商品详情页预览 - getDiyInfo({ - id: id.value, - name: name.value - }).then((res: any) => { - Object.assign(requestData, res.data); - diyStore.mode = 'decorate'; - handleComponentDataFn() - diyStore.value = diyData.value; - diyStore.global = diyData.global; - - loading.value = false; - if (callback) callback(requestData) - }) - - } else { - getGoodsDetail({ - goods_id: goodsDetailParameter.goods_id || '', - sku_id: goodsDetailParameter.sku_id || '', - type: goodsDetailParameter.type || '' // 来源营销活动类型,例如:discount:限时折扣,newcomer_discount:新人价 - }).then((res: any) => { - if (!res.data.goods || JSON.stringify(res.data) === '[]') { - let goBackParameter = { - url: '/addon/shop/pages/index', - title: '找不到该商品', - mode: 'reLaunch' - }; - goback(goBackParameter) - return false - } - - Object.assign(requestData, res.data.diy_detail_info); - handleComponentDataFn() - // 商品详情数据处理 - diyData.global.goodsParameter = {} - diyData.global.goodsParameter.goods_id = goodsDetailParameter.goods_id - diyData.global.goodsParameter.sku_id = goodsDetailParameter.sku_id - diyData.global.goodsParameter.type = goodsDetailParameter.type == 'newcomer_discount' ? 'nd' : goodsDetailParameter.type - // 组装商品组件数据 - assembleGoodsDetailData(diyData, res.data) - - // 商品分享 - requestData.share = { - title: res.data.goods.goods_name, - desc: res.data.goods.sub_title, - url: res.data.goods.goods_cover_thumb_mid - } - - loading.value = false; - if (callback) callback(requestData) - - }); - } - }) - } - - // 处理组件数据 - const handleComponentDataFn = () => { - if (requestData.value) { - diyData.pageMode = requestData.mode; - diyData.title = requestData.title; - - let sources = JSON.parse(requestData.value); // todo diy的结构应该后台处理好,前端就不需要再转换了 - - diyData.global = sources.global; - // 用于区分微页面之间弹窗的id - if (diyData.global.popWindow && diyData.global.popWindow.show) { - diyData.global.popWindow.id = requestData.id; - } - - diyData.value = sources.value; - diyData.value.forEach((item: any, index) => { - let detailComponent:any = [] - if(diyStore.mode != 'decorate'){ - detailComponent = ['ShopGoodsDetailBottom','ShopGoodsDetailDesc','ShopGoodsDetailAttr','ShopGoodsDetailEvaluate','ShopGoodsDetailSow','ShopGoodsDetailPurchaseService','ShopGoodsDetailBasicInfo'] - } - if(detailComponent.indexOf(item.componentName) > -1){ - item.componentIsShow = false // 是否显示 - }else{ - item.componentIsShow = true // 是否显示 - } - - item.pageStyle = ''; - if (item.pageStartBgColor) { - if (item.pageStartBgColor && item.pageEndBgColor) item.pageStyle += `background:linear-gradient(${ item.pageGradientAngle },${ item.pageStartBgColor },${ item.pageEndBgColor });`; - else item.pageStyle += 'background-color:' + item.pageStartBgColor + ';'; - } - - if (item.margin) { - if (item.margin.top > 0) { - item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';'; - } - item.pageStyle += 'padding-bottom:' + item.margin.bottom * 2 + 'rpx' + ';'; - item.pageStyle += 'padding-right:' + item.margin.both * 2 + 'rpx' + ';'; - item.pageStyle += 'padding-left:' + item.margin.both * 2 + 'rpx' + ';'; - } - }); - - // 控制自定义头部是否出现 | 微信小程序 - isShowTopTabbar.value = diyData.value.some((item: any) => { - return item && item.position && item.position == 'top_fixed' - }); - - uni.setNavigationBarTitle({ - title: diyData.title - }); - - } - } - - // 监听页面隐藏 - const onHideLifeCycle = (callback: any = null) => { - onHide(() => { - /******** 解决跳转自定义页面空白问题-第一步 -start **********/ - let url = []; - if (uni.getStorageSync('diyPageBlank')) { - url = uni.getStorageSync('diyPageBlank'); - } - - // 清空重复、与当前页面路径一致的url - if (url.length) { - url = Array.from(new Set(url)) - url.forEach((item, index, arr) => { - if (item == currRoute.value) { - arr.splice(index, 1); - } - }) - } - - // 当diyStore.topFixedStatus == "diy"时,存储到diyPageBlank缓存中 - if (diyStore.topFixedStatus == "diy") { - url.push(currRoute.value); - } - uni.setStorageSync('diyPageBlank', url); - /******** 解决跳转自定义页面空白问题-第一步 -end **********/ - - if (callback) callback() - }) - } - - // 监听页面卸载 - const onUnloadLifeCycle = () => { - onUnload(() => { - useGoodsDetailStore().removeGoodsDetail() - }) - } - - // 监听滚动事件 - const onPageScrollLifeCycle = () => { - onPageScroll((e) => { - if (e.scrollTop > 0) { - diyStore.scrollTop = e.scrollTop; - } - }) - } - - const assembleGoodsDetailData = (componentData: any, res: any) => { - let data = deepClone(res) - data.goods.goods_image = data.goods.goods_image.split(','); - data.goods.goods_image.forEach((item: any, index: any) => { - data.goods.goods_image[index] = img(item); - }) - data.goods.delivery_type_list = data.goods.delivery_type_list ? Object.values(data.goods.delivery_type_list) : [] - - if (getToken()) { - // 我的足迹 - myBrowseFn(data.goods.goods_id); - } - - uni.setNavigationBarTitle({ - title: data.goods.goods_name - }) - - // 弹窗开启 - data.isOpenSkuBuy = false - data.skuBuyType = '' - - // 打开分享弹窗 - data.isOpenSharePoster = false - useGoodsDetailStore().setGoodsDetail(data,true) - } - - // 我的足迹 - const myBrowseFn = (goods_id: any) => { - browse({ - goods_id - }).then((res: any) => { - }) - } - - return { - getLoading, - data: data.value, - isShowTopTabbar, - pageStyle, - onLoad: onLoadLifeCycle, - onShow: onShowLifeCycle, - onHide: onHideLifeCycle, - onUnload: onUnloadLifeCycle, - onPageScroll: onPageScrollLifeCycle, - } -} diff --git a/niucloud/addon/shop/uni-app/hooks/useGoods.ts b/niucloud/addon/shop/uni-app/hooks/useGoods.ts deleted file mode 100644 index ecd6ffb29..000000000 --- a/niucloud/addon/shop/uni-app/hooks/useGoods.ts +++ /dev/null @@ -1,39 +0,0 @@ -export function useGoods(params: any = {}) { - - const baseTagStyle = (data: any) => { - let style = ""; - if (data.color_json && data.color_json.text_color) { - style += `color:${ data.color_json.text_color };`; - } - if (data.color_json && data.color_json.border_color) { - style += `border-color: ${ data.color_json.border_color };`; - } - if (data.color_json && data.color_json.bg_color) { - style += `background-color: ${ data.color_json.bg_color };`; - } - return style; - } - - // 价格类型 - const priceType = (data: any) => { - return data.goodsSku.show_type - } - - // 商品价格 - const goodsPrice = (data: any) => { - let price = data.goodsSku.show_price - return parseFloat(price); - } - - // 错误图片展示 - const errorImgFn = (data: any, type: any) => { - data[type] = ''; - } - - return { - baseTagStyle: baseTagStyle, - goodsPrice: goodsPrice, - priceType: priceType, - error: errorImgFn - } -} diff --git a/niucloud/addon/shop/uni-app/locale/en.json b/niucloud/addon/shop/uni-app/locale/en.json deleted file mode 100644 index 9e26dfeeb..000000000 --- a/niucloud/addon/shop/uni-app/locale/en.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans.json b/niucloud/addon/shop/uni-app/locale/zh-Hans.json deleted file mode 100644 index 70b4722d3..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "pages.goods.search": "搜索", - "pages.goods.cart": "购物车", - "pages.goods.collect": "商品收藏", - "pages.goods.browse": "我的足迹", - "pages.goods.category": "商品分类", - "pages.goods.detail": "商品详情", - "pages.goods.list": "商品列表", - "pages.goods.rank": "排行榜", - "pages.member.index": "个人中心", - "pages.member.my_coupon": "我的优惠券", - "pages.order.list": "订单列表", - "pages.order.detail": "订单详情", - "pages.order.payment": "待付款订单", - "pages.evaluate.order_evaluate": "商品评价", - "pages.evaluate.order_evaluate_view": "商品评价", - "pages.evaluate.list": "评价列表", - "pages.coupon.list": "优惠券列表", - "pages.coupon.detail": "优惠券详情", - "pages.discount.list": "限时折扣", - "pages.refund.list": "退款列表", - "pages.refund.detail": "退款详情", - "pages.refund.apply": "申请退款", - "pages.refund.edit_apply": "编辑退款信息", - "pages.refund.log": "协商记录", - "pages.point.index": "积分商城", - "pages.point.list": "积分商品列表", - "pages.point.detail": "积分商品详情", - "pages.point.payment": "待付款订单", - "pages.point.order_list": "积分兑换记录", - "pages.newcomer.list": "新人专享", - "pages.invoice.list": "发票管理", - "pages.invoice.detail": "发票详情", - "pages.invoice.invoice": "申请发票", - "pages.invoice.invoice_edit": "编辑发票信息", - "pages.invoice.invoice_order": "发票订单", - "pages.pay.index": "待支付", - "pages.pay.result": "" -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/common.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/common.json deleted file mode 100644 index 0a041dd1c..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/common.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "orderNo": "订单号", - "actualPayment": "实付款", - "orderClose": "关闭订单", - "orderFinish": "确认收货", - "coupon":"优惠劵", - "emptyAddress": "暂无收货地址,请先创建地址", - "addAddress": "新增收货地址", - "selectAddress": "选择地址" -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.cart.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.cart.json deleted file mode 100644 index 2c63c0851..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.cart.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.category.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.category.json deleted file mode 100644 index 2c63c0851..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.category.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.detail.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.detail.json deleted file mode 100644 index 2c63c0851..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.detail.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.list.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.list.json deleted file mode 100644 index 358a66be7..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.list.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "all": "全部", - "price": "价格" -} diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.rank.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.rank.json deleted file mode 100644 index b6f022fc5..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.goods.rank.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "rankingRules":"榜单规则" -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.index.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.index.json deleted file mode 100644 index 2c63c0851..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.index.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.member.index.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.member.index.json deleted file mode 100644 index c8b96b1cd..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.member.index.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "coupon": "优惠券" -} diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.order.detail.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.order.detail.json deleted file mode 100644 index 8b439cbc5..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.order.detail.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "orderNo": "订单号", - "actualPayment": "实付款", - "orderClose": "关闭订单", - "orderFinish": "确认收货", - "topay": "去支付", - "orderDetail": "详情", - "orderTradeNo": "支付流水号", - "createTime": "创建时间", - "deliveryType": "配送方式", - "payTypeName": "支付方式", - "payTime": "支付时间", - "goodsMoney": "商品金额", - "deliveryMoney": "配送费用", - "orderMoney": "实付金额", - "evaluate": "评价", - "selectedEvaluate": "查看评价", - "index": "首页", - "discountMoney": "优惠金额", - "logisticsTracking":"查看物流", - "copy":"复制", - "detailedInformation":"详细信息", - "helpPay":"的帮付", - "memberRemark":"用户备注" -} diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.order.list.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.order.list.json deleted file mode 100644 index 937a509b7..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.order.list.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "emptyAddress":"暂无收货地址,请先创建地址", - "addAddress":"新增收货地址", - "selectAddress":"选择地址", - "evaluate": "评价", - "money":"元", - "pendingPayment":"待支付", - "pendingPaymentTips":"剩余时间", - "service":"含物流运输服务", - "selectedEvaluate": "查看评价", - "orderClose": "关闭订单", - "orderFinish": "确认收货", - "topay": "支付", - "deliveryType":"配送方式", - "createTime":"下单时间" -} diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.order.payment.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.order.payment.json deleted file mode 100644 index 769e24d46..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.order.payment.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "orderNo": "订单号", - "actualPayment": "实付款", - "orderClose": "关闭订单", - "orderFinish": "确认收货", - "topay": "支付", - "orderDetail": "详情", - "evaluate": "评价", - "orderListempty":"暂无订单", - "emptyAddress":"暂无收货地址,请先创建地址", - "changeIt":"换一换", - "activityInstructions":"活动说明", - "goodsLimitThree":"该商品起购", - "piece":"件", - "goodsLimitTwo":"该商品每人限购", - "goodsLimitOne":"该商品单次限购", - "stockNotEnough":"商品库存不足", - "limitPlaceholderTwo":"件,超过按", - "limitPlaceholderThree":"购买", - "limitPlaceholderOne":"限购", - "buyWithOneClick":"一键购买", - "know":"我知道了" -} diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.point.detail.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.point.detail.json deleted file mode 100644 index e30ee6193..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.point.detail.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "point":"积分", - "priceUnit":"元", - "redeemed":"已兑" -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.point.order_list.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.point.order_list.json deleted file mode 100644 index 31342def5..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.point.order_list.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "orderNo": "订单号", - "actualPayment": "订单金额", - "orderClose": "关闭订单", - "orderFinish": "确认收货", - "topay": "支付", - "orderDetail": "详情", - "evaluate": "评价", - "selectedEvaluate": "查看评价", - "orderListempty": "暂无订单", - "deliveryType":"配送方式", - "money":"元", - "point": "积分" -} diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.refund.detail.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.refund.detail.json deleted file mode 100644 index 4fd1125b9..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.refund.detail.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "refundDetail": "退货详情", - "fastRefundSuccessful": "极速退款成功", - "refundInfo": "由于你的信誉良好,已享受极速退款服务,退款即刻到账", - "refundType": "退款方式", - "refundMoney": "退款金额", - "refundCause": "退款原因", - "reasonRefusal": "拒绝原因", - "refundNo": "退款编号", - "createTime": "申请时间", - "createExplain": "退款说明", - "record": "协商记录", - "check": "查看", - "refundApply": "取消退款", - "cancelRefundContent": "撤销之后本次申请将会关闭,如后续仍有问题可再次发起申请。", - "index": "首页" -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.refund.list.json b/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.refund.list.json deleted file mode 100644 index 7d6830ade..000000000 --- a/niucloud/addon/shop/uni-app/locale/zh-Hans/pages.refund.list.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "refundNo": "退款编号", - "refundMoney": "退款金额", - "refundApply": "取消退款", - "refund": "退款进度", - "cancelRefundContent": "撤销之后本次申请将会关闭,如后续仍有问题可再次发起申请。" -} \ No newline at end of file diff --git a/niucloud/addon/shop/uni-app/pages/coupon/detail.vue b/niucloud/addon/shop/uni-app/pages/coupon/detail.vue deleted file mode 100644 index a0ffdba68..000000000 --- a/niucloud/addon/shop/uni-app/pages/coupon/detail.vue +++ /dev/null @@ -1,177 +0,0 @@ - - - diff --git a/niucloud/addon/shop/uni-app/pages/coupon/list.vue b/niucloud/addon/shop/uni-app/pages/coupon/list.vue deleted file mode 100644 index aafc902bb..000000000 --- a/niucloud/addon/shop/uni-app/pages/coupon/list.vue +++ /dev/null @@ -1,362 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/pages/discount/list.vue b/niucloud/addon/shop/uni-app/pages/discount/list.vue deleted file mode 100644 index fc6723b74..000000000 --- a/niucloud/addon/shop/uni-app/pages/discount/list.vue +++ /dev/null @@ -1,304 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/pages/evaluate/components/upload-img.vue b/niucloud/addon/shop/uni-app/pages/evaluate/components/upload-img.vue deleted file mode 100644 index 013d3990f..000000000 --- a/niucloud/addon/shop/uni-app/pages/evaluate/components/upload-img.vue +++ /dev/null @@ -1,96 +0,0 @@ - - diff --git a/niucloud/addon/shop/uni-app/pages/evaluate/list.vue b/niucloud/addon/shop/uni-app/pages/evaluate/list.vue deleted file mode 100644 index a5b1cdaea..000000000 --- a/niucloud/addon/shop/uni-app/pages/evaluate/list.vue +++ /dev/null @@ -1,235 +0,0 @@ - - - - - diff --git a/niucloud/addon/shop/uni-app/pages/evaluate/order_evaluate.vue b/niucloud/addon/shop/uni-app/pages/evaluate/order_evaluate.vue deleted file mode 100644 index e50565256..000000000 --- a/niucloud/addon/shop/uni-app/pages/evaluate/order_evaluate.vue +++ /dev/null @@ -1,156 +0,0 @@ -