@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public static function getImageMaxSizeByte() |
48 | 48 | { |
49 | - $imageMaxSize = Yii::$app->getSettings()->get('imageMaxSize','attachment'); |
|
49 | + $imageMaxSize = Yii::$app->getSettings()->get('imageMaxSize', 'attachment'); |
|
50 | 50 | return self::getMaxUploadByte($imageMaxSize); |
51 | 51 | } |
52 | 52 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public static function getVideoMaxSizeByte() |
58 | 58 | { |
59 | - $videoMaxSize = Yii::$app->getSettings()->get('videoMaxSize','attachment'); |
|
59 | + $videoMaxSize = Yii::$app->getSettings()->get('videoMaxSize', 'attachment'); |
|
60 | 60 | return self::getMaxUploadByte($videoMaxSize); |
61 | 61 | } |
62 | 62 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public static function getFileMaxSizeByte() |
68 | 68 | { |
69 | - $fileMaxSize = Yii::$app->getSettings()->get('fileMaxSize','attachment'); |
|
69 | + $fileMaxSize = Yii::$app->getSettings()->get('fileMaxSize', 'attachment'); |
|
70 | 70 | return self::getMaxUploadByte($fileMaxSize); |
71 | 71 | } |
72 | 72 | |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public static function getAcceptImageMimeTypes() |
78 | 78 | { |
79 | - $imageAllowFiles = Yii::$app->getSettings()->get('imageAllowFiles','attachment'); |
|
79 | + $imageAllowFiles = Yii::$app->getSettings()->get('imageAllowFiles', 'attachment'); |
|
80 | 80 | $extensions = explode(',', $imageAllowFiles); |
81 | - array_walk($extensions, function (&$value) { |
|
81 | + array_walk($extensions, function(&$value) { |
|
82 | 82 | $value = 'image/' . $value; |
83 | 83 | }); |
84 | 84 | return $extensions; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | public static function normalizeExtension($extensions) |
94 | 94 | { |
95 | 95 | $extensions = explode(',', $extensions); |
96 | - array_walk($extensions, function (&$value) { |
|
96 | + array_walk($extensions, function(&$value) { |
|
97 | 97 | $value = '.' . $value; |
98 | 98 | }); |
99 | 99 | return $extensions; |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | const AFTER_REGISTER = 'afterRegister'; |
49 | 49 | |
50 | 50 | //场景定义 |
51 | - const SCENARIO_CREATE = 'create';//后台或控制台创建用户 |
|
52 | - const SCENARIO_UPDATE = 'update';//后台或控制台修改用户 |
|
53 | - const SCENARIO_REGISTER = 'basic_create';//邮箱注册 |
|
54 | - const SCENARIO_EMAIL_REGISTER = 'email_create';//邮箱注册 |
|
55 | - const SCENARIO_MOBILE_REGISTER = 'mobile_create';//手机号注册 |
|
56 | - const SCENARIO_SETTINGS = 'settings';//更新 |
|
57 | - const SCENARIO_CONNECT = 'connect';//账户链接或自动注册新用户 |
|
51 | + const SCENARIO_CREATE = 'create'; //后台或控制台创建用户 |
|
52 | + const SCENARIO_UPDATE = 'update'; //后台或控制台修改用户 |
|
53 | + const SCENARIO_REGISTER = 'basic_create'; //邮箱注册 |
|
54 | + const SCENARIO_EMAIL_REGISTER = 'email_create'; //邮箱注册 |
|
55 | + const SCENARIO_MOBILE_REGISTER = 'mobile_create'; //手机号注册 |
|
56 | + const SCENARIO_SETTINGS = 'settings'; //更新 |
|
57 | + const SCENARIO_CONNECT = 'connect'; //账户链接或自动注册新用户 |
|
58 | 58 | const SCENARIO_PASSWORD = 'password'; |
59 | 59 | |
60 | 60 | /** |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | static::SCENARIO_EMAIL_REGISTER => ['nickname', 'email', 'password'], |
96 | 96 | static::SCENARIO_MOBILE_REGISTER => ['mobile', 'password'], |
97 | 97 | static::SCENARIO_SETTINGS => ['username', 'email', 'password'], |
98 | - static::SCENARIO_CONNECT => ['nickname', 'email', 'password'],//链接账户密码可以为空邮箱可以为空 |
|
99 | - static::SCENARIO_PASSWORD => ['password'],//只修改密码 |
|
98 | + static::SCENARIO_CONNECT => ['nickname', 'email', 'password'], //链接账户密码可以为空邮箱可以为空 |
|
99 | + static::SCENARIO_PASSWORD => ['password'], //只修改密码 |
|
100 | 100 | ]); |
101 | 101 | } |
102 | 102 |
@@ -26,23 +26,23 @@ |
||
26 | 26 | const DEFAULT_TIMEOUT = 5.0; |
27 | 27 | |
28 | 28 | //交易类型 |
29 | - const TRADE_TYPE_QR_CODE = 'qr-code';//扫码支付 |
|
30 | - const TRADE_TYPE_JS_API = 'js-api';//应用内JS API,如微信 |
|
31 | - const TRADE_TYPE_APP = 'app';//app支付 |
|
32 | - const TRADE_TYPE_WAP = 'wap';//H5支付 |
|
33 | - const TRADE_TYPE_WEB = 'web';//PC支付 |
|
34 | - const TRADE_TYPE_POS = 'pos';//刷卡支付 |
|
29 | + const TRADE_TYPE_QR_CODE = 'qr-code'; //扫码支付 |
|
30 | + const TRADE_TYPE_JS_API = 'js-api'; //应用内JS API,如微信 |
|
31 | + const TRADE_TYPE_APP = 'app'; //app支付 |
|
32 | + const TRADE_TYPE_WAP = 'wap'; //H5支付 |
|
33 | + const TRADE_TYPE_WEB = 'web'; //PC支付 |
|
34 | + const TRADE_TYPE_POS = 'pos'; //刷卡支付 |
|
35 | 35 | |
36 | 36 | //交易状态 |
37 | - const STATE_NOT_PAY = 0b0;//未支付 |
|
38 | - const STATE_SUCCESS = 0b1;//支付成功 |
|
39 | - const STATE_FAILED = 0b10;//支付失败 |
|
40 | - const STATE_CLOSED = 0b100;//已关闭 |
|
41 | - const STATE_REVOKED = 0b101;//已撤销 |
|
42 | - const STATE_ERROR = 0b110;//错误 |
|
43 | - const STATE_REFUND = 0b111;//转入退款 |
|
44 | - const STATE_REFUND_SUCCESS = 0b11;//转入退款 |
|
45 | - const STATE_REFUND_FAILED = 0b11;//转入退款 |
|
37 | + const STATE_NOT_PAY = 0b0; //未支付 |
|
38 | + const STATE_SUCCESS = 0b1; //支付成功 |
|
39 | + const STATE_FAILED = 0b10; //支付失败 |
|
40 | + const STATE_CLOSED = 0b100; //已关闭 |
|
41 | + const STATE_REVOKED = 0b101; //已撤销 |
|
42 | + const STATE_ERROR = 0b110; //错误 |
|
43 | + const STATE_REFUND = 0b111; //转入退款 |
|
44 | + const STATE_REFUND_SUCCESS = 0b11; //转入退款 |
|
45 | + const STATE_REFUND_FAILED = 0b11; //转入退款 |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * @var float 连接超时时间 |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | * @var array 交易类型和Trade映射 |
72 | 72 | */ |
73 | 73 | public $tradeTypeMap = [ |
74 | - self::TRADE_TYPE_QR_CODE => 'NATIVE',//WEB 原生扫码支付 |
|
75 | - self::TRADE_TYPE_JS_API => 'JSAPI',//应用内JS API,如微信 |
|
76 | - self::TRADE_TYPE_APP => 'APP',//app支付 |
|
77 | - self::TRADE_TYPE_WAP => 'MWEB',//H5支付 |
|
78 | - self::TRADE_TYPE_POS => 'MICROPAY',//刷卡支付 |
|
74 | + self::TRADE_TYPE_QR_CODE => 'NATIVE', //WEB 原生扫码支付 |
|
75 | + self::TRADE_TYPE_JS_API => 'JSAPI', //应用内JS API,如微信 |
|
76 | + self::TRADE_TYPE_APP => 'APP', //app支付 |
|
77 | + self::TRADE_TYPE_WAP => 'MWEB', //H5支付 |
|
78 | + self::TRADE_TYPE_POS => 'MICROPAY', //刷卡支付 |
|
79 | 79 | self::TRADE_TYPE_WEB => 'NATIVE'//PC支付 |
80 | 80 | ]; |
81 | 81 | |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | trigger_error('need openssl support sha256', E_USER_ERROR); |
91 | 91 | } |
92 | 92 | if (empty ($this->appId)) { |
93 | - throw new InvalidConfigException ('The "appId" property must be set.'); |
|
93 | + throw new InvalidConfigException('The "appId" property must be set.'); |
|
94 | 94 | } |
95 | 95 | if (empty ($this->apiKey)) { |
96 | - throw new InvalidConfigException ('The "apiKey" property must be set.'); |
|
96 | + throw new InvalidConfigException('The "apiKey" property must be set.'); |
|
97 | 97 | } |
98 | 98 | if (empty ($this->mchId)) { |
99 | - throw new InvalidConfigException ('The "mchId" property must be set.'); |
|
99 | + throw new InvalidConfigException('The "mchId" property must be set.'); |
|
100 | 100 | } |
101 | 101 | if (empty ($this->privateKey)) { |
102 | - throw new InvalidConfigException ('The "privateKey" property must be set.'); |
|
102 | + throw new InvalidConfigException('The "privateKey" property must be set.'); |
|
103 | 103 | } |
104 | 104 | if (empty ($this->publicKey)) { |
105 | - throw new InvalidConfigException ('The "publicKey" property must be set.'); |
|
105 | + throw new InvalidConfigException('The "publicKey" property must be set.'); |
|
106 | 106 | } |
107 | 107 | $this->initPrivateKey(); |
108 | 108 | $this->initPublicKey(); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | protected function initPrivateKey() |
116 | 116 | { |
117 | 117 | $privateKey = Yii::getAlias($this->privateKey); |
118 | - if (!is_file ($privateKey)) { |
|
118 | + if (!is_file($privateKey)) { |
|
119 | 119 | $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" . |
120 | 120 | wordwrap($this->privateKey, 64, "\n", true) . |
121 | 121 | "\n-----END RSA PRIVATE KEY-----"; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $weParams = $trade->user->socialAccounts['wechat']->getDecodedData(); |
181 | 181 | $data['openid'] = $weParams['openid']; |
182 | 182 | } else { |
183 | - throw new PaymentException ('Non-WeChat authorized login.'); |
|
183 | + throw new PaymentException('Non-WeChat authorized login.'); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | $response = $this->post('pay/unifiedorder', $data)->send(); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | throw new PaymentException($response->data['return_msg']); |
193 | 193 | } |
194 | 194 | } else { |
195 | - throw new Exception ('Http request failed.'); |
|
195 | + throw new Exception('Http request failed.'); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | } elseif ($this->signType == self::SIGNATURE_METHOD_SHA256) { |
257 | 257 | $sign = hash_hmac('sha256', $this->getSignatureContent($params), $this->apiKey); |
258 | 258 | } else { |
259 | - throw new InvalidConfigException ('This encryption is not supported'); |
|
259 | + throw new InvalidConfigException('This encryption is not supported'); |
|
260 | 260 | } |
261 | 261 | return strtoupper($sign); |
262 | 262 | } |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | trigger_error('need openssl support sha256', E_USER_ERROR); |
64 | 64 | } |
65 | 65 | if (empty ($this->appId)) { |
66 | - throw new InvalidConfigException ('The "appId" property must be set.'); |
|
66 | + throw new InvalidConfigException('The "appId" property must be set.'); |
|
67 | 67 | } |
68 | 68 | if (empty ($this->privateKey)) { |
69 | - throw new InvalidConfigException ('The "privateKey" property must be set.'); |
|
69 | + throw new InvalidConfigException('The "privateKey" property must be set.'); |
|
70 | 70 | } |
71 | 71 | if (empty ($this->publicKey)) { |
72 | - throw new InvalidConfigException ('The "publicKey" property must be set.'); |
|
72 | + throw new InvalidConfigException('The "publicKey" property must be set.'); |
|
73 | 73 | } |
74 | 74 | $this->initPrivateKey(); |
75 | 75 | $this->initPublicKey(); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } elseif ($this->signType == self::SIGNATURE_METHOD_RSA) { |
139 | 139 | $sign = openssl_sign($this->getSignatureContent($params), $sign, $this->privateKey, OPENSSL_ALGO_SHA1) ? base64_encode($sign) : null; |
140 | 140 | } else { |
141 | - throw new InvalidConfigException ('This encryption is not supported'); |
|
141 | + throw new InvalidConfigException('This encryption is not supported'); |
|
142 | 142 | } |
143 | 143 | return $sign; |
144 | 144 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | public function rules() |
65 | 65 | { |
66 | 66 | return [ |
67 | - [[ 'model_id'], 'required'], |
|
67 | + [['model_id'], 'required'], |
|
68 | 68 | [['user_id', 'model_id'], 'integer'], |
69 | 69 | [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::class, 'targetAttribute' => ['user_id' => 'id']], |
70 | 70 | ]; |