Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
loveisland
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘小敏
loveisland
Commits
6c74f7be
Commit
6c74f7be
authored
May 09, 2026
by
刘小敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传附件文件格式增加证书;增加累计消费和累计充值金额接口;
parent
fae5729e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
1 deletion
+59
-1
WalletLog.php
addons/shopro/controller/user/WalletLog.php
+58
-0
upload.php
application/extra/upload.php
+1
-1
No files found.
addons/shopro/controller/user/WalletLog.php
View file @
6c74f7be
...
...
@@ -4,6 +4,7 @@ namespace addons\shopro\controller\user;
use
addons\shopro\controller\Common
;
use
app\admin\model\shopro\user\WalletLog
as
UserWalletLogModel
;
use
think\Cache
;
class
WalletLog
extends
Common
{
...
...
@@ -35,4 +36,61 @@ class WalletLog extends Common
$logs
=
UserWalletLogModel
::
where
(
$where
)
->
{
$type
}()
->
whereTime
(
'createtime'
,
'between'
,
$date
)
->
order
(
'createtime'
,
'desc'
)
->
paginate
(
$list_rows
);
$this
->
success
(
'获取成功'
,
[
'list'
=>
$logs
,
'income'
=>
$income
,
'expense'
=>
$expense
]);
}
/**
* 钱包统计( 累计充值 和 累计消费 )
* @param string $type 钱包类型:money-余额, score-积分, commission-佣金(默认money)
* @return array
*/
public
function
walletStats
()
{
$user
=
auth_user
();
$type
=
$this
->
request
->
param
(
'type'
,
'score'
);
// 验证钱包类型
if
(
!
in_array
(
$type
,
[
'money'
,
'score'
,
'commission'
]))
{
$this
->
error
(
'参数错误'
);
}
// 缓存key(包含用户ID、类型)
$cacheKey
=
"wallet_stats_
{
$user
->
id
}
_
{
$type
}
"
;
$cacheData
=
Cache
::
get
(
$cacheKey
);
if
(
$cacheData
!==
false
)
{
// 返回缓存数据
$this
->
success
(
'获取成功'
,
$cacheData
);
}
try
{
// 累计充值(收入)- 充值相关事件
$rechargeEvents
=
[
'money'
=>
[
'order_recharge'
,
'admin_recharge'
,
'recharge_gift'
,
'activity_gift'
,
'transfer_by_commission'
],
'score'
=>
[
'signin'
,
'activity_gift'
,
'admin_recharge'
,
'recharge_gift'
],
'commission'
=>
[
'reward_income'
,
'withdraw_error'
]
];
$recharge
=
UserWalletLogModel
::
where
(
'user_id'
,
$user
->
id
)
->
where
(
'type'
,
$type
)
->
where
(
'amount'
,
'>'
,
0
)
->
whereIn
(
'event'
,
$rechargeEvents
[
$type
])
->
sum
(
'amount'
)
?:
0
;
// 累计消费(支出)
$consume
=
UserWalletLogModel
::
where
(
'user_id'
,
$user
->
id
)
->
where
(
'type'
,
$type
)
->
where
(
'amount'
,
'<'
,
0
)
->
sum
(
'amount'
)
?:
0
;
$result
=
[
'recharge'
=>
round
(
$recharge
,
2
),
'consume'
=>
round
(
abs
(
$consume
),
2
),
'type'
=>
$type
];
}
catch
(
\Exception
$e
)
{
$result
=
[
'recharge'
=>
0
,
'consume'
=>
0
,
'type'
=>
$type
];
}
// 设置1分钟缓存
Cache
::
set
(
$cacheKey
,
$result
,
60
);
$this
->
success
(
'获取成功'
,
$result
);
}
}
application/extra/upload.php
View file @
6c74f7be
...
...
@@ -22,7 +22,7 @@ return [
* 可上传的文件类型
* 如配置允许 pdf,ppt,docx,svg 等可能含有脚本的文件时,请先从服务器配置此类文件直接下载而不是预览
*/
'mimetype'
=>
'jpg,png,bmp,jpeg,gif,webp,zip,rar,wav,mp4,mp3,webm'
,
'mimetype'
=>
'jpg,png,bmp,jpeg,gif,webp,zip,rar,wav,mp4,mp3,webm
,pem,crt
'
,
/**
* 是否支持批量上传
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment