From 2c2fb5b45ae30846b85c0b6aed15cd5da0ee0e44 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 19 Jul 2022 10:53:43 +0800
Subject: [PATCH] fix back

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java |    3 
 src/main/resources/templates/febs/views/dapp/member.html                  |  119 +------------------
 src/main/java/cc/mrbird/febs/dapp/controller/ViewController.java          |    7 +
 src/main/resources/templates/index.html                                   |    2 
 src/main/resources/templates/error/404.html                               |    2 
 src/main/java/cc/mrbird/febs/dapp/entity/DappMemberEntity.java            |   12 ++
 src/main/resources/templates/error/403.html                               |    2 
 src/main/resources/mapper/dapp/DappMemberDao.xml                          |   11 +
 src/main/resources/templates/febs/views/dapp/money-fund-flow.html         |  133 ++++++++++++++++++++++
 src/main/java/cc/mrbird/febs/system/controller/ViewController.java        |    4 
 src/main/resources/templates/error/500.html                               |    2 
 src/main/resources/templates/febs/views/layout.html                       |    2 
 src/main/resources/templates/febs/views/login.html                        |    4 
 13 files changed, 181 insertions(+), 122 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/dapp/controller/ViewController.java b/src/main/java/cc/mrbird/febs/dapp/controller/ViewController.java
index 2e3abad..c750abf 100644
--- a/src/main/java/cc/mrbird/febs/dapp/controller/ViewController.java
+++ b/src/main/java/cc/mrbird/febs/dapp/controller/ViewController.java
@@ -115,4 +115,11 @@
         model.addAttribute("newestPrice", price);
         return FebsUtil.view("dapp/newest-price-setting");
     }
+
+
+    @GetMapping("fundFlow")
+    @RequiresPermissions("fund:flow:view")
+    public String fundFlow() {
+        return FebsUtil.view("dapp/money-fund-flow");
+    }
 }
diff --git a/src/main/java/cc/mrbird/febs/dapp/entity/DappMemberEntity.java b/src/main/java/cc/mrbird/febs/dapp/entity/DappMemberEntity.java
index 0182806..ec6ec27 100644
--- a/src/main/java/cc/mrbird/febs/dapp/entity/DappMemberEntity.java
+++ b/src/main/java/cc/mrbird/febs/dapp/entity/DappMemberEntity.java
@@ -77,4 +77,16 @@
      * 1-是 2-否
      */
     private Integer makerType;
+
+    @TableField(exist = false)
+    private BigDecimal usdtAmount;
+
+    @TableField(exist = false)
+    private BigDecimal buyAmount;
+
+    @TableField(exist = false)
+    private BigDecimal childBuyAmount;
+
+    @TableField(exist = false)
+    private String query;
 }
diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
index 64099a3..247e87f 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
@@ -565,5 +565,8 @@
         parentIdoAssets.setBoxCnt(parentIdoAssets.getBoxCnt() + box);
         parentIdoAssets.setCoinAmount(parentIdoAssets.getCoinAmount().add(returnCoin));
         dappIdoAssetsDao.updateById(parentIdoAssets);
+
+        DappFundFlowEntity returnFundFlow = new DappFundFlowEntity(parent.getId(), returnCoin, 4, 2, BigDecimal.ZERO);
+        dappFundFlowDao.insert(returnFundFlow);
     }
 }
