Completed
Push — master ( 6e6af4...326a90 )
by Xu
1073:18 queued 1033:19
created
src/helpers/UploadHelper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/user/models/User.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/trade/migrations/m180315_104659_create_trade_refunds_table.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@
 block discarded – undo
21 21
         }
22 22
         $this->createTable($this->tableName, [
23 23
             'id' => $this->bigPrimaryKey(),
24
-            'amount' => $this->unsignedInteger()->notNull(),//退款金额大于 0, 单位为对应币种的最小货币单位,例如:人民币为分(如退款金额为 1 元,此处请填 100)。必须小于等于可退款金额,默认为全额退款。
25
-            'succeed' => $this->boolean()->defaultValue(false),//退款是否成功。
26
-            'status' => $this->string(10)->defaultValue('pending'),//退款状态(目前支持三种状态: pending: 处理中; succeeded: 成功; failed: 失败)。
27
-            'time_succeed' => $this->unixTimestamp(),//退款成功的时间,用 Unix 时间戳表示。
28
-            'description' => $this->string(255)->notNull(),//退款详情,最多 255 个 Unicode 字符。
29
-            'failure_code' => $this->string(),//退款的错误码,详见 错误 中的错误码。
30
-            'failure_msg' => $this->string(),//退款消息的描述。
24
+            'amount' => $this->unsignedInteger()->notNull(), //退款金额大于 0, 单位为对应币种的最小货币单位,例如:人民币为分(如退款金额为 1 元,此处请填 100)。必须小于等于可退款金额,默认为全额退款。
25
+            'succeed' => $this->boolean()->defaultValue(false), //退款是否成功。
26
+            'status' => $this->string(10)->defaultValue('pending'), //退款状态(目前支持三种状态: pending: 处理中; succeeded: 成功; failed: 失败)。
27
+            'time_succeed' => $this->unixTimestamp(), //退款成功的时间,用 Unix 时间戳表示。
28
+            'description' => $this->string(255)->notNull(), //退款详情,最多 255 个 Unicode 字符。
29
+            'failure_code' => $this->string(), //退款的错误码,详见 错误 中的错误码。
30
+            'failure_msg' => $this->string(), //退款消息的描述。
31 31
             //'metadata',
32
-            'charge_id' => $this->string(50)->notNull(),//支付  charge 对象的  id
33
-            'charge_order_no' => $this->string(64),//商户订单号,这边返回的是  charge 对象中的  order_no 参数。
34
-            'transaction_no' => $this->string(64),//支付渠道返回的交易流水号,部分渠道返回该字段为空。
35
-            'funding_source' => $this->string(20),//微信及 QQ 类退款资金来源。取值范围: unsettled_funds :使用未结算资金退款; recharge_funds :微信-使用可用余额退款,QQ-使用可用现金账户资金退款。注:默认值  unsettled_funds ,该参数对于微信渠道的退款来说仅适用于微信老资金流商户使用,包括  wx 、 wx_pub 、 wx_pub_qr 、 wx_lite 、 wx_wap 、 wx_pub_scan 六个渠道;新资金流退款资金默认从基本账户中扣除。该参数仅在请求退款,传入该字段时返回。
32
+            'charge_id' => $this->string(50)->notNull(), //支付  charge 对象的  id
33
+            'charge_order_no' => $this->string(64), //商户订单号,这边返回的是  charge 对象中的  order_no 参数。
34
+            'transaction_no' => $this->string(64), //支付渠道返回的交易流水号,部分渠道返回该字段为空。
35
+            'funding_source' => $this->string(20), //微信及 QQ 类退款资金来源。取值范围: unsettled_funds :使用未结算资金退款; recharge_funds :微信-使用可用余额退款,QQ-使用可用现金账户资金退款。注:默认值  unsettled_funds ,该参数对于微信渠道的退款来说仅适用于微信老资金流商户使用,包括  wx 、 wx_pub 、 wx_pub_qr 、 wx_lite 、 wx_wap 、 wx_pub_scan 六个渠道;新资金流退款资金默认从基本账户中扣除。该参数仅在请求退款,传入该字段时返回。
36 36
             //'extra',
37 37
             'created_at' => $this->unixTimestamp(),
38 38
         ], $tableOptions);
Please login to merge, or discard this patch.
src/trade/models/TradeCharges.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
                 'attributes' => [
60 60
                     ActiveRecord::EVENT_BEFORE_INSERT => 'id',
61 61
                 ],
62
-                'value' => function ($event) {
62
+                'value' => function($event) {
63 63
                     return $event->sender->generateId();
64 64
                 }
65 65
             ],
Please login to merge, or discard this patch.
src/payment/Channel.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -26,23 +26,23 @@
 block discarded – undo
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 连接超时时间
Please login to merge, or discard this patch.
src/payment/channels/WeChat.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
      * @var array 交易类型和Trade映射
