UrlConstants.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Bear
  5. * Date: 2018/12/5
  6. * Time: 下午4:56
  7. */
  8. namespace app\main\constants;
  9. use think\Config;
  10. /**
  11. * 处理关于链接的常量
  12. * Class UrlConstants
  13. * @package app\main\constants
  14. */
  15. class UrlConstants
  16. {
  17. const REFERRAL_READING_PAGE_SPREAD = '1';//阅读页推广
  18. const REFERRAL_FRONT_PAGE_SPREAD = '2';//书城首页推广
  19. const REFERRAL_GROUND_PAGE_SPREAD = '3';//落地页推广
  20. const REFERRAL_PUSH_IN = '1';//内推
  21. const REFERRAL_PUSH_OUT = '0';//外派
  22. public static function get_page_404()
  23. {
  24. return Config::get('site.cdnurl').'/404.html';
  25. }
  26. public static $callbackIgnore = [
  27. 'mpapi',
  28. 'opticket',
  29. ];
  30. //忽略全部处理逻辑的页面url
  31. public static $ignoreCallbackInitialize = [
  32. 'api/wechat/opticket',
  33. 'api/wechat/mpapi',
  34. 'api/wechat/ttlttback',
  35. 'api/wechat/getToken',
  36. ];
  37. /**
  38. * 返回当前url 对应的位置索引
  39. * @param $action
  40. * @return int|mixed
  41. */
  42. public static function getLocation($action)
  43. {
  44. $location = [
  45. '/index/user/recent' => 1,
  46. '/index/user/index' => 2,
  47. '/index/index/index' => 3
  48. ];
  49. return $location[$action] ?? 0;
  50. }
  51. }