Commit f4803cf1 authored by 万继龙's avatar 万继龙

Merge branch 'refund_wanjl_0824' into 'master'

Refund wanjl 0824

See merge request bp/pay!62
parents d74d4f73 bbb50b3a
...@@ -7,4 +7,49 @@ class PayOrderClearingItem extends MysqlBase ...@@ -7,4 +7,49 @@ class PayOrderClearingItem extends MysqlBase
{ {
const TABLE_NAME = 'pay_order_clearing_item'; const TABLE_NAME = 'pay_order_clearing_item';
const CONFIG_INDEX = 'pay'; const CONFIG_INDEX = 'pay';
public static function marketSaleCount($accountId) {
$ret = [
'transit_fund'=>0,
'history_fund'=>0,
];
if($accountId == 0) {
return $ret;
}
$sql = "select sum(poci.`pay_amount`) as 'pay_amount', notify_account_status from pay_order_clearing_item poci
join pay_order_item poi on poi.`order_item_id` = poci.`order_item_id`
where poci.pay_sub_type = 105 and poci.account_id = ? and poi.refund_order_status = 0 group by notify_account_status ";
/*
type=1: 该团长历史累计分销佣金收入总和
type=2: 该团长当前未结算分销佣金总和
*/
try{
$medoo = self::getConnection(self::READ);
$medoo->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$sth = $medoo->pdo->prepare($sql);
$sth->execute([$accountId]);
while ($row = $sth->fetch(\PDO::FETCH_ASSOC)) {
if($row['notify_account_status'] == 2) {
$ret['history_fund'] += $row['pay_amount'];
} else {
$ret['transit_fund'] += $row['pay_amount'];
}
}
return $ret;
}catch (\PDOException $e) {
throw new BaseException(['msg'=>'数据查询错误:' . $e->getMessage(), 'code'=>'2401']);
}
}
} }
<?php
use App\Base\Base;
use App\Models\order\mysql\PayOrderClearingItem;
class AccountController extends Base
{
/**
* @throws \App\Exception\BaseException
* @throws \App\Exception\custom\PayException
*/
public function fundAction()
{
$params = $this->params;
$user_id = $params['user_id'];
$payment = PayOrderClearingItem::marketSaleCount($user_id);
$this->success(['result'=>$payment]);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment