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

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

Loading…
Cancel
Save