Commit c7abd980 authored by wanjilong's avatar wanjilong

add: merge master to branch

parents 42722c7a d03c6b68
...@@ -2,9 +2,66 @@ ...@@ -2,9 +2,66 @@
namespace App\Models\order\mysql; namespace App\Models\order\mysql;
use Api\PhpUtils\Mysql\MysqlBase; use Api\PhpUtils\Mysql\MysqlBase;
use App\Exception\BaseException;
class PayOrderClearingItem extends MysqlBase 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 ";
/*
$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
not exists (select 1 from refund_order ro where ro.`order_item_id` = poci.`order_item_id`) and
poci.pay_sub_type = 105 and poci.account_id = ?
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]);
}
}
...@@ -1888,6 +1888,7 @@ opcache.huge_code_pages=1 ...@@ -1888,6 +1888,7 @@ opcache.huge_code_pages=1
;openssl.capath= ;openssl.capath=
[apcu] [apcu]
apc.enable_cli=1
apc.shm_size=1024M apc.shm_size=1024M
apc.slam_defense=1 apc.slam_defense=1
apc.serializer=igbinary apc.serializer=igbinary
......
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