www.lightcourse.com/app/home/controller/Memberfeedback.php

138 lines
4.6 KiB
PHP

<?php
namespace app\home\controller;
use think\facade\View;
use think\facade\Lang;
/**
* ============================================================================
* 联课教育商城系统
* ============================================================================
* 版权所有 2022 刻羽互动科技有限公司,并保留所有权利。
* 网站地址: http://www.o1h.cn
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
* 不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
* 数据层模型
*/
class Memberfeedback extends BaseMember {
public function initialize() {
parent::initialize(); // TODO: Change the autogenerated stub
Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/memberfeedback.lang.php');
}
/*
* 反馈列表
*/
public function index() {
$feedback_model = model('feedback');
$condition = array();
$condition[] = array('member_id','=', session('member_id'));
$feedback_list = $feedback_model->getFeedbackList($condition,10);
/* 设置买家当前菜单 */
$this->setMemberCurMenu('member_feedback');
/* 设置买家当前栏目 */
$this->setMemberCurItem('feedback_list');
//文章
$article_model = model('article');
$condition = array();
$condition[]=array('article_show','=','1');
$condition[]=array('ac_id','=','10');
$article_list = $article_model->getAllArticle($condition, 10);
foreach ($article_list as &$val) {
$val['article_date'] = date('Y-m-d H:i:s',$val['article_time']);
preg_match_all('/[\x{4e00}-\x{9fff}]+/u', $val['article_content'], $matches);
$str = join('', $matches[0]);
$val['article'] = mb_substr($str,0,200);
}
View::assign('article', $article_list);
View::assign('feedback_list', $feedback_list);
View::assign('show_page', $feedback_model->page_info->render());
return View::fetch($this->template_dir . 'index');
}
public function add(){
if (request()->isPost()) {
$feedback_model = model('feedback');
$param = array();
if (!empty(input('param.email'))) {
if (!empty(input('param.fname'))) {
$param['fb_content'] = input('param.school').':'.input('param.fname').'-'.input('param.lname');
} else {
$param['fb_content'] = 'View syllabus';
}
$param['fb_code'] = input('fb_code');
$param['fb_course'] = input('fb_course');
$param['fb_school'] = input('fb_school');
$param['fb_type'] = 2;
$param['fb_time'] = TIMESTAMP;
$param['member_id'] = input('param.email');
$param['member_name'] = input('param.email');
}
$res=word_filter($param['fb_content']);
if(!$res['code']){
ds_json_encode(10001,'Error');
}
$param['fb_content']=$res['data']['text'];
$result = $feedback_model->addFeedback($param);
if ($result) {
ds_json_encode(10000, 'Success');
} else {
ds_json_encode(10001, 'Error');
}
}else{
$this->setMemberCurMenu('member_feedback');
/* 设置买家当前栏目 */
$this->setMemberCurItem('feedback_add');
return View::fetch($this->template_dir . 'add');
}
}
/**
* 用户中心右边,小导航
*
* @param string $menu_type 导航类型
* @param string $menu_key 当前导航的menu_key
* @param array $array 附加菜单
*
* @return
*/
public function getMemberItemList() {
$menu_array = array(
array(
'name' => 'feedback_list',
'text' => lang('feedback_list'),
'url' => url('Memberfeedback/index')
),
array(
'name' => 'feedback_add',
'text' => lang('feedback_add'),
'url' => url('Memberfeedback/add'),
)
);
return $menu_array;
}
}