Browse Source

add: 后台支持用户币余额和币变动记录查询

joe 4 years ago
parent
commit
943c14ceeb

+ 18 - 0
app/admin/controller/user/User.php

@@ -19,6 +19,9 @@ use app\admin\model\store\{StoreVisit, StoreCouponUser};
 use app\admin\model\system\{SystemUserLevel, SystemUserTask};
 use app\admin\model\system\{SystemUserLevel, SystemUserTask};
 use crmeb\services\{FormBuilder as Form, UtilService as Util, JsonService as Json};
 use crmeb\services\{FormBuilder as Form, UtilService as Util, JsonService as Json};
 use app\admin\model\user\{User as UserModel, UserBill as UserBillAdmin, UserLevel, UserGroup, UserTaskFinish};
 use app\admin\model\user\{User as UserModel, UserBill as UserBillAdmin, UserLevel, UserGroup, UserTaskFinish};
+// 共用前端 model
+use app\models\user\UserCoin;
+use app\models\coin\UserCoinTransfer;
 
 
 /**
 /**
  * 用户管理控制器
  * 用户管理控制器
@@ -746,6 +749,21 @@ class User extends AuthController
         return $this->fetch();
         return $this->fetch();
     }
     }
 
 
+    /**
+     * 获取某用户所有币的变动记录
+     */
+    public function getCoinChangeList($uid, $page = 1, $limit = 20)
+    {
+        return Json::successful(UserCoinTransfer::getUserTransferred($uid, $page, $limit));
+    }
+    /**
+     * 获取某用户所有币及其余额
+     */
+    public function getCoinList($uid, $page = 1, $limit = 20)
+    {
+        return Json::successful(UserCoin::getUserCoin($uid, $page, $limit));
+    }
+
     /*
     /*
      * 获取某个用户的推广下线
      * 获取某个用户的推广下线
      * */
      * */

+ 103 - 1
app/admin/view/user/user/see.php

@@ -89,6 +89,8 @@
                             <li>持有优惠劵</li>
                             <li>持有优惠劵</li>
                             <li>余额变动记录</li>
                             <li>余额变动记录</li>
                             <li>推广下线明细</li>
                             <li>推广下线明细</li>
+                            <li>币余额</li>
+                            <li>币记录</li>
                         </ul>
                         </ul>
                         <div class="layui-tab-content" id="content">
                         <div class="layui-tab-content" id="content">
                             <div class="layui-tab-item layui-show">
                             <div class="layui-tab-item layui-show">
@@ -262,13 +264,77 @@
                                         <td>{{item.integral}}</td>
                                         <td>{{item.integral}}</td>
                                         <td>{{item.add_time}}</td>
                                         <td>{{item.add_time}}</td>
                                     </tr>
                                     </tr>
-                                    <tr v-show="balanceChangList.length<=0" style="text-align: center">
+                                    <tr v-show="SpreadList.length<=0" style="text-align: center">
                                         <td colspan="4">暂无数据</td>
                                         <td colspan="4">暂无数据</td>
                                     </tr>
                                     </tr>
                                     </tbody>
                                     </tbody>
                                 </table>
                                 </table>
                                 <div ref="spread_page" v-show="count.spread_count > limit" style="text-align: right;"></div>
                                 <div ref="spread_page" v-show="count.spread_count > limit" style="text-align: right;"></div>
                             </div>
                             </div>
+                            <!-- 币余额 -->
+                            <div class="layui-tab-item">
+                                <table class="layui-table" v-cloak="">
+                                    <thead>
+                                    <tr>
+                                        <th>图标</th>
+                                        <th>名称</th>
+                                        <th>余额</th>
+                                        <th>钱包</th>
+                                    </tr>
+                                    </thead>
+                                    <tbody>
+                                    <tr v-for="item in CoinList">
+                                        <td>
+                                            <p><img style="width:32px;height:32px;" :src="item.icon"/></p>
+                                        </td>
+                                        <td>{{item.symbol}}</td>
+                                        <td>{{item.balance}}</td>
+                                        <td>{{item.addr}}</td>
+                                    </tr>
+                                    <tr v-show="CoinList.length<=0" style="text-align: center">
+                                        <td colspan="4">暂无数据</td>
+                                    </tr>
+                                    </tbody>
+                                </table>
+                                <div ref="coin_page" v-show="count.coin_count > limit" style="text-align: right;"></div>
+                            </div>
+                             <!-- 币记录 -->
+                             <div class="layui-tab-item">
+                                <table class="layui-table" v-cloak="">
+                                    <thead>
+                                    <tr>
+                                        <th>订单编号</th>
+                                        <th>图标</th>
+                                        <th>名称</th>
+                                        <th>发送地址</th>
+                                        <th>接收地址</th>
+                                        <th>操作</th>
+                                        <th>数量</th>
+                                        <th>时间</th>
+                                    </tr>
+                                    </thead>
+                                    <tbody>
+                                    <tr v-for="item in CoinChangeList">
+                                        <td>{{item.order_id}}</td>
+                                        <td>
+                                            <p><img style="width:32px;height:32px;" :src="item.icon"/></p>
+                                        </td>
+                                        <td>{{item.symbol}}</td>
+                                        <td>{{item.from}}</td>
+                                        <td>{{ item.to }}</td>
+                                        <td>
+                                            <span class="layui-badge" :class="{'layui-bg-green':item.out==0}" v-text="item.out==1 ? '转出': '挖取' ">正在加载</span>
+                                        </td>
+                                        <td>{{item.amount}}</td>
+                                        <td>{{ item.stime }} </td>
+                                    </tr>
+                                    <tr v-show="CoinChangeList.length<=0" style="text-align: center">
+                                        <td colspan="4">暂无数据</td>
+                                    </tr>
+                                    </tbody>
+                                </table>
+                                <div ref="coinchange_page" v-show="count.coinchange_count > limit" style="text-align: right;"></div>
+                            </div>
                             <!--end-->
                             <!--end-->
                         </div>
                         </div>
                     </div>
                     </div>
