Browse Source

CLUSTER和OPERATOR互换

master
李可松 4 years ago
parent
commit
2f45e9949a
  1. 2
      app/Admin/Controllers/AgentController.php
  2. 2
      app/Admin/Controllers/MiniProgramController.php
  3. 4
      app/Admin/Extensions/Grid/AuditAgent.php
  4. 14
      app/AdminAgent/Controllers/AgentProductController.php
  5. 2
      app/AdminAgent/Controllers/DemandController.php
  6. 2
      app/AdminAgent/Controllers/WorkorderController.php
  7. 2
      app/AdminGuide/Controllers/WorkorderController.php
  8. 4
      app/AdminSettled/Controllers/AgentController.php
  9. 4
      app/AdminSupplier/Metrics/Examples/NewDevices.php
  10. 12
      app/Common/AgentType.php
  11. 2
      app/Providers/ProductServiceProvider.php

2
app/Admin/Controllers/AgentController.php

@ -158,7 +158,7 @@ class AgentController extends AdminController
->required();
$form->radio('type')
->options(AgentType::array())
->default(AgentType::OPERATOR)
->default(AgentType::CLUSTER)
->required();
$form->text('company_name')->required()->help('请正确填写,保持跟营业执照上的完全一致,如:海南易游天下供应链有限公司');
$form->text('credit_codes')->required()->help('请正确填写,保持跟营业执照上的完全一致,如:91440300577652919M');

2
app/Admin/Controllers/MiniProgramController.php

@ -31,7 +31,7 @@ class MiniProgramController extends AdminController
$grid->disableActions();
$grid->model()
->whereIn('type', [AgentType::OPERATOR, AgentType::SUPPLIER])
->whereIn('type', [AgentType::CLUSTER, AgentType::SUPPLIER])
->where([['status', '=', UserStatus::NORMAL], ['id', '>', 1]]); //隐藏ID=1的领峰云管理员
$grid->tools(new MiniProgramPull('更新小程序模板'));

4
app/Admin/Extensions/Grid/AuditAgent.php

