PageController.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: king/QQ:995265288
  5. * Date: 2019-06-19
  6. * Time: 16:52
  7. */
  8. namespace app\backend\modules\excelRecharge\controllers;
  9. use app\common\components\BaseController;
  10. use Yunshop\Love\Common\Services\SetService;
  11. class PageController extends BaseController
  12. {
  13. /**
  14. * @var string
  15. */
  16. protected $path = 'app/public/recharge';
  17. //批量充值页面接口
  18. public function index()
  19. {
  20. $this->makeFilePath();
  21. return view('excelRecharge.page', $this->resultData());
  22. }
  23. /**
  24. * 创建目录
  25. */
  26. private function makeFilePath()
  27. {
  28. if (!is_dir(storage_path($this->path))) {
  29. mkdir(storage_path($this->path), 0777);
  30. }
  31. }
  32. private function resultData()
  33. {
  34. return [
  35. 'loveOpen' => $this->lovePluginStatus(),
  36. 'loveName' => $this->loveName(),
  37. ];
  38. }
  39. private function loveName()
  40. {
  41. if ($this->lovePluginStatus()) {
  42. return SetService::getLoveName();
  43. }
  44. return '爱心值';
  45. }
  46. private function lovePluginStatus()
  47. {
  48. return app('plugins')->isEnabled('love');
  49. }
  50. }