You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HomeController.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace app\controller\api\pc;
  3. use app\services\pc\HomeServices;
  4. use app\services\other\QrcodeServices;
  5. use crmeb\services\SystemConfigService;
  6. /**
  7. * Class HomeController
  8. * @package app\api\controller\pc
  9. */
  10. class HomeController
  11. {
  12. /**
  13. *
  14. * @var HomeServices
  15. */
  16. protected $services;
  17. /**
  18. * HomeController constructor.
  19. * @param HomeServices $services
  20. */
  21. public function __construct(HomeServices $services)
  22. {
  23. $this->services = $services;
  24. }
  25. /**
  26. * PC端首页轮播图
  27. * @return mixed
  28. */
  29. public function getBanner()
  30. {
  31. $list = sys_data('pc_home_banner');
  32. return app('json')->successful(compact('list'));
  33. }
  34. /**
  35. * 首页分类尚品
  36. * @return mixed
  37. */
  38. public function getCategoryProduct()
  39. {
  40. $data = $this->services->getCategoryProduct();
  41. return app('json')->successful($data);
  42. }
  43. /**
  44. * 获取手机购买跳转url配置
  45. * @return string
  46. */
  47. public function getProductPhoneBuy()
  48. {
  49. $data = SystemConfigService::more(['product_phone_buy_url', 'site_url']);
  50. return app('json')->successful(['phone_buy' => $data['product_phone_buy_url'] ?? 1, 'sit_url' => $data['site_url'] ?? '']);
  51. }
  52. /**
  53. * 付费会员购买二维码
  54. * @return mixed
  55. */
  56. public function getPayVipCode()
  57. {
  58. $type = sys_config('product_phone_buy_url', 1);
  59. $url = '/pages/annex/vip_paid/index';
  60. $name = "wechat_pay_vip_code.png";
  61. /** @var QrcodeServices $QrcodeService */
  62. $QrcodeService = app()->make(QrcodeServices::class);
  63. if ($type == 1) {
  64. $codeUrl = $QrcodeService->getWechatQrcodePath($name, $url, false, false);
  65. } else {
  66. //生成小程序地址
  67. $codeUrl = $QrcodeService->getRoutineQrcodePath(0, 0, 5, [], false);
  68. }
  69. return app('json')->successful(['url' => $codeUrl ? $codeUrl : '']);
  70. }
  71. }