diff --git a/app/Caches/AccessToken.php b/app/Caches/AccessToken.php deleted file mode 100644 index f2222b27..00000000 --- a/app/Caches/AccessToken.php +++ /dev/null @@ -1,35 +0,0 @@ -lifetime; - } - - public function getKey($id = null) - { - return "access_token:{$id}"; - } - - public function getContent($id = null) - { - $accessTokenRepo = new AccessTokenRepo(); - - $accessToken = $accessTokenRepo->findById($id); - - if (!$accessToken) { - return new \stdClass(); - } - - return $accessToken; - } - -} diff --git a/app/Http/Admin/Controllers/Controller.php b/app/Http/Admin/Controllers/Controller.php index 92e7a606..a391bc86 100644 --- a/app/Http/Admin/Controllers/Controller.php +++ b/app/Http/Admin/Controllers/Controller.php @@ -3,16 +3,17 @@ namespace App\Http\Admin\Controllers; use App\Models\Audit as AuditModel; -use App\Services\AuthUser\Admin as AdminAuthUser; +use App\Services\Auth\Admin as AdminAuth; use App\Traits\Response as ResponseTrait; use App\Traits\Security as SecurityTrait; use Phalcon\Mvc\Dispatcher; +use Yansongda\Supports\Collection; class Controller extends \Phalcon\Mvc\Controller { /** - * @var array + * @var Collection */ protected $authUser; @@ -112,11 +113,11 @@ class Controller extends \Phalcon\Mvc\Controller protected function getAuthUser() { /** - * @var AdminAuthUser $authUser + * @var AdminAuth $auth */ - $authUser = $this->getDI()->get('auth'); + $auth = $this->getDI()->get('auth'); - return $authUser->getAuthInfo(); + return $auth->getAuthInfo(); } } diff --git a/app/Http/Admin/Module.php b/app/Http/Admin/Module.php index d9090772..f07f31d3 100644 --- a/app/Http/Admin/Module.php +++ b/app/Http/Admin/Module.php @@ -2,7 +2,7 @@ namespace App\Http\Admin; -use App\Services\AuthUser\Admin as AdminAuthUser; +use App\Services\Auth\Admin as AdminAuth; use Phalcon\DiInterface; use Phalcon\Mvc\ModuleDefinitionInterface; use Phalcon\Mvc\View; @@ -27,7 +27,7 @@ class Module implements ModuleDefinitionInterface }); $di->setShared('auth', function () { - return new AdminAuthUser(); + return new AdminAuth(); }); } diff --git a/app/Http/Admin/Services/AlipayTest.php b/app/Http/Admin/Services/AlipayTest.php index e48c9b18..9aff02cd 100644 --- a/app/Http/Admin/Services/AlipayTest.php +++ b/app/Http/Admin/Services/AlipayTest.php @@ -19,18 +19,14 @@ class AlipayTest extends PaymentTest $qrcode = $alipayService->scan($trade); - $result = $qrcode ?: false; - - return $result; + return $qrcode ?: false; } public function status($tradeNo) { $alipayService = new AlipayService(); - $result = $alipayService->status($tradeNo); - - return $result; + return $alipayService->status($tradeNo); } public function cancel($tradeNo) diff --git a/app/Http/Admin/Services/AuthMenu.php b/app/Http/Admin/Services/AuthMenu.php index 0e0427b3..f5458fda 100644 --- a/app/Http/Admin/Services/AuthMenu.php +++ b/app/Http/Admin/Services/AuthMenu.php @@ -2,7 +2,7 @@ namespace App\Http\Admin\Services; -use App\Services\AuthUser\Admin as AdminAuthUser; +use App\Services\Auth\Admin as AdminAuth; use Phalcon\Mvc\User\Component; class AuthMenu extends Component @@ -115,11 +115,11 @@ class AuthMenu extends Component protected function getAuthInfo() { /** - * @var AdminAuthUser $authUser + * @var AdminAuth $auth */ - $authUser = $this->getDI()->get('auth'); + $auth = $this->getDI()->get('auth'); - return $authUser->getAuthInfo(); + return $auth->getAuthInfo(); } } diff --git a/app/Http/Admin/Services/PaymentTest.php b/app/Http/Admin/Services/PaymentTest.php index b485f475..458c5789 100644 --- a/app/Http/Admin/Services/PaymentTest.php +++ b/app/Http/Admin/Services/PaymentTest.php @@ -4,6 +4,7 @@ namespace App\Http\Admin\Services; use App\Models\Order as OrderModel; use App\Models\Trade as TradeModel; +use App\Services\Auth\Admin as AdminAuth; abstract class PaymentTest extends Service { @@ -21,15 +22,17 @@ abstract class PaymentTest extends Service public function createOrder() { /** - * @var object $authUser + * @var AdminAuth $auth */ - $authUser = $this->getDI()->get('auth')->getAuthInfo(); + $auth = $this->getDI()->get('auth'); + + $authUser = $auth->getAuthInfo(); $order = new OrderModel(); $order->subject = '测试 - 支付测试0.01元'; $order->amount = 0.01; - $order->user_id = $authUser->id; + $order->user_id = $authUser['id']; $order->item_type = OrderModel::ITEM_TEST; $order->create(); diff --git a/app/Http/Admin/Services/Session.php b/app/Http/Admin/Services/Session.php index 846eafee..04917606 100644 --- a/app/Http/Admin/Services/Session.php +++ b/app/Http/Admin/Services/Session.php @@ -2,7 +2,7 @@ namespace App\Http\Admin\Services; -use App\Services\AuthUser as AuthUserService; +use App\Services\Auth as AuthService; use App\Validators\Account as AccountValidator; use App\Validators\Security as SecurityValidator; @@ -10,7 +10,7 @@ class Session extends Service { /** - * @var AuthUserService + * @var AuthService */ protected $auth; diff --git a/app/Http/Admin/Services/WxpayTest.php b/app/Http/Admin/Services/WxpayTest.php index 04628706..14c26bc2 100644 --- a/app/Http/Admin/Services/WxpayTest.php +++ b/app/Http/Admin/Services/WxpayTest.php @@ -16,27 +16,21 @@ class WxpayTest extends PaymentTest $qrcode = $wxpayService->scan($trade); - $result = $qrcode ?: false; - - return $result; + return $qrcode ?: false; } public function status($tradeNo) { $wxpayService = new WxpayService(); - $result = $wxpayService->status($tradeNo); - - return $result; + return $wxpayService->status($tradeNo); } public function cancel($tradeNo) { $wxpayService = new WxpayService(); - $response = $wxpayService->close($tradeNo); - - return $response; + return $wxpayService->close($tradeNo); } } diff --git a/app/Http/Admin/Views/index/index.volt b/app/Http/Admin/Views/index/index.volt index e3d3857d..e6fd7d7d 100644 --- a/app/Http/Admin/Views/index/index.volt +++ b/app/Http/Admin/Views/index/index.volt @@ -29,7 +29,7 @@