TestController.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?php
  2. namespace App\Http\Controllers\Api\Wechat;
  3. use Aix\Sms\Contracts\Smser;
  4. use App\Http\Controllers\Api\ApiBaseController;
  5. use App\Services\Common\SmsService;
  6. use App\Services\Common\WechatService;
  7. use App\Wechat\Official\EventHandle;
  8. use EasyWeChat\Kernel\Messages\Message;
  9. use Illuminate\Support\Facades\Cache;
  10. use Illuminate\Support\Facades\DB;
  11. use Illuminate\Support\Facades\Hash;
  12. class TestController extends ApiBaseController
  13. {
  14. /**
  15. * @var WechatService
  16. */
  17. private $wechatService;
  18. /**
  19. * OfficialController constructor.
  20. * @param WechatService $wechatService
  21. */
  22. public function __construct(WechatService $wechatService)
  23. {
  24. $this->wechatService = $wechatService;
  25. }
  26. public function index()
  27. {
  28. $official = $this->wechatService->getOfficialAccount();
  29. $official->server->push(EventHandle::class, Message::EVENT);
  30. return $official->server->serve();
  31. }
  32. public function pushMenu()
  33. {
  34. $official = $this->wechatService->getOfficialAccount();
  35. $menu = [
  36. [
  37. "name" => "个人服务",
  38. "sub_button" => [
  39. [
  40. "type" => "click",
  41. "name" => "刷新简历",
  42. "key" => "PersonResumeRefresh",
  43. ],
  44. [
  45. "type" => "view",
  46. "name" => "面试邀请",
  47. "url" => route('mobile.auth.thirdlogin.official')
  48. . '?redirect_url=' . urlencode(route('mobile.person.jobs_interview')),
  49. ],
  50. [
  51. "type" => "view",
  52. "name" => "投递反馈",
  53. "url" => route('mobile.auth.thirdlogin.official')
  54. . '?redirect_url=' . urlencode(route('mobile.person.apply_jobs')),
  55. ],
  56. [
  57. "type" => "view",
  58. "name" => "职位搜索",
  59. "url" => route('mobile.auth.thirdlogin.official')
  60. . '?redirect_url=' . urlencode(route('mobile.jobs')),
  61. ],
  62. [
  63. "type" => "view",
  64. "name" => "个人中心",
  65. "url" => route('mobile.auth.thirdlogin.official')
  66. . '?redirect_url=' . urlencode(route('mobile.person.index')),
  67. ],
  68. ],
  69. ],
  70. [
  71. "name" => "企业服务",
  72. "sub_button" => [
  73. [
  74. "type" => "click",
  75. "name" => "刷新职位",
  76. "key" => "CompanyJobRefresh",
  77. ],
  78. [
  79. "type" => "view",
  80. "name" => "职位管理",
  81. "url" => route('mobile.auth.thirdlogin.official')
  82. . '?redirect_url=' . urlencode(route('mobile.firm.jobs.list')),
  83. ],
  84. [
  85. "type" => "view",
  86. "name" => "应聘简历",
  87. "url" => route('mobile.auth.thirdlogin.official')
  88. . '?redirect_url=' . urlencode(route('mobile.firm.resume.apply')),
  89. ],
  90. [
  91. "type" => "view",
  92. "name" => "简历搜索",
  93. "url" => route('mobile.auth.thirdlogin.official')
  94. . '?redirect_url=' . urlencode(route('mobile.resumes')),
  95. ],
  96. ],
  97. ],
  98. [
  99. "name" => "更多精彩",
  100. "sub_button" => [
  101. [
  102. "type" => "click",
  103. "name" => "每日签到",
  104. "key" => "EverydaySignIn",
  105. ],
  106. [
  107. "type" => "view",
  108. "name" => "账号绑定",
  109. "url" => route('mobile.auth.thirdlogin.official'),
  110. ],
  111. [
  112. "type" => "view",
  113. "name" => "最近招聘会",
  114. "url" => route('mobile.auth.thirdlogin.official')
  115. . '?redirect_url=' . urlencode(route('mobile.jobfair.index')),
  116. ],
  117. [
  118. "type" => "view",
  119. "name" => "进入官网",
  120. "url" => route('mobile.home'),
  121. ],
  122. ],
  123. ],
  124. ];
  125. $official->menu->create($menu);
  126. }
  127. public function smsTest(SmsService $smsService)
  128. {
  129. // $smsService->sendSms('13313826760', Smser::TEMPLATE_JOBFAIR_APPLY_ERROR, ['jobfair_name'=>'职业名称']);
  130. $smsService->sendSms('13313826760', 'sms_buyhouse_supply', ['name' => '林武', 'month' => 7, 'day' => 23]);
  131. }
  132. }