基于SSM实现仿知乎微信小程序分享
2023-06-13 09:14:06 时间
技术点
- 开发语言:Java
- 框架:ssm框架
- JDK版本:JDK1.8
- 服务器:tomcat8.5
- 数据库:mysql 5.7(请一定使用5.×版本数据库,尽量使用5.7)
- 数据库工具:Navicat16
- 开发软件:eclipse或者idea都可以
- Maven包:Maven3.3.9
系统功能介绍
(1)用户管理功能。主要实现了仿知乎微信小程序的用户管理功能。
(2)标签管理功能。主要实现了仿知乎微信小程序的标签管理功能。
(3)今日热闻管理功能。主要实现了仿知乎微信小程序的今日热闻管理功能。
(4)问答模式管理功能。主要实现了仿知乎微信小程序的问答模式管理功能。
(5)文件管理功能。主要实现了仿知乎微信小程序的文件管理功能。
截图演示
主要代码逻辑
/**
* 通用接口
*/
@RestController
public class CommonController{
@Autowired
private CommonService commonService;
@Autowired
private ConfigService configService;
private static AipFace client = null;
private static String BAIDU_DITU_AK = null;
@RequestMapping("/location")
public R location(String lng,String lat) {
if(BAIDU_DITU_AK==null) {
BAIDU_DITU_AK = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "baidu_ditu_ak")).getValue();
if(BAIDU_DITU_AK==null) {
return R.error("请在配置管理中正确配置baidu_ditu_ak");
}
}
Map<String, String> map = BaiduUtil.getCityByLonLat(BAIDU_DITU_AK, lng, lat);
return R.ok().put("data", map);
}
/**
* 人脸比对
*
* @param face1 人脸1
* @param face2 人脸2
* @return
*/
@RequestMapping("/matchFace")
public R matchFace(String face1, String face2,HttpServletRequest request) {
if(client==null) {
/*String AppID = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "AppID")).getValue();*/
String APIKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "APIKey")).getValue();
String SecretKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "SecretKey")).getValue();
String token = BaiduUtil.getAuth(APIKey, SecretKey);
if(token==null) {
return R.error("请在配置管理中正确配置APIKey和SecretKey");
}
client = new AipFace(null, APIKey, SecretKey);
client.setConnectionTimeoutInMillis(2000);
client.setSocketTimeoutInMillis(60000);
}
JSONObject res = null;
try {
File file1 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face1);
File file2 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face2);
String img1 = Base64Util.encode(FileUtil.FileToByte(file1));
String img2 = Base64Util.encode(FileUtil.FileToByte(file2));
MatchRequest req1 = new MatchRequest(img1, "BASE64");
MatchRequest req2 = new MatchRequest(img2, "BASE64");
ArrayList<MatchRequest> requests = new ArrayList<MatchRequest>();
requests.add(req1);
requests.add(req2);
res = client.match(requests);
System.out.println(res.get("result"));
} catch (FileNotFoundException e) {
e.printStackTrace();
return R.error("文件不存在");
} catch (IOException e) {
e.printStackTrace();
}
return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString()));
}
/**
* 获取table表中的column列表(联动接口)
* @param table
* @param column
* @return
*/
@IgnoreAuth
@RequestMapping("/option/{tableName}/{columnName}")
public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,String level,String parent) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
if(StringUtils.isNotBlank(level)) {
params.put("level", level);
}
if(StringUtils.isNotBlank(parent)) {
params.put("parent", parent);
}
List<String> data = commonService.getOption(params);
return R.ok().put("data", data);
}
下载地址
相关文章
- 【愚公系列】2022年08月 微信小程序-下拉刷新功能实现
- 【愚公系列】2022年09月 微信小程序-电商项目-商品列表也功能实现(待写勿看)
- 微信小程序官方组件展示之表单组件keyboard-accessory源码
- 微信小程序即时聊天对话窗口静态源码[通俗易懂]
- 解决微信小程序errcode:40029[通俗易懂]
- 微信小程序电商实战—首页篇(上)
- 【说站】独家全新娱乐性超高的喝酒神器微信小程序源码支持流量主解锁多人对战等等
- 【说站】2021最新微信漫画小程序全开源商业版:带漫画资源,带搭建教程,流量变现利器
- php实现微信小程序消息通知「建议收藏」
- 【愚公系列】2022年09月 微信小程序-小程序登录面板功能实现
- 【愚公系列】2022年09月 微信小程序-promise2详解(待写勿看)
- 微信开发步骤_微信小程序快速入门
- 【愚公系列】2022年10月 微信小程序-电商项目-使用vtabs实现商品列表页
- 【愚公系列】2022年10月 微信小程序-电商项目-微信支付小程序内部API功能实现
- 【愚公系列】2022年10月 微信小程序-电商项目-微信支付后端功能实现(node版)
- 【愚公系列】2022年10月 微信小程序-优购电商项目-小程序模板语法
- python新手程序_怎么用微信小程序练字
- 【愚公系列】2022年11月 微信小程序-优购电商项目-意见反馈页面
- 【愚公系列】2022年11月 微信小程序-优购电商项目-个人中心页面
- 微信小程序Video组件实现视频、自定义播放按钮、封面图、封面图文字demo
- 微信小程序模板消息接口下线了,不用慌,调用统一服务消息接口来实现相同功能
- 2-STM32+Air724UG基本控制篇(自建物联网平台)-整体运行测试-微信小程序扫码绑定Air724,并通过MQTT和模组实现远程通信控制(使用模组自带MQTT命令)
- 【微信小程序】微信小程序生成二维码报错errcode=41030,invalid page rid
- 微信小程序管理软件在提高安全性、稳定性和可扩展性方面的作用
- 微信 iOS SQLite 源码优化实践
- 微信小程序之基础入门详解编程语言