mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-05-22 14:59:14 +08:00
ComposerUpdate
This commit is contained in:
parent
2c89f9a760
commit
3eda894673
60
admin_v6.sql
60
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
|
||||
|
@ -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'],
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -12,6 +12,12 @@ use app\data\service\NewsService;
|
||||
*/
|
||||
class News extends Auth
|
||||
{
|
||||
/**
|
||||
* 绑定数据表
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'DataNewsXCollect';
|
||||
|
||||
/**
|
||||
* 用户评论内容
|
||||
* @throws \think\db\exception\DbException
|
||||
@ -20,10 +26,12 @@ class News extends Auth
|
||||
{
|
||||
$data = $this->_vali([
|
||||
'uid.value' => $this->uuid,
|
||||
'type.value' => 4,
|
||||
'status.value' => 1,
|
||||
'code.require' => '文章不能为空!',
|
||||
'content.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' => '编号不能为空!',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
@ -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('超过限购数量');
|
||||
}
|
||||
}
|
||||
|
@ -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');
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
{block name="content"}
|
||||
{include file='shop_goods/formstyle'}
|
||||
<form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card table-block' autocomplete="off">
|
||||
<form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
|
||||
<div class="layui-card-body padding-40 padding-bottom-20">
|
||||
{notempty name='marks'}
|
||||
<div class="layui-form-item relative block">
|
||||
@ -54,12 +54,13 @@
|
||||
{/notempty}
|
||||
|
||||
<div class="layui-form-item">
|
||||
<span class="color-green font-w7 label-required-prev">商品图片及轮播展示图片</span>
|
||||
<span class="color-green font-w7 label-required-prev">商品封面及轮播图片</span>
|
||||
<span class="color-desc margin-left-5">Cover and Carousel Pictures</span>
|
||||
<table class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:90px" class="text-center">LOGO</th>
|
||||
<th class="text-left">展示图片</th>
|
||||
<th style="width:90px" class="text-center">商品封面</th>
|
||||
<th style="width:auto" class="text-left">轮播图片</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-center">
|
||||
@ -76,22 +77,34 @@
|
||||
</div>
|
||||
|
||||
<div class="layui-clear goods-item-box">
|
||||
|
||||
<fieldset>
|
||||
<legend class="layui-bg-gray">入会礼包配置</legend>
|
||||
<legend><span class="layui-badge think-bg-violet">物流配送发货</span></legend>
|
||||
<div class="layui-form-item">
|
||||
{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)}
|
||||
<input type="radio" name="truck_type" value="{$k}" title="{$v}" checked>
|
||||
{else}
|
||||
<input type="radio" name="truck_type" value="{$k}" title="{$v}">
|
||||
{/if}{/foreach}
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend><span class="layui-badge think-bg-violet">入会礼包配置</span></legend>
|
||||
<div class="layui-form-item">
|
||||
{foreach ['非入会礼包,购买后不会影响等级','入会员礼包,购买后升级会员级别'] as $k=>$v}
|
||||
{if (isset($vo.vip_entry) and $vo.vip_entry eq $k) or (empty($vo.vip_entry) and $k eq 0)}
|
||||
<input type="radio" name="vip_entry" value="{$k}" title="{$v}" checked lay-filter="vip_entry">
|
||||
{else}
|
||||
<input type="radio" name="vip_entry" value="{$k}" title="{$v}" lay-filter="vip_entry">
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}{/foreach}
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
{notempty name='levels'}
|
||||
<fieldset>
|
||||
<legend class="layui-bg-gray">升级会员级别</legend>
|
||||
<legend><span class="layui-badge think-bg-violet">升级会员级别</span></legend>
|
||||
<label class="layui-form-item">
|
||||
<select name="vip_upgrade" class="layui-select" lay-filter="vip_upgrade">
|
||||
{foreach $levels as $level}{if isset($vo.vip_upgrade) and $vo.vip_upgrade eq $level.number}
|
||||
@ -105,9 +118,26 @@
|
||||
</fieldset>
|
||||
{/notempty}
|
||||
|
||||
{notempty name='discounts'}
|
||||
<fieldset>
|
||||
<legend><span class="layui-badge think-bg-violet">会员折扣方案</span></legend>
|
||||
<label class="layui-form-item">
|
||||
<select name="discount_id" class="layui-select" lay-search>
|
||||
<option value="0"> -- 不设置 --</option>
|
||||
{foreach $discounts as $discount}{if isset($vo.discount_id) and $vo.discount_id eq $discount.id}
|
||||
<option selected value="{$discount.id|default=0}">{$discount.name|default='0'}</option>
|
||||
{else}
|
||||
<option value="{$discount.id|default=0}">{$discount.name|default='0'}</option>
|
||||
{/if}{/foreach}
|
||||
</select>
|
||||
<span class="help-block">会员级别达到规则可享有折扣!</span>
|
||||
</label>
|
||||
</fieldset>
|
||||
{/notempty}
|
||||
|
||||
{notempty name='levels'}
|
||||
<fieldset>
|
||||
<legend class="layui-bg-gray">限制最低购买等级</legend>
|
||||
<legend><span class="layui-badge think-bg-violet">限制最低购买等级</span></legend>
|
||||
<label class="layui-form-item">
|
||||
<select name="limit_low_vip" class="layui-select">
|
||||
<option value="0"> -- 不设置 --</option>
|
||||
@ -122,32 +152,14 @@
|
||||
</fieldset>
|
||||
{/notempty}
|
||||
|
||||
{notempty name='discounts'}
|
||||
<fieldset>
|
||||
<legend class="layui-bg-gray">会员享有折扣方案</legend>
|
||||
<legend><span class="layui-badge think-bg-violet">商品限购数量</span></legend>
|
||||
<label class="layui-form-item">
|
||||
<select name="discount_id" class="layui-select" lay-search>
|
||||
<option value="0"> -- 不设置 --</option>
|
||||
{foreach $discounts as $discount}
|
||||
{if isset($vo.discount_id) and $vo.discount_id eq $discount.id}
|
||||
<option selected value="{$discount.id|default=0}">{$discount.name|default='0'}</option>
|
||||
{else}
|
||||
<option value="{$discount.id|default=0}">{$discount.name|default='0'}</option>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</select>
|
||||
<span class="help-block">会员级别达到规则可享有折扣!</span>
|
||||
<input class="layui-input" data-blur-number="0" name="limit_max_num" value="{$vo.limit_max_num|default=0}" placeholder="请输入商品限购数量">
|
||||
<span class="help-block">限制每人可购买数量(为 0 时不限制)!</span>
|
||||
</label>
|
||||
</fieldset>
|
||||
{/notempty}
|
||||
|
||||
<fieldset>
|
||||
<legend class="layui-bg-gray">商品限购设置</legend>
|
||||
<label class="layui-form-item">
|
||||
<input class="layui-input" data-blur-number="0" name="limit_max_buy" value="{$vo.limit_max_buy|default=0}" placeholder="请输入商品限购数量">
|
||||
<span class="help-block">限制每人可购买数量(为0时不限制)!</span>
|
||||
</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
@ -174,8 +186,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="mode==='add'">
|
||||
<a ng-if="specs.length<3" class="layui-btn layui-btn-sm layui-btn-primary" ng-click="addSpecRow(specs)">增加分组</a>
|
||||
<p>请完成属性修改后再编辑下面的规格信息,否则规格数据会丢失!!!</p>
|
||||
<a ng-if="specs.length<3" class="layui-btn layui-btn-sm layui-btn-primary" ng-click="addSpecRow(specs)">增加规则分组</a>
|
||||
<p class="margin-top-10"><span class="color-red">请完成属性修改后再编辑下面的规格信息,否则规格数据会丢失!</span></p>
|
||||
</div>
|
||||
<table class="layui-table margin-top-10">
|
||||
<thead>
|
||||
@ -184,6 +196,8 @@
|
||||
<th width="12%" class="text-center nowrap">商品SKU <a ng-click="batchSet('sku',null)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
||||
<th width="10%" class="text-center nowrap">市场价格 <a ng-click="batchSet('market',2)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
||||
<th width="10%" class="text-center nowrap">销售价格 <a ng-click="batchSet('selling',2)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
||||
<th width="10%" class="text-center nowrap">奖励余额 <a ng-click="batchSet('balance',2)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
||||
<th width="10%" class="text-center nowrap">奖励积分 <a ng-click="batchSet('integral',2)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
||||
<th width="10%" class="text-center nowrap">虚拟销量 <a ng-click="batchSet('virtual',0)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
||||
<th width="10%" class="text-center nowrap">快递计件 <a ng-click="batchSet('express',0)" data-tips-text="批量设置" class="layui-icon"></a></th>
|
||||
<th width="08%" class="text-center nowrap">销售状态</th>
|
||||
@ -207,6 +221,16 @@
|
||||
<input ng-blur="rows[0].selling=setValue(rows[0].key,'selling',$event.target.value,'(parseFloat(_)||0).toFixed(2)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].selling">
|
||||
</label>
|
||||
</td>
|
||||
<td class="padding-0">
|
||||
<label class="padding-0 margin-0">
|
||||
<input ng-blur="rows[0].balance=setValue(rows[0].key,'balance',$event.target.value,'(parseFloat(_)||0).toFixed(2)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].balance">
|
||||
</label>
|
||||
</td>
|
||||
<td class="padding-0">
|
||||
<label class="padding-0 margin-0">
|
||||
<input ng-blur="rows[0].integral=setValue(rows[0].key,'integral',$event.target.value,'(parseFloat(_)||0).toFixed(2)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].integral">
|
||||
</label>
|
||||
</td>
|
||||
<td class="padding-0">
|
||||
<label class="padding-0 margin-0">
|
||||
<input ng-blur="rows[0].virtual=setValue(rows[0].key,'virtual',$event.target.value,'(parseInt(_)||0)')" class="layui-input border-0 padding-left-0 text-center" ng-model="rows[0].virtual">
|
||||
@ -218,7 +242,9 @@
|
||||
</label>
|
||||
</td>
|
||||
<td class="text-center layui-bg-gray">
|
||||
<label class="think-checkbox margin-0 full-width full-height block"><input lay-ignore type="checkbox" ng-model="rows[0].status"></label>
|
||||
<label class="think-checkbox margin-0 full-width full-height block">
|
||||
<input lay-ignore type="checkbox" ng-model="rows[0].status">
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -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;
|
||||
|
4
vendor/composer/installed.json
vendored
4
vendor/composer/installed.json
vendored
@ -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": {
|
||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// This file is automatically generated at:2021-02-22 10:56:25
|
||||
// This file is automatically generated at:2021-02-23 09:58:44
|
||||
declare (strict_types = 1);
|
||||
return array (
|
||||
0 => 'think\\admin\\Library',
|
||||
|
9
vendor/zoujingli/think-library/readme.md
vendored
9
vendor/zoujingli/think-library/readme.md
vendored
@ -1,6 +1,13 @@
|
||||
[](https://packagist.org/packages/zoujingli/think-library) [](https://packagist.org/packages/zoujingli/think-library) [](https://packagist.org/packages/zoujingli/think-library) [](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 应用。
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user