-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from shortintern2020-A-labyrinth/feature/thyme…
…leaf_request Feature/thymeleaf request
- Loading branch information
Showing
10 changed files
with
277 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,16 @@ insert into users(name, mail, filterlevel) values | |
('pinapple.chocomint', '[email protected]', 3) | ||
; | ||
|
||
insert into emolog(userid, friendid, name, latestemolog) | ||
values (1, 2, 'hoge', 'emojihoge') | ||
insert into friend(userid, friendid, name, latestemolog) values | ||
(1, 2, 'hoge', 'emojihoge'), | ||
(2, 1, 'Trump', ':smile:'), | ||
(1, 3, 'kim jyoung-un', ':sad:') | ||
; | ||
|
||
insert into emolog(userid, friendid, create_at, contents) values | ||
(1, 2, current_timestamp, ':mountain:'), | ||
(2, 1, current_timestamp, ':hotel:'), | ||
(1, 3, current_timestamp, ':gorilla:'), | ||
(3, 1, current_timestamp, ':space:') | ||
; | ||
|
74 changes: 74 additions & 0 deletions
74
src/main/java/com/example/demo/controller/HtmlController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package com.example.demo.controller; | ||
|
||
import com.vdurmont.emoji.EmojiManager; | ||
import org.springframework.ui.ModelMap; | ||
import com.vdurmont.emoji.EmojiParser; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import twitter4j.TwitterException; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
|
||
@Controller | ||
@RequestMapping(path = "/") | ||
public class HtmlController { | ||
@RequestMapping(path = "/", method = RequestMethod.GET) | ||
public String index() { | ||
return "index"; | ||
} | ||
|
||
@RequestMapping(path = "/enter", method = RequestMethod.GET) | ||
public String crawling( | ||
ModelMap modelMap | ||
) throws Exception { | ||
|
||
List<String> keyword_tweets = new ArrayList<String>(); | ||
List<String> keyword_images = new ArrayList<String>(); | ||
|
||
keyword_tweets = ViewController.get_NLU_keywords("CNN", 100000); | ||
keyword_images = ViewController.get_image_keywords("CNN", 100000); | ||
|
||
List<String> emojiList = new ArrayList<String>(); | ||
|
||
// TODO: ここでDBアクセスかなんかlook upする??。->つかささんのやつくっつける。 | ||
|
||
// 文字列整形の方(テキトーに::をつける方) | ||
for( String keyword : keyword_tweets){ | ||
try{ | ||
String tmp = EmojiParser.parseToHtmlDecimal(":" + keyword + ":"); | ||
emojiList.add(tmp); | ||
} | ||
catch (NullPointerException ignored){} | ||
} | ||
|
||
for( String keyword : keyword_images){ | ||
try{ | ||
String tmp = EmojiParser.parseToHtmlDecimal(":" + keyword + ":"); | ||
emojiList.add(tmp); | ||
} | ||
catch (NullPointerException ignored){} | ||
} | ||
|
||
// で、:hoge:みたいなんが得られたらEmologにパースして、それをaddAttributeする.->データがdbに入っていないとThymeleaf側で取り出せん模様。 | ||
// modelMap.addAttribute("emologs", emojiList); | ||
|
||
|
||
// emojiList : ["😃", "😃", "😃"] みたいな感じ。 | ||
// emojiListから一つの文字列に直す。 | ||
String emolog = String.join("", emojiList); | ||
|
||
|
||
//TODO: ここで得られたemologをdbに登録する処理… | ||
// emolog(userid, friendid, create_at, contents) | ||
// userid = 1, friendid = 2, create_at = TIMESTAMP??, contents = emolog | ||
|
||
|
||
|
||
|
||
|
||
return "friendlist"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.