SHARE
TWEET

Untitled

a guest Jun 8th, 2017 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ShinTrx < ActiveRecord::Base
  2.   establish_connection(
  3.     adapter: 'mysql2',
  4.     host: 'localhost',
  5.     encoding: 'utf8',
  6.     username: 'root',
  7.     password: '',
  8.     database: 'shinkansen'
  9.   )
  10.   self.table_name = 'transactions'
  11. end
  12. ShinTrx.connection
  13.  
  14. class ShinBook < ActiveRecord::Base
  15.   establish_connection(
  16.     adapter: 'mysql2',
  17.     host: 'localhost',
  18.     encoding: 'utf8',
  19.     username: 'root',
  20.     password: '',
  21.     database: 'shinkansen'
  22.   )
  23.   self.table_name = 'books'
  24. end
  25. ShinBook.connection
  26.  
  27. ids = ""
  28. ShinTrx.where(state: 5).find_each do |trx|
  29.   begin
  30.     ShinBook.where(transaction_id: trx.id).find_each do |book|
  31.       begin
  32.         res = VirtualProduct::Channel::Kai::GetBookInfo.info(book.book_code)
  33.         if res.book_balance != 0
  34.           ids = ids + trx.remote_transaction_id.to_s + "\n"
  35.         end
  36.       end
  37.     end
  38.   end
  39. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top