Commit 83a04ac2 83a04ac2e0ef3ebd9a8daf8a3a041311979041a5 by 文鑫

调整请求方式

1 parent 68a0764c
......@@ -64,10 +64,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<mainClass>com.topdraw.dockingapi.DockingApiApplication</mainClass>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>repackage</id>
......
......@@ -7,7 +7,8 @@ import com.digital.szzz.gateway.sdk.bean.GatewayResponse;
import com.topdraw.dockingapi.config.EnvConfiguration;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -51,8 +52,9 @@ public class ApiController {
* 获取jsToken
* @return token信息
*/
@GetMapping("/js/token")
@PostMapping("/js/token")
public GatewayResponse getJsApiToken() {
String authCode = "";
String method = "ykb.app.jsapi.getToken";
JSONObject param = new JSONObject();
param.put("appId", appId);
......@@ -62,14 +64,15 @@ public class ApiController {
/**
* 获取authCode
* @param userId 用户id
* @param data 用户id
* @return authCode信息
*/
@GetMapping("/auth/code")
public GatewayResponse getAuthCodeByUserId(String userId) {
@PostMapping("/auth/code")
public GatewayResponse getAuthCodeByUserId(@RequestBody JSONObject data) {
String method = "app.ykb.uc.oauth.get";
JSONObject param = new JSONObject();
param.put("appId", appId);
String userId = data.getString("userId");
param.put("userId", userId);
param.put("forceScopes", new JSONArray().fluentAdd("ykb_user_info").fluentAdd("ykb_divide"));
Map<String, String> headerMap = new HashMap<>();
......@@ -78,14 +81,14 @@ public class ApiController {
/**
* 获取用户脱敏信息
* @param authCode 认证code
* @param data 认证code
* @return 用户信息
*/
@GetMapping("/user/info")
public GatewayResponse getUserInfoByAuthCode(String authCode) {
@PostMapping("/user/info")
public GatewayResponse getUserInfoByAuthCode(@RequestBody JSONObject data) {
String method = "app.ykb.uc.oauth.userInfo";
JSONObject param = new JSONObject();
param.put("authCode", authCode);
param.put("authCode", data.getString("authCode"));
Map<String, String> headerMap = new HashMap<>();
return GatewaySender.send(url, appId, method, iv, appKey, appSecretKey, param, authCode, headerMap, readTimeout, connTimeout);
}
......
#!/usr/bin/env bash
pid= #进程pid
# 启动jar包的名字
packageName=docking-api-0.0.1-SNAPSHOT.jar
counter=0
max_attempts=10
#检测pid
function getPid()
{
echo "检测状态---------------------------------------------"
pid=$(ps -ef | grep -n ${packageName} | grep -v grep | awk '{print $2}')
if [ -n "${pid}" ]
then
echo "运行pid:${pid}"
else
echo "未运行"
fi
}
#停止程序
function stop()
{
getPid
if [ -n "${pid}" ]
then
echo "停止程序---------------------------------------------"
kill -15 ${pid}
while [ $counter -lt $max_attempts ]; do
getPid
if [ ${pid} ]
then
#stop
sleep 1
else
echo "停止成功,尝试${counter}次"
break
fi
((counter++))
done
getPid
if [ ${pid} ]
then
#stop
echo "停止失败"
else
echo "停止完成"
fi
fi
}
#启动程序
function start()
{
#启动前,先停止之前的
stop
if [ -n "${pid}" ]
then
echo "停止程序失败,无法启动"
else
echo "启动程序---------------------------------------------"
# 删除out输出文件
rm -rf ./console.out
nohup java -Xms500m -Xmx800m -jar ./$packageName --spring.profiles.active=prod >./console.out 2>&1 &
#查询是否有启动进程
getPid
if [ ${pid} ]
then
echo "已启动"
#nohup日志
tail -n 50 -f ./console.out
else
echo "启动失败"
fi
fi
}
#启动时带参数,根据参数执行
if [ ${#} -ge 1 ]
then
case ${1} in
"start")
start
;;
"restart")
start
;;
"stop")
stop
;;
*)
echo "${1}无任何操作"
;;
esac
else
echo "
command如下命令:
start:启动
stop:停止进程
restart:重启
示例命令如:./publish start
"
fi
<html>
<html lang="zh" xmlns="">
<body>
<h1>hello word!!!</h1>
<p>this is a html page</p>
<div >
test
<div>
test
<table>
<li>1</li>
</table>
</div>
</div>
</body>
</html>
\ No newline at end of file
......