Browse Source

测试

master
李可松 4 years ago
parent
commit
6437db94b3
  1. 10
      app/Http/Controllers/Api/TestController.php

10
app/Http/Controllers/Api/TestController.php

@ -2,6 +2,7 @@
namespace App\Http\Controllers\Api;
use App\Common\ProductStatus;
use App\Models\AgentProduct;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
@ -16,7 +17,14 @@ class TestController
{
public function index()
{
dd(AgentProduct::list(10)->withTrashed()->count());
dd(AgentProduct::withoutGlobalScope('orderById')
->whereDoesntHave('agentProductItem', function ($query) {
return $query->whereHas('product', function ($query) {
return $query->where('stock', '<=', 0)->orWhere('status', '<>', ProductStatus::ON_SALE);
});
})
->where('stock', '>', 0)->where(['agent_id' => 10, 'status' => ProductStatus::ON_SALE])
->select('id', 'sale', 'product_id', 'price', 'original_price', 'title', 'pictures')->withTrashed()->count());
}
/**

Loading…
Cancel
Save