修复错误
This commit is contained in:
parent
317e9bf8bf
commit
60fc4f00b9
@ -38,11 +38,18 @@ class AccountLogController extends BaseApiController
|
|||||||
//个人月份统计
|
//个人月份统计
|
||||||
public function year_count()
|
public function year_count()
|
||||||
{
|
{
|
||||||
|
$params=$this->request->param();
|
||||||
$data = [['month' => date('Y') . '-01'], ['month' => date('Y') . '-02'], ['month' => date('Y') . '-03'], ['month' => date('Y') . '-04'], ['month' => date('Y') . '-05'], ['month' => date('Y') . '-06'], ['month' => date('Y') . '-07'], ['month' => date('Y') . '-08'], ['month' => date('Y') . '-09'], ['month' => date('Y') . '-10'], ['month' => date('Y') . '-11'], ['month' => date('Y') . '-12']];
|
$data = [['month' => date('Y') . '-01'], ['month' => date('Y') . '-02'], ['month' => date('Y') . '-03'], ['month' => date('Y') . '-04'], ['month' => date('Y') . '-05'], ['month' => date('Y') . '-06'], ['month' => date('Y') . '-07'], ['month' => date('Y') . '-08'], ['month' => date('Y') . '-09'], ['month' => date('Y') . '-10'], ['month' => date('Y') . '-11'], ['month' => date('Y') . '-12']];
|
||||||
$year = date('Y');
|
$year = date('Y');
|
||||||
|
if(isset($params['user_id']) && $params['user_id'] > 0){
|
||||||
|
$where[] =['user_id','=', $params['user_id']];
|
||||||
|
}else{
|
||||||
|
$where[] = ['user_id', '=', $this->userId];
|
||||||
|
}
|
||||||
$change_amount_1 = Db::name('user_account_log')
|
$change_amount_1 = Db::name('user_account_log')
|
||||||
->whereYear('create_time', $year)
|
->whereYear('create_time', $year)
|
||||||
->where('action', 1)
|
->where('action', 1)
|
||||||
|
->where($where)
|
||||||
->field('DATE_FORMAT(FROM_UNIXTIME(create_time), "%Y-%m") as month, SUM(change_amount) as total')
|
->field('DATE_FORMAT(FROM_UNIXTIME(create_time), "%Y-%m") as month, SUM(change_amount) as total')
|
||||||
->group('month')
|
->group('month')
|
||||||
->order('month')
|
->order('month')
|
||||||
@ -50,6 +57,8 @@ class AccountLogController extends BaseApiController
|
|||||||
$change_amount_2 = Db::name('user_account_log')
|
$change_amount_2 = Db::name('user_account_log')
|
||||||
->whereYear('create_time', $year)
|
->whereYear('create_time', $year)
|
||||||
->where('action', 2)
|
->where('action', 2)
|
||||||
|
->where($where)
|
||||||
|
|
||||||
->field('DATE_FORMAT(FROM_UNIXTIME(create_time), "%Y-%m") as month, SUM(change_amount) as total')
|
->field('DATE_FORMAT(FROM_UNIXTIME(create_time), "%Y-%m") as month, SUM(change_amount) as total')
|
||||||
->group('month')
|
->group('month')
|
||||||
->order('month')
|
->order('month')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user