TableDataLogic.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\common\logic;
  15. use app\common\enum\PayEnum;
  16. use app\common\enum\RefundEnum;
  17. use app\common\model\equity\EquityConfig;
  18. use app\common\model\labels\Labels;
  19. use app\common\model\property\PropertyHead;
  20. use app\common\model\recharge\RechargeOrder;
  21. use app\common\model\refund\RefundLog;
  22. use app\common\model\refund\RefundRecord;
  23. use app\common\model\sale\Sale;
  24. use app\common\model\sale\SaleGroup;
  25. use app\common\model\setting\PostageRegion;
  26. use app\common\service\pay\AliPayService;
  27. use app\common\service\pay\WeChatPayService;
  28. /**
  29. * 查询选项类数据
  30. * Class TableDataLogic
  31. * @package app\common\logic
  32. */
  33. class TableDataLogic extends BaseLogic
  34. {
  35. /**
  36. * @notes 商品标签列表
  37. */
  38. public static function labels()
  39. {
  40. return Labels::where('id','>',0)->where('label_type',1)->field('id,label_name as name,id as value,"data_table_labels" as type_value')->select()->toArray();
  41. }
  42. /**
  43. * @notes 销售列表
  44. */
  45. public static function sale()
  46. {
  47. return Sale::where('id','>',0)->field('id,sale_name as name,id as value,"data_table_sale" as type_value')->select()->toArray();
  48. }
  49. /**
  50. * @notes 销售组列表
  51. */
  52. public static function saleGroup()
  53. {
  54. return SaleGroup::where('id','>',0)->field('id,sale_name as name,id as value,"data_table_saleGroup" as type_value')->select()->toArray();
  55. }
  56. public static function propertyHead()
  57. {
  58. return PropertyHead::where('id','>',0)->field('id,village_name as name,id as value,"data_table_propertyHead" as type_value')->select()->toArray();
  59. }
  60. /**
  61. * @notes 工程师标签列表
  62. */
  63. public static function masterWorkerLabels()
  64. {
  65. return Labels::where('id','>',0)->where('label_type',2)->field('id,label_name as name,id as value,"data_table_masterWorkerLabels" as type_value')->select()->toArray();
  66. }
  67. /**
  68. * @notes 优惠券标签列表
  69. */
  70. public static function couponLabels()
  71. {
  72. return Labels::where('id','>',0)->where('label_type',3)->field('id,label_name as name,id as value,"data_table_couponLabels" as type_value')->select()->toArray();
  73. }
  74. /**
  75. * @notes 权益卡列表
  76. */
  77. public static function equityConfig()
  78. {
  79. return EquityConfig::where('id','>',0)->field('id,equity_name as name,id as value,"data_table_equityConfig" as type_value')->select()->toArray();
  80. }
  81. public static function postageRegion(): array
  82. {
  83. // 缓存优化
  84. $data = cache('labelPostageRegion');
  85. if(empty($data)){
  86. $lists = getPostageRegion();
  87. $data = linear_to_tree($lists, 'children', 'id', 'pid');
  88. cache('labelPostageRegion',$data);
  89. }
  90. return $data;
  91. }
  92. }