Quellcode durchsuchen

update: coinwatchlist加入3个资讯 url地址v1

lvzhiqiang vor 1 Jahr
Ursprung
Commit
8126848a83

+ 14 - 1
src/main/java/top/lvzhiqiang/controller/CoinController.java

@@ -260,7 +260,7 @@ public class CoinController {
      */
     @RequestMapping("/insertOrUpdateWatchlist")
     @ResponseBody
-    public R insertOrUpdateWatchlist(String symbol, String trackCategory, String issuingDate, Long cmcId, String coingeckoId, Integer filterFlag, String crudType) {
+    public R insertOrUpdateWatchlist(String symbol, String trackCategory, String issuingDate, Long cmcId, String coingeckoId, String coingeckoUrl, String feixiaohaoUrl, Integer filterFlag, String crudType) {
         if (StringUtils.isEmpty(crudType)) {
             throw new ParameterException("crudType为空!");
         }
@@ -282,6 +282,8 @@ public class CoinController {
             coinWatchlist.setIssuingDate(LocalDate.parse(issuingDate, DateUtils.dateFormatter));
             coinWatchlist.setCmcId(cmcId);
             coinWatchlist.setCoingeckoId(coingeckoId);
+            coinWatchlist.setCoingeckoUrl(coingeckoUrl);
+            coinWatchlist.setFeixiaohaoUrl(feixiaohaoUrl);
             coinWatchlist.setFilterFlag(filterFlag);
 
             coinMapper.insertOrUpdateWatchlist(coinWatchlist);
@@ -301,6 +303,17 @@ public class CoinController {
             if (null != cmcId) {
                 coinWatchlist.setCmcId(cmcId);
             }
+
+            if (StringUtils.isNotEmpty(coingeckoId)) {
+                coinWatchlist.setCoingeckoId(coingeckoId);
+            }
+            if (StringUtils.isNotEmpty(coingeckoUrl)) {
+                coinWatchlist.setCoingeckoUrl(coingeckoUrl);
+            }
+            if (StringUtils.isNotEmpty(feixiaohaoUrl)) {
+                coinWatchlist.setFeixiaohaoUrl(feixiaohaoUrl);
+            }
+
             if (null != filterFlag) {
                 coinWatchlist.setFilterFlag(filterFlag);
             }

+ 4 - 0
src/main/java/top/lvzhiqiang/entity/CoinWatchlist.java

@@ -104,6 +104,10 @@ public class CoinWatchlist implements Serializable {
      */
     private String coingeckoId;
 
+    private String coingeckoUrl;
+    private String cmcUrl;
+    private String feixiaohaoUrl;
+
     /**
      * 排序
      */

+ 3 - 3
src/main/java/top/lvzhiqiang/mapper/CoinMapper.java

@@ -101,7 +101,7 @@ public interface CoinMapper {
     @Update("update coin_watchlist set cmc_id=#{cmcId},total_market_ranking=#{totalMarketRanking},total_market_value=#{totalMarketValue}," +
             "mark_price=#{markPrice},price_change_percentage_24h=#{priceChangePercentage24h},highest_historical_price=#{highestHistoricalPrice},ath_change_percentage=#{athChangePercentage},atl_change_percentage=#{atlChangePercentage},lowest_historical_price=#{lowestHistoricalPrice}," +
             "highest_historical_date=#{highestHistoricalDate},lowest_historical_date=#{lowestHistoricalDate},increase_multiple=#{increaseMultiple}," +
-            "issuing_days=#{issuingDays},modify_time=now() where id = #{id}")
+            "issuing_days=#{issuingDays},coingecko_url=#{coingeckoUrl},cmc_url=#{cmcUrl},feixiaohao_url=#{feixiaohaoUrl},modify_time=now() where id = #{id}")
     int updateCoinWatchlist(CoinWatchlist coinWatchlist);
 
     @Update("update coin_watchlist set remark=#{remark},modify_time=now() where symbol = #{symbol}")
@@ -165,8 +165,8 @@ public interface CoinMapper {
     @MapKey("job_name")
     Map<String, JSONObject> findMonitorJobConfig();
 
-    @Insert("INSERT INTO coin_watchlist(cmc_id, symbol, track_category, issuing_date, coingecko_id, filter_flag, create_time, modify_time) " +
-            "VALUES (#{cmcId}, #{symbol}, #{trackCategory}, #{issuingDate}, #{coingeckoId}, #{filterFlag}, now(), now())" +
+    @Insert("INSERT INTO coin_watchlist(cmc_id, symbol, track_category, issuing_date, coingecko_id, coingecko_url, cmc_url, feixiaohao_url, filter_flag, create_time, modify_time) " +
+            "VALUES (#{cmcId}, #{symbol}, #{trackCategory}, #{issuingDate}, #{coingeckoId}, #{coingeckoUrl}, #{cmcUrl}, #{feixiaohaoUrl}, #{filterFlag}, now(), now())" +
             " ON DUPLICATE KEY UPDATE cmc_id=values(cmc_id),track_category=values(track_category),issuing_date=values(issuing_date),coingecko_id=values(coingecko_id),filter_flag=values(filter_flag),modify_time=now()")
     int insertOrUpdateWatchlist(CoinWatchlist coinWatchlist);
 }

+ 7 - 0
src/main/java/top/lvzhiqiang/service/impl/CoinServiceImpl.java

@@ -1012,6 +1012,13 @@ public class CoinServiceImpl implements CoinService {
                     }
                     value.setTotalMarketValue(totalMarketValue);
 
+                    // cmc_url
+                    value.setCmcUrl(jsonObject.getString("slug"));
+                    // coingecko_url
+                    if (StringUtils.isEmpty(value.getCoingeckoUrl())) {
+                        value.setCoingeckoUrl(value.getCmcUrl());
+                    }
+
                     coinMapper.updateCoinWatchlist(value);
                 }
             });

+ 9 - 5
src/main/resources/static/coin.html

@@ -386,17 +386,21 @@
             <div class="watchlist-loading"><img src='cover/loading.gif'></div>
             <span class="font">InsertOrUpdateWatchlist</span>
             <span id="insertOrUpdateWatchlistAlert" style="margin-left: 10px;font-size: 13px;"></span>
-            <form method="post" action="coin/insertOrUpdateWatchlistAlert" onsubmit="return false;" id="insertOrUpdateWatchlist">
+            <form method="post" action="coin/insertOrUpdateWatchlist" onsubmit="return false;" id="insertOrUpdateWatchlist">
                 <span>名称</span>
-                <input type="text" name="symbol" placeholder="不可为空"/>
+                <input type="text" name="symbol" placeholder="不可为空" style="width: 100px;"/>
                 <span>赛道分类</span>
                 <input type="text" name="trackCategory" placeholder="可为空"/>
                 <span>发行日期</span>
-                <input type="text" name="issuingDate" placeholder="可为空"/>
+                <input type="text" name="issuingDate" placeholder="可为空" style="width: 100px;"/>
                 <span>cmcId</span>
-                <input type="text" name="cmcId" placeholder="可为空"/>
+                <input type="text" name="cmcId" placeholder="可为空" style="width: 100px;"/>
                 <span>coingeckoId</span>
-                <input type="text" name="coingeckoId" placeholder="可为空"/>
+                <input type="text" name="coingeckoId" placeholder="可为空" style="width: 100px;"/>
+                <span>coingeckoUrl</span>
+                <input type="text" name="coingeckoUrl" placeholder="可为空" style="width: 100px;"/>
+                <span>feixiaohaoUrl</span>
+                <input type="text" name="feixiaohaoUrl" placeholder="可为空" style="width: 100px;"/>
                 <span>filterFlag</span>
                 <select id="apis-quiet-div-watchlist-filterFlagField" style="height: 24px;" name="filterFlag">
                     <option value="2">已过滤</option>

+ 7 - 7
src/main/resources/static/js/my-av.js

@@ -28,10 +28,10 @@ function savIDMouseEnter(e, nameEn) {
 }
 
 // 鼠标离开番号
-function savIDMouseLeave(e) {
+function savIDMouseLeave(e, nameEn) {
     timerMouseLeave = setTimeout(function () {
         avInfo = {};
-        savMenuMouseLeave();
+        savMenuMouseLeave($(e), nameEn);
         removeLoading();
     }, 50)
 }
@@ -156,8 +156,8 @@ function getInfo(e, nameEn) {
                         otherInfo = document.createElement('avdivsInfo');
                     }
 
-                    otherInfo.style.overflow = "auto";
-                    otherInfo.style.maxHeight = "550px";
+                    //otherInfo.style.overflow = "auto";
+                    //otherInfo.style.maxHeight = "550px";
                     otherInfo.style.textIndent = "0em";
                     otherInfo.innerHTML = data.data.remark;
 
@@ -193,8 +193,8 @@ function createPattenr(e, nameEn) {
         aPattern += "<avdiv class='savlink'><a href='" + $(e).attr('href') + "' target='_blank' referrerpolicy='same-origin'>CoinMarketCap</a></avdiv>";
         aPattern += "<avdiv class='savlink'><a href='" + $(e).attr('href') + "' target='_blank' referrerpolicy='same-origin'>CoinGecko</a></avdiv>";
 
-        // odiv.style.overflow = "auto";
-        // odiv.style.maxHeight = "550px";
+        odiv.style.overflow = "auto";
+        odiv.style.maxHeight = "550px";
     }
 
     aPattern += "</avdivbutton>";
@@ -380,7 +380,7 @@ function settingPostion(image) {
 }
 
 // 鼠标离开菜单
-function savMenuMouseLeave(e) {
+function savMenuMouseLeave(e, nameEn) {
     timerMouseLeaveMenu = setTimeout(function () {
         var odiv = document.querySelector(".sav-menu");
         if (odiv) {

+ 10 - 8
src/main/resources/static/js/my-coin.js

@@ -572,14 +572,16 @@ function initContentEvent(nameEn) {
         });
     }
 
-    // 鼠标滑过 开启菜单
-    $(".primary").mouseenter(function () {
-        savIDMouseEnter($(this), nameEn);
-    });
-    // 鼠标离开 关闭菜单
-    $(".primary").mouseleave(function () {
-        savIDMouseLeave($(this), nameEn);
-    });
+    if (nameEn === 'orderHistoryProductType' || nameEn === 'traderList' || nameEn === 'watchlist' || nameEn === 'image' || nameEn === 'cmcmap') {
+        // 鼠标滑过 开启菜单
+        $(".primary").mouseenter(function () {
+            savIDMouseEnter($(this), nameEn);
+        });
+        // 鼠标离开 关闭菜单
+        $(".primary").mouseleave(function () {
+            savIDMouseLeave($(this), nameEn);
+        });
+    }
 }
 
 function uploadImgsSubmit(){