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
dfc8dbda
Commit
dfc8dbda
authored
Jan 30, 2018
by
hujun
Committed by
hujun
Jan 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
盘方操作记录
parent
045fd975
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
37 deletions
+53
-37
Houses.php
application/index/controller/Houses.php
+0
-1
Basic.php
application/index/extend/Basic.php
+3
-30
GHousesToAgents.php
application/model/GHousesToAgents.php
+39
-1
GOperatingRecords.php
application/model/GOperatingRecords.php
+11
-5
No files found.
application/index/controller/Houses.php
View file @
dfc8dbda
...
@@ -12,7 +12,6 @@ namespace app\index\controller;
...
@@ -12,7 +12,6 @@ namespace app\index\controller;
use
app\index\extend\Basic
;
use
app\index\extend\Basic
;
use
app\model\AAgents
;
use
app\model\AAgents
;
use
app\model\GHouses
;
use
app\model\GHouses
;
use
think\Db
;
use
think\Request
;
use
think\Request
;
...
...
application/index/extend/Basic.php
View file @
dfc8dbda
...
@@ -9,6 +9,7 @@ namespace app\index\extend;
...
@@ -9,6 +9,7 @@ namespace app\index\extend;
* Time: 9:35
* Time: 9:35
* 基类
* 基类
*/
*/
use
app\model\GOperatingRecords
;
use
think\Controller
;
use
think\Controller
;
use
think\Request
;
use
think\Request
;
use
think\Response
;
use
think\Response
;
...
@@ -219,16 +220,6 @@ class Basic extends Controller
...
@@ -219,16 +220,6 @@ class Basic extends Controller
}
}
}
}
/**
* 记录操作
*
* @param int $agents_id
* @param array $data
* @param string $type
* @param string $remark
* @return bool
*/
/**
/**
* 记录操作
* 记录操作
*
*
...
@@ -238,26 +229,8 @@ class Basic extends Controller
...
@@ -238,26 +229,8 @@ class Basic extends Controller
* @return bool|int|string
* @return bool|int|string
*/
*/
public
function
operating_records
(
$agents_id
=
0
,
$type
=
''
,
$remark
=
''
)
{
public
function
operating_records
(
$agents_id
=
0
,
$type
=
''
,
$remark
=
''
)
{
$result
=
false
;
$records
=
new
GOperatingRecords
();
$agents_id
=
Session
::
get
(
'userId'
)
?
Session
::
get
(
'userId'
)
:
$agents_id
;
$result
=
$records
->
record
(
$agents_id
,
$type
,
$remark
);
if
(
$agents_id
>
0
)
{
$name
=
Session
::
get
(
'userName'
);
if
(
$name
)
{
$name
=
Db
::
table
(
'a_agents'
)
->
where
(
'id'
,
$agents_id
)
->
value
(
'name'
);
}
$data
=
[
'agents_id'
=>
$agents_id
,
'name'
=>
$name
,
'url'
=>
$this
->
request
->
url
(),
'ip'
=>
$this
->
request
->
ip
(),
'remark'
=>
$remark
,
'type'
=>
$type
,
'create_time'
=>
date
(
'Y-m-d H:i:s'
)
];
$result
=
Db
::
table
(
'g_operating_records'
)
->
insert
(
$data
);
}
return
$result
;
return
$result
;
}
}
...
...
application/model/GHousesToAgents.php
View file @
dfc8dbda
...
@@ -32,18 +32,33 @@ class GHousesToAgents extends BaseModel
...
@@ -32,18 +32,33 @@ class GHousesToAgents extends BaseModel
$where
[
'type'
]
=
$type
;
$where
[
'type'
]
=
$type
;
$where
[
'houses_id'
]
=
$houses_id
;
$where
[
'houses_id'
]
=
$houses_id
;
$where
[
'is_del'
]
=
0
;
$where
[
'is_del'
]
=
0
;
$records
=
new
GOperatingRecords
();
$agents
=
new
AAgents
();
//为空全部伪删除
//为空全部伪删除
if
(
empty
(
$agents_id
[
0
]))
{
if
(
empty
(
$agents_id
[
0
]))
{
if
(
$type
==
2
)
{
$house_agents
=
$this
->
field
(
'agents_id'
)
->
where
(
'houses_id'
,
$houses_id
)
->
where
(
'is_del'
,
0
)
->
select
();
$name
=
array
();
foreach
(
$house_agents
as
$k2
=>
$v2
){
$name
[]
=
$agents
->
where
(
'id'
,
$v2
[
'agents_id'
])
->
value
(
'name'
);
}
$records
->
record
(
''
,
2
,
'删除盘方'
.
implode
(
','
,
$name
),
$houses_id
);
}
$res
=
$this
->
where
(
$where
)
->
setField
(
'is_del'
,
1
);
$res
=
$this
->
where
(
$where
)
->
setField
(
'is_del'
,
1
);
}
else
{
}
else
{
$houses_data
=
$this
->
where
(
$where
)
->
select
();
$houses_data
=
$this
->
where
(
$where
)
->
select
();
$key
=
0
;
$key
=
0
;
foreach
(
$houses_data
as
$k
=>
$v
)
{
foreach
(
$houses_data
as
$k
=>
$v
)
{
if
(
!
in_array
(
$v
[
'agents_id'
],
$agents_id
)
&&
$type
==
$v
[
'type'
]
)
{
if
(
!
in_array
(
$v
[
'agents_id'
],
$agents_id
)
&&
(
$type
==
$v
[
'type'
])
&&
(
$v
[
'agents_id'
]
!=
NULL
)
)
{
$agent_arr
[
$key
][
'id'
]
=
$v
[
'id'
];
$agent_arr
[
$key
][
'id'
]
=
$v
[
'id'
];
$agent_arr
[
$key
][
'is_del'
]
=
1
;
$agent_arr
[
$key
][
'is_del'
]
=
1
;
$agent_arr
[
$key
][
'update_time'
]
=
$date
;
$agent_arr
[
$key
][
'update_time'
]
=
$date
;
$key
++
;
$key
++
;
if
(
$type
==
2
)
{
$del_agents_id
[]
=
$v
[
'agents_id'
];
}
}
}
}
}
...
@@ -63,7 +78,30 @@ class GHousesToAgents extends BaseModel
...
@@ -63,7 +78,30 @@ class GHousesToAgents extends BaseModel
$agent_arr
[
$key
][
'create_time'
]
=
$this
->
date
;
$agent_arr
[
$key
][
'create_time'
]
=
$this
->
date
;
$agent_arr
[
$key
][
'update_time'
]
=
$this
->
date
;
$agent_arr
[
$key
][
'update_time'
]
=
$this
->
date
;
$key
++
;
$key
++
;
if
(
$type
==
2
)
{
$record_agents_id
[]
=
$v
;
}
}
if
(
count
(
$del_agents_id
)
>
0
)
{
$name
=
array
();
foreach
(
$del_agents_id
as
$k2
=>
$v2
){
$name
[]
=
$agents
->
where
(
'id'
,
$v2
)
->
value
(
'name'
);
}
$records
->
record
(
''
,
2
,
'删除盘方:'
.
implode
(
','
,
$name
),
$houses_id
);
}
}
if
(
count
(
$record_agents_id
)
>
0
)
{
$records
=
new
GOperatingRecords
();
$name
=
array
();
foreach
(
$record_agents_id
as
$k2
=>
$v2
){
$name
[]
=
$agents
->
where
(
'id'
,
$v2
)
->
value
(
'name'
);
}
$records
->
record
(
''
,
2
,
'新增盘方:'
.
implode
(
','
,
$name
),
$houses_id
);
}
$res
=
$this
->
saveAll
(
$agent_arr
);
$res
=
$this
->
saveAll
(
$agent_arr
);
}
}
...
...
application/model/GOperatingRecords.php
View file @
dfc8dbda
...
@@ -10,33 +10,39 @@ namespace app\model;
...
@@ -10,33 +10,39 @@ namespace app\model;
use
think\Request
;
use
think\Request
;
use
think\Session
;
class
GOperatingRecords
extends
BaseModel
class
GOperatingRecords
extends
BaseModel
{
{
/**
/**
* 行为日志记录
* 行为日志记录
*
*
* @param int $agents_id
* @param int $agents_id
* @param array $data
* @param string $type
* @param string $type
* @param string $remark
* @param string $remark
* @param $houses_id
* @return bool|false|int
* @return bool|false|int
*/
*/
public
function
record
(
$agents_id
=
0
,
$
data
=
[],
$type
=
''
,
$remark
=
''
)
public
function
record
(
$agents_id
=
0
,
$
type
=
''
,
$remark
=
''
,
$houses_id
=
''
)
{
{
$result
=
false
;
$result
=
false
;
$agents_id
=
$agents_id
?
$agents_id
:
Session
::
get
(
'userId'
);
if
(
$agents_id
>
0
)
{
if
(
$agents_id
>
0
)
{
$request
=
Request
::
instance
();
$request
=
Request
::
instance
();
$name
=
db
(
'a_agents'
)
->
where
(
'id'
,
$agents_id
)
->
value
(
'username'
);
$name
=
Session
::
get
(
'userName'
);
if
(
$name
)
{
$name
=
db
(
'a_agents'
)
->
where
(
'id'
,
$agents_id
)
->
value
(
'name'
);
}
$data
=
[
$data
=
[
'agents_id'
=>
$agents_id
,
'agents_id'
=>
$agents_id
,
'name'
=>
$name
,
'name'
=>
$name
,
'request_method'
=>
$request
->
method
(),
'url'
=>
$request
->
url
(),
'url'
=>
$request
->
url
(),
'data'
=>
$data
,
'ip'
=>
$request
->
ip
(),
'ip'
=>
$request
->
ip
(),
'remark'
=>
$remark
,
'remark'
=>
$remark
,
'houses_id'
=>
$houses_id
,
'type'
=>
$type
,
'type'
=>
$type
,
'create_time'
=>
date
(
'Y-m-d H:i:s'
),
];
];
$result
=
$this
->
isUpdate
(
false
)
->
data
(
$data
)
->
save
();
$result
=
$this
->
isUpdate
(
false
)
->
data
(
$data
)
->
save
();
}
}
...
...
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