WxOpenClass.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace biz\wx\classes;
  3. use biz\sj\classes\MerchantClass;
  4. use common\components\util;
  5. use Yii;
  6. use biz\base\classes\BaseClass;
  7. class WxOpenClass extends BaseClass
  8. {
  9. public static $baseFile = '\biz\wx\models\WxOpen';
  10. const OPEN_STYLE_RETAIL = 1;
  11. const OPEN_STYLE_GHS = 2;
  12. //获取所有的小程序信息 shish 2021.2.25
  13. public static function getMiniInfo()
  14. {
  15. $ghsOpen = self::getGhsOpen();
  16. $wxGhsMiniBaseId = $ghsOpen['wxGhsMiniBaseId'] ?? 0;
  17. $arr = [];
  18. $ghsMini = WxMiniBaseClass::getById($wxGhsMiniBaseId);
  19. $arr['ghs']['miniAppId'] = $ghsMini['miniAppId'] ?? '';
  20. $retailOpen = self::getRetailOpen();
  21. $wxMiniBaseId = $retailOpen['wxMiniBaseId'] ?? 0;
  22. $wxMini = WxMiniBaseClass::getById($wxGhsMiniBaseId);
  23. $arr['hd']['miniAppId'] = $wxMini['miniAppId'] ?? '';
  24. return $arr;
  25. }
  26. //取供货商平台信息 shish 2021.2.25
  27. public static function getGhsOpen()
  28. {
  29. //暂时只有一个平台,取一个平台
  30. return self::getByCondition(['style' => self::OPEN_STYLE_RETAIL]);
  31. }
  32. //取零售平台信息 shish 2021.2.25
  33. public static function getRetailOpen()
  34. {
  35. return self::getByCondition(['style' => self::OPEN_STYLE_RETAIL]);
  36. }
  37. }