@@ -22,11 +22,11 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function register(Container $pimple) |
| 24 | 24 | { |
| 25 | - $pimple['material'] = function ($pimple) { |
|
| 25 | + $pimple['material'] = function($pimple) { |
|
| 26 | 26 | return new Material($pimple['access_token']); |
| 27 | 27 | }; |
| 28 | 28 | |
| 29 | - $temporary = function ($pimple) { |
|
| 29 | + $temporary = function($pimple) { |
|
| 30 | 30 | return new Temporary($pimple['access_token']); |
| 31 | 31 | }; |
| 32 | 32 | |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function register(Container $pimple) |
| 31 | 31 | { |
| 32 | - $pimple['suite.ticket'] = function ($pimple) { |
|
| 32 | + $pimple['suite.ticket'] = function($pimple) { |
|
| 33 | 33 | return new Ticket( |
| 34 | 34 | $pimple['config']['suite']['suite_id'], |
| 35 | 35 | $pimple['cache'] |
| 36 | 36 | ); |
| 37 | 37 | }; |
| 38 | 38 | |
| 39 | - $pimple['suite.access_token'] = function ($pimple) { |
|
| 39 | + $pimple['suite.access_token'] = function($pimple) { |
|
| 40 | 40 | $accessToken = new AccessToken( |
| 41 | 41 | $pimple['config']['suite']['suite_id'], |
| 42 | 42 | $pimple['config']['suite']['secret'], |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | return $accessToken; |
| 48 | 48 | }; |
| 49 | 49 | |
| 50 | - $pimple['suite.encryptor'] = function ($pimple) { |
|
| 50 | + $pimple['suite.encryptor'] = function($pimple) { |
|
| 51 | 51 | return new Encryptor( |
| 52 | 52 | $pimple['config']['suite']['suite_id'], |
| 53 | 53 | $pimple['config']['suite']['token'], |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | ); |
| 56 | 56 | }; |
| 57 | 57 | |
| 58 | - $pimple['suite'] = function ($pimple) { |
|
| 58 | + $pimple['suite'] = function($pimple) { |
|
| 59 | 59 | return new Suite($pimple); |
| 60 | 60 | }; |
| 61 | 61 | |
| 62 | - $pimple['suite.server'] = function ($pimple) { |
|
| 62 | + $pimple['suite.server'] = function($pimple) { |
|
| 63 | 63 | $server = new Guard($pimple['config']['suite']['token']); |
| 64 | 64 | $server->debug($pimple['config']['debug']); |
| 65 | 65 | $server->setEncryptor($pimple['suite.encryptor']); |
@@ -73,21 +73,21 @@ discard block |
||
| 73 | 73 | return $server; |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | - $pimple['suite.pre_auth'] = $pimple['suite.pre_authorization'] = function ($pimple) { |
|
| 76 | + $pimple['suite.pre_auth'] = $pimple['suite.pre_authorization'] = function($pimple) { |
|
| 77 | 77 | return new PreAuthorization( |
| 78 | 78 | $pimple['suite.access_token'], |
| 79 | 79 | $pimple['request'] |
| 80 | 80 | ); |
| 81 | 81 | }; |
| 82 | 82 | |
| 83 | - $pimple['suite.api'] = function ($pimple) { |
|
| 83 | + $pimple['suite.api'] = function($pimple) { |
|
| 84 | 84 | return new BaseApi( |
| 85 | 85 | $pimple['suite.access_token'], |
| 86 | 86 | $pimple['request'] |
| 87 | 87 | ); |
| 88 | 88 | }; |
| 89 | 89 | |
| 90 | - $pimple['suite.authorization'] = function ($pimple) { |
|
| 90 | + $pimple['suite.authorization'] = function($pimple) { |
|
| 91 | 91 | return new Authorization( |
| 92 | 92 | $pimple['suite.api'], |
| 93 | 93 | $pimple['config']['suite']['corp_id'], |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ); |
| 96 | 96 | }; |
| 97 | 97 | |
| 98 | - $pimple['suite.authorizer_access_token'] = function ($pimple) { |
|
| 98 | + $pimple['suite.authorizer_access_token'] = function($pimple) { |
|
| 99 | 99 | return new AuthorizerAccessToken( |
| 100 | 100 | $pimple['config']['suite']['corp_id'], |
| 101 | 101 | $pimple['suite.authorization'] |
@@ -103,25 +103,25 @@ discard block |
||
| 103 | 103 | }; |
| 104 | 104 | |
| 105 | 105 | // Authorization events handlers. |
| 106 | - $pimple['suite.handlers.suite_ticket'] = function ($pimple) { |
|
| 106 | + $pimple['suite.handlers.suite_ticket'] = function($pimple) { |
|
| 107 | 107 | return new EventHandlers\SuiteTicket($pimple['suite.ticket']); |
| 108 | 108 | }; |
| 109 | - $pimple['suite.handlers.create_auth'] = function () { |
|
| 109 | + $pimple['suite.handlers.create_auth'] = function() { |
|
| 110 | 110 | return new EventHandlers\CreateAuth(); |
| 111 | 111 | }; |
| 112 | - $pimple['suite.handlers.change_auth'] = function () { |
|
| 112 | + $pimple['suite.handlers.change_auth'] = function() { |
|
| 113 | 113 | return new EventHandlers\ChangeAuth(); |
| 114 | 114 | }; |
| 115 | - $pimple['suite.handlers.cancel_auth'] = function () { |
|
| 115 | + $pimple['suite.handlers.cancel_auth'] = function() { |
|
| 116 | 116 | return new EventHandlers\CancelAuth(); |
| 117 | 117 | }; |
| 118 | 118 | |
| 119 | - $pimple['suite.app'] = function ($pimple) { |
|
| 119 | + $pimple['suite.app'] = function($pimple) { |
|
| 120 | 120 | return new Application($pimple['config']->toArray()); |
| 121 | 121 | }; |
| 122 | 122 | |
| 123 | 123 | // OAuth for Suite. |
| 124 | - $pimple['suite.oauth'] = function ($pimple) { |
|
| 124 | + $pimple['suite.oauth'] = function($pimple) { |
|
| 125 | 125 | return new App($pimple['suite.authorizer_access_token']->getToken()); |
| 126 | 126 | }; |
| 127 | 127 | } |
@@ -22,14 +22,14 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function register(Container $pimple) |
| 24 | 24 | { |
| 25 | - $pimple['js'] = function ($pimple) { |
|
| 25 | + $pimple['js'] = function($pimple) { |
|
| 26 | 26 | $js = new Js($pimple['access_token']); |
| 27 | 27 | $js->setCache($pimple['cache']); |
| 28 | 28 | |
| 29 | 29 | return $js; |
| 30 | 30 | }; |
| 31 | 31 | |
| 32 | - $contact = function ($pimple) { |
|
| 32 | + $contact = function($pimple) { |
|
| 33 | 33 | $js = new Contact($pimple['access_token']); |
| 34 | 34 | $js->setCache($pimple['cache']); |
| 35 | 35 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function register(Container $pimple) |
| 27 | 27 | { |
| 28 | - $pimple['merchant'] = function ($pimple) { |
|
| 28 | + $pimple['merchant'] = function($pimple) { |
|
| 29 | 29 | $config = array_merge( |
| 30 | 30 | ['app_id' => $pimple['config']['app_id']], |
| 31 | 31 | $pimple['config']->get('payment', []) |
@@ -34,19 +34,19 @@ discard block |
||
| 34 | 34 | return new Merchant($config); |
| 35 | 35 | }; |
| 36 | 36 | |
| 37 | - $pimple['payment'] = function ($pimple) { |
|
| 37 | + $pimple['payment'] = function($pimple) { |
|
| 38 | 38 | return new Payment($pimple['merchant']); |
| 39 | 39 | }; |
| 40 | 40 | |
| 41 | - $pimple['lucky_money'] = function ($pimple) { |
|
| 41 | + $pimple['lucky_money'] = function($pimple) { |
|
| 42 | 42 | return new LuckyMoney($pimple['merchant']); |
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | - $pimple['merchant_pay'] = function ($pimple) { |
|
| 45 | + $pimple['merchant_pay'] = function($pimple) { |
|
| 46 | 46 | return new MerchantPay($pimple['merchant']); |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | - $pimple['cash_coupon'] = function ($pimple) { |
|
| 49 | + $pimple['cash_coupon'] = function($pimple) { |
|
| 50 | 50 | return new CashCoupon($pimple['merchant']); |
| 51 | 51 | }; |
| 52 | 52 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function register(Container $pimple) |
| 23 | 23 | { |
| 24 | - $pimple['staff'] = function ($pimple) { |
|
| 24 | + $pimple['staff'] = function($pimple) { |
|
| 25 | 25 | return new Staff($pimple['access_token']); |
| 26 | 26 | }; |
| 27 | 27 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function register(Container $pimple) |
| 23 | 23 | { |
| 24 | - $pimple['menu'] = function ($pimple) { |
|
| 24 | + $pimple['menu'] = function($pimple) { |
|
| 25 | 25 | return new Menu($pimple['access_token']); |
| 26 | 26 | }; |
| 27 | 27 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | public function register(Container $pimple) |
| 18 | 18 | { |
| 19 | - $pimple['fundamental.api'] = function ($pimple) { |
|
| 19 | + $pimple['fundamental.api'] = function($pimple) { |
|
| 20 | 20 | return new API($pimple['access_token']); |
| 21 | 21 | }; |
| 22 | 22 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | parent::__construct(); |
| 86 | 86 | |
| 87 | - $this['config'] = function () use ($config) { |
|
| 87 | + $this['config'] = function() use ($config) { |
|
| 88 | 88 | return new Config($config); |
| 89 | 89 | }; |
| 90 | 90 | |
@@ -218,19 +218,19 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | private function registerBase() |
| 220 | 220 | { |
| 221 | - $this['request'] = function () { |
|
| 221 | + $this['request'] = function() { |
|
| 222 | 222 | return Request::createFromGlobals(); |
| 223 | 223 | }; |
| 224 | 224 | |
| 225 | 225 | if (!empty($this['config']['cache']) && $this['config']['cache'] instanceof CacheInterface) { |
| 226 | 226 | $this['cache'] = $this['config']['cache']; |
| 227 | 227 | } else { |
| 228 | - $this['cache'] = function () { |
|
| 228 | + $this['cache'] = function() { |
|
| 229 | 229 | return new FilesystemCache(sys_get_temp_dir()); |
| 230 | 230 | }; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - $this['access_token'] = function () { |
|
| 233 | + $this['access_token'] = function() { |
|
| 234 | 234 | return new AccessToken( |
| 235 | 235 | $this['config']['corp_id'], |
| 236 | 236 | $this['config']['secret'], |
@@ -44,17 +44,17 @@ discard block |
||
| 44 | 44 | const API_DELETE_CARD = 'https://qyapi.weixin.qq.com/cgi-bin/card/delete'; |
| 45 | 45 | |
| 46 | 46 | // 卡券类型 |
| 47 | - const TYPE_GENERAL_COUPON = 'GENERAL_COUPON'; // 通用券 |
|
| 48 | - const TYPE_GROUPON = 'GROUPON'; // 团购券 |
|
| 49 | - const TYPE_DISCOUNT = 'DISCOUNT'; // 折扣券 |
|
| 50 | - const TYPE_GIFT = 'GIFT'; // 礼品券 |
|
| 51 | - const TYPE_CASH = 'CASH'; // 代金券 |
|
| 47 | + const TYPE_GENERAL_COUPON = 'GENERAL_COUPON'; // 通用券 |
|
| 48 | + const TYPE_GROUPON = 'GROUPON'; // 团购券 |
|
| 49 | + const TYPE_DISCOUNT = 'DISCOUNT'; // 折扣券 |
|
| 50 | + const TYPE_GIFT = 'GIFT'; // 礼品券 |
|
| 51 | + const TYPE_CASH = 'CASH'; // 代金券 |
|
| 52 | 52 | |
| 53 | 53 | // 卡券状态 |
| 54 | - const CARD_STATUS_NOT_VERIFY = 'CARD_STATUS_NOT_VERIFY'; // 待审核 |
|
| 55 | - const CARD_STATUS_VERIFY_FAIL = 'CARD_STATUS_VERIFY_FAIL'; // 审核失败 |
|
| 56 | - const CARD_STATUS_VERIFY_OK = 'CARD_STATUS_VERIFY_OK'; // 通过审核 |
|
| 57 | - const CARD_STATUS_USER_DELETE = 'CARD_STATUS_USER_DELETE'; // 卡券被商户删除 |
|
| 54 | + const CARD_STATUS_NOT_VERIFY = 'CARD_STATUS_NOT_VERIFY'; // 待审核 |
|
| 55 | + const CARD_STATUS_VERIFY_FAIL = 'CARD_STATUS_VERIFY_FAIL'; // 审核失败 |
|
| 56 | + const CARD_STATUS_VERIFY_OK = 'CARD_STATUS_VERIFY_OK'; // 通过审核 |
|
| 57 | + const CARD_STATUS_USER_DELETE = 'CARD_STATUS_USER_DELETE'; // 卡券被商户删除 |
|
| 58 | 58 | const CARD_STATUS_USER_DISPATCH = 'CARD_STATUS_USER_DISPATCH'; // 在公众平台投放过的卡券 |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | public function jsConfigForAssign(array $cards) |
| 165 | 165 | { |
| 166 | - return json_encode(array_map(function ($card) { |
|
| 166 | + return json_encode(array_map(function($card) { |
|
| 167 | 167 | return $this->attachExtension($card['card_id'], $card); |
| 168 | 168 | }, $cards)); |
| 169 | 169 | } |