Browse Source

rwa对换

afa 6 months ago
parent
commit
1e3fe50231

+ 56 - 0
application/admin/controller/offline/RwaExchangeRecord.php

@@ -0,0 +1,56 @@
+<?php
+
+namespace app\admin\controller\offline;
+
+use app\common\controller\Backend;
+
+/**
+ * Rwa茶兑换记录管理
+ *
+ * @icon fa fa-circle-o
+ */
+class RwaExchangeRecord extends Backend
+{
+
+    /**
+     * RwaExchangeRecord模型对象
+     * @var \app\admin\model\offline\RwaExchangeRecord
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\common\model\RwaExchangeRecordModel;
+    }
+
+
+    /**
+     * 查看
+     *
+     * @return string|Json
+     * @throws \think\Exception
+     * @throws DbException
+     */
+    public function index()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if (false === $this->request->isAjax()) {
+            return $this->view->fetch();
+        }
+        //如果发送的来源是 Selectpage,则转发到 Selectpage
+        if ($this->request->request('keyField')) {
+            return $this->selectpage();
+        }
+        [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+        $list = $this->model->with('users,products')
+            ->where($where)
+            ->order($sort, $order)
+            ->paginate($limit);
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
+    }
+
+
+}

+ 16 - 0
application/admin/lang/zh-cn/offline/rwa_exchange_record.php

@@ -0,0 +1,16 @@
+<?php
+
+return [
+    'Order_no'     => '订单号',
+    'Tx_hash'      => '交易哈希',
+    'User_id'      => '用户',
+    'Symbol'       => '币种',
+    'Amount'       => '金额',
+    'Product_id'   => '发放产品',
+    'From_address' => '用户地址',
+    'To_address'   => '充值地址',
+    'Status'       => '状态',
+    'Create_time'  => '创建时间',
+    'Block_number' => '最新扫描的最新区块',
+    'Note'         => '备注'
+];

+ 27 - 0
application/admin/validate/offline/RwaExchangeRecord.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\admin\validate\offline;
+
+use think\Validate;
+
+class RwaExchangeRecord extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => [],
+    ];
+    
+}

+ 27 - 0
application/admin/view/offline/rwa_exchange_record/index.html

@@ -0,0 +1,27 @@
+<div class="panel panel-default panel-intro">
+    
+    <div class="panel-heading">
+        {:build_heading(null,FALSE)}
+  
+    </div>
+
+
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                   
+                        
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+            
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 13 - 0
application/common/model/RwaExchangeRecordModel.php

@@ -32,6 +32,19 @@ class RwaExchangeRecordModel extends Model
         return $this->hasOne(UserModel::class, 'id', 'user_id');
     }
 
+    //用户 user_id
+    public function users()
+    {
+        return $this->hasOne('UserModel', 'id', 'user_id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+    //产品
+    public function products()
+    {
+        return $this->hasOne('ProductLists', 'id', 'product_id', [], 'LEFT')->setEagerlyType(0);
+    }
+ 
+
     public function getCreateTimeTextAttr($value, $data)
     {
         $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');

+ 62 - 0
public/assets/js/backend/offline/rwa_exchange_record.js

@@ -0,0 +1,62 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'offline/rwa_exchange_record/index' + location.search,
+                    import_url: 'offline/rwa_exchange_record/import',
+                    table: 'rwa_exchange_record',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'id',
+                fixedColumns: true,
+                fixedRightNumber: 1,
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id'), operate: false},
+                        {field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
+                        {field: 'tx_hash', title: __('Tx_hash'), operate: 'LIKE'},
+                        {field: 'users.address', title: __('User_id'),operate: 'LIKE'},
+                        {field: 'symbol', title: __('Symbol'), operate: false},
+                        {field: 'amount', title: __('Amount'), operate:false},
+                        {field: 'products.zh_name', title: __('Product_id'), operate:'LIKE'},
+                        {field: 'from_address', title: __('From_address'), operate: 'LIKE'},
+                        {field: 'to_address', title: __('To_address'), operate: 'LIKE'},
+                        {field: 'status', title: __('Status'), searchList: {
+                            "100":__('待确认'),"200":__('成功'),"400":__('失败')
+                        }, formatter: Table.api.formatter.status},
+                        {field: 'create_time', title: __('Create_time'), operate: false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'block_number', title: __('Block_number'), operate: false},
+                        {field: 'note', title: __('Note'), operate: false},
+                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});