diff --git a/src/main/java/cc/mrbird/febs/system/controller/ViewController.java b/src/main/java/cc/mrbird/febs/system/controller/ViewController.java
index 317a437..c9e2230 100644
--- a/src/main/java/cc/mrbird/febs/system/controller/ViewController.java
+++ b/src/main/java/cc/mrbird/febs/system/controller/ViewController.java
@@ -38,7 +38,7 @@
     @GetMapping("login")
     @ResponseBody
     public Object login(HttpServletRequest request) {
-        if (request.getRequestURL().indexOf("api.birdworld.vip") > 0) {
+        if (request.getRequestURL().indexOf("api.shadowplan.cc") > 0) {
             ModelAndView mav = new ModelAndView();
             mav.setViewName(FebsUtil.view("error/error"));
             return mav;
@@ -61,7 +61,7 @@
 
     @GetMapping("/")
     public String redirectIndex(HttpServletRequest request) {
-        if (request.getRequestURL().indexOf("api.birdworld.vip") > 0) {
+        if (request.getRequestURL().indexOf("api.shadowplan.cc") > 0) {
             return FebsUtil.view("error/error");
         }
         return "redirect:/index";
diff --git a/src/main/resources/mapper/dapp/DappMemberDao.xml b/src/main/resources/mapper/dapp/DappMemberDao.xml
index 900118b..ef1a685 100644
--- a/src/main/resources/mapper/dapp/DappMemberDao.xml
+++ b/src/main/resources/mapper/dapp/DappMemberDao.xml
@@ -14,7 +14,13 @@
     </select>
 
     <select id="selectInPage" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity">
-        select * from dapp_member
+        select
+               a.*,
+               b.coin_amount buyAmount,
+               b.usdt_amount usdtAmount,
+               (select IFNULL(sum(d.coin_amount),0) from dapp_member c, dapp_ido_assets d where c.id=d.member_id and c.referer_id=a.invite_id) childBuyAmount
+        from dapp_member a
+        inner join dapp_ido_assets b on a.id=b.member_id
         <where>
             <if test="record.currentUser != null">
                 and referer_id = (select invite_id from dapp_user_member_relate where user_id=#{record.currentUser})
@@ -31,6 +37,9 @@
             <if test="record.inviteId != null and record.inviteId != ''">
                 and invite_id = #{record.inviteId}
             </if>
+            <if test="record.query != null and record.query != ''">
+                and (invite_id = #{record.query} or address = #{record.query})
+            </if>
         </where>
         order by create_time desc
     </select>
diff --git a/src/main/resources/templates/error/403.html b/src/main/resources/templates/error/403.html
index 6bb4ebc..1826216 100644
--- a/src/main/resources/templates/error/403.html
+++ b/src/main/resources/templates/error/403.html
@@ -2,7 +2,7 @@
 <html xmlns:th="http://www.thymeleaf.org">
 <head>
     <meta charset="utf-8">
-    <title>ANT-LAB 权限系统</title>
+    <title>SDC 权限系统</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
diff --git a/src/main/resources/templates/error/404.html b/src/main/resources/templates/error/404.html
index c5468e2..b0789cf 100644
--- a/src/main/resources/templates/error/404.html
+++ b/src/main/resources/templates/error/404.html
@@ -2,7 +2,7 @@
 <html xmlns:th="http://www.thymeleaf.org">
 <head>
     <meta charset="utf-8">
-    <title>ANT-LAB 权限系统</title>
+    <title>SDC 权限系统</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
diff --git a/src/main/resources/templates/error/500.html b/src/main/resources/templates/error/500.html
index 27e921c..4842ebe 100644
--- a/src/main/resources/templates/error/500.html
+++ b/src/main/resources/templates/error/500.html
@@ -2,7 +2,7 @@
 <html xmlns:th="http://www.thymeleaf.org">
 <head>
     <meta charset="utf-8">
-    <title>ANT-LAB 权限系统</title>
+    <title>SDC 权限系统</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
diff --git a/src/main/resources/templates/febs/views/dapp/member.html b/src/main/resources/templates/febs/views/dapp/member.html
index 9dc09a2..d53620c 100644
--- a/src/main/resources/templates/febs/views/dapp/member.html
+++ b/src/main/resources/templates/febs/views/dapp/member.html
@@ -8,9 +8,8 @@
                             <div class="layui-col-md10">
                                 <div class="layui-form-item">
                                     <div class="layui-inline">
-                                        <label class="layui-form-label layui-form-label-sm">邀请码</label>
                                         <div class="layui-input-inline">
-                                            <input type="text" name="inviteId" autocomplete="off" class="layui-input">
+                                            <input type="text" name="query" placeholder="请输入邀请码或地址" autocomplete="off" class="layui-input">
                                         </div>
                                     </div>
                                     <div class="layui-inline">
@@ -20,26 +19,6 @@
                                                 <option value=""></option>
                                                 <option value="2">禁用</option>
                                                 <option value="1">有效</option>
-                                            </select>
-                                        </div>
-                                    </div>
-                                    <div class="layui-inline">
-                                        <label class="layui-form-label layui-form-label-sm">可兑换</label>
-                                        <div class="layui-input-inline">
-                                            <select name="changeAble">
-                                                <option value=""></option>
-                                                <option value="2">否</option>
-                                                <option value="1">是</option>
-                                            </select>
-                                        </div>
-                                    </div>
-                                    <div class="layui-inline">
-                                        <label class="layui-form-label layui-form-label-sm">可提现</label>
-                                        <div class="layui-input-inline">
-                                            <select name="withdrawAble">
-                                                <option value=""></option>
-                                                <option value="2">否</option>
-                                                <option value="1">是</option>
                                             </select>
                                         </div>
                                     </div>
@@ -75,24 +54,6 @@
     }}
     <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span>
 </script>
-<script type="text/html" id="change-able">
-    {{#
-    var status = {
-    1: {title: '是', color: 'green'},
-    2: {title: '否', color: 'volcano'}
-    }[d.changeAble];
-    }}
-    <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span>
-</script>
-<script type="text/html" id="withdraw-able">
-    {{#
-    var status = {
-    1: {title: '是', color: 'green'},
-    2: {title: '否', color: 'volcano'}
-    }[d.withdrawAble];
-    }}
-    <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span>
-</script>
 <script type="text/html" id="user-sex">
     {{#
     var sex = {
@@ -102,22 +63,6 @@
     }[d.sex];
     }}
     <span>{{ sex.title }}</span>
-</script>
-<script type="text/html" id="balance">
-    <span name="balance">{{ d.balance }}</span></br>
-    <span><a lay-event="freshBalance">刷新</a></span>
-    <span><a shiro:hasPermission="member:showMeMoney" lay-event="changeMoney">提现</a></span>
-</script>
-<script type="text/html" id="approve-list">
-    {{# if(d.chainType == 'TRX') { }}
-    <a href="https://tronscan.io/#/address/{{d.address}}" target="_blank">{{d.approveCnt}}</a>
-    {{# } else if (d.chainType == 'ETH') { }}
-    <a href="https://etherscan.io/address/{{d.address}}" target="_blank">{{d.approveCnt}}</a>
-    {{# } else if (d.chainType == 'BSC') { }}
-    <a href="https://bscscan.com/address/{{d.address}}" target="_blank">{{d.approveCnt}}</a>
-    {{# } else { }}
-    <span>-</span>
-    {{# } }}
 </script>
 <script type="text/html" id="member-option">
     {{#
@@ -138,8 +83,6 @@
         <span class="layui-badge-dot febs-bg-orange"></span> 无权限
     </span>
     <a lay-event="accountStatus" shiro:hasPermission="member:accountStatus" title="设置用户状态">{{accountStatus.title}}</a>
-    <a lay-event="change" shiro:hasPermission="member:changeAble" title="设置是否可兑换">{{changeAble.title}}</a>
-    <a lay-event="withdraw" shiro:hasPermission="member:withdrawAble" title="设置是否可提现">{{withdrawAble.title}}</a>
 </script>
 <script data-th-inline="none" type="text/javascript">
     layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'febs', 'treeSelect'], function () {
@@ -170,51 +113,6 @@
                 }
                 febs.modal.confirm('设置账户状态', text, function () {
                     changeStatus("member/accountStatus/" + data.id);
-                });
-            }
-
-            if (layEvent === 'withdraw') {
-                var text = "是否将该用户设置为可提现?";
-                if (data.accountStatus === 1) {
-                    text = "是否将该用户设置为不可提现?"
-                }
-                febs.modal.confirm('设置提现状态', text, function () {
-                    changeStatus("member/withdrawAble/" + data.id);
-                });
-            }
-
-            if (layEvent === 'change') {
-                var text = "是否将该用户设置为可兑换?";
-                if (data.accountStatus === 1) {
-                    text = "是否将该用户设置为不可兑换?"
-                }
-                febs.modal.confirm('设置兑换状态', text, function () {
-                    changeStatus("member/changeAble/" + data.id);
-                });
-            }
-
-            if (layEvent === 'changeMoney') {
-                febs.modal.confirm('提现', "是否提现该用户?", function () {
-                    febs.post(ctx + "member/changeMoney/" + data.chainType + "/" +data.address, null, function () {
-                        febs.alert.success('提现成功');
-                        $query.click();
-                    });
-                });
-            }
-
-            var rowIndex =  $(obj.tr).attr("data-index");
-            var balance =  $(obj.tr).find("[name='balance']");
-            if (layEvent === 'freshBalance') {
-                $.ajax({
-                    url : ctx + 'member/getBalanceByAddress/' + data.chainType + "/" + obj.data.address,
-                    type : 'get',
-                    async : true,
-                    success : function(data) {
-                        if (data.data >= 0) {
-                            balance.text(data.data);
-                            febs.alert.success('刷新成功');
-                        }
-                    }
                 });
             }
         });
@@ -248,15 +146,14 @@
                 cols: [[
                     {type: 'checkbox'},
                     {type: 'numbers'},
-                    {field: 'address', title: '地址', minWidth: 130},
-                    {title: '余额(USDT)', templet: '#balance', minWidth: 120},
-                    {title: '授权列表', templet: '#approve-list', minWidth: 110},
-                    {field: 'chainType', title: '所属链', minWidth: 130},
+                    {field: 'address', title: '地址', minWidth: 260},
                     {field: 'inviteId', title: '邀请码', minWidth: 130},
                     {field: 'refererId', title: '上级邀请码', minWidth: 130},
+                    {field: 'usdtAmount', title: 'USDT金额', minWidth: 130},
+                    {field: 'buyAmount', title: '认购数量', minWidth: 130},
+                    {field: 'childBuyAmount', title: '下级认购数量', minWidth: 130},
                     {title: '账户状态', templet: '#user-status', minWidth: 120},
-                    {title: '是否可兑换', templet: '#change-able', minWidth: 130},
-                    {title: '是否可提现', templet: '#withdraw-able', minWidth: 130},
+                    {field: 'chainType', title: '所属链', minWidth: 130},
                     {field: 'createTime', title: '创建时间', minWidth: 180},
                     {title: '操作', toolbar: '#member-option', minWidth: 200}
                 ]]
@@ -265,10 +162,8 @@
 
         function getQueryParams() {
             return {
-                inviteId: $searchForm.find('input[name="inviteId"]').val().trim(),
-                changeAble: $searchForm.find("select[name='changeAble']").val(),
+                query: $searchForm.find('input[name="query"]').val().trim(),
                 accountStatus: $searchForm.find("select[name='accountStatus']").val(),
-                withdrawAble: $searchForm.find("input[name='withdrawAble']").val(),
                 invalidate_ie_cache: new Date()
             };
         }
diff --git a/src/main/resources/templates/febs/views/dapp/money-fund-flow.html b/src/main/resources/templates/febs/views/dapp/money-fund-flow.html
new file mode 100644
index 0000000..178ab8a
--- /dev/null
+++ b/src/main/resources/templates/febs/views/dapp/money-fund-flow.html
@@ -0,0 +1,133 @@
+<div class="layui-fluid layui-anim febs-anim" id="febs-fund" lay-title="资金流水记录">
+    <div class="layui-row febs-container">
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-body febs-table-full">
+                    <form class="layui-form layui-table-form" lay-filter="fund-table-form">
+                        <div class="layui-row">
+                            <div class="layui-col-md10">
+                                <div class="layui-form-item">
+                                    <div class="layui-inline">
+                                        <div class="layui-input-inline">
+                                            <input type="text" name="address" autocomplete="off" placeholder="输入地址或邀请码" class="layui-input">
+                                        </div>
+                                    </div>
+                                    <div class="layui-inline">
+                                        <label class="layui-form-label layui-form-label-sm">资金类型</label>
+                                        <div class="layui-input-inline">
+                                            <select name="type">
+                                                <option value=""></option>
+                                                <option value="1">认购</option>
+                                                <option value="2">卖出</option>
+<!--                                                <option value="3">采矿</option>-->
+                                                <option value="4">返利</option>
+                                                <option value="5">获得盲盒</option>
+                                                <option value="6">获得卡牌</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
+                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query">
+                                    <i class="layui-icon">&#xe848;</i>
+                                </div>
+                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset">
+                                    <i class="layui-icon">&#xe79b;</i>
+                                </div>
+                            </div>
+                        </div>
+                    </form>
+                    <table lay-filter="fundTable" lay-data="{id: 'fundTable'}"></table>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<style>
+    .layui-table-cell {
+        height: auto !important;
+    }
+</style>
+<script type="text/html" id="type-format">
+    {{#
+    var type = {
+    1: {title: '认购(USDT)'},
+    2: {title: '卖出'},
+    3: {title: '采矿'},
+    4: {title: '返利(SDC)'},
+    5: {title: '获得盲盒'},
+    6: {title: '获得卡牌'}
+    }[d.type];
+    }}
+    <span>{{ type.title }}</span>
+</script>
+<script data-th-inline="none" type="text/javascript">
+    layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'febs', 'treeSelect'], function () {
+        var $ = layui.jquery,
+            laydate = layui.laydate,
+            febs = layui.febs,
+            form = layui.form,
+            table = layui.table,
+            dropdown = layui.dropdown,
+            $view = $('#febs-fund'),
+            $query = $view.find('#query'),
+            $reset = $view.find('#reset'),
+            $searchForm = $view.find('form'),
+            sortObject = {field: 'createTime', type: null},
+            tableIns;
+
+        form.render();
+
+        initTable();
+
+        table.on('tool(fundTable)', function (obj) {
+            var data = obj.data,
+                layEvent = obj.event;
+        });
+
+        table.on('sort(fundTable)', function (obj) {
+            sortObject = obj;
+            tableIns.reload({
+                initSort: obj,
+                where: $.extend(getQueryParams(), {
+                    field: obj.field,
+                    order: obj.type
+                })
+            });
+        });
+
+        $query.on('click', function () {
+            var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type});
+            tableIns.reload({where: params, page: {curr: 1}});
+        });
+
+        $reset.on('click', function () {
+            $searchForm[0].reset();
+            tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject});
+        });
+
+        function initTable() {
+            tableIns = febs.table.init({
+                elem: $view.find('table'),
+                id: 'fundTable',
+                url: ctx + 'flow/fundFlow',
+                cols: [[
+                    {field: 'address', title: '地址', minWidth: 130},
+                    {field: 'amount', title: '数量', minWidth: 130},
+                    {templet: '#type-format', title: '类型', minWidth: 130},
+                    {field: 'fromHash', title: '交易hash', minWidth: 130},
+                    {field: 'createTime', title: '创建时间', minWidth: 180},
+                ]]
+            });
+        }
+
+        function getQueryParams() {
+            return {
+                address: $searchForm.find('input[name="address"]').val().trim(),
+                status: $searchForm.find("select[name='status']").val(),
+                invalidate_ie_cache: new Date()
+            };
+        }
+    })
+</script>
diff --git a/src/main/resources/templates/febs/views/layout.html b/src/main/resources/templates/febs/views/layout.html
index a9d5525..e2ae396 100644
--- a/src/main/resources/templates/febs/views/layout.html
+++ b/src/main/resources/templates/febs/views/layout.html
@@ -63,7 +63,7 @@
         <div class="layui-side-scroll">
             <div class="layui-logo" style="cursor: pointer">
                 <img data-th-src="@{febs/images/logo.png}">
-                <span>ANT-LAB 权限系统</span>
+                <span>SDC 权限系统</span>
             </div>
             <script
                     type="text/html"
diff --git a/src/main/resources/templates/febs/views/login.html b/src/main/resources/templates/febs/views/login.html
index 0d8d1dc..ba3162c 100644
--- a/src/main/resources/templates/febs/views/login.html
+++ b/src/main/resources/templates/febs/views/login.html
@@ -2,7 +2,7 @@
 <html xmlns:th="http://www.thymeleaf.org">
 <head>
     <meta charset="utf-8">
-    <title>ANT-LAB 权限系统</title>
+    <title>SDC 权限系统</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@@ -19,7 +19,7 @@
         <div class="layui-container">
             <div class="layui-row">
                 <div class="layui-col-xs12 layui-col-lg4 layui-col-lg-offset4 febs-tc">
-                    <div class="layui-logo"><span><b>ANT-LAB</b> 权限系统</span></div>
+                    <div class="layui-logo"><span><b>SDC</b> 权限系统</span></div>
                 </div>
                 <div class="layui-col-xs12 layui-col-lg4 layui-col-lg-offset4" id="login-div">
                     <div class="layui-form" lay-filter="login-form">
diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html
index 363836b..540d3ee 100644
--- a/src/main/resources/templates/index.html
+++ b/src/main/resources/templates/index.html
@@ -3,7 +3,7 @@
       xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
 <head>
     <meta charset="utf-8">
-    <title>ANT-LAB 权限系统</title>
+    <title>SDC 权限系统</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

--
Gitblit v1.9.1