From 3eda8946738bf89949b08ab1a6d1a18136192ab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Tue, 23 Feb 2021 14:53:53 +0800 Subject: [PATCH] ComposerUpdate --- admin_v6.sql | 60 +++++------- app/data/controller/ShopGoods.php | 4 +- app/data/controller/api/News.php | 12 +-- app/data/controller/api/auth/News.php | 116 +++++++++++++++-------- app/data/controller/api/auth/Order.php | 4 +- app/data/service/NewsService.php | 21 ++-- app/data/view/shop_goods/form.html | 96 ++++++++++++------- vendor/composer/installed.json | 4 +- vendor/services.php | 2 +- vendor/zoujingli/think-library/readme.md | 9 +- 10 files changed, 192 insertions(+), 136 deletions(-) diff --git a/admin_v6.sql b/admin_v6.sql index bd6a3fed0..ee16eac7b 100644 --- a/admin_v6.sql +++ b/admin_v6.sql @@ -11,7 +11,7 @@ Target Server Version : 50562 File Encoding : 65001 - Date: 22/02/2021 15:33:49 + Date: 23/02/2021 14:52:47 */ SET NAMES utf8mb4; @@ -74,39 +74,23 @@ CREATE TABLE `data_news_mark` ( DROP TABLE IF EXISTS `data_news_x_collect`; CREATE TABLE `data_news_x_collect` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, - `uid` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '用户UID', - `type` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '记录类型(1收藏,2点赞,3历史)', + `uid` bigint(20) NULL DEFAULT 0 COMMENT '用户UID', + `type` tinyint(1) NULL DEFAULT 1 COMMENT '记录类型(1收藏,2点赞,3历史,4评论)', `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '文章编号', + `reply` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '评论内容', + `status` tinyint(1) NULL DEFAULT 1 COMMENT '记录状态(0无效,1待审核,2已审核)', `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', PRIMARY KEY (`id`) USING BTREE, INDEX `idx_data_news_x_collect_mid`(`uid`) USING BTREE, INDEX `idx_data_news_x_collect_type`(`type`) USING BTREE, - INDEX `idx_data_news_x_collect_code`(`code`) USING BTREE + INDEX `idx_data_news_x_collect_code`(`code`) USING BTREE, + INDEX `idx_data_news_x_collect_status`(`status`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-文章-标记' ROW_FORMAT = COMPACT; -- ---------------------------- -- Records of data_news_x_collect -- ---------------------------- --- ---------------------------- --- Table structure for data_news_x_comment --- ---------------------------- -DROP TABLE IF EXISTS `data_news_x_comment`; -CREATE TABLE `data_news_x_comment` ( - `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, - `uid` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '用户UID', - `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '文章编号', - `content` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '评论内容', - `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`) USING BTREE, - INDEX `idx_data_news_x_comment_mid`(`uid`) USING BTREE, - INDEX `idx_data_news_x_comment_code`(`code`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-文章-评论' ROW_FORMAT = COMPACT; - --- ---------------------------- --- Records of data_news_x_comment --- ---------------------------- - -- ---------------------------- -- Table structure for data_user -- ---------------------------- @@ -436,7 +420,7 @@ CREATE TABLE `data_user_transfer` ( DROP TABLE IF EXISTS `shop_goods`; CREATE TABLE `shop_goods` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, - `cate` bigint(20) NULL DEFAULT 0 COMMENT '商品分类', + `cate` bigint(20) NULL DEFAULT 0 COMMENT '分类编号', `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '商品编号', `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '商品名称', `mark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '商品标签', @@ -444,8 +428,8 @@ CREATE TABLE `shop_goods` ( `slider` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '轮播图片', `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '商品描述', `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '商品详情', - `data_specs` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '商品规格', - `data_items` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '商品规格', + `data_specs` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '商品规格(JSON)', + `data_items` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '商品规格(JSON)', `truck_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '运费模板', `stock_total` bigint(20) NULL DEFAULT 0 COMMENT '库存统计', `stock_sales` bigint(20) NULL DEFAULT 0 COMMENT '销售统计', @@ -455,11 +439,11 @@ CREATE TABLE `shop_goods` ( `discount_id` bigint(20) NULL DEFAULT 0 COMMENT '折扣方案编号', `vip_entry` tinyint(1) NULL DEFAULT 0 COMMENT '入会礼包升级', `vip_upgrade` bigint(20) NULL DEFAULT 0 COMMENT '购买立即升级', - `num_read` bigint(20) NULL DEFAULT 0 COMMENT '访问阅读统计', `limit_low_vip` bigint(20) NULL DEFAULT 0 COMMENT '限制最低等级', - `limit_max_buy` bigint(20) NULL DEFAULT 0 COMMENT '最大购买数量', - `set_hot` tinyint(1) NULL DEFAULT 0 COMMENT '设置热度标签', - `set_home` tinyint(1) NULL DEFAULT 0 COMMENT '设置首页推荐', + `limit_max_num` bigint(20) NULL DEFAULT 0 COMMENT '最大购买数量', + `num_read` bigint(20) NULL DEFAULT 0 COMMENT '访问阅读统计', + `state_hot` tinyint(1) NULL DEFAULT 0 COMMENT '设置热度标签', + `state_home` tinyint(1) NULL DEFAULT 0 COMMENT '设置首页推荐', `sort` bigint(20) NULL DEFAULT 0 COMMENT '列表排序权重', `status` tinyint(1) NULL DEFAULT 1 COMMENT '商品状态(1使用,0禁用)', `deleted` tinyint(1) NULL DEFAULT 0 COMMENT '删除状态(0未删,1已删)', @@ -510,10 +494,12 @@ CREATE TABLE `shop_goods_item` ( `goods_spec` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '商品规格', `stock_sales` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '销售数量', `stock_total` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '商品库存', - `price_selling` decimal(20, 2) UNSIGNED NULL DEFAULT 0.00 COMMENT '销售价格', - `price_market` decimal(20, 2) UNSIGNED NULL DEFAULT 0.00 COMMENT '市场价格', - `number_virtual` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '虚拟销量', - `number_express` bigint(20) UNSIGNED NULL DEFAULT 1 COMMENT '计件数量', + `number_virtual` bigint(20) NULL DEFAULT 0 COMMENT '虚拟销量', + `number_express` bigint(20) NULL DEFAULT 1 COMMENT '配送计件', + `price_selling` decimal(20, 2) NULL DEFAULT 0.00 COMMENT '销售价格', + `price_market` decimal(20, 2) NULL DEFAULT 0.00 COMMENT '市场价格', + `reward_balance` decimal(20, 2) NULL DEFAULT 0.00 COMMENT '奖励余额', + `reward_integral` decimal(20, 2) NULL DEFAULT 0.00 COMMENT '奖励积分', `status` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '商品状态', `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', PRIMARY KEY (`id`) USING BTREE, @@ -4750,7 +4736,7 @@ CREATE TABLE `system_oplog` ( `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '操作人用户名', `create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-日志' ROW_FORMAT = COMPACT; +) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-日志' ROW_FORMAT = COMPACT; -- ---------------------------- -- Records of system_oplog @@ -4761,6 +4747,8 @@ INSERT INTO `system_oplog` VALUES (3, 'admin/menu/edit', '127.0.0.1', '系统菜 INSERT INTO `system_oplog` VALUES (4, 'admin/login/index', '127.0.0.1', '系统用户登录', '登录系统后台成功', 'admin', '2021-02-01 03:28:15'); INSERT INTO `system_oplog` VALUES (5, 'admin/login/index', '127.0.0.1', '系统用户登录', '登录系统后台成功', 'admin', '2021-02-22 02:37:37'); INSERT INTO `system_oplog` VALUES (6, 'admin/api.plugs/optimize', '127.0.0.1', '系统运维管理', '创建数据库优化任务', 'admin', '2021-02-22 02:37:58'); +INSERT INTO `system_oplog` VALUES (7, 'admin/login/index', '127.0.0.1', '系统用户登录', '登录系统后台成功', 'admin', '2021-02-22 09:17:48'); +INSERT INTO `system_oplog` VALUES (8, 'admin/login/index', '127.0.0.1', '系统用户登录', '登录系统后台成功', 'admin', '2021-02-23 02:39:42'); -- ---------------------------- -- Table structure for system_queue @@ -4827,7 +4815,7 @@ CREATE TABLE `system_user` ( -- ---------------------------- -- Records of system_user -- ---------------------------- -INSERT INTO `system_user` VALUES (10000, 'admin', '21232f297a57a5a743894a0e4a801fc3', '系统管理员', 'http://127.0.0.1:8000/upload/ec/f571134493e54fe06855c88557052c.png', ',,', '', '', '', '127.0.0.1', '2021-02-22 02:37:37', 74, '', 1, 0, 0, '2015-11-13 15:14:22'); +INSERT INTO `system_user` VALUES (10000, 'admin', '21232f297a57a5a743894a0e4a801fc3', '系统管理员', 'http://127.0.0.1:8000/upload/ec/f571134493e54fe06855c88557052c.png', ',,', '', '', '', '127.0.0.1', '2021-02-23 02:39:42', 76, '', 1, 0, 0, '2015-11-13 15:14:22'); -- ---------------------------- -- Table structure for wechat_fans diff --git a/app/data/controller/ShopGoods.php b/app/data/controller/ShopGoods.php index 8ac72f545..d9b47bebf 100644 --- a/app/data/controller/ShopGoods.php +++ b/app/data/controller/ShopGoods.php @@ -160,7 +160,7 @@ class ShopGoods extends Controller $this->discounts = $this->app->db->name('DataUserDiscount')->where(['status' => 1, 'deleted' => 0])->order('sort desc,id desc')->select()->toArray(); $this->truckitems = $this->app->db->name('ShopTruckTemplate')->where(['status' => 1, 'deleted' => 0])->order('sort desc,id desc')->column('code,name'); // 商品规格处理 - $fields = 'goods_sku `sku`,goods_code,goods_spec `key`,price_selling `selling`,price_market `market`,number_virtual `virtual`,number_express `express`,status'; + $fields = 'goods_sku `sku`,goods_code,goods_spec `key`,price_selling `selling`,price_market `market`,number_virtual `virtual`,number_express `express`,reward_balance `balance`,reward_integral `integral`,status'; $data['data_items'] = json_encode($this->app->db->name('ShopGoodsItem')->where(['goods_code' => $data['code']])->column($fields, 'goods_spec'), JSON_UNESCAPED_UNICODE); } elseif ($this->request->isPost()) { if (empty($data['cover'])) $this->error('商品图片不能为空!'); @@ -181,6 +181,8 @@ class ShopGoods extends Controller 'price_selling' => $item['selling'], 'number_virtual' => $item['virtual'], 'number_express' => $item['express'], + 'balance' => $item['balance'], + 'integral' => $item['integral'], 'status' => $item['status'] ? 1 : 0, ], 'goods_spec', [ 'goods_code' => $data['code'], diff --git a/app/data/controller/api/News.php b/app/data/controller/api/News.php index 9098d9b51..c4bad0f06 100644 --- a/app/data/controller/api/News.php +++ b/app/data/controller/api/News.php @@ -21,7 +21,7 @@ class News extends Controller public function getMark() { $query = $this->_query('DataNewsMark')->like('name'); - $query->where(['deleted' => 0, 'status' => 1])->withoutField('sort,status,deleted'); + $query->where(['status' => 1, 'deleted' => 0])->withoutField('sort,status,deleted'); $this->success('获取文章标签列表', $query->order('sort desc,id desc')->page(false, false)); } @@ -38,7 +38,7 @@ class News extends Controller 'num_read' => $this->app->db->raw('`num_read`+1'), ]); if (($mid = input('uid', 0)) > 0) { - $data = ['uid' => $mid, 'code' => $code, 'type' => 3]; + $data = ['uid' => $mid, 'code' => $code, 'type' => 3, 'status' => 2]; $this->app->db->name('DataNewsXCollect')->where($data)->delete(); $this->app->db->name('DataNewsXCollect')->insert($data); } @@ -47,7 +47,7 @@ class News extends Controller $query->where(['deleted' => 0, 'status' => 1])->withoutField('sort,status,deleted'); $result = $query->order('sort desc,id desc')->page(true, false, false, 15); NewsService::instance()->buildListState($result['list'], input('uid', 0)); - $this->success('获取文章内容列表', $result); + $this->success('获取列表成功!', $result); } /** @@ -59,10 +59,10 @@ class News extends Controller public function getComment() { $map = $this->_vali(['code.require' => '文章不能为空!']); - $query = $this->_query('DataNewsXComment')->where($map); - $result = $query->order('id desc')->page(false, false, false, 5); + $query = $this->_query('DataNewsXCollect')->where(['type' => 4, 'status' => 2]); + $result = $query->where($map)->order('id desc')->page(true, false, false, 15); NewsService::instance()->buildListByUidAndCode($result['list']); - $this->success('获取文章评论成功!', $result); + $this->success('获取评论成功!', $result); } } \ No newline at end of file diff --git a/app/data/controller/api/auth/News.php b/app/data/controller/api/auth/News.php index 43f70f100..0b17b93aa 100644 --- a/app/data/controller/api/auth/News.php +++ b/app/data/controller/api/auth/News.php @@ -12,6 +12,12 @@ use app\data\service\NewsService; */ class News extends Auth { + /** + * 绑定数据表 + * @var string + */ + protected $table = 'DataNewsXCollect'; + /** * 用户评论内容 * @throws \think\db\exception\DbException @@ -19,11 +25,13 @@ class News extends Auth public function addComment() { $data = $this->_vali([ - 'uid.value' => $this->uuid, - 'code.require' => '文章不能为空!', - 'content.require' => '内容不能为空!', + 'uid.value' => $this->uuid, + 'type.value' => 4, + 'status.value' => 1, + 'code.require' => '文章不能为空!', + 'reply.require' => '评论不能为空!', ]); - if ($this->app->db->name('DataNewsXComment')->insert($data) !== false) { + if ($this->app->db->name($this->table)->insert($data) !== false) { NewsService::instance()->syncNewsTotal($data['code']); $this->success('添加评论成功!'); } else { @@ -39,8 +47,8 @@ class News extends Auth */ public function getComment() { - $map = $this->_vali(['uid.value' => $this->uuid, 'code.require' => '文章不能为空!']); - $result = $this->_query('DataNewsXComment')->where($map)->order('id desc')->page(true, false); + $query = $this->_query($this->table)->where(['uid' => $this->uuid, 'type' => 4]); + $result = $query->whereIn('status', [1, 2])->order('id desc')->page(true, false, false, 15); NewsService::instance()->buildListByUidAndCode($result); $this->success('获取评论列表成功', $result); } @@ -51,12 +59,13 @@ class News extends Auth */ public function delComment() { - $map = $this->_vali([ + $data = $this->_vali([ 'uid.value' => $this->uuid, - 'id.require' => '评论ID不能为空!', - 'code.require' => '文章CODE不能为空!', + 'type.value' => 4, + 'id.require' => '评论编号不能为空!', + 'code.require' => '文章编号不能为空!', ]); - if ($this->app->db->name('DataNewsXComment')->where($map)->delete() !== false) { + if ($this->app->db->name('DataNewsXCollect')->where($data)->delete() !== false) { $this->success('评论删除成功!'); } else { $this->error('认证删除失败!'); @@ -69,12 +78,17 @@ class News extends Auth */ public function addCollect() { - $map = $this->_getCollectWhere(1); - if ($this->app->db->name('DataNewsXCollect')->where($map)->count() > 0) { + $data = $this->_vali([ + 'uid.value' => $this->uuid, + 'type.value' => 1, + 'status.value' => 2, + 'code.require' => '文章编号不能为空!', + ]); + if ($this->app->db->name('DataNewsXCollect')->where($data)->count() > 0) { $this->success('您已收藏!'); } - if ($this->app->db->name('DataNewsXCollect')->insert($map) !== false) { - NewsService::instance()->syncNewsTotal($map['code']); + if ($this->app->db->name('DataNewsXCollect')->insert($data) !== false) { + NewsService::instance()->syncNewsTotal($data['code']); $this->success('收藏成功!'); } else { $this->error('收藏失败!'); @@ -87,9 +101,13 @@ class News extends Auth */ public function delCollect() { - $map = $this->_getCollectWhere(1); - if ($this->app->db->name('DataNewsXCollect')->where($map)->delete() !== false) { - NewsService::instance()->syncNewsTotal($map['code']); + $data = $this->_vali([ + 'uid.value' => $this->uuid, + 'type.value' => 1, + 'code.require' => '文章编号不能为空!', + ]); + if ($this->app->db->name('DataNewsXCollect')->where($data)->delete() !== false) { + NewsService::instance()->syncNewsTotal($data['code']); $this->success('取消收藏成功!'); } else { $this->error('取消收藏失败!'); @@ -115,12 +133,17 @@ class News extends Auth */ public function addLike() { - $map = $this->_getCollectWhere(2); - if ($this->app->db->name('DataNewsXCollect')->where($map)->count() > 0) { + $data = $this->_vali([ + 'uid.value' => $this->uuid, + 'type.value' => 2, + 'status.value' => 2, + 'code.require' => '文章编号不能为空!', + ]); + if ($this->app->db->name('DataNewsXCollect')->where($data)->count() > 0) { $this->success('您已点赞!'); } - if ($this->app->db->name('DataNewsXCollect')->insert($map) !== false) { - NewsService::instance()->syncNewsTotal($map['code']); + if ($this->app->db->name('DataNewsXCollect')->insert($data) !== false) { + NewsService::instance()->syncNewsTotal($data['code']); $this->success('点赞成功!'); } else { $this->error('点赞失败!'); @@ -133,9 +156,13 @@ class News extends Auth */ public function delLike() { - $map = $this->_getCollectWhere(2); - if ($this->app->db->name('DataNewsXCollect')->where($map)->delete() !== false) { - NewsService::instance()->syncNewsTotal($map['code']); + $data = $this->_vali([ + 'uid.value' => $this->uuid, + 'type.value' => 2, + 'code.require' => '文章编号不能为空!', + ]); + if ($this->app->db->name('DataNewsXCollect')->where($data)->delete() !== false) { + NewsService::instance()->syncNewsTotal($data['code']); $this->success('取消点赞成功!'); } else { $this->error('取消点赞失败!'); @@ -148,12 +175,30 @@ class News extends Auth */ public function getLike() { - $query = $this->_query('DataNewsXCollect')->order('id desc'); - $result = $query->where(['uid' => $this->uuid, 'type' => 2])->page(true, false, false, 15); + $query = $this->_query('DataNewsXCollect'); + $query->where(['uid' => $this->uuid, 'type' => 2, 'status' => 2]); + $result = $query->order('id desc')->page(true, false, false, 15); NewsService::instance()->buildListByUidAndCode($result['list']); $this->success('获取点赞记录成功!', $result); } + /** + * 添加用户的浏览历史 + * @throws \think\db\exception\DbException + */ + public function addHistory() + { + $data = $this->_vali([ + 'uid.value' => $this->uuid, + 'type.value' => 2, + 'status.value' => 2, + 'code.require' => '文章编号不能为空!', + ]); + $this->app->db->name('DataNewsXCollect')->where($data)->delete(); + $this->app->db->name('DataNewsXCollect')->insert($data); + $this->success('添加浏览历史成功!'); + } + /** * 获取用户的浏览历史 * @throws \think\db\exception\DataNotFoundException @@ -162,24 +207,11 @@ class News extends Auth */ public function getHistory() { - $query = $this->_query('DataNewsXCollect')->order('id desc'); - $result = $query->where(['uid' => $this->uuid, 'type' => 3])->page(true, false, false, 15); + $query = $this->_query('DataNewsXCollect'); + $query->where(['uid' => $this->uuid, 'type' => 3, 'status' => 2]); + $result = $query->order('id desc')->page(true, false, false, 15); NewsService::instance()->buildListByUidAndCode($result['list']); $this->success('获取浏览历史成功!', $result); } - /** - * 获取收藏点赞 - * @param integer $type 数据类型 - * @return array - */ - private function _getCollectWhere(int $type = 1): array - { - return $this->_vali([ - 'uid.value' => $this->uuid, - 'type.value' => $type, - 'code.require' => '编号不能为空!', - ]); - } - } \ No newline at end of file diff --git a/app/data/controller/api/auth/Order.php b/app/data/controller/api/auth/Order.php index db2e2dc21..74579da01 100644 --- a/app/data/controller/api/auth/Order.php +++ b/app/data/controller/api/auth/Order.php @@ -77,10 +77,10 @@ class Order extends Auth $goodsItem = $this->app->db->name('ShopGoodsItem')->where($map)->find(); if (empty($goodsItem)) $this->error('商品规格异常'); // 限制数量 - if (isset($goods['limit_max_buy']) && $goods['limit_max_buy'] > 0) { + if (isset($goods['limit_max_num']) && $goods['limit_max_num'] > 0) { $map = [['a.status', 'in', [2, 3, 4, 5]], ['b.goods_code', '=', $goods['code']], ['a.uid', '=', $this->uuid]]; $buys = $this->app->db->name('StoreOrder')->alias('a')->join('store_order_item b', 'a.order_no=b.order_no')->where($map)->sum('b.stock_sales'); - if ($this->member['vip_entry'] && $goods['vip_entry'] || $buys + $count > $goods['limit_max_buy']) { + if ($this->member['vip_entry'] && $goods['vip_entry'] || $buys + $count > $goods['limit_max_num']) { $this->error('超过限购数量'); } } diff --git a/app/data/service/NewsService.php b/app/data/service/NewsService.php index 7f868c8a0..0361b71a2 100644 --- a/app/data/service/NewsService.php +++ b/app/data/service/NewsService.php @@ -14,18 +14,17 @@ class NewsService extends Service /** * 同步文章数据统计 * @param string $code 文章编号 + * @param array $total 查询统计 * @throws \think\db\exception\DbException */ - public function syncNewsTotal(string $code): void + public function syncNewsTotal(string $code, $total = []): void { - [$map, $total] = [['code' => $code], []]; - $query = $this->app->db->name('DataNewsXCollect')->field('count(1) count,type'); - $query->where($map)->group('type')->select()->map(function ($item) use (&$total) { + $query = $this->app->db->name('DataNewsXCollect')->field('type,count(1) count'); + foreach ($query->where(['code' => $code, 'status' => 2])->group('type')->cursor() as $item) { $total[$item['type']] = $item['count']; - }); + } $this->app->db->name('DataNewsItem')->where(['code' => $code])->update([ - 'num_collect' => $total[2] ?? 0, 'num_like' => $total[1] ?? 0, - 'num_comment' => $this->app->db->name('DataNewsXComment')->where($map)->count(), + 'num_like' => $total[1] ?? 0, 'num_collect' => $total[2] ?? 0, 'num_comment' => $total[4] ?? 0, ]); } @@ -54,15 +53,15 @@ class NewsService extends Service /** * 获取列表状态 * @param array $list 数据列表 - * @param integer $mid 用户UID + * @param integer $uid 用户UID * @return array */ - public function buildListState(array &$list, int $mid = 0): array + public function buildListState(array &$list, int $uid = 0): array { if (count($list) > 0) { [$code2, $code1, $marks] = [[], [], []]; - if ($mid > 0) { - $map = [['uid', '=', $mid], ['code', 'in', array_unique(array_column($list, 'code'))]]; + if ($uid > 0) { + $map = [['uid', '=', $uid], ['code', 'in', array_unique(array_column($list, 'code'))]]; $marks = $this->app->db->name('DataNewsMark')->where(['status' => 1])->column('name'); $code1 = $this->app->db->name('DataNewsXCollect')->where($map)->where(['type' => 1])->column('code'); $code2 = $this->app->db->name('DataNewsXCollect')->where($map)->where(['type' => 2])->column('code'); diff --git a/app/data/view/shop_goods/form.html b/app/data/view/shop_goods/form.html index 2c9a1ef75..b88495c0a 100644 --- a/app/data/view/shop_goods/form.html +++ b/app/data/view/shop_goods/form.html @@ -2,7 +2,7 @@ {block name="content"} {include file='shop_goods/formstyle'} -
+
{notempty name='marks'}
@@ -54,12 +54,13 @@ {/notempty}
- 商品图片及轮播展示图片 + 商品封面及轮播图片 + Cover and Carousel Pictures - - + +
LOGO展示图片商品封面轮播图片
@@ -76,22 +77,34 @@
+
- 入会礼包配置 + 物流配送发货
- {foreach [0=>'非入会礼包,购买后不会影响等级',1=>'入会员礼包,购买后升级会员级别'] as $k=>$v} + {foreach ['虚拟商品,无需物流配送','实物商品,需要物流配送'] as $k=>$v} + {if (isset($vo.truck_type) and $vo.truck_type eq $k) or (empty($vo.truck_type) and $k eq 0)} + + {else} + + {/if}{/foreach} +
+
+ +
+ 入会礼包配置 +
+ {foreach ['非入会礼包,购买后不会影响等级','入会员礼包,购买后升级会员级别'] as $k=>$v} {if (isset($vo.vip_entry) and $vo.vip_entry eq $k) or (empty($vo.vip_entry) and $k eq 0)} {else} - {/if} - {/foreach} + {/if}{/foreach}
{notempty name='levels'}
- 升级会员级别 + 升级会员级别 +
+ {/notempty} + {notempty name='levels'}
- 限制最低购买等级 + 限制最低购买等级
- {/notempty} -
- 商品限购设置 - -
@@ -174,8 +186,8 @@
- 增加分组 -

请完成属性修改后再编辑下面的规格信息,否则规格数据会丢失!!!

+ 增加规则分组 +

请完成属性修改后再编辑下面的规格信息,否则规格数据会丢失!

@@ -184,6 +196,8 @@ + + @@ -207,6 +221,16 @@ + + @@ -366,7 +392,9 @@ item.sku = $rootScope.getValue(item.key, 'sku', getRand(14, 'S')); item.status = !!$rootScope.getValue(item.key, 'status', 1); item.market = $rootScope.getValue(item.key, 'market', '0.00'); + item.balance = $rootScope.getValue(item.key, 'balance', '0.00'); item.selling = $rootScope.getValue(item.key, 'selling', '0.00'); + item.integral = $rootScope.getValue(item.key, 'integral', '0.00'); item.express = $rootScope.getValue(item.key, 'express', '1'); item.virtual = $rootScope.getValue(item.key, 'virtual', '0'); return false; diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 1f1722cf6..102323d27 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -860,7 +860,7 @@ "source": { "type": "git", "url": "https://gitee.com/zoujingli/ThinkLibrary", - "reference": "f835b371ad1d37cf7352d27aa7a24ea9667a5b51" + "reference": "1f6500135bacf0b7ef7dcaa1115494e73ab92b90" }, "require": { "ext-curl": "*", @@ -870,7 +870,7 @@ "ext-mbstring": "*", "topthink/framework": "^6.0" }, - "time": "2021-02-22T02:50:49+00:00", + "time": "2021-02-22T10:20:05+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/services.php b/vendor/services.php index b2491843f..d02c003a7 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\admin\\Library', diff --git a/vendor/zoujingli/think-library/readme.md b/vendor/zoujingli/think-library/readme.md index 7fb2b5712..60dcf68c1 100644 --- a/vendor/zoujingli/think-library/readme.md +++ b/vendor/zoujingli/think-library/readme.md @@ -1,6 +1,13 @@ [![Latest Stable Version](https://poser.pugx.org/zoujingli/think-library/v/stable)](https://packagist.org/packages/zoujingli/think-library) [![Total Downloads](https://poser.pugx.org/zoujingli/think-library/downloads)](https://packagist.org/packages/zoujingli/think-library) [![Latest Unstable Version](https://poser.pugx.org/zoujingli/think-library/v/unstable)](https://packagist.org/packages/zoujingli/think-library) [![License](https://poser.pugx.org/zoujingli/think-library/license)](https://packagist.org/packages/zoujingli/think-library) -# ThinkLibrary 6.0 for ThinkPHP 6.0 +> 近期 Github 网络访问不稳定,项目主库已迁移到 Gitee 仓库 +> +> 注意:Github 仓库不会经常更新,获取最新源码请访问 Gitee 仓库 +> +> Gitee 仓库地址:https://gitee.com/zoujingli/ThinkLibrary + +ThinkLibrary 6.0 for ThinkPHP 6.0 +--- ThinkLibrary 6.0 是针对 ThinkPHP 6.0 版本封装的一套工具类库,方便快速构建 Web 应用。
商品SKU 市场价格 销售价格 奖励余额 奖励积分 虚拟销量 快递计件 销售状态 + + + + - +