维护客户基本完善

This commit is contained in:
wanyongkang
2020-11-22 11:09:33 +08:00
parent 1b9e56b24a
commit 18687d8ab1
4 changed files with 261 additions and 6 deletions

View File

@@ -4,8 +4,8 @@
* @version:
* @Author: kangkang
* @Date: 2020-10-16 14:44:02
* @LastEditors: kangkang
* @LastEditTime: 2020-11-19 18:49:23
* @LastEditors: Please set LastEditors
* @LastEditTime: 2020-11-22 10:31:50
*/
namespace app\manager\model;
@@ -31,6 +31,44 @@ class ProductOrder extends Model
->fetchAll();
}
/**
* @description: 获取支付总金额
* @param {*}
* @return {*}
*/
public function getAllMoney($where = '', $where2 = [])
{
$data = $this->field('sum(PaymentAmount) as money,UserId')
->where(['OrderState' => ['in', ProductOrderEnum::$PayComplete]])
->where($where)
->where($where2)
->group(['UserId'])
->fetchAll();
$result = [
'money' => 0,
'num' => 0
];
foreach($data as $info){
$result['money'] += $info['money'];
$result['num'] ++;
}
return $result;
}
/**
* @description: 获取退款总金额
* @param {*}
* @return {*}
*/
public function getRefund($where = '', $where2 = [])
{
return $this->field('sum(PaymentAmount) as money')
->where(['OrderState' => ['in', ProductOrderEnum::$Refunds]])
->where($where)
->where($where2)
->fetch();
}
/**
* @description: 获取所有支付成功用户近一个月的支付总金额
* @param {*}