Link.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace app\shop\controller\link;
  3. use app\shop\controller\Controller;
  4. use app\shop\model\plus\giftpackage\GiftPackage;
  5. use app\shop\model\page\Page as PageModel;
  6. use app\shop\model\plus\invitationgift\InvitationGift as InvitationModel;
  7. use app\shop\model\plus\table\Table as TableModel;
  8. /**
  9. * 超链接控制器
  10. */
  11. class Link extends Controller
  12. {
  13. /**
  14. *获取数据
  15. */
  16. public function index()
  17. {
  18. // 礼包购
  19. $model = new GiftPackage();
  20. $list = $model->getDatas();
  21. $packageList = [];
  22. foreach ($list as $item) {
  23. $packageList[] = [
  24. 'id' => $item['gift_package_id'],
  25. 'url' => 'pages/plus/giftpackage/giftpackage?package_id=' . $item['gift_package_id'],
  26. 'name' => $item['name'],
  27. 'type' => '营销'
  28. ];
  29. }
  30. // 邀请有礼
  31. $list = (new InvitationModel())->getLinkDatas();
  32. $invitationList = [];
  33. foreach ($list as $item) {
  34. $invitationList[] = [
  35. 'id' => $item['invitation_gift_id'],
  36. 'url' => 'pages/user/invite/invite?invitation_gift_id=' . $item['invitation_gift_id'],
  37. 'name' => $item['name'],
  38. 'type' => '营销'
  39. ];
  40. }
  41. // 万能表单
  42. $list = (new TableModel())->getAll();
  43. $tableList = [];
  44. foreach ($list as $item) {
  45. $tableList[] = [
  46. 'id' => $item['table_id'],
  47. 'url' => 'pages/plus/table/table?table_id=' . $item['table_id'],
  48. 'name' => $item['name'],
  49. 'type' => '表单'
  50. ];
  51. }
  52. return $this->renderSuccess('', compact('packageList', 'invitationList', 'tableList'));
  53. }
  54. /**
  55. * 获取自定义页面
  56. */
  57. public function getPageList()
  58. {
  59. $model = new PageModel;
  60. $list = $model->getLists();
  61. return $this->renderSuccess('', compact('list'));
  62. }
  63. }