70 lines
1.9 KiB
PHP
70 lines
1.9 KiB
PHP
<?php
|
|
|
|
|
|
namespace models;
|
|
|
|
use mt;
|
|
use phpcommon\SqlHelper;
|
|
class Contribution extends BaseModel
|
|
{
|
|
|
|
public static function find(){
|
|
$row = SqlHelper::ormSelectOne(
|
|
myself()->_getSelfMysql(),
|
|
't_contribution',
|
|
array(
|
|
'account_id' => myself()->_getAccountId(),
|
|
)
|
|
);
|
|
if (!$row){
|
|
return 0;
|
|
}
|
|
return $row['ingame_contribution'];
|
|
}
|
|
|
|
public static function add($point){
|
|
return;
|
|
SqlHelper::upsert(
|
|
myself()->_getSelfMysql(),
|
|
't_contribution',
|
|
array(
|
|
'account_id' => myself()->_getAccountId(),
|
|
),
|
|
array(
|
|
'contribution' => function () use ($point){
|
|
return "contribution + ${point}";
|
|
},
|
|
'ingame_contribution' => function () use ($point){
|
|
return "ingame_contribution + ${point}";
|
|
},
|
|
),
|
|
array(
|
|
'account_id' => myself()->_getAccountId(),
|
|
'contribution' => $point,
|
|
'ingame_contribution' => $point,
|
|
'createtime' => myself()->_getNowTime(),
|
|
'modifytime' => myself()->_getNowTime(),
|
|
)
|
|
);
|
|
}
|
|
|
|
public static function addHistory($gold,$point,$controller,$action){
|
|
return;
|
|
SqlHelper::insert(
|
|
myself()->_getSelfMysql(),
|
|
't_contribution_history',
|
|
array(
|
|
'account_id' => myself()->_getAccountId(),
|
|
'consume_gold' => $gold,
|
|
'contribution' => $point,
|
|
'controller' => $controller,
|
|
'action' => $action,
|
|
'createtime' => myself()->_getNowTime(),
|
|
'modifytime' => myself()->_getNowTime(),
|
|
)
|
|
);
|
|
}
|
|
|
|
|
|
}
|