CommonService.php 901 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Author: luzheng.liu
  4. * Time: 2020/12/5 00:49
  5. */
  6. namespace app\common\service;
  7. use app\index\model\SettingModel;
  8. class CommonService {
  9. static $setData;
  10. public static function getSetData() {
  11. if (empty(self::$setData)){
  12. $data = (new SettingModel())::where(['id' => 1])->find();
  13. self::$setData = $data;
  14. return $data;
  15. }
  16. return self::$setData;
  17. }
  18. public static function getAuthUrl() {
  19. $baseUrl = self::getBaeUrl();
  20. return $baseUrl.'?redirecturi='.self::getRedirectUrl();
  21. }
  22. public static function getBaeUrl() {
  23. $data = self::getSetData();
  24. return "http://{$data['domain']}/api/wechat/focusarea/{$data['site_id']}/{$data['unique_key']}";
  25. }
  26. public static function getRedirectUrl() {
  27. $data = self::getSetData();
  28. return $data['redirct_url'];
  29. }
  30. }