Commit 364b4557 authored by zhuwei's avatar zhuwei

1

parent 4f4e403d
......@@ -31,9 +31,9 @@ class AccountBalanceService{
}
//todo 获取用户账户明细
public function getBalanceList($pageNo,$pageSize,$params){
$field = '';
$this->m_account_balance->getBalanceList($pageNo,$pageSize,$field,$params);
public function getBalanceList($params){
$res = $this->m_account_balance->getBalanceList($params);
return $res;
}
//todo 后台账户明细表
......
......@@ -19,38 +19,8 @@ class UserAccountBalance extends Basic{
public function userAccountBalanceList()
{
$params = $this->params;
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 10 : $params['pageSize'];
if (!empty($params['start_date']) && !empty($params['end_date'])) {
$where['a.call_time'] = [ 'between', [ $this->params['start_date'] . ' 00:00:00', $this->params['end_date'] . ' 23:59:59' ] ];
}
if (!empty($this->params['user_id'])) {
$where['a.user_id'] = $this->params['user_id'];
}
if (!empty($this->params['user_phone'])) {
$where['a.user_id'] = $this->params['user_id'];
}
if (!empty($this->params['user_name'])) {
$where['a.user_id'] = $this->params['user_id'];
}
$this->s_account_balance->getBalanceList($pageNo,$pageSize,$params);
return $this->response("200", "success!", $result["data"]);
$result["list"] = $this->s_account_balance->getBalanceList($params);
return $this->response("200", "success!", $result);
}
......
......@@ -11,9 +11,12 @@ class UAccountBalance extends Model
protected $table = 'u_account_balance';
public function getBalanceList($pageNo,$pageSize,$field,$params)
public function getBalanceList($params)
{
$pageNo = empty($params['pageNo']) ? 0 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 10 : $params['pageSize'];
if (!empty($params['create_time_start']) && !empty($params['create_time_end'])) {
$conditions[] = "aaa.create_time BETWEEN '".$params['create_time_start']. " 00:00:00' AND '" .$params['create_time_end'] . " 23:59:59'";
}
......@@ -32,17 +35,19 @@ class UAccountBalance extends Model
$where_params = 'WHERE ' . implode(" AND ", $conditions);
}
$sql = "SELECT * FROM
(
(SELECT $field FROM `u_account_balance` `a` WHERE `a`.`status` = 0)
UNION
(SELECT $field FROM `u_account_check` `a` WHERE `a`.`status` = 0)
) as aaa
$where_params ORDER BY `create_time` DESC limit $pageNo,$pageSize";
$result = $this->db->query($sql);
$sql = "SELECT
*
FROM
(
( SELECT id, user_id,source_id, money, create_time, 1 AS aa FROM `u_account_balance` `a` WHERE `a`.`status` = 0 ) UNION
( SELECT id, user_id,0 as source_id ,money, create_time, 2 AS aa FROM `u_account_check` `a` WHERE `a`.`status` IN ( 0, 1, 2 ) )
) AS aaa $where_params
ORDER BY
`create_time` DESC
LIMIT {$pageNo},
{$pageSize}";
$result = $this->query($sql);
// echo $this->getLastSql();
return $result;
}
......
......@@ -428,6 +428,9 @@ Route::group('index', [
'saveActivity' => ['index/Activity/saveActivity', ['method' => 'POST|GET']],//新增或修改活动
'getActivityList' => ['index/Activity/getActivityList', ['method' => 'POST|GET']],//获取活动
'couponList' => ['index/Coupon/couponList', ['method' => 'GET']],//获取活动
'userAccountBalanceList' => ['index/UserAccountBalance/userAccountBalanceList', ['method' => 'get|post']],//
]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment