MonthOrderController.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: z-yang
  5. * Date: 2019/7/25
  6. * Time: 10:29
  7. */
  8. namespace App\Http\Controllers\Wap\Pay;
  9. use GuzzleHttp\Client;
  10. use Illuminate\Routing\Controller;
  11. use Illuminate\Http\Request;
  12. use Log;
  13. class MonthOrderController extends Controller
  14. {
  15. public function getRedirectUrl(Request $request){
  16. $app_id = 'Aekgrv87yo5wxnl715';
  17. $app_secret = '57gwsnd158ib2sn7wluq5716brp8fzm';
  18. $key = 'sn7wluq5716brp8fzm';
  19. $plan_id = 124768;
  20. $user_id = 10008;
  21. $ip = '125.120.47.90';
  22. $sign = _sign(compact('app_id','app_secret','plan_id','user_id','ip'),$key.$key);
  23. $sign = strtoupper($sign);
  24. $client = new Client();
  25. $url = 'http://pap.manyuedu.org/h5.php?'.http_build_query(compact('app_id','app_secret','plan_id','user_id','ip','sign'));
  26. return $client->get($url)->getBody()->getContents();
  27. }
  28. public function getH5RedirectUrl(Request $request){
  29. $app_id = 'Aekgrv87115wxnl715';
  30. $app_secret = '57gwsnd158ib2sn7wluq5716brp8fzm';
  31. $key = 'sn7wluq5716brp8fzm';
  32. //$plan_id = 124768;
  33. $plan_id = 39603;
  34. $user_id = 10008;
  35. $ip = _getIp();
  36. //$ip = '125.120.47.90';
  37. $sign = _sign(compact('app_id','app_secret','plan_id','user_id','ip'),$key.$key);
  38. $sign = strtoupper($sign);
  39. $client = new Client();
  40. Log::info(compact('app_id','app_secret','plan_id','user_id','ip','sign'));
  41. $url = 'http://pap.manyuedu.org/h5.php?'.http_build_query(compact('app_id','app_secret','plan_id','user_id','ip','sign'));
  42. //return $url;
  43. return $client->get($url)->getBody()->getContents();
  44. }
  45. public function getWechatRedirectUrl(Request $request){
  46. $app_id = 'Aekgrv87115wxnl715';
  47. $app_secret = '57gwsnd158ib2sn7wluq5716brp8fzm';
  48. $key = 'sn7wluq5716brp8fzm';
  49. //$plan_id = 124768;
  50. $plan_id = 39603;
  51. $user_id = 10008;
  52. $ip = _getIp();
  53. //$ip = '125.120.47.90';
  54. $sign = _sign(compact('app_id','app_secret','plan_id','user_id','ip'),$key.$key);
  55. $sign = strtoupper($sign);
  56. $client = new Client();
  57. Log::info(compact('app_id','app_secret','plan_id','user_id','ip','sign'));
  58. //$url = 'http://pap.manyuedu.org/h5.php?'.http_build_query(compact('app_id','app_secret','plan_id','user_id','ip','sign'));
  59. $url = 'http://pap.manyuedu.org/?'.http_build_query(compact('app_id','app_secret','plan_id','user_id','ip','sign'));
  60. //return $url;
  61. return $client->get($url)->getBody()->getContents();
  62. }
  63. public function signCallBack(Request $request){
  64. Log::info('signCallBack------------------------------------------signCallBack');
  65. Log::info($request->all());
  66. Log::info($request->getMethod());
  67. Log::info('signCallBack-------------------end-----------------------signCallBack');
  68. return response('success');
  69. }
  70. public function orderCallBack(Request $request){
  71. Log::info('orderCallBack------------------------------------------orderCallBack');
  72. Log::info();
  73. Log::info($request->all());
  74. Log::info($request->getMethod());
  75. Log::info('orderCallBack--------------------endend----------------------orderCallBack');
  76. return response('success');
  77. }
  78. public function monthSignCallBack(Request $request){
  79. $key = 'sn7wluq5716brp8fzm';
  80. $app_id = $request->get('app_id');
  81. $plan_id = $request->get('plan_id');
  82. $user_id = $request->get('user_id');
  83. $change_type = $request->get('change_type');
  84. $sign = _sign(compact('app_id','plan_id','user_id','change_type'),$key.$key);
  85. $sign = strtoupper($sign);
  86. if($sign == $request->get('sign')){
  87. }
  88. }
  89. }