diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 0481045..6c7acdc 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -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 diff --git a/webapp/models/Mission.php b/webapp/models/Mission.php new file mode 100644 index 0000000..5963618 --- /dev/null +++ b/webapp/models/Mission.php @@ -0,0 +1,60 @@ +_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; + } + +} diff --git a/webapp/mt/Task.php b/webapp/mt/Task.php index 442bf2e..d607402 100644 --- a/webapp/mt/Task.php +++ b/webapp/mt/Task.php @@ -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; }