| xqd
@@ -4,6 +4,7 @@ namespace App\Admin\Actions\backstage;
|
|
|
|
|
|
use App\Models\Docter;
|
|
|
use App\Models\DocterOrganization;
|
|
|
+use App\Models\Organization;
|
|
|
use App\Models\Serviceapplys;
|
|
|
use Encore\Admin\Actions\RowAction;
|
|
|
use Illuminate\Database\Eloquent\Model;
|
| xqd
@@ -16,6 +17,30 @@ class Pass extends RowAction
|
|
|
{
|
|
|
// $model ...
|
|
|
// dd($model);
|
|
|
+ //判定通过认证的数量
|
|
|
+ $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'] == 1)
|
|
|
+ {
|
|
|
+ $is_pass_num=$is_pass_num+1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果是第一次认证,就将机构的经纬度覆盖进去
|
|
|
+ if ($is_pass_num == 0 )
|
|
|
+ {
|
|
|
+ //organization_id
|
|
|
+ //经度
|
|
|
+ $longitude = Organization::where('id',$this->row->organization_id)->value('longitude');
|
|
|
+ //纬度
|
|
|
+ $latitude = Organization::where('id',$this->row->organization_id)->value('latitude');
|
|
|
+ Docter::where('id',$this->row->docter_id)->update(['latitude'=>$latitude,'longitude'=>$longitude]);
|
|
|
+ }
|
|
|
$end_time = strtotime('+1year');
|
|
|
$authentication_end_time = date('Y-m-d H:i:s',$end_time);
|
|
|
DocterOrganization::where('id',$model->id)->update(['state'=>1,
|