56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?php
|
|
|
|
|
|
namespace models;
|
|
require_once('mt/Item.php');
|
|
|
|
use mt;
|
|
use phpcommon\SqlHelper;
|
|
class Parachute extends BaseModel
|
|
{
|
|
public static $parachute = '170001'; //默认降落伞
|
|
|
|
public static function getMyParachute(){
|
|
$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){
|
|
if ($itemMeta['type'] == mt\Item::PARACHUTE_TYPE){
|
|
SqlHelper::upsert(
|
|
myself()->_getSelfMysql(),
|
|
't_parachute',
|
|
array(
|
|
'account_id' => myself()->_getAccountId(),
|
|
'item_id' => $itemMeta['id'],
|
|
),
|
|
array(),
|
|
array(
|
|
'account_id' => myself()->_getAccountId(),
|
|
'item_id' => $itemMeta['id'],
|
|
'createtime' => myself()->_getNowTime(),
|
|
'modifytime' => myself()->_getNowTime(),
|
|
)
|
|
);
|
|
}else{
|
|
return false;
|
|
}
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
} |