微信小程序不二博客星球-创新互联
一、灵感











后台截图


2.2、项目结构
后端
小程序
后台管理
三、技术选型
3.1、语言介绍
网站名称:微信小程序不二博客星球-创新互联
本文URL:http://scpingwu.com/article/doiosd.html
趁着周末无聊,做了一款博客小程序,记录日常工作中遇到的一些问题,方便在手机上温故。
借鉴了网上的一些类似功能,用了大概近一个月的时间,完成了第一个版本。
主要功能有:
- 博客
- 专题
- 书籍推荐
- 圈子
- 动态
- 评论、收藏
- 积分获取
- 留言
- 等等

























3.2、源码展示
- 小程序使用uniapp框架,开箱即用。
- 前端使用 vue、ElementUI。
- 后端使用 java 主流框架 Springboot。
- 中间件 Redis
获取积分
@Override
public void addRecord(IntegralValueEnum valueEnum, Long userId) { threadPoolTaskExecutor.execute(() ->{ if (ObjectUtils.isEmpty(userId)) { return;
}
switch (valueEnum.getType()) { // 增加积分
case IntegralTypeConstant.INCREASE:
// 当天积分获取记录
ListintegralRecordEntities = baseDao.selectList(Wrappers.lambdaQuery()
.eq(IntegralRecordEntity::getType, IntegralTypeConstant.INCREASE)
.eq(IntegralRecordEntity::getSourceName, valueEnum.getTitle())
.eq(IntegralRecordEntity::getCreator, userId)
.ge(IntegralRecordEntity::getCreateDate, DateUtils.getZeroDate(true))
.lt(IntegralRecordEntity::getCreateDate, DateUtils.getZeroDate(false))
.orderByDesc(IntegralRecordEntity::getCreateDate));
if (CollUtil.isEmpty(integralRecordEntities)) { updateIntegral(valueEnum, userId, valueEnum.value());
} else { // 今日已获得该类型的积分值
int sum = integralRecordEntities.stream().mapToInt(IntegralRecordEntity::getUpdateNum).sum();
if (sum >= valueEnum.getMaxNum()) { log.error("今日获取积分已达上限, name={}, userId={}", valueEnum.title(), userId);
return;
}
// 此次应加积分(忽略超出的积分)
int updateIntegralNum = (valueEnum.maxNum() - sum) >valueEnum.value() ? valueEnum.value() : valueEnum.maxNum() - sum;
updateIntegral(valueEnum, userId, updateIntegralNum);
}
break;
// 扣减积分
case IntegralTypeConstant.DEDUCTIONS:
IntegralEntity integralEntity = integralDao.selectOne(Wrappers.lambdaQuery()
.eq(IntegralEntity::getCreator, userId));
if (ObjectUtils.isEmpty(integralEntity)) { return;
}
int differenceValue = Math.max(integralEntity.getIntegralNum() - valueEnum.value(), 0);
updateIntegral(valueEnum, userId, differenceValue);
break;
default:
}
});
}
文章详情
public ArticleDTO appGet(Long id, UserEntity user) {ArticleEntity entity = this.selectById(id);
ArticleDTO articleDTO = ConvertUtils.sourceToTarget(entity, ArticleDTO.class);
articleDTO.setPictures(JsonUtils.parseArray(entity.getPictures(), String.class).toArray(new String[0]));
Long count = myLinkDao.selectCount(Wrappers.lambdaQuery()
.eq(MyLinkEntity::getCategory, BusinessTypeConstant.ARTICLE)
.eq(MyLinkEntity::getStatus, StringPool.ONE)
.eq(MyLinkEntity::getSourceId, id));
articleDTO.setCollectionNum(count.intValue());
if (ObjectUtils.isNotEmpty(user)) {Long i = myLinkDao.selectCount(Wrappers.lambdaQuery()
.eq(MyLinkEntity::getCategory, BusinessTypeConstant.ARTICLE)
.eq(MyLinkEntity::getStatus, StringPool.ZERO)
.eq(MyLinkEntity::getCreator, user.getId())
.eq(MyLinkEntity::getSourceId, id));
articleDTO.setIsCollect(i >0);
} else {articleDTO.setIsCollect(false);
}
return articleDTO;
}
有需要前后端源码的,可私聊看演示。
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧
网站名称:微信小程序不二博客星球-创新互联
本文URL:http://scpingwu.com/article/doiosd.html