Test.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace app\master\controller;
  3. class Test
  4. {
  5. public function loginByPassword()
  6. {
  7. $curl = curl_init($this->urlCreate('master/loginByPassword'));
  8. $app = [
  9. 'mobile'=>'17316900863',
  10. 'password'=>'111111'
  11. ];
  12. curl_setopt($curl, CURLOPT_HEADER, 0);
  13. curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($this->loginDataCreate($app)));
  14. curl_setopt($curl, CURLOPT_POST,true);
  15. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  16. return curl_exec($curl);
  17. }
  18. public function cangCreate()
  19. {
  20. $curl = curl_init($this->urlCreate('cang/cangCreate'));
  21. $app = [
  22. 'mobile'=>'17316900863',
  23. 'password'=>'111111'
  24. ];
  25. curl_setopt($curl, CURLOPT_HEADER, 0);
  26. curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($this->loginDataCreate($app)));
  27. curl_setopt($curl, CURLOPT_POST,true);
  28. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  29. return curl_exec($curl);
  30. }
  31. public function hongbaoPlanSendUser()
  32. {
  33. $curl = curl_init($this->urlCreate('market/hongbaoPlanSendUser'));
  34. $app = [
  35. 'userID'=>15728,
  36. 'hongbaoIDS'=>[42,43]
  37. ];
  38. curl_setopt($curl, CURLOPT_HEADER, 0);
  39. curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($this->dataCreate($app)));
  40. curl_setopt($curl, CURLOPT_POST,true);
  41. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  42. return curl_exec($curl);
  43. }
  44. public function urlCreate($apiIcon) {
  45. return 'http://wxapp.dahengdian.com/master/'.$apiIcon;
  46. }
  47. //dataCreate
  48. public function dataCreate($app = []) {
  49. $data['token'] = '0a15d8e33aacbc6930fdca3c47112ad9';
  50. $data['app'] = $app;
  51. return $data;
  52. }
  53. public function loginDataCreate($app = []) {
  54. $data['token'] = '';
  55. $data['app'] = $app;
  56. return $data;
  57. }
  58. }