71 71
      */
72 72
     public $tradeTypeMap = [
73
-        self::TRADE_TYPE_QR_CODE => 'NATIVE',//WEB 原生扫码支付
74
-        self::TRADE_TYPE_JS_API => 'JSAPI',//应用内JS API,如微信
75
-        self::TRADE_TYPE_APP => 'APP',//app支付
76
-        self::TRADE_TYPE_WAP => 'MWEB',//H5支付
77
-        self::TRADE_TYPE_POS => 'MICROPAY',//刷卡支付
73
+        self::TRADE_TYPE_QR_CODE => 'NATIVE', //WEB 原生扫码支付
74
+        self::TRADE_TYPE_JS_API => 'JSAPI', //应用内JS API,如微信
75
+        self::TRADE_TYPE_APP => 'APP', //app支付
76
+        self::TRADE_TYPE_WAP => 'MWEB', //H5支付
77
+        self::TRADE_TYPE_POS => 'MICROPAY', //刷卡支付
78 78
         self::TRADE_TYPE_WEB => 'NATIVE'//PC支付
79 79
     ];
80 80
 
@@ -89,19 +89,19 @@  discard block
 block discarded – undo
89 89
             trigger_error('need openssl support sha256', E_USER_ERROR);
90 90
         }
91 91
         if (empty ($this->appId)) {
92
-            throw new InvalidConfigException ('The "appId" property must be set.');
92
+            throw new InvalidConfigException('The "appId" property must be set.');
93 93
         }
94 94
         if (empty ($this->apiKey)) {
95
-            throw new InvalidConfigException ('The "apiKey" property must be set.');
95
+            throw new InvalidConfigException('The "apiKey" property must be set.');
96 96
         }
97 97
         if (empty ($this->mchId)) {
98
-            throw new InvalidConfigException ('The "mchId" property must be set.');
98
+            throw new InvalidConfigException('The "mchId" property must be set.');
99 99
         }
100 100
         if (empty ($this->privateKey)) {
101
-            throw new InvalidConfigException ('The "privateKey" property must be set.');
101
+            throw new InvalidConfigException('The "privateKey" property must be set.');
102 102
         }
103 103
         if (empty ($this->publicKey)) {
104
-            throw new InvalidConfigException ('The "publicKey" property must be set.');
104
+            throw new InvalidConfigException('The "publicKey" property must be set.');
105 105
         }
106 106
         $this->initPrivateKey();
107 107
         $this->initPublicKey();
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 $weParams = $trade->user->socialAccounts['wechat']->getDecodedData();
140 140
                 $data['openid'] = $weParams['openid'];
141 141
             } else {
142
-                throw new PaymentException ('Non-WeChat authorized login.');
142
+                throw new PaymentException('Non-WeChat authorized login.');
143 143
             }
144 144
         }
145 145
         $response = $this->post('pay/unifiedorder', $data)->send();
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
                 throw new PaymentException($response->data['return_msg']);
152 152
             }
153 153
         } else {
154
-            throw new Exception ('Http request failed.');
154
+            throw new Exception('Http request failed.');
155 155
         }
156 156
     }
157 157
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         } elseif ($this->signType == self::SIGNATURE_METHOD_SHA256) {
243 243
             $sign = hash_hmac('sha256', $bizString, $this->apiKey);
244 244
         } else {
245
-            throw new InvalidConfigException ('This encryption is not supported');
245
+            throw new InvalidConfigException('This encryption is not supported');
246 246
         }
247 247
         return strtoupper($sign);
248 248
     }
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
                 throw new InvalidConfigException(openssl_error_string());
272 272
             }
273 273
         } else {
274
-            throw new InvalidConfigException ('The "privateKey" property must be set.');
274
+            throw new InvalidConfigException('The "privateKey" property must be set.');
275 275
         }
276 276
     }
277 277
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                 throw new InvalidConfigException(openssl_error_string());
289 289
             }
290 290
         } else {
291
-            throw new InvalidConfigException ('The "publicKey" property must be set.');
291
+            throw new InvalidConfigException('The "publicKey" property must be set.');
292 292
         }
293 293
     }
294 294
 }
295 295
\ No newline at end of file
Please login to merge, or discard this patch.
src/payment/channels/Alipay.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@
 block discarded – undo
57 57
             trigger_error('need openssl support sha256', E_USER_ERROR);
58 58
         }
59 59
         if (empty ($this->appId)) {
60
-            throw new InvalidConfigException ('The "appId" property must be set.');
60
+            throw new InvalidConfigException('The "appId" property must be set.');
61 61
         }
62 62
         if (empty ($this->privateKey)) {
63
-            throw new InvalidConfigException ('The "privateKey" property must be set.');
63
+            throw new InvalidConfigException('The "privateKey" property must be set.');
64 64
         }
