企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
#### 任务表 结构 ~~~ CREATE TABLE `acc_dragon_task` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID', `mail_id` smallint(255) NOT NULL COMMENT '邮件ID', `title` varchar(255) NOT NULL COMMENT '标题', `issue_at` datetime NOT NULL COMMENT '定时时间', `complete_at` datetime DEFAULT NULL COMMENT '完成时间', `issuetype` tinyint(4) NOT NULL COMMENT '发放类型:0 即时发放 1定时发放', `characterid` int(4) NOT NULL DEFAULT '0' COMMENT '每日', `status` tinyint(4) NOT NULL COMMENT '发放状态', `comments` varchar(255) DEFAULT NULL COMMENT '备注', `create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间', `update_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; ~~~ 任务列表(获取器) ~~~ namespace app\index\model; use think\Model; class Task extends Model { protected function initialize() { //继承父类 parent::initialize(); $this->table = 'acc_dragon_task'; } /** * 发放类型获取器 * @DateTime 2018-01-23 * @param [type] $value [description] * @return [type] */ public function getIssuetypeAttr($value) { $types = [0 => '即时发放', 1 => '定时发放']; return $types[$value]; } /** * 列表(主键列表,条件数组,闭包查询) */ public function doList($param = null) { //参数查询 // $result = self::all($param); $rows = []; foreach ($result as $data) { $item = $data->getData(); $item['issuetype'] = $data->getAttr('issuetype'); //访问获取器 array_push($rows, $item); } //查询总计 $total = count($rows); $res = array(); if ($total > 0) { $res['rows'] = $rows; $res['total'] = $total; } else { $res['rows'] = array(); $res['total'] = 0; } //返回信息 _callback($res); } } ~~~