1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Vicens\Alidayu\Request; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* 流量直充 |
7
|
|
|
* @link https://api.alidayu.com/docs/api.htm?apiId=26306 |
8
|
|
|
* @method $this|string phoneNum(string | null $phoneNum = null) |
9
|
|
|
* @method $this|string grade(string | null $grade = null) |
10
|
|
|
* @method $this|string outRechargeId(string | null $outRechargeId = null) |
11
|
|
|
* @method $this|int scope(int | null $scope = null) |
12
|
|
|
* @method $this|boolean isProvince(boolean | null $isProvince = null) |
13
|
|
|
* @method $this|string reason(string | null $reason = null) |
14
|
|
|
*/ |
15
|
|
|
class FlowCharge extends AbstractRequest |
16
|
|
|
{ |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* FlowCharge constructor. |
20
|
|
|
* @param string $phoneNum 手机号 |
21
|
|
|
* @param int $grade 充值数量 |
22
|
|
|
* @param string $outRechargeId 唯一流水号 |
23
|
|
|
* @param int $scope 0:全国漫游流量 1:省内流量 |
24
|
|
|
* @param bool $isProvince 是否分省通道(scope为0时生效) |
25
|
|
|
* @param string $reason 充值原因 |
26
|
|
|
*/ |
27
|
|
|
public function __construct($phoneNum, $grade, $outRechargeId, $scope = 0, $isProvince = false, $reason = '') |
28
|
|
|
{ |
29
|
|
|
$this->setParams([ |
30
|
|
|
'phone_num' => $phoneNum, |
31
|
|
|
'grade' => $grade, |
32
|
|
|
'out_recharge_id' => $outRechargeId, |
33
|
|
|
'scope' => $scope, |
34
|
|
|
'is_province' => $isProvince, |
35
|
|
|
'reason' => $reason |
36
|
|
|
]); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* 返回接口所需参数 |
41
|
|
|
* @return array |
42
|
|
|
*/ |
43
|
|
|
public function getParams() |
44
|
|
|
{ |
45
|
|
|
$params = parent::getParams(); |
46
|
|
|
|
47
|
|
|
$params['is_province'] = $params['is_province'] ? 'true' : 'false'; |
48
|
|
|
|
49
|
|
|
return $params; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* 返回接口名 |
54
|
|
|
* @return string |
55
|
|
|
*/ |
56
|
|
|
public function getMethod() |
57
|
|
|
{ |
58
|
|
|
return 'alibaba.aliqin.fc.flow.charge'; |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|