Test.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. <?php
  2. namespace app\mobile_v_2_1\controller;
  3. use app\mobile_v_2_1\logic\Cang as Logic;
  4. use think\Controller;
  5. use think\Exception;
  6. use think\Log;
  7. class Test extends Controller
  8. {
  9. //jiaqiancaifu.dahengdian.com/mobile/test/registerSendMobileCode
  10. public function registerSendMobileCode()
  11. {
  12. $curl = curl_init("https://jiaqiancaifu.dahengdian.com/mobile/user/registerSendMobileCode");
  13. $app = [
  14. 'mobile'=>'17316900863'
  15. ];
  16. curl_setopt($curl, CURLOPT_HEADER, 0);
  17. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  18. curl_setopt($curl, CURLOPT_POST,true);
  19. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  20. return curl_exec($curl);
  21. }
  22. //http://jiaqiancaifu.dahengdian.com/mobile/test/register
  23. public function register()
  24. {
  25. $curl = curl_init($this->urlCreate('user/register'));
  26. $app = [
  27. 'mobile'=>'17316900863',
  28. 'mobileCode'=>'6310',
  29. 'password'=>'111111',
  30. 'passwordRe'=>'111111'
  31. ];
  32. curl_setopt($curl, CURLOPT_HEADER, 0);
  33. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  34. curl_setopt($curl, CURLOPT_POST,true);
  35. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  36. return curl_exec($curl);
  37. }
  38. //http://jiaqiancaifu.dahengdian.com/mobile/test/logout
  39. public function logout()
  40. {
  41. $curl = curl_init($this->urlCreate('user/logout'));
  42. $app = new \stdClass();
  43. curl_setopt($curl, CURLOPT_HEADER, 0);
  44. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  45. curl_setopt($curl, CURLOPT_POST,true);
  46. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  47. return curl_exec($curl);
  48. }
  49. //http://jiaqiancaifu.dahengdian.com/mobile/test/getLoginAd
  50. public function getLoginAd()
  51. {
  52. $curl = curl_init($this->urlCreate('ext/getLoginAd'));
  53. $app = new \stdClass();
  54. curl_setopt($curl, CURLOPT_HEADER, 0);
  55. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  56. curl_setopt($curl, CURLOPT_POST,true);
  57. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  58. return curl_exec($curl);
  59. }
  60. //http://jiaqiancaifu.dahengdian.com/mobile/test/loginByPassword
  61. public function loginByPassword()
  62. {
  63. $curl = curl_init($this->urlCreate('user/loginByPassword'));
  64. $app = [
  65. 'mobile'=>'17316900863',
  66. 'password'=>'qissen111111'
  67. ];
  68. curl_setopt($curl, CURLOPT_HEADER, 0);
  69. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  70. curl_setopt($curl, CURLOPT_POST,true);
  71. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  72. return curl_exec($curl);
  73. }
  74. //http://jiaqiancaifu.dahengdian.com/mobile/test/getUserBankList
  75. public function getUserBankList()
  76. {
  77. $curl = curl_init($this->urlCreate('user/getUserBankList'));
  78. $app = new \stdClass();
  79. curl_setopt($curl, CURLOPT_HEADER, 0);
  80. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  81. curl_setopt($curl, CURLOPT_POST,true);
  82. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  83. return curl_exec($curl);
  84. }
  85. //http://jiaqiancaifu.dahengdian.com/mobile/test/getUserInfo
  86. public function getUserInfo()
  87. {
  88. $curl = curl_init($this->urlCreate('user/getUserInfo'));
  89. $app = new \stdClass();
  90. curl_setopt($curl, CURLOPT_HEADER, 0);
  91. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  92. curl_setopt($curl, CURLOPT_POST,true);
  93. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  94. return curl_exec($curl);
  95. }
  96. //http://jiaqiancaifu.dahengdian.com/mobile/test/cang
  97. public function cang() {
  98. $curl = curl_init("http://jiaqiancaifu.dahengdian.com/mobile/cang/create");
  99. $app = [
  100. 'moneySubject'=>'100.00',
  101. 'subjectID'=>'44',
  102. 'hongbaoIDS'=>[155]
  103. ];
  104. curl_setopt($curl, CURLOPT_HEADER, 0);
  105. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  106. curl_setopt($curl, CURLOPT_POST,true);
  107. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  108. return curl_exec($curl);
  109. }
  110. //http://jiaqiancaifu.dahengdian.com/mobile/test/getUserHongbaoList
  111. public function getUserHongbaoList()
  112. {
  113. $curl = curl_init("http://jiaqiancaifu.dahengdian.com/mobile/user/getUserHongbaoList");
  114. $app = new \stdClass();
  115. curl_setopt($curl, CURLOPT_HEADER, 0);
  116. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  117. curl_setopt($curl, CURLOPT_POST, true);
  118. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  119. return curl_exec($curl);
  120. }
  121. //http://wxapp.dahengdian.com/mobile_v_2_1/test/getIndexInfo
  122. public function getIndexInfo()
  123. {
  124. $curl = curl_init("http://wxapp.dahengdian.com/mobile_v_2_1/index/getIndexInfo");
  125. $app = new \stdClass();
  126. curl_setopt($curl, CURLOPT_HEADER, 0);
  127. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  128. curl_setopt($curl, CURLOPT_POST, true);
  129. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  130. return curl_exec($curl);
  131. }
  132. //http://jiaqiancaifu.dahengdian.com/mobile/test/getSubjectList
  133. public function getSubjectList()
  134. {
  135. $curl = curl_init("http://jiaqiancaifu.dahengdian.com/mobile/subject/getSubjectList");
  136. $app = new \stdClass();
  137. curl_setopt($curl, CURLOPT_HEADER, 0);
  138. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  139. curl_setopt($curl, CURLOPT_POST, true);
  140. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  141. return curl_exec($curl);
  142. }
  143. //http://jiaqiancaifu.dahengdian.com/mobile/test/contract
  144. public function contract()
  145. {
  146. $app = [
  147. 'money'=>'100.32',
  148. 'userBankID'=>13
  149. ];
  150. $url = 'http://jiaqiancaifu.dahengdian.com/mobile/h5/contract?track='.$this->dataCreateH5($app);
  151. $this->redirect($url);
  152. }
  153. //http://wxapp.dahengdian.com/mobile_v_2_1/test/cancelUser
  154. public function cancelUser()
  155. {
  156. $app = [
  157. 'abcd'=>''
  158. ];
  159. $url = 'http://wxapp.dahengdian.com/mobile_v_2_1/h5/userCancelUser?track='.$this->dataCreateH5($app);
  160. $this->redirect($url);
  161. }
  162. //http://jiaqiancaifu.dahengdian.com/mobile/test/getBankList
  163. public function getBankList()
  164. {
  165. $curl = curl_init("http://jiaqiancaifu.dahengdian.com/mobile/system/getBankList");
  166. $app = new \stdClass();
  167. curl_setopt($curl, CURLOPT_HEADER, 0);
  168. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  169. curl_setopt($curl, CURLOPT_POST, true);
  170. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  171. return curl_exec($curl);
  172. }
  173. //http://jiaqiancaifu.dahengdian.com/mobile/test/checkInfo
  174. public function checkInfo()
  175. {
  176. $curl = curl_init("http://jiaqiancaifu.dahengdian.com/mobile/user/checkInfo");
  177. $app = [
  178. 'trueName'=>'张奇',
  179. 'passport'=>'230523198606180810',
  180. 'mobile'=>'13136180523',
  181. 'mobileCode'=>'892686',
  182. 'bankNumber'=>'6217001540014586968',
  183. 'bankID'=>4
  184. ];
  185. curl_setopt($curl, CURLOPT_HEADER, 0);
  186. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  187. curl_setopt($curl, CURLOPT_POST, true);
  188. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  189. return curl_exec($curl);
  190. }
  191. //http://jiaqiancaifu.dahengdian.com/mobile/test/checkInfoSendMobileCode
  192. public function checkInfoSendMobileCode()
  193. {
  194. $curl = curl_init("http://jiaqiancaifu.dahengdian.com/mobile/user/checkInfoSendMobileCode");
  195. $app = [
  196. 'mobile'=>'13516825311'
  197. ];
  198. curl_setopt($curl, CURLOPT_HEADER, 0);
  199. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  200. curl_setopt($curl, CURLOPT_POST, true);
  201. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  202. return curl_exec($curl);
  203. }
  204. //http://jiaqiancaifu.dahengdian.com/mobile/test/getConfig
  205. public function getConfig()
  206. {
  207. $curl = curl_init("http://jiaqiancaifu.dahengdian.com/mobile/system/getConfig");
  208. $app = [
  209. 'mobile'=>'17316800863'
  210. ];
  211. curl_setopt($curl, CURLOPT_HEADER, 0);
  212. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  213. curl_setopt($curl, CURLOPT_POST, true);
  214. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  215. return curl_exec($curl);
  216. }
  217. //http://jiaqiancaifu.dahengdian.com/mobile/test/getUserFinanceList
  218. public function getUserFinanceList()
  219. {
  220. $curl = curl_init("http://jiaqiancaifu.dahengdian.com/mobile/user/getUserFinanceList");
  221. $app = new \stdClass();
  222. curl_setopt($curl, CURLOPT_HEADER, 0);
  223. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  224. curl_setopt($curl, CURLOPT_POST, true);
  225. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  226. return curl_exec($curl);
  227. }
  228. //http://jiaqiancaifu.dahengdian.com/mobile/test/userRecharge
  229. public function userRecharge()
  230. {
  231. $app = [
  232. 'money'=>'100.32',
  233. 'userBankID'=>13
  234. ];
  235. $url = 'http://jiaqiancaifu.dahengdian.com/mobile/h5/userRecharge?track='.$this->dataCreateH5($app);
  236. $this->redirect($url);
  237. }
  238. //http://jiaqiancaifu.dahengdian.com/mobile/test/userDrawcash
  239. public function userDrawcash()
  240. {
  241. $app = [
  242. 'money'=>'1',
  243. 'userBankID'=>13
  244. ];
  245. $url = 'http://jiaqiancaifu.dahengdian.com/mobile/h5/userDrawcash?track='.$this->dataCreateH5($app);
  246. $this->redirect($url);
  247. }
  248. //http://jiaqiancaifu.dahengdian.com/mobile/test/activeList
  249. public function activeList()
  250. {
  251. $app = [
  252. 'money'=>'1',
  253. 'userBankID'=>13
  254. ];
  255. $url = 'http://jiaqiancaifu.dahengdian.com/mobile/h5/activeList?track='.$this->dataCreateH5($app);
  256. $this->redirect($url);
  257. }
  258. //http://jiaqiancaifu.dahengdian.com/mobile/test/subjectContent
  259. public function subjectContent()
  260. {
  261. $app = [
  262. 'subjectID'=>13
  263. ];
  264. $url = 'http://jiaqiancaifu.dahengdian.com/mobile/h5/subjectContent?track='.$this->dataCreateH5($app);
  265. $this->redirect($url);
  266. }
  267. //http://jiaqiancaifu.dahengdian.com/mobile_v_2_1/test/regAgreement
  268. public function regAgreement()
  269. {
  270. $app = [
  271. 'subjectID'=>13
  272. ];
  273. $url = 'http://jiaqiancaifu.dahengdian.com/mobile_v_2_1/h5/regAgreement?track='.$this->dataCreateH5($app);
  274. $this->redirect($url);
  275. }
  276. //http://jiaqiancaifu.dahengdian.com/mobile/test/safe
  277. public function safe()
  278. {
  279. $app = [
  280. 'subjectID'=>13
  281. ];
  282. $url = 'http://jiaqiancaifu.dahengdian.com/mobile/h5/safe?track='.$this->dataCreateH5($app);
  283. $this->redirect($url);
  284. }
  285. //http://jiaqiancaifu.dahengdian.com/mobile/test/getSubjectContent
  286. public function getSubjectContent() {
  287. $curl = curl_init("http://jiaqiancaifu.dahengdian.com/mobile/subject/getSubjectContent");
  288. $app = [
  289. 'subjectID'=>766
  290. ];
  291. curl_setopt($curl, CURLOPT_HEADER, 0);
  292. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  293. curl_setopt($curl, CURLOPT_POST,true);
  294. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  295. return curl_exec($curl);
  296. }
  297. public function getCangList() {
  298. $curl = curl_init("http://jiaqiancaifu.dahengdian.com/mobile/cang/getCangList");
  299. $app = [
  300. 'status'=>1
  301. ];
  302. curl_setopt($curl, CURLOPT_HEADER, 0);
  303. curl_setopt($curl, CURLOPT_POSTFIELDS, $this->dataCreate($app));
  304. curl_setopt($curl, CURLOPT_POST,true);
  305. curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
  306. return curl_exec($curl);
  307. }
  308. public function urlCreate($apiIcon) {
  309. return 'http://wxapp.dahengdian.com/mobile_v_2_1/'.$apiIcon;
  310. }
  311. public function dataCreateH5($app = []) {
  312. $data['apiV'] = 'v1';
  313. $data['osV'] = 'android1.1';
  314. $data['osType'] = '2';
  315. $data['appV'] = '1';
  316. $data['deviceID'] = 'a898723jhjka89789auioajhfa';
  317. $data['token'] = '0787211ffebcc71c8a4d2f570231b948';
  318. $data['ip'] = '192.168.1.1';
  319. $data['channel'] = '123';
  320. $data['time'] = (int)THINK_START_TIME;
  321. $appJson = json_encode($app, JSON_UNESCAPED_UNICODE);
  322. Log::info($appJson);
  323. $signPre = 'aladfa5a4g46jh4vb44n4e4r4t'.$data['token'].$data['time'].$data['appV'].$data['apiV'].$data['osV'].$data['osType'].$data['deviceID'].$data['ip'].$data['channel'].$appJson;
  324. Log::info($signPre);
  325. $data['sign'] = md5($signPre);
  326. $data['app'] = $app;
  327. return json_encode($data);
  328. }
  329. public function dataCreate($app = []) {
  330. $data['apiV'] = 'v1';
  331. $data['osV'] = 'android1.1';
  332. $data['osType'] = '2';
  333. $data['appV'] = '1';
  334. $data['deviceID'] = 'a898723jhjka89789auioajhfa';
  335. $data['token'] = '0787211ffebcc71c8a4d2f570231b948';
  336. $data['ip'] = '192.168.1.1';
  337. $data['channel'] = '123';
  338. $data['time'] = (int)THINK_START_TIME;
  339. $data['app'] = $app;
  340. $appJson = json_encode($data['app'], JSON_UNESCAPED_UNICODE);
  341. Log::info($appJson);
  342. $signPre = 'aladfa5a4g46jh4vb44n4e4r4t'.$data['token'].$data['time'].$data['appV'].$data['apiV'].$data['osV'].$data['osType'].$data['deviceID'].$data['ip'].$data['channel'].$appJson;
  343. Log::info($signPre);
  344. $data['sign'] = md5($signPre);
  345. $data = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
  346. return $data;
  347. }
  348. public function loginDataCreate($app) {
  349. $data['apiV'] = 'v1';
  350. $data['osV'] = 'android1.1';
  351. $data['osType'] = '2';
  352. $data['appV'] = '1';
  353. $data['deviceID'] = 'a898723jhjka89789auioajhfa';
  354. $data['token'] = '';
  355. $data['channel'] = '123';
  356. $data['time'] = (int)THINK_START_TIME;
  357. $data['app'] = $app;
  358. $data['ip'] = '192.168.1.1';
  359. $appJson = json_encode($data['app']);
  360. Log::info($appJson);
  361. $signPre = $data['token'].$data['time'].$data['appV'].$data['apiV'].$data['osV'].$data['osType'].$data['deviceID'].$data['ip'].$data['channel'].$appJson;
  362. Log::info($signPre);
  363. $data['sign'] = md5($signPre);
  364. Log::info($data);
  365. $data = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
  366. }
  367. }