Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
stock_new
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sugar
stock_new
Commits
a5d8bd78
You need to sign in or sign up before continuing.
Commit
a5d8bd78
authored
Jun 21, 2024
by
twj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
余额提现和期权提现
parent
9fa88147
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
221 additions
and
203 deletions
+221
-203
application/apicom/home/Withdraw.php
application/apicom/home/Withdraw.php
+49
-30
application/money/admin/Esopplan.php
application/money/admin/Esopplan.php
+1
-1
application/money/admin/Esopplanrecord.php
application/money/admin/Esopplanrecord.php
+1
-1
application/money/admin/Withdraw.php
application/money/admin/Withdraw.php
+3
-1
application/money/model/EsopPlan.php
application/money/model/EsopPlan.php
+3
-2
application/money/model/Withdraw.php
application/money/model/Withdraw.php
+164
-168
No files found.
application/apicom/home/Withdraw.php
View file @
a5d8bd78
...
...
@@ -34,20 +34,39 @@ class Withdraw extends Common
public
function
index
()
{
$money
=
\app\money\model\Money
::
getMoney
(
MID
);
$money
[
'account'
]
=
bcdiv
(
$money
[
'account'
],
100
,
2
);
$money
[
'operate_account'
]
=
bcdiv
(
$money
[
'operate_account'
],
100
,
2
);
$money
[
'operate_account'
]
=
bcdiv
(
$money
[
'operate_account'
],
100
,
2
);
$money
[
'account'
]
=
bcdiv
(
$money
[
'account'
],
100
,
2
);
$money
[
'operate_account'
]
=
bcdiv
(
$money
[
'operate_account'
],
100
,
2
);
$money
[
'operate_account'
]
=
bcdiv
(
$money
[
'operate_account'
],
100
,
2
);
$banks
=
BankModel
::
getBank
(
MID
);
if
(
empty
(
$banks
))
ajaxmsg
(
'您未绑定银行卡,请先绑定银行卡'
,
0
);
if
(
empty
(
$banks
))
ajaxmsg
(
'您未绑定银行卡,请先绑定银行卡'
,
0
);
$data
[
'money'
]
=
$money
;
$data
[
'banks'
]
=
$banks
;
$data
[
'default_bank'
]
=
$banks
[
0
];
$data
[
'bankSetting'
]
=
preg_replace
(
'/\|img/'
,
''
,
config
(
"web_bank"
));
ajaxmsg
(
'线下提现信息'
,
1
,
$data
);
$data
[
'bankSetting'
]
=
preg_replace
(
'/\|img/'
,
''
,
config
(
"web_bank"
));
ajaxmsg
(
'线下提现信息'
,
1
,
$data
);
}
/**
* 提现规则说明
*/
public
function
withdrawRule
()
{
//最低提现金额
$minimum
=
config
(
'withdraw_minimum'
);
//最高提现金额
$maximum
=
config
(
'withdraw_maximum'
);
//提现手续费比例
$rate
=
config
(
'withdraw_rate'
);
//提现审核时间
$withdraw_audit_time
=
config
(
'withdraw_audit_time'
);
$rule
=
[];
$rule
[
0
]
=
"1.单笔提现最低金额:"
.
$minimum
;
$rule
[
1
]
=
"2.单笔提现最高金额:"
.
$maximum
;
$rule
[
2
]
=
"3.提现手续费"
.
$rate
.
"%"
;
$rule
[
4
]
=
"4.提现审核时间"
.
$withdraw_audit_time
;
ajaxmsg
(
'提现规则说明'
,
1
,
$rule
);
}
/*
* 操作提现操作
...
...
@@ -58,37 +77,37 @@ class Withdraw extends Common
$data
=
$this
->
request
->
post
();
$data
[
'mid'
]
=
MID
;
$result
=
$this
->
validate
(
$data
,
"Withdraw.create"
);
if
(
true
!==
$result
)
{
ajaxmsg
(
$result
,
0
);
if
(
true
!==
$result
)
{
ajaxmsg
(
$result
,
0
);
//$this->error($result);
}
if
(
$data
[
'money'
]
<
0
)
{
ajaxmsg
(
'提现金额错误!'
,
0
);
if
(
$data
[
'money'
]
<
0
)
{
ajaxmsg
(
'提现金额错误!'
,
0
);
}
$money_res
=
Db
::
name
(
'money'
)
->
where
([
'mid'
=>
MID
])
->
find
();
if
(
empty
(
$money_res
[
'account'
]))
{
ajaxmsg
(
'查询账户资金出错!'
,
0
);
$money_res
=
Db
::
name
(
'money'
)
->
where
([
'mid'
=>
MID
])
->
find
();
if
(
empty
(
$money_res
[
'account'
]))
{
ajaxmsg
(
'查询账户资金出错!'
,
0
);
}
if
(
isset
(
$money_res
[
'account'
])
&&
$money_res
[
'account'
]
<
$data
[
'money'
])
{
ajaxmsg
(
'提现金额已经大于可用余额!'
,
0
);
if
(
isset
(
$money_res
[
'account'
])
&&
$money_res
[
'account'
]
<
$data
[
'money'
])
{
ajaxmsg
(
'提现金额已经大于可用余额!'
,
0
);
}
$withdraw_info
=
Db
::
name
(
'money_withdraw'
)
->
where
([
'mid'
=>
MID
])
->
where
([
'status'
=>
0
])
$withdraw_info
=
Db
::
name
(
'money_withdraw'
)
->
where
([
'mid'
=>
MID
])
->
where
([
'status'
=>
0
])
->
find
();
if
(
!
empty
(
$withdraw_info
))
{
ajaxmsg
(
'您已有提现申请,请耐心等待审核。'
,
0
);
if
(
!
empty
(
$withdraw_info
))
{
ajaxmsg
(
'您已有提现申请,请耐心等待审核。'
,
0
);
}
$c
=
Db
::
name
(
'member'
)
->
where
([
"id"
=>
MID
])
->
find
();
if
(
Hash
::
check
((
string
)
$data
[
'paywd'
],
$c
[
'paywd'
]))
{
$c
=
Db
::
name
(
'member'
)
->
where
([
"id"
=>
MID
])
->
find
();
if
(
Hash
::
check
((
string
)
$data
[
'paywd'
],
$c
[
'paywd'
]))
{
$res
=
WithdrawModel
::
saveData
(
$data
);
}
else
{
ajaxmsg
(
'支付密码错误'
,
0
);
}
else
{
ajaxmsg
(
'支付密码错误'
,
0
);
}
if
(
$res
[
'status'
])
{
ajaxmsg
(
'提现申请已提交,请耐心等待审核'
,
1
);
}
else
{
ajaxmsg
(
'提现申请提交失败'
,
0
);
if
(
$res
[
'status'
])
{
ajaxmsg
(
'提现申请已提交,请耐心等待审核'
,
1
);
}
else
{
ajaxmsg
(
'提现申请提交失败'
,
0
);
}
}
}
application/money/admin/Esopplan.php
View file @
a5d8bd78
...
...
@@ -83,7 +83,7 @@ class Esopplan extends Admin
$data
[
'create_time'
]
=
time
();
$data
[
'plan_account'
]
=
$data
[
'plan_account'
]
*
100
;
$data
[
'remain_account'
]
=
$data
[
'plan_account'
]
*
100
;
$data
[
'create_ip'
]
=
get_client_ip
(
1
);
$data
[
'create_ip'
]
=
get_client_ip
(
0
);
//业务逻辑处理
$result_up
=
Db
::
name
(
"esop_plan"
)
->
insert
(
$data
);
if
(
$result_up
===
1
)
{
...
...
application/money/admin/Esopplanrecord.php
View file @
a5d8bd78
...
...
@@ -112,7 +112,7 @@ class EsopplanRecord extends Admin
'type'
=>
1
,
'info'
=>
"自动行权,期权增加"
.
(
$affect
/
100
),
'create_time'
=>
time
(),
'create_ip'
=>
get_client_ip
(
1
)
'create_ip'
=>
get_client_ip
(
0
)
];
EsopPlanRecordModel
::
create
(
$arr
);
}
...
...
application/money/admin/Withdraw.php
View file @
a5d8bd78
...
...
@@ -67,7 +67,9 @@ class Withdraw extends Admin
[
'order_no'
,
'订单号'
],
[
'mobile'
,
'手机号'
],
[
'name'
,
'姓名'
],
[
'money'
,
'金额'
],
[
'money'
,
'申请金额'
],
[
'fee'
,
'手续费'
],
[
'real_money'
,
'到账金额'
],
[
'bank'
,
'银行信息'
],
[
'status'
,
'状态'
],
[
'create_time'
,
'申请时间'
,
'datetime'
],
...
...
application/money/model/EsopPlan.php
View file @
a5d8bd78
...
...
@@ -66,9 +66,10 @@ class EsopPlan extends Model
$data
[
'bank'
]
=
$bank
[
'bank'
]
.
"|"
.
$bank
[
'card'
]
.
'|'
.
$bank
[
'province'
]
.
$bank
[
'city'
]
.
$bank
[
'branch'
]
.
"|"
.
$names
[
'name'
];
$data
[
'mid'
]
=
$parameter
[
'mid'
];
$data
[
'money'
]
=
$parameter
[
'money'
]
*
100
;
$data
[
'fee'
]
=
$parameter
[
'money'
]
*
100
*
config
(
'withdraw_rate'
);
$data
[
'order_no'
]
=
'tx'
.
generate_rand_str
(
10
,
3
);
$data
[
'create_time'
]
=
time
();
$data
[
'create_ip'
]
=
get_client_ip
(
1
);
$data
[
'create_ip'
]
=
get_client_ip
(
0
);
Db
::
startTrans
();
//查看当前期权的信息
...
...
@@ -89,7 +90,7 @@ class EsopPlan extends Model
'type'
=>
3
,
'info'
=>
"期权申请提现,金额:"
.
$parameter
[
'money'
],
'create_time'
=>
time
(),
'create_ip'
=>
get_client_ip
(
1
)
'create_ip'
=>
get_client_ip
(
0
)
];
$res2
=
EsopPlanRecordModel
::
create
(
$arr
);
//更新期权信息
...
...
application/money/model/Withdraw.php
View file @
a5d8bd78
<?php
namespace
app\money\model
;
use
think\helper\Hash
;
use
app\money\model\Role
as
RoleModel
;
use
app\money\model\Record
;
use
app\member\model\Bank
as
BankModel
;
use
app\member\model\MemberMessage
as
MemberMessageModel
;
use
think\Model
;
use
think\Db
;
use
think\Exception
;
class
Withdraw
extends
Model
{
namespace
app\money\model
;
use
think\helper\Hash
;
use
app\money\model\Role
as
RoleModel
;
use
app\money\model\Record
;
use
app\member\model\Bank
as
BankModel
;
use
app\member\model\MemberMessage
as
MemberMessageModel
;
use
think\Model
;
use
think\Db
;
use
think\Exception
;
class
Withdraw
extends
Model
{
// 设置当前模型对应的完整数据表名称
protected
$table
=
'__MONEY_WITHDRAW__'
;
...
...
@@ -30,23 +32,22 @@
public
function
getStatusAttr
(
$value
,
$data
)
{
$status
=
[
0
=>
'待处理'
,
1
=>
'成功'
,
2
=>
'失败'
,
3
=>
'退回'
];
$status
=
[
0
=>
'待处理'
,
1
=>
'成功'
,
2
=>
'失败'
,
3
=>
'退回'
];
return
$status
[
$data
[
'status'
]];
}
public
static
function
getAll
(
$map
=
[],
$order
=
''
)
public
static
function
getAll
(
$map
=
[],
$order
=
''
)
{
$data_list
=
self
::
view
(
'money_withdraw'
,
true
)
$data_list
=
self
::
view
(
'money_withdraw'
,
'id,mid,order_no,money,fee,(money-fee) as real_money,status,create_time'
)
->
view
(
'member'
,
'mobile, name, id_card'
,
'member.id=money_withdraw.mid'
,
'left'
)
->
where
(
$map
)
->
order
(
$order
)
->
paginate
()
->
each
(
function
(
$item
,
$key
)
{
->
each
(
function
(
$item
,
$key
)
{
$item
->
money
=
money_convert
(
$item
->
money
);
$item
->
fee
=
money_convert
(
$item
->
fee
);
});
return
$data_list
;
}
/**
...
...
@@ -59,48 +60,46 @@
$status
=
input
(
'post.status'
);
$id
=
input
(
'post.id'
);
$remark
=
input
(
'post.remark'
);
if
(
!
$id
)
{
if
(
!
$id
)
{
return
false
;
}
$withdraw
=
Db
(
'money_withdraw'
)
->
where
(
'id'
,
$id
)
->
find
();
$user_mobile
=
Db
(
'member'
)
->
where
(
'id'
,
$withdraw
[
'mid'
])
->
value
(
'mobile'
);
$user_mobile
=
Db
(
'member'
)
->
where
(
'id'
,
$withdraw
[
'mid'
])
->
value
(
'mobile'
);
$up_withdraw
[
'status'
]
=
$status
;
$up_withdraw
[
'id'
]
=
$id
;
Db
::
startTrans
();
try
{
try
{
$record
=
new
record
;
$money_info
=
Db
(
'money'
)
->
where
(
'id'
,
$withdraw
[
'mid'
])
->
lock
(
true
)
->
find
();
if
(
$status
==
1
){
// 提现通过 减去冻结金额
if
(
$status
==
1
)
{
// 提现通过 减去冻结金额
self
::
sms_withdraw
(
'stock_withdraw_auditing_success'
,
$user_mobile
,
$withdraw
[
'money'
]);
$contents
=
"提现审核通过"
;
self
::
sms_withdraw
(
'stock_withdraw_auditing_success'
,
$user_mobile
,
$withdraw
[
'money'
]);
$contents
=
"提现审核通过"
;
$up_money
[
'freeze'
]
=
bcsub
(
$money_info
[
'freeze'
],
$withdraw
[
'money'
]);
$info
=
"提现单号:"
.
$withdraw
[
'order_no'
];
$info
=
"提现单号:"
.
$withdraw
[
'order_no'
];
$affect
=
$withdraw
[
'money'
];
$type
=
3
;
$account
=
$money_info
[
'account'
];
}
elseif
(
$status
==
2
){
// 提现失败 解冻冻结金额
self
::
sms_withdraw
(
'stock_withdraw_auditing_fail'
,
$user_mobile
,
$withdraw
[
'money'
]);
$contents
=
"提现审核未通过"
;
}
elseif
(
$status
==
2
)
{
// 提现失败 解冻冻结金额
self
::
sms_withdraw
(
'stock_withdraw_auditing_fail'
,
$user_mobile
,
$withdraw
[
'money'
]);
$contents
=
"提现审核未通过"
;
$up_money
[
'freeze'
]
=
bcsub
(
$money_info
[
'freeze'
],
$withdraw
[
'money'
]);
$up_money
[
'account'
]
=
bcadd
(
$money_info
[
'account'
],
$withdraw
[
'money'
]);
$info
=
"解冻金额"
.
(
$withdraw
[
'money'
]
/
100
)
.
"元,提现单号:"
.
$withdraw
[
'order_no'
];
$info
=
"解冻金额"
.
(
$withdraw
[
'money'
]
/
100
)
.
"元,提现单号:"
.
$withdraw
[
'order_no'
];
$affect
=
$withdraw
[
'money'
];
$type
=
4
;
$account
=
$up_money
[
'account'
];
}
elseif
(
$status
==
3
){
// 提现退回 补充可用金额
}
elseif
(
$status
==
3
)
{
// 提现退回 补充可用金额
$up_money
[
'account'
]
=
bcadd
(
$money_info
[
'account'
],
$withdraw
[
'money'
]);
$info
=
"退回金额"
.
(
$withdraw
[
'money'
]
/
100
)
.
"元,提现单号:"
.
$withdraw
[
'order_no'
];
$info
=
"退回金额"
.
(
$withdraw
[
'money'
]
/
100
)
.
"元,提现单号:"
.
$withdraw
[
'order_no'
];
$affect
=
$withdraw
[
'money'
];
$type
=
6
;
$account
=
$up_money
[
'account'
];
}
else
{
}
else
{
return
'状态有误'
;
}
...
...
@@ -108,34 +107,32 @@
$res3
=
$record
->
saveData
(
$withdraw
[
'mid'
],
$affect
,
$account
,
$type
,
$info
);
$res2
=
self
::
update
(
$up_withdraw
);
if
(
$res1
&&
$res2
&&
$res3
)
{
if
(
$res1
&&
$res2
&&
$res3
)
{
Db
::
commit
();
//添加站内信信息
$MemberMessageModel
=
new
MemberMessageModel
();
$MemberMessageModel
->
addInnerMsg
(
$withdraw
[
'mid'
],
'提现审核通知'
,
$contents
);
//站内信
}
else
{
$MemberMessageModel
->
addInnerMsg
(
$withdraw
[
'mid'
],
'提现审核通知'
,
$contents
);
//站内信
}
else
{
Db
::
rollback
();
return
'数据更新失败'
;
}
}
catch
(
\Exception
$e
){
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
$e
->
getMessage
();
}
$mobile
=
Db
(
'member'
)
->
where
(
'id'
,
$withdraw
[
'mid'
])
->
value
(
'mobile'
);
$details
=
$mobile
.
' 字段(status),原值:(0)新值:('
.
$status
.
') 备注:'
.
$remark
.
$info
;
$details
=
$mobile
.
' 字段(status),原值:(0)新值:('
.
$status
.
') 备注:'
.
$remark
.
$info
;
action_log
(
'withdraw_edit'
,
'money_withdraw'
,
$id
,
UID
,
$details
);
return
true
;
}
static
public
function
sms_withdraw
(
$type
,
$mobile
,
$money
){
$contentarr
=
getconfigSms_status
([
'name'
=>
$type
]);
$content
=
str_replace
(
array
(
"#var#"
,
"#amount#"
),
array
(
$mobile
,
money_convert
(
$money
)),
$contentarr
[
'value'
]);
$res
=
false
;
if
(
$contentarr
[
'status'
]
==
1
){
$res
=
sendsms_mandao
(
$mobile
,
$content
,
''
);
static
public
function
sms_withdraw
(
$type
,
$mobile
,
$money
)
{
$contentarr
=
getconfigSms_status
([
'name'
=>
$type
]);
$content
=
str_replace
(
array
(
"#var#"
,
"#amount#"
),
array
(
$mobile
,
money_convert
(
$money
)),
$contentarr
[
'value'
]);
$res
=
false
;
if
(
$contentarr
[
'status'
]
==
1
)
{
$res
=
sendsms_mandao
(
$mobile
,
$content
,
''
);
}
return
$res
;
}
...
...
@@ -143,15 +140,16 @@
{
$bank_id
=
$parameter
[
'bank_id'
];
$bank
=
BankModel
::
bankInfo
(
$bank_id
);
$where1
[
'id'
]
=
$parameter
[
'mid'
];
//会员ID
$where1
[
'status'
]
=
1
;
//会员状态
$where1
[
'id'
]
=
$parameter
[
'mid'
];
//会员ID
$where1
[
'status'
]
=
1
;
//会员状态
$names
=
Db
::
name
(
'member'
)
->
field
(
'name'
)
->
where
(
$where1
)
->
find
();
$data
[
'bank'
]
=
$bank
[
'bank'
]
.
"|"
.
$bank
[
'card'
]
.
'|'
.
$bank
[
'province'
]
.
$bank
[
'city'
]
.
$bank
[
'branch'
]
.
"|"
.
$names
[
'name'
];
$data
[
'bank'
]
=
$bank
[
'bank'
]
.
"|"
.
$bank
[
'card'
]
.
'|'
.
$bank
[
'province'
]
.
$bank
[
'city'
]
.
$bank
[
'branch'
]
.
"|"
.
$names
[
'name'
];
$data
[
'mid'
]
=
$parameter
[
'mid'
];
$data
[
'money'
]
=
$parameter
[
'money'
]
*
100
;
$data
[
'order_no'
]
=
'tx'
.
generate_rand_str
(
10
,
3
);
$data
[
'money'
]
=
$parameter
[
'money'
]
*
100
;
$data
[
'fee'
]
=
$parameter
[
'money'
]
*
100
*
config
(
'withdraw_rate'
);
$data
[
'order_no'
]
=
'tx'
.
generate_rand_str
(
10
,
3
);
$data
[
'create_time'
]
=
time
();
$data
[
'create_ip'
]
=
get_client_ip
(
1
);
...
...
@@ -163,23 +161,21 @@
$up_money
[
'freeze'
]
=
bcadd
(
$money_info
[
'freeze'
],
$data
[
'money'
]);
$up_money
[
'account'
]
=
$account
;
$info
=
"提现冻结金额"
.
(
$data
[
'money'
]
/
100
)
.
"元,提现单号:"
.
$data
[
'order_no'
];
try
{
$info
=
"提现冻结金额"
.
(
$data
[
'money'
]
/
100
)
.
"元,提现单号:"
.
$data
[
'order_no'
];
try
{
$res1
=
self
::
create
(
$data
);
$res2
=
$record
->
saveData
(
$data
[
'mid'
],
-
$data
[
'money'
],
$account
,
2
,
$info
);
$res3
=
Db
(
'money'
)
->
where
(
'mid'
,
$data
[
'mid'
])
->
update
(
$up_money
);
if
(
$res1
&&
$res2
&&
$res3
)
{
if
(
$res1
&&
$res2
&&
$res3
)
{
Db
::
commit
();
return
[
'status'
=>
1
,
'message'
=>
'提交成功'
];
}
else
{
return
[
'status'
=>
1
,
'message'
=>
'提交成功'
];
}
else
{
Db
::
rollback
();
return
[
'status'
=>
0
,
'message'
=>
'提交失败'
];
return
[
'status'
=>
0
,
'message'
=>
'提交失败'
];
}
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
[
'status'
=>
0
,
'message'
=>
'数据异常'
];
}
return
[
'status'
=>
0
,
'message'
=>
'数据异常'
];
}
}
?>
}
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