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
126ec313
Commit
126ec313
authored
Mar 14, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台收入列表
parent
ca3d4063
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
31 deletions
+111
-31
AccountBalanceService.php
application/api/service/AccountBalanceService.php
+8
-0
AccountBalance.php
application/index/controller/AccountBalance.php
+11
-3
UAccountBalance.php
application/model/UAccountBalance.php
+45
-28
UAccountCheck.php
application/model/UAccountCheck.php
+47
-0
No files found.
application/api/service/AccountBalanceService.php
View file @
126ec313
...
...
@@ -2,6 +2,7 @@
namespace
app\api\service
;
use
app\model\UAccountBalance
;
use
app\model\UAccountCheck
;
use
app\model\Users
;
...
...
@@ -56,6 +57,13 @@ class AccountBalanceService{
return
$res
;
}
public
function
getBalanceCount
(
$params
){
$balanceCount
=
$this
->
m_account_balance
->
getBalanceCount
(
$params
);
$accountCheckModel
=
new
UAccountCheck
();
$checkCount
=
$accountCheckModel
->
getCheckCount
(
$params
);
return
$balanceCount
+
$checkCount
;
}
/**
* 获取客户信息
...
...
application/index/controller/AccountBalance.php
View file @
126ec313
...
...
@@ -16,16 +16,24 @@ class AccountBalance extends Basic{
}
/**
* @return \think\Response
*/
public
function
userAccountBalanceList
()
{
$params
=
$this
->
params
;
$params
=
array
(
/*
$params = array(
"create_time_start" => '2019-03-14 11:03:10',
"create_time_end" => '2019-03-15 11:03:10',
"user_phone" => '6471',
"user_id" => '111',
);
$result
[
"list"
]
=
$this
->
s_account_balance
->
getBalanceList
(
$params
);
);*/
$data
=
$this
->
s_account_balance
->
getBalanceList
(
$params
);
if
(
count
(
$data
)
<=
0
){
return
$this
->
response
(
"200"
,
"null"
);
}
$result
[
"list"
]
=
$data
;
$result
[
"total"
]
=
$this
->
s_account_balance
->
getBalanceCount
(
$params
);
return
$this
->
response
(
"200"
,
"success!"
,
$result
);
}
...
...
application/model/UAccountBalance.php
View file @
126ec313
...
...
@@ -9,12 +9,20 @@ class UAccountBalance extends Model
{
// 设置当前模型对应的完整数据表名称
protected
$table
=
'u_account_balance'
;
private
$db_
;
public
function
addBalance
(
$data
)
{
$time
=
date
(
"Y-m-d H:i:s"
,
time
());
public
function
__construct
(
$data
=
[])
{
$this
->
db_
=
Db
::
table
(
$this
->
table
);
parent
::
__construct
(
$data
);
}
public
function
addBalance
(
$data
)
{
$time
=
date
(
"Y-m-d H:i:s"
,
time
());
$data
[
'create_time'
]
=
$time
;
$data
[
'update_time'
]
=
$time
;
$data
[
"status"
]
=
0
;
$data
[
"status"
]
=
0
;
return
$this
->
insert
(
$data
);
}
...
...
@@ -22,40 +30,49 @@ class UAccountBalance extends Model
public
function
getBalanceList
(
$params
)
{
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
0
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
0
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$where_str
=
""
;
if
(
!
empty
(
$params
[
'create_time_start'
])
&&
!
empty
(
$params
[
'create_time_end'
]))
{
$where_str
.=
" and create_time BETWEEN '"
.
$params
[
'create_time_start'
]
.
" 00:00:00' AND '"
.
$params
[
'create_time_end'
]
.
" 23:59:59'"
;
$where_str
.=
" and create_time BETWEEN '"
.
$params
[
'create_time_start'
]
.
" 00:00:00' AND '"
.
$params
[
'create_time_end'
]
.
" 23:59:59'"
;
}
if
(
!
empty
(
$params
[
'user_phone'
]))
{
$where_str
.=
" and user_phone LIKE '%"
.
$params
[
'user_phone'
]
.
"%'"
;
$where_str
.=
" and user_phone LIKE '%"
.
$params
[
'user_phone'
]
.
"%'"
;
}
if
(
!
empty
(
$params
[
'user_id'
]))
{
$where_str
.=
" and user_id =
{
$params
[
'user_
phone'
]
}
"
;
$where_str
.=
" and user_id =
{
$params
[
'user_
id'
]
}
"
;
}
$sql
=
"SELECT
*
FROM
(
( SELECT id, user_id,source_id , money, user_name,create_time, 1 AS is_essay FROM `u_account_balance` WHERE `status` = 0
$where_str
) UNION
$sql
=
"SELECT * FROM (
( SELECT id, user_id,source_id, money, user_name,create_time, 1 AS is_essay FROM `u_account_balance` WHERE `status` = 0
$where_str
) UNION
( SELECT id, user_id,0 as source_id ,money, user_name,create_time, 2 AS is_essay FROM `u_account_check` WHERE `status` IN ( 0, 1, 2 )
$where_str
)
) AS aaa
ORDER BY
`create_time` DESC
LIMIT
{
$pageNo
}
,
{
$pageSize
}
"
;
) AS aaa ORDER BY `create_time` DESC LIMIT
{
$pageNo
}
,
{
$pageSize
}
"
;
$result
=
$this
->
query
(
$sql
);
echo
$this
->
getLastSql
();
//echo $this->getLastSql();
return
$result
;
}
/**
* @param $params
* @return int|string
*/
public
function
getBalanceCount
(
$params
)
{
$where_arr
=
[];
if
(
!
empty
(
$params
[
'create_time_start'
])
&&
!
empty
(
$params
[
'create_time_end'
])){
$where_arr
[
'create_time'
]
=
array
(
'between'
,
array
(
$params
[
'create_time_start'
],
$params
[
'create_time_end'
]));
}
if
(
!
empty
(
$params
[
'user_phone'
])
){
$where_arr
[
'user_phone'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'user_phone'
])
.
"%"
);
}
if
(
!
empty
(
$params
[
'user_id'
]))
{
$where_arr
[
'user_id'
]
=
$params
[
'user_id'
];
}
$where_arr
[
'status'
]
=
0
;
$result
=
$this
->
db_
->
field
(
"id"
)
->
where
(
$where_arr
)
->
count
();
return
$result
;
}
...
...
application/model/UAccountCheck.php
0 → 100644
View file @
126ec313
<?php
namespace
app\model
;
use
think\Db
;
use
think\Model
;
/**
* Created by PhpStorm.
* User: fuju
* Date: 2019/3/14
* Time: 14:13
*/
class
UAccountCheck
extends
Model
{
// 设置当前模型对应的完整数据表名称
protected
$table
=
'u_account_check'
;
private
$db_
;
public
function
__construct
(
$data
=
[])
{
$this
->
db_
=
Db
::
table
(
$this
->
table
);
parent
::
__construct
(
$data
);
}
/**
* @param $params
* @return int|string
*/
public
function
getCheckCount
(
$params
)
{
$where_arr
=
[];
if
(
!
empty
(
$params
[
'create_time_start'
])
&&
!
empty
(
$params
[
'create_time_end'
])){
$where_arr
[
'create_time'
]
=
array
(
'between'
,
array
(
$params
[
'create_time_start'
],
$params
[
'create_time_end'
]));
}
if
(
!
empty
(
$params
[
'user_phone'
])
){
$where_arr
[
'user_phone'
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'user_phone'
])
.
"%"
);
}
if
(
!
empty
(
$params
[
'user_id'
]))
{
$where_arr
[
'user_id'
]
=
$params
[
'user_id'
];
}
$where_arr
[
'status'
]
=
array
(
"in"
,
"0,1,2"
);;
$result
=
$this
->
db_
->
field
(
"id"
)
->
where
(
$where_arr
)
->
count
();
return
$result
;
}
}
\ 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