73 lines
2.3 KiB
PHP
73 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace models;
|
|
|
|
class User extends BaseModel {
|
|
|
|
public static function show($row)
|
|
{
|
|
return array(
|
|
'activated' => $row['activated'],
|
|
'account_id' => $row['account_id'],
|
|
'name' => $row['name'],
|
|
'sex' => $row['sex'],
|
|
'head_id' => $row['hero_id'],
|
|
'head_frame' => $row['head_frame'],
|
|
'level' => $row['level'],
|
|
'exp' => $row['exp'],
|
|
'rank' => $row['rank'],
|
|
'score' => $row['score'],
|
|
'gold' => $row['gold'],
|
|
'diamond' => $row['diamond'],
|
|
'hero_id' => $row['hero_id'],
|
|
'first_fight' => $row['first_fight'],
|
|
'head_list' => self::getHeadList($row),
|
|
'head_frame_list' => emptyReplace(json_decode($row['head_frame_list'], true), array()),
|
|
);
|
|
}
|
|
|
|
public static function info($row)
|
|
{
|
|
return array(
|
|
'activated' => $row['activated'],
|
|
'account_id' => $row['account_id'],
|
|
'name' => $row['name'],
|
|
'sex' => $row['sex'],
|
|
'head_id' => $row['hero_id'],
|
|
'head_frame' => $row['head_frame'],
|
|
'level' => $row['level'],
|
|
'exp' => $row['exp'],
|
|
'rank' => $row['rank'],
|
|
'score' => $row['score'],
|
|
'gold' => $row['gold'],
|
|
'diamond' => $row['diamond'],
|
|
'hero_id' => $row['hero_id'],
|
|
'first_fight' => $row['first_fight'],
|
|
'head_list' => self::getHeadList($row),
|
|
'head_frame_list' => emptyReplace(json_decode($row['head_frame_list'], true), array()),
|
|
);
|
|
}
|
|
|
|
public static function isValidHeadId($userInfo, $headId)
|
|
{
|
|
$headList = self::getHeadList($userInfo);
|
|
return in_array($headId, $headList);
|
|
}
|
|
|
|
public static function isValidHeadFrame($userInfo, $headFrame)
|
|
{
|
|
$headFrameList = !empty($userInfo['head_frame_list']) ?
|
|
json_decode($userInfo['head_frame_list'], true) : array();
|
|
return in_array($headFrame, $headFrameList);
|
|
}
|
|
|
|
private static function getHeadList($userInfo)
|
|
{
|
|
$headList = !empty($userInfo['head_list']) ? json_decode($userInfo['head_list'], true) : array();
|
|
$heroList = array();
|
|
$heroSkinList = array();
|
|
return $headList;
|
|
}
|
|
|
|
}
|