Your Name 10 months ago
commit 25646be3f7
  1. 37
      application/admin/controller/ScoreLog.php
  2. 26
      application/admin/lang/zh-cn/score_log.php
  3. 40
      application/admin/model/ScoreLog.php
  4. 27
      application/admin/validate/ScoreLog.php
  5. 69
      application/admin/view/score_log/add.html
  6. 69
      application/admin/view/score_log/edit.html
  7. 29
      application/admin/view/score_log/index.html
  8. 63
      public/assets/js/backend/score_log.js

@ -0,0 +1,37 @@
<?php
namespace app\admin\controller;
use app\common\controller\Backend;
/**
* 用户资金日志
*
* @icon fa fa-circle-o
*/
class ScoreLog extends Backend
{
/**
* ScoreLog模型对象
* @var \app\admin\model\ScoreLog
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\ScoreLog;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

@ -0,0 +1,26 @@
<?php
return [
'User_id' => '用户',
'Type' => '类型',
'Type money' => '余额',
'Type commission' => '佣金',
'Type score' => '积分',
'Event' => '事件',
'Event money_recharge' => '充值',
'Event money_consume' => '余额消费',
'Event commission_withdraw' => '提现',
'Event commission_transfer' => '佣金转余额',
'Event commission_reward' => '佣金奖励',
'Event score_consume' => '积分消费',
'Event score_sign' => '积分签到',
'Event activity' => '活动赠送',
'Amount' => '数量',
'Before' => '变动前',
'After' => '变动后',
'Memo' => '备注',
'Ext' => '扩展信息',
'Oper_type' => '操作人类型',
'Oper_id' => '操作人',
'Createtime' => '创建时间'
];

@ -0,0 +1,40 @@
<?php
namespace app\admin\model;
use think\Model;
class ScoreLog extends Model
{
// 表名
protected $name = 'shopro_user_wallet_log';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = false;
protected $deleteTime = false;
// 追加属性
protected $append = [
];
}

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

@ -0,0 +1,69 @@
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-type" data-rule="required" class="form-control" name="row[type]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Event')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-event" data-rule="required" class="form-control" name="row[event]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Amount')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-amount" data-rule="required" class="form-control" step="0.01" name="row[amount]" type="number" value="0.00">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Before')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-before" data-rule="required" class="form-control" step="0.01" name="row[before]" type="number" value="0.00">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('After')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-after" data-rule="required" class="form-control" step="0.01" name="row[after]" type="number" value="0.00">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Memo')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-memo" class="form-control" name="row[memo]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Ext')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-ext" class="form-control" name="row[ext]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Oper_type')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-oper_type" data-rule="required" class="form-control" name="row[oper_type]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Oper_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-oper_id" data-rule="required" data-source="oper/index" class="form-control selectpage" name="row[oper_id]" type="text" value="">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
</form>

@ -0,0 +1,69 @@
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-type" data-rule="required" class="form-control" name="row[type]" type="text" value="{$row.type|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Event')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-event" data-rule="required" class="form-control" name="row[event]" type="text" value="{$row.event|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Amount')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-amount" data-rule="required" class="form-control" step="0.01" name="row[amount]" type="number" value="{$row.amount|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Before')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-before" data-rule="required" class="form-control" step="0.01" name="row[before]" type="number" value="{$row.before|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('After')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-after" data-rule="required" class="form-control" step="0.01" name="row[after]" type="number" value="{$row.after|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Memo')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-memo" class="form-control" name="row[memo]" type="text" value="{$row.memo|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Ext')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-ext" class="form-control" name="row[ext]" type="text" value="{$row.ext|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Oper_type')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-oper_type" data-rule="required" class="form-control" name="row[oper_type]" type="text" value="{$row.oper_type|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Oper_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-oper_id" data-rule="required" data-source="oper/index" class="form-control selectpage" name="row[oper_id]" type="text" value="{$row.oper_id|htmlentities}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
</form>

@ -0,0 +1,29 @@
<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>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('score_log/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('score_log/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('score_log/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('score_log/edit')}"
data-operate-del="{:$auth->check('score_log/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,63 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'score_log/index' + location.search,
add_url: 'score_log/add',
edit_url: 'score_log/edit',
del_url: 'score_log/del',
multi_url: 'score_log/multi',
import_url: 'score_log/import',
table: 'shopro_user_wallet_log',
}
});
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')},
{field: 'user_id', title: __('User_id')},
{field: 'type', title: __('Type'), operate: 'LIKE'},
{field: 'event', title: __('Event'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'amount', title: __('Amount'), operate:'BETWEEN'},
{field: 'before', title: __('Before'), operate:'BETWEEN'},
{field: 'after', title: __('After'), operate:'BETWEEN'},
{field: 'memo', title: __('Memo'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'ext', title: __('Ext'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'oper_type', title: __('Oper_type'), operate: 'LIKE'},
{field: 'oper_id', title: __('Oper_id')},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{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;
});
Loading…
Cancel
Save