算力功能改版
This commit is contained in:
@@ -9,6 +9,7 @@ use app\common\util\PaymentUtil;
|
||||
use think\facade\Env;
|
||||
use think\facade\Request;
|
||||
use app\common\model\Order;
|
||||
use app\common\model\User;
|
||||
|
||||
/**
|
||||
* 支付服务(内部调用)
|
||||
@@ -495,6 +496,13 @@ class PaymentService
|
||||
switch ($order['orderType']) {
|
||||
case 1:
|
||||
// 处理购买算力
|
||||
// 查询用户信息,判断是否为管理员(需要同时匹配userId和companyId)
|
||||
$user = User::where([
|
||||
'id' => $order->userId,
|
||||
'companyId' => $order->companyId
|
||||
])->find();
|
||||
$isAdmin = (!empty($user) && isset($user->isAdmin) && $user->isAdmin == 1) ? 1 : 0;
|
||||
|
||||
$token = TokensCompany::where(['companyId' => $order->companyId,'userId' => $order->userId])->find();
|
||||
$goodsSpecs = json_decode($order->goodsSpecs, true);
|
||||
if (!empty($token)) {
|
||||
@@ -507,6 +515,7 @@ class PaymentService
|
||||
$tokensCompany->userId = $order->userId;
|
||||
$tokensCompany->companyId = $order->companyId;
|
||||
$tokensCompany->tokens = $goodsSpecs['tokens'];
|
||||
$tokensCompany->isAdmin = $isAdmin;
|
||||
$tokensCompany->createTime = time();
|
||||
$tokensCompany->updateTime = time();
|
||||
$tokensCompany->save();
|
||||
|
||||
Reference in New Issue
Block a user