Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
nyx
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
发现
nyx
Commits
d1ce2bf1
Commit
d1ce2bf1
authored
May 13, 2020
by
jscat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nyx: oss上传功能
更新: 在回调函数中新增addT_post的功能,新增一条信息发布
parent
36d84cb5
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
61 行增加
和
23 行删除
+61
-23
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/config/DatabaseType.java
+1
-16
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/repository/Rockwell_keyMapper.java
+2
-1
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/Rockwell_keyService.java
+8
-1
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/impl/Rockwell_keyServiceImpl.java
+35
-1
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/web/controller/OssApiController.java
+9
-3
增值产品-小程序及app/nyx_app_key/api/src/main/resources/cn/com/fun/nyxkey/api/repository/Rockwell_keyMapper.xml
+6
-1
没有找到文件。
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/config/DatabaseType.java
查看文件 @
d1ce2bf1
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
config
;
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
config
;
package
cn
.
com
.
fun
.
nyxkey
.
api
.
config
;
import
java.io.Serializable
;
import
java.lang.reflect.AccessibleObject
;
import
java.lang.reflect.Array
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.checkerframework.checker.units.qual.C
;
import
org.springframework.context.annotation.Configuration
;
import
sun.reflect.ConstructorAccessor
;
import
sun.reflect.FieldAccessor
;
import
sun.reflect.ReflectionFactory
;
public
enum
DatabaseType
{
}
\ No newline at end of file
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/repository/Rockwell_keyMapper.java
查看文件 @
d1ce2bf1
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
repository
;
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
repository
;
...
...
@@ -36,6 +36,7 @@ public interface Rockwell_keyMapper {
/* post api */
List
<
Rockwell_keyV_post_info
>
getV_post_info
(
Rockwell_keyT_postQuery
rockwell_keyT_postQuery
);
void
addT_post
(
Rockwell_keyT_post
rockwell_keyT_post
);
/* area api */
List
<
Rockwell_keyV_area_total
>
getCityList
();
...
...
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/Rockwell_keyService.java
查看文件 @
d1ce2bf1
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
service
;
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
service
;
...
...
@@ -6,6 +6,7 @@ import cn.com.fun.nyxkey.api.domain.*;
import
cn.com.fun.nyxkey.api.domain.query.*
;
import
org.joda.time.DateTime
;
import
java.io.UnsupportedEncodingException
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -14,6 +15,7 @@ import java.util.List;
*/
public
interface
Rockwell_keyService
{
// t_quiz相关的函数
JSONResult
Rockwell_keyServiceGetT_quizWithPage
(
String
strQuestionName
,
int
pageNum
,
int
pageCount
);
JSONResult
Rockwell_keyServiceGetT_quizRand
();
JSONResult
Rockwell_keyServiceGetT_matchLike
();
...
...
@@ -42,6 +44,11 @@ public interface Rockwell_keyService {
/* post api */
JSONResult
Rockwell_keyServiceGetV_post_info
(
String
tag
,
String
title
,
String
top
,
int
pageNum
,
int
pageCount
);
/* todo 添加新增pos功能
* 数据流 小程序客户端 -> 阿里云oss -> callback回应用服务器 -> AddT_post
* */
int
Rockwell_keyServiceAddT_post
(
String
userId
,
String
noteImage
,
String
tag
,
String
title
,
String
content
)
throws
UnsupportedEncodingException
;
/* member pos api */
JSONResult
Rockwell_keyServiceGetCityList
();
...
...
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/impl/Rockwell_keyServiceImpl.java
查看文件 @
d1ce2bf1
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
service
.
impl
;
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
service
.
impl
;
...
...
@@ -9,15 +9,19 @@ import cn.com.fun.nyxkey.api.domain.query.*;
import
org.apache.commons.lang3.StringUtils
;
import
org.checkerframework.checker.units.qual.K
;
import
org.joda.time.DateTime
;
import
org.mortbay.util.UrlEncoded
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.sql.DataSource
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -33,6 +37,12 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
@Autowired
private
Rockwell_keyMapper
rockwell_keyMapper
;
@Value
(
"${aliyun.oss.endpoint}"
)
private
String
aliyunOssEndpoint
;
@Value
(
"${aliyun.oss.bucket}"
)
private
String
aliyunOssBucket
;
/*
接口api: main use 题目热搜
*/
...
...
@@ -289,6 +299,30 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
return
jsonResult
;
}
// 新增post
/*
post_id, user_id, tag, note_image, title, content, create_datetime, update_datetime
*/
public
int
Rockwell_keyServiceAddT_post
(
String
userId
,
String
noteImage
,
String
tag
,
String
title
,
String
content
)
throws
UnsupportedEncodingException
{
LOGGER
.
debug
(
"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
.
setPostId
(
"pid_"
+
UUID
.
randomUUID
().
toString
());
rockwell_keyT_post
.
setUserId
(
userId
);
rockwell_keyT_post
.
setTag
(
URLDecoder
.
decode
(
tag
,
"UTF-8"
));
rockwell_keyT_post
.
setNoteImage
(
host
+
noteImage
);
rockwell_keyT_post
.
setTitle
(
URLDecoder
.
decode
(
title
,
"UTF-8"
));
rockwell_keyT_post
.
setContent
(
URLDecoder
.
decode
(
content
,
"UTF-8"
));
rockwell_keyT_post
.
setCreateDatetime
(
new
Date
());
rockwell_keyT_post
.
setUpdateDatetime
(
new
Date
());
System
.
out
.
println
(
rockwell_keyT_post
);
rockwell_keyMapper
.
addT_post
(
rockwell_keyT_post
);
return
0
;
}
/* member pos api */
public
JSONResult
Rockwell_keyServiceGetCityList
()
{
...
...
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/web/controller/OssApiController.java
查看文件 @
d1ce2bf1
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
web
.
controller
;
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
web
.
controller
;
...
...
@@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.io.UnsupportedEncodingException
;
/**
* Created by jscat on 2020-04-21.
*
...
...
@@ -33,6 +35,9 @@ public class OssApiController {
@Autowired
private
Rockwell_ossService
ossService
;
@Autowired
private
Rockwell_keyService
keyService
;
// 3.0 oss getToken api
@ApiOperation
(
value
=
"获取阿里云oss token"
,
notes
=
"获取阿里云oss token"
)
@ApiImplicitParams
({
...
...
@@ -55,7 +60,7 @@ public class OssApiController {
// 前端请求传Json对象的字符串则后端使用@RequestBody。
@RequestMapping
(
value
=
"/nyx/oss/callback"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
JSONObject
callback
(
public
JSONObject
callback
(
@RequestParam
(
value
=
"filename"
,
required
=
false
,
defaultValue
=
"0"
)
String
filename
,
@RequestParam
(
value
=
"size"
,
required
=
false
,
defaultValue
=
"0"
)
String
size
,
@RequestParam
(
value
=
"height"
,
required
=
false
,
defaultValue
=
"0"
)
String
height
,
...
...
@@ -64,9 +69,10 @@ public class OssApiController {
@RequestParam
(
value
=
"title"
,
required
=
false
,
defaultValue
=
"0"
)
String
title
,
@RequestParam
(
value
=
"content"
,
required
=
false
,
defaultValue
=
"0"
)
String
content
,
@RequestParam
(
value
=
"category"
,
required
=
false
,
defaultValue
=
"0"
)
String
category
){
)
throws
UnsupportedEncodingException
{
System
.
out
.
println
(
"===callback_\n"
);
System
.
out
.
println
(
"===filename: "
+
filename
+
"&tag="
+
tag
+
"&title="
+
title
+
"&content="
+
content
+
"&category="
+
category
);
keyService
.
Rockwell_keyServiceAddT_post
(
"uid_123"
,
filename
,
tag
,
title
,
content
);
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"Status"
,
"OK"
);
return
result
;
...
...
增值产品-小程序及app/nyx_app_key/api/src/main/resources/cn/com/fun/nyxkey/api/repository/Rockwell_keyMapper.xml
查看文件 @
d1ce2bf1
<?xml
version="1.0" encoding="UTF-8"?>
<?xml
version="1.0" encoding="UTF-8"?>
...
...
@@ -255,6 +255,11 @@ limitations under the License.
</if>
</select>
<!-- 添加一条post信息 -->
<insert
id=
"addT_post"
parameterType=
"cn.com.fun.nyxkey.api.domain.Rockwell_keyT_post"
>
insert into tbl_post(post_id, user_id, tag, note_image, title, content, create_datetime, update_datetime)
values (#{postId}, #{userId}, #{tag} , #{noteImage}, #{title}, #{content}, #{createDatetime}, #{updateDatetime})
</insert>
<!-- post api 4.1 从 view_post_info 获取 post信息
-->
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论