50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace models;
|
|
|
|
use mt;
|
|
use phpcommon\SqlHelper;
|
|
|
|
class TicketConsumeRecord extends BaseModel {
|
|
|
|
public static function add($matchRoomUuid, $accountId)
|
|
{
|
|
SqlHelper::upsert(
|
|
myself()->_getSelfMysql(),
|
|
't_ticket_consume_record',
|
|
array(
|
|
'match_room_uuid' => $matchRoomUuid,
|
|
'account_id' => $accountId,
|
|
),
|
|
array(
|
|
|
|
),
|
|
array(
|
|
'match_room_uuid' => $matchRoomUuid,
|
|
'account_id' => $accountId,
|
|
'createtime' => myself()->_getNowTime(),
|
|
'modifytime' => myself()->_getNowTime(),
|
|
)
|
|
);
|
|
}
|
|
|
|
public static function getRecord($matchRoomUuid){
|
|
if (!self::$matchRoomUuid || self::$matchRoomUuid != $matchRoomUuid){
|
|
self::$matchRoomUuid = $matchRoomUuid;
|
|
$rows = SqlHelper::ormSelect(
|
|
myself()->_getSelfMysql(),
|
|
't_ticket_consume_record',
|
|
array(
|
|
'match_room_uuid' => $matchRoomUuid,
|
|
)
|
|
);
|
|
self::$ticketNum = count($rows);
|
|
}
|
|
return self::$ticketNum;
|
|
}
|
|
|
|
private static $matchRoomUuid = null;
|
|
private static $ticketNum = 0;
|
|
|
|
}
|