This commit is contained in:
邓皓元 2019-04-19 11:38:25 +08:00
parent 08377c74b2
commit 00c51c0162
5 changed files with 31 additions and 4 deletions

View File

@ -5,10 +5,13 @@ use App\Core\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use App\Models\Virtual\OrderCardPartition;
use Illuminate\Pagination\AbstractPaginator;
use Illuminate\Pagination\LengthAwarePaginator;
use App\Domains\Virtual\Services\PackageService;
use App\Domains\Virtual\Services\ProductService;
use App\Domains\Virtual\Repositories\OrderCardPartitionRepository;
use App\Models\Virtual\OrderCardPartition;
use App\Exceptions\InvalidArgumentException;
class CardController extends Controller
{
@ -37,13 +40,18 @@ class CardController extends Controller
if ($this->request->has('sim')) {
$conditions['sim'] = $this->request->ids('sim');
foreach ($conditions['sim'] as $key => $value) {
if($value > 9223372036854775807){
throw new InvalidArgumentException('SIM卡号查询长度过长');
}
}
}
$limit = $conditions['limit'] ?? 20;
$cards = $this->orderCardPartitionRepository->select(['sim', DB::raw('MIN(company_id) as company_id')])->withConditions($conditions)->groupBy('sim')->paginate($limit);
if ($this->request->has('sim')) {
$simArray = $this->request->ids('sim');
$cardArray = $cards->pluck('sim')->toArray();
@ -51,6 +59,10 @@ class CardController extends Controller
foreach ($simArray as $key => $value) {
if(!in_array($value, $cardArray)){
$cards->push(new OrderCardPartition(['sim' => $value, 'company_id' => 0]));
if($cards instanceof LengthAwarePaginator){
$cards = new LengthAwarePaginator($cards->items(), $cards->total + 1, $cards->perPage());
}
}
}
}

View File

@ -162,7 +162,7 @@ class OrderService extends Service
}
if (!$product) {
throw new NotExistException('请选择套餐');
throw new NotExistException('套餐不存在或已删除');
}
$rule['type'][] = 'required';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-6ea47298.6166dab5.css rel=prefetch><link href=/css/chunk-8064e07e.03f6c57e.css rel=prefetch><link href=/js/chunk-00ae0766.d130b440.js rel=prefetch><link href=/js/chunk-07a274ec.55e1b3b0.js rel=prefetch><link href=/js/chunk-6ea47298.b6a301d0.js rel=prefetch><link href=/js/chunk-8064e07e.2574bafe.js rel=prefetch><link href=/css/app.be09e36f.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.47b51f12.js rel=preload as=script><link href=/js/chunk-vendors.ed6443e8.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.be09e36f.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ed6443e8.js></script><script src=/js/app.47b51f12.js></script></body></html>
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-6ea47298.6166dab5.css rel=prefetch><link href=/css/chunk-8064e07e.03f6c57e.css rel=prefetch><link href=/js/chunk-00ae0766.d130b440.js rel=prefetch><link href=/js/chunk-07a274ec.55e1b3b0.js rel=prefetch><link href=/js/chunk-6ea47298.b6a301d0.js rel=prefetch><link href=/js/chunk-8064e07e.dbd98b81.js rel=prefetch><link href=/css/app.be09e36f.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.7633b564.js rel=preload as=script><link href=/js/chunk-vendors.ed6443e8.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.be09e36f.css rel=stylesheet></head><body><noscript><strong>很抱歉如果没有启用JavaScript程序不能正常工作若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.ed6443e8.js></script><script src=/js/app.7633b564.js></script></body></html>