20 changed files with 885 additions and 28 deletions
-
86app/AdminAgent/Controllers/DemandBiddingController.php
-
208app/AdminAgent/Controllers/DemandController.php
-
132app/AdminAgent/Controllers/MyDemandController.php
-
47app/AdminAgent/Lazys/DemandBiddingLazys.php
-
16app/AdminAgent/Repositories/Demand.php
-
16app/AdminAgent/Repositories/DemandBidding.php
-
6app/AdminAgent/routes.php
-
15app/Models/Agent.php
-
25app/Models/Demand.php
-
19app/Models/DemandBidding.php
-
15app/Models/Guide.php
-
15app/Models/Supplier.php
-
31app/Traits/DemandTraits.php
-
50app/Traits/ResponseHelper.php
-
45database/migrations/2021_08_24_164921_create_demand_table.php
-
36database/migrations/2021_08_24_165029_create_demand_bidding_table.php
-
96dcat_admin_ide_helper.php
-
13resources/lang/zh_CN/demand-bidding.php
-
21resources/lang/zh_CN/demand.php
-
21resources/lang/zh_CN/my-demand.php
@ -0,0 +1,86 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminAgent\Controllers; |
|||
|
|||
use App\AdminAgent\Repositories\DemandBidding; |
|||
use App\Traits\DemandTraits; |
|||
use Dcat\Admin\Admin; |
|||
use Dcat\Admin\Form; |
|||
use Dcat\Admin\Grid; |
|||
use Dcat\Admin\Show; |
|||
use Dcat\Admin\Http\Controllers\AdminController; |
|||
use http\Env\Request; |
|||
use Illuminate\Support\Arr; |
|||
|
|||
class DemandBiddingController extends AdminController |
|||
{ |
|||
/** |
|||
* Make a grid builder. |
|||
* |
|||
* @return Grid |
|||
*/ |
|||
protected function grid() |
|||
{ |
|||
return Grid::make(new DemandBidding(), function (Grid $grid) { |
|||
$grid->model()->where(['bidding_user_id' => Admin::user()->id,'bidding_user_type' => Arr::first(DemandTraits::$col)]); |
|||
$grid->column('id')->sortable(); |
|||
$grid->column('price'); |
|||
$grid->column('comment'); |
|||
$grid->column('created_at'); |
|||
$grid->column('updated_at')->sortable(); |
|||
$grid->disableDeleteButton(); |
|||
$grid->disableEditButton(); |
|||
$grid->disableQuickEditButton(); |
|||
$grid->disableViewButton(); |
|||
$grid->disableCreateButton(); |
|||
$grid->disableActions(); |
|||
$grid->filter(function (Grid\Filter $filter) { |
|||
$filter->equal('id'); |
|||
|
|||
}); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Make a show builder. |
|||
* |
|||
* @param mixed $id |
|||
* |
|||
* @return Show |
|||
*/ |
|||
protected function detail($id) |
|||
{ |
|||
return Show::make($id, new DemandBidding(), function (Show $show) { |
|||
$show->field('id'); |
|||
$show->field('price'); |
|||
$show->field('comment'); |
|||
$show->field('created_at'); |
|||
$show->field('updated_at'); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Make a form builder. |
|||
* |
|||
* @return Form |
|||
*/ |
|||
protected function form() |
|||
{ |
|||
return Form::make(new DemandBidding(), function (Form $form) { |
|||
$form->display('id'); |
|||
$form->text('price'); |
|||
$form->text('comment'); |
|||
$form->hidden('demand_id')->value(request('demand_id',0)); |
|||
$form->hidden('bidding_user_type'); |
|||
$form->hidden('bidding_user_id'); |
|||
$form->saving(function (Form $form) { |
|||
// 判断是否是新增操作
|
|||
if ($form->isCreating()) { |
|||
//发布人身份
|
|||
$form->bidding_user_type = 'App\models\Agent'; |
|||
$form->bidding_user_id = Admin::user()->id; |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,208 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminAgent\Controllers; |
|||
|
|||
use App\Models\AgentProduct; |
|||
use App\Models\Product; |
|||
use App\Traits\ResponseHelper; |
|||
use App\AdminAgent\Repositories\Demand; |
|||
use App\Models\DemandBidding; |
|||
use Dcat\Admin\Admin; |
|||
use Dcat\Admin\Form; |
|||
use Dcat\Admin\Grid; |
|||
use Dcat\Admin\Show; |
|||
use Dcat\Admin\Http\Controllers\AdminController; |
|||
use App\Traits\DemandTraits; |
|||
use Illuminate\Database\Eloquent\Model; |
|||
use Illuminate\Http\Request; |
|||
use Illuminate\Support\Arr; |
|||
use Illuminate\Support\Facades\DB; |
|||
use Illuminate\Support\Facades\Log; |
|||
use Illuminate\Support\Facades\URL; |
|||
|
|||
class DemandController extends AdminController |
|||
{ |
|||
|
|||
use ResponseHelper; |
|||
/** |
|||
* Make a grid builder. |
|||
* |
|||
* @return Grid |
|||
*/ |
|||
protected function grid() |
|||
{ |
|||
return Grid::make(new Demand(['publisher','biddingUser']), function (Grid $grid) { |
|||
$grid->column('id')->sortable(); |
|||
$grid->column('title'); |
|||
$grid->column('detail','内容')->display('查看')->modal('详情',function ($modal) { |
|||
$modal->xl(); |
|||
return $this->comment; |
|||
}); |
|||
$grid->column('images','图片')->display(function ($image) { |
|||
return json_decode($image,true); |
|||
})->image(); |
|||
$grid->column('deadline'); |
|||
$grid->column('publisher.name','发布人'); |
|||
$grid->column('publisher_type')->using(DemandTraits::$polymorphic); |
|||
$grid->column('biddingUser.name','中标人'); |
|||
$grid->column('bidding_user_type','竞标用户类型')->using(DemandTraits::$polymorphic); |
|||
$grid->column('price'); |
|||
$grid->column('stock'); |
|||
$grid->column('state')->using(DemandTraits::$state)->dot( |
|||
[ |
|||
1 => 'yellow', |
|||
2 => 'success', |
|||
3 => 'danger', |
|||
] |
|||
); |
|||
|
|||
$grid->column('bidding','竞标') |
|||
->if(function (){ |
|||
return $this->state == 1 && $this->bidding_user_type == Arr::first(DemandTraits::$col); |
|||
}) |
|||
->then(function (Grid\Column $column) { |
|||
$column->append('<a class="btn btn-sm btn-primary" href="'.admin_url('/demand_bidding/create?demand_id='.$this->id).'">发起竞标</a>'); |
|||
}); |
|||
$grid->column('created_at')->sortable(); |
|||
$grid->disableDeleteButton(); |
|||
$grid->disableEditButton(); |
|||
$grid->disableQuickEditButton(); |
|||
$grid->disableViewButton(); |
|||
$grid->disableActions(); |
|||
$grid->filter(function (Grid\Filter $filter) { |
|||
$filter->equal('id'); |
|||
$filter->equal('bidding_user_type','竞标用户类型')->select(DemandTraits::$polymorphic); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Make a show builder. |
|||
* |
|||
* @param mixed $id |
|||
* |
|||
* @return Show |
|||
*/ |
|||
protected function detail($id) |
|||
{ |
|||
return Show::make($id, new Demand(['publisher','biddingUser']), function (Show $show) { |
|||
$show->field('id'); |
|||
$show->field('title'); |
|||
$show->field('comment'); |
|||
$show->field('images')->image(); |
|||
$show->field('deadline'); |
|||
$show->field('bidding_user_type','竞标用户类型')->using(DemandTraits::$polymorphic); |
|||
$show->field('price'); |
|||
$show->field('stock'); |
|||
$show->field('publisher_type')->using(DemandTraits::$polymorphic); |
|||
$show->field('publisher.name','发布人'); |
|||
$show->field('state')->using(DemandTraits::$state)->dot( |
|||
[ |
|||
1 => 'yellow', |
|||
2 => 'danger', |
|||
3 => 'success', |
|||
] |
|||
);; |
|||
$show->field('created_at'); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Make a form builder. |
|||
* |
|||
* @return Form |
|||
*/ |
|||
protected function form() |
|||
{ |
|||
return Form::make(new Demand(), function (Form $form) { |
|||
$form->disableEditingCheck(); |
|||
$form->disableCreatingCheck(); |
|||
$form->disableViewCheck(); |
|||
$form->display('id'); |
|||
$form->text('title'); |
|||
$form->text('comment'); |
|||
$form->multipleImage('images','图片')->limit(5)->saving(function ($path) { |
|||
return json_encode($path); |
|||
}); |
|||
$form->hidden('deadline'); |
|||
$form->select('bidding_user_type','竞标用户类型') |
|||
->when([2],function (Form $form){ |
|||
$form->select('product_id','产品')->options(function (){ |
|||
return Product::query()->whereIn('agent_id',[0,Admin::user()->id])->pluck('title','id'); |
|||
}); |
|||
}) |
|||
->options([ |
|||
1 => '供应商', |
|||
2 => '地接' |
|||
]) |
|||
->default(1); |
|||
$form->decimal('price'); |
|||
$form->number('stock'); |
|||
$form->hidden('publisher_type'); |
|||
$form->hidden('publisher_id'); |
|||
$form->saving(function (Form $form) { |
|||
// 判断是否是新增操作
|
|||
if ($form->isCreating()) { |
|||
if ($form->bidding_user_type != 2) { |
|||
$form->product_id = 0; |
|||
} |
|||
$form->bidding_user_type = DemandTraits::$col[$form->bidding_user_type]; |
|||
//处理流拍时间
|
|||
$form->deadline = now()->addDays(5); |
|||
//发布人身份
|
|||
$form->publisher_type = DemandTraits::$col[0]; |
|||
$form->publisher_id = Admin::user()->id; |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
public function binding() |
|||
{ |
|||
$demandBiddingId = request('demand_bidding_id',0); |
|||
$demandBidding = DemandBidding::find($demandBiddingId); |
|||
if (empty($demandBidding)) { |
|||
return false; |
|||
} |
|||
|
|||
$demand = \App\Models\Demand::find($demandBidding->demand_id); |
|||
|
|||
if (empty($demand)) { |
|||
return false; |
|||
} |
|||
|
|||
DB::beginTransaction(); |
|||
try { |
|||
//新建供应商订单
|
|||
$product = new Product(); |
|||
$product->agent_id = $demand->publisher_id; |
|||
$product->title = $demand->title; |
|||
$product->pictures = $demand->images; |
|||
$product->price = $demand->price; |
|||
$product->original_price = $demand->price; |
|||
$product->stock = $demand->stock; |
|||
$product->state = 0; |
|||
$product->save(); |
|||
//处理代理商订单
|
|||
$agentProduct = new AgentProduct(); |
|||
$agentProduct->agent_id = $demand->publisher_id; |
|||
$agentProduct->product_id = $product->id; |
|||
$agentProduct->stock = $demand->stock; |
|||
$agentProduct->price = $demand->price; |
|||
$agentProduct->original_price = $demand->price; |
|||
$agentProduct->state = 0; |
|||
$agentProduct->save(); |
|||
//改变订单状态
|
|||
$demand->bidding_id = $demandBidding->id; |
|||
$demand->bidding_user_id = $demandBidding->bidding_user_id; |
|||
$demand->state = DemandTraits::$stateKey[1]; |
|||
$demand->save(); |
|||
DB::commit(); |
|||
} catch (\Exception $e) { |
|||
Log::error('选中竞标失败::'.$e->getTraceAsString()); |
|||
DB::rollBack(); |
|||
return $this->jsonFail(1001,'选中竞标失败,稍后重试或联系管理员!'.$e->getMessage()); |
|||
} |
|||
return back(); |
|||
} |
|||
} |
|||
@ -0,0 +1,132 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminAgent\Controllers; |
|||
|
|||
use App\AdminAgent\Lazys\DemandBiddingLazys; |
|||
use App\AdminAgent\Repositories\Demand; |
|||
use App\Models\DemandBidding; |
|||
use Dcat\Admin\Admin; |
|||
use Dcat\Admin\Form; |
|||
use Dcat\Admin\Grid; |
|||
use Dcat\Admin\Show; |
|||
use Dcat\Admin\Http\Controllers\AdminController; |
|||
use App\Traits\DemandTraits; |
|||
use Illuminate\Support\Arr; |
|||
|
|||
class MyDemandController extends AdminController |
|||
{ |
|||
/** |
|||
* Make a grid builder. |
|||
* |
|||
* @return Grid |
|||
*/ |
|||
protected function grid() |
|||
{ |
|||
return Grid::make(new Demand(['publisher','biddingUser']), function (Grid $grid) { |
|||
$grid->model()->where(['publisher_id' => Admin::user()->id,'publisher_type' => Arr::first(DemandTraits::$col)]); |
|||
$grid->column('id')->sortable(); |
|||
$grid->column('title'); |
|||
$grid->column('detail','内容')->display('查看')->modal('详情',function ($modal) { |
|||
$modal->xl(); |
|||
return $this->comment; |
|||
}); |
|||
$grid->column('images','图片')->display(function ($image) { |
|||
return json_decode($image,true); |
|||
})->image(); |
|||
$grid->column('deadline'); |
|||
$grid->column('biddingUser.name','中标人'); |
|||
$grid->column('bidding_user_type','竞标用户类型')->using(DemandTraits::$polymorphic); |
|||
$grid->column('price'); |
|||
$grid->column('stock'); |
|||
$grid->column('state')->using(DemandTraits::$state)->dot( |
|||
[ |
|||
1 => 'yellow', |
|||
2 => 'success', |
|||
3 => 'danger', |
|||
] |
|||
); |
|||
|
|||
$grid->column('bidding','竞标明细') |
|||
->display(function (){ |
|||
return '竞标数 : '. DemandBidding::query()->where('demand_id',$this->id)->count(); |
|||
}) |
|||
->modal('竞标明细',function () { |
|||
return DemandBiddingLazys::make(['demand_id' => $this->id]); |
|||
}); |
|||
|
|||
$grid->column('created_at')->sortable(); |
|||
$grid->disableDeleteButton(); |
|||
$grid->disableEditButton(); |
|||
$grid->disableQuickEditButton(); |
|||
$grid->disableViewButton(); |
|||
$grid->disableActions(); |
|||
$grid->filter(function (Grid\Filter $filter) { |
|||
$filter->equal('id'); |
|||
$filter->equal('bidding_user_type','竞标用户类型')->select(DemandTraits::$polymorphic); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Make a show builder. |
|||
* |
|||
* @param mixed $id |
|||
* |
|||
* @return Show |
|||
*/ |
|||
protected function detail($id) |
|||
{ |
|||
return Show::make($id, new Demand(['publisher','biddingUser']), function (Show $show) { |
|||
$show->field('id'); |
|||
$show->field('title'); |
|||
$show->field('comment'); |
|||
$show->field('images')->image(); |
|||
$show->field('deadline'); |
|||
$show->field('bidding_user_type','竞标用户类型')->using(DemandTraits::$polymorphic); |
|||
$show->field('price'); |
|||
$show->field('stock'); |
|||
$show->field('state')->using(DemandTraits::$state)->dot( |
|||
[ |
|||
1 => 'yellow', |
|||
2 => 'danger', |
|||
3 => 'success', |
|||
] |
|||
);; |
|||
$show->field('created_at'); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Make a form builder. |
|||
* |
|||
* @return Form |
|||
*/ |
|||
protected function form() |
|||
{ |
|||
return Form::make(new Demand(), function (Form $form) { |
|||
$form->display('id'); |
|||
$form->text('title'); |
|||
$form->text('comment'); |
|||
$form->multipleImage('images','图片'); |
|||
$form->hidden('deadline'); |
|||
$form->select('bidding_user_type','竞标用户类型')->options([ |
|||
'App\models\Supplier' => '供应商', |
|||
'App\models\Guides' => '地接' |
|||
]); |
|||
$form->decimal('price'); |
|||
$form->number('stock'); |
|||
$form->hidden('publisher_type'); |
|||
$form->hidden('publisher_id'); |
|||
$form->saving(function (Form $form) { |
|||
// 判断是否是新增操作
|
|||
if ($form->isCreating()) { |
|||
//处理流拍时间
|
|||
$form->deadline = now()->addDays(5); |
|||
//发布人身份
|
|||
$form->publisher_type = 'App\models\Agent'; |
|||
$form->publisher_id = Admin::user()->id; |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace App\AdminAgent\Lazys; |
|||
|
|||
use App\AdminAgent\Repositories\DemandBidding; |
|||
use App\Models\Demand; |
|||
use App\Traits\DemandTraits; |
|||
use Dcat\Admin\Grid; |
|||
use Dcat\Admin\Grid\LazyRenderable; |
|||
use Illuminate\Support\Arr; |
|||
|
|||
class DemandBiddingLazys extends LazyRenderable |
|||
{ |
|||
public function grid(): Grid |
|||
{ |
|||
return Grid::make(new DemandBidding(['biddingUser']), function (Grid $grid) { |
|||
$demandId = request('demand_id',''); |
|||
$demand = Demand::find($demandId); |
|||
$grid->model()->where('demand_id',$demandId); |
|||
$grid->column('id'); |
|||
$grid->column('price','出价'); |
|||
$grid->column('comment','内容'); |
|||
$grid->column('biddingUser.name','竞拍人'); |
|||
$grid->column('bidding','竞标') |
|||
->if(function () use ($demand){ |
|||
return $demand->state == 1; |
|||
}) |
|||
->then(function (Grid\Column $column) { |
|||
$column->append('<a class="btn btn-sm btn-primary" href="'.admin_url('/api/demand/binding?demand_bidding_id='.$this->id).'" style="color: white">选中竞标</a>'); |
|||
}) |
|||
->if(function () use ($demand){ |
|||
return $demand->state == 2; |
|||
}) |
|||
->then(function (Grid\Column $column) use ($demand){ |
|||
if ($demand->bidding_id == $this->id) { |
|||
$column->append('<span class="text-success">已中标</span>'); |
|||
} else { |
|||
$column->append('<span class="text-danger">未中标</span>'); |
|||
} |
|||
}); |
|||
$grid->column('created_at'); |
|||
$grid->disableActions(); |
|||
$grid->disableRowSelector(); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminAgent\Repositories; |
|||
|
|||
use App\Models\Demand as Model; |
|||
use Dcat\Admin\Repositories\EloquentRepository; |
|||
|
|||
class Demand extends EloquentRepository |
|||
{ |
|||
/** |
|||
* Model. |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $eloquentClass = Model::class; |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminAgent\Repositories; |
|||
|
|||
use App\Models\DemandBidding as Model; |
|||
use Dcat\Admin\Repositories\EloquentRepository; |
|||
|
|||
class DemandBidding extends EloquentRepository |
|||
{ |
|||
/** |
|||
* Model. |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $eloquentClass = Model::class; |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
<?php |
|||
|
|||
namespace App\Models; |
|||
|
|||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
|||
use Illuminate\Database\Eloquent\SoftDeletes; |
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class Demand extends BaseModel |
|||
{ |
|||
use HasDateTimeFormatter; |
|||
use SoftDeletes; |
|||
|
|||
protected $table = 'demand'; |
|||
|
|||
public function publisher() |
|||
{ |
|||
return $this->morphTo(); |
|||
} |
|||
|
|||
public function biddingUser() |
|||
{ |
|||
return $this->morphTo(); |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
<?php |
|||
|
|||
namespace App\Models; |
|||
|
|||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
|||
use Illuminate\Database\Eloquent\SoftDeletes; |
|||
|
|||
class DemandBidding extends BaseModel |
|||
{ |
|||
use HasDateTimeFormatter; |
|||
use SoftDeletes; |
|||
|
|||
protected $table = 'demand_bidding'; |
|||
|
|||
public function biddingUser() |
|||
{ |
|||
return $this->morphTo(); |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
<?php |
|||
|
|||
namespace App\Traits; |
|||
|
|||
trait DemandTraits |
|||
{ |
|||
|
|||
public static $col = [ |
|||
'App\models\Agent', |
|||
'App\models\Supplier', |
|||
'App\models\Guide', |
|||
]; |
|||
|
|||
public static $polymorphic = [ |
|||
'App\models\Agent' => '代理商', |
|||
'App\models\Supplier' => '供应商', |
|||
'App\models\Guide' => '地接', |
|||
]; |
|||
|
|||
public static $stateKey = [ |
|||
1, |
|||
2, |
|||
3, |
|||
]; |
|||
|
|||
public static $state = [ |
|||
1 => '待竞标' , |
|||
2 => '已竞标' , |
|||
3 => '流拍' |
|||
]; |
|||
} |
|||
@ -0,0 +1,50 @@ |
|||
<?php |
|||
|
|||
namespace App\Traits; |
|||
|
|||
use Throwable; |
|||
use Illuminate\Support\Facades\Response; |
|||
|
|||
trait ResponseHelper |
|||
{ |
|||
|
|||
public function jsonSuccess($data = [], $metalData = [], $code = 0, $msg = 'success') |
|||
{ |
|||
return Response::json([ |
|||
'code' => $code, |
|||
'msg' => $msg, |
|||
'data' => $data, |
|||
'metal_data' => $metalData, |
|||
]); |
|||
} |
|||
|
|||
public function jsonFail($code = 0, $msg = 'fail', $data = [], $metalData = []) |
|||
{ |
|||
return Response::json([ |
|||
'code' => $code, |
|||
'msg' => $msg, |
|||
'data' => $data, |
|||
'metal_data' => $metalData, |
|||
]); |
|||
} |
|||
|
|||
public function jsonFailValidated($msg = 'validate fail', $code = 5000, $data = [], $metalData = []) |
|||
{ |
|||
return Response::json([ |
|||
'code' => $code, |
|||
'msg' => $msg, |
|||
'data' => $data, |
|||
'metal_data' => $metalData, |
|||
]); |
|||
} |
|||
|
|||
public function jsonException(Throwable $e, $statusCode = 200) |
|||
{ |
|||
return Response::json([ |
|||
'code' => $e->getCode() ?: $statusCode, |
|||
'msg' => $e->getMessage(), |
|||
'data' => [], |
|||
'metal_data' => [], |
|||
], 500); |
|||
} |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Database\Migrations\Migration; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Support\Facades\Schema; |
|||
|
|||
class CreateDemandTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('demand', function (Blueprint $table) { |
|||
$table->id(); |
|||
$table->string('title')->comment('标题')->default(''); |
|||
$table->string('comment')->comment('内容')->default(''); |
|||
$table->dateTime('deadline')->comment('流拍时间')->nullable(); |
|||
$table->decimal('price')->comment('起拍价格')->default(0); |
|||
$table->integer('stock')->comment('库存')->default(0); |
|||
$table->string('publisher_type')->comment('发布人身份 类型 关联模型')->default(''); |
|||
$table->bigInteger('publisher_id')->index()->comment('发布人身份id 根据类型查不同的表')->default(1); |
|||
$table->tinyInteger('state')->comment('状态 1 待竞标 2 已竞标 3 流拍')->default(1); |
|||
$table->string('bidding_user_type')->comment('竞拍人 关联模型')->default(1); |
|||
$table->bigInteger('bidding_user_id')->index()->comment('竞拍成功人用户id 关联竞标表')->default(0); |
|||
$table->bigInteger('bidding_id')->index()->comment('竞拍成功id 关联竞标表')->default(0); |
|||
$table->string('images')->index()->comment('图片')->default(''); |
|||
$table->dateTime('created_at')->nullable(); |
|||
$table->dateTime('updated_at')->nullable(); |
|||
$table->dateTime('deleted_at')->nullable(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('demand'); |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Database\Migrations\Migration; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Support\Facades\Schema; |
|||
|
|||
class CreateDemandBiddingTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('demand_bidding', function (Blueprint $table) { |
|||
$table->id(); |
|||
$table->decimal('price')->comment('报价')->default(0); |
|||
$table->string('comment')->comment('内容 解决方案')->default(''); |
|||
$table->bigInteger('demand_id')->index()->comment('市场需求表id 关联需求表表')->default(0); |
|||
$table->dateTime('created_at')->nullable(); |
|||
$table->dateTime('updated_at')->nullable(); |
|||
$table->dateTime('deleted_at')->nullable(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('demand_bidding'); |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
<?php |
|||
return [ |
|||
'labels' => [ |
|||
'DemandBidding' => '我的竞标', |
|||
'demand-bidding' => '我的竞标', |
|||
], |
|||
'fields' => [ |
|||
'price' => '价格', |
|||
'comment' => '内容', |
|||
], |
|||
'options' => [ |
|||
], |
|||
]; |
|||
@ -0,0 +1,21 @@ |
|||
<?php |
|||
return [ |
|||
'labels' => [ |
|||
'Demand' => '市场需求', |
|||
'demand' => '市场需求', |
|||
], |
|||
'fields' => [ |
|||
'title' => '标题', |
|||
'comment' => '内容', |
|||
'deadline' => '流拍时间', |
|||
'type' => '类型', |
|||
'price' => '价格', |
|||
'stock' => '库存', |
|||
'publisher_type' => '发布人身份', |
|||
'publisher_id' => '发布人', |
|||
'state' => '状态', |
|||
'bidding_id' => '竞拍成功id 关联竞标表', |
|||
], |
|||
'options' => [ |
|||
], |
|||
]; |
|||
@ -0,0 +1,21 @@ |
|||
<?php |
|||
return [ |
|||
'labels' => [ |
|||
'MyDemand' => '我的需求', |
|||
'my_demand' => '我的需求', |
|||
], |
|||
'fields' => [ |
|||
'title' => '标题', |
|||
'comment' => '内容', |
|||
'deadline' => '流拍时间', |
|||
'type' => '类型', |
|||
'price' => '价格', |
|||
'stock' => '库存', |
|||
'publisher_type' => '发布人身份', |
|||
'publisher_id' => '发布人', |
|||
'state' => '状态', |
|||
'bidding_id' => '竞拍成功id 关联竞标表', |
|||
], |
|||
'options' => [ |
|||
], |
|||
]; |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue