| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace app\api\controller;
- use think\Db;
- class debug
- {
- public function rest_exchange()
- {
- $orders = Db::name('rwa_exchange_record_1')->group('order_no')->select();
- $i = 0;
- foreach ($orders as $order) {
- $order_no = $order['order_no'];
- $order_list = Db::name('rwa_exchange_record_1')->where('order_no', $order_no)->select();
- $usdt_info = $token_info = [];
- foreach ($order_list as $item) {
- if ($item['symbol'] == 'USDT') {
- $usdt_info = $item;
- } else {
- $token_info = $item;
- }
- }
- dump($usdt_info);
- dump($token_info);
- $inster_data = [
- 'order_no' => $order_no,
- 'user_id' => $order['user_id'],
- 'welfare_id' => 1,
- 'product_id' => $order['product_id'],
- 'tx_hash_usdt' => $usdt_info['tx_hash'],
- 'from_address_usdt' => $usdt_info['from_address'],
- 'amount_usdt' => $usdt_info['amount'],
- 'token_name' => $token_info['symbol'],
- 'from_address_token' => $token_info['from_address'],
- 'amount_token' => $token_info['amount'],
- 'tx_hash_token' => $token_info['tx_hash'],
- 'to_address' => $order['to_address'],
- 'create_time' => $token_info['create_time']
- ];
- dump('拼接数据');
- dump($inster_data);
- $rs = Db::name('rwa_exchange_record_back')->insert($inster_data);
- dump($rs);
- dump('完成:' . $order_no);
- $i++;
- }
- dump('共完成:' . $i . '条');
- }
- }
|