仓库初始化
This commit is contained in:
54
application/api/controller/Help.php
Normal file
54
application/api/controller/Help.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
|
||||
|
||||
class Help extends BaseCom
|
||||
{
|
||||
/*
|
||||
* 用户反馈
|
||||
*/
|
||||
//初始化
|
||||
protected function initialize()
|
||||
{
|
||||
//允许跨域
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
}
|
||||
|
||||
//常见问题分类
|
||||
public function help_type(){
|
||||
$reslut = DB::name('vs_help_type')->where('delete_time',0)->where('status', 1) ->order('sort desc')->select();
|
||||
$reslut = ['code' => 1, 'msg' => '获取成功', 'data' => $reslut];
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//常见问题
|
||||
public function help_list(){
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 10);
|
||||
$type = input('type', 0);
|
||||
$map = [];
|
||||
if($type){
|
||||
$map = ['type'=>$type];
|
||||
}
|
||||
$page_list = DB::name('vs_help')->field('id,title')->where('delete_time', 0)->where($map)->order('id desc')->page($page, $page_limit)->select();
|
||||
$reslut = ['code' => 1, 'msg' => '获取成功', 'data' => $page_list];
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//常见问题详情
|
||||
public function help_detail(){
|
||||
$id = input('id',0);
|
||||
$data = DB::name('vs_help')->where('id',$id)->find();
|
||||
if(!$data){
|
||||
$reslut = ['code' => 0, 'msg' => '获取失败', 'data' => null];
|
||||
}
|
||||
$data['createtime'] = date('Y-m-d H:i:s',$data['createtime']);
|
||||
$reslut = ['code' => 1, 'msg' => '获取成功', 'data' => $data];
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user