예제 #1
0
    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);
        }
    }
예제 #2
0
        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;
        }