You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zhishifufei_php/application/admin/controller/special/Offline.php

83 lines
2.6 KiB

9 months ago
<?php
// +----------------------------------------------------------------------
// | 天诚科技 [ 刘海东 17600099397赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.tczxkj.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 该系统并不是自由软件,未经许可不能去掉相关版权
// +----------------------------------------------------------------------
// | Author:甘肃天诚志信电子商务有限公司 刘海东 联系电话维系17600099397
// +----------------------------------------------------------------------
namespace app\admin\controller\special;
use app\admin\model\special\OfflineCourse as OfflineCourseModel;
use app\admin\model\special\Special;
use service\JsonService;
use think\Url;
use service\FormBuilder as Form;
use service\JsonService as Json;
use app\admin\controller\AuthController;
class Offline extends AuthController
{
/**
* 线下课列表展示
* @return
* */
public function index()
{
return $this->fetch();
}
/**
* 线下课列表获取
* @return
* */
public function offline_list()
{
$where = parent::getMore([
['page', 1],
['is_show', ''],
['limit', 20],
['title', ''],
]);
return JsonService::successlayui(OfflineCourseModel::getList($where));
}
/**添加/编辑
* @param int $id
* @return mixed|void
* @throws \think\exception\DbException
*/
public function create($id = 0)
{
if ($id) {
$lecturer = OfflineCourseModel::get($id);
$lecturer['label'] = json_decode($lecturer['label']);
$lecturer['introduction'] = htmlspecialchars_decode($lecturer['introduction']);
if (!$lecturer) return JsonService::fail('线下课信息不存在!');
} else {
$lecturer = [];
}
$this->assign(['lecturer' => json_encode($lecturer), 'id' => $id]);
return $this->fetch();
}
/**
* 删除线下课
* @param int $id 修改的主键
* @return json
* */
public function delete($id = 0)
{
if (!$id) return JsonService::fail('缺少参数');
if (OfflineCourseModel::delLecturer($id))
return JsonService::successful('删除成功');
else
return JsonService::fail(OfflineCourseModel::getErrorInfo('删除失败'));
}
}