This commit is contained in:
aozhiwei 2021-11-26 14:24:31 +08:00
parent cef4576d09
commit 4f3a51cc68
2 changed files with 21 additions and 21 deletions

View File

@ -13,10 +13,10 @@ class Hero extends BaseModel {
public static function find($heroId) public static function find($heroId)
{ {
$row = SqlHelper::ormSelectOne( $row = SqlHelper::ormSelectOne(
myself()->getSelfMysql(), myself()->_getSelfMysql(),
't_hero', 't_hero',
array( array(
'accountid' => myself()->getAccountId(), 'accountid' => myself()->_getAccountId(),
'hero_id' => $heroId, 'hero_id' => $heroId,
) )
); );
@ -40,16 +40,16 @@ class Hero extends BaseModel {
{ {
$defSkin = mt\Hero::getDefaultSkin($heroMeta); $defSkin = mt\Hero::getDefaultSkin($heroMeta);
SqlHelper::upsert( SqlHelper::upsert(
myself()->getSelfMysql(), myself()->_getSelfMysql(),
't_hero', 't_hero',
array( array(
'accountid' => myself()->getAccountId(), 'accountid' => myself()->_getAccountId(),
'hero_id' => $heroMeta['id'] 'hero_id' => $heroMeta['id']
), ),
array( array(
), ),
array( array(
'accountid' => myself()->getAccountId(), 'accountid' => myself()->_getAccountId(),
'hero_id' => $heroMeta['id'], 'hero_id' => $heroMeta['id'],
'hero_lv' => 1, 'hero_lv' => 1,
'skin_id' => $defSkin, 'skin_id' => $defSkin,
@ -57,8 +57,8 @@ class Hero extends BaseModel {
'skill1_lv2' => 1, 'skill1_lv2' => 1,
'yoke_lv' => 0, 'yoke_lv' => 0,
'yoke_exp' => 0, 'yoke_exp' => 0,
'createtime' => myself()->getNowTime(), 'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->getNowTime() 'modifytime' => myself()->_getNowTime()
) )
); );
if ($defSkin) { if ($defSkin) {
@ -69,15 +69,15 @@ class Hero extends BaseModel {
public static function takeonSkin($heroId, $skinId) public static function takeonSkin($heroId, $skinId)
{ {
SqlHelper::update( SqlHelper::update(
myself()->getSelfMysql(), myself()->_getSelfMysql(),
't_hero', 't_hero',
array( array(
'accountid' => myself()->getAccountId(), 'accountid' => myself()->_getAccountId(),
'hero_id' => $heroMeta['id'] 'hero_id' => $heroMeta['id']
), ),
array( array(
'skin_id' => $skinId, 'skin_id' => $skinId,
'modifytime' => myself()->getNowTime() 'modifytime' => myself()->_getNowTime()
) )
); );
} }
@ -89,17 +89,17 @@ class Hero extends BaseModel {
} }
$fieldName = 'skill1_lv' . ($skillIdx + 1); $fieldName = 'skill1_lv' . ($skillIdx + 1);
SqlHelper::update( SqlHelper::update(
myself()->getSelfMysql(), myself()->_getSelfMysql(),
't_hero', 't_hero',
array( array(
'accountid' => myself()->getAccountId(), 'accountid' => myself()->_getAccountId(),
'hero_id' => $heroId 'hero_id' => $heroId
), ),
array( array(
$fieldName => function () use($fieldName) { $fieldName => function () use($fieldName) {
return "${fieldName} + 1"; return "${fieldName} + 1";
}, },
'modifytime' => myself()->getNowTime() 'modifytime' => myself()->_getNowTime()
) )
); );
} }

View File

@ -12,10 +12,10 @@ class HeroSkin extends BaseModel {
public static function find($skinId) public static function find($skinId)
{ {
$row = SqlHelper::ormSelectOne( $row = SqlHelper::ormSelectOne(
myself()->getSelfMysql(), myself()->_getSelfMysql(),
't_hero_skin', 't_hero_skin',
array( array(
'accountid' => myself()->getAccountId(), 'accountid' => myself()->_getAccountId(),
'skin_id' => $skinId 'skin_id' => $skinId
) )
); );
@ -36,25 +36,25 @@ class HeroSkin extends BaseModel {
public static function addSkin($skinId) public static function addSkin($skinId)
{ {
SqlHelper::upsert( SqlHelper::upsert(
myself()->getSelfMysql(), myself()->_getSelfMysql(),
't_hero_skin', 't_hero_skin',
array( array(
'accountid' => myself()->getAccountId(), 'accountid' => myself()->_getAccountId(),
'skin_id' => $skinId 'skin_id' => $skinId
), ),
array( array(
'skin_state' => 3, 'skin_state' => 3,
'modifytime' => myself()->getNowTime() 'modifytime' => myself()->_getNowTime()
), ),
array( array(
'accountid' => myself()->getAccountId(), 'accountid' => myself()->_getAccountId(),
'skin_id' => $skinId, 'skin_id' => $skinId,
'skin_state' => 0, 'skin_state' => 0,
'get_from' => 0, 'get_from' => 0,
'consume_num' => 0, 'consume_num' => 0,
'trytime' => 0, 'trytime' => 0,
'createtime' => myself()->getNowTime(), 'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->getNowTime() 'modifytime' => myself()->_getNowTime()
) )
); );
} }