WeiXinMenuConst.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * WeiXinMenuConst.php UTF-8
  4. * huosdk_mini_program
  5. *
  6. * @date : 2018/9/26 15:26
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : chenbingling <cbl@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huolib\constant;
  13. class WeiXinMenuConst {
  14. CONST IS_MENU_1 = 1; //不是微信菜单
  15. CONST IS_MENU_2 = 2; //微信菜单
  16. CONST MENU_TYPE_CLICK = 'click'; //点击回复关键词类型
  17. CONST MENU_TYPE_VIEW = 'view'; //跳转url类型
  18. CONST MENU_TYPE_MP = 'miniprogram'; //小程序类型
  19. public static function getMenuTypeMsg($type, $all = false) {
  20. $_msg = array(
  21. self::MENU_TYPE_CLICK => '点击回复类型',
  22. self::MENU_TYPE_VIEW => '跳转url类型',
  23. self::MENU_TYPE_MP => '跳转小程序',
  24. );
  25. if (true == $all) {
  26. return $_msg;
  27. }
  28. if (!isset($_msg[$type])) {
  29. return false;
  30. }
  31. return $_msg[$type];
  32. }
  33. public static function getMenuType($inc = false) {
  34. $_types = self::getMenuTypeMsg(null, true);
  35. if (true == $inc) {
  36. $_default = ["0" => "选择类型"];
  37. $_types = $_default + $_types;
  38. }
  39. return $_types;
  40. }
  41. }