55 changed files with 1977 additions and 303 deletions
-
11MySQL_change.sql
-
71app/Admin/Controllers/DemandProductController.php
-
7app/Admin/Controllers/GuideController.php
-
8app/Admin/Controllers/SupplierController.php
-
2app/Admin/Extensions/Grid/AuditAgent.php
-
57app/Admin/Extensions/Grid/AuditDemandProduct.php
-
2app/Admin/Extensions/Grid/AuditGuide.php
-
2app/Admin/Extensions/Grid/AuditSupplier.php
-
1app/Admin/routes.php
-
87app/AdminAgent/Actions/Grid/DemandConfirm.php
-
26app/AdminAgent/Controllers/AgentProductController.php
-
5app/AdminAgent/Controllers/CategoryController.php
-
21app/AdminAgent/Controllers/DemandBiddingController.php
-
71app/AdminAgent/Controllers/DemandController.php
-
132app/AdminAgent/Controllers/MyDemandController.php
-
71app/AdminAgent/Controllers/MyDemandProductController.php
-
2app/AdminAgent/Controllers/OrderController.php
-
10app/AdminAgent/Forms/Setting.php
-
2app/AdminAgent/Renderable/SelectProduct.php
-
2app/AdminAgent/routes.php
-
99app/AdminGuide/Controllers/DemandBiddingController.php
-
213app/AdminGuide/Controllers/DemandController.php
-
79app/AdminGuide/Controllers/MyDemandProductController.php
-
16app/AdminGuide/Repositories/Demand.php
-
16app/AdminGuide/Repositories/DemandBidding.php
-
3app/AdminGuide/routes.php
-
172app/AdminSupplier/Controllers/DemandBiddingController.php
-
225app/AdminSupplier/Controllers/DemandController.php
-
139app/AdminSupplier/Controllers/DemandProductController.php
-
71app/AdminSupplier/Controllers/MyDemandProductController.php
-
47app/AdminSupplier/Renderable/SelectProduct.php
-
16app/AdminSupplier/Repositories/Demand.php
-
16app/AdminSupplier/Repositories/DemandBidding.php
-
16app/AdminSupplier/Repositories/DemandProduct.php
-
7app/AdminSupplier/routes.php
-
8app/Common/PayType.php
-
51app/Http/Controllers/Api/OrderController.php
-
2app/Http/Controllers/Api/TestController.php
-
2app/Http/Controllers/Api/WxpayController.php
-
2app/Models/Agent.php
-
5app/Models/AgentSetting.php
-
16app/Models/Demand.php
-
5app/Models/DemandBidding.php
-
52app/Models/DemandProduct.php
-
50app/Providers/DemandBiddingServiceProvider.php
-
115app/Service/SmsService.php
-
18app/Traits/DemandTraits.php
-
3composer.json
-
154composer.lock
-
2config/app.php
-
16config/sms.php
-
4resources/lang/zh_CN/agent-product.php
-
25resources/lang/zh_CN/demand-product.php
-
21resources/lang/zh_CN/my-demand-product.php
-
4resources/lang/zh_CN/setting.php
@ -0,0 +1,71 @@ |
|||
<?php |
|||
|
|||
namespace App\Admin\Controllers; |
|||
|
|||
use App\Admin\Extensions\Grid\AuditDemandProduct; |
|||
use App\Admin\Repositories\Product; |
|||
use App\Common\ProductStatus; |
|||
use App\Common\UserStatus; |
|||
use App\Models\Category; |
|||
use App\Models\DemandProduct; |
|||
use App\Models\Supplier; |
|||
use Dcat\Admin\Form; |
|||
use Dcat\Admin\Grid; |
|||
use Dcat\Admin\Show; |
|||
use Dcat\Admin\Http\Controllers\AdminController; |
|||
use Illuminate\Support\Facades\Route; |
|||
|
|||
class DemandProductController extends AdminController |
|||
{ |
|||
/** |
|||
* Make a grid builder. |
|||
* |
|||
* @return Grid |
|||
*/ |
|||
protected function grid() |
|||
{ |
|||
return Grid::make(new DemandProduct(['supplier:id,name', 'category:id,name']), function (Grid $grid) { |
|||
$grid->disableCreateButton(); |
|||
//如果是审核页面,多加where条件判断
|
|||
if (strpos(Route::current()->uri, 'audit')) { |
|||
$grid->model()->where('status', ProductStatus::UNAUDITED); |
|||
} |
|||
|
|||
$grid->column('id')->sortable(); |
|||
$grid->column('category.name', '分类'); |
|||
$grid->column('picture')->image('', 60, 60); |
|||
$grid->column('title'); |
|||
$grid->column('sale'); |
|||
$grid->column('supplier.name', '供应商'); |
|||
$grid->column('status') |
|||
->if(fn() => $this->status == ProductStatus::UNAUDITED) |
|||
->display('') |
|||
->then(function ($column) { |
|||
$column->append((new AuditDemandProduct(null, 1))->setKey($this->id))->append(' '); |
|||
$column->append((new AuditDemandProduct(null, 2))->setKey($this->id)); |
|||
}) |
|||
->else() |
|||
->using(ProductStatus::array()) |
|||
->dot([ |
|||
ProductStatus::ON_SALE => 'success', |
|||
ProductStatus::UNAUDITED => '', |
|||
ProductStatus::REFUSE => 'danger', |
|||
ProductStatus::SOLD_OUT => 'warning', |
|||
], 'primary'); |
|||
$grid->column('created_at'); |
|||
$grid->column('updated_at'); |
|||
$grid->disableDeleteButton(); |
|||
$grid->disableEditButton(); |
|||
$grid->disableQuickEditButton(); |
|||
$grid->disableViewButton(); |
|||
$grid->disableActions(); |
|||
$grid->filter(function (Grid\Filter $filter) { |
|||
$filter->panel(); |
|||
|
|||
$filter->equal('id')->width(2); |
|||
$filter->like('title')->width(3); |
|||
$filter->equal('status')->select(ProductStatus::array())->width(2); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,57 @@ |
|||
<?php |
|||
|
|||
namespace App\Admin\Extensions\Grid; |
|||
use App\Common\ProductStatus; |
|||
use App\Models\DemandProduct; |
|||
use App\Models\Product; |
|||
use Dcat\Admin\Grid\RowAction; |
|||
use Illuminate\Http\Request; |
|||
|
|||
/** |
|||
* 供应商审核 |
|||
* Class AuditSupplier |
|||
* @package App\Admin\Extensions\Grid |
|||
*/ |
|||
class AuditDemandProduct extends RowAction |
|||
{ |
|||
private $action; |
|||
|
|||
public function __construct($title = null, $action = 1) |
|||
{ |
|||
parent::__construct($title); |
|||
$this->action = $action; //$action:1=通过;2=拒绝
|
|||
$this->title = $action == 1 ? '通过' : '拒绝'; |
|||
} |
|||
|
|||
protected function html() |
|||
{ |
|||
$class = $this->action == 1 ? 'btn btn-sm btn-success' : 'btn btn-sm btn-danger'; |
|||
$this->appendHtmlAttribute('class', $class); |
|||
$this->defaultHtmlAttribute('href', 'javascript:;'); |
|||
|
|||
return "<a {$this->formatHtmlAttributes()}>{$this->title}</a>"; |
|||
} |
|||
|
|||
public function handle(Request $request) |
|||
{ |
|||
try { |
|||
$product = DemandProduct::find($this->getKey()); |
|||
$product->status = $request->action == 1 ? ProductStatus::ON_SALE : ProductStatus::REFUSE; |
|||
$product->save(); |
|||
|
|||
return $this->response()->success("审核成功")->refresh(); |
|||
} catch (\Exception $e) { |
|||
return $this->response()->error($e->getMessage()); |
|||
} |
|||
} |
|||
|
|||
public function confirm() |
|||
{ |
|||
return ['确定要'.$this->title.'该产品吗?', '']; |
|||
} |
|||
|
|||
public function parameters() |
|||
{ |
|||
return ['action' => $this->action]; |
|||
} |
|||
} |
|||
@ -0,0 +1,87 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminAgent\Actions\Grid; |
|||
|
|||
use Dcat\Admin\Actions\Response; |
|||
use Dcat\Admin\Grid\RowAction; |
|||
use Dcat\Admin\Grid\Tools\AbstractTool; |
|||
use Dcat\Admin\Traits\HasPermissions; |
|||
use Illuminate\Contracts\Auth\Authenticatable; |
|||
use Illuminate\Database\Eloquent\Model; |
|||
use Illuminate\Http\Request; |
|||
|
|||
class DemandConfirm extends RowAction |
|||
{ |
|||
protected $model; |
|||
|
|||
public function __construct(string $model = null) |
|||
{ |
|||
$this->model = $model; |
|||
} |
|||
|
|||
/** |
|||
* 标题 |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function title() |
|||
{ |
|||
return 'Copy'; |
|||
} |
|||
|
|||
/** |
|||
* 设置确认弹窗信息,如果返回空值,则不会弹出弹窗 |
|||
* |
|||
* 允许返回字符串或数组类型 |
|||
* |
|||
* @return array|string|void |
|||
*/ |
|||
public function confirm() |
|||
{ |
|||
return [ |
|||
// 确认弹窗 title
|
|||
"您确定要复制这行数据吗?", |
|||
// 确认弹窗 content
|
|||
$this->row->username, |
|||
]; |
|||
} |
|||
|
|||
/** |
|||
* 处理请求 |
|||
* |
|||
* @param Request $request |
|||
* |
|||
* @return \Dcat\Admin\Actions\Response |
|||
*/ |
|||
public function handle(Request $request) |
|||
{ |
|||
// 获取当前行ID
|
|||
$id = $this->getKey(); |
|||
|
|||
// 获取 parameters 方法传递的参数
|
|||
$username = $request->get('username'); |
|||
$model = $request->get('model'); |
|||
|
|||
// 复制数据
|
|||
$model::find($id)->replicate()->save(); |
|||
|
|||
// 返回响应结果并刷新页面
|
|||
return $this->response()->success("复制成功: [{$username}]")->refresh(); |
|||
} |
|||
|
|||
/** |
|||
* 设置要POST到接口的数据 |
|||
* |
|||
* @return array |
|||
*/ |
|||
public function parameters() |
|||
{ |
|||
return [ |
|||
// 发送当前行 username 字段数据到接口
|
|||
'username' => $this->row->username, |
|||
// 把模型类名传递到接口
|
|||
'model' => $this->model, |
|||
]; |
|||
} |
|||
|
|||
} |
|||
@ -1,132 +0,0 @@ |
|||
<?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,71 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminAgent\Controllers; |
|||
|
|||
use App\AdminAgent\Actions\Grid\DemandConfirm; |
|||
use App\AdminAgent\Lazys\DemandBiddingLazys; |
|||
use App\Common\ProductStatus; |
|||
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 MyDemandProductController extends AdminController |
|||
{ |
|||
|
|||
use ResponseHelper; |
|||
/** |
|||
* Make a grid builder. |
|||
* |
|||
* @return Grid |
|||
*/ |
|||
protected function grid() |
|||
{ |
|||
return Grid::make(new Demand(['publisher','biddingUser','product.category']), function (Grid $grid) { |
|||
|
|||
$grid->model() |
|||
->where(['publisher_id' => Admin::user()->id,'publisher_type' => DemandTraits::$col[0]]) |
|||
->where('product_id','>',0); |
|||
|
|||
$grid->column('id')->sortable(); |
|||
//$grid->column('title');
|
|||
//$grid->column('detail','内容')->display('查看')->modal('详情',function ($modal) {
|
|||
// $modal->xl();
|
|||
// return $this->comment;
|
|||
//});
|
|||
$grid->column('biddingUser.name','中标人'); |
|||
$grid->column('price','发标价格'); |
|||
$grid->column('product.category.name', '产品分类'); |
|||
$grid->column('product.title','产品标题'); |
|||
$grid->column('product.picture','产品图片')->image('', 60, 60); |
|||
$grid->column('product.price','产品售价'); |
|||
$grid->column('product.original_price','产品原价'); |
|||
$grid->column('product.stock','产品库存'); |
|||
$grid->column('product.sale','产品销量'); |
|||
$grid->column('product.status','产品状态')->using(ProductStatus::array()); |
|||
$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); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,99 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminGuide\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(['demand']), function (Grid $grid) { |
|||
$grid->model()->where(['bidding_user_id' => Admin::user()->id,'bidding_user_type' => DemandTraits::$col[2]]); |
|||
$grid->column('id')->sortable(); |
|||
$grid->column('price'); |
|||
$grid->column('comment'); |
|||
$grid->column('demand.title','竞拍标题'); |
|||
$grid->column('demand.comment','竞拍内容'); |
|||
$grid->column('state','状态')->using(DemandTraits::$biddingState)->dot( |
|||
[ |
|||
'yellow', |
|||
'success', |
|||
'danger', |
|||
] |
|||
); |
|||
$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->disableEditingCheck(); |
|||
$form->disableCreatingCheck(); |
|||
$form->disableViewCheck(); |
|||
$form->display('id'); |
|||
$form->text('price'); |
|||
$form->textarea('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 = DemandTraits::$col[2]; |
|||
$form->bidding_user_id = Admin::user()->id; |
|||
} |
|||
$form->response()->success('操作成功')->redirect('demand_bidding'); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,213 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminGuide\Controllers; |
|||
|
|||
use App\AdminAgent\Actions\Grid\DemandConfirm; |
|||
use App\AdminAgent\Lazys\DemandBiddingLazys; |
|||
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) { |
|||
if (\request('self',0)) { |
|||
$grid->model()->where(['publisher_id' => Admin::user()->id,'publisher_type' => DemandTraits::$col[2]]); |
|||
} |
|||
$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->setActionClass(Grid\Displayers\Actions::class);
|
|||
//
|
|||
//$grid->actions(function (Grid\Displayers\Actions $actions) {
|
|||
// $actions->append(new DemandConfirm(1));
|
|||
//});
|
|||
|
|||
|
|||
if (\request('self',0)) { |
|||
$grid->column('bidding','竞标明细') |
|||
->display(function (){ |
|||
return '竞标数 : '. DemandBidding::query()->where('demand_id',$this->id)->count(); |
|||
}) |
|||
->modal('竞标明细',function () { |
|||
return DemandBiddingLazys::make(['demand_id' => $this->id]); |
|||
}); |
|||
}else{ |
|||
$grid->column('bidding','竞标') |
|||
->if(function (){ |
|||
return $this->state == 1 && $this->bidding_user_type == DemandTraits::$col[2]; |
|||
}) |
|||
->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('demand_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->demand_product_id = 0; |
|||
} |
|||
$form->bidding_user_type = DemandTraits::$col[$form->bidding_user_type]; |
|||
//处理流拍时间
|
|||
$form->deadline = now()->addDays(5); |
|||
//发布人身份
|
|||
$form->publisher_type = DemandTraits::$col[2]; |
|||
$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 { |
|||
$demandBidding->state = 1; |
|||
$demandBidding->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,79 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminGuide\Controllers; |
|||
|
|||
use App\AdminAgent\Actions\Grid\DemandConfirm; |
|||
use App\AdminAgent\Lazys\DemandBiddingLazys; |
|||
use App\Common\ProductStatus; |
|||
use App\Models\AgentProduct; |
|||
use App\Models\Channel; |
|||
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 MyDemandProductController extends AdminController |
|||
{ |
|||
|
|||
use ResponseHelper; |
|||
/** |
|||
* Make a grid builder. |
|||
* |
|||
* @return Grid |
|||
*/ |
|||
protected function grid() |
|||
{ |
|||
return Grid::make(new Demand(['publisher','biddingUser','agentProduct.category']), function (Grid $grid) { |
|||
|
|||
$grid->model() |
|||
->where(['bidding_user_id' => Admin::user()->id,'bidding_user_type' => DemandTraits::$col[2]]) |
|||
->where('agent_product_id','>',0); |
|||
|
|||
$grid->column('id')->sortable(); |
|||
//$grid->column('title');
|
|||
//$grid->column('detail','内容')->display('查看')->modal('详情',function ($modal) {
|
|||
// $modal->xl();
|
|||
// return $this->comment;
|
|||
//});
|
|||
$grid->column('agentProduct.picture', '产品图片')->image('', 60, 60); |
|||
$grid->column('agentProduct.title', '产品名称')->limit(15); |
|||
$grid->column('agentProduct.price','产品价格'); |
|||
$grid->column('agentProduct.original_price','产品原价'); |
|||
$grid->column('agentProduct.sale','产品销量'); |
|||
$grid->column('agentProduct.stock','产品库存'); |
|||
|
|||
$grid->column('channel_id', '频道') |
|||
->display(function ($modal) { |
|||
|
|||
$channels = Channel::where('agent_id', $this->publisher_id)->pluck('name', 'id')->toArray(); |
|||
|
|||
$data = array_flip(explode(',', $this->channel_id)); |
|||
return join(',',array_intersect_key($channels, $data)); |
|||
}) |
|||
->limit(10); |
|||
$grid->column('agentProduct.category.name', '分类'); |
|||
$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); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminGuide\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\AdminGuide\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,172 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminSupplier\Controllers; |
|||
|
|||
use App\AdminSupplier\Renderable\SelectProduct; |
|||
use App\AdminSupplier\Repositories\DemandBidding; |
|||
use App\Models\AgentProduct; |
|||
use App\Models\AgentProductItem; |
|||
use App\Models\Demand; |
|||
use App\Models\DemandProduct; |
|||
use App\Models\Product; |
|||
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 Illuminate\Database\Eloquent\Model; |
|||
use Illuminate\Support\Arr; |
|||
use Illuminate\Support\Facades\DB; |
|||
use Illuminate\Support\Facades\Log; |
|||
|
|||
class DemandBiddingController extends AdminController |
|||
{ |
|||
/** |
|||
* Make a grid builder. |
|||
* |
|||
* @return Grid |
|||
*/ |
|||
protected function grid() |
|||
{ |
|||
return Grid::make(new DemandBidding(['demand']), function (Grid $grid) { |
|||
$grid->model()->where(['bidding_user_id' => Admin::user()->id,'bidding_user_type' => DemandTraits::$col[1]]); |
|||
$grid->column('id')->sortable(); |
|||
$grid->column('price'); |
|||
$grid->column('comment'); |
|||
$grid->column('demand.title','竞拍标题'); |
|||
$grid->column('demand.comment','竞拍内容'); |
|||
$grid->column('state','状态')->using(DemandTraits::$biddingState)->dot( |
|||
[ |
|||
'yellow', |
|||
'success', |
|||
'danger', |
|||
] |
|||
); |
|||
$grid->column('bidding','操作') |
|||
->if(function (){ |
|||
return $this->state == 1 && $this->bidding_user_type == DemandTraits::$col[1] && empty($this->demand->demand_product_id); |
|||
}) |
|||
->then(function (Grid\Column $column) { |
|||
$column->append('<a class="btn btn-sm btn-success" href="'.admin_url('/demand_bidding/'.$this->id.'/edit?is_bidding=true').'">绑定产品</a>'); |
|||
}) |
|||
->if(function (){ |
|||
return $this->state == 1 && $this->bidding_user_type == DemandTraits::$col[1] && !empty($this->demand->demand_product_id); |
|||
}) |
|||
->then(function (Grid\Column $column) { |
|||
$column->append('<a class="btn btn-sm btn-primary" href="'.admin_url('/demand_product/'.$this->demand->demand_product_id).'">查看产品</a>'); |
|||
}); |
|||
$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->disableEditingCheck(); |
|||
$form->disableCreatingCheck(); |
|||
$form->disableDeleteButton(); |
|||
$form->disableViewButton(); |
|||
$form->disableViewCheck(); |
|||
$form->display('id')->disable(); |
|||
if(request('is_bidding',0)) { |
|||
$form->textarea('comment')->disable(); |
|||
$form->selectTable('demand_product_id', '产品') |
|||
->title('选择产品') |
|||
->dialogWidth('50%;min-width:600px;') //不起作用
|
|||
->from(SelectProduct::make()) |
|||
->model(DemandProduct::class, 'id', 'title'); |
|||
}else{ |
|||
$form->text('price'); |
|||
$form->textarea('comment'); |
|||
} |
|||
$form->hidden('demand_id')->value(request('demand_id',0)); |
|||
$form->hidden('bidding_user_type')->disable(); |
|||
$form->hidden('bidding_user_id')->disable(); |
|||
$form->saving(function (Form $form) { |
|||
$form->deleteInput('demand_product_id'); |
|||
//发布人身份
|
|||
$form->bidding_user_type = DemandTraits::$col[1]; |
|||
$form->bidding_user_id = Admin::user()->id; |
|||
}); |
|||
|
|||
$form->saved(function (Form $form) { |
|||
if($form->isEditing()) { |
|||
$productId = request('demand_product_id', 0); |
|||
if (!empty($productId)) { |
|||
DB::beginTransaction(); |
|||
try { |
|||
//处理订单
|
|||
//将产品绑给代理商
|
|||
$demand = Demand::find($form->model()->demand_id); |
|||
$demand->demand_product_id = $productId; |
|||
|
|||
|
|||
$demandProduct = DemandProduct::find($productId); |
|||
$product = new Product(); |
|||
|
|||
$product->supplier_id = $demandProduct->supplier_id; |
|||
$product->category_id = $demandProduct->category_id; |
|||
$product->title = $demandProduct->title; |
|||
$product->price = $form->model()->price; |
|||
$product->original_price = $form->model()->price; |
|||
$product->pictures = $demandProduct->pictures; |
|||
$product->stock = $demand->stock; |
|||
$product->know = $demandProduct->know; |
|||
$product->content = $demandProduct->content; |
|||
$product->agent_id = $form->model()->bidding_user_id; |
|||
$product->save(); |
|||
//处理需求
|
|||
$demand = Demand::find($form->model()->demand_id); |
|||
$demand->demand_product_id = $productId; |
|||
$demand->save(); |
|||
|
|||
$demand->product_id = $product->id; |
|||
$demand->save(); |
|||
DB::commit(); |
|||
} catch (\Exception $e) { |
|||
Log::error('分配订单失败::' . $e->getTraceAsString()); |
|||
DB::rollBack(); |
|||
return $form->response()->error('分配订单失败,稍后重试或联系管理员!' . $e->getMessage()); |
|||
} |
|||
} |
|||
} |
|||
$form->response()->success('操作成功')->redirect('demand_bidding'); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,225 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminSupplier\Controllers; |
|||
|
|||
use App\AdminAgent\Lazys\DemandBiddingLazys; |
|||
use App\Models\AgentProduct; |
|||
use App\Models\DemandProduct; |
|||
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) { |
|||
if (\request('self',0)) { |
|||
$grid->model()->where(['publisher_id' => Admin::user()->id,'publisher_type' => DemandTraits::$col[1]]); |
|||
} |
|||
$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', |
|||
] |
|||
); |
|||
|
|||
if (\request('self',0)) { |
|||
$grid->column('bidding','竞标明细') |
|||
->display(function (){ |
|||
return '竞标数 : '. DemandBidding::query()->where('demand_id',$this->id)->count(); |
|||
}) |
|||
->modal('竞标明细',function () { |
|||
return DemandBiddingLazys::make(['demand_id' => $this->id]); |
|||
}); |
|||
}else{ |
|||
$grid->column('bidding','竞标') |
|||
->if(function (){ |
|||
return $this->state == 1 && $this->bidding_user_type == DemandTraits::$col[1]; |
|||
}) |
|||
->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([0],function (Form $form){ |
|||
$form->select('demand_product_id','产品')->options(function (){ |
|||
return DemandProduct::query()->where('supplier_id',Admin::user()->id)->where('status',1)->pluck('title','id'); |
|||
}); |
|||
}) |
|||
->options([ |
|||
'代理商' |
|||
]) |
|||
->default(0); |
|||
$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->demand_product_id = 0;
|
|||
//}
|
|||
$form->bidding_user_type = DemandTraits::$col[$form->bidding_user_type]; |
|||
//处理流拍时间
|
|||
$form->deadline = now()->addDays(5); |
|||
//发布人身份
|
|||
$form->publisher_type = DemandTraits::$col[1]; |
|||
$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 { |
|||
|
|||
$demandBidding->state = 1; |
|||
$demandBidding->save(); |
|||
//改变订单状态
|
|||
$demand->bidding_id = $demandBidding->id; |
|||
$demand->bidding_user_id = $demandBidding->bidding_user_id; |
|||
$demand->state = DemandTraits::$stateKey[1]; |
|||
$demand->save(); |
|||
//将产品绑给代理商
|
|||
$demandProduct = DemandProduct::find($demand->demand_product_id); |
|||
$product = new Product(); |
|||
|
|||
$product->supplier_id = $demandProduct->supplier_id; |
|||
$product->category_id = $demandProduct->category_id; |
|||
$product->title = $demandProduct->title; |
|||
$product->price = $demandBidding->price; |
|||
$product->original_price = $demandBidding->price; |
|||
$product->pictures = $demandProduct->pictures; |
|||
$product->stock = $demand->stock; |
|||
$product->know = $demandProduct->know; |
|||
$product->content = $demandProduct->content; |
|||
$product->agent_id = $demandBidding->bidding_user_id; |
|||
$product->save(); |
|||
|
|||
$demand->product_id = $product->id; |
|||
$demand->save(); |
|||
DB::commit(); |
|||
} catch (\Exception $e) { |
|||
Log::error('选中竞标失败::'.$e->getTraceAsString()); |
|||
DB::rollBack(); |
|||
return $this->jsonFail(1001,'选中竞标失败,稍后重试或联系管理员!'.$e->getMessage()); |
|||
} |
|||
return back(); |
|||
} |
|||
} |
|||
@ -0,0 +1,139 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminSupplier\Controllers; |
|||
|
|||
use App\AdminSupplier\Repositories\DemandProduct; |
|||
use App\Common\ProductStatus; |
|||
use App\Models\AgentProduct; |
|||
use App\Models\Category; |
|||
use Dcat\Admin\Admin; |
|||
use Dcat\Admin\Form; |
|||
use Dcat\Admin\Grid; |
|||
use Dcat\Admin\Repositories\EloquentRepository; |
|||
use Dcat\Admin\Show; |
|||
use Dcat\Admin\Http\Controllers\AdminController; |
|||
use Illuminate\Support\Facades\DB; |
|||
|
|||
class DemandProductController extends AdminController |
|||
{ |
|||
protected $title = '产品'; |
|||
/** |
|||
* Make a grid builder. |
|||
* |
|||
* @return Grid |
|||
*/ |
|||
protected function grid() |
|||
{ |
|||
return Grid::make(new DemandProduct(['category:id,name']), function (Grid $grid) { |
|||
$grid->model()->where('supplier_id', Admin::user()->id); |
|||
|
|||
$grid->column('id')->sortable(); |
|||
$grid->column('category.name', '产品分类'); |
|||
$grid->column('title'); |
|||
$grid->column('picture')->image('', 60, 60); |
|||
//$grid->column('price');
|
|||
//$grid->column('original_price');
|
|||
//$grid->column('stock');
|
|||
$grid->column('sale'); |
|||
$grid->column('status')->using(ProductStatus::array()); |
|||
$grid->column('created_at'); |
|||
$grid->column('updated_at'); |
|||
|
|||
$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 DemandProduct(), function (Show $show) { |
|||
$show->field('id'); |
|||
$show->field('supplier_id'); |
|||
$show->field('category_id'); |
|||
$show->field('title'); |
|||
//$show->field('price');
|
|||
//$show->field('original_price');
|
|||
$show->field('pictures')->image('', 80, 80); |
|||
//$show->field('stock');
|
|||
$show->field('sale'); |
|||
$show->field('status'); |
|||
$show->field('know')->unescape()->as(fn($v) => preg_replace('/<script.*?>.*?<\/script>/is', '', $v)); |
|||
$show->field('content')->unescape()->as(fn($v) => preg_replace('/<script.*?>.*?<\/script>/is', '', $v)); |
|||
$show->field('created_at'); |
|||
$show->field('updated_at'); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Make a form builder. |
|||
* |
|||
* @return Form |
|||
*/ |
|||
protected function form() |
|||
{ |
|||
return Form::make(new DemandProduct(), function (Form $form) { |
|||
//不允许编辑非自己数据
|
|||
if ($form->isEditing() && $form->model()->supplier_id != Admin::user()->id) { |
|||
return $form->response()->error('数据不存在'); |
|||
} |
|||
|
|||
$form->display('id'); |
|||
|
|||
$options = Category::selectOptions(fn($query) => $query->where('agent_id', 0)); |
|||
$form->select('category_id')->options(array_slice($options, 1, null, true))->required(); |
|||
$form->text('title')->required(); |
|||
//$form->text('price')->required();
|
|||
//$form->text('original_price')->required();
|
|||
$form->multipleImage('pictures')->required()->removable(false)->retainable()->uniqueName(); |
|||
//$form->text('stock')->default(9999)->required();
|
|||
$form->editor('know'); |
|||
$form->editor('content')->required(); |
|||
|
|||
if ($form->isEditing()) { |
|||
$form->confirm('提示', '编辑产品需要重新审核,同时<span class="btn-danger">下架所有</span>关联的代理商产品,是否继续?'); |
|||
} |
|||
})->saving(function (Form $form) { |
|||
//不允许编辑非自己数据
|
|||
if ($form->isEditing() && $form->model()->supplier_id != Admin::user()->id) { |
|||
return $form->response()->error('数据不存在'); |
|||
} |
|||
|
|||
//不允许编辑的字段 TODO 忽略字段不起作用
|
|||
$form->ignore(['id', 'supplier_id', 'sale', 'status', 'created_at', 'updated_at', 'deleted_at']); |
|||
|
|||
//null字段转为''
|
|||
foreach ($form->input() as $k => $v) { |
|||
if (is_null($v)) { |
|||
$form->$k = ''; |
|||
} |
|||
} |
|||
|
|||
//特殊字段处理
|
|||
$form->hidden(['status', 'supplier_id']); //表单没有的字段,必须加上这句才能重置值
|
|||
$form->status = ProductStatus::UNAUDITED; |
|||
$form->supplier_id = Admin::user()->id; |
|||
})->saved(function (Form $form, $result) { |
|||
//下架代理商产品
|
|||
if ($result) { |
|||
$id = $form->getKey(); |
|||
AgentProduct::where('product_id', $id) |
|||
->orWhere(DB::raw('FIND_IN_SET(' . $id . ', product_ids)')) //TODO product_ids字段可能会去掉
|
|||
->update(['status' => ProductStatus::SOLD_OUT]); |
|||
} |
|||
})->deleting(function (Form $form) { |
|||
//不允许删除非自己的数据
|
|||
if (array_filter($form->model()->toArray(), fn($v) => $v['supplier_id'] != Admin::user()->id)) { |
|||
return $form->response()->error('数据不存在'); |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,71 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminSupplier\Controllers; |
|||
|
|||
use App\AdminAgent\Actions\Grid\DemandConfirm; |
|||
use App\AdminAgent\Lazys\DemandBiddingLazys; |
|||
use App\Common\ProductStatus; |
|||
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 MyDemandProductController extends AdminController |
|||
{ |
|||
|
|||
use ResponseHelper; |
|||
/** |
|||
* Make a grid builder. |
|||
* |
|||
* @return Grid |
|||
*/ |
|||
protected function grid() |
|||
{ |
|||
return Grid::make(new Demand(['publisher','biddingUser','product.category']), function (Grid $grid) { |
|||
|
|||
$grid->model() |
|||
->where(['bidding_user_id' => Admin::user()->id,'bidding_user_type' => DemandTraits::$col[1]]) |
|||
->where('product_id','>',0); |
|||
|
|||
$grid->column('id')->sortable(); |
|||
//$grid->column('title');
|
|||
//$grid->column('detail','内容')->display('查看')->modal('详情',function ($modal) {
|
|||
// $modal->xl();
|
|||
// return $this->comment;
|
|||
//});
|
|||
$grid->column('biddingUser.name','中标人'); |
|||
$grid->column('price','发标价格'); |
|||
$grid->column('product.category.name', '产品分类'); |
|||
$grid->column('product.title','产品标题'); |
|||
$grid->column('product.picture','产品图片')->image('', 60, 60); |
|||
$grid->column('product.price','产品售价'); |
|||
$grid->column('product.original_price','产品原价'); |
|||
$grid->column('product.stock','产品库存'); |
|||
$grid->column('product.sale','产品销量'); |
|||
$grid->column('product.status','产品状态')->using(ProductStatus::array()); |
|||
$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); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminSupplier\Renderable; |
|||
use App\Common\ProductStatus; |
|||
use App\AdminAgent\Repositories\Product; |
|||
use App\Models\DemandProduct; |
|||
use Dcat\Admin\Admin; |
|||
use Dcat\Admin\Grid; |
|||
use Dcat\Admin\Grid\LazyRenderable; |
|||
|
|||
/** |
|||
* 选择产品 |
|||
* Class SelectProduct |
|||
* @package App\AdminAgent\Renderable |
|||
*/ |
|||
class SelectProduct extends LazyRenderable |
|||
{ |
|||
public function grid(): Grid |
|||
{ |
|||
// 获取外部传递的参数
|
|||
// $id = $this->id;
|
|||
Admin::translation('product'); |
|||
return Grid::make(new DemandProduct(['supplier:id,name']), function (Grid $grid) { |
|||
$grid->disableActions(); |
|||
$grid->disableBatchDelete(); |
|||
$grid->disableBatchActions(); |
|||
|
|||
//$grid->model()->where('status', ProductStatus::ON_SALE);
|
|||
$grid->model()->where('supplier_id',Admin::user()->id); |
|||
$grid->quickSearch(['title', 'supplier.name'])->placeholder('搜索产品名称、供应商'); |
|||
|
|||
$grid->column('id'); |
|||
$grid->column('supplier.name', '供应商'); |
|||
$grid->column('title'); |
|||
$grid->column('picture')->image('',60, 60); |
|||
$grid->column('sale'); |
|||
$grid->column('updated_at'); |
|||
|
|||
$grid->paginate(15); |
|||
|
|||
$grid->filter(function (Grid\Filter $filter) { |
|||
$filter->like('title')->width(4); |
|||
$filter->like('supplier.name', '供应商名称')->width(4); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminSupplier\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\AdminSupplier\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,16 @@ |
|||
<?php |
|||
|
|||
namespace App\AdminSupplier\Repositories; |
|||
|
|||
use App\Models\DemandProduct as Model; |
|||
use Dcat\Admin\Repositories\EloquentRepository; |
|||
|
|||
class DemandProduct extends EloquentRepository |
|||
{ |
|||
/** |
|||
* Model. |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $eloquentClass = Model::class; |
|||
} |
|||
@ -0,0 +1,52 @@ |
|||
<?php |
|||
|
|||
namespace App\Models; |
|||
|
|||
use Dcat\Admin\Traits\HasDateTimeFormatter; |
|||
use Illuminate\Database\Eloquent\Factories\HasFactory; |
|||
use Illuminate\Database\Eloquent\SoftDeletes; |
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class DemandProduct extends Model |
|||
{ |
|||
use HasDateTimeFormatter; |
|||
use SoftDeletes; |
|||
|
|||
protected $table = 'demand_products'; |
|||
use HasFactory, SoftDeletes; |
|||
|
|||
protected $guarded = ['id']; //不允许编辑的字段
|
|||
|
|||
// 获取所有产品图片
|
|||
public function getPicturesAttribute($value): array |
|||
{ |
|||
if (is_string($value)) { |
|||
$value = $value ? json_decode($value, true) : []; |
|||
} |
|||
$this->append('picture'); |
|||
return $value ?? []; |
|||
} |
|||
|
|||
// 获取第一张产品图片
|
|||
public function getPictureAttribute($value): string |
|||
{ |
|||
return $this->pictures[0] ?? ''; |
|||
} |
|||
|
|||
public function setPicturesAttribute($value) |
|||
{ |
|||
if (is_array($value)) { |
|||
$this->attributes['pictures'] = json_encode(array_filter($value)); |
|||
} |
|||
} |
|||
|
|||
public function supplier() |
|||
{ |
|||
return $this->belongsTo(Supplier::class); |
|||
} |
|||
|
|||
public function category() |
|||
{ |
|||
return $this->belongsTo(Category::class); |
|||
} |
|||
} |
|||
@ -0,0 +1,50 @@ |
|||
<?php |
|||
|
|||
namespace App\Providers; |
|||
|
|||
use App\Models\Demand; |
|||
use App\Models\DemandBidding; |
|||
use App\Service\SmsService; |
|||
use App\Traits\DemandTraits; |
|||
use Illuminate\Support\Facades\Log; |
|||
use Illuminate\Support\ServiceProvider; |
|||
|
|||
class DemandBiddingServiceProvider extends ServiceProvider |
|||
{ |
|||
/** |
|||
* Register services. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function register() |
|||
{ |
|||
//
|
|||
} |
|||
|
|||
/** |
|||
* Bootstrap services. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function boot() |
|||
{ |
|||
//DemandBidding::created(function ($order) {
|
|||
// $demand = Demand::query()->with(['publisher'])->where('id',$order->demand_id)->first();
|
|||
// if(!empty($demand->publisher->contact_phone)) {
|
|||
// $sms = new SmsService();
|
|||
// $sms->send('bidding',[$order->biddingUser->name,$demand->id,DemandTraits::$polymorphic[$demand->publisher_type]],[$demand->publisher->contact_phone]);
|
|||
// }
|
|||
//});
|
|||
//
|
|||
//
|
|||
//Demand::updated(function ($demand) {
|
|||
// //如果状态改变了
|
|||
// if($demand->isDirty('bidding_id')) {
|
|||
// if(!empty($demand->publisher->contact_phone)) {
|
|||
// $sms = new SmsService();
|
|||
// $sms->send('bidding',[$demand->publisher->name,$demand->id,DemandTraits::$polymorphic[$demand->bidding_user_type]],[$demand->biddingUser->contact_phone]);
|
|||
// }
|
|||
// }
|
|||
//});
|
|||
} |
|||
} |
|||
@ -0,0 +1,115 @@ |
|||
<?php |
|||
|
|||
namespace App\Service; |
|||
use \Illuminate\Support\Facades\Log; |
|||
|
|||
use TencentCloud\Sms\V20210111\SmsClient; |
|||
use TencentCloud\Sms\V20210111\Models\SendSmsRequest; |
|||
use TencentCloud\Common\Exception\TencentCloudSDKException; |
|||
use TencentCloud\Common\Credential; |
|||
use TencentCloud\Common\Profile\ClientProfile; |
|||
use TencentCloud\Common\Profile\HttpProfile; |
|||
|
|||
class SmsService |
|||
{ |
|||
|
|||
private $client; |
|||
private $cfg; |
|||
|
|||
function __construct() |
|||
{ |
|||
/* 必要步骤: |
|||
* 实例化一个认证对象,入参需要传入腾讯云账户密钥对 secretId,secretKey。 |
|||
* 这里采用的是从环境变量读取的方式,需要在环境变量中先设置这两个值。 |
|||
* 你也可以直接在代码中写死密钥对,但是小心不要将代码复制、上传或者分享给他人, |
|||
* 以免泄露密钥对危及你的财产安全。 |
|||
* CAM密匙查询: https://console.cloud.tencent.com/cam/capi |
|||
*/ |
|||
$this->cfg = config('sms.tencent'); |
|||
$cred = new Credential($this->cfg['secret_id'], $this->cfg['secret_key']); |
|||
// $cred = new Credential(getenv("TENCENTCLOUD_SECRET_ID"), getenv("TENCENTCLOUD_SECRET_KEY"));
|
|||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
|||
$httpProfile = new HttpProfile(); |
|||
// 配置代理
|
|||
// $httpProfile->setProxy("https://ip:port");
|
|||
$httpProfile->setReqMethod("GET"); // post请求(默认为post请求)
|
|||
$httpProfile->setReqTimeout(30); // 请求超时时间,单位为秒(默认60秒)
|
|||
$httpProfile->setEndpoint("sms.tencentcloudapi.com"); // 指定接入地域域名(默认就近接入)
|
|||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
|||
$clientProfile = new ClientProfile(); |
|||
$clientProfile->setSignMethod("TC3-HMAC-SHA256"); // 指定签名算法(默认为HmacSHA256)
|
|||
$clientProfile->setHttpProfile($httpProfile); |
|||
// 实例化要请求产品(以sms为例)的client对象,clientProfile是可选的
|
|||
// 第二个参数是地域信息,可以直接填写字符串 ap-guangzhou,或者引用预设的常量
|
|||
$this->client = new SmsClient($cred, 'ap-guangzhou', $clientProfile); |
|||
} |
|||
|
|||
public function send($templateId, $templateParamSet, $phoneNumberSet, $signName = '领峰远扬') |
|||
{ |
|||
//if (!config('sms.debug') || config('sms.debug') == 'yes') {
|
|||
// Log::debug([$templateId, $templateParamSet, $phoneNumberSet, $signName]);
|
|||
// return true;
|
|||
//}
|
|||
foreach ($phoneNumberSet as $key => $phone) { |
|||
if (!$phoneNumberSet[$key]) { |
|||
unset($phoneNumberSet[$key]); |
|||
} else { |
|||
$phoneNumberSet[$key] = '+86' . $phoneNumberSet[$key]; |
|||
} |
|||
} |
|||
if (count($phoneNumberSet) == 0) { |
|||
return true; |
|||
} |
|||
if (!$signName) { |
|||
$signName = $this->cfg['sign_name']; |
|||
} |
|||
try { |
|||
// 实例化一个 sms 发送短信请求对象,每个接口都会对应一个request对象。
|
|||
$req = new SendSmsRequest(); |
|||
/* 填充请求参数,这里request对象的成员变量即对应接口的入参 |
|||
* 你可以通过官网接口文档或跳转到request对象的定义处查看请求参数的定义 |
|||
* 基本类型的设置: |
|||
* 帮助链接: |
|||
* 短信控制台: https://console.cloud.tencent.com/smsv2 |
|||
* sms helper: https://cloud.tencent.com/document/product/382/3773 |
|||
*/ |
|||
/* |
|||
* 短信应用ID: 短信SdkAppId在 [短信控制台] 添加应用后生成的实际SdkAppId,示例如1400006666 |
|||
*/ |
|||
$req->SmsSdkAppId = $this->cfg['sms_sdk_app_id']; |
|||
/* 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名,签名信息可登录 [短信控制台] 查看 */ |
|||
$req->SignName = $signName; |
|||
/* 短信码号扩展号: 默认未开通,如需开通请联系 [sms helper] */ |
|||
$req->ExtendCode = ""; |
|||
/* |
|||
下发手机号码,采用 E.164 标准,+[国家或地区码][手机号] |
|||
* 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号 |
|||
*/ |
|||
$req->PhoneNumberSet = $phoneNumberSet; |
|||
/* 国际/港澳台短信 SenderId: 国内短信填空,默认未开通,如需开通请联系 [sms helper] */ |
|||
$req->SenderId = ""; |
|||
/* 用户的 session 内容: 可以携带用户侧 ID 等上下文信息,server 会原样返回 */ |
|||
$req->SessionContext = "xxx"; |
|||
/* 模板 ID: 必须填写已审核通过的模板 ID。模板ID可登录 [短信控制台] 查看 */ |
|||
$req->TemplateId = $this->cfg['templates'][$templateId]; |
|||
/* 模板参数: 若无模板参数,则设置为空*/ |
|||
$req->TemplateParamSet = $templateParamSet; |
|||
// 通过client对象调用SendSms方法发起请求。注意请求方法名与请求对象是对应的
|
|||
// 返回的resp是一个SendSmsResponse类的实例,与请求对象对应
|
|||
$resp = $this->client->SendSms($req); |
|||
// 输出json格式的字符串回包
|
|||
$res = json_decode($resp->toJsonString()); |
|||
foreach ($res->SendStatusSet as $item) { |
|||
if ($item->Code != 'Ok') { |
|||
$tpl = $this->cfg['templates'][$templateId]; |
|||
$param = json_encode($templateParamSet); |
|||
Log::error("SMS ERROR $item->Code[$tpl:$item->PhoneNumber:$param]$item->Message"); |
|||
} |
|||
} |
|||
return True; |
|||
} catch (TencentCloudSDKException $e) { |
|||
Log::error($e); |
|||
} |
|||
return 0; |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<?php |
|||
|
|||
return [ |
|||
'sender' => \App\Libraries\Sms\Tencent::class, |
|||
'type' => 'tencent', |
|||
//'debug' => env('SMS_DEBUG'),
|
|||
'tencent' => [ |
|||
'sms_sdk_app_id'=> env('SMS_SDK_APP_ID'), |
|||
'secret_id' => env('SECRET_ID'), |
|||
'secret_key' => env('SECRET_KEY'), |
|||
'sign_name' => '领峰远扬', |
|||
'templates' => [ |
|||
'bidding' => '1100494' //{1}参与了您发起的竞标{2},详情请登录{3}查看。
|
|||
] |
|||
] |
|||
]; |
|||
@ -0,0 +1,25 @@ |
|||
<?php |
|||
return [ |
|||
'labels' => [ |
|||
'DemandProduct' => '需求市场产品', |
|||
'demand-product' => '需求市场产品', |
|||
'demand' => '需求市场', |
|||
'product' => '产品', |
|||
], |
|||
'fields' => [ |
|||
'agent_id' => '代理商id 竞标特供', |
|||
'category_id' => '产品分类ID', |
|||
'content' => '产品详情', |
|||
'know' => '旅客须知', |
|||
'original_price' => '原价', |
|||
'picture' => '产品图片', |
|||
'price' => '价格', |
|||
'sale' => '销量', |
|||
'status' => '状态', |
|||
'stock' => '库存量', |
|||
'supplier_id' => '供应商ID', |
|||
'title' => '标题', |
|||
], |
|||
'options' => [ |
|||
], |
|||
]; |
|||
@ -0,0 +1,21 @@ |
|||
<?php |
|||
return [ |
|||
'labels' => [ |
|||
'MyDemandProduct' => '我的竞标产品库', |
|||
'my_demand_product' => '我的竞标产品库', |
|||
], |
|||
'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