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
<?php
namespace addons\shopro\controller;
class UserWalletApply extends Base
{
protected $noNeedLogin = ['rule'];
protected $noNeedRight = ['*'];
public function index()
{
$this->success('提现记录', \addons\shopro\model\UserWalletApply::getList());
}
public function apply () {
$params = $this->request->post();
$this->success('申请成功', \addons\shopro\model\UserWalletApply::apply($params));
}
public function rule () {
// 提现规则
$config = \addons\shopro\model\Config::where('name', 'withdraw')->find();
$config = json_decode($config['value'], true);
$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 = '提现金额必须';
if ($max) {
$rule .= '在' . $min . '-' . $max . '元之间';
} else {
$rule .= '大于' . ($min >= 0 ? $min : 0);
}
if ($service_fee) {
$rule .= ',提现手续费为提现金额的 '. $service_fee . '%';
}
$this->success('获取成功', $rule);
}
}