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.
238 lines
9.2 KiB
238 lines
9.2 KiB
<?php
|
|
defined('IN_IA') or exit('Access Denied');
|
|
|
|
class campusActivities_WeliamController {
|
|
|
|
public function index() {
|
|
global $_W, $_GPC;
|
|
|
|
$where = [];
|
|
|
|
$where = [];
|
|
$pindex = max(1, intval($_GPC['page']));
|
|
$psize = 10;
|
|
|
|
if (!empty($_GPC['title'])) {
|
|
$where['title@'] = '%' . trim($_GPC['title'] .'%');
|
|
}
|
|
if (is_numeric($_GPC['status'])) $where['status'] = $_GPC['status'];
|
|
if (!empty($_GPC['create_place'])) $where['create_place'] = $_GPC['create_place'];
|
|
|
|
$memberData = Util::getNumData("*", PDO_NAME . 'member_campus_activities', $where, 'id desc', $pindex, $psize, 1);
|
|
$list = $memberData[0];
|
|
$pager = $memberData[1];
|
|
|
|
foreach ($list as &$item) {
|
|
if (!empty($item['cc_id'])) {
|
|
$ccRes = Category::getSingleCategory($item['cc_id'],'name');
|
|
$item['cc_name'] = $ccRes['name'];
|
|
}
|
|
$item['promotional_img'] = MemberCampusActivities::handlePromotionalImg($item['promotional_img'],2);
|
|
$item['nickname'] = '小粤';
|
|
$item['avatar'] = $_W['wlsetting']['base']['logo'] ? tomedia($_W['wlsetting']['base']['logo']) : tomedia('headimg_'.$_W['account']['acid'].'.jpg');
|
|
if ($item['create_place'] == 2) Member::getMemberInfo($item,$item['create_user_id']);
|
|
}
|
|
|
|
include wl_template('member/campus_activities/index');
|
|
}
|
|
|
|
/**
|
|
* 保存活动宣传内容
|
|
* @return void
|
|
*/
|
|
public function edit () {
|
|
global $_W, $_GPC;
|
|
|
|
$id = $_GPC['id'];
|
|
|
|
if (checksubmit('submit')) {
|
|
|
|
$data = $_GPC['register'];
|
|
if (empty($data['title'])) wl_message('请填写活动标题','refresh','error');
|
|
if (strlen($data['title']) > 128) wl_message('活动标题不得超过128个字符','refresh','error');
|
|
if (empty($data['describe'])) wl_message('请填写活动描述','refresh','error');
|
|
if (empty($data['promotional_img'])) wl_message('请填写上传图集','refresh','error');
|
|
|
|
$data['uniacid'] = $_W['uniacid'];
|
|
$data['title'] = trim($data['title']);
|
|
$data['recommend'] = $data['recommend'] ?: 0;
|
|
$data['promotional_img'] = MemberCampusActivities::promotionalImgStr($data['promotional_img']);
|
|
$data['describe'] = htmlspecialchars_decode($data['describe']);
|
|
$data['diyformid'] = $data['diyformid'] ?: 0;
|
|
|
|
$where = ['title' => $data['title']];
|
|
if ($id) $where['id!='] = $id;
|
|
$query_res = pdo_get(PDO_NAME . 'member_campus_activities',$where);
|
|
if ($query_res) wl_message('该活动标题已存在,请换一个','refresh','error');
|
|
|
|
if (empty($id)) {
|
|
$data['create_user_id'] = $_W['uid'];
|
|
$data['create_time'] = time();
|
|
$result = pdo_insert(PDO_NAME . 'member_campus_activities',$data);
|
|
} else {
|
|
$data['update_time'] = time();
|
|
$result = pdo_update(PDO_NAME . 'member_campus_activities',$data,['id' => $id]);
|
|
}
|
|
|
|
if (!$result) wl_message('活动保存失败,请重试', web_url('member/campus_activities/edit',['id' => $id]), 'error');
|
|
|
|
wl_message('活动保存成功',web_url('member/campusActivities/index',['active' => 1]),'success');
|
|
}
|
|
|
|
$register = [];
|
|
if (!empty($id)) {
|
|
$register = pdo_get(PDO_NAME . 'member_campus_activities', ['id' => $id]);
|
|
$register['promotional_img'] = MemberCampusActivities::promotionalImgArr($register['promotional_img']);
|
|
}
|
|
|
|
$category = Category::getChildCategoryAll(6,'*',true);
|
|
$diyform = FormTemplate::getAllDiyFormList($_W);
|
|
|
|
include wl_template('member/campus_activities/edit');
|
|
}
|
|
|
|
public function publish() {
|
|
global $_W, $_GPC;
|
|
|
|
$id = $_GPC['id'];
|
|
if (empty($id) || !is_numeric($id)) show_json(0,'参数错误');
|
|
$data = [
|
|
'status' => 1,
|
|
'publish_time' => time(),
|
|
'publish_user_id' => $_W['uid']
|
|
];
|
|
$result = pdo_update(PDO_NAME . 'member_campus_activities',$data,['id' => $id]);
|
|
if (!$result) show_json(0,'发布失败');
|
|
show_json(1,['message' => '发布成功','button' => '已发布']);
|
|
}
|
|
|
|
public function reject() {
|
|
global $_W, $_GPC;
|
|
|
|
$id = $_GPC['id'];
|
|
$reject = $_GPC['reject'];
|
|
if (empty($id) || !is_numeric($id)) wl_message('参数错误');
|
|
if (empty($reject)) wl_message('驳回原因不能为空');
|
|
$data = ['status' => 2,'reject' => $reject];
|
|
$result = pdo_update(PDO_NAME . 'member_campus_activities',$data,['id' => $id]);
|
|
if (!$result) wl_message('驳回失败');
|
|
wl_message('驳回成功',web_url('member/campusActivities/index',['active' => 1]),'success');
|
|
}
|
|
|
|
public function delete() {
|
|
global $_W, $_GPC;
|
|
|
|
$id = $_GPC['id'];
|
|
if (empty($id) || !is_numeric($id)) show_json(0,'参数错误');
|
|
$del_res = pdo_delete(PDO_NAME . 'member_campus_activities',['id' => $id]);
|
|
if (!$del_res) {
|
|
show_json(0,'删除失败');
|
|
}
|
|
pdo_delete(PDO_NAME . 'member_evaluation_activities',['campus_activities_id' => $id]);
|
|
|
|
show_json(1,'删除成功');
|
|
}
|
|
|
|
/**
|
|
* Comment: 修改状态
|
|
* Author: zzw
|
|
* Date: 2023/5/6 13:52
|
|
*/
|
|
public function changeRecommend()
|
|
{
|
|
global $_W, $_GPC;
|
|
#1、获取参数信息
|
|
$id = $_GPC['id'] or Commons::sRenderError('缺少参数:导航id');
|
|
$recommend = $_GPC['status'] ?: 0;
|
|
#1、修改操作
|
|
$res = pdo_update(PDO_NAME . "member_campus_activities", ['recommend' => $recommend], ['id' => $id]);
|
|
if ($res) Commons::sRenderSuccess('修改成功');
|
|
else Commons::sRenderError('修改失败,请刷新重试!');
|
|
}
|
|
|
|
public function commentIndex()
|
|
{
|
|
global $_W, $_GPC;
|
|
|
|
$where = [];
|
|
$pindex = max(1, intval($_GPC['page']));
|
|
$psize = 10;
|
|
|
|
if (is_numeric($_GPC['status'])) $where['status'] = $_GPC['status'];
|
|
|
|
$pageData = Util::getNumData("*", PDO_NAME . 'member_evaluation_activities', $where, 'status asc,create_time asc', $pindex, $psize, 1);
|
|
$list = $pageData[0];
|
|
$pager = $pageData[1];
|
|
|
|
foreach ($list as &$item) {
|
|
|
|
Member::getMemberInfo($item,$item['mid']);
|
|
if (is_base64($item['content'])) $item['content'] = base64_decode($item['content']);
|
|
$item['create_time'] = date("Y-m-d H:i:s",$item['create_time']);
|
|
|
|
}
|
|
|
|
include wl_template('member/campus_activities/commentIndex');
|
|
}
|
|
|
|
public function checkComment()
|
|
{
|
|
global $_W, $_GPC;
|
|
$id = $_GPC['id'];
|
|
if (empty($id)) {
|
|
wl_message('缺少参数:id',web_url('member/campusActivities/commentIndex',['active' => 2]),'error');
|
|
}
|
|
$status = $_GPC['status'];
|
|
if (empty($status)) {
|
|
wl_message('缺少参数:status',web_url('member/campusActivities/commentIndex',['active' => 2]),'error');
|
|
}
|
|
$updateArr = ['status' => $status];
|
|
$checkRes = pdo_update(PDO_NAME . 'member_evaluation_activities',$updateArr,['id' => $id]);
|
|
if (!$checkRes) wl_message('审核失败',web_url('member/campusActivities/commentIndex',['active' => 2]),'error');
|
|
wl_message('审核成功',web_url('member/campusActivities/commentIndex',['active' => 2]),'success');
|
|
}
|
|
|
|
public function deleteComment()
|
|
{
|
|
global $_W, $_GPC;
|
|
|
|
if (Member::commentDelete($_GPC['id'])) wl_message('删除成功', web_url('member/campusActivities/commentIndex',['active' => 2]), 'success');
|
|
|
|
wl_message('删除失败', referer(), 'error');
|
|
}
|
|
|
|
public function enrollList()
|
|
{
|
|
global $_W, $_GPC;
|
|
|
|
$where = [];
|
|
|
|
$where = [];
|
|
$pindex = max(1, intval($_GPC['page']));
|
|
$psize = 10;
|
|
|
|
if (!empty($_GPC['activities_id'])) $where['activities_id'] = $_GPC['activities_id'];
|
|
if (!empty($_GPC['template_type'])) $where['template_type'] = $_GPC['template_type'];
|
|
if (!empty($_GPC['title'])) {
|
|
$formIdArr = [];
|
|
$diyFormData = pdo_getall(PDO_NAME . 'diyform',['title%' => $_GPC['title']],'id');
|
|
foreach ($diyFormData as $diyFormRow) $formIdArr[] = $diyFormRow['id'];
|
|
$where['diyformid#'] = $formIdArr ? implode(",",$formIdArr) : '0';
|
|
}
|
|
|
|
$enrollData = Util::getNumData("*", PDO_NAME . 'member_enroll', $where, 'id desc', $pindex, $psize, 1);
|
|
$list = $enrollData[0];
|
|
$pager = $enrollData[1];
|
|
|
|
foreach ($list as &$item) {
|
|
Member::getMemberInfo($item,$item['mid']);
|
|
$item['temp_type_str'] = FormTemplate::$template_type[$item['template_type']];
|
|
$diyForm = FormTemplate::getDiyFormData($item['diyformid'],$item['template_type']);
|
|
$item['template_title'] = $diyForm ? $diyForm['title'] : '';
|
|
$item['enroll_data'] = MemberEnrollData::getAll($item['id']);
|
|
}
|
|
$template_type_list = FormTemplate::$template_type;
|
|
|
|
include wl_template('member/campus_activities/enroll_list');
|
|
}
|
|
}
|