Browse Source

完善认证

ChenWuJie 4 năm trước cách đây
mục cha
commit
93aec4dc94

+ 6 - 1
app/Admin/Actions/backstage/Pass.php

xqd
@@ -15,7 +15,12 @@ class Pass extends RowAction
     {
 //         $model ...
 //        dd($model);
-        DocterOrganization::where('id',$model->id)->update(['state'=>2,'authentication_time'=>date('Y-m-d H:i:s')]);
+        $end_time = strtotime('+1year');
+        $authentication_end_time = date('Y-m-d H:i:s',$end_time);
+        DocterOrganization::where('id',$model->id)->update(['state'=>2,
+                                                            'authentication_time'=>date('Y-m-d H:i:s'),
+                                                            'authentication_end_time'=>$authentication_end_time]
+                                                            );
         Docter::where('id',$model->docter_id)->update(['is_then'=>1]);
         return $this->response()->success('审核通过')->refresh();
     }

+ 1 - 1
app/Admin/Actions/backstage/Refuse.php

xqd
@@ -12,7 +12,7 @@ class Refuse extends RowAction
     public function handle(Model $model)
     {
         // $model ...
-        DocterOrganization::where('id',$model->id)->update(['state'=>0,'authentication_time'=>0]);
+        DocterOrganization::where('id',$model->id)->update(['state'=>0,'authentication_time'=>0,'authentication_end_time'=>0]);
 
         return $this->response()->success('审核驳回')->refresh();
     }

+ 1 - 1
app/Admin/Actions/backstage/Revoke.php

xqd
@@ -32,7 +32,7 @@ class Revoke extends RowAction
         }
         if ($is_pass_num ==1)
         {
-            DocterOrganization::where('id',$model->id)->update(['state'=>0,'authentication_time'=>0]);
+            DocterOrganization::where('id',$model->id)->update(['state'=>0,'authentication_time'=>0,'authentication_end_time'=>0]);
             Docter::where('id',$model->docter_id)->update(['is_then'=>0]);
         }
         //修改记录

+ 8 - 0
app/Admin/Controllers/ApproveController.php

xqd
@@ -49,6 +49,14 @@ class ApproveController extends AdminController
                 return $time;
             }
         });
+        $grid->column('authentication_end_time', __('签约到期时间'))->display(function ($time){
+            if ($time == 0){
+                return '';
+            }else
+            {
+                return $time;
+            }
+        });
         //禁用创建按钮
         $grid->disableCreateButton();
         $grid->actions(function ($actions) {

+ 30 - 9
app/Admin/Controllers/SignUpController.php

xqd xqd
@@ -25,18 +25,45 @@ class SignUpController extends AdminController
     protected function grid()
     {
         $grid = new Grid(new DocterOrganization());
-        $grid->disableActions();
         $docter_id = \request('docter_id');
         $grid->filter(function ($filter){
             $filter->disableIdFilter();
             $filter->equal('docter_id','医生');
         });
+        $grid->actions(function ($actions) {
+            // 去掉删除
+            $actions->disableDelete();
+            // 去掉查看
+            $actions->disableView();
+
+            // 如果审核成功才能修改认证到期时间
+            if($actions->row->state != 2){
+                //去掉编辑
+                $actions->disableEdit();
+            }
+        });
         $grid->column('id', __('Id'));
         $grid->column('docter_id', __('医生id'));
         $grid->column('docter.name', __('医生姓名'));
         $grid->column('organization_id', __('机构id'));
         $grid->column('organization.name', __('机构名字'));
-        $grid->column('state', __('审核状态'))->using([0=>'待审核',1=>'审核通过',2=>'审核拒绝']);
+        $grid->column('state', __('审核状态'))->using([1=>'待审核',2=>'审核通过',3=>'审核拒绝']);
+        $grid->column('authentication_time', __('入驻时间'))->display(function ($time){
+            if ($time == 0){
+                return '';
+            }else
+            {
+                return $time;
+            }
+        });
+        $grid->column('authentication_end_time', __('签约到期时间'))->display(function ($time){
+            if ($time == 0){
+                return '';
+            }else
+            {
+                return $time;
+            }
+        });
         $grid->column('created_at', __('创建时间'));
         $grid->column('updated_at', __('更新时间'));
 
@@ -73,13 +100,7 @@ class SignUpController extends AdminController
     protected function form()
     {
         $form = new Form(new DocterOrganization());
-
-        $form->number('docter_id', __('Docter id'));
-        $form->number('organization_id', __('Organization id'));
-        $form->number('offices_id', __('Offices id'));
-        $form->number('qualifications_id', __('Qualifications id'));
-        $form->number('state', __('State'));
-
+        $form->datetime('authentication_end_time', __('签约到期时间'));
         return $form;
     }
 }