UserWalletApply.php
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace addons\groupon\controller;
class UserWalletApply extends Base
{
protected $noNeedLogin = ['rule'];
protected $noNeedRight = ['*'];
public function index()
{
$this->success('提现记录', \addons\groupon\model\UserWalletApply::getList());
}
public function apply () {
repeat_filter(); // 防抖
$type = $this->request->post('type');
$money = $this->request->post('money');
$apply = \addons\groupon\model\UserWalletApply::apply($type, $money);
if ($apply) {
$this->success('申请成功');
}
$this->error('申请失败');
}
public function rule () {
// 提现规则
$config = \addons\groupon\model\UserWalletApply::getWithdrawConfig();
$min = round(floatval($config['min']), 2);
$max = round(floatval($config['max']), 2);
$service_fee = floatval($config['service_fee']) * 100;
$service_fee = round($service_fee, 1); // 1 位小数
$rule = [
'min' => $min,
'max' => $max,
'service_fee' => $service_fee,
'methods' => $config['methods'] ?? []
];
$this->success('提现规则', $rule);
}
}