TestController.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Jobs\ProcessDataJob;
  4. use App\Model\Record;
  5. use App\Service\EnterpriseWechatService;
  6. use App\Service\U8ThirdPartyService;
  7. class TestController extends BaseController
  8. {
  9. public function test(){
  10. // $record = Record::where('id',1065)->first()->toArray();
  11. $service = new U8ThirdPartyService();
  12. // list($status, $msg) = $service->puAppVouch($record);
  13. // list($status, $msg) = $service->poPomain($record);
  14. // list($status, $msg) = $service->purchaseInAdd($record);
  15. // dd($status, $msg);
  16. }
  17. private function submitAgain(){
  18. $result = Record::where('del_time',2)
  19. ->where('result', '<>', '')
  20. ->get()->toArray();
  21. foreach ($result as $value){
  22. ProcessDataJob::dispatch($value)->onQueue(Record::$job);
  23. }
  24. dd('ok');
  25. }
  26. public function sendNotification()
  27. {
  28. $wechatService = new EnterpriseWechatService();
  29. // 1. 目标员工的企业微信 userid(可在企业微信通讯录查看)
  30. $userId = 'chen';
  31. // 2. 组装卡片标题
  32. $title = '台风防汛紧急通知';
  33. // 3. 组装卡片内容(可以自由排版,比微信模板消息爽多了)
  34. $description = "<div class=\"gray\">2026年7月10日</div>"
  35. . "<div class=\"highlight\">【重要提醒】第9号台风“巴威”正在逼近!</div>"
  36. . "<br/>"
  37. . "当前状态:温州市已启动防台风Ⅱ级应急响应<br/>"
  38. . "防御要求:沿海大闸已密集泄洪,请各部门排查低洼处积水隐患,检查门窗是否关紧。<br/>"
  39. . "<br/>"
  40. . "通知部门:行政安全部";
  41. // 4. 点击卡片要跳转的系统系统链接
  42. $url = 'https://your-system.com/dashboard';
  43. // 5. 调用你刚才写好的方法
  44. list($status, $msg) = $wechatService->sendTextCard($userId, $title, $description, $url);
  45. dd($status, $msg);
  46. }
  47. }