1
This commit is contained in:
parent
69353c47d7
commit
76a9d8504a
@ -197,5 +197,25 @@ CREATE TABLE `t_shop_buy_record` (
|
||||
KEY `account_id` (`account_id`),
|
||||
UNIQUE KEY `account_id_item_id` (`account_id`, `item_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_mission`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_mission`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_mission` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`mission_id` int(11) NOT NULL DEFAULT '0' COMMENT '任务id',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
KEY `account_id` (`account_id`),
|
||||
UNIQUE KEY `account_id_mission_id` (`account_id`, `mission_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
-- Dump completed on 2015-08-19 18:51:22
|
||||
|
60
webapp/models/Mission.php
Normal file
60
webapp/models/Mission.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace models;
|
||||
|
||||
require_once('mt/Item.php');
|
||||
|
||||
use mt;
|
||||
use phpcommon\SqlHelper;
|
||||
|
||||
class Mission extends BaseModel {
|
||||
|
||||
public static function find($missionId)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
myself()->_getSelfMysql(),
|
||||
't_mission',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'mission_id' => $missionid,
|
||||
)
|
||||
);
|
||||
return $row;
|
||||
}
|
||||
|
||||
public static function toDto($row)
|
||||
{
|
||||
return array(
|
||||
'mission_id' => $row['mission_id'],
|
||||
'createtime' => $row['createtime'],
|
||||
'modifytime' => $row['modifytime'],
|
||||
);
|
||||
}
|
||||
|
||||
public static function all()
|
||||
{
|
||||
$rows = SqlHelper::ormSelect(
|
||||
myself()->_getSelfMysql(),
|
||||
't_mission',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
)
|
||||
);
|
||||
return array_map(function($row) {
|
||||
$nowDaySeconds = myself()->_getNowDaySeconds();
|
||||
$mondaySeconds = myself()->_getMondaySeconds();
|
||||
return $row;
|
||||
}, $rows);
|
||||
}
|
||||
|
||||
public static function allToHash()
|
||||
{
|
||||
$rows = self::all();
|
||||
$missionHash = array();
|
||||
array_walk($rows, function ($row) use(&$missionHash) {
|
||||
$missionHash[$row['mission_id']] = $row;
|
||||
});
|
||||
return $missionHash;
|
||||
}
|
||||
|
||||
}
|
@ -6,36 +6,19 @@ use phpcommon;
|
||||
|
||||
class Task {
|
||||
|
||||
|
||||
public static function get($equipId)
|
||||
public static function get($id)
|
||||
{
|
||||
return self::getMeta()[$equipId];
|
||||
return getXVal(self::getMetaList(), $id);
|
||||
}
|
||||
|
||||
protected static function getMeta()
|
||||
protected static function getMetaList()
|
||||
{
|
||||
if (!self::$meta) {
|
||||
self::$meta = getMetaTable('newtask@newtask.php');
|
||||
if (!self::$metaList) {
|
||||
self::$metaList = getMetaTable('task@task.php');
|
||||
}
|
||||
return self::$meta;
|
||||
return self::$metaList;
|
||||
}
|
||||
|
||||
public static function getTaskCfgByID($_itemID)
|
||||
{
|
||||
$playerSkinCfg = self::getMeta();
|
||||
$itemData = null;
|
||||
foreach($playerSkinCfg as $item)
|
||||
{
|
||||
$tmpItemID = $item["id"];
|
||||
if($tmpItemID == $_itemID)
|
||||
{
|
||||
$itemData = $item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $itemData;
|
||||
}
|
||||
protected static $itemArr;
|
||||
protected static $meta;
|
||||
protected static $metaList;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user