Commit 13dd7379 by jscat

nyx: 优化多图oss上传流程,添加发现点赞功能

说明
1. 多图上传里,前n-1张图片直接上传oss,最后第n张图片上传oss+callback,通过callback写入阿里云数据库
2. 针对postId进行点赞,
3. 已点赞用户无需二次点赞
parent 490867f6
//config.js API全局域名配置 //config.js API全局域名配置
//config.js API全局域名配置 //config.js API全局域名配置
var prod = 0; var prod = 0; //阿里云服务器生产版本
var local = 0; var local = 1; //本地java测试,需要启动java 后台
var test = 1; var test = 0; //阿里云服务器测试版本
var debug = 0; //是否打印调试信息 var debug = 0; //是否打印调试信息
var host_key = "https://fun.hisuhong.com"; var host_key = "https://fun.hisuhong.com";
...@@ -54,5 +54,6 @@ var config={ ...@@ -54,5 +54,6 @@ var config={
socket_url: socket_url, socket_url: socket_url,
oss_token_url: host_key + "/api/nyx/oss/getToken", oss_token_url: host_key + "/api/nyx/oss/getToken",
oss_callback_url: login_url + "/api/nyx/oss/callback", oss_callback_url: login_url + "/api/nyx/oss/callback",
post_like_url: host_key + "/api/nyx/post/like",
} }
module.exports=config; module.exports=config;
\ No newline at end of file
// pages/kinds/kinds.js // pages/kinds/kinds.js
...@@ -45,6 +45,9 @@ Page({ ...@@ -45,6 +45,9 @@ Page({
strSearch : "", //搜索的字串 strSearch : "", //搜索的字串
inputVal : "", //输入字符串,主要用于页面显示 inputVal : "", //输入字符串,主要用于页面显示
//点赞模块
likeDict: {},
}, },
switchCategory(e) { switchCategory(e) {
...@@ -200,13 +203,14 @@ Page({ ...@@ -200,13 +203,14 @@ Page({
} }
for (var i = 0; i < res.data.data.length; i++) { for (var i = 0; i < res.data.data.length; i++) {
var result = {} var result = {}
result["post_id"] = res.data.data[i].postId
result["note_image"] = res.data.data[i].noteImage.split("::") result["note_image"] = res.data.data[i].noteImage.split("::")
result["title"] = res.data.data[i].title result["title"] = res.data.data[i].title
result["tag"] = res.data.data[i].tag result["tag"] = res.data.data[i].tag
result["content"] = res.data.data[i].content result["content"] = res.data.data[i].content
result["like"] = res.data.data[i].numLike result["like"] = res.data.data[i].numLike
result["writer_name"] = res.data.data[i].nickName result["writer_name"] = res.data.data[i].nickName == null ? "匿名用户" : res.data.data[i].nickName
result["writer_image"] = res.data.data[i].avatarUrl result["writer_image"] = res.data.data[i].avatarUrl == null ? '/icon/icon_avatar1.png' : res.data.data[i].avatarUrl
list.push(result) list.push(result)
} }
...@@ -278,5 +282,46 @@ Page({ ...@@ -278,5 +282,46 @@ Page({
}) })
}, },
submitLike: function (postId) {
var _this = this;
var strUrl = config.post_like_url + '?postId=' + postId
config.debug == 1 ? console.log("===submitLike strUrl is: " + strUrl) : ""
wx.request({
url: strUrl,
method: 'GET',
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) {
if (res.statusCode == 200) {
//表示查询成功
console.log(res.data);
var notesList = _this.data.notes
var likeDict = _this.data.likeDict
for (var j = 0; j < notesList.length; j++) {
if (notesList[j].post_id == postId)
notesList[j].like = parseInt(notesList[j].like) + 1
likeDict[postId] = 1
}
_this.setData({
likeDict: likeDict,
notes: notesList,
})
}
}
})
},
onSubmitLike: function (e) {
var _this = this;
let postId = e.currentTarget.dataset.postId;//获取评论内容
var likeDict = _this.data.likeDict
if (likeDict[postId] == 0 || likeDict[postId] == undefined) {
_this.submitLike(postId)
}
},
}) })
<view class="page"> <view class="page">
...@@ -47,8 +47,8 @@ ...@@ -47,8 +47,8 @@
<image class="photo-img" src="{{item.writer_image}}"/> <image class="photo-img" src="{{item.writer_image}}"/>
<span class="name">{{item.writer_name}}</span> <span class="name">{{item.writer_name}}</span>
</navigator> </navigator>
<view class="like"> <view class="like" bindtap="onSubmitLike" data-post-id="{{item.post_id}}">
<image class="like-icon" src="../../icon/discover/like.png"/> <image class="like-icon" src="../../icon/discover/like.png" style="width:30rpx;height:30rpx"/>
<span>{{item.like}}</span> <span>{{item.like}}</span>
</view> </view>
</view> </view>
......
// pages/index/note-info/note-info.js // pages/index/note-info/note-info.js
...@@ -35,8 +35,8 @@ Page({ ...@@ -35,8 +35,8 @@ Page({
notes['content'] = options.content; notes['content'] = options.content;
notes['note_image'] = options.note_image.split(","); notes['note_image'] = options.note_image.split(",");
notes['like'] = options.like; notes['like'] = options.like;
notes['writer_name'] = options.writer_name; notes['writer_name'] = options.writer_name == "null" ? "匿名用户" : options.writer_name;
notes['writer_image'] = options.writer_image; notes['writer_image'] = options.writer_image == "null" ? '/icon/icon_avatar1.png' : options.writer_image;
} }
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
......
<view class="page"> <view class="page">
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<span class="name">{{notes.writer_name}}</span> <span class="name">{{notes.writer_name}}</span>
</view> </view>
<!-- 图片 --> <!-- 图片 -->
<scroll-view class="scroll-view_H" scroll-x scroll-with-animation style="width: 100%;height:{{contentHeight}}px" bindscroll="getSelectItem" scroll-left="{{scrollLeft}}"> <scroll-view class="scroll-view_H" scroll-x scroll-with-animation style="width: 100%;height: 90%;" bindscroll="getSelectItem" scroll-left="{{scrollLeft}}">
<block wx:for="{{notes.note_image}}" wx:key="unique" wx:for-index="id" wx:for-item="item"> <block wx:for="{{notes.note_image}}" wx:key="unique" wx:for-index="id" wx:for-item="item">
<view class="scroll_item {{item.selected ? 'selected' : ''}}" data-index='{{item.index}}' bindtap='selectProItem'> <view class="scroll_item {{item.selected ? 'selected' : ''}}" data-index='{{item.index}}' bindtap='selectProItem'>
<image src="{{item}}" mode="widthFix"/> <image src="{{item}}" mode="widthFix"/>
...@@ -14,7 +14,10 @@ ...@@ -14,7 +14,10 @@
</scroll-view> </scroll-view>
<!-- 文字内容 --> <!-- 文字内容 -->
<view class="note"> <view class="note">
<view class="note-info"> <view class="note-title" style="font-weight: bold">
{{notes.title}}
</view>
<view class="note-content">
{{notes.content}} {{notes.content}}
</view> </view>
</view> </view>
......
.scroll-view_H{ .scroll-view_H{
...@@ -2,20 +2,21 @@ ...@@ -2,20 +2,21 @@
position: relative; position: relative;
width: 100%; width: 100%;
text-align: center; text-align: center;
transform: scale(0.9);
white-space: nowrap; white-space: nowrap;
} }
.scroll_item { .scroll_item {
position: relative; position: relative;
width: 100%; width: 100%;
height: 90%;
margin: 0; margin: 0;
transform-origin: 50% 0; transform-origin: 50% 0;
left: 0%; left: 0%;
display: inline-block; display: inline-block;
border-radius: 20rpx !important ; /* border-radius: 20rpx !important ; */
overflow: hidden; overflow: hidden;
transform: scale(0.9); /* transform: scale(0.9); */
/* box-shadow: 0 0 10px #ccc; */ vertical-align: middle;
vertical-align: top;
/* top: 0%; */ /* top: 0%; */
/* height: 72%; */ /* height: 72%; */
background-color: #fff; background-color: #fff;
...@@ -45,9 +46,25 @@ ...@@ -45,9 +46,25 @@
background: #fff; background: #fff;
border-radius: 5px; border-radius: 5px;
float: left; float: left;
margin-top: 0;
} }
.note-info{ .note-title{
font-size: 13px; font-size: 16px;
/* 后期用于 '展开' 功能 */
/* overflow : hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical; */
margin-left: 10%;
margin-right: 10%;
margin-top: 0;
text-align:justify;
}
.note-content{
font-size: 16px;
/* 后期用于 '展开' 功能 */ /* 后期用于 '展开' 功能 */
/* overflow : hidden; /* overflow : hidden;
......
<view class="page" style="height:100%;width:100%"> <view class="page" style="height:100%;width:100%">
...@@ -5,10 +5,7 @@ ...@@ -5,10 +5,7 @@
</navigator> </navigator>
</block> </block>
<view class="page-body">
<form> <form>
<view class="page-section">
<!-- <view class="weui-cells weui-cells_after-title"> --> <!-- <view class="weui-cells weui-cells_after-title"> -->
<!-- 选择图片来源 --> <!-- 选择图片来源 -->
<!-- <view class="weui-cell weui-cell_input"> <!-- <view class="weui-cell weui-cell_input">
...@@ -34,7 +31,6 @@ ...@@ -34,7 +31,6 @@
</view> </view>
</view> </view>
</view> --> </view> -->
<view class="weui-cells"> <view class="weui-cells">
<view class="weui-cell"> <view class="weui-cell">
<view class="weui-cell__bd"> <view class="weui-cell__bd">
...@@ -59,8 +55,6 @@ ...@@ -59,8 +55,6 @@
</view> </view>
</view> </view>
</view> </view>
</view>
</form> </form>
</view>
</view> </view>
\ No newline at end of file
// pages/post/submit/submit.js // pages/post/submit/submit.js
...@@ -20,8 +20,8 @@ Page({ ...@@ -20,8 +20,8 @@ Page({
accessid: "", accessid: "",
policy: "", policy: "",
signature: "", signature: "",
uploadUrl: "", host: "",
uploadUrlend: "", dir: "",
expire: "", expire: "",
securityToken: "", securityToken: "",
...@@ -31,28 +31,26 @@ Page({ ...@@ -31,28 +31,26 @@ Page({
}, },
onReady: function (e) { onReady: function (e) {
var _this = this; var _this = this;
//进入页面就自动获取oss参数
_this.oss(); _this.oss();
}, },
// Date Flow // Date Flow
// 输入该组图片的内容 // 提交oss和数据库
bindKeyInput(e) {
var _this = this;
_this.setData({
inputContent: e.detail.value
})
},
onSubmitPost: function (e) { onSubmitPost: function (e) {
var _this = this; var _this = this;
var title = e.detail.value.inputTitle;//获取topc var title = e.detail.value.inputTitle;//获取title
var content = e.detail.value.inputContent;//获取content var content = e.detail.value.inputContent;//获取content
app.globalData.postData.title = title
app.globalData.postData.content = content
if (content != undefined && content != "") { if (content != undefined && content != "") {
//step1, 上传至oss-获取token,在onReady()提前准备 //step1, 上传至oss-获取token,在onReady()提前准备
//_this.oss(); //_this.oss();
//step2, 上传至oss-上传图片 //step2, 上传至oss-上传图片
_this.releaseOss(title, content); _this.releaseOss(title, content);
//step3, 上传信息到数据库 //step3, 上传信息到数据库
//上传数据库在oss sdk的callback函数里设置
//需要java后台支持
} }
...@@ -76,8 +74,8 @@ Page({ ...@@ -76,8 +74,8 @@ Page({
accessid: res.data.data.accessid, accessid: res.data.data.accessid,
policy: res.data.data.policy, policy: res.data.data.policy,
signature: res.data.data.signature, signature: res.data.data.signature,
uploadUrl: res.data.data.host, host: res.data.data.host,
uploadUrlend: res.data.data.dir, dir: res.data.data.dir,
expire: res.data.data.expire, expire: res.data.data.expire,
securityToken: res.data.data.securityToken, securityToken: res.data.data.securityToken,
}) })
...@@ -85,44 +83,90 @@ Page({ ...@@ -85,44 +83,90 @@ Page({
} }
}) })
}, },
//上传照片(阿里云) //上传照片(阿里云)
uploadAli: function (babyData, photoArr) { uploadAli: function (tag, title, content, photoArr) {
var _this = this; var _this = this;
var uploadUrl = this.data.uploadUrl; var promise = Promise.all(photoArr.map((pic, index) => {
var uploadUrlend = this.data.uploadUrlend; //pic是多图上传模式中的单张图片 index => 0 : length-1
var photoArrLen = photoArr.length; console.log(pic)
console.log("===this is uploadAli"); //传给阿里云的参数
console.log("===uploadUrl_"+uploadUrl); var policy = this.data.policy;
console.log("===uploadUrlend_" + uploadUrlend); var accessid = this.data.accessid;
var securityToken = this.data.securityToken;
var signature = this.data.signature;
var path = this.data.host + "/" + this.data.dir;
console.log("policy: " + policy);
console.log("signature: " + signature);
console.log("accessid: " + accessid);
console.log("path: " + path)
var babyData = {
'Filename': '${filename}',
'name': pic.replace('http://tmp/', "").replace('wxfile://', ""),
'key': this.data.dir + '${filename}',
'policy': policy,
'OSSAccessKeyId': accessid,
'success_action_status': '200', //让服务端返回200,不然,默认会返回204
'signature': signature,
'x-oss-security-token': securityToken
}
// 多图n上传流程,通过promise.all实现异步控制
// n-1图直接上传
// 第n图上传+设置callback,在java后台提交参数到数据库
if (index == photoArr.length - 1)
{
var photoArrsm = [];
//由于微信小程序生成的临时路径在上传阿里云的时候不需要上传.所以需要对路径进行处理,但是在手机端上传和PC端上传,图片临时路径的前缀不同,所以需要进行分别的处理
// pc: http://tmp/
// wx: wxfile://
for (let i = 0; i < photoArr.length; i++) {
photoArrsm.push(path + photoArr[i].replace('http://tmp/', "").replace('wxfile://', ""));
}
//生成最终的文件字符串 file1.jpg::file2.png (数据库解析格式)
var image = photoArrsm.join("::")
var userId = wx.getStorageSync('nyxCode')
var strUrl = config.oss_callback_url
var callback_param = {
'callbackUrl': strUrl,
'callbackBody': 'filename=${object}&size=${size}&mimeType=${mimeType}&height=${imageInfo.height}&width=${imageInfo.width}&tag=' + encodeURI(encodeURI(tag)) + '&title=' + encodeURI(encodeURI(title)) + '&content=' + encodeURI(encodeURI(content)) + '&image=' + image + '&userId=' + userId,
'callbackBodyType': "application/x-www-form-urlencoded",
}
var base64_callback_body = base64.encode(JSON.stringify(callback_param));
babyData['callback'] = base64_callback_body
}
return new Promise(function (resolve, reject) {
var host = _this.data.host;
wx.uploadFile({ wx.uploadFile({
url: uploadUrl, url: host,
formData: babyData, formData: babyData,
name: 'file', name: 'file',
filePath: photoArr[0], filePath: pic,
header: { header: {
'content-type': 'multipart/form-data' 'content-type': 'multipart/form-data'
}, },
success: res => { success: function (res) {
if (res.statusCode == 200) { console.log("=== index_"+index)
//表示上传成功(可以在阿里云服务器查看上传的图片) console.log(res)
_this.switchTab() resolve(res.data);
} },
else fail: function (err) {
{ reject(new Error('failed to upload file'));
console.log("阿里云 oss 上传失败, error msg__", res) console.log("fail to upload file")
} },
complete: function () {
console.log("complete to upload file");
} }
}) });
});
})).then(_this.switchTab());
}, },
//发布按钮 //发布按钮
releaseOss: function (title, content) { releaseOss: function (title, content) {
var _this = this; var _this = this;
console.log("===this is releaseOss"); console.log("===this is releaseOss");
//获取照片数组 //获取照片数组
var photoArr = app.globalData.postData.photoArray; var photoArr = app.globalData.postData.photoArray;
//获取时间
var date = this.data.date;
var userToken = this.data.userToken;
//时间搓 //时间搓
var expire = this.data.expire; var expire = this.data.expire;
//获取当前时间搓 //获取当前时间搓
...@@ -133,50 +177,13 @@ Page({ ...@@ -133,50 +177,13 @@ Page({
_this.oss(); _this.oss();
expire = this.data.expire; expire = this.data.expire;
} }
//传给阿里云的参数
var policy = this.data.policy;
var accessid = this.data.accessid;
var securityToken = this.data.securityToken;
var signature = this.data.signature;
var uploadUrlend = this.data.uploadUrlend;
console.log("policy: " + policy);
console.log("signature: " + signature);
console.log("accessid: " + accessid);
//传给阿里云的参数-end
var newPhoto = '';
var photoArrsm = '';
//由于微信小程序生成的临时路径在上传阿里云的时候不需要上传.所以需要对路径进行处理,但是在手机端上传和PC端上传,图片临时路径的前缀不同,所以需要进行分别的处理
if (photoArr[0].indexOf('http://tmp/') != -1) {
photoArrsm = uploadUrlend + photoArr[0].replace('http://tmp/', "");
}
if (photoArr[0].indexOf('wxfile://') != -1) {
photoArrsm = uploadUrlend + photoArr[0].replace('wxfile://', "");
}
var tag = app.globalData.postData.photoTag var tag = app.globalData.postData.photoTag
var category = "心情" this.uploadAli(tag, title, content, photoArr)
var strUrl = config.oss_callback_url
var callback_param = {
'callbackUrl': strUrl,
'callbackBody': 'filename=${object}&size=${size}&mimeType=${mimeType}&height=${imageInfo.height}&width=${imageInfo.width}&tag=' + encodeURI(encodeURI(tag)) + '&title=' + encodeURI(encodeURI(title)) + '&content=' + encodeURI(encodeURI(content)),
'callbackBodyType': "application/x-www-form-urlencoded",
}
var base64_callback_body = base64.encode(JSON.stringify(callback_param));
var babyData = {
'Filename': '${filename}',
'name': 'photoArr[0]',
'key': uploadUrlend + '${filename}',
'policy': policy,
'OSSAccessKeyId': accessid,
'success_action_status': '200', //让服务端返回200,不然,默认会返回204
'callback': base64_callback_body,
'signature': signature,
'x-oss-security-token': securityToken
}
this.uploadAli(babyData, photoArr)
}, },
switchTab() { switchTab() {
app.globalData.postData = {}
wx.switchTab({ wx.switchTab({
url: '/pages/discover/discover' url: '/pages/discover/discover'
}); });
......
package cn.com.fun.nyxkey.api.repository; package cn.com.fun.nyxkey.api.repository;
...@@ -37,6 +37,7 @@ public interface Rockwell_keyMapper { ...@@ -37,6 +37,7 @@ public interface Rockwell_keyMapper {
/* post api */ /* post api */
List<Rockwell_keyV_post_info> getV_post_info(Rockwell_keyT_postQuery rockwell_keyT_postQuery); List<Rockwell_keyV_post_info> getV_post_info(Rockwell_keyT_postQuery rockwell_keyT_postQuery);
void addT_post(Rockwell_keyT_post rockwell_keyT_post); void addT_post(Rockwell_keyT_post rockwell_keyT_post);
void addT_postLike(Rockwell_keyT_post rockwell_keyT_post);
/* area api */ /* area api */
List<Rockwell_keyV_area_total> getCityList(); List<Rockwell_keyV_area_total> getCityList();
......
package cn.com.fun.nyxkey.api.service; package cn.com.fun.nyxkey.api.service;
...@@ -48,7 +48,7 @@ public interface Rockwell_keyService { ...@@ -48,7 +48,7 @@ public interface Rockwell_keyService {
* 数据流 小程序客户端 -> 阿里云oss -> callback回应用服务器 -> AddT_post * 数据流 小程序客户端 -> 阿里云oss -> callback回应用服务器 -> AddT_post
* */ * */
int Rockwell_keyServiceAddT_post(String userId, String noteImage, String tag, String title, String content) throws UnsupportedEncodingException; int Rockwell_keyServiceAddT_post(String userId, String noteImage, String tag, String title, String content) throws UnsupportedEncodingException;
int Rockwell_keyServiceAddT_postLike(String postId);
/* member pos api */ /* member pos api */
JSONResult Rockwell_keyServiceGetCityList(); JSONResult Rockwell_keyServiceGetCityList();
......
package cn.com.fun.nyxkey.api.service.impl; package cn.com.fun.nyxkey.api.service.impl;
...@@ -306,14 +306,11 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService { ...@@ -306,14 +306,11 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
public int Rockwell_keyServiceAddT_post(String userId, String noteImage, String tag, String title, String content) throws UnsupportedEncodingException { public int Rockwell_keyServiceAddT_post(String userId, String noteImage, String tag, String title, String content) throws UnsupportedEncodingException {
LOGGER.debug("find Rockwell_keyServiceAddT_post"); LOGGER.debug("find Rockwell_keyServiceAddT_post");
System.out.println("find Rockwell_keyServiceAddT_post"); System.out.println("find Rockwell_keyServiceAddT_post");
String endpoint = aliyunOssEndpoint; // 请填写您的 endpoint
String bucket = aliyunOssBucket; // 请填写您的 bucketname
String host = "http://" + bucket + "." + endpoint + "/"; // host的格式为 bucketname.endpoint
Rockwell_keyT_post rockwell_keyT_post = new Rockwell_keyT_post(); Rockwell_keyT_post rockwell_keyT_post = new Rockwell_keyT_post();
rockwell_keyT_post.setPostId("pid_"+UUID.randomUUID().toString()); rockwell_keyT_post.setPostId("pid_"+UUID.randomUUID().toString());
rockwell_keyT_post.setUserId(userId); rockwell_keyT_post.setUserId(userId);
rockwell_keyT_post.setTag(URLDecoder.decode(tag, "UTF-8")); rockwell_keyT_post.setTag(URLDecoder.decode(tag, "UTF-8"));
rockwell_keyT_post.setNoteImage(host+noteImage); rockwell_keyT_post.setNoteImage(noteImage);
rockwell_keyT_post.setTitle(URLDecoder.decode(title, "UTF-8")); rockwell_keyT_post.setTitle(URLDecoder.decode(title, "UTF-8"));
rockwell_keyT_post.setContent(URLDecoder.decode(content, "UTF-8")); rockwell_keyT_post.setContent(URLDecoder.decode(content, "UTF-8"));
rockwell_keyT_post.setCreateDatetime(new Date()); rockwell_keyT_post.setCreateDatetime(new Date());
...@@ -323,6 +320,18 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService { ...@@ -323,6 +320,18 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
return 0; return 0;
} }
/*
1.3 添加点赞
*/
public int Rockwell_keyServiceAddT_postLike(String postId){
LOGGER.debug("find Rockwell_keyServiceAddT_postLike");
Rockwell_keyT_post rockwell_keyT_post = new Rockwell_keyT_post();
rockwell_keyT_post.setPostId(postId);
rockwell_keyMapper.addT_postLike(rockwell_keyT_post);
return 0;
}
/* member pos api */ /* member pos api */
public JSONResult Rockwell_keyServiceGetCityList() public JSONResult Rockwell_keyServiceGetCityList()
{ {
......
package cn.com.fun.nyxkey.api.web.controller; package cn.com.fun.nyxkey.api.web.controller;
...@@ -262,10 +262,21 @@ public class NyxApiController { ...@@ -262,10 +262,21 @@ public class NyxApiController {
@RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum, @RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
@RequestParam(value = "pageCount", required = false, defaultValue = "5") int pageCount @RequestParam(value = "pageCount", required = false, defaultValue = "5") int pageCount
) { ) {
return keyService.Rockwell_keyServiceGetV_post_info(tag, title, top, pageNum, pageCount); return keyService.Rockwell_keyServiceGetV_post_info(tag, title, top, pageNum, pageCount);
} }
// 4.1 为post添加点赞 2020-05-19
@ApiOperation(value="添加点赞", notes="添加点赞")
@ApiImplicitParams({
@ApiImplicitParam(name = "postId", value = "postId", required = false, dataType = "String", defaultValue = "pid_123"),
})
@RequestMapping(value = "/nyx/post/like", method = RequestMethod.GET)
public void RockwellAddKeyPostike(
@RequestParam(value = "postId", required = false, defaultValue = "pid_123") String postId
) {
keyService.Rockwell_keyServiceAddT_postLike(postId);
}
// 5.0 member pos api // 5.0 member pos api
@ApiOperation(value="获取citylist", notes="获取citylist") @ApiOperation(value="获取citylist", notes="获取citylist")
@ApiImplicitParams({}) @ApiImplicitParams({})
......
package cn.com.fun.nyxkey.api.web.controller; package cn.com.fun.nyxkey.api.web.controller;
...@@ -68,11 +68,12 @@ public class OssApiController { ...@@ -68,11 +68,12 @@ public class OssApiController {
@RequestParam(value = "tag", required = false, defaultValue = "0") String tag, @RequestParam(value = "tag", required = false, defaultValue = "0") String tag,
@RequestParam(value = "title", required = false, defaultValue = "0") String title, @RequestParam(value = "title", required = false, defaultValue = "0") String title,
@RequestParam(value = "content", required = false, defaultValue = "0") String content, @RequestParam(value = "content", required = false, defaultValue = "0") String content,
@RequestParam(value = "category", required = false, defaultValue = "0") String category @RequestParam(value = "image", required = false, defaultValue = "0") String image,
@RequestParam(value = "userId", required = false, defaultValue = "0") String userId
) throws UnsupportedEncodingException { ) throws UnsupportedEncodingException {
System.out.println("===callback_\n"); System.out.println("===callback_\n");
System.out.println("===filename: "+filename+"&tag="+tag+"&title="+title+"&content="+content+"&category="+category); System.out.println("===filename: "+filename+"&tag="+tag+"&title="+title+"&content="+content+"&image="+image+"&userId="+userId);
keyService.Rockwell_keyServiceAddT_post("uid_123",filename, tag, title, content); keyService.Rockwell_keyServiceAddT_post(userId, image, tag, title, content);
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("Status","OK"); result.put("Status","OK");
return result; return result;
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
...@@ -261,6 +261,18 @@ limitations under the License. ...@@ -261,6 +261,18 @@ limitations under the License.
values (#{postId}, #{userId}, #{tag} , #{noteImage}, #{title}, #{content}, #{createDatetime}, #{updateDatetime}) values (#{postId}, #{userId}, #{tag} , #{noteImage}, #{title}, #{content}, #{createDatetime}, #{updateDatetime})
</insert> </insert>
<!-- key post 更新post中的num_like记录-->
<!--
UPDATE tbl_post
SET num_like=num_like+1
WHERE post_id='pid_123'
-->
<select id="addT_postLike" parameterType="cn.com.fun.nyxkey.api.domain.Rockwell_keyT_post">
UPDATE tbl_post
SET num_like=num_like+1
WHERE post_id=#{postId}
</select>
<!-- post api 4.1 从 view_post_info 获取 post信息 <!-- post api 4.1 从 view_post_info 获取 post信息
--> -->
<select id="getCityList" resultType="cn.com.fun.nyxkey.api.domain.Rockwell_keyV_area_total"> <select id="getCityList" resultType="cn.com.fun.nyxkey.api.domain.Rockwell_keyV_area_total">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论