diff --git a/webapp/models/GoldBullion.php b/webapp/models/GoldBullion.php index 0f5bb390..ef68792d 100644 --- a/webapp/models/GoldBullion.php +++ b/webapp/models/GoldBullion.php @@ -11,16 +11,36 @@ class GoldBullion extends BaseModel { public static function onLogin() { + $address = myself()->_getAddress(); + if (empty($address)) { + return; + } $rows = SqlHelper::ormSelect( myself()->_getSelfMysql(), 't_gold_bullion', array( 'open_address' => myself()->_getAddress(), 'open_status' => self::OPEN_STATUS_PENDING, + 'returned' => 0, ) ); if (count($rows) > 0) { - + foreach ($rows as $row) { + SqlHelper::update( + myself()->_getSelfMysql(), + 't_gold_bullion', + array( + 'idx' => $row['idx'], + 'open_status' => self::OPEN_STATUS_PENDING + ), + array( + 'open_status' => self::OPEN_STATUS_SEND_BEGIN, + 'open_try_count' => function () { + return "open_try_count + 1"; + }, + ) + ); + } } }