Merge branch 'james_bc' into hjb

This commit is contained in:
hujiabin 2022-12-21 16:21:43 +08:00
commit 44da74f70b
8 changed files with 47 additions and 2 deletions

View File

@ -9,6 +9,7 @@ class NftIntro(object):
['idx', 0, 'idx'],
['token_id', '', 'token_id'],
['token_type', 0, 'nft类型 1:英雄 2:枪支 3:芯片'],
['amount', 0, '堆叠数量'],
['createtime', 0, '创建时间(上架时间)'],
['modifytime', 0, '修改时间(更新价格等)'],
['s_price', 0, '出售价格-暂定'],
@ -368,6 +369,7 @@ class Market(object):
['token', '', 'token'],
['nft_token', '', 'nft_token'],
['s_price', '', '出售价格USDT'],
['amount', 0, '出售数量'],
['payment_token_address', '', 'payment_token_address'],
['nonce', '', 'nonce'],
['signature', '', '签名soliditySha3(type, payment_token_address, price, nonce), 签名的replace客户端做处理'],

View File

@ -77,6 +77,7 @@ class User(object):
['guild_id', 0, '跟新工会id(可选参数,不传就不更新)'],
['guild_job', 0, '跟新工会职位(可选参数,不传就不更新)'],
['guild_name', 0, '跟新工会名称(可选参数,不传就不更新)'],
['parachute', 0, '跟新降落伞(可选参数,不传就不更新)'],
],
'response': [
_common.RspHead(),

View File

@ -149,6 +149,8 @@ class UserInfo(object):
['guild_id', '', '工会id'],
['guild_job', 0, '工会职位'],
['guild_name', '', '工会名称'],
['parachute', '', '当前使用的降落伞id'],
['!parachute_list', [0], '拥有的降落伞列表'],
]
class UserSimple(object):

View File

@ -65,6 +65,7 @@ CREATE TABLE `t_user` (
`guild_id` varchar(60) NOT NULL DEFAULT '' COMMENT '工会id',
`guild_job` int(11) NOT NULL DEFAULT '0' COMMENT '工会职位',
`guild_name` varchar(255) NOT NULL DEFAULT '' COMMENT '工会名称',
`parachute` int(11) NOT NULL DEFAULT '0' COMMENT '降落伞ID',
PRIMARY KEY (`idx`),
UNIQUE KEY `account_id` (`account_id`),
KEY `channel` (`channel`)

View File

@ -884,6 +884,7 @@ class MarketController extends BaseController {
$token = getReqVal('token', '');
$nft_token = getReqVal('nft_token', '');
$s_price = getReqVal('s_price', '');
$amount = getReqVal('amount', 1);
$payment_token_address = getReqVal('payment_token_address', '');
$nonce = getReqVal('nonce', '');
$signature = getReqVal('signature', '');
@ -901,6 +902,7 @@ class MarketController extends BaseController {
'token_id' => $nft_token,
'owner_address' => $nftDetail['owner_address'],
'token_type' => $nftDetail['type'],
'amount' => $amount,
'createtime' => myself()->_getNowTime(),
'modifytime' => myself()->_getNowTime(),
's_price' => $s_price,

View File

@ -486,6 +486,21 @@ class UserController extends BaseAuthedController {
'valid_func' => function ($val, &$errCode, &$errMsg) {
return true;
}
),
'parachute' => array(
'field_name' => 'parachute',
'val_func' => function ($val) {
return $val;
},
'valid_func' => function ($val, &$errCode, &$errMsg) {
if (User::isValidParachute($val)) {
return true;
} else {
$errCode = 1;
$errMsg = 'parachute parameter error';
return false;
}
}
)
);
$fieldsKv = array();

View File

@ -8,14 +8,25 @@ use mt;
use phpcommon\SqlHelper;
class Parachute extends BaseModel
{
public static $parachute = '170001'; //默认降落伞
public static function getMyParachute(){
return SqlHelper::ormSelect(
$list = array(
self::$parachute
);
$rows = SqlHelper::ormSelect(
myself()->_getSelfMysql(),
't_parachute',
array(
'account_id' => myself()->_getAccountId(),
)
);
if ($rows){
foreach ($rows as $row){
array_push($list, $row['item_id']);
}
}
return $list;
}
public static function addParachute($itemMeta){
if ($itemMeta){

View File

@ -4,11 +4,13 @@ namespace models;
require_once('mt/Item.php');
require_once('models/UserSeasonRing.php');
require_once('models/Parachute.php');
use mt;
use phpcommon;
use phpcommon\SqlHelper;
use models\UserSeasonRing;
use models\Parachute;
class User extends BaseModel {
@ -69,6 +71,8 @@ class User extends BaseModel {
'guild_id' => $row['guild_id'],
'guild_job' => $row['guild_job'],
'guild_name' => $row['guild_name'],
'parachute' => $row['parachute'] ? $row['parachute'] : Parachute::$parachute,
'parachute_list' => Parachute::getMyParachute(),
);
}
@ -106,7 +110,9 @@ class User extends BaseModel {
'guild_id' => $row['guild_id'],
'guild_job' => $row['guild_job'],
'guild_name' => $row['guild_name'],
'ring_list' => UserSeasonRing::ringList($row['account_id'])
'ring_list' => UserSeasonRing::ringList($row['account_id']),
'parachute' => $row['parachute'] ? $row['parachute'] : Parachute::$parachute,
'parachute_list' => Parachute::getMyParachute(),
);
}
@ -150,6 +156,11 @@ class User extends BaseModel {
return in_array($headFrame, $headFrameList);
}
public static function isValidParachute($parachute){
$parachuteList = Parachute::getMyParachute();
return in_array($parachute, $parachuteList);
}
private static function getHeadList($userInfo)
{
$headList = emptyReplace(json_decode($userInfo['head_list'], true), array());