private void threadProc() { while (!_isbreak) { int week = Convert.ToInt32(DateTime.Now.DayOfWeek.ToString("d")); int beginHour = 8; int endHour = 21; if (week > 0 && week < 6) //if (true) { if (DateTime.Now.Hour >= beginHour && DateTime.Now.Hour <= endHour) //if (true) { List <DebitUserRecord> taskList = BusinessDao.GetReadyReleaseDebitRecords(); LoanBank bank = new LoanBank(); Log.WriteDebugLog("TaskThread::threadProc", "今天是星期:{0} 是放款日,放款时间段:{1}点- {2}点,待放款数据为:{3}条" , week, beginHour, endHour, taskList.Count); if (taskList.Count > 0) { foreach (DebitUserRecord record in taskList) { try { BusinessDao.SetDebitRecordStatus(record.debitId, 5, "Pencairan dana sedang dalam proses(10002)"); string errMsg = String.Empty; if (bank.Transfer(record, out errMsg)) { BusinessDao.SetDebitRecordStatus(record.debitId, 1, "Uang anda telah berhasil di transfer(10002)."); //在此处可增加放款成功的短信通知 WaveCellSMSSingleSender sms = new WaveCellSMSSingleSender(); WaveCellSMSSingleSender.Authorization = "Bearer yCCTxuCM7nIbdEuIxENllGMuqlF90qjtMlhb201S0bI"; WaveCellSMSSingleSender.SubAccountName = "Prodigy_DANA"; } else { BusinessDao.SetDebitRecordStatus(record.debitId, -1, errMsg); } } catch (Exception ex) { Log.WriteErrorLog("TaskThread::threadProc", ex.Message); } } } } else { Log.WriteDebugLog("TaskThread::threadProc", "今天是星期:{0} 放款时间段:{1}点- {2}点,现在是:{3}点" , week, beginHour, endHour, DateTime.Now.Hour); } } else { Log.WriteDebugLog("TaskThread::threadProc", "今天是星期:{0} 不放款。", week); } Thread.Sleep(3 * 60 * 1000); } }
static void Main(string[] args) { //AGUSTINUS WAHYU TETRA NO !=agustinus wahyu tetra novranta //: != Console.WriteLine(Convert.ToString(Levenshtein("CHINTIA D W LASUT", "chintia dervini wulandari lasut".ToUpper()))); Log.Init(1, 50240000, "yyyyMMdd", @"./logs/", LogType.Debug); DataBaseOperator.SetDbIniFilePath("."); Log.WriteDebugLog("ControlCenter::Startup", "Begin connect db"); string connStr = DataBasePool.AddDataBaseConnectionString("debittest", "!%(**$*@^77f1fjj", 5, 5); Log.WriteDebugLog("ControlCenter::Startup", connStr); DataBaseOperator.Init("debittest"); ControlCenter cc = new ControlCenter(); cc.Start(); while (true) { Thread.Sleep(100000); } return; string serverInfo = "127.0.0.1:6379"; string password = "******"; RedisPools.RedisPools.Init(serverInfo, Proxy.None, 200, password); LoanBank bank = new LoanBank(); DebitUserRecord record = new DebitUserRecord(); record.debitId = 111; record.bankAccount = "1680001297876"; record.bankCode = "008"; record.amountTransfer = 10000; record.purpose = "test"; record.userId = 27; record.userName = "******"; string errMsg = String.Empty; bank.Transfer(record, out errMsg); //bank.CheckTransferStatus("10013"); //$paramSignature = $email . $timestamp . $bankCode . $bankAccount . $accountName . $custRefNumber . $amountTransfer . $purpose . $disburseId . $secretKey; }
private void threadProc() { while (!_isbreak) { SortedList <string, string> list = BusinessDao.GetNeedCheckDebitRecords(); Log.WriteDebugLog("StatusCheckThread::threadProc", "存在{0}个需要确认的订单。", list.Count); foreach (string orderId in list.Keys) { string target = list[orderId]; Log.WriteDebugLog("StatusCheckThread::threadProc", "{0} 准备开始确认订单的状态,渠道{1}。", orderId, target); LoanBank bank = new LoanBank(); string merchantCode = String.Empty; InquriyTransferResponse response = bank.DuitkuOrderStatusInquiryRequest(orderId, target); if (response.statusCode == "00") { CallbackRequestModel callback = new CallbackRequestModel(); callback.amount = response.amount; callback.merchantOrderId = response.merchantOrderId; DataProviderResultModel resultModel = DuitkuProvider.SetDuitkuPaybackRecordStaus(callback); if (resultModel.result == Result.SUCCESS) { Log.WriteDebugLog("StatusCheckThread::threadProc", "[{0}]重做成功了。", orderId); } else { Log.WriteDebugLog("StatusCheckThread::threadProc", "[{0}]接口调用成功,但是数据库操作失败了。", orderId); } } else { Log.WriteDebugLog("StatusCheckThread::threadProc", "[{0}]重做失败了。", orderId); } ///重做次数+1 BusinessDao.UpdateRedoUserPayBackRecordStatus(orderId); } Thread.Sleep(10 * 60 * 1000); } }