feat/task1-c-wallet
parent
1698395860
commit
bc2b575811
|
|
@ -31,12 +31,36 @@
|
|||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<span>类型:</span>
|
||||
<select name="type" class="chosen-select" data-placeholder="操作类型...">
|
||||
<span>业务:</span>
|
||||
<select name="business_type" class="chosen-select" data-placeholder="业务类型...">
|
||||
<option value="-1">业务类型...</option>
|
||||
{{if !empty($business_type_list)}}
|
||||
{{foreach $business_type_list as $v}}
|
||||
<option value="{{$v.value}}" {{if isset($params['business_type']) and $params['business_type'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<span>操作:</span>
|
||||
<select name="operation_type" class="chosen-select" data-placeholder="操作类型...">
|
||||
<option value="-1">操作类型...</option>
|
||||
{{if !empty($common_integral_log_type_list)}}
|
||||
{{foreach $common_integral_log_type_list as $v}}
|
||||
<option value="{{$v.id}}" {{if isset($params['type']) and $params['type'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
|
||||
{{if !empty($operation_type_list)}}
|
||||
{{foreach $operation_type_list as $v}}
|
||||
<option value="{{$v.value}}" {{if isset($params['operation_type']) and $params['operation_type'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span>金额:</span>
|
||||
<select name="money_type" class="chosen-select" data-placeholder="金额类型...">
|
||||
<option value="-1">金额类型...</option>
|
||||
{{if !empty($money_type_list)}}
|
||||
{{foreach $money_type_list as $v}}
|
||||
<option value="{{$v.value}}" {{if isset($params['money_type']) and $params['money_type'] eq $v['value']}}selected{{/if}}>{{$v.name}}</option>
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
</select>
|
||||
|
|
@ -55,28 +79,43 @@
|
|||
<table class="am-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>业务类型</th>
|
||||
<th>操作类型</th>
|
||||
<th class="am-hide-sm-only">描述</th>
|
||||
<th>原始积分</th>
|
||||
<th>最新积分</th>
|
||||
<th class="am-hide-sm-only">时间</th>
|
||||
<th>金额类型</th>
|
||||
<th>操作金额(元)</th>
|
||||
<th class="am-hide-sm-only">变更说明</th>
|
||||
<th class="am-hide-sm-only">创建时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{if !empty($data_list)}}
|
||||
{{foreach $data_list as $v}}
|
||||
<tr>
|
||||
<td>{{$v.type_name}}</td>
|
||||
<td>{{$v.business_type_text}}</td>
|
||||
<td>
|
||||
{{if $v['operation_type'] eq 0}}
|
||||
<span class="operation-reduce-icon">{{$v.operation_type_text}}</span>
|
||||
{{elseif $v['operation_type'] eq 1}}
|
||||
<span class="operation-increase-icon">{{$v.operation_type_text}}</span>
|
||||
{{/if}}
|
||||
</td>
|
||||
<td>{{$v.money_type_text}}</td>
|
||||
<td>
|
||||
{{if $v['operation_type'] eq 0}}
|
||||
<span class="operation-reduce-icon">-</span>
|
||||
{{elseif $v['operation_type'] eq 1}}
|
||||
<span class="operation-increase-icon">+</span>
|
||||
{{/if}}
|
||||
<span class="money">{{$v.money}}</span>
|
||||
</td>
|
||||
<td class="am-hide-sm-only">{{$v.msg}}</td>
|
||||
<td>{{$v.original_integral}}</td>
|
||||
<td>{{$v.new_integral}}</td>
|
||||
<td class="am-hide-sm-only">{{$v.add_time_time}}</td>
|
||||
<td class="am-hide-sm-only">{{$v.add_time_text}}</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
{{if empty($data_list)}}
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<td colspan="6">
|
||||
<div class="table-no"><i class="am-icon-warning"></i> 没有相关数据</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class Hook extends Controller
|
|||
$params['data']['property']['item'][] = [
|
||||
'name' => '我的钱包',
|
||||
'url' => PluginsHomeUrl('wallet', 'wallet', 'index'),
|
||||
'contains' => ['walletindex'],
|
||||
'contains' => ['walletindex', 'rechargeindex', 'cashindex'],
|
||||
'is_show' => 1,
|
||||
'icon' => 'am-icon-github-alt',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class Recharge extends Common
|
|||
$number = MyC('admin_page_number', 10, true);
|
||||
|
||||
// 条件
|
||||
$where = BaseService::RechargeListWhere($params);
|
||||
$where = BaseService::RechargeWhere($params);
|
||||
|
||||
// 获取总数
|
||||
$total = BaseService::RechargeTotal($where);
|
||||
|
|
|
|||
|
|
@ -11,9 +11,8 @@
|
|||
namespace app\plugins\wallet;
|
||||
|
||||
use app\plugins\wallet\Common;
|
||||
use app\plugins\wallet\BusinessService;
|
||||
use app\service\PluginsService;
|
||||
use app\service\IntegralService;
|
||||
use app\plugins\wallet\service\BaseService;
|
||||
use app\plugins\wallet\service\WalletService;
|
||||
|
||||
/**
|
||||
* 钱包 - 账户明细
|
||||
|
|
@ -48,17 +47,16 @@ class Wallet extends Common
|
|||
public function index($params = [])
|
||||
{
|
||||
// 参数
|
||||
$params = input();
|
||||
$params['user'] = $this->user;
|
||||
|
||||
// 分页
|
||||
$number = 10;
|
||||
$number = MyC('admin_page_number', 10, true);
|
||||
|
||||
// 条件
|
||||
$where = IntegralService::UserIntegralLogListWhere($params);
|
||||
$where = BaseService::WalletLogWhere($params);
|
||||
|
||||
// 获取总数
|
||||
$total = IntegralService::UserIntegralLogTotal($where);
|
||||
$total = BaseService::WalletLogTotal($where);
|
||||
|
||||
// 分页
|
||||
$page_params = array(
|
||||
|
|
@ -66,7 +64,7 @@ class Wallet extends Common
|
|||
'total' => $total,
|
||||
'where' => $params,
|
||||
'page' => isset($params['page']) ? intval($params['page']) : 1,
|
||||
'url' => MyUrl('index/userintegral/index'),
|
||||
'url' => PluginsHomeUrl('wallet', 'wallet', 'index'),
|
||||
);
|
||||
$page = new \base\Page($page_params);
|
||||
$this->assign('page_html', $page->GetPageHtml());
|
||||
|
|
@ -77,11 +75,13 @@ class Wallet extends Common
|
|||
'n' => $number,
|
||||
'where' => $where,
|
||||
);
|
||||
$data = IntegralService::UserIntegralLogList($data_params);
|
||||
$data = BaseService::WalletLogList($data_params);
|
||||
$this->assign('data_list', $data['data']);
|
||||
|
||||
// 操作类型
|
||||
$this->assign('common_integral_log_type_list', lang('common_integral_log_type_list'));
|
||||
// 静态数据
|
||||
$this->assign('business_type_list', WalletService::$business_type_list);
|
||||
$this->assign('operation_type_list', WalletService::$operation_type_list);
|
||||
$this->assign('money_type_list', WalletService::$money_type_list);
|
||||
|
||||
// 参数
|
||||
$this->assign('params', $params);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ CREATE TABLE `s_plugins_wallet_log` (
|
|||
`wallet_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '钱包id',
|
||||
`business_type` tinyint(2) NOT NULL DEFAULT '-1' COMMENT '业务类型(-1未知, 0充值, 1提现, 2消费)',
|
||||
`operation_type` tinyint(2) NOT NULL DEFAULT '-1' COMMENT '操作类型(-1未知, 0减少, 1增加)',
|
||||
`money_type` tinyint(2) NOT NULL DEFAULT '-1' COMMENT '操作类型(-1未知, 0正常, 1冻结)',
|
||||
`money_type` tinyint(2) NOT NULL DEFAULT '-1' COMMENT '金额类型(-1未知, 0正常, 1冻结)',
|
||||
`money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '操作金额',
|
||||
`msg` char(200) NOT NULL DEFAULT '' COMMENT '变更说明',
|
||||
`add_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间',
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use think\Db;
|
|||
use app\service\PluginsService;
|
||||
use app\service\ResourcesService;
|
||||
use app\service\PaymentService;
|
||||
use app\plugins\wallet\service\WalletService;
|
||||
|
||||
/**
|
||||
* 基础服务层
|
||||
|
|
@ -83,7 +84,7 @@ class BaseService
|
|||
}
|
||||
|
||||
/**
|
||||
* 总数
|
||||
* 充值列表总数
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
|
|
@ -105,7 +106,7 @@ class BaseService
|
|||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function RechargeListWhere($params = [])
|
||||
public static function RechargeWhere($params = [])
|
||||
{
|
||||
$where = [];
|
||||
|
||||
|
|
@ -383,5 +384,101 @@ class BaseService
|
|||
}
|
||||
return DataReturn('删除失败或资源不存在', -100);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 钱包明细列表
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2019-04-30T00:13:14+0800
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function WalletLogList($params = [])
|
||||
{
|
||||
$where = empty($params['where']) ? [] : $params['where'];
|
||||
$m = isset($params['m']) ? intval($params['m']) : 0;
|
||||
$n = isset($params['n']) ? intval($params['n']) : 10;
|
||||
$field = empty($params['field']) ? '*' : $params['field'];
|
||||
$order_by = empty($params['order_by']) ? 'id desc' : $params['order_by'];
|
||||
|
||||
// 获取数据列表
|
||||
$data = Db::name('PluginsWalletLog')->field($field)->where($where)->limit($m, $n)->order($order_by)->select();
|
||||
if(!empty($data))
|
||||
{
|
||||
$business_type_list = WalletService::$business_type_list;
|
||||
$operation_type_list = WalletService::$operation_type_list;
|
||||
$money_type_list = WalletService::$money_type_list;
|
||||
foreach($data as &$v)
|
||||
{
|
||||
// 业务类型
|
||||
$v['business_type_text'] = (isset($v['business_type']) && isset($business_type_list[$v['business_type']])) ? $business_type_list[$v['business_type']]['name'] : '未知';
|
||||
|
||||
// 操作类型
|
||||
$v['operation_type_text'] = (isset($v['operation_type']) && isset($operation_type_list[$v['operation_type']])) ? $operation_type_list[$v['operation_type']]['name'] : '未知';
|
||||
|
||||
// 金额类型
|
||||
$v['money_type_text'] = (isset($v['money_type']) && isset($money_type_list[$v['money_type']])) ? $money_type_list[$v['money_type']]['name'] : '未知';
|
||||
|
||||
// 创建时间
|
||||
$v['add_time_text'] = empty($v['add_time']) ? '' : date('Y-m-d H:i:s', $v['add_time']);
|
||||
}
|
||||
}
|
||||
return DataReturn('处理成功', 0, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 钱包明细总数
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-29
|
||||
* @desc description
|
||||
* @param [array] $where [条件]
|
||||
*/
|
||||
public static function WalletLogTotal($where = [])
|
||||
{
|
||||
return (int) Db::name('PluginsWalletLog')->where($where)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* 钱包明细条件
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-29
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function WalletLogWhere($params = [])
|
||||
{
|
||||
$where = [];
|
||||
|
||||
// 用户id
|
||||
if(!empty($params['user']))
|
||||
{
|
||||
$where[] = ['user_id', '=', $params['user']['id']];
|
||||
}
|
||||
|
||||
// 业务类型
|
||||
if(isset($params['business_type']) && $params['business_type'] > -1)
|
||||
{
|
||||
$where[] = ['business_type', '=', $params['business_type']];
|
||||
}
|
||||
|
||||
// 操作类型
|
||||
if(isset($params['operation_type']) && $params['operation_type'] > -1)
|
||||
{
|
||||
$where[] = ['operation_type', '=', $params['operation_type']];
|
||||
}
|
||||
|
||||
// 金额类型
|
||||
if(isset($params['money_type']) && $params['money_type'] > -1)
|
||||
{
|
||||
$where[] = ['money_type', '=', $params['money_type']];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -31,6 +31,26 @@ class WalletService
|
|||
2 => ['value' => 2, 'name' => '已注销'],
|
||||
];
|
||||
|
||||
// 业务类型
|
||||
public static $business_type_list = [
|
||||
0 => ['value' => 0, 'name' => '充值', 'checked' => true],
|
||||
1 => ['value' => 1, 'name' => '提现'],
|
||||
2 => ['value' => 2, 'name' => '消费'],
|
||||
];
|
||||
|
||||
// 操作类型
|
||||
public static $operation_type_list = [
|
||||
0 => ['value' => 0, 'name' => '减少', 'checked' => true],
|
||||
1 => ['value' => 1, 'name' => '增加'],
|
||||
];
|
||||
|
||||
// 金额类型
|
||||
public static $money_type_list = [
|
||||
0 => ['value' => 0, 'name' => '正常', 'checked' => true],
|
||||
1 => ['value' => 1, 'name' => '冻结'],
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 用户钱包
|
||||
* @author Devil
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* 列表
|
||||
*/
|
||||
.user-content-body .data-list .operation-reduce-icon {
|
||||
color: #f00;
|
||||
}
|
||||
.user-content-body .data-list .operation-increase-icon {
|
||||
color: #0a9610;
|
||||
}
|
||||
Loading…
Reference in New Issue