init
This commit is contained in:
115
back/application/api/controller_74GYL3/Material.php
Normal file
115
back/application/api/controller_74GYL3/Material.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\Config;
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
use think\Model;
|
||||
use think\Request;
|
||||
use think\cache\driver\Memcache;
|
||||
|
||||
|
||||
header("Access-Control-Allow-Origin:*");
|
||||
header("Access-Control-Allow-Methods:GET, POST, OPTIONS, DELETE");
|
||||
header("Access-Control-Allow-Headers:DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, Accept-Language, Origin, Accept-Encoding");
|
||||
|
||||
|
||||
class Material extends Common
|
||||
{
|
||||
//获取资料信息
|
||||
/*public function GetMaterialsInfo()
|
||||
{
|
||||
$param = request()->post();
|
||||
|
||||
$ret = db('materials_info')->alias('p')
|
||||
->join('materials_type s', 's.type_id =p.materials_type', 'left')
|
||||
->where('p.materials_owner', $param['materials_owner'])
|
||||
->field('p.*, s.type_name as materials_type_name')
|
||||
->select();
|
||||
return $this->sendSuccess($ret);
|
||||
}*/
|
||||
|
||||
//获取资料类型信息
|
||||
public function GetMaterialsType()
|
||||
{
|
||||
$ret = db('materials_type')->select();
|
||||
return $this->sendSuccess($ret);
|
||||
}
|
||||
|
||||
//添加资料信息
|
||||
//materials_class 资料分类 1项目 2问题 3story 4task
|
||||
//materials_type 具体文件属性,技术文件,会议纪要,问题描述等
|
||||
//materials_owner:资料属于那个项目或问题或story或task
|
||||
public function AddMaterialsInfo()
|
||||
{
|
||||
$param = request()->post();
|
||||
$insert_info = [];
|
||||
$insert_info['materials_class'] = $param['materials_class'];
|
||||
$insert_info['materials_type'] = $param['materials_type'];
|
||||
$insert_info['materials_owner'] = $param['materials_owner'];
|
||||
$insert_info['materials_intro'] = $param['materials_intro'];
|
||||
$insert_info['materials_url'] = $param['materials_url'];
|
||||
$insert_info['create_time'] = $param['create_time'];
|
||||
|
||||
db('materials_info')->insert($insert_info);
|
||||
}
|
||||
|
||||
|
||||
//添加资料信息
|
||||
public function GetMaterialsInfo()
|
||||
{
|
||||
$param = request()->post();
|
||||
|
||||
|
||||
//3:故事 4:任务
|
||||
if (3 == $param['materials_class'] || 4 == $param['materials_class'])
|
||||
{
|
||||
$MaterialsInfoList = db('materials_info')->alias('p')
|
||||
->join('materials_type s', 's.type_id =p.materials_type', 'left')
|
||||
->where('p.materials_class', $param['materials_class'])
|
||||
->where('p.materials_owner', $param['materials_owner'])
|
||||
->order('p.create_time desc')
|
||||
->field('p.*, s.type_name as materials_type_name')
|
||||
->select();
|
||||
return $this->sendSuccess($MaterialsInfoList);
|
||||
}
|
||||
//项目基础信息
|
||||
else if (1 == $param['materials_class'] )
|
||||
{
|
||||
$MaterialsInfoList = db('materials_info')->alias('p')
|
||||
->join('materials_type s', 's.type_id =p.materials_type', 'left')
|
||||
->where('p.materials_class', $param['materials_class'])
|
||||
->where('p.materials_owner', $param['materials_owner'])
|
||||
->where('p.materials_type', $param['materials_type'])
|
||||
->order('p.create_time desc')
|
||||
->field('p.*, s.type_name as materials_type_name')
|
||||
->select();
|
||||
return $this->sendSuccess($MaterialsInfoList);
|
||||
}
|
||||
|
||||
//问题单信息
|
||||
else if (2 == $param['materials_class'] )
|
||||
{
|
||||
$MaterialsInfoList = db('materials_info')->alias('p')
|
||||
->join('materials_type s', 's.type_id =p.materials_type', 'left')
|
||||
->where('p.materials_class', $param['materials_class'])
|
||||
->where('p.materials_owner', $param['materials_owner'])
|
||||
->where('p.materials_type', $param['materials_type'])
|
||||
->order('p.create_time desc')
|
||||
->field('p.*, s.type_name as materials_type_name')
|
||||
->select();
|
||||
return $this->sendSuccess($MaterialsInfoList);
|
||||
}
|
||||
|
||||
|
||||
/*$MaterialsInfoList = db('materials_info')->where('project_id', $param['project_id'])
|
||||
->where('issue_id', $param['issue_id'])
|
||||
->where('materials_type', $param['materials_type'])
|
||||
->order('create_time desc')
|
||||
->select();*/
|
||||
//return $this->sendSuccess($MaterialsInfoList);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user