game2006api/webapp/models/Currency.php
2022-12-12 10:48:48 +08:00

162 lines
5.4 KiB
PHP

<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class Currency extends BaseModel
{
public static function getCurrencyList(){
$baseList = self::baseCurrency();
$rows = SqlHelper::ormSelect(
myself()->_getSelfMysql(),
't_user_currency',
array(
'account_id'=>myself()->_getAccountId()
)
);
if ($rows){
$list = array_merge($baseList,$rows);
}else{
$list = $baseList;
}
return $list;
}
public static function addCurrency($data){
if (!$data){
return;
}
SqlHelper::upsert
(myself()->_getSelfMysql(),
't_user_currency',
array(
'account_id' => myself()->_getAccountId(),
'net_id' => $data['net_id'],
'address' => $data['address'],
),
array(
),
array(
'account_id' => myself()->_getAccountId(),
'net_id' => $data['net_id'],
'address' => $data['address'],
'symbol' => $data['symbol'],
'precision' => $data['precision'],
'type' => $data['type'],
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
)
);
}
private static function baseCurrency(){
if (SERVER_ENV == _ONLINE) {
return array(
array(
'account_id'=> myself()->_getAccountId(),
'net_id'=>80001,
'address'=>'0xfa513999031dC1DCf86e99d91101e17d07839235',
'symbol'=>'CEC',
'precision'=>18,
'type'=>3,
),
array(
'account_id'=> myself()->_getAccountId(),
'net_id'=>80001,
'address'=>'0x9f87eCA8F0479383fF11a5AB2336b5A6c383d6F3',
'symbol'=>'CEG',
'precision'=>18,
'type'=>3,
),
array(
'account_id'=> myself()->_getAccountId(),
'net_id'=>80001,
'address'=>'0x3EBF5196dADC8F3F09C808333f98FE8A4b7d1e62',
'symbol'=>'hero',
'precision'=>18,
'type'=>1,
),
array(
'account_id'=> myself()->_getAccountId(),
'net_id'=>80001,
'address'=>'0x2F2Ed1c403cB7156617449795dE1CB47A0302a25',
'symbol'=>'weapon',
'precision'=>18,
'type'=>1,
),
array(
'account_id'=> myself()->_getAccountId(),
'net_id'=>80001,
'address'=>'0x73482411443E87CAC124C12A10B34e9Aaa2De168',
'symbol'=>'chip',
'precision'=>18,
'type'=>2,
),
array(
'account_id'=> myself()->_getAccountId(),
'net_id'=>80001,
'address'=>'0xFc21A863bFb4E4534B246078772e2074e076f0a7',
'symbol'=>'shard',
'precision'=>18,
'type'=>2,
),
);
}else{
return array(
array(
'account_id'=> myself()->_getAccountId(),
'net_id'=>1338,
'address'=>'0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7',
'symbol'=>'CEC',
'precision'=>18,
'type'=>3,
),
array(
'account_id'=> myself()->_getAccountId(),
'net_id'=>1338,
'address'=>'0x59d3631c86BbE35EF041872d502F218A39FBa150',
'symbol'=>'CEG',
'precision'=>18,
'type'=>3,
),
array(
'account_id'=> myself()->_getAccountId(),
'net_id'=>1338,
'address'=>'0x9b1f7F645351AF3631a656421eD2e40f2802E6c0',
'symbol'=>'hero',
'precision'=>18,
'type'=>1,
),
array(
'account_id'=> myself()->_getAccountId(),
'net_id'=>1338,
'address'=>'0x2612Af3A521c2df9EAF28422Ca335b04AdF3ac66',
'symbol'=>'weapon',
'precision'=>18,
'type'=>1,
),
array(
'account_id'=> myself()->_getAccountId(),
'net_id'=>1338,
'address'=>'0x26b4AFb60d6C903165150C6F0AA14F8016bE4aec',
'symbol'=>'chip',
'precision'=>18,
'type'=>2,
),
array(
'account_id'=> myself()->_getAccountId(),
'net_id'=>1338,
'address'=>'0x0E696947A06550DEf604e82C26fd9E493e576337',
'symbol'=>'shard',
'precision'=>18,
'type'=>2,
),
);
}
}
}