Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
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
hujun
tl_estate
Commits
b857f5d7
Commit
b857f5d7
authored
Jul 03, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台商学院接口
parent
7add9f4f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
258 additions
and
0 deletions
+258
-0
UploadFileService.php
application/api_broker/service/UploadFileService.php
+3
-0
News.php
application/index/controller/News.php
+159
-0
index.html
application/index/view/news/index.html
+3
-0
SLabel.php
application/model/SLabel.php
+16
-0
SNews.php
application/model/SNews.php
+73
-0
route.php
application/route.php
+4
-0
No files found.
application/api_broker/service/UploadFileService.php
View file @
b857f5d7
...
...
@@ -66,6 +66,9 @@ class UploadFileService
case
'house_img'
:
$path
.=
'resource/lib/Attachments/images/'
;
break
;
case
'business_school'
:
$path
.=
'static/business_school/'
;
break
;
default
:
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
"上传图片类型错误"
;
...
...
application/index/controller/News.php
0 → 100644
View file @
b857f5d7
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/6/12
* Time: 17:21
*/
namespace
app\index\controller
;
use
app\api_broker\service\UploadFileService
;
use
app\index\extend\Basic
;
use
app\model\SLabel
;
use
app\model\SNews
;
use
think\Request
;
class
News
extends
Basic
{
protected
$m_news
;
public
function
__construct
(
Request
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
m_news
=
new
SNews
();
}
/**
* 商学院列表
*
* @return \think\Response|\think\response\View
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
index
()
{
if
(
!
$this
->
request
->
isAjax
())
{
return
view
(
'index'
);
}
$pageNo
=
empty
(
$this
->
params
[
'pageNo'
])
?
1
:
$this
->
params
[
'pageNo'
];
$pageSize
=
empty
(
$this
->
params
[
'pageSize'
])
?
10
:
$this
->
params
[
'pageSize'
];
if
(
!
empty
(
$this
->
params
[
'start_time'
])
&&
empty
(
$this
->
params
[
'end_time'
]))
{
$where
[
'a.create_time'
]
=
[
'> time'
,
$this
->
params
[
'start_time'
]
.
' 00:00:00'
];
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
empty
(
$this
->
params
[
'start_time'
]))
{
$where
[
'a.create_time'
]
=
[
'< time'
,
$this
->
params
[
'end_time'
]
.
' 23:59:59'
];
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
!
empty
(
$this
->
params
[
'start_time'
]))
{
$where
[
'a.create_time'
]
=
[
'between time'
,
[
$this
->
params
[
'start_time'
]
.
' 00:00:00'
,
$this
->
params
[
'end_time'
]
.
' 23:59:59'
]
];
}
if
(
!
empty
(
$this
->
params
[
'title'
]))
{
$where
[
'a.title'
]
=
[
'LIKE'
,
'%'
.
$this
->
params
[
'title'
]
.
'%'
];
}
if
(
!
empty
(
$this
->
params
[
'label_id'
]))
{
$where
[
'a.s_label_id'
]
=
$this
->
params
[
'label_id'
];
}
$field
=
'a.id,a.title,a.content,a.create_time,b.name,c.label_name'
;
$where
[
'a.status'
]
=
0
;
$data
[
'list'
]
=
$this
->
m_news
->
getListAgent
(
$pageNo
,
$pageSize
,
'id DESC'
,
$field
,
$where
);
$data
[
'total'
]
=
$this
->
m_news
->
getListAgentTotal
(
$where
);
return
$this
->
response
(
200
,
""
,
$data
);
}
/**
* 新增文章
*
* @return \think\Response
*/
public
function
addNews
()
{
if
(
empty
(
$this
->
params
[
'title'
]))
{
return
$this
->
response
(
101
,
'标题为空!'
);
}
if
(
empty
(
$this
->
params
[
'content'
]))
{
return
$this
->
response
(
101
,
'内容为空!'
);
}
if
(
empty
(
$_FILES
[
'file_img'
]))
{
return
$this
->
response
(
101
,
'封面图片为空'
);
}
$upload
=
new
UploadFileService
();
$result
=
$upload
->
upload
(
$_FILES
[
'file_img'
],
'business_school'
);
$data
[
'title'
]
=
trim
(
$this
->
params
[
'title'
]);
$data
[
'content'
]
=
trim
(
$this
->
params
[
'content'
]);
$data
[
'publisher_id'
]
=
$this
->
userId
;
$data
[
'cover_plan'
]
=
$result
[
'msg'
][
'img_path'
];
$num
=
$this
->
m_news
->
editData
(
$data
,
$this
->
params
[
'id'
]);
if
(
$num
<
1
)
{
return
$this
->
response
(
101
,
'新增失败!'
);
}
return
$this
->
response
(
200
,
'新增成功!'
);
}
/**
* 商学院资讯详情
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getNewsInfo
()
{
if
(
empty
(
$this
->
params
[
'id'
]))
{
return
$this
->
response
(
101
,
"Id is null."
);
}
$data
=
$this
->
m_news
->
getNewsInfo
(
'id,title,s_label_id,cover_plan,content'
);
return
$this
->
response
(
200
,
""
,
$data
);
}
/**
* 删除状态
*
* @return \think\Response
*/
public
function
delNews
()
{
if
(
empty
(
$this
->
params
[
'id'
]))
{
return
$this
->
response
(
101
,
"Id is null."
);
}
$num
=
$this
->
m_push
->
editData
([
'status'
=>
1
],
$this
->
params
[
'id'
]);
if
(
$num
>
0
)
{
return
$this
->
response
(
200
);
}
else
{
return
$this
->
response
(
101
,
"删除失败!"
);
}
}
/**
* 商学院标签
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getNewsLabel
()
{
$label
=
new
SLabel
();
$data
=
$label
->
getList
(
1
,
200
,
''
,
'id,label_name'
,
[
'status'
=>
0
]);
return
$this
->
response
(
200
,
''
,
$data
);
}
}
\ No newline at end of file
application/index/view/news/index.html
0 → 100644
View file @
b857f5d7
{layout name="global/frame_tpl" /}
商学院
\ No newline at end of file
application/model/SLabel.php
0 → 100644
View file @
b857f5d7
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/7/3
* Time: 14:51
*/
namespace
app\model
;
class
SLabel
extends
BaseModel
{
}
\ No newline at end of file
application/model/SNews.php
0 → 100644
View file @
b857f5d7
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/7/3
* Time: 14:21
*/
namespace
app\model
;
class
SNews
extends
BaseModel
{
/**
* 商学院列表
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getListAgent
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.publisher_id = b.id'
,
'left'
)
->
join
(
's_label c'
,
'a.s_label_id = c.id'
,
'left'
)
->
where
(
$params
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
}
/**
* 商学院列表总数
*
* @param $params
* @return int|string
*/
public
function
getListAgentTotal
(
$params
)
{
return
$this
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.publisher_id = b.id'
,
'left'
)
->
where
(
$params
)
->
count
();
}
/**
* 商学院资讯详情
*
* @param string $field
* @param string $params
* @param string $order
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getNewsInfo
(
$field
=
''
,
$params
=
''
,
$order
=
'id ASC'
)
{
return
$this
->
field
(
$field
)
->
where
(
$params
)
->
order
(
$order
)
->
find
();
}
}
\ No newline at end of file
application/route.php
View file @
b857f5d7
...
...
@@ -246,6 +246,10 @@ Route::group('index', [
'evaluationList'
=>
[
'index/Evaluation/evaluationList'
,
[
'method'
=>
'POST|GET'
]
],
//评价列表 朱伟 2018-06-13
'marchInList'
=>
[
'index/MarchIn/marchInList'
,
[
'method'
=>
'POST|GET'
]
],
//进场记录列表 朱伟 2018-06-13
'superviseList'
=>
[
'index/Supervise/superviseList'
,
[
'method'
=>
'POST|GET'
]
],
//监督执行列表 朱伟 2018-06-14
'business_school'
=>
[
'index/news/index'
,
[
'method'
=>
'GET'
]
],
//商学院资讯列表
'addNews'
=>
[
'index/news/addNews'
,
[
'method'
=>
'POST'
]
],
//新增商学院资讯
'getNewsInfo'
=>
[
'index/news/getNewsInfo'
,
[
'method'
=>
'GET'
]
],
//商学院资讯详情
'getNewsLabel'
=>
[
'index/news/getNewsLabel'
,
[
'method'
=>
'GET'
]
],
//商学院资标签
]);
...
...
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