afa 3 сар өмнө
parent
commit
f7d7d8f215

+ 75 - 0
application/admin/controller/ledger/LedgerTeacEcolyChange.php

@@ -0,0 +1,75 @@
+<?php
+
+namespace app\admin\controller\ledger;
+
+use app\common\controller\Backend;
+use app\common\model\UserModel;
+use fast\Action;
+use fast\RechargeStatus;
+use fast\RechargeType;
+use think\exception\DbException;
+use think\response\Json;
+
+/**
+ * Teac-生态变动明细管理  ledger_teac_angel_change
+ *
+ * @icon fa fa-circle-o
+ */
+class LedgerTeacEcolyChange extends Backend
+{
+
+    /**
+     * LedgerSmhChange模型对象
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\common\model\LedgerTeacEcolyChangeModel();
+
+
+
+    }
+
+
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+    /**
+     * 查看
+     *
+     * @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->alias('r')
+            ->join('user u','r.user_id=u.id','LEFT')
+            ->where($where)
+            ->field('r.*,u.address')
+            ->order($sort, $order)
+            ->paginate($limit);
+        foreach ($list as $k => $v) {
+            $list[$k]['address'] = (new UserModel())->getById($v['user_id'])['address'];
+        }
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
+    }
+
+}

+ 20 - 0
application/admin/view/ledger/ledger_teac_ecoly_change/index.html

@@ -0,0 +1,20 @@
+<div class="panel panel-default panel-intro">
+    {:build_heading()}
+
+    <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"
+                           data-operate-edit="false"
+                           data-operate-del="false">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 5 - 1
application/api/controller/Ledger.php

@@ -5,7 +5,7 @@ namespace app\api\controller;
 use app\api\logic\WelfareLoginc;
 use app\common\controller\Api;
 use app\common\model\LedgerFrozenChangeModel;
-use app\common\model\ProductLists;
+use app\common\model\LedgerTeacEcolyChangeModel;
 use app\common\model\LedgerTeacChangeModel;
 use app\common\model\LedgerTeacAngelChangeModel;
 use app\common\model\UserModel;
@@ -107,6 +107,10 @@ class Ledger extends Api
                 $paginator = (new LedgerTeacAngelChangeModel());
                 $res['data'] = $paginator->where($where)->order('id DESC')->paginate($this->pageSize);
                 break;
+            case 'teac_ecology':
+                $paginator = (new LedgerTeacEcolyChangeModel());
+                $res['data'] = $paginator->where($where)->order('id DESC')->paginate($this->pageSize);
+                break;
             default:
                 $this->error(__('Invalid parameters'));
                 break;

+ 1 - 1
application/common/model/LedgerTeacEcolyChangeModel.php

@@ -6,7 +6,7 @@ use think\Model;
 
 class LedgerTeacEcolyChangeModel extends Model
 {
-    // Teac-天使 TEAC_ECOLY
+    // Teac-生态 TEAC_ECOLY
     protected $name = "ledger_teac_ecoly_change";
 
 

+ 59 - 0
public/assets/js/backend/ledger/ledger_teac_ecoly_change.js

@@ -0,0 +1,59 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'ledger/ledger_teac_ecoly_change/index' + location.search,
+              
+                    multi_url: 'ledger/ledger_teac_ecoly_change/multi',
+                    import_url: 'ledger/ledger_teac_ecoly_change/import',
+                    table: 'ledger_teac_ecoly_change',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'id',
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: '编号'},
+                        {field: 'user_id', title: '用户ID'},
+                        {field: 'address', title: '用户地址'},
+                        {
+                            field: 'action', title: '账变类型', searchList: {
+                                '0': 'TeaC·生态发展划转',
+                                '1': '',
+                         
+                            }, operate: 'FIND_IN_SET', formatter: Table.api.formatter.label
+                        },
+                        {field: 'change_amount', title: '变动金额', operate:'BETWEEN'},
+                        {field: 'present_amount', title: '实时余额', operate:'BETWEEN'},
+                        {field: 'from_id', title: '来源ID'},
+                        {field: 'create_time', title: '变动时间', operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                    ]
+                ]
+            });
+            // 为表格绑定事件
+            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;
+});