维护用户排序
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* @Author: kangkang
|
||||
* @Date: 2020-10-16 14:44:02
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2020-11-22 10:31:50
|
||||
* @LastEditTime: 2020-11-24 15:53:12
|
||||
*/
|
||||
|
||||
namespace app\manager\model;
|
||||
@@ -172,25 +172,17 @@ class ProductOrder extends Model
|
||||
* @param {*} flag = true 上一个月
|
||||
* @return {*} flag = false 本月
|
||||
*/
|
||||
public function getMonthSort($where = [],$order = 1, $limit = '50', $flag = true)
|
||||
public function getMonthSort($where = [],$order = 1, $limit = '50', $where2 ='')
|
||||
{
|
||||
$order_type = 'money';
|
||||
if($order == '0'){
|
||||
$order_type = 'money desc';
|
||||
}
|
||||
if ($flag) {
|
||||
$last_month = date("Y-m-01 H:i:s", strtotime("-1 month"));
|
||||
$new_month = date("Y-m-t H:i:s", strtotime("-1 month"));
|
||||
} else {
|
||||
$last_month = date("Y-m-01 H:i:s", time());
|
||||
$new_month = date("Y-m-d H:i:s", time());
|
||||
}
|
||||
return $this->field('product_order.UserId,sum(product_order.PaymentAmount) as money')
|
||||
->join('user ON product_order.UserId=user.Id')
|
||||
->where(['OrderState' => ['in', ProductOrderEnum::$PayComplete]])
|
||||
->where($where)
|
||||
->where("product_order.UpdateTime >'".$last_month."'")
|
||||
->where("product_order.UpdateTime <'".$new_month."'")
|
||||
->where($where2)
|
||||
->group(['product_order.UserId'])
|
||||
->order($order_type)
|
||||
->limit($limit)
|
||||
|
||||
Reference in New Issue
Block a user