维护用户销售统计——筛选
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-25 13:27:34
|
||||
* @LastEditTime: 2020-11-25 16:40:37
|
||||
*/
|
||||
|
||||
namespace app\manager\model;
|
||||
@@ -38,7 +38,7 @@ class ProductOrder extends Model
|
||||
*/
|
||||
public function getAllMoney($where = '', $where2 = [])
|
||||
{
|
||||
$data = $this->field('sum(PaymentAmount) as money,UserId')
|
||||
$data = $this->field('sum(PaymentAmount) as money,UserId')
|
||||
->where(['OrderState' => ['in', ProductOrderEnum::$PayComplete]])
|
||||
->where($where)
|
||||
->where($where2)
|
||||
@@ -46,11 +46,11 @@ class ProductOrder extends Model
|
||||
->fetchAll();
|
||||
$result = [
|
||||
'money' => 0,
|
||||
'num' => 0
|
||||
'num' => 0,
|
||||
];
|
||||
foreach($data as $info){
|
||||
foreach ($data as $info) {
|
||||
$result['money'] += $info['money'];
|
||||
$result['num'] ++;
|
||||
$result['num']++;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@@ -151,17 +151,18 @@ class ProductOrder extends Model
|
||||
* @param {*}
|
||||
* @return {*}
|
||||
*/
|
||||
public function getSort($where = [],$order = 1, $limit = '50')
|
||||
public function getSort($where = [], $order = 1, $limit = '50', $time_where, $having = '')
|
||||
{
|
||||
$order_type = 'money';
|
||||
if($order == '0'){
|
||||
if ($order == '0') {
|
||||
$order_type = 'money desc';
|
||||
}
|
||||
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($time_where)
|
||||
->where($where)
|
||||
->group(['product_order.UserId'])
|
||||
->group(['product_order.UserId'], $having)
|
||||
->order($order_type)
|
||||
->limit($limit)
|
||||
->fetchAll();
|
||||
@@ -172,10 +173,10 @@ class ProductOrder extends Model
|
||||
* @param {*} flag = true 上一个月
|
||||
* @return {*} flag = false 本月
|
||||
*/
|
||||
public function getMonthSort($where = [],$order = 1, $limit = '50', $where2 ='')
|
||||
public function getMonthSort($where = [], $order = 1, $limit = '50', $where2 = '', $having = '')
|
||||
{
|
||||
$order_type = 'money';
|
||||
if($order == '0'){
|
||||
if ($order == '0') {
|
||||
$order_type = 'money desc';
|
||||
}
|
||||
return $this->field('product_order.UserId,sum(product_order.PaymentAmount) as money')
|
||||
@@ -183,7 +184,7 @@ class ProductOrder extends Model
|
||||
->where(['OrderState' => ['in', ProductOrderEnum::$PayComplete]])
|
||||
->where($where)
|
||||
->where($where2)
|
||||
->group(['product_order.UserId'])
|
||||
->group(['product_order.UserId'], $having)
|
||||
->order($order_type)
|
||||
->limit($limit)
|
||||
->fetchAll();
|
||||
@@ -192,15 +193,16 @@ class ProductOrder extends Model
|
||||
/**
|
||||
* @description: 获取所有支付成功用户筛选金额
|
||||
* @param {*}
|
||||
* @return {*}
|
||||
* @return {*}
|
||||
*/
|
||||
public function getScreenCost($where,$having, $limit = '50')
|
||||
public function getScreenCost($where, $having, $limit = '50', $where2 = [])
|
||||
{
|
||||
return $this->field('UserId,sum(PaymentAmount) as money')
|
||||
->join('user ON product_order.UserId=user.Id')
|
||||
->where(['OrderState' => ['in', ProductOrderEnum::$PayComplete]])
|
||||
->where($where)
|
||||
->group(['UserId'],$having)
|
||||
->where($where2)
|
||||
->group(['UserId'], $having)
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
@@ -209,7 +211,7 @@ class ProductOrder extends Model
|
||||
* @param {*}
|
||||
* @return {*}
|
||||
*/
|
||||
public function getUserCost($user_id, $index, $where='')
|
||||
public function getUserCost($user_id, $index, $where = '')
|
||||
{
|
||||
return $this->field('UpdateTime,OrderNo,OrderType,ProductName,PackageName,PaymentAmount,Accounts,ConnectCount,PayType')
|
||||
->where(['UserId' => $user_id])
|
||||
|
||||
Reference in New Issue
Block a user