SentPrController.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\SentPr;
  4. use Illuminate\Http\Request;
  5. use Illuminate\Support\Facades\Http;
  6. class SentPrController extends Controller
  7. {
  8. /**
  9. * Display a listing of the resource.
  10. *
  11. * @return \Illuminate\Http\Response
  12. */
  13. public function index()
  14. {
  15. //
  16. }
  17. /**
  18. * Store a newly created resource in storage.
  19. *
  20. * @param \Illuminate\Http\Request $request
  21. * @return \Illuminate\Http\Response
  22. */
  23. public function store(Request $request)
  24. {
  25. //
  26. if(!isset($_COOKIE['user_uid'])){
  27. return $this->error('not login');
  28. }
  29. $data = $request->all();
  30. if($data['channel'] == '7fea264d-7a26-40f8-bef7-bc95102760fb' && $data['book']==65 && $data['para']>2056 && $data['para']<2192){
  31. $url = "https://oapi.dingtalk.com/robot/send?access_token=34143dbec80a8fc09c1cb5897a5639ee3a9a32ecfe31835ad29bf7013bdb9fdf";
  32. $param = [
  33. "actionCard"=> [
  34. "title"=> "说慧地品",
  35. "text"=> " wikipali: 来自{$_COOKIE['user_uid']}的修改建议:{$data['text']}",
  36. "btnOrientation"=> "0",
  37. "singleTitle" => "详情",
  38. "singleURL"=>"https://staging.wikipali.org/app/article/index.php?view=para&book={$data['book']}&par={$data['para']}&channal={$data['channel']}&display=sent&mode=edit"
  39. ],
  40. "msgtype"=>"actionCard"
  41. ];
  42. $response = Http::post($url, $param);
  43. if($response->successful()){
  44. return $this->ok($response->body);
  45. }else{
  46. return $this->error($response->body);
  47. }
  48. }else{
  49. return $this->ok();
  50. }
  51. }
  52. /**
  53. * Display the specified resource.
  54. *
  55. * @param \App\Models\SentPr $sentPr
  56. * @return \Illuminate\Http\Response
  57. */
  58. public function show(SentPr $sentPr)
  59. {
  60. //
  61. }
  62. /**
  63. * Update the specified resource in storage.
  64. *
  65. * @param \Illuminate\Http\Request $request
  66. * @param \App\Models\SentPr $sentPr
  67. * @return \Illuminate\Http\Response
  68. */
  69. public function update(Request $request, SentPr $sentPr)
  70. {
  71. //
  72. }
  73. /**
  74. * Remove the specified resource from storage.
  75. *
  76. * @param \App\Models\SentPr $sentPr
  77. * @return \Illuminate\Http\Response
  78. */
  79. public function destroy(SentPr $sentPr)
  80. {
  81. //
  82. }
  83. }