HomeController.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\api\controller\pc;
  12. use app\services\other\QrcodeServices;
  13. use app\services\pc\HomeServices;
  14. class HomeController
  15. {
  16. protected $services;
  17. public function __construct(HomeServices $services)
  18. {
  19. $this->services = $services;
  20. }
  21. /**
  22. * PC端首页轮播图
  23. * @return mixed
  24. */
  25. public function getBanner()
  26. {
  27. $list = sys_data('pc_home_banner');
  28. return app('json')->successful(compact('list'));
  29. }
  30. /**
  31. * 首页分类尚品
  32. * @return mixed
  33. */
  34. public function getCategoryProduct()
  35. {
  36. $data = $this->services->getCategoryProduct();
  37. return app('json')->successful($data);
  38. }
  39. /**
  40. * 获取手机购买跳转url配置
  41. * @return string
  42. */
  43. public function getProductPhoneBuy()
  44. {
  45. $phoneBuy = sys_config('product_phone_buy_url', 1);
  46. $siteUrl = sys_config('site_url');
  47. return app('json')->successful(['phone_buy' => $phoneBuy, 'sit_url' => $siteUrl]);
  48. }
  49. /**
  50. * 付费会员购买二维码
  51. * @return mixed
  52. */
  53. public function getPayVipCode()
  54. {
  55. $type = sys_config('product_phone_buy_url', 1);
  56. $url = '/pages/annex/vip_paid/index';
  57. $name = "wechat_pay_vip_code.png";
  58. /** @var QrcodeServices $QrcodeService */
  59. $QrcodeService = app()->make(QrcodeServices::class);
  60. if ($type == 1) {
  61. $codeUrl = $QrcodeService->getWechatQrcodePath($name, $url, false, false);
  62. } else {
  63. //生成小程序地址
  64. $codeUrl = $QrcodeService->getRoutineQrcodePath(0, 0, 5, [], false);
  65. }
  66. return app('json')->successful(['url' => $codeUrl ? $codeUrl : '']);
  67. }
  68. }