Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jcy2004x
ShopXO
提交
576079b9
ShopXO
项目概览
jcy2004x
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
576079b9
编写于
5月 07, 2019
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
钱包管理
上级
491fc4c7
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
76 addition
and
25 deletion
+76
-25
application/plugins/view/wallet/public/nav.html
application/plugins/view/wallet/public/nav.html
+10
-4
application/plugins/wallet/install.sql
application/plugins/wallet/install.sql
+1
-1
application/plugins/wallet/service/WalletService.php
application/plugins/wallet/service/WalletService.php
+62
-15
public/static/plugins/css/wallet/index/common.css
public/static/plugins/css/wallet/index/common.css
+3
-5
未找到文件。
application/plugins/view/wallet/public/nav.html
浏览文件 @
576079b9
...
...
@@ -23,18 +23,24 @@
<!-- 账户信息 -->
{{if empty($wallet_error)}}
<div
class=
"am-alert am-alert-secondary"
data-am-alert
>
<div
class=
"
available
"
>
<span>
可用
金额
</span>
<div
class=
"
normal
"
>
<span>
有效
金额
</span>
<span
class=
"integral-value"
>
{{$user_wallet.normal_money}}
</span>
<em>
元
</em>
<span
class=
"integral-tips"
>
正常可以使用的金额
</span>
<span
class=
"integral-tips"
>
正常可以使用的金额
、包含赠送金额
</span>
</div>
<div
class=
"
locking
"
>
<div
class=
"
frozen
"
>
<span>
冻结金额
</span>
<span
class=
"integral-value"
>
{{$user_wallet.frozen_money}}
</span>
<em>
元
</em>
<span
class=
"integral-tips"
>
一般积分交易中、提现、交易并未完成,锁定相应的积分
</span>
</div>
<div
class=
"give"
>
<span>
赠送金额
</span>
<span
class=
"integral-value"
>
{{$user_wallet.give_money}}
</span>
<em>
元
</em>
<span
class=
"integral-tips"
>
所有赠送金额总额
</span>
</div>
</div>
{{else /}}
<div
class=
"am-alert am-alert-warning"
data-am-alert
>
...
...
application/plugins/wallet/install.sql
浏览文件 @
576079b9
...
...
@@ -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
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'业务类型(0系统, 1充值, 2提现, 3消费)'
,
`operation_type`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'操作类型( 0减少, 1增加)'
,
`money_type`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'金额类型(0
正常
, 1冻结, 2赠送)'
,
`money_type`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'金额类型(0
有效
, 1冻结, 2赠送)'
,
`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
'添加时间'
,
...
...
application/plugins/wallet/service/WalletService.php
浏览文件 @
576079b9
...
...
@@ -47,7 +47,7 @@ class WalletService
// 金额类型
public
static
$money_type_list
=
[
0
=>
[
'value'
=>
0
,
'name'
=>
'
正常
'
,
'checked'
=>
true
],
0
=>
[
'value'
=>
0
,
'name'
=>
'
有效
'
,
'checked'
=>
true
],
1
=>
[
'value'
=>
1
,
'name'
=>
'冻结'
],
2
=>
[
'value'
=>
2
,
'name'
=>
'赠送'
],
];
...
...
@@ -223,6 +223,30 @@ class WalletService
return
DataReturn
(
'操作成功'
,
0
,
$wallet
);
}
/**
* 钱包日志添加
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-05-07T00:57:36+0800
* @param [array] $params [输入参数]
* @return [boolean] [成功true, 失败false]
*/
public
static
function
WalletLogInsert
(
$params
=
[])
{
$data
=
[
'user_id'
=>
isset
(
$params
[
'user_id'
])
?
intval
(
$params
[
'user_id'
])
:
0
,
'wallet_id'
=>
isset
(
$params
[
'wallet_id'
])
?
intval
(
$params
[
'wallet_id'
])
:
0
,
'business_type'
=>
isset
(
$params
[
'business_type'
])
?
intval
(
$params
[
'business_type'
])
:
0
,
'operation_type'
=>
isset
(
$params
[
'operation_type'
])
?
intval
(
$params
[
'operation_type'
])
:
0
,
'money_type'
=>
isset
(
$params
[
'money_type'
])
?
intval
(
$params
[
'money_type'
])
:
0
,
'money'
=>
isset
(
$params
[
'money'
])
?
PriceNumberFormat
(
$params
[
'money'
])
:
0.00
,
'msg'
=>
empty
(
$params
[
'msg'
])
?
'系统'
:
$params
[
'msg'
],
'add_time'
=>
time
(),
];
return
Db
::
name
(
'PluginsWalletLog'
)
->
insertGetId
(
$data
)
>
0
;
}
/**
* 钱包编辑
* @author Devil
...
...
@@ -282,6 +306,9 @@ class WalletService
return
DataReturn
(
'钱包不存在或已删除'
,
-
10
);
}
// 开始处理
Db
::
startTrans
();
// 数据
$data
=
[
'status'
=>
intval
(
$params
[
'status'
]),
...
...
@@ -290,24 +317,44 @@ class WalletService
'give_money'
=>
empty
(
$params
[
'give_money'
])
?
0.00
:
PriceNumberFormat
(
$params
[
'give_money'
]),
'upd_time'
=>
time
(),
];
if
(
!
Db
::
name
(
'PluginsWallet'
)
->
where
([
'id'
=>
$wallet
[
'id'
]])
->
update
(
$data
))
{
Db
::
rollback
();
return
DataReturn
(
'编辑失败'
,
-
100
);
}
// 日志
$log_data
=
[];
if
(
$wallet
[
'normal_money'
]
!=
$data
[
'normal_money'
])
// 字段名称 金额类型
$money_field
=
[
[
'field'
=>
'normal_money'
,
'money_type'
=>
0
],
[
'field'
=>
'frozen_money'
,
'money_type'
=>
1
],
[
'field'
=>
'give_money'
,
'money_type'
=>
2
],
];
foreach
(
$money_field
as
$v
)
{
// 有效金额
if
(
$wallet
[
$v
[
'field'
]]
!=
$data
[
$v
[
'field'
]])
{
$log_data
[]
=
[
$log_data
=
[
'user_id'
=>
$wallet
[
'user_id'
],
'wallet_id'
=>
$wallet
[
'id'
],
'business_type'
=>
0
,
'operation_type'
=>
(
$wallet
[
'normal_money'
]
<
$data
[
'normal_money'
])
?
1
:
0
,
'money_type'
=>
0
,
'money'
=>
(
$wallet
[
'normal_money'
]
<
$data
[
'normal_money'
])
?
PriceNumberFormat
(
$data
[
'normal_money'
]
-
$wallet
[
'normal_money'
])
:
PriceNumberFormat
(
$wallet
[
'normal_money'
]
-
$data
[
'normal_money'
]),
'operation_type'
=>
(
$wallet
[
$v
[
'field'
]]
<
$data
[
$v
[
'field'
]
])
?
1
:
0
,
'money_type'
=>
$v
[
'money_type'
]
,
'money'
=>
(
$wallet
[
$v
[
'field'
]]
<
$data
[
$v
[
'field'
]])
?
PriceNumberFormat
(
$data
[
$v
[
'field'
]]
-
$wallet
[
$v
[
'field'
]])
:
PriceNumberFormat
(
$wallet
[
$v
[
'field'
]]
-
$data
[
$v
[
'field'
]
]),
'msg'
=>
'管理员操作'
,
'add_time'
=>
time
(),
];
if
(
!
self
::
WalletLogInsert
(
$log_data
))
{
Db
::
rollback
();
return
DataReturn
(
'日志添加失败'
,
-
101
);
}
}
print_r
(
$data
);
print_r
(
$log_data
);
}
// 处理成功
Db
::
commit
();
return
DataReturn
(
'编辑成功'
,
0
);
}
}
?>
\ No newline at end of file
public/static/plugins/css/wallet/index/common.css
浏览文件 @
576079b9
...
...
@@ -68,13 +68,10 @@
border-color
:
#ececec
;
margin-bottom
:
20px
;
}
.user-content-body
.
available
.integral-value
{
.user-content-body
.
normal
.integral-value
{
color
:
#4CAF50
;
}
.user-content-body
.locking
{
margin-top
:
5px
;
}
.user-content-body
.locking
.integral-value
{
.user-content-body
.frozen
.integral-value
{
color
:
#FF9800
;
}
.user-content-body
.integral-value
{
...
...
@@ -146,4 +143,5 @@
}
.user-content-body
.data-list
.money
{
color
:
#E4393C
;
font-weight
:
700
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录