Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jamesyang1999
ShopXO
提交
426adacf
ShopXO
项目概览
jamesyang1999
/
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,发现更多精彩内容 >>
提交
426adacf
编写于
6月 10, 2019
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
细节优化
上级
22f36f06
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
113 addition
and
26 deletion
+113
-26
application/plugins/wallet/install.sql
application/plugins/wallet/install.sql
+26
-26
application/plugins/wallet/service/WalletService.php
application/plugins/wallet/service/WalletService.php
+73
-0
application/service/OrderAftersaleService.php
application/service/OrderAftersaleService.php
+14
-0
未找到文件。
application/plugins/wallet/install.sql
浏览文件 @
426adacf
#
充值
CREATE
TABLE
`s_plugins_wallet_recharge`
(
`id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增id'
,
`user_id`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'用户id'
,
`wallet_id`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'钱包id'
,
`recharge_no`
char
(
60
)
NOT
NULL
DEFAULT
''
COMMENT
'充值单号'
,
`status`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'状态(0未支付, 1已支付)'
,
`money`
decimal
(
10
,
2
)
unsigned
NOT
NULL
DEFAULT
'0.00'
COMMENT
'金额'
,
`pay_money`
decimal
(
10
,
2
)
unsigned
NOT
NULL
DEFAULT
'0.00'
COMMENT
'支付金额'
,
`payment_id`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'支付方式id'
,
`payment`
char
(
60
)
NOT
NULL
DEFAULT
''
COMMENT
'支付方式标记'
,
`payment_name`
char
(
60
)
NOT
NULL
DEFAULT
''
COMMENT
'支付方式名称'
,
`pay_time`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'支付时间'
,
`add_time`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'添加时间'
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`recharge_no`
(
`recharge_no`
),
KEY
`status`
(
`status`
),
KEY
`user_id`
(
`user_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'钱包充值 - 应用'
#
钱包
CREATE
TABLE
`s_plugins_wallet`
(
`id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增id'
,
`user_id`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'用户id'
,
`status`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'状态(0正常, 1异常, 2已注销)'
,
`normal_money`
decimal
(
10
,
2
)
unsigned
NOT
NULL
DEFAULT
'0.00'
COMMENT
'有效金额(包含赠送金额)'
,
`frozen_money`
decimal
(
10
,
2
)
unsigned
NOT
NULL
DEFAULT
'0.00'
COMMENT
'冻结金额'
,
`give_money`
decimal
(
10
,
2
)
unsigned
NOT
NULL
DEFAULT
'0.00'
COMMENT
'赠送金额(所有赠送金额总计)'
,
`normal_money`
decimal
(
10
,
2
)
NOT
NULL
DEFAULT
'0.00'
COMMENT
'有效金额(包含赠送金额)'
,
`frozen_money`
decimal
(
10
,
2
)
NOT
NULL
DEFAULT
'0.00'
COMMENT
'冻结金额'
,
`give_money`
decimal
(
10
,
2
)
NOT
NULL
DEFAULT
'0.00'
COMMENT
'赠送金额(所有赠送金额总计)'
,
`add_time`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'添加时间'
,
`upd_time`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
),
...
...
@@ -41,9 +21,9 @@ CREATE TABLE `s_plugins_wallet_log` (
`business_type`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'业务类型(0系统, 1充值, 2提现, 3消费)'
,
`money_type`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'金额类型(0正常, 1冻结, 2赠送)'
,
`operation_type`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'操作类型( 0减少, 1增加)'
,
`operation_money`
decimal
(
10
,
2
)
unsigned
NOT
NULL
DEFAULT
'0.00'
COMMENT
'操作金额'
,
`original_money`
decimal
(
10
,
2
)
unsigned
NOT
NULL
DEFAULT
'0.00'
COMMENT
'原始金额'
,
`latest_money`
decimal
(
10
,
2
)
unsigned
NOT
NULL
DEFAULT
'0.00'
COMMENT
'最新金额'
,
`operation_money`
decimal
(
10
,
2
)
NOT
NULL
DEFAULT
'0.00'
COMMENT
'操作金额'
,
`original_money`
decimal
(
10
,
2
)
NOT
NULL
DEFAULT
'0.00'
COMMENT
'原始金额'
,
`latest_money`
decimal
(
10
,
2
)
NOT
NULL
DEFAULT
'0.00'
COMMENT
'最新金额'
,
`msg`
char
(
200
)
NOT
NULL
DEFAULT
''
COMMENT
'变更说明'
,
`add_time`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'添加时间'
,
PRIMARY
KEY
(
`id`
),
...
...
@@ -51,6 +31,26 @@ CREATE TABLE `s_plugins_wallet_log` (
KEY
`user_id`
(
`user_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'钱包日志 - 应用'
;
#
充值
CREATE
TABLE
`s_plugins_wallet_recharge`
(
`id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增id'
,
`user_id`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'用户id'
,
`wallet_id`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'钱包id'
,
`recharge_no`
char
(
60
)
NOT
NULL
DEFAULT
''
COMMENT
'充值单号'
,
`status`
tinyint
(
2
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'状态(0未支付, 1已支付)'
,
`money`
decimal
(
10
,
2
)
unsigned
NOT
NULL
DEFAULT
'0.00'
COMMENT
'金额'
,
`pay_money`
decimal
(
10
,
2
)
unsigned
NOT
NULL
DEFAULT
'0.00'
COMMENT
'支付金额'
,
`payment_id`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'支付方式id'
,
`payment`
char
(
60
)
NOT
NULL
DEFAULT
''
COMMENT
'支付方式标记'
,
`payment_name`
char
(
60
)
NOT
NULL
DEFAULT
''
COMMENT
'支付方式名称'
,
`pay_time`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'支付时间'
,
`add_time`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'添加时间'
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`recharge_no`
(
`recharge_no`
),
KEY
`status`
(
`status`
),
KEY
`user_id`
(
`user_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
=
'钱包充值 - 应用'
;
#
钱包提现
CREATE
TABLE
`s_plugins_wallet_cash`
(
`id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增id'
,
...
...
application/plugins/wallet/service/WalletService.php
浏览文件 @
426adacf
...
...
@@ -271,5 +271,78 @@ class WalletService
Db
::
commit
();
return
DataReturn
(
'操作成功'
,
0
);
}
/**
* 用户钱包有效金额更新
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-06-10
* @desc description
* @param [int] $user_id [用户id]
* @param [float] $money [操作金额]
* @param [int] $type [类型(0减少, 1增加)]
* @param [string] $field [金额字段, 默认normal_money有效金额, frozen_money冻结金额, give_money赠送金额]
* @param [int] $business_type [业务类型(0系统, 1充值, 2提现, 3消费)]
* @param [string] $msg_title [附加描述标题]
*/
public
static
function
UserWalletMoneyUpdate
(
$user_id
,
$money
,
$type
,
$field
=
'normal_money'
,
$business_type
=
0
,
$msg_title
=
'钱包变更'
)
{
// 获取用户钱包
$wallet
=
self
::
UserWallet
(
$user_id
);
if
(
$wallet
[
'code'
]
==
0
)
{
// 金额字段
$money_field
=
[
'normal_money'
=>
0
,
'frozen_money '
=>
1
,
'give_money'
=>
2
];
if
(
!
in_array
(
$field
,
$money_field
))
{
return
DataReturn
(
'钱包操作金额字段有误'
,
-
10
);
}
// 操作金额
$money
=
PriceNumberFormat
(
$money
);
// 开始处理
Db
::
startTrans
();
// 钱包数据
$data
=
[
$field
=>
(
$type
==
1
)
?
PriceNumberFormat
(
$wallet
[
'data'
][
$field
]
+
$money
)
:
PriceNumberFormat
(
$wallet
[
'data'
][
$field
]
-
$money
),
'upd_time'
=>
time
(),
];
if
(
!
Db
::
name
(
'PluginsWallet'
)
->
where
([
'id'
=>
$wallet
[
'data'
][
'id'
]])
->
update
(
$data
))
{
Db
::
rollback
();
return
DataReturn
(
'钱包操作失败'
,
-
100
);
}
// 日志
$log_data
=
[
'user_id'
=>
$wallet
[
'data'
][
'user_id'
],
'wallet_id'
=>
$wallet
[
'data'
][
'id'
],
'business_type'
=>
$business_type
,
'operation_type'
=>
$type
,
'money_type'
=>
$money_field
[
$field
],
'operation_money'
=>
$money
,
'original_money'
=>
$wallet
[
'data'
][
$field
],
'latest_money'
=>
$data
[
$field
],
];
$operation_type_text
=
(
$log_data
[
'operation_type'
]
==
1
)
?
'增加'
:
'减少'
;
$log_data
[
'msg'
]
=
$msg_title
.
' [ '
.
self
::
$money_type_list
[
$log_data
[
'money_type'
]][
'name'
]
.
'金额'
.
$operation_type_text
.
$log_data
[
'operation_money'
]
.
'元 ]'
;
if
(
!
self
::
WalletLogInsert
(
$log_data
))
{
Db
::
rollback
();
return
DataReturn
(
'钱包日志添加失败'
,
-
101
);
}
// 消息通知
MessageService
::
MessageAdd
(
$wallet
[
'data'
][
'user_id'
],
'钱包变更'
,
$log_data
[
'msg'
],
0
,
$wallet
[
'data'
][
'id'
]);
// 处理成功
Db
::
commit
();
return
DataReturn
(
'操作成功'
,
0
);
}
return
$wallet
;
}
}
?>
\ No newline at end of file
application/service/OrderAftersaleService.php
浏览文件 @
426adacf
...
...
@@ -837,6 +837,20 @@ class OrderAftersaleService
return
DataReturn
(
'售后订单更新失败'
,
-
60
);
}
// 订单售后审核处理完毕钩子
$hook_name
=
'plugins_service_order_aftersale_audit_handle_end'
;
$ret
=
Hook
::
listen
(
$hook_name
,
[
'hook_name'
=>
$hook_name
,
'is_backend'
=>
true
,
'params'
=>
$params
,
'order_id'
=>
$order
[
'data'
][
'id'
],
]);
if
(
isset
(
$ret
[
'code'
])
&&
$ret
[
'code'
]
!=
0
)
{
Db
::
rollback
();
return
$ret
;
}
// 提交事务
Db
::
commit
();
return
DataReturn
(
'退款成功'
,
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录