<?php
// +----------------------------------------------------------------------
// | RXThinkCMF框架 [ RXThinkCMF ]
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 南京RXThinkCMF研发中心
// +----------------------------------------------------------------------
// | 官方网站: http://www.rxthink.cn
// +----------------------------------------------------------------------
// | Author: 牧羊人 <1175401194@qq.com>
// +----------------------------------------------------------------------

namespace app\admin\service;


use app\admin\model\Crontab;
use app\common\service\BaseService;

/**
 * 定时任务-服务类
 * @author 牧羊人
 * @since 2020/7/4
 * Class CrontabService
 * @package app\admin\service
 */
class CrontabService extends BaseService
{
    /**
     * 构造函数
     * @author 牧羊人
     * @since 2020/7/4
     * CrontabService constructor.
     */
    public function __construct()
    {
        $this->model = new Crontab();
    }

    /**
     * 添加或编辑
     * @return array
     * @since 2020/7/4
     * @author 牧羊人
     */
    public function edit()
    {
        $data = request()->param();
        // 开始时间
        if (isset($data['start_time']) && $data['start_time']) {
            $data['start_time'] = strtotime($data['start_time']);
        }
        // 结束时间
        if (isset($data['end_time']) && $data['end_time']) {
            $data['end_time'] = strtotime($data['end_time']);
        }
        // 执行时间
        if (isset($data['execute_time']) && $data['execute_time']) {
            $data['execute_time'] = strtotime($data['execute_time']);
        }
        return parent::edit($data); // TODO: Change the autogenerated stub
    }
}