From fef956da9e71c8d8fe32da82f9fc7fb24a27cf3d Mon Sep 17 00:00:00 2001 From: bruce <1272542526@qq.com> Date: Thu, 25 Jan 2024 23:13:52 +0800 Subject: [PATCH] update --- app/common/model/user/User.php | 5 +++++ app/controller/api/Auth.php | 8 ++++++++ runtime/swoole.pid | 1 + 3 files changed, 14 insertions(+) create mode 100644 runtime/swoole.pid diff --git a/app/common/model/user/User.php b/app/common/model/user/User.php index d02805b..0eaee78 100644 --- a/app/common/model/user/User.php +++ b/app/common/model/user/User.php @@ -328,4 +328,9 @@ class User extends BaseModel } } + public static function SumBrokeragePrice(int $status = 1): float + { + return self::getDB()->where("status", $status)->sum("brokerage_price") ?? 0.00; + } + } diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 90ec384..4fc8850 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -15,6 +15,7 @@ namespace app\controller\api; use app\common\dao\store\order\StoreOrderDao; +use app\common\model\user\User; use app\common\repositories\store\order\StoreOrderRepository; use app\common\repositories\store\order\StoreRefundOrderRepository; use app\common\repositories\system\notice\SystemNoticeConfigRepository; @@ -158,6 +159,13 @@ class Auth extends BaseController $data = $user->toArray(); $data['total_consume'] = $user['pay_price']; $data['extension_status'] = systemConfig('extension_status'); + + $brokeragePrice = User::SumBrokeragePrice(); + if($brokeragePrice > 0) { + $data['point_price'] = bcdiv(systemConfig('all_award'), $brokeragePrice, 2); + } + $data['asset_price'] = bcmul($data['point_price'], $this->request->userInfo()->brokerage_price ?? 0,2); + if (systemConfig('member_status')) $data['member_icon'] = $this->request->userInfo()->member->brokerage_icon ?? ''; if ($data['is_svip'] == 3) diff --git a/runtime/swoole.pid b/runtime/swoole.pid new file mode 100644 index 0000000..609dcf6 --- /dev/null +++ b/runtime/swoole.pid @@ -0,0 +1 @@ +70933 \ No newline at end of file