@@ -293,6 +359,8 @@
                 CouponsList:[],
                 CouponsList:[],
                 balanceChangList:[],
                 balanceChangList:[],
                 SpreadList:[],
                 SpreadList:[],
+                CoinList:[],        // 用户所有的币
+                CoinChangeList:[],  // 币变动记录
                 count:count,
                 count:count,
                 page:{
                 page:{
                     order_page:1,
                     order_page:1,
@@ -301,6 +369,8 @@
                     copons_page:1,
                     copons_page:1,
                     balancechang_page:1,
                     balancechang_page:1,
                     spread_page:1,
                     spread_page:1,
+                    coin_page:1,
+                    coinchange_page:1,
                 },
                 },
             },
             },
             watch:{
             watch:{
@@ -321,9 +391,21 @@
                 },
                 },
                 'page.spread_page':function () {
                 'page.spread_page':function () {
                     this.getSpreadList();
                     this.getSpreadList();
+                },
+                'page.coin_page':function () {
+                    this.getCoinList();
+                },
+                'page.coinchange_page':function () {
+                    this.getCoinChangeList();
                 }
                 }
             },
             },
             methods:{
             methods:{
+                getCoinChangeList: function () {
+                    this.request('getCoinChangeList', this.page.coinchange_page, 'CoinChangeList');
+                },
+                getCoinList: function () {
+                    this.request('getCoinList', this.page.coin_page, 'CoinList');
+                },
                 getSpreadList:function(){
                 getSpreadList:function(){
                     this.request('getSpreadList',this.page.spread_page,'SpreadList');
                     this.request('getSpreadList',this.page.spread_page,'SpreadList');
                 },
                 },
@@ -356,6 +438,8 @@
                 this.getOneCouponsList();
                 this.getOneCouponsList();
                 this.getOneBalanceChangList();
                 this.getOneBalanceChangList();
                 this.getSpreadList();
                 this.getSpreadList();
+                this.getCoinList();
+                this.getCoinChangeList();
                 var that=this;
                 var that=this;
                 layList.laypage.render({
                 layList.laypage.render({
                     elem: that.$refs.page_order
                     elem: that.$refs.page_order
@@ -412,6 +496,24 @@
                         that.page.spread_page=obj.curr;
                         that.page.spread_page=obj.curr;
                     }
                     }
                 });
                 });
+                layList.laypage.render({
+                    elem: that.$refs.coin_page
+                    ,count:that.count.coin_count
+                    ,limit:that.limit
+                    ,theme: '#1E9FFF',
+                    jump:function(obj){
+                        that.page.coin_page=obj.curr;
+                    }
+                });
+                layList.laypage.render({
+                    elem: that.$refs.coinchange_page
+                    ,count:that.count.coinchange_count
+                    ,limit:that.limit
+                    ,theme: '#1E9FFF',
+                    jump:function(obj){
+                        that.page.coinchange_page=obj.curr;
+                    }
+                });
             }
             }
         });
         });
     });
     });

+ 2 - 2
app/models/coin/UserCoinTransfer.php

@@ -72,8 +72,8 @@ class UserCoinTransfer extends BaseModel {
     public static function getUserTransferred($uid, $page, $limit=20) {
     public static function getUserTransferred($uid, $page, $limit=20) {
         $res = self::where('uid', $uid)->order('ts desc')
         $res = self::where('uid', $uid)->order('ts desc')
             ->alias('t')->join('dict_coin c', 'c.symbol=t.symbol')
             ->alias('t')->join('dict_coin c', 'c.symbol=t.symbol')
-            ->field('t.symbol, c.icon, t.from, t.to, t.amount, t.out, t.ts')
-            ->limit(($page-1) * $limit, $limit)->select()->toArray();
+            ->field('t.order_id, t.symbol, c.icon, t.from, t.to, t.amount, t.out, t.ts, FROM_UNIXTIME(t.ts,"%Y-%m-%d") as stime')
+            ->page(intval($page), intval($limit))->select()->toArray();
         //echo self::getLastSql();
         //echo self::getLastSql();
         return $res;
         return $res;
     }
     }

+ 12 - 0
app/models/user/UserCoin.php

@@ -37,4 +37,16 @@ class UserCoin extends BaseModel {
             ]);
             ]);
         }
         }
     }
     }
+
+    public static function getUserCoin($uid, $page, $limit)
+    {
+        $rows = self::alias('c')->join('dict_coin d', 'c.symbol=d.symbol')
+            ->where('c.uid', $uid)
+            ->field('d.icon,c.symbol,c.balance,c.addr')
+            ->order('c.symbol asc')
+            ->page(intval($page), intval($limit))
+            ->select();
+        count($rows) && $rows = $rows->toArray();
+        return $rows;
+    }
 }
 }

+ 1 - 1
docs/TODO

@@ -34,7 +34,7 @@
 
 
 # 增加 幸运2021 结果查询接口
 # 增加 幸运2021 结果查询接口
 
 
-# 增加用户挖矿余额,提币记录查询
+# __增加用户挖矿余额,提币记录查询__
 
 
 # install 过程增加检查 iconv 模块。
 # install 过程增加检查 iconv 模块。