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
e15a738b
Commit
e15a738b
authored
May 14, 2025
by
wangzhengwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交本地修改
parent
22e405d0
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
403 additions
and
33 deletions
+403
-33
CourseComment.php
app/api/controller/CourseComment.php
+99
-0
User.php
app/api/controller/User.php
+0
-16
User.php
app/api/controller/mine/User.php
+116
-0
Auth.php
app/api/middleware/Auth.php
+1
-1
UserService.php
app/api/service/UserService.php
+9
-3
CourseValidate.php
app/api/validate/CourseValidate.php
+1
-0
UserValidate.php
app/api/validate/UserValidate.php
+10
-1
Course.php
app/model/Course.php
+2
-1
CourseClassCategory.php
app/model/CourseClassCategory.php
+1
-1
CourseComment.php
app/model/CourseComment.php
+61
-0
CourseProgress.php
app/model/CourseProgress.php
+3
-3
CourseUserWork.php
app/model/CourseUserWork.php
+5
-5
Advert.php
app/model/project/Advert.php
+1
-0
AdvertCate.php
app/model/project/AdvertCate.php
+1
-0
Business.php
app/model/project/Business.php
+5
-0
School.php
app/model/project/School.php
+4
-0
User.php
app/model/project/User.php
+18
-2
UserAccount.php
app/model/project/UserAccount.php
+33
-0
UserSmrz.php
app/model/project/UserSmrz.php
+33
-0
No files found.
app/api/controller/CourseComment.php
0 → 100644
View file @
e15a738b
<?php
namespace
app\api\controller
;
use
app\api\middleware\Auth
;
use
app\api\validate\CourseValidate
;
use
app\BaseController
;
use
think\facade\Request
;
use
app\model\CourseComment
as
courseCommentModel
;
class
CourseComment
extends
BaseController
{
protected
$middleware
=
[
Auth
::
class
,
];
// 获取评论列表
public
function
list
()
{
$vo
=
(
new
CourseValidate
())
->
goCheck
([
'course_id'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
$courseId
=
Request
::
param
(
'course_id/d'
,
0
);
$page
=
Request
::
param
(
'page/d'
,
1
);
$pageSize
=
Request
::
param
(
'pageSize/d'
,
10
);
$comments
=
courseCommentModel
::
getCommentList
(
$courseId
,
$page
,
$pageSize
);
return
$this
->
returnMsg
(
'success'
,
1
,
$comments
);
}
// 发表评论
public
function
create
()
{
$vo
=
(
new
CourseValidate
())
->
goCheck
([
'course_id'
,
'content'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
$userId
=
$this
->
request
->
userId
;
$courseId
=
Request
::
param
(
'course_id/d'
,
0
);
$parentId
=
Request
::
param
(
'parent_id/d'
,
0
);
$content
=
Request
::
param
(
'content/s'
,
''
);
// 如果是回复,检查父评论是否存在
if
(
$parentId
>
0
)
{
$parentComment
=
courseCommentModel
::
where
(
'id'
,
$parentId
)
->
where
(
'course_id'
,
$courseId
)
->
find
();
if
(
!
$parentComment
)
{
return
$this
->
returnMsg
(
'父评论不存在'
);
}
// 限制只能回复一级评论
if
(
$parentComment
->
parent_id
>
0
)
{
return
$this
->
returnMsg
(
'只能回复一级评论'
);
}
}
// 创建评论
$comment
=
courseCommentModel
::
create
([
'course_id'
=>
$courseId
,
'user_id'
=>
$userId
,
'parent_id'
=>
$parentId
,
'content'
=>
$content
]);
return
$this
->
returnMsg
(
'success'
,
1
,
$comment
);
}
// 删除评论
public
function
delete
()
{
$userId
=
$this
->
request
->
userId
;
$commentId
=
Request
::
param
(
'comment_id/d'
,
0
);
$comment
=
courseCommentModel
::
where
(
'id'
,
$commentId
)
->
where
(
'user_id'
,
$userId
)
->
find
();
if
(
!
$comment
)
{
return
$this
->
returnMsg
(
'评论不存在或无权删除'
);
}
$comment
->
together
([
'replies'
])
->
delete
();
return
$this
->
returnMsg
(
'删除成功'
,
1
);
}
}
\ No newline at end of file
app/api/controller/User.php
View file @
e15a738b
...
...
@@ -48,22 +48,6 @@ class User extends BaseController
}
public
function
getUserInfo
(
Request
$request
)
{
$vo
=
(
new
UserValidate
())
->
goCheck
([
'token'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
$data
=
$request
->
header
();
$user
=
UserService
::
getUserInfo
(
$data
[
'token'
]);
if
(
!
$user
)
{
return
$this
->
returnMsg
(
'token无效'
,
0
);
}
return
$this
->
returnMsg
(
'操作成功'
,
1
,
$user
);
}
public
function
register
(
Request
$request
)
...
...
app/api/controller/mine/User.php
0 → 100644
View file @
e15a738b
<?php
namespace
app\api\controller\mine
;
use
app\api\middleware\Auth
;
use
app\api\service\UserService
;
use
app\api\validate\UserValidate
;
use
app\BaseController
;
use
app\model\project\UserAccount
;
use
app\model\project\UserSmrz
;
use
app\Request
;
use
app\model\project\User
as
UserModel
;
class
User
extends
BaseController
{
protected
$middleware
=
[
Auth
::
class
,
];
public
function
getUserInfo
(
Request
$request
)
{
$vo
=
(
new
UserValidate
())
->
goCheck
([
'token'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
$data
=
$request
->
header
();
$user
=
UserService
::
getUserInfo
(
$data
[
'token'
]);
if
(
!
$user
)
{
return
$this
->
returnMsg
(
'token无效'
,
0
);
}
return
$this
->
returnMsg
(
'操作成功'
,
1
,
$user
);
}
public
function
updateUserInfo
(
Request
$request
)
{
$vo
=
(
new
UserValidate
())
->
goCheck
([
'updateField'
,
'updateValue'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
$data
=
$request
->
param
();
$res
=
UserService
::
updateUserInfo
(
$data
[
'updateField'
],
$data
[
'updateValue'
]);
return
$this
->
returnMsg
(
'操作成功'
,
1
,
$res
);
}
public
function
bindZfb
(
Request
$request
)
{
$vo
=
(
new
UserValidate
())
->
goCheck
([
'zfb'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
if
(
UserAccount
::
where
([
'user_id'
=>
$request
->
userId
,
'is_del'
=>
0
])
->
count
())
{
return
$this
->
returnMsg
(
'请勿重复提交'
);
}
$data
=
$request
->
param
();
$data
[
'type'
]
=
0
;
$data
[
'account'
]
=
$data
[
'zfb'
];
$data
[
'user_id'
]
=
$request
->
userId
;
unset
(
$data
[
'zfb'
]);
$res
=
UserAccount
::
create
(
$data
);
return
$this
->
returnMsg
(
'操作成功'
,
1
,
$res
);
}
public
function
editMobile
(
Request
$request
)
{
$vo
=
(
new
UserValidate
())
->
goCheck
([
'mobile'
,
'code'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
$data
=
$request
->
param
();
//check sms
$res
=
UserService
::
updateUserInfo
(
'mobile'
,
$data
[
'mobile'
]);
return
$this
->
returnMsg
(
'操作成功'
,
1
,
$res
);
}
public
function
realUser
(
Request
$request
)
{
$vo
=
(
new
UserValidate
())
->
goCheck
([
'realname'
,
'idcard'
,
'idcard_q'
,
'idcard_h'
]);
if
(
$vo
!==
true
)
{
return
$vo
;
}
if
(
UserSmrz
::
where
([
'user_id'
=>
$request
->
userId
,
'is_del'
=>
0
])
->
count
())
{
return
$this
->
returnMsg
(
'请勿重复提交'
);
}
$data
=
$request
->
param
();
$data
[
'user_id'
]
=
$request
->
userId
;
$res
=
UserSmrz
::
create
(
$data
);
return
$this
->
returnMsg
(
'操作成功'
,
1
,
$res
);
}
}
\ No newline at end of file
app/api/middleware/Auth.php
View file @
e15a738b
...
...
@@ -34,7 +34,7 @@ class Auth extends BaseController
{
return
false
;
}
if
(
$user
[
'status'
]
!=
1
)
if
(
$user
[
'
user'
][
'
status'
]
!=
1
)
{
return
false
;
}
...
...
app/api/service/UserService.php
View file @
e15a738b
...
...
@@ -3,6 +3,7 @@
namespace
app\api\service
;
use
app\api\validate\UserValidate
;
use
app\model\project\User
;
use
app\model\project\User
as
userModel
;
use
app\Request
;
...
...
@@ -18,9 +19,9 @@ class UserService
return
false
;
}
$user
=
userModel
::
where
([
'token'
=>
$token
])
->
field
(
'id,username,mobile,realname,token,role'
)
// ->with(['getSchoolData','getBusinessData'=>['businessQualification']
])
$user
=
userModel
::
where
([
'token'
=>
$token
,
'is_del'
=>
0
])
//
->field('id,username,mobile,realname,token,role')
->
with
([
'headico'
,
'zfb'
])
->
find
();
if
(
!
$user
)
{
...
...
@@ -30,5 +31,10 @@ class UserService
return
$user
->
toArray
();
}
public
static
function
updateUserInfo
(
$filed
,
$value
)
{
return
User
::
where
(
'id'
,
\request
()
->
userId
)
->
update
([
$filed
=>
$value
]);
}
}
\ No newline at end of file
app/api/validate/CourseValidate.php
View file @
e15a738b
...
...
@@ -12,6 +12,7 @@ class CourseValidate extends BaseValidate
'current_time'
=>
'require|number'
,
'attachment_ids'
=>
'require'
,
'work_id'
=>
'require|number'
,
'content'
=>
'require'
,
];
// protected $message = [
...
...
app/api/validate/UserValidate.php
View file @
e15a738b
...
...
@@ -14,6 +14,13 @@ class UserValidate extends BaseValidate
'token'
=>
'require'
,
'str'
=>
'require'
,
'confirm_password'
=>
'require|checkPasswordEqual'
,
'updateField'
=>
'require|in:username,realname,sex,headico,description,email,qq,wechat'
,
'updateValue'
=>
'require'
,
'zfb'
=>
'require'
,
'realname'
=>
'require'
,
'idcard'
=>
'require'
,
'idcard_q'
=>
'require'
,
'idcard_h'
=>
'require'
,
];
protected
$message
=
[
...
...
@@ -24,7 +31,9 @@ class UserValidate extends BaseValidate
'code.require'
=>
'验证码必须'
,
'token.require'
=>
'token必须'
,
'str.require'
=>
'必填项不能为空'
,
'confirm_password.checkPasswordEqual'
=>
'两次输入的密码不一致'
'confirm_password.checkPasswordEqual'
=>
'两次输入的密码不一致'
,
'updateField.require'
=>
'必填项不能为空'
,
'updateField.in'
=>
'范围不合法'
,
];
protected
function
checkPasswordEqual
(
$value
,
$rule
,
$data
)
...
...
app/model/Course.php
View file @
e15a738b
...
...
@@ -59,7 +59,7 @@ class Course extends Model
//获取课程详情
public
function
getCouresDetail
(
$course_id
=
0
)
{
//
$where = ['status'=>3,'is_sell'=>1,'is_del'=>0];
$where
=
[
'status'
=>
3
,
'is_sell'
=>
1
,
'is_del'
=>
0
];
if
(
$course_id
)
{
$where
[
'id'
]
=
$course_id
;
...
...
@@ -113,6 +113,7 @@ class Course extends Model
public
function
thumb
()
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'thumb'
)
->
where
(
'is_del'
,
0
)
->
field
(
'fileid,filename,filesize,fileurl,filetype'
);
}
...
...
app/model/CourseClassCategory.php
View file @
e15a738b
...
...
@@ -10,7 +10,7 @@ class CourseClassCategory extends Model
public
function
getCourseClass
()
{
return
$this
->
hasMany
(
\app\model\CourseClass
::
class
,
'cate_id'
,
'id'
)
//
->where('is_del',0)
->
where
(
'is_del'
,
0
)
->
order
(
'sort'
,
'asc'
);
// ->field('id,title,cate_id');
}
...
...
app/model/CourseComment.php
0 → 100644
View file @
e15a738b
<?php
namespace
app\model
;
use
app\model\project\User
;
use
think\Model
;
use
think\model\concern\SoftDelete
;
class
CourseComment
extends
Model
{
use
SoftDelete
;
// 设置当前模型对应的完整数据表名称
protected
$table
=
'fj_course_comments'
;
// 自动时间戳
protected
$autoWriteTimestamp
=
true
;
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
'updatetime'
;
// 指定软删除字段
protected
$deleteTime
=
'deletetime'
;
// 用户关联
public
function
user
()
{
return
$this
->
belongsTo
(
User
::
class
,
'user_id'
,
'id'
)
->
field
(
'id,username,headico'
);
}
// 回复关联
public
function
replies
()
{
return
$this
->
hasMany
(
CourseComment
::
class
,
'parent_id'
,
'id'
)
->
with
(
'user'
)
->
order
(
'createtime'
,
'asc'
);
}
// 获取课程评论列表
public
static
function
getCommentList
(
$courseId
,
$page
=
1
,
$pageSize
=
10
)
{
return
self
::
with
([
'user'
=>
[
'headico'
],
'replies'
])
->
where
(
'course_id'
,
$courseId
)
->
where
(
'parent_id'
,
0
)
->
order
(
'createtime'
,
'desc'
)
->
paginate
([
'page'
=>
$page
,
'list_rows'
=>
$pageSize
]);
}
// 获取包含已删除评论的查询(管理员用)
public
static
function
getListWithTrashed
(
$courseId
)
{
return
self
::
with
([
'user'
=>
[
'headico'
],
'replies'
])
->
where
(
'course_id'
,
$courseId
)
->
where
(
'parent_id'
,
0
)
->
withTrashed
()
->
select
();
}
}
\ No newline at end of file
app/model/CourseProgress.php
View file @
e15a738b
...
...
@@ -19,19 +19,19 @@ class CourseProgress extends Model
// 关联课程
public
function
course
()
{
return
$this
->
belongsTo
(
Course
::
class
,
'course_id'
);
return
$this
->
belongsTo
(
Course
::
class
,
'course_id'
)
->
where
(
'is_del'
,
0
)
;
}
// 关联章节(课时)
public
function
class
()
{
return
$this
->
belongsTo
(
CourseClass
::
class
,
'class_id'
);
return
$this
->
belongsTo
(
CourseClass
::
class
,
'class_id'
)
->
where
(
'is_del'
,
0
)
;
}
// 关联用户
public
function
user
()
{
return
$this
->
belongsTo
(
User
::
class
,
'user_id'
);
return
$this
->
belongsTo
(
User
::
class
,
'user_id'
)
->
where
(
'is_del'
,
0
)
;
}
}
\ No newline at end of file
app/model/CourseUserWork.php
View file @
e15a738b
...
...
@@ -25,7 +25,7 @@ class CourseUserWork extends Model
*/
public
static
function
workList
(
$userId
,
$page
=
1
,
$pageSize
=
10
)
{
return
self
::
where
([
'user_id'
=>
$userId
])
return
self
::
where
([
'user_id'
=>
$userId
,
'is_del'
=>
0
])
->
with
([
'course'
,
'courseWork'
])
->
field
(
'id,user_id,work_id,status,course_id,createtime'
)
->
paginate
([
...
...
@@ -44,7 +44,7 @@ class CourseUserWork extends Model
*/
public
static
function
workDetail
(
$id
)
{
$detail
=
self
::
where
([
'id'
=>
$id
])
$detail
=
self
::
where
([
'id'
=>
$id
,
'is_del'
=>
0
])
->
with
([
'course'
,
'courseWork'
])
->
field
(
'id,user_id,work_id,status,course_id,createtime'
)
->
findOrEmpty
();
...
...
@@ -90,7 +90,7 @@ class CourseUserWork extends Model
*/
public
static
function
uploadWork
(
$workId
,
$attachment_ids
)
{
return
self
::
where
([
'id'
=>
$workId
,
'status'
=>
0
])
return
self
::
where
([
'id'
=>
$workId
,
'status'
=>
0
,
'is_del'
=>
0
])
->
update
([
'attachment_ids'
=>
$attachment_ids
,
'status'
=>
1
]);
}
...
...
@@ -98,13 +98,13 @@ class CourseUserWork extends Model
//关联作业
public
function
courseWork
()
{
return
$this
->
hasOne
(
CourseWork
::
class
,
'id'
,
'work_id'
)
->
field
(
'id,title,file_id_str'
);
return
$this
->
hasOne
(
CourseWork
::
class
,
'id'
,
'work_id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'id,title,file_id_str'
);
}
//关联课程
public
function
course
()
{
return
$this
->
hasOne
(
Course
::
class
,
'id'
,
'course_id'
)
->
field
(
'id,title'
);
return
$this
->
hasOne
(
Course
::
class
,
'id'
,
'course_id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'id,title'
);
}
}
\ No newline at end of file
app/model/project/Advert.php
View file @
e15a738b
...
...
@@ -17,6 +17,7 @@ class Advert extends Model
public
function
coverImg
()
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'cover_img_id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'fileid, filename, filesize, fileurl, filetype'
);
}
public
function
getAdvcatenameAttr
(
$value
,
$data
){
...
...
app/model/project/AdvertCate.php
View file @
e15a738b
...
...
@@ -17,6 +17,7 @@ class AdvertCate extends Model
public
function
getAdvertList
()
{
return
$this
->
hasMany
(
Advert
::
class
,
'p_id'
,
'id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'id,name,type,url,p_id,url,cover_img_id'
)
->
order
(
'sort desc'
);
}
...
...
app/model/project/Business.php
View file @
e15a738b
...
...
@@ -17,6 +17,7 @@ class Business extends Model
public
function
businessQualification
()
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'business_qualification_url_id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'fileid,filename,filesize,fileurl,filetype'
);
}
...
...
@@ -24,6 +25,7 @@ class Business extends Model
public
function
businessIndustry
()
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'business_industry_url_id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'fileid,filename,filesize,fileurl,filetype'
);
}
...
...
@@ -31,6 +33,7 @@ class Business extends Model
public
function
businessPorject
()
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'business_project_url_id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'fileid,filename,filesize,fileurl,filetype'
);
}
...
...
@@ -38,6 +41,7 @@ class Business extends Model
public
function
businessMore
()
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'more_url_id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'fileid,filename,filesize,fileurl,filetype'
);
}
...
...
@@ -45,6 +49,7 @@ class Business extends Model
public
function
businessLogo
()
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'business_logo_url_id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'fileid,filename,filesize,fileurl,filetype'
);
}
}
\ No newline at end of file
app/model/project/School.php
View file @
e15a738b
...
...
@@ -17,6 +17,7 @@ class School extends Model
public
function
schoolQualification
()
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'school_qualification_url_id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'fileid,filename,filesize,fileurl,filetype'
);
}
...
...
@@ -24,6 +25,7 @@ class School extends Model
public
function
teacherQualification
()
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'teacher_qualification_url_id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'fileid, filename, filesize, fileurl, filetype'
);
}
...
...
@@ -31,6 +33,7 @@ class School extends Model
public
function
agreement
()
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'agreement_url_id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'fileid, filename, filesize, fileurl, filetype'
);
}
...
...
@@ -38,6 +41,7 @@ class School extends Model
public
function
moreFile
()
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'more_url_id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'fileid, filename, filesize, fileurl, filetype'
);
}
}
\ No newline at end of file
app/model/project/User.php
View file @
e15a738b
...
...
@@ -2,6 +2,7 @@
namespace
app\model\project
;
use
app\model\system\SystemUploadFile
;
use
think\Model
;
use
function
Symfony
\Component\Translation\t
;
...
...
@@ -16,12 +17,27 @@ class User extends Model
public
function
getSchoolData
()
{
return
$this
->
hasOne
(
School
::
class
,
'user_id'
,
'id'
);
return
$this
->
hasOne
(
School
::
class
,
'user_id'
,
'id'
)
->
where
(
'is_del'
,
0
)
;
}
public
function
getBusinessData
()
{
return
$this
->
hasOne
(
Business
::
class
,
'user_id'
,
'id'
);
return
$this
->
hasOne
(
Business
::
class
,
'user_id'
,
'id'
)
->
where
(
'is_del'
,
0
);
}
public
function
headico
()
{
return
$this
->
hasOne
(
SystemUploadFile
::
class
,
'fileid'
,
'headico'
)
->
where
(
'is_del'
,
0
)
->
field
(
'fileid,filename,filesize,fileurl,filetype'
);
}
public
function
zfb
()
{
return
$this
->
hasOne
(
UserAccount
::
class
,
'user_id'
,
'id'
)
->
where
(
'type'
,
0
)
->
where
(
'is_del'
,
0
)
->
field
(
'account,id,user_id'
);
}
//获取头像
...
...
app/model/project/UserAccount.php
0 → 100644
View file @
e15a738b
<?php
namespace
app\model\project
;
use
app\model\project\User
;
use
think\Model
;
use
think\model\concern\SoftDelete
;
class
UserAccount
extends
Model
{
// use SoftDelete;
// 设置当前模型对应的完整数据表名称
protected
$table
=
'fj_user_account'
;
// 自动时间戳
protected
$autoWriteTimestamp
=
true
;
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
false
;
// 指定软删除字段
// protected $deleteTime = 'is_del';
// 用户关联
public
function
user
()
{
return
$this
->
belongsTo
(
User
::
class
,
'user_id'
,
'id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'id,username,headico'
);
}
}
\ No newline at end of file
app/model/project/UserSmrz.php
0 → 100644
View file @
e15a738b
<?php
namespace
app\model\project
;
use
app\model\project\User
;
use
think\Model
;
use
think\model\concern\SoftDelete
;
class
UserSmrz
extends
Model
{
// use SoftDelete;
// 设置当前模型对应的完整数据表名称
protected
$table
=
'fj_user_smrz'
;
// 自动时间戳
protected
$autoWriteTimestamp
=
true
;
protected
$createTime
=
'create_time'
;
protected
$updateTime
=
false
;
// 指定软删除字段
// protected $deleteTime = 'is_del';
// 用户关联
public
function
user
()
{
return
$this
->
belongsTo
(
User
::
class
,
'user_id'
,
'id'
)
->
where
(
'is_del'
,
0
)
->
field
(
'id,username,headico'
);
}
}
\ 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