first commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
abd2f604-0e26-4a3e-ae75-60639c9df448
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/4/24
|
||||
* Time: 15:05
|
||||
*/
|
||||
|
||||
namespace app\admin\controller\custom;
|
||||
|
||||
|
||||
use app\admin\controller\AdminController;
|
||||
|
||||
class Message extends AdminController
|
||||
{
|
||||
/**
|
||||
* User模型对象
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
* User constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->model = new \app\admin\model\costom\Message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 留言建议列表
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
//ajax访问
|
||||
if ($this->request->get('type') == 'ajax') {
|
||||
$page = $this->request->get('page', 1);
|
||||
$limit = $this->request->get('limit', 10);
|
||||
$search = (array)$this->request->get('search', []);
|
||||
return json($this->model->messageList($page, $limit, $search));
|
||||
}
|
||||
|
||||
$basic_data = [
|
||||
'title' => '留言建议列表',
|
||||
'data' => '',
|
||||
];
|
||||
|
||||
return $this->fetch('', $basic_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 留言回复
|
||||
* @return mixed|string|\think\response\Json
|
||||
*/
|
||||
public function reply() {
|
||||
if (!$this->request->isPost()) {
|
||||
|
||||
//查找所需修改的数据
|
||||
$data = $this->model->where('id', $this->request->get('id'))->find();
|
||||
if($data['img1']){
|
||||
$data['img1'] = config('secure.mpic_url'). $data['img1'];
|
||||
}
|
||||
if($data['img2']){
|
||||
$data['img2'] = config('secure.mpic_url'). $data['img2'];
|
||||
}
|
||||
|
||||
if (empty($data)) return msg_error('暂无数据,请重新刷新页面!');
|
||||
|
||||
//基础数据
|
||||
$basic_data = [
|
||||
'title' => '工单回复',
|
||||
'result' => $data,
|
||||
];
|
||||
return $this->fetch('form', $basic_data);
|
||||
} else {
|
||||
$post = $this->request->post();
|
||||
$post['reply_time'] = time();
|
||||
//验证数据
|
||||
$validate = $this->validate($post, 'app\admin\validate\custom\Message.reply');
|
||||
if (true !== $validate) return __error($validate);
|
||||
|
||||
//保存数据,返回结果
|
||||
return $this->model->reply($post);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/4/24
|
||||
* Time: 11:25
|
||||
*/
|
||||
|
||||
namespace app\admin\controller\custom;
|
||||
|
||||
|
||||
use app\admin\controller\AdminController;
|
||||
use think\Db;
|
||||
use app\admin\model\costom\Order as OrderModel;
|
||||
class Order extends AdminController
|
||||
{
|
||||
/**
|
||||
* User模型对象
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
* User constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->model = new \app\admin\model\costom\Order;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
//ajax访问
|
||||
if ($this->request->get('type') == 'ajax') {
|
||||
$page = $this->request->get('page', 1);
|
||||
$limit = $this->request->get('limit', 10);
|
||||
$search = (array)$this->request->get('search', []);
|
||||
return json($this->model->orderList($page, $limit, $search));
|
||||
}
|
||||
//获取配置表的省份数据
|
||||
$resProvince = config('province.province');
|
||||
//基础数据
|
||||
$basic_data = [
|
||||
'title' => '订单列表',
|
||||
'resProvince' => $resProvince,
|
||||
'data' => '',
|
||||
];
|
||||
|
||||
return $this->fetch('', $basic_data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 订单详情
|
||||
* */
|
||||
|
||||
public function details(){
|
||||
//订单商品列表
|
||||
if ($this->request->get('type') == 'ajax') {
|
||||
$id = $this->request->get('user_id');
|
||||
$result = Db::table('orders')->where('user_id','=',$id)->limit(30)->select();
|
||||
|
||||
empty($result) ? $msg = '暂无数据!' : $msg = '查询成功!';
|
||||
//获取配置权限名称
|
||||
$vipNameArr = config('product.vipName');
|
||||
foreach($result as $key => $val){
|
||||
$result[$key]['vipName'] = $vipNameArr[$val['vip']];
|
||||
$result[$key]['add_time'] = date('Y-m-d H:i:s',$val['add_time']);
|
||||
if($val['pay_time']){
|
||||
$result[$key]['pay_time'] = date('Y-m-d H:i:s',$val['pay_time']);
|
||||
}
|
||||
$val['wenli'] = $val['wenli'] = config('setSub.subTypeName')[$val['wenli']];
|
||||
//拼接用户信息
|
||||
$result[$key]['userInfo'] = $val['province_title']."_".$val['score']."_".$val['wenli']."_".$val['mykemustr'];
|
||||
|
||||
}
|
||||
$list = [
|
||||
'code' => 0,
|
||||
'msg' => $msg,
|
||||
'data' => $result
|
||||
];
|
||||
|
||||
return json($list);
|
||||
}
|
||||
$id = $this->request->get('id',0);
|
||||
|
||||
$basic_data = [
|
||||
'title' => '订单详情列表',
|
||||
'data' => '',
|
||||
'user_id' => $id
|
||||
];
|
||||
|
||||
$this->assign($basic_data);
|
||||
return $this->fetch('custom/student/details');
|
||||
}
|
||||
|
||||
/*
|
||||
* 订单退款
|
||||
* */
|
||||
public function refundOrder(){
|
||||
$post = $this->request->post();
|
||||
$validate = $this->validate($post, 'app\admin\validate\custom\Student.refundOrder');
|
||||
if (true !== $validate){
|
||||
$list = [
|
||||
'code' => 0,
|
||||
'msg' => $validate
|
||||
];
|
||||
return $list;
|
||||
exit;
|
||||
};
|
||||
|
||||
$result = OrderModel::orderRefund($post);
|
||||
|
||||
if($result){
|
||||
$list = [
|
||||
'code' => 1,
|
||||
'msg' => '退款成功!'
|
||||
];
|
||||
}else{
|
||||
$list = [
|
||||
'code' => 2,
|
||||
'msg' => '退款失败!'
|
||||
];
|
||||
}
|
||||
return $list;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/4/25
|
||||
* Time: 15:09
|
||||
*/
|
||||
|
||||
namespace app\admin\controller\custom;
|
||||
|
||||
|
||||
use app\admin\controller\AdminController;
|
||||
use think\Db;
|
||||
|
||||
class Proscore extends AdminController
|
||||
{
|
||||
/**
|
||||
* 默认模型对象
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
* User constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->model = new \app\admin\model\costom\Proscore();
|
||||
}
|
||||
|
||||
/**
|
||||
* 省控分數列表
|
||||
* @return mixed|\think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function index() {
|
||||
if (!$this->request->isPost()) {
|
||||
if ($this->request->get('type') == 'ajax') {
|
||||
$page = $this->request->get('page', 1);
|
||||
$limit = $this->request->get('limit', 10);
|
||||
$search = (array)$this->request->get('search', []);
|
||||
return json($this->model->getList($page, $limit, $search));
|
||||
}
|
||||
//获取配置表的省份数据
|
||||
$resProvince = config('province.province');
|
||||
//基础数据
|
||||
$basic_data = [
|
||||
'title' => '省控分数列表',
|
||||
'resProvince' => $resProvince,
|
||||
'data' => '',
|
||||
];
|
||||
return $this->fetch('', $basic_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @return mixed
|
||||
*/
|
||||
public function add() {
|
||||
if (!$this->request->isPost()) {
|
||||
$province_list = config('province.province');
|
||||
$basic_data = [
|
||||
'province_list' => $province_list,
|
||||
'title' => '添加',
|
||||
];
|
||||
return $this->fetch('form', $basic_data);
|
||||
} else {
|
||||
$post = $this->request->post();
|
||||
//验证数据
|
||||
$validate = $this->validate($post, 'app\admin\validate\custom\Proscore.add');
|
||||
if (true !== $validate) return __error($validate);
|
||||
|
||||
//保存数据,返回结果
|
||||
return $this->model->addData($post);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @return mixed|string|\think\response\Json
|
||||
*/
|
||||
public function edit() {
|
||||
if (!$this->request->isPost()) {
|
||||
$province_list = config('province.province');
|
||||
//查找所需修改的数据
|
||||
$data = $this->model->where('id', $this->request->get('id'))->find();
|
||||
if (empty($data)) return msg_error('暂无数据,请重新刷新页面!');
|
||||
|
||||
//基础数据
|
||||
$basic_data = [
|
||||
'title' => '修改信息',
|
||||
'res' => $data,
|
||||
'province_list'=> $province_list
|
||||
];
|
||||
return $this->fetch('form', $basic_data);
|
||||
} else {
|
||||
$post = $this->request->post();
|
||||
//验证数据
|
||||
$validate = $this->validate($post, 'app\admin\validate\custom\Proscore.edit');
|
||||
if (true !== $validate) return __error($validate);
|
||||
|
||||
//保存数据,返回结果
|
||||
return $this->model->editData($post);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function del() {
|
||||
$get = $this->request->get();
|
||||
//验证数据
|
||||
if (!is_array($get['id'])) {
|
||||
$validate = $this->validate($get, 'app\admin\validate\custom\Proscore.del');
|
||||
if (true !== $validate) return __error($validate);
|
||||
}
|
||||
|
||||
//执行删除操作
|
||||
return $this->model->delData($get['id'], true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/4/23
|
||||
* Time: 8:53
|
||||
*/
|
||||
|
||||
namespace app\admin\controller\custom;
|
||||
|
||||
|
||||
use app\admin\controller\AdminController;
|
||||
use think\Db;
|
||||
use app\admin\model\costom\Order;
|
||||
class Student extends AdminController
|
||||
{
|
||||
/**
|
||||
* User模型对象
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
* User constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->model = new \app\admin\model\costom\User;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用戶列表
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
//ajax访问
|
||||
if ($this->request->get('type') == 'ajax') {
|
||||
$page = $this->request->get('page', 1);
|
||||
$limit = $this->request->get('limit', 10);
|
||||
$search = (array)$this->request->get('search', []);
|
||||
return json($this->model->userList($page, $limit, $search));
|
||||
}
|
||||
//获取配置表的省份数据
|
||||
$resProvince = config('province.province');
|
||||
//基础数据
|
||||
$basic_data = [
|
||||
'title' => '用戶列表',
|
||||
'resProvince' => $resProvince,
|
||||
'data' => '',
|
||||
];
|
||||
|
||||
return $this->fetch('', $basic_data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 订单详情
|
||||
* */
|
||||
|
||||
public function details(){
|
||||
//订单商品列表
|
||||
if ($this->request->get('type') == 'ajax') {
|
||||
$id = $this->request->get('user_id');
|
||||
$result = Db::table('orders')->where('user_id','=',$id)->limit(30)->select();
|
||||
|
||||
empty($result) ? $msg = '暂无数据!' : $msg = '查询成功!';
|
||||
//获取配置权限名称
|
||||
$vipNameArr = config('product.vipName');
|
||||
foreach($result as $key => $val){
|
||||
$result[$key]['vipName'] = $vipNameArr[$val['vip']];
|
||||
$result[$key]['add_time'] = date('Y-m-d H:i:s',$val['add_time']);
|
||||
if($val['pay_time']){
|
||||
$result[$key]['pay_time'] = date('Y-m-d H:i:s',$val['pay_time']);
|
||||
}
|
||||
$val['wenli'] = $val['wenli'] = config('setSub.subTypeName')[$val['wenli']];
|
||||
//拼接用户信息
|
||||
$result[$key]['userInfo'] = $val['province_title']."_".$val['score']."_".$val['wenli']."_".$val['mykemustr'];
|
||||
|
||||
}
|
||||
$list = [
|
||||
'code' => 0,
|
||||
'msg' => $msg,
|
||||
'data' => $result
|
||||
];
|
||||
|
||||
return json($list);
|
||||
}
|
||||
$id = $this->request->get('id',0);
|
||||
|
||||
$basic_data = [
|
||||
'title' => '订单详情列表',
|
||||
'data' => '',
|
||||
'user_id' => $id
|
||||
];
|
||||
|
||||
$this->assign($basic_data);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/*
|
||||
* 订单退款
|
||||
* */
|
||||
public function refundOrder(){
|
||||
$post = $this->request->post();
|
||||
$validate = $this->validate($post, 'app\admin\validate\custom\Student.refundOrder');
|
||||
if (true !== $validate){
|
||||
$list = [
|
||||
'code' => 0,
|
||||
'msg' => $validate
|
||||
];
|
||||
return $list;
|
||||
exit;
|
||||
};
|
||||
|
||||
$result = Order::orderRefund($post);
|
||||
|
||||
if($result){
|
||||
$list = [
|
||||
'code' => 1,
|
||||
'msg' => '退款成功!'
|
||||
];
|
||||
}else{
|
||||
$list = [
|
||||
'code' => 2,
|
||||
'msg' => '退款失败!'
|
||||
];
|
||||
}
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user