@@ -66,7 +66,7 @@ public static function tick(int $merchant_id, int $merchant_store_id, callable $
6666 try {
6767 $ amazonAppCollection = AmazonAppModel::query ()->where ('merchant_id ' , $ merchant_id )->where ('merchant_store_id ' , $ merchant_store_id )->firstOrFail ();
6868 } catch (ModelNotFoundException $ exception ) {
69- throw new AmazonAppException (sprintf ('AmazonAppException ModelNotFound. %s ' , $ exception ->getMessage ()), 201 );
69+ throw new AmazonAppException (sprintf ('AmazonAppException ModelNotFound. 错误信息: %s ' , $ exception ->getMessage ()), 201 );
7070 }
7171 $ appHash ->load ($ amazonAppCollection ->toArray ());
7272 $ appHash ->ttl (3600 );
@@ -158,21 +158,22 @@ public static function tok2(int $merchant_id, int $merchant_store_id, string $re
158158 // 验证region知否为合法
159159 try {
160160 self ::region ($ region );
161- } catch (BusinessException $ businessException ) {
162- $ log = sprintf ('Amazon App SDK构建失败,region值非法. region:%s ' , $ region );
161+ } catch (AmazonAppException $ amazonAppException ) {
162+ $ log = sprintf ('Amazon App SDK构建失败,region值非法. region:%s, 请检查. ' , $ region );
163163 $ console = ApplicationContext::getContainer ()->get (StdoutLoggerInterface::class);
164164 $ console ->error ($ log );
165165 return true ;
166166 }
167167
168+ //TODO 缓存AmazonAppRegionModel数据
168169 try {
169170 $ amazonAppRegionCollection = AmazonAppRegionModel::query ()
170171 ->where ('merchant_id ' , $ merchant_id )
171172 ->where ('merchant_store_id ' , $ merchant_store_id )
172173 ->where ('region ' , $ region )
173174 ->firstOrFail ();
174175 } catch (ModelNotFoundException $ modelNotFoundException ) {
175- $ log = sprintf ('Amazon App SDK构建失败,AmazonAppRegion查询失败. %s merchant_id:%s merchant_store_id:%s region:%s ' , $ modelNotFoundException ->getMessage (), $ merchant_id , $ merchant_store_id , $ region );
176+ $ log = sprintf ('Amazon App SDK构建失败,AmazonAppRegion查询失败. 错误信息: %s merchant_id:%s merchant_store_id:%s region:%s ' , $ modelNotFoundException ->getMessage (), $ merchant_id , $ merchant_store_id , $ region );
176177 $ console = ApplicationContext::getContainer ()->get (StdoutLoggerInterface::class);
177178 $ console ->error ($ log );
178179 return true ;
@@ -220,6 +221,7 @@ public static function tok2(int $merchant_id, int $merchant_store_id, string $re
220221 */
221222 public static function single (callable $ func ): bool
222223 {
224+ //TODO 缓存AmazonAppModel数据
223225 $ amazonAppCollections = AmazonAppModel::query ()->where ('status ' , Constants::STATUS_ACTIVE )->get ();
224226 if ($ amazonAppCollections ->isEmpty ()) {
225227 return false ;
@@ -266,7 +268,7 @@ public static function regions(array $regions): void
266268 public static function region (string $ region ): void
267269 {
268270 if (! Regions::isValid ($ region )) {
269- throw new BusinessException ('Invalid Region ' , 1 );
271+ throw new AmazonAppException ('Invalid Region ' , 1 );
270272 }
271273 }
272274}
0 commit comments