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
825d21a5
Commit
825d21a5
authored
Sep 10, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公告
parent
85e94731
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
7 deletions
+51
-7
Notice.php
application/index/controller/Notice.php
+17
-2
PushFeed.php
application/model/PushFeed.php
+34
-5
No files found.
application/index/controller/Notice.php
View file @
825d21a5
...
...
@@ -12,6 +12,7 @@ namespace app\index\controller;
use
app\api_broker\service\PushMessageService
;
use
app\index\extend\Basic
;
use
app\model\PushFeed
;
use
app\model\SFile
;
use
think\Request
;
class
Notice
extends
Basic
...
...
@@ -90,8 +91,22 @@ class Notice extends Basic
$data
[
'steel_phone'
]
=
0
;
$data
[
'type'
]
=
1
;
$data
[
'annex_file_name'
]
=
$this
->
params
[
'annex_file_name'
];
$num
=
$this
->
m_push
->
editData
(
$data
);
if
(
$num
<
1
)
{
$id
=
$this
->
m_push
->
addData
(
$data
);
if
(
$id
<
1
)
{
if
(
$this
->
params
[
'annex_file_name'
])
{
$s_file
=
new
SFile
();
$annex_file_name
=
explode
(
','
,
$this
->
params
[
'annex_file_name'
]);
foreach
(
$annex_file_name
as
$k
=>
$v
)
{
$file_data
[
'file_name'
]
=
$v
;
$file_data
[
'new_id'
]
=
$id
;
$file_data
[
'type'
]
=
2
;
$file_data
[
'status'
]
=
0
;
$s_file
->
insertData
(
$file_data
);
}
}
return
$this
->
response
(
101
,
'新增公告失败!'
);
}
...
...
application/model/PushFeed.php
View file @
825d21a5
...
...
@@ -21,9 +21,10 @@ class PushFeed extends BaseModel
* @return int|true
* @throws \think\Exception
*/
public
function
editNum
(
$id
,
$field
,
$way
=
1
,
$step
=
1
)
{
public
function
editNum
(
$id
,
$field
,
$way
=
1
,
$step
=
1
)
{
$this
->
where
(
'id'
,
$id
);
$this
->
where
(
'id'
,
$id
);
if
(
$way
==
1
)
{
$result
=
$this
->
setInc
(
$field
,
$step
);
}
else
{
...
...
@@ -43,7 +44,8 @@ class PushFeed extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getFeedInfo
(
$field
=
''
,
$params
=
''
,
$order
=
'id ASC'
)
{
public
function
getFeedInfo
(
$field
=
''
,
$params
=
''
,
$order
=
'id ASC'
)
{
return
$this
->
field
(
$field
)
->
where
(
$params
)
->
order
(
$order
)
...
...
@@ -61,7 +63,8 @@ class PushFeed extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getListAgent
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
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'
)
...
...
@@ -76,10 +79,35 @@ class PushFeed extends BaseModel
* @param $params
* @return int|string
*/
public
function
getListAgentTotal
(
$params
)
{
public
function
getListAgentTotal
(
$params
)
{
return
$this
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.publisher_id = b.id'
,
'left'
)
->
where
(
$params
)
->
count
();
}
/**
* @param $data
* @param bool $kv
* @param string $key
* @param bool $confirm
* @return PushFeed|int|string
*/
public
function
addData
(
$data
,
$kv
=
false
,
$key
=
'id'
,
$confirm
=
false
)
{
$this
->
allowField
(
true
);
if
(
$confirm
)
{
//是否验证
$this
->
validate
(
$confirm
);
}
if
(
$kv
)
{
//编辑
$res
=
$this
->
where
(
"
$key
"
,
$kv
)
->
update
(
$data
);
}
else
{
$res
=
$this
->
insertGetId
(
$data
);
}
return
$res
;
}
}
\ 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