WxOpenClass.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. namespace bizHd\wx\classes;
  3. use biz\sj\classes\MerchantClass;
  4. use common\components\dict;
  5. use common\components\util;
  6. use bizHd\base\classes\BaseClass;
  7. class WxOpenClass extends BaseClass
  8. {
  9. public static $baseFile = '\bizHd\wx\models\WxOpen';
  10. //平台管理员的手机号
  11. const ADMIN_MOBILE = 15280215347;
  12. const PLATFORM_ACCOUNT = 12359;
  13. const ID = 1;
  14. //取平台的帐号
  15. public static function getPlatformAccount()
  16. {
  17. return self::PLATFORM_ACCOUNT;
  18. }
  19. //获取平台基础信息 ssh 2020.2.11
  20. public static function getOpen()
  21. {
  22. return self::getById(self::ID);
  23. }
  24. //获取平台管理员的手机号 ssh 2020.3.4
  25. public static function getAdminMobile()
  26. {
  27. return self::ADMIN_MOBILE;
  28. }
  29. //获取平台微信信息
  30. public static function getOpenInfo()
  31. {
  32. $open = self::getById(self::ID);
  33. if (isset($open['sjId']) && !empty($open['sjId'])) {
  34. $sjId = $open['sjId'];
  35. return MerchantClass::getMerchantById($sjId);
  36. }
  37. util::fail('没有找到平台信息');
  38. }
  39. //更新开放平台信息 ssh 2020.4.13
  40. public static function updateOpen($data)
  41. {
  42. self::updateById(self::ID, $data);
  43. }
  44. //平台小程序信息 ssh 2020.4.13
  45. public static function getWxMiniBase()
  46. {
  47. $open = self::getByCondition(['style' => dict::getDict('ptStyle','hd')]);
  48. if (empty($open)) {
  49. util::fail('没有找到花店平台信息...');
  50. }
  51. $wxMiniBaseId = isset($open['wxMiniBaseId']) ? $open['wxMiniBaseId'] : 0;
  52. $base = WxMiniBaseClass::getById($wxMiniBaseId);
  53. if (empty($base)) {
  54. util::fail('没有找到平台小程序信息');
  55. }
  56. return $base;
  57. }
  58. //公众号信息 ssh 2020.4.14
  59. public static function getWxBase()
  60. {
  61. $open = self::getByCondition(['style' => dict::getDict('ptStyle','hd')]);
  62. if (empty($open)) {
  63. util::fail('没有找到花店平台信息...');
  64. }
  65. $wxBaseId = isset($open['wxBaseId']) ? $open['wxBaseId'] : 0;
  66. $base = WxBaseClass::getById($wxBaseId);
  67. if (empty($base)) {
  68. util::fail('没有找到平台公众号信息');
  69. }
  70. return $base;
  71. }
  72. //获取微信和小程序信息 ssh 2020.4.14
  73. public static function getWxInfo()
  74. {
  75. $mini = self::getWxMiniBase();
  76. $wx = self::getWxBase();
  77. return array_merge($wx, $mini);
  78. }
  79. //公众号信息 ssh 2020.4.14
  80. public static function getGhsWxBase()
  81. {
  82. $open = self::getByCondition(['style' => dict::getDict('ptStyle','ghs')]);
  83. if (empty($open)) {
  84. util::fail('没有找到供货商平台信息...');
  85. }
  86. $wxBaseId = isset($open['wxBaseId']) ? $open['wxBaseId'] : 0;
  87. $base = WxBaseClass::getById($wxBaseId);
  88. if (empty($base)) {
  89. util::fail('没有找到平台公众号信息');
  90. }
  91. return $base;
  92. }
  93. //平台小程序信息 ssh 2020.4.13
  94. public static function getGhsWxMiniBase()
  95. {
  96. $open = self::getByCondition(['style' => dict::getDict('ptStyle','ghs')]);
  97. if (empty($open)) {
  98. util::fail('没有找到供货商平台信息...');
  99. }
  100. $wxMiniBaseId = isset($open['wxMiniBaseId']) ? $open['wxMiniBaseId'] : 0;
  101. $base = WxMiniBaseClass::getById($wxMiniBaseId);
  102. if (empty($base)) {
  103. util::fail('没有找到平台小程序信息');
  104. }
  105. return $base;
  106. }
  107. public static function getGhsWxInfo()
  108. {
  109. $mini = self::getGhsWxMiniBase();
  110. $wx = self::getGhsWxBase();
  111. return array_merge($wx, $mini);
  112. }
  113. public static function getMallWxInfo()
  114. {
  115. $mini = self::getMallWxMiniBase();
  116. $wx = self::getMallWxBase();
  117. return array_merge($wx, $mini);
  118. }
  119. public static function getMallWxMiniBase()
  120. {
  121. $open = self::getByCondition(['style' => dict::getDict('ptStyle','mall')]);
  122. if (empty($open)) {
  123. util::fail('没有找到供货商平台信息...');
  124. }
  125. $wxMiniBaseId = isset($open['wxMiniBaseId']) ? $open['wxMiniBaseId'] : 0;
  126. $base = WxMiniBaseClass::getById($wxMiniBaseId);
  127. if (empty($base)) {
  128. util::fail('没有找到平台小程序信息');
  129. }
  130. return $base;
  131. }
  132. //公众号信息 ssh 2020.4.14
  133. public static function getMallWxBase()
  134. {
  135. $open = self::getByCondition(['style' => dict::getDict('ptStyle','mall')]);
  136. if (empty($open)) {
  137. util::fail('没有找到供货商平台信息...');
  138. }
  139. $wxBaseId = isset($open['wxBaseId']) ? $open['wxBaseId'] : 0;
  140. $base = WxBaseClass::getById($wxBaseId);
  141. if (empty($base)) {
  142. util::fail('没有找到平台公众号信息');
  143. }
  144. return $base;
  145. }
  146. }