239 lines
10 KiB
PHP
239 lines
10 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller;
|
|
|
|
use think\Controller;
|
|
use think\Db;
|
|
use app\bj\controller\Common;
|
|
use think\Log;
|
|
use \think\Validate;
|
|
|
|
class Notice extends Base{
|
|
protected $page_num = 10;
|
|
protected $file_max_pic = 1024*1024*5;//xxxMB
|
|
protected $information_msg_list_arr = [
|
|
'1' => '身高管理',
|
|
'2' => '体重管理',
|
|
'3' => '肺活训练',
|
|
'4' => '跳绳训练',
|
|
'5' => '中考体测',
|
|
'6' => '公告',
|
|
];
|
|
|
|
###################################################banner图管理start###################################################
|
|
###################################################banner图管理start###################################################
|
|
###################################################banner图管理start###################################################
|
|
|
|
public function banner_index($page = 1){
|
|
$data = input();
|
|
$pd = true;
|
|
$parameter = [];
|
|
// $parameter['scene_data'] = 3;
|
|
if(array_key_exists('tt', $data)){
|
|
$page = $data['page_num'];
|
|
unset($data['page_num']);
|
|
unset($data['tt']);
|
|
$pd = false;
|
|
// if($data['status_num'] === "0" || $data['status_num'] === "1"){
|
|
// $parameter['is_del'] = $data['status_num'];
|
|
// }
|
|
|
|
// if($data['tel']){
|
|
// $parameter['tel'] = $data['tel'];
|
|
// }
|
|
// if($data['email']){
|
|
// $parameter['email'] = $data['email'];
|
|
// }
|
|
// if($data['s_time']){
|
|
// $parameter['create_time'] = ['>=',$data['s_time']];
|
|
// }
|
|
// if($data['e_time']){
|
|
// $parameter['create_time'] = ['<=',$data['e_time']];
|
|
// }
|
|
}
|
|
$num = Db::table('admin_notice_banner')->where($parameter)->count();
|
|
$result = Db::table('admin_notice_banner')->where($parameter)->order('is_del,sort_num desc')->page($page,$this->page_num)->select();
|
|
// dump($result);
|
|
// die;
|
|
if(!$pd){
|
|
$return_result['num'] = $num;
|
|
$return_result['data'] = $result;
|
|
return $this->msg(0,'success',$return_result);
|
|
}
|
|
$this->assign([
|
|
'result' => $result,
|
|
'num' => $num,
|
|
]);
|
|
return $this->fetch();
|
|
}
|
|
public function banner_add(){
|
|
return $this->fetch();
|
|
}
|
|
public function banner_edit(){
|
|
$data = input();
|
|
$return_data = Db::table('admin_notice_banner')->where(['id'=>$data['id']])->find();
|
|
$pic_id = Db::table('admin_pic_manage')->where(['url_data'=>$return_data['pic']])->find();
|
|
$return_data['pic_id'] = $pic_id['id'];
|
|
if($return_data['type'] == 1){
|
|
$return_data['jump_url'] = '';
|
|
}
|
|
$this->assign([
|
|
'result' => $return_data,
|
|
]);
|
|
return $this->fetch();
|
|
}
|
|
|
|
###################################################action
|
|
public function banner_add_or_update_action(){
|
|
$data = input();
|
|
$action_data = [
|
|
'title' => $data['title'],
|
|
'pic' => $data['banner_img'],
|
|
'type' => $data['type'],
|
|
'jump_url' => $data['jump_url'],
|
|
'parameter_data' => $data['parameter_data'] != '' ? $data['parameter_data'] : 999999,
|
|
'create_time' => date('Y-m-d H:i:s'),
|
|
'scene_data' => $data['scene_data'],
|
|
];
|
|
$pic_data = Db::table('admin_pic_manage')->where(['id'=>$action_data['pic']])->find();
|
|
$action_data['pic'] = $pic_data['url_data'];
|
|
if($action_data['type'] == 1){
|
|
$action_data['jump_url'] = "https://tc.pcxbc.com/editortext/model_content";
|
|
}else if($action_data['type'] == 2){
|
|
$action_data['jump_url'] = "weixin://dl/business/?appid=".$data['parameter_data']."&path=".$data['jump_url'];
|
|
}else if($action_data['type'] == 3){
|
|
$action_data['jump_url'] = $data['jump_url'];
|
|
}else{
|
|
return $this->msg(10002,'选择类型错误');
|
|
}
|
|
if($data['action_type'] == 'add'){
|
|
$result = Db::table('admin_notice_banner')->insertGetId($action_data);
|
|
}else{
|
|
unset($action_data['create_time']);
|
|
// unset($action_data['scene_data']);
|
|
$result = Db::table('admin_notice_banner')->where(['id'=>$data['id']])->update($action_data);
|
|
}
|
|
if($result){
|
|
return $this->msg([]);
|
|
}else{
|
|
return $this->msg(10002);
|
|
}
|
|
|
|
}
|
|
public function banner_update_sort(){
|
|
$data = input();
|
|
$result = Db::table('admin_notice_banner')->where(['id'=>$data['id']])->update(['sort_num'=>$data['data']]);
|
|
if($result){
|
|
return $this->msg([]);
|
|
}else{
|
|
return $this->msg(10002);
|
|
}
|
|
}
|
|
public function banner_stop_run(){
|
|
$data = input();
|
|
$result = Db::table('admin_notice_banner')->where(['id'=>$data['id']])->update(['is_del'=>$data['data']]);
|
|
if($result){
|
|
return $this->msg([]);
|
|
}else{
|
|
return $this->msg(10002);
|
|
}
|
|
}
|
|
###################################################banner图管理end###################################################
|
|
###################################################banner图管理end###################################################
|
|
###################################################banner图管理end###################################################
|
|
|
|
###################################################首页弹窗管理start###################################################
|
|
###################################################首页弹窗管理start###################################################
|
|
###################################################首页弹窗管理start###################################################
|
|
public function pop_index($page = 1){
|
|
$data = input();
|
|
$pd = true;
|
|
$parameter = [];
|
|
$parameter['scene_data'] = 1;
|
|
if(array_key_exists('tt', $data)){
|
|
$page = $data['page_num'];
|
|
unset($data['page_num']);
|
|
unset($data['tt']);
|
|
$pd = false;
|
|
// if($data['status_num'] === "0" || $data['status_num'] === "1"){
|
|
// $parameter['is_del'] = $data['status_num'];
|
|
// }
|
|
|
|
// if($data['tel']){
|
|
// $parameter['tel'] = $data['tel'];
|
|
// }
|
|
// if($data['email']){
|
|
// $parameter['email'] = $data['email'];
|
|
// }
|
|
// if($data['s_time']){
|
|
// $parameter['create_time'] = ['>=',$data['s_time']];
|
|
// }
|
|
// if($data['e_time']){
|
|
// $parameter['create_time'] = ['<=',$data['e_time']];
|
|
// }
|
|
}
|
|
$num = Db::table('admin_notice_banner')->where($parameter)->count();
|
|
$result = Db::table('admin_notice_banner')->where($parameter)->order('is_del,sort_num desc')->page($page,$this->page_num)->select();
|
|
// dump($result);
|
|
// die;
|
|
if(!$pd){
|
|
$return_result['num'] = $num;
|
|
$return_result['data'] = $result;
|
|
return $this->msg(0,'success',$return_result);
|
|
}
|
|
$this->assign([
|
|
'result' => $result,
|
|
'num' => $num,
|
|
]);
|
|
return $this->fetch();
|
|
}
|
|
|
|
###################################################首页弹窗管理end###################################################
|
|
###################################################首页弹窗管理end###################################################
|
|
###################################################首页弹窗管理end###################################################
|
|
|
|
###################################################公告管理start###################################################
|
|
###################################################公告管理start###################################################
|
|
###################################################公告管理start###################################################
|
|
|
|
###################################################公告管理end###################################################
|
|
###################################################公告管理end###################################################
|
|
###################################################公告管理end###################################################
|
|
|
|
|
|
###################################################公共用接口start###################################################
|
|
###################################################公共用接口start###################################################
|
|
###################################################公共用接口start###################################################
|
|
// 简单文章信息列表浏览
|
|
public function information_msg_list($page = 1) {
|
|
$data = input();
|
|
$pd = true;
|
|
if(array_key_exists('page',$data)){
|
|
$page = $data['page'];
|
|
$pd = false;
|
|
}
|
|
$num = Db::table('admin_editor_text_content')->where(['is_del'=>0])->count();
|
|
$result = Db::table('admin_editor_text_content')->where(['is_del'=>0])->order('id desc')->page($page,10)->select();
|
|
|
|
foreach ($result as $key => $value) {
|
|
if(array_key_exists($value['type'], $this->information_msg_list_arr)){
|
|
$result[$key]['type'] = $this->information_msg_list_arr[$value['type']];
|
|
}
|
|
}
|
|
if(!$pd){
|
|
$return_result['num'] = $num;
|
|
$return_result['result'] = $result;
|
|
return $this->msg(0,'success',$return_result);
|
|
}
|
|
$this->assign([
|
|
'result' => $result,
|
|
'num' => $num,
|
|
]);
|
|
return $this->fetch();
|
|
}
|
|
###################################################公共用接口end###################################################
|
|
###################################################公共用接口end###################################################
|
|
###################################################公共用接口end###################################################
|
|
|
|
|
|
} |