Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
qwgame
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵国君
qwgame
Commits
98a7786c
Commit
98a7786c
authored
Apr 24, 2019
by
赵国君
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
快速开始
parent
04bd4be9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
32 deletions
+32
-32
Test.java.bak
...ava/com/qiwu/chatbotbackend/GameEnvironment/Test.java.bak
+0
-9
PlotConstructor2.java
.../com/qiwu/chatbotbackend/gameDesign/PlotConstructor2.java
+4
-6
ActionMatcher.java
...ava/com/qiwu/chatbotbackend/processing/ActionMatcher.java
+0
-0
GameDesignServlet.java
...va/com/qiwu/chatbotbackend/servlet/GameDesignServlet.java
+7
-16
GetAnswerServlet.java
...ava/com/qiwu/chatbotbackend/servlet/GetAnswerServlet.java
+21
-1
No files found.
src/main/java/com/qiwu/chatbotbackend/GameEnvironment/Test.java.bak
deleted
100644 → 0
View file @
04bd4be9
package
com
.
qiwu
.
chatbotbackend
.
GameEnvironment
;
public
class
Test
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
GameEnv
gameEnv
=
new
GameEnv
(
"7011489633"
);
//
System
.
out
.
println
(
gameEnv
.
queryNpcAttrByNpcName
(
"武士"
,
"热度"
));
System
.
out
.
println
(
gameEnv
.
queryGlobalAttr
(
"啦啦"
));
}
}
src/main/java/com/qiwu/chatbotbackend/gameDesign/PlotConstructor2.java
View file @
98a7786c
...
@@ -52,16 +52,17 @@ public class PlotConstructor2 extends ElementConstructor {
...
@@ -52,16 +52,17 @@ public class PlotConstructor2 extends ElementConstructor {
}
}
public
void
construct
(
JSONObject
jsonObject
,
UserInfo
userinfo
)
{
public
void
construct
(
JSONObject
jsonObject
,
UserInfo
userinfo
)
{
Integer
startOption
=
jsonObject
.
getInteger
(
"startOption"
);
try
{
try
{
if
(
startOption
!=
null
&&
startOption
.
equals
(
2
))
{
}
else
{
addGameStartPlot
(
jsonObject
,
keywordMap
);
addGameStartPlot
(
jsonObject
,
keywordMap
);
}
JSONArray
plots
=
jsonObject
.
getJSONArray
(
"plots"
);
JSONArray
plots
=
jsonObject
.
getJSONArray
(
"plots"
);
String
start
=
(
String
)
jsonObject
.
get
(
"start"
),
startCondition
;
String
start
=
(
String
)
jsonObject
.
get
(
"start"
),
startCondition
;
JSONObject
returnMessage
=
null
;
JSONObject
returnMessage
=
null
;
this
.
plots
=
plots
;
this
.
plots
=
plots
;
constructAdjList
(
plots
);
constructAdjList
(
plots
);
...
@@ -737,10 +738,7 @@ public class PlotConstructor2 extends ElementConstructor {
...
@@ -737,10 +738,7 @@ public class PlotConstructor2 extends ElementConstructor {
jsonStr
=
jsonStr
.
replace
(
"startId"
,
gameElements
.
getString
(
"start"
));
jsonStr
=
jsonStr
.
replace
(
"startId"
,
gameElements
.
getString
(
"start"
));
jsonStr
=
jsonStr
.
replace
(
"site_list"
,
keywordMap
.
get
(
"site_list"
).
toString
());
jsonStr
=
jsonStr
.
replace
(
"site_list"
,
keywordMap
.
get
(
"site_list"
).
toString
());
//System.out.println("JSONSTR ------------------------------\n" + jsonStr);
JSONObject
config
=
JSONObject
.
parseObject
(
jsonStr
);
JSONObject
config
=
JSONObject
.
parseObject
(
jsonStr
);
gameElements
.
getJSONArray
(
"plots"
).
addAll
(
config
.
getJSONArray
(
"gameStart"
));
gameElements
.
getJSONArray
(
"plots"
).
addAll
(
config
.
getJSONArray
(
"gameStart"
));
gameElements
.
put
(
"start"
,
"start1"
);
gameElements
.
put
(
"start"
,
"start1"
);
gameElements
.
put
(
"firstUnknownText"
,
GAME_START_HINT
);
gameElements
.
put
(
"firstUnknownText"
,
GAME_START_HINT
);
...
...
src/main/java/com/qiwu/chatbotbackend/processing/ActionMatcher.java
View file @
98a7786c
src/main/java/com/qiwu/chatbotbackend/servlet/GameDesignServlet.java
View file @
98a7786c
...
@@ -168,9 +168,6 @@ public class GameDesignServlet extends HttpServlet {
...
@@ -168,9 +168,6 @@ public class GameDesignServlet extends HttpServlet {
jsonList
.
add
(
json
);
jsonList
.
add
(
json
);
}
}
helper
.
batchInsertConfigByBotId
(
botId
,
jsonList
,
idList
,
categoryMap
.
get
(
moduleName2
));
helper
.
batchInsertConfigByBotId
(
botId
,
jsonList
,
idList
,
categoryMap
.
get
(
moduleName2
));
constructor
.
postProcessing
(
idList
,
categoryMap
.
get
(
moduleName2
));
constructor
.
postProcessing
(
idList
,
categoryMap
.
get
(
moduleName2
));
constructor
.
generateConfigText
(
idList
);
constructor
.
generateConfigText
(
idList
);
...
@@ -189,23 +186,12 @@ public class GameDesignServlet extends HttpServlet {
...
@@ -189,23 +186,12 @@ public class GameDesignServlet extends HttpServlet {
}
}
if
(
returnStatus
==
1
)
{
if
(
returnStatus
==
1
)
{
// ldt = LocalDateTime.now();
// now = ldt.format(dtf);
// timeUsedDetect.append("\n发送post请求预处理:").append(now);
StringReader
sr
=
new
StringReader
(
mergedConfigText
.
toString
());
StringReader
sr
=
new
StringReader
(
mergedConfigText
.
toString
());
BufferedReader
br
=
new
BufferedReader
(
sr
);
BufferedReader
br
=
new
BufferedReader
(
sr
);
//System.out.println(mergedConfigText.toString());
UserInfoController
.
buildUserInfo
(
br
,
userinfo
,
true
);
UserInfoController
.
buildUserInfo
(
br
,
userinfo
,
true
);
context
.
setAttribute
(
botAccount
,
userinfo
);
context
.
setAttribute
(
botAccount
,
userinfo
);
UserInfoController
.
writeConfigText
(
botAccount
,
userinfo
);
// ldt = LocalDateTime.now();
// now = ldt.format(dtf);
// timeUsedDetect.append("\n发送post请求前:").append(now);
IntervalStatus
generateResult
=
actionRegenerate
(
root
,
gameElements
,
userinfo
,
additionalKeywords
,
exceptRelation
,
POS
,
helper
);
IntervalStatus
generateResult
=
actionRegenerate
(
root
,
gameElements
,
userinfo
,
additionalKeywords
,
exceptRelation
,
POS
,
helper
);
UserInfoController
.
writeConfigText
(
botAccount
,
userinfo
);
// ldt = LocalDateTime.now();
// now = ldt.format(dtf);
// timeUsedDetect.append("\n发送post请求后:").append(now);
if
(
generateResult
.
getStatus
()
!=
1
){
if
(
generateResult
.
getStatus
()
!=
1
){
returnStatus
=
0
;
returnStatus
=
0
;
...
@@ -282,6 +268,7 @@ public class GameDesignServlet extends HttpServlet {
...
@@ -282,6 +268,7 @@ public class GameDesignServlet extends HttpServlet {
public
IntervalStatus
actionRegenerate
(
JSONObject
root
,
JSONObject
gameElements
,
UserInfo
userInfo
,
HashMap
<
String
,
HashSet
<
String
>>
additionalKeywords
,
HashSet
<
String
>
exceptRelation
,
StringBuffer
POS
,
SqlHelper
helper
){
public
IntervalStatus
actionRegenerate
(
JSONObject
root
,
JSONObject
gameElements
,
UserInfo
userInfo
,
HashMap
<
String
,
HashSet
<
String
>>
additionalKeywords
,
HashSet
<
String
>
exceptRelation
,
StringBuffer
POS
,
SqlHelper
helper
){
String
startCondition
,
POS2
=
""
,
botName
=
gameElements
.
getString
(
"botName"
);
String
startCondition
,
POS2
=
""
,
botName
=
gameElements
.
getString
(
"botName"
);
System
.
out
.
println
(
botName
);
System
.
out
.
println
(
botName
);
Integer
startOption
=
gameElements
.
getInteger
(
"startOption"
);
JSONObject
returnMessage
=
null
;
JSONObject
returnMessage
=
null
;
EngineUtils
engine
=
null
;
EngineUtils
engine
=
null
;
IntervalStatus
intervalStatus
=
new
IntervalStatus
(
1
,
""
);
IntervalStatus
intervalStatus
=
new
IntervalStatus
(
1
,
""
);
...
@@ -290,7 +277,11 @@ public class GameDesignServlet extends HttpServlet {
...
@@ -290,7 +277,11 @@ public class GameDesignServlet extends HttpServlet {
startCondition
=
(
String
)
root
.
get
(
"conditionName"
);
startCondition
=
(
String
)
root
.
get
(
"conditionName"
);
actionPostData
.
put
(
"startCondition"
,
"start_options"
);
actionPostData
.
put
(
"startCondition"
,
"start_options"
);
actionPostData
.
put
(
"welcome"
,
String
.
format
(
GAME_WELCOME_TEXT
,
gameElements
.
getString
(
"botName"
)));
if
(
startOption
!=
null
&&
startOption
.
equals
(
2
))
{
actionPostData
.
put
(
"welcome"
,
gameElements
.
getString
(
"plotStartText"
));
}
else
{
actionPostData
.
put
(
"welcome"
,
String
.
format
(
GAME_WELCOME_TEXT
,
botName
));
}
actionPostData
.
put
(
"relationKeywords"
,
additionalKeywords
);
actionPostData
.
put
(
"relationKeywords"
,
additionalKeywords
);
actionPostData
.
put
(
"botId"
,
gameElements
.
getInteger
(
"botId"
));
actionPostData
.
put
(
"botId"
,
gameElements
.
getInteger
(
"botId"
));
...
...
src/main/java/com/qiwu/chatbotbackend/servlet/GetAnswerServlet.java
View file @
98a7786c
package
com
.
qiwu
.
chatbotbackend
.
servlet
;
package
com
.
qiwu
.
chatbotbackend
.
servlet
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.qiwu.chatbotbackend.actiongenerate.DB.EngineUtils
;
import
com.qiwu.chatbotbackend.entity.Action
;
import
com.qiwu.chatbotbackend.entity.Action
;
import
com.qiwu.chatbotbackend.entity.ChatCache
;
import
com.qiwu.chatbotbackend.entity.ChatCache
;
import
com.qiwu.chatbotbackend.entity.Solution
;
import
com.qiwu.chatbotbackend.entity.Solution
;
...
@@ -17,6 +18,7 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -17,6 +18,7 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.sql.SQLException
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -44,11 +46,29 @@ public class GetAnswerServlet extends HttpServlet {
...
@@ -44,11 +46,29 @@ public class GetAnswerServlet extends HttpServlet {
if
(
tmpStr
==
null
||
tmpStr
.
equals
(
""
))
if
(
tmpStr
==
null
||
tmpStr
.
equals
(
""
))
continue
;
continue
;
tmpStr
=
tmpStr
.
replace
(
"qiwu"
,
"我"
);
tmpStr
=
tmpStr
.
replace
(
"qiwu"
,
"我"
);
//tmpStr = tmpStr.replace("qiwu", "你");
receiveParamters
.
put
(
entry
.
getKey
(),
tmpStr
);
receiveParamters
.
put
(
entry
.
getKey
(),
tmpStr
);
}
}
}
}
String
botName
=
receiveParamters
.
get
(
"bot_name"
);
String
botName
=
receiveParamters
.
get
(
"bot_name"
);
/*
EngineUtils engineDBConn = null;
try {
engineDBConn = new EngineUtils();
String nickname = engineDBConn.queryBotNickNameByName(botName);
} catch (SQLException e1) {
e1.printStackTrace();
} finally {
engineDBConn.destroy();
}
Set<Entry<String, String>> entrySet2 = receiveParamters.entrySet();
for(Entry<String, String> entry : entrySet2) {
String value = entry.getValue();
if(value.indexOf("")) {
}
}
*/
Map
<
String
,
String
>
curInfoPoint
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
curInfoPoint
=
new
HashMap
<
String
,
String
>();
Solution
bestMatch
=
null
;
Solution
bestMatch
=
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment