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.
121 lines
3.7 KiB
121 lines
3.7 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | 天诚科技 [ 刘海东 17600099397赋能开发者,助力企业发展 ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2016~2020 https://www.tczxkj.com All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed 该系统并不是自由软件,未经许可不能去掉相关版权
|
|
// +----------------------------------------------------------------------
|
|
// | Author:甘肃天诚志信电子商务有限公司 刘海东 联系电话维系17600099397
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\admin\controller\education;
|
|
|
|
use app\admin\controller\AuthController;
|
|
use service\JsonService as Json;
|
|
use app\admin\model\ump\EventRegistration as EventRegistrationModel;
|
|
use app\admin\model\ump\EventData as EventDataModel;
|
|
use app\admin\model\educational\Education as EducationModel;
|
|
use app\admin\model\ump\EventPrice as EventPriceModel;
|
|
use app\admin\model\merchant\Merchant;
|
|
|
|
/**资质控制器
|
|
* Class EventRegistration
|
|
* @package app\admin\controller\ump
|
|
*/
|
|
class Education extends AuthController
|
|
{
|
|
public function index()
|
|
{
|
|
$mer_list = Merchant::getMerchantList();
|
|
$this->assign(['mer_list' => $mer_list]);
|
|
return $this->fetch();
|
|
}
|
|
|
|
/**
|
|
* 资质列表
|
|
*/
|
|
public function event_registration_list()
|
|
{
|
|
$where = parent::getMore([
|
|
['title', ''],
|
|
['status', 1],
|
|
['is_show', ''],
|
|
['mer_id', ''],
|
|
['page', 1],
|
|
['limit', 20],
|
|
], $this->request);
|
|
return Json::successlayui(EducationModel::systemPage($where));
|
|
}
|
|
|
|
/**编辑
|
|
* @param string $is_show
|
|
* @param string $id
|
|
*/
|
|
public function set_show($is_show = '', $id = '')
|
|
{
|
|
if ($is_show == '' || $id == '') return Json::fail('缺少参数');
|
|
$res = parent::getDataModification('event', $id, 'is_show', (int)$is_show);
|
|
if ($res)
|
|
return Json::successful($is_show == 1 ? '显示成功' : '隐藏成功');
|
|
else
|
|
return Json::fail($is_show == 1 ? '显示失败' : '隐藏失败');
|
|
}
|
|
|
|
/**获得添加
|
|
* @return mixed|void
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @throws \think\exception\DbException
|
|
*/
|
|
public function create($id = 0)
|
|
{
|
|
$news = [];
|
|
$event = [];
|
|
if ($id) {
|
|
$data = EducationModel::where('id',$id)->find();
|
|
$news = $data;
|
|
$event =json_decode($data['qualifications'],true);
|
|
}
|
|
$this->assign(['id' => $id, 'news' => json_encode($news), 'event' => json_encode($event)]);
|
|
return $this->fetch();
|
|
}
|
|
|
|
/**
|
|
* 删除活动
|
|
* */
|
|
public function delete($id)
|
|
{
|
|
|
|
EducationModel::where('id',$id)->delete($id);
|
|
return Json::successful('删除成功!');
|
|
}
|
|
|
|
/**
|
|
* 添加和修改资质
|
|
*/
|
|
public function add_new()
|
|
{
|
|
$data = parent::postMore([
|
|
['id', 0],
|
|
'title',
|
|
['sort', 0],
|
|
['event', ''],//资质
|
|
]);
|
|
$id = $data['id'];
|
|
unset($data['id']);
|
|
$data_li = [
|
|
'qualifications' => $data['event'],
|
|
'sort' => $data['sort'],
|
|
'title' => $data['title'],
|
|
'add_time' => time(),
|
|
];
|
|
if($id){
|
|
$res = EducationModel::where('id',$id)->update($data_li);
|
|
}else{
|
|
$res = EducationModel::insert($data_li);
|
|
}
|
|
return Json::successful($id == 0 ? '添加成功' : '修改成功');
|
|
}
|
|
}
|
|
|
|
|