PasswordController.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: shenyang
  5. * Date: 2017/9/22
  6. * Time: 下午3:12
  7. */
  8. namespace app\frontend\modules\payment\controllers;
  9. use app\common\components\ApiController;
  10. use app\common\services\password\PasswordService;
  11. class PasswordController extends ApiController
  12. {
  13. public function check()
  14. {
  15. if ($this->masterSwitch()) $this->_check();
  16. return $this->successJson('成功', []);
  17. }
  18. public function multiple()
  19. {
  20. return $this->successJson('', (new PasswordService())->multipleSwitch());
  21. }
  22. private function _check()
  23. {
  24. $this->validate(['password' => 'required|string']);
  25. (new PasswordService())->checkPayPassword($this->memberId(), $this->password());
  26. }
  27. private function masterSwitch()
  28. {
  29. return (new PasswordService())->masterSwitch();
  30. }
  31. private function memberId()
  32. {
  33. return \YunShop::app()->getMemberId();
  34. }
  35. private function password()
  36. {
  37. return request()->input('password');
  38. }
  39. }