| xqd
@@ -1,6 +1,7 @@
|
|
|
<?php
|
|
|
|
|
|
namespace App\Admin\Actions\backstage;
|
|
|
+use App\Models\Docter;
|
|
|
use App\Models\DocterOrganization;
|
|
|
use Encore\Admin\Actions\RowAction;
|
|
|
use Illuminate\Database\Eloquent\Model;
|
| xqd
@@ -11,8 +12,31 @@ class Revoke extends RowAction
|
|
|
|
|
|
public function handle(Model $model)
|
|
|
{
|
|
|
- // $model ...
|
|
|
- DocterOrganization::where('id',$model->id)->update(['state'=>0]);
|
|
|
+
|
|
|
+ //获得通过认证的机构数量
|
|
|
+ $is_pass_num = 0;
|
|
|
+ $docter_approve_num = DocterOrganization::where('docter_id',$model->docter_id)->get();
|
|
|
+ $docter_approve_num_array = $docter_approve_num->toarray();
|
|
|
+ foreach ($docter_approve_num_array as $value)
|
|
|
+ {
|
|
|
+ if ($value['state'] == 2)
|
|
|
+ {
|
|
|
+ $is_pass_num=$is_pass_num+1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果同时有多个机构认证
|
|
|
+ if($is_pass_num > 1)
|
|
|
+ {
|
|
|
+ //撤销到社区端
|
|
|
+ DocterOrganization::where('id',$model->id)->update(['state'=>0,'authentication_time'=>'']);
|
|
|
+ }
|
|
|
+ if ($is_pass_num ==1)
|
|
|
+ {
|
|
|
+ DocterOrganization::where('id',$model->id)->update(['state'=>0,'authentication_time'=>0]);
|
|
|
+ Docter::where('id',$model->docter_id)->update(['is_then'=>0]);
|
|
|
+ }
|
|
|
+ //修改记录
|
|
|
+// DocterOrganization::where('id',$model->id)->update(['state'=>0]);
|
|
|
return $this->response()->success('审核撤销')->refresh();
|
|
|
}
|
|
|
|