SelfDefineService.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace App\Modules\OfficialAccount\Services;
  3. use App\Modules\OfficialAccount\Models\DistributionSelfDefineContent;
  4. use App\Modules\OfficialAccount\Models\SelfDefinedMenu;
  5. use Redis;
  6. use App\Modules\Channel\Services\ChannelService;
  7. use App\Jobs\SendNews;
  8. use App\Jobs\SendTexts;
  9. class SelfDefineService
  10. {
  11. public static function getMenu($distribution_channel_id,$filter=[]){
  12. return SelfDefinedMenu::getMenu($distribution_channel_id,$filter);
  13. }
  14. public static function getMenuFormated($distribution_channel_id,$filter=[]) {
  15. return SelfDefinedMenu::getMenuFormated($distribution_channel_id,$filter);
  16. }
  17. #channel项目用到了相同的方法,如修改两边同时修改
  18. public static function getDefaultMenu($distribution_channel_id) {
  19. $WECHAT_CUSTOM_HOST = env('WECHAT_CUSTOM_HOST');
  20. if(in_array($distribution_channel_id,array('369','14'))){
  21. $WECHAT_CUSTOM_HOST = env('CUSTOM_HOST');
  22. }
  23. $encodeDistributionChannelId = encodeDistributionChannelId($distribution_channel_id);
  24. //\Log::info('officialMenusList:distribution_channel_id:'.$distribution_channel_id.' encodeDistributionChannelId:'.$encodeDistributionChannelId.' is_yq_move:'.$is_yq_move.' menu_type:'.$menu_type);
  25. $base_url = env('PROTOCOL') . '://site' . $encodeDistributionChannelId . '.' . $WECHAT_CUSTOM_HOST . '.com/';
  26. $help_url = 'https://help.'.$WECHAT_CUSTOM_HOST.'.com?distribution_channel_id='.$encodeDistributionChannelId;
  27. $buttons =
  28. [
  29. [
  30. "type" => "click",
  31. "name" => "最近阅读",
  32. "key" => "recent_read",
  33. ],
  34. [
  35. "type" => "click",
  36. "name" => "今日签到",
  37. "key" => 'daily_sign',
  38. ],
  39. [
  40. "name" => "用户中心",
  41. "sub_button" =>
  42. [
  43. [
  44. "type" => "view",
  45. "name" => "小说排行",
  46. "url" => $base_url . 'rank',
  47. ],
  48. [
  49. "type" => "view",
  50. "name" => "个人中心",
  51. "url" => $base_url . 'person',
  52. ],
  53. [
  54. "type" => "view",
  55. "name" => "书城首页",
  56. "url" => $base_url,
  57. ],
  58. [
  59. "type" => "view",
  60. "name" => "优惠充值",
  61. "url" => $base_url . 'pay',
  62. ],
  63. [
  64. "type" => "view",
  65. "name" => "帮助中心",
  66. "url" => $help_url,
  67. ],
  68. ],
  69. ],
  70. ];
  71. return $buttons;
  72. }
  73. }