wang hou sheng 7 months ago
parent 7e81dc2af0
commit 9887082516
  1. 5
      app/api/controller/Server.php
  2. 23
      app/api/model/Server/ServerOrder.php

@ -8,6 +8,7 @@ namespace app\api\controller;
use app\api\model\Server\ServerCategory;
use app\api\model\Server\ServerOrder;
use app\api\service\Server\ServerPayment;
use app\api\service\User as UserService;
use app\common\enum\ServerEnum;
use app\common\service\server\Order as ServerServiceOrder;
use cores\exception\BaseException;
@ -229,6 +230,10 @@ class Server extends Controller
if (!$serverId) {
return $this->renderError('非法请求');
}
//分销工程师限制下单
if (UserService::isDealerEngineer()) {
return $this->renderError('当前角色无法下单');
}
$orderService = new ServerServiceOrder();
$data = [
'server_id' => $serverId,

@ -216,15 +216,24 @@ class ServerOrder extends Order
$dataTypeFilter = $this->getFilterDataType($dataType);
// 当前用户ID
$userId = UserService::getCurrentLoginUserId();
// 查询数据
$query = $this;
// 非店长不带入user_id查询
if (!UserService::isStore()) {
$query = $query->where('user_id', '=', $userId);
}
return $query->where($dataTypeFilter)
//判断当前用户身份
if (UserService::isDealerEngineer()) {
//分销商工程师
return $this->where($dataTypeFilter)
->where('dealer_id', '=', $userId)
->where('is_delete', '=', 0)
->count();
} elseif (UserService::isStore()) {
// 店主
return $this->where($dataTypeFilter)
->where('is_delete', '=', 0)
->count();
} else {
return $this->where($dataTypeFilter)
->where('user_id', '=', $userId)
->where('is_delete', '=', 0)
->count();
}
}
/**

Loading…
Cancel
Save