65 65
         if (empty ($this->publicKey)) {
66
-            throw new InvalidConfigException ('The "publicKey" property must be set.');
66
+            throw new InvalidConfigException('The "publicKey" property must be set.');
67 67
         }
68 68
         $this->initPrivateKey();
69 69
         $this->initPublicKey();
Please login to merge, or discard this patch.
src/trade/migrations/m180315_104011_create_trade_charges_table.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -22,27 +22,27 @@
 block discarded – undo
22 22
 
23 23
         $this->createTable($this->tableName, [
24 24
             'id' => $this->string(50)->notNull()->comment('ID'),
25
-            'paid' => $this->boolean()->defaultValue(false),//boolean 是否已付款
26
-            'refunded' => $this->boolean()->defaultValue(false),//boolean 是否存在退款信息
27
-            'reversed' => $this->boolean()->defaultValue(false),//boolean 订单是否撤销
28
-            'channel' => $this->string(50)->notNull(),//付款渠道
29
-            'order_no' => $this->string()->notNull(),//商户订单号,适配每个渠道对此参数的要求,必须在商户的系统内唯一
30
-            'amount' => $this->unsignedInteger()->notNull(),//订单总金额(必须大于 0),单位为对应币种的最小货币单位,人民币为分
31
-            'currency' => $this->string(3)->notNull(),//3 位 ISO 货币代码,人民币为  cny 。
32
-            'subject' => $this->string(32)->notNull(),//商品标题,该参数最长为 32 个 Unicode 字符
33
-            'body' => $this->string(128)->notNull(),//商品描述信息,该参数最长为 128 个 Unicode 字符
34
-            'client_ip' => $this->ipAddress(),//发起支付请求客户端的 IP 地址
25
+            'paid' => $this->boolean()->defaultValue(false), //boolean 是否已付款
26
+            'refunded' => $this->boolean()->defaultValue(false), //boolean 是否存在退款信息
27
+            'reversed' => $this->boolean()->defaultValue(false), //boolean 订单是否撤销
28
+            'channel' => $this->string(50)->notNull(), //付款渠道
29
+            'order_no' => $this->string()->notNull(), //商户订单号,适配每个渠道对此参数的要求,必须在商户的系统内唯一
30
+            'amount' => $this->unsignedInteger()->notNull(), //订单总金额(必须大于 0),单位为对应币种的最小货币单位,人民币为分
31
+            'currency' => $this->string(3)->notNull(), //3 位 ISO 货币代码,人民币为  cny 。
32
+            'subject' => $this->string(32)->notNull(), //商品标题,该参数最长为 32 个 Unicode 字符
33
+            'body' => $this->string(128)->notNull(), //商品描述信息,该参数最长为 128 个 Unicode 字符
34
+            'client_ip' => $this->ipAddress(), //发起支付请求客户端的 IP 地址
35 35
             //'extra',//特定渠道发起交易时需要的额外参数,以及部分渠道支付成功返回的额外参数
36
-            'time_paid' => $this->unixTimestamp(),//订单支付完成时的 Unix 时间戳。(银联支付成功时间为接收异步通知的时间)
37
-            'time_expire' => $this->unixTimestamp(),//订单失效时间
38
-            'transaction_no' => $this->string(64),//支付渠道返回的交易流水号。
36
+            'time_paid' => $this->unixTimestamp(), //订单支付完成时的 Unix 时间戳。(银联支付成功时间为接收异步通知的时间)
37
+            'time_expire' => $this->unixTimestamp(), //订单失效时间
38
+            'transaction_no' => $this->string(64), //支付渠道返回的交易流水号。
39 39
             //'refunds',//退款详情列表
40
-            'amount_refunded' => $this->unsignedInteger()->notNull()->defaultValue(0),//已退款总金额,单位为对应币种的最小货币单位,例如:人民币为分。
41
-            'failure_code' => $this->string(),//订单的错误码
42
-            'failure_msg' => $this->string(),//订单的错误消息的描述。
40
+            'amount_refunded' => $this->unsignedInteger()->notNull()->defaultValue(0), //已退款总金额,单位为对应币种的最小货币单位,例如:人民币为分。
41
+            'failure_code' => $this->string(), //订单的错误码
42
+            'failure_msg' => $this->string(), //订单的错误消息的描述。
43 43
             'metadata' => $this->text(),
44 44
             // 'credential',//支付凭证,用于客户端发起支付。
45
-            'description' => $this->string(255),//订单附加说明,最多 255 个 Unicode 字符。
45
+            'description' => $this->string(255), //订单附加说明,最多 255 个 Unicode 字符。
46 46
             'created_at' => $this->unixTimestamp(),
47 47
         ], $tableOptions);
48 48
     }
Please login to merge, or discard this patch.