Commit 99ff3f55 authored by wangtao's avatar wangtao

学习资料

parent 928bfbe8
......@@ -13,9 +13,9 @@ use app\api\validate\StudyInformationValidate;
class StudyInformation extends BaseController
{
protected $middleware = [
Auth::class,
];
// protected $middleware = [
// Auth::class,
// ];
//添加学习资料
public function addStudyInformation(Request $request)
......@@ -91,7 +91,7 @@ class StudyInformation extends BaseController
$pageSize = $request->param('pageSize', 10);
$list = StudyInformationModel::where($where)->where($map)
->order('createtime desc')
->with(['filepath','studycatedata'])
->with(['filepath', 'studycatedata'])
->append(['status_text'])
->paginate([
'page' => $page,
......@@ -111,9 +111,9 @@ class StudyInformation extends BaseController
}
$parm = $request->param();
$where = ['id' => $parm['study_information_id'], 'user_id' => $request->userId];
if($parm['updateField'] == 'is_sell'){
if ($parm['updateField'] == 'is_sell') {
$status = StudyInformationModel::where($where)->value('status');
if($status != 2){
if ($status != 2) {
return $this->returnMsg('审核未通过不能上下架');
}
}
......@@ -121,6 +121,19 @@ class StudyInformation extends BaseController
return $this->returnMsg('操作成功', 1, $result);
}
//学习资料详情
public function detailStudyInformation(Request $request)
{
$vo = (new StudyInformationValidate())->goCheck(['study_information_id']);
if ($vo !== true) {
return $vo;
}
$parm = $request->param();
$where = ['id' => $parm['study_information_id'], 'user_id' => $request->userId];
$info = StudyInformationModel::where($where)->with(['filepath', 'studycatedata'])->append(['status_text'])->find();
return $this->returnMsg('操作成功', 1, $info);
}
//学习资料分类列表
public function getStudyCategoryList()
{
......@@ -128,4 +141,5 @@ class StudyInformation extends BaseController
return $this->returnMsg('操作成功', 1, $list);
}
}
\ No newline at end of file
......@@ -116,7 +116,7 @@ class StudyInformation extends Model
$query->where('id', $id);
}
$query->where(['is_sell'=>1,'status'=>2]);
$query->field('id,user_id,title,type,thumb,updatetime,createtime,file_id');
$query->field('id,user_id,title,type,thumb,updatetime,createtime,file_id,content');
return $query->find();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment