game2006api/webapp/models/GoldBullion.php
aozhiwei eee2c3892c 1
2024-06-11 11:58:07 +08:00

47 lines
1.2 KiB
PHP

<?php
namespace models;
class GoldBullion extends BaseModel {
const OPEN_STATUS_SENT = 1;
const OPEN_STATUS_PENDING = 2;
const OPEN_STATUS_SEND_BEGIN = 3;
const OPEN_STATUS_SEND_END = 4;
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']
),
array(
'open_status' => self::OPEN_STATUS_SEND_BEGIN,
'open_try_count' => function () {
return "open_try_count + 1";
},
)
);
}
}
}
}