|
|
@ -17,8 +17,10 @@ namespace app\common\repositories\system\merchant; |
|
|
|
use app\common\dao\system\merchant\FinancialRecordDao; |
|
|
|
use app\common\dao\system\merchant\FinancialRecordDao; |
|
|
|
use app\common\repositories\BaseRepository; |
|
|
|
use app\common\repositories\BaseRepository; |
|
|
|
use app\common\repositories\store\order\StoreOrderRepository; |
|
|
|
use app\common\repositories\store\order\StoreOrderRepository; |
|
|
|
|
|
|
|
use app\common\repositories\user\UserAssetsRepository; |
|
|
|
use app\common\repositories\user\UserBillRepository; |
|
|
|
use app\common\repositories\user\UserBillRepository; |
|
|
|
use app\common\repositories\user\UserRechargeRepository; |
|
|
|
use app\common\repositories\user\UserRechargeRepository; |
|
|
|
|
|
|
|
use app\common\repositories\user\UserRepository; |
|
|
|
use think\facade\Cache; |
|
|
|
use think\facade\Cache; |
|
|
|
use think\facade\Db; |
|
|
|
use think\facade\Db; |
|
|
|
|
|
|
|
|
|
|
@ -197,6 +199,44 @@ class FinancialRecordRepository extends BaseRepository |
|
|
|
return compact('stat'); |
|
|
|
return compact('stat'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getMerchantStatistics($where){ |
|
|
|
|
|
|
|
//商户收入 |
|
|
|
|
|
|
|
$count = $this->dao->search($where)->where('financial_type','in',['order','mer_presell'])->sum('number'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//商户余额 |
|
|
|
|
|
|
|
$mer_money = app()->make(MerchantRepository::class)->search(['mer_id' => $where['is_mer']])->value('mer_money'); |
|
|
|
|
|
|
|
//最低提现额度 |
|
|
|
|
|
|
|
$extract_minimum_line = systemConfig('extract_minimum_line'); |
|
|
|
|
|
|
|
//商户可提现金额 |
|
|
|
|
|
|
|
$_line = bcsub($mer_money,$extract_minimum_line,2); |
|
|
|
|
|
|
|
//退款支出金额 |
|
|
|
|
|
|
|
$refund_order = $this->dao->search($where)->where('financial_type','refund_order')->sum('number'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//商户冻结金额 |
|
|
|
|
|
|
|
$merLockMoney = app()->make(UserBillRepository::class)->merchantLickMoney($where['is_mer']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$user = \app(UserRepository::class)->getUserByMerId($where['is_mer']); |
|
|
|
|
|
|
|
if($user){ |
|
|
|
|
|
|
|
$assets = app(UserAssetsRepository::class)->assets($user['uid']); |
|
|
|
|
|
|
|
$welfare = $assets['welfare']; |
|
|
|
|
|
|
|
$welfare_frozen = $assets['welfare_frozen']; |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
$welfare = 0; |
|
|
|
|
|
|
|
$welfare_frozen = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return array( |
|
|
|
|
|
|
|
'total' => $count, |
|
|
|
|
|
|
|
'mer_money' => $mer_money, |
|
|
|
|
|
|
|
'frozen_money' => $merLockMoney, |
|
|
|
|
|
|
|
'refund_money' => $refund_order, |
|
|
|
|
|
|
|
'available_money' => $_line, |
|
|
|
|
|
|
|
'welfare' => $welfare, |
|
|
|
|
|
|
|
'welfare_frozen' => $welfare_frozen, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* TODO 商户头部统计 |
|
|
|
* TODO 商户头部统计 |
|
|
|
* @param $where |
|
|
|
* @param $where |
|
|
@ -229,6 +269,8 @@ class FinancialRecordRepository extends BaseRepository |
|
|
|
//商户可提现金额 |
|
|
|
//商户可提现金额 |
|
|
|
// $bill_order = app()->make(StoreOrderRepository::class)->search(['paid' => 1,'date' => $where['date'],'pay_type' => 0])->sum('pay_price'); |
|
|
|
// $bill_order = app()->make(StoreOrderRepository::class)->search(['paid' => 1,'date' => $where['date'],'pay_type' => 0])->sum('pay_price'); |
|
|
|
$merLockMoney = app()->make(UserBillRepository::class)->merchantLickMoney($where['is_mer']); |
|
|
|
$merLockMoney = app()->make(UserBillRepository::class)->merchantLickMoney($where['is_mer']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$stat = [ |
|
|
|
$stat = [ |
|
|
|
[ |
|
|
|
[ |
|
|
|
'className' => 'el-icon-s-goods', |
|
|
|
'className' => 'el-icon-s-goods', |
|
|
|