Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projecttwo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangtao
projecttwo
Commits
cfb0f1f2
Commit
cfb0f1f2
authored
Jun 19, 2025
by
wangzhengwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目封面图招募截止日期
parent
ad71f30d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
14 deletions
+42
-14
Project.php
app/api/controller/manage/Project.php
+7
-5
Project.php
app/api/controller/project/Project.php
+1
-7
ProjectPut.php
app/api/controller/project/ProjectPut.php
+12
-0
ProjectService.php
app/api/service/ProjectService.php
+4
-0
ProjectValidate.php
app/api/validate/ProjectValidate.php
+1
-0
Project.php
app/model/Project.php
+17
-2
No files found.
app/api/controller/manage/Project.php
View file @
cfb0f1f2
...
...
@@ -43,7 +43,7 @@ class Project extends BaseController
}
$query
=
ProjectModel
::
where
(
$where
);
$query
=
ProjectModel
::
w
ith
([
'thumb'
])
->
w
here
(
$where
);
if
(
!
empty
(
$data
[
'search_str'
]))
{
$searchStr
=
trim
(
$data
[
'search_str'
]);
...
...
@@ -240,7 +240,7 @@ class Project extends BaseController
//创建项目
public
function
createProject
(
Request
$request
)
{
$filed
=
[
'title'
,
'cate_id'
,
'tag_ids'
,
'yusuan'
,
'zhouqi'
,
'description'
,
'content'
,
'file_id_str
'
];
$filed
=
[
'title'
,
'cate_id'
,
'tag_ids'
,
'yusuan'
,
'zhouqi'
,
'description'
,
'put_end_time
'
];
// 参数验证
$vo
=
(
new
ProjectValidate
())
->
goCheck
(
$filed
);
...
...
@@ -248,9 +248,10 @@ class Project extends BaseController
return
$vo
;
}
$data
=
$request
->
only
(
$filed
);
$data
=
$request
->
param
(
);
$data
[
'sn'
]
=
UtilService
::
generateCompactOrderNo
(
null
,
'xm'
);
$data
[
'user_id'
]
=
$request
->
userId
;
$data
[
'put_end_time'
]
=
strtotime
(
$data
[
'put_end_time'
]);
try
{
// 开启事务
...
...
@@ -303,16 +304,17 @@ class Project extends BaseController
//编辑项目
public
function
editProject
(
Request
$request
)
{
$filed
=
[
'project_id'
,
'title'
,
'cate_id'
,
'tag_ids'
,
'yusuan'
,
'zhouqi'
,
'description'
,
'content'
,
'file_id_str
'
];
$filed
=
[
'project_id'
,
'title'
,
'cate_id'
,
'tag_ids'
,
'yusuan'
,
'zhouqi'
,
'description'
,
'put_end_time
'
];
$vo
=
(
new
ProjectValidate
())
->
goCheck
(
$filed
);
if
(
$vo
!==
true
)
{
return
$vo
;
}
$data
=
$request
->
only
(
$filed
);
$data
=
$request
->
param
(
);
$id
=
$data
[
'project_id'
];
unset
(
$data
[
'project_id'
]);
$data
[
'put_end_time'
]
=
strtotime
(
$data
[
'put_end_time'
]);
$res
=
ProjectModel
::
where
([
'id'
=>
$id
,
'user_id'
=>
$request
->
userId
])
->
update
(
$data
);
return
$this
->
returnMsg
(
'success'
,
1
,
$res
);
...
...
app/api/controller/project/Project.php
View file @
cfb0f1f2
...
...
@@ -23,7 +23,7 @@ class Project extends BaseController
return
$this
->
returnMsg
(
'success'
,
1
,
$list
);
}
//推荐项目列表
//推荐项目
分类
列表
public
function
getProjectCategoryTjList
(
Request
$request
)
{
$list
=
(
new
ProjectCategory
())
->
getProjectCategoryTjList
();
...
...
@@ -77,12 +77,6 @@ class Project extends BaseController
[
'user_id'
=>
27
,
'total_money'
=>
2500.0
,
'record_count'
=>
8
,
'user_info'
=>
[
'username'
=>
'Alice'
,
'realname'
=>
'Alice Smith'
,
'headico'
=>
41
,
'id'
=>
2
]],
[
'user_id'
=>
28
,
'total_money'
=>
2000.0
,
'record_count'
=>
7
,
'user_info'
=>
[
'username'
=>
'Bob'
,
'realname'
=>
'Bob Johnson'
,
'headico'
=>
42
,
'id'
=>
3
]],
[
'user_id'
=>
29
,
'total_money'
=>
1800.0
,
'record_count'
=>
6
,
'user_info'
=>
[
'username'
=>
'David'
,
'realname'
=>
'David Lee'
,
'headico'
=>
43
,
'id'
=>
4
]],
[
'user_id'
=>
30
,
'total_money'
=>
1500.0
,
'record_count'
=>
5
,
'user_info'
=>
[
'username'
=>
'Eva'
,
'realname'
=>
'Eva Green'
,
'headico'
=>
44
,
'id'
=>
5
]],
[
'user_id'
=>
31
,
'total_money'
=>
1200.0
,
'record_count'
=>
4
,
'user_info'
=>
[
'username'
=>
'Frank'
,
'realname'
=>
'Frank Wang'
,
'headico'
=>
45
,
'id'
=>
6
]],
[
'user_id'
=>
32
,
'total_money'
=>
1000.0
,
'record_count'
=>
3
,
'user_info'
=>
[
'username'
=>
'Grace'
,
'realname'
=>
'Grace Zhao'
,
'headico'
=>
46
,
'id'
=>
7
]],
[
'user_id'
=>
33
,
'total_money'
=>
800.0
,
'record_count'
=>
2
,
'user_info'
=>
[
'username'
=>
'Henry'
,
'realname'
=>
'Henry Chen'
,
'headico'
=>
47
,
'id'
=>
8
]],
[
'user_id'
=>
34
,
'total_money'
=>
500.0
,
'record_count'
=>
1
,
'user_info'
=>
[
'username'
=>
'Ivy'
,
'realname'
=>
'Ivy Zhang'
,
'headico'
=>
48
,
'id'
=>
9
]],
[
'user_id'
=>
35
,
'total_money'
=>
300.0
,
'record_count'
=>
1
,
'user_info'
=>
[
'username'
=>
'Jack'
,
'realname'
=>
'Jack Ma'
,
'headico'
=>
49
,
'id'
=>
10
]]
];
}
...
...
app/api/controller/project/ProjectPut.php
View file @
cfb0f1f2
...
...
@@ -7,6 +7,8 @@ use app\api\validate\ProjectValidate;
use
app\BaseController
;
use
think\Request
;
use
app\model\ProjectPut
as
ProjectPutModel
;
use
app\model\Project
as
ProjectModel
;
class
ProjectPut
extends
BaseController
{
...
...
@@ -26,6 +28,16 @@ class ProjectPut extends BaseController
$data
=
$request
->
only
([
'project_id'
,
'user_desc'
,
'file_id_str'
]);
$projectData
=
ProjectModel
::
where
([
'id'
=>
$data
[
'project_id'
]])
->
find
();
if
(
$projectData
[
'status'
]
!=
1
)
{
return
$this
->
returnMsg
(
'项目状态错误'
);
}
if
(
$projectData
[
'put_end_time'
]
<
time
())
{
return
$this
->
returnMsg
(
'项目已结束'
);
}
$count
=
ProjectPutModel
::
where
([
'project_id'
=>
$data
[
'project_id'
],
'user_id'
=>
$request
->
userId
])
->
count
();
if
(
$count
)
{
...
...
app/api/service/ProjectService.php
View file @
cfb0f1f2
...
...
@@ -40,6 +40,10 @@ class ProjectService
if
(
!
$projectData
)
{
throw
new
\Exception
(
'项目不存在'
);
}
// if ($projectData['put_end_time']<time())
// {
// throw new \Exception('项目已过截止日期');
// }
// 4. 更新项目状态为已完成
$projectUpdate
=
[
'status'
=>
4
,
'updatetime'
=>
time
(),
'complete_time'
=>
time
()];
...
...
app/api/validate/ProjectValidate.php
View file @
cfb0f1f2
...
...
@@ -33,6 +33,7 @@ class ProjectValidate extends BaseValidate
'title'
=>
'require|checktitle'
,
'user_id'
=>
'require|number'
,
'pid'
=>
'require|number'
,
'put_end_time'
=>
'require'
,
];
protected
$message
=
[
'title.require'
=>
'项目名不能为空'
,
...
...
app/model/Project.php
View file @
cfb0f1f2
...
...
@@ -48,6 +48,11 @@ class Project extends Model
return
date
(
'Y-m-d H:i:s'
,
$value
);
}
public
function
getPutEndTimeAttr
(
$value
)
{
if
(
!
$value
)
return
null
;
return
date
(
'Y-m-d H:i:s'
,
$value
);
}
public
function
getCreatetimeAttr
(
$value
)
{
...
...
@@ -116,6 +121,8 @@ class Project extends Model
$where
=
[
'sh_status'
=>
2
,
'status'
=>
1
];
$query
=
self
::
where
(
$where
);
$query
->
where
(
'put_end_time'
,
'>'
,
time
());
if
(
$category_id
)
{
// $where['cate_id'] = $category_id;
...
...
@@ -136,7 +143,8 @@ class Project extends Model
{
$query
->
where
(
'is_hot'
,
1
);
}
$list
=
$query
->
field
(
'id,sn,title,createtime,cate_id,yusuan,zhouqi,tag_ids'
)
$list
=
$query
->
field
(
'id,sn,title,createtime,cate_id,yusuan,zhouqi,tag_ids,put_end_time,thumb'
)
->
with
([
'thumb'
])
->
paginate
([
'page'
=>
$page
,
'list_rows'
=>
$pageSize
...
...
@@ -154,7 +162,7 @@ class Project extends Model
//项目详情
public
function
projectDetail
(
$id
,
$userId
)
{
$project
=
self
::
with
([
'getuserdata'
,
'projectcatedata'
])
->
find
(
$id
);
$project
=
self
::
with
([
'getuserdata'
,
'projectcatedata'
,
'thumb'
])
->
find
(
$id
);
if
(
!
$project
)
{
return
[];
}
...
...
@@ -190,5 +198,12 @@ class Project extends Model
return
get_upload_file
(
$data
[
'file_id_str'
],
'list'
);
}
public
function
thumb
()
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'thumb'
)
->
where
(
'isdel'
,
0
)
->
field
(
'fileid,filename,filesize,fileurl,filetype'
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment