debug.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace app\api\controller;
  3. use think\Db;
  4. class debug
  5. {
  6. public function rest_exchange()
  7. {
  8. $orders = Db::name('rwa_exchange_record_1')->group('order_no')->select();
  9. $i = 0;
  10. foreach ($orders as $order) {
  11. $order_no = $order['order_no'];
  12. $order_list = Db::name('rwa_exchange_record_1')->where('order_no', $order_no)->select();
  13. $usdt_info = $token_info = [];
  14. foreach ($order_list as $item) {
  15. if ($item['symbol'] == 'USDT') {
  16. $usdt_info = $item;
  17. } else {
  18. $token_info = $item;
  19. }
  20. }
  21. dump($usdt_info);
  22. dump($token_info);
  23. $inster_data = [
  24. 'order_no' => $order_no,
  25. 'user_id' => $order['user_id'],
  26. 'welfare_id' => 1,
  27. 'product_id' => $order['product_id'],
  28. 'tx_hash_usdt' => $usdt_info['tx_hash'],
  29. 'from_address_usdt' => $usdt_info['from_address'],
  30. 'amount_usdt' => $usdt_info['amount'],
  31. 'token_name' => $token_info['symbol'],
  32. 'from_address_token' => $token_info['from_address'],
  33. 'amount_token' => $token_info['amount'],
  34. 'tx_hash_token' => $token_info['tx_hash'],
  35. 'to_address' => $order['to_address'],
  36. 'create_time' => $token_info['create_time']
  37. ];
  38. dump('拼接数据');
  39. dump($inster_data);
  40. $rs = Db::name('rwa_exchange_record_back')->insert($inster_data);
  41. dump($rs);
  42. dump('完成:' . $order_no);
  43. $i++;
  44. }
  45. dump('共完成:' . $i . '条');
  46. }
  47. }