@ -113,8 +113,8 @@ class AuditAgent extends RowAction
if ($user->status == UserStatus::NORMAL) {
$roleArr = [
AgentType::SUPPLIER => 2, //供应商旅行社,对应后台的角色role_id
AgentType::CLUSTER => 3, //计调旅行社,对应后台的角色role_id
AgentType::OPERATOR => 4, //组团旅行社,对应后台的角色role_id
AgentType::OPERATOR => 3, //计调旅行社,对应后台的角色role_id
AgentType::CLUSTER => 4, //组团旅行社,对应后台的角色role_id
];
DB::table(config('admin-agent.database.role_users_table'))
->insertOrIgnore(['role_id' => $roleArr[$user->type], 'user_id' => $this->getKey()]);

14
app/AdminAgent/Controllers/AgentProductController.php

@ -90,7 +90,7 @@ class AgentProductController extends AdminController
ProductStatus::REFUSE => 'danger',
ProductStatus::SOLD_OUT => 'warning',
], 'primary');
if (Admin::user()->type != AgentType::CLUSTER) {
if (Admin::user()->type != AgentType::OPERATOR) {
$grid->column('is_rec')->switch()->help('推荐后将在“我的”页面下方显示');
}
$grid->column('updated_at');
@ -134,14 +134,14 @@ class AgentProductController extends AdminController
$show->field('stock');
$show->field('category.name', '分类');
$show->field('status')->using(ProductStatus::array());
if (Admin::user()->type == AgentType::CLUSTER) {
if (Admin::user()->type == AgentType::OPERATOR) {
$show->field('guide.name', '地接');
}
$show->field('title');
$show->field('pictures')->image('', 80, 80);
$show->field('know')->unescape();
$show->field('content')->unescape();
if (Admin::user()->type != AgentType::CLUSTER) {
if (Admin::user()->type != AgentType::OPERATOR) {
$show->field('is_rec')->using(['未推荐', '已推荐']);
$show->field('channel_id')->as(fn($v) => join(',', Channel::whereIn('id', explode(',', $v))->pluck('name')->toArray()));
$show->field('earnest');
@ -171,7 +171,7 @@ class AgentProductController extends AdminController
$form->display('id');
//计调版旅行社不允许选择计调云产品
if (Admin::user()->type == AgentType::CLUSTER) {
if (Admin::user()->type == AgentType::OPERATOR) {
$form->hidden('product_id')->value(0)->default(0);
$form->hidden('type')->value(1)->default(1);
// 组合销售
@ -249,7 +249,7 @@ class AgentProductController extends AdminController
/*$form->radio('type')
->options(['单品销售'])
->default(Admin::user()->type == AgentType::CLUSTER ? 1 : 0)->required()
->default(Admin::user()->type == AgentType::OPERATOR ? 1 : 0)->required()
//->help('单品销售无需审核,组合销售需要审核才能上架')
->help('单品销售无需审核')
->when(0, function (Form $form) {
@ -318,7 +318,7 @@ class AgentProductController extends AdminController
// ->required();
//计调版旅行社可以选择地接
if (Admin::user()->type == AgentType::CLUSTER) {
if (Admin::user()->type == AgentType::OPERATOR) {
$form->selectTable('guide_id', '地接人员')
->title('选择地接人员')
->dialogWidth('50%;min-width:600px;') //不起作用
@ -485,7 +485,7 @@ class AgentProductController extends AdminController
}
//如果是计调版旅行社,标记为是云产品
if (Admin::user()->type == AgentType::CLUSTER) {
if (Admin::user()->type == AgentType::OPERATOR) {
$form->hidden('is_cloud');
$form->is_cloud = 1;
}

2
app/AdminAgent/Controllers/DemandController.php

@ -173,7 +173,7 @@ class DemandController extends AdminController
return json_encode($path);
});
$form->hidden('deadline');
if (Admin::user()->type == AgentType::CLUSTER) {
if (Admin::user()->type == AgentType::OPERATOR) {
$form->select('bidding_user_type', '竞标用户类型')
->when([2], function (Form $form) {
$form->select('agent_product_id', '产品')->options(function () {

2
app/AdminAgent/Controllers/WorkorderController.php

@ -186,7 +186,7 @@ class WorkorderController extends AdminController
$form->display('id');
//$form->text('title')->required();
$form->textarea('content')->required();
if (Admin::user()->type == AgentType::CLUSTER) {
if (Admin::user()->type == AgentType::OPERATOR) {
$form->select('point_type')
->when([1], function (Form $form) {
$form->select('supplier_id', '供应商')->options(function () {

2
app/AdminGuide/Controllers/WorkorderController.php

@ -186,7 +186,7 @@ class WorkorderController extends AdminController
->default(0)
->required();
$form->select('point_id', '代理商')->options(function () {
return Agent::query()->where('type',AgentType::CLUSTER)->pluck('name','id');
return Agent::query()->where('type',AgentType::OPERATOR)->pluck('name','id');
})
->required();
$form->hidden('publisher_type');

4
app/AdminSettled/Controllers/AgentController.php

@ -70,7 +70,7 @@ class AgentController extends AdminController
// $form->text('mchkey')->placeholder('可以先不填,审核通过之后再设置');
$form->radio('type')
->options(AgentType::array())
->default(AgentType::OPERATOR)
->default(AgentType::CLUSTER)
->required();
$form->text('company_name')->required()->help('请正确填写,保持跟营业执照上的完全一致,如:海南易游天下供应链有限公司');
$form->text('address')->required();
@ -136,7 +136,7 @@ class AgentController extends AdminController
$form->hidden(['status', 'rate']);
$form->status = UserStatus::UNAUDITED;
$form->rate = 5;
$form->type = in_array($form->type, AgentType::key()) ? $form->type : AgentType::OPERATOR;
$form->type = in_array($form->type, AgentType::key()) ? $form->type : AgentType::CLUSTER;
})->saved(function (Form $form) {
$js = (new SettledPay)->PayJs($form->repository()->model());
return $form->response()->success('操作成功,继续支付入驻费完成入驻')->script($js);

4
app/AdminSupplier/Metrics/Examples/NewDevices.php

@ -57,11 +57,11 @@ class NewDevices extends Donut
$agent = $agent->pluck('type');
$operator = $supplier = $cluster = 0;
foreach ($agent as $v) {
if ($v == AgentType::OPERATOR) {
if ($v == AgentType::CLUSTER) {
$operator++;
} elseif ($v == AgentType::SUPPLIER) {
$supplier++;
} elseif($v == AgentType::CLUSTER) {
} elseif($v == AgentType::OPERATOR) {
$cluster++;
}
}

12
app/Common/AgentType.php

@ -10,29 +10,29 @@ namespace App\Common;
class AgentType
{
/** @var int 组团版旅行社 */
const OPERATOR = 1;
const CLUSTER = 1;
/** @var int 供应商旅行社 */
const SUPPLIER = 2;
/** @var int 计调版旅行社 */
const CLUSTER = 3;
const OPERATOR = 3;
public static function array(): array
{
return [
self::OPERATOR => '组团版旅行社',
self::CLUSTER => '组团版旅行社',
self::SUPPLIER => '供应商旅行社',
self::CLUSTER => '计调版旅行社',
self::OPERATOR => '计调版旅行社',
];
}
public static function key(): array
{
return [
self::OPERATOR,
self::SUPPLIER,
self::CLUSTER,
self::SUPPLIER,
self::OPERATOR,
];
}
}

2
app/Providers/ProductServiceProvider.php

@ -46,7 +46,7 @@ class ProductServiceProvider extends ServiceProvider
->withoutGlobalScope('orderById')
->where('supplier_id', $product->supplier_id)
->whereHas('agent',function($query) {
$query->where('type','!=',AgentType::CLUSTER);
$query->where('type','!=',AgentType::OPERATOR);
})
->distinct()
->pluck('agent_id');

Loading…
Cancel
Save