维护用户排序时间搜索

This commit is contained in:
wanyongkang
2020-11-24 14:57:04 +08:00
parent eb5c3c482f
commit 30c93507ff
2 changed files with 32 additions and 20 deletions

View File

@@ -5,7 +5,7 @@
* @Author: kangkang
* @Date: 2020-10-13 19:52:37
* @LastEditors: Please set LastEditors
* @LastEditTime: 2020-11-23 15:47:36
* @LastEditTime: 2020-11-24 14:55:57
*/
namespace app\manager\controller;
@@ -17,6 +17,7 @@ use app\manager\model\ProductOrder;
use app\manager\model\User;
use app\manager\model\UserScore;
use enum\account\ProductAccount as ProductAccountEnum;
use enum\order\ProductOrder as ProductOrderEnum;
use enum\order\UserScore as UserScoreEnum;
use enum\user\User as UserEnum;
use fastphp\base\Controller;
@@ -77,15 +78,16 @@ class UserFollow extends Controller
$date3 = date("Y-m-01", time());
$date4 = date("Y-m-d H:i:s", time());
if (!empty($search['last_month']['s_time'])) {
$date1 = $search['last_month']['s_time'];
$date2 = $search['last_month']['e_time'];
$date1 = date('Y-m-d',strtotime($search['last_month']['s_time']));
$date2 = date('Y-m-d 23:59:59',strtotime($search['last_month']['e_time']));
$is_screen = true;
} elseif (!empty($search['new_month']['s_time'])) {
$date3 = $search['new_month']['s_time'];
$date4 = $search['new_month']['e_time'];
$date3 = date('Y-m-d',strtotime($search['new_month']['s_time']));
$date4 = date('Y-m-d 23:59:59',strtotime($search['new_month']['e_time']));
$is_screen = true;
}
//上月
$time_where1 .= " UpdateTime>='" . $date1 . "' and UpdateTime<='" . $date2 . "' ";
//本月
@@ -155,7 +157,7 @@ class UserFollow extends Controller
foreach ($user_list as $info) {
$info['last_pay_time'] = '无消费';
$pay_time = $user_score_model->getNewOne('UpdateTime', ['UserId' => $info['Id'], 'ScoreType' => $user_score_enum::$Pay]);
$pay_time = $product_order_model->getNewOne('UpdateTime', ['UserId' => $info['Id'], 'ScoreType' => ProductOrderEnum::$PayComplete]);
if ($pay_time) {
$info['last_pay_time'] = $pay_time['UpdateTime'];
}
@@ -213,9 +215,14 @@ class UserFollow extends Controller
array_multisort($field, $sort, $list);
}
$data_count = 0;
if (empty($search['sortLable'])) {
$data_count = $user_model->getCount($where)['count'];
}
$data = [
'list' => array_merge($list),
'count' => $user_model->getCount($where)['count'],
'count' => $data_count,
'types' => $user_enum->getFormatList($user_enum::$FollowStatus),
];
\result($data);