消费统计界面基础表格和搜索

This commit is contained in:
wanyongkang
2020-11-20 16:02:54 +08:00
parent deb09ebb2f
commit 1b9e56b24a
8 changed files with 670 additions and 26 deletions

View File

@@ -0,0 +1,49 @@
<?php
/*
* @Descripttion:
* @version:
* @Author: kangkang
* @Date: 2020-10-16 14:44:02
* @LastEditors: kangkang
* @LastEditTime: 2020-11-18 19:34:22
*/
namespace app\manager\model;
use fastphp\base\Model;
class UserScore extends Model
{
protected $table = 'user_score';
/**
* @description: 获取用户所有的消费记录
* @param {*}
* @return {*}
*/
public function getUserCost($user_id, $index)
{
$where = [];
$wheres = [];
switch($index){
case 2:
$last_month = date("Y-m-01 H:i:s", strtotime("-1 month"));
$new_month = date("Y-m-t H:i:s", strtotime("-1 month"));
$where['UpdateTime'] = ['<',$new_month];
$wheres['UpdateTime'] = ['>',$last_month];
break;
case 3:
$last_month = date("Y-m-01 H:i:s", time());
$new_month = date("Y-m-d H:i:s", time());
$where['UpdateTime'] = ['<',$new_month];
$wheres['UpdateTime'] = ['>',$last_month];
break;
}
return $this->field('ScoreTypeName,ScoreValue,RestAmount1,RestAmount2,UpdateTime')
->where(['UserId' => $user_id])
->where($where)
->where($wheres)
->order('Id desc')
->fetchAll();
}
}