Admin.php 2.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2018 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\plugins\commontopnotice;

D
devil_gong 已提交
13
use think\Controller;
14 15 16 17 18 19 20 21 22
use app\service\PluginsService;

/**
 * 顶部公告插件 - 管理
 * @author   Devil
 * @blog     http://gong.gg/
 * @version  0.0.1
 * @datetime 2016-12-01T21:51:08+0800
 */
D
devil_gong 已提交
23
class Admin extends Controller
24 25 26 27 28 29 30 31 32 33 34 35 36 37
{
    /**
     * 首页
     * @author   Devil
     * @blog     http://gong.gg/
     * @version  1.0.0
     * @datetime 2019-02-07T08:21:54+0800
     * @param    [array]          $params [输入参数]
     */
    public function index($params = [])
    {
        $ret = PluginsService::PluginsData('commontopnotice');
        if($ret['code'] == 0)
        {
D
devil_gong 已提交
38 39
            $this->assign('data', $ret['data']);
            return $this->fetch('../../../plugins/view/commontopnotice/admin/index');
40
        } else {
D
devil_gong 已提交
41
            return $ret['msg'];
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
        }
    }

    /**
     * 编辑页面
     * @author   Devil
     * @blog     http://gong.gg/
     * @version  1.0.0
     * @datetime 2019-02-07T08:21:54+0800
     * @param    [array]          $params [输入参数]
     */
    public function saveinfo($params = [])
    {
        $ret = PluginsService::PluginsData('commontopnotice');
        if($ret['code'] == 0)
        {
            // 是否
            $is_whether_list =  [
                0 => array('id' => 0, 'name' => '否', 'checked' => true),
                1 => array('id' => 1, 'name' => '是'),
            ];

D
devil_gong 已提交
64 65 66
            $this->assign('is_whether_list', $is_whether_list);
            $this->assign('data', $ret['data']);
            return $this->fetch('../../../plugins/view/commontopnotice/admin/saveinfo');
67
        } else {
D
devil_gong 已提交
68
            return $ret['msg'];
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
        }
    }

    /**
     * 数据保存
     * @author   Devil
     * @blog     http://gong.gg/
     * @version  1.0.0
     * @datetime 2019-02-07T08:21:54+0800
     * @param    [array]          $params [输入参数]
     */
    public function save($params = [])
    {
        return PluginsService::PluginsDataSave(['plugins'=>'commontopnotice', 'data'=>$params]);
    }
}
?>