@@ -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 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function register(Container $pimple) |
| 23 | 23 | { |
| 24 | - $pimple['card'] = function ($pimple) { |
|
| 24 | + $pimple['card'] = function($pimple) { |
|
| 25 | 25 | $card = new Card($pimple['access_token']); |
| 26 | 26 | $card->setCache($pimple['cache']); |
| 27 | 27 | |
@@ -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 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | parent::__construct(); |
| 78 | 78 | |
| 79 | - $this['config'] = function () use ($config) { |
|
| 79 | + $this['config'] = function() use ($config) { |
|
| 80 | 80 | return new Config($config); |
| 81 | 81 | }; |
| 82 | 82 | |
@@ -210,19 +210,19 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | private function registerBase() |
| 212 | 212 | { |
| 213 | - $this['request'] = function () { |
|
| 213 | + $this['request'] = function() { |
|
| 214 | 214 | return Request::createFromGlobals(); |
| 215 | 215 | }; |
| 216 | 216 | |
| 217 | 217 | if (!empty($this['config']['cache']) && $this['config']['cache'] instanceof CacheInterface) { |
| 218 | 218 | $this['cache'] = $this['config']['cache']; |
| 219 | 219 | } else { |
| 220 | - $this['cache'] = function () { |
|
| 220 | + $this['cache'] = function() { |
|
| 221 | 221 | return new FilesystemCache(sys_get_temp_dir()); |
| 222 | 222 | }; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - $this['access_token'] = function () { |
|
| 225 | + $this['access_token'] = function() { |
|
| 226 | 226 | return new AccessToken( |
| 227 | 227 | $this['config']['corp_id'], |
| 228 | 228 | $this['config']['secret'], |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | protected function accessTokenMiddleware() |
| 140 | 140 | { |
| 141 | - return function (callable $handler) { |
|
| 142 | - return function (RequestInterface $request, array $options) use ($handler) { |
|
| 141 | + return function(callable $handler) { |
|
| 142 | + return function(RequestInterface $request, array $options) use ($handler) { |
|
| 143 | 143 | if (!$this->accessToken) { |
| 144 | 144 | return $handler($request, $options); |
| 145 | 145 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | protected function logMiddleware() |
| 163 | 163 | { |
| 164 | - return Middleware::tap(function (RequestInterface $request, $options) { |
|
| 164 | + return Middleware::tap(function(RequestInterface $request, $options) { |
|
| 165 | 165 | Log::debug("Request: {$request->getMethod()} {$request->getUri()} ".json_encode($options)); |
| 166 | 166 | Log::debug('Request headers:'.json_encode($request->getHeaders())); |
| 167 | 167 | }); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | protected function retryMiddleware() |
| 176 | 176 | { |
| 177 | - return Middleware::retry(function ( |
|
| 177 | + return Middleware::retry(function( |
|
| 178 | 178 | $retries, |
| 179 | 179 | RequestInterface $request, |
| 180 | 180 | ResponseInterface $response = null |
@@ -17,14 +17,14 @@ |
||
| 17 | 17 | const API_SEND = 'https://qyapi.weixin.qq.com/cgi-bin/chat/send'; |
| 18 | 18 | const API_SET_MUTE = 'https://qyapi.weixin.qq.com/cgi-bin/chat/setmute'; |
| 19 | 19 | |
| 20 | - const CHAT_TYPE_SINGLE = 'single'; // 单聊 |
|
| 21 | - const CHAT_TYPE_GROUP = 'group'; // 群聊 |
|
| 22 | - |
|
| 23 | - const MSG_TYPE_TEXT = 'text'; // 文本 |
|
| 24 | - const MSG_TYPE_VOICE = 'voice'; // 语音 |
|
| 25 | - const MSG_TYPE_IMAGE = 'image'; // 图片 |
|
| 26 | - const MSG_TYPE_FILE = 'file'; // 文件 |
|
| 27 | - const MSG_TYPE_LINK = 'link'; // 文件 |
|
| 20 | + const CHAT_TYPE_SINGLE = 'single'; // 单聊 |
|
| 21 | + const CHAT_TYPE_GROUP = 'group'; // 群聊 |
|
| 22 | + |
|
| 23 | + const MSG_TYPE_TEXT = 'text'; // 文本 |
|
| 24 | + const MSG_TYPE_VOICE = 'voice'; // 语音 |
|
| 25 | + const MSG_TYPE_IMAGE = 'image'; // 图片 |
|
| 26 | + const MSG_TYPE_FILE = 'file'; // 文件 |
|
| 27 | + const MSG_TYPE_LINK = 'link'; // 文件 |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Fetch a chat by chat id. |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | $articles = [$articles]; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - $params = ['articles' => array_map(function ($article) { |
|
| 101 | + $params = ['articles' => array_map(function($article) { |
|
| 102 | 102 | if ($article instanceof Article) { |
| 103 | 103 | return $article->only([ |
| 104 | 104 | 'title', 'thumb_media_id', 'author', 'digest', |
@@ -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 | } |