Failed.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace App\Admin\Actions\Community\Docter;
  3. use App\Models\Docter;
  4. use App\Models\DocterOrganization;
  5. use Encore\Admin\Actions\Action;
  6. use Encore\Admin\Actions\RowAction;
  7. use Illuminate\Http\Request;
  8. use Illuminate\Support\Facades\DB;
  9. use Mockery\Exception;
  10. class Failed extends RowAction
  11. {
  12. protected $selector = '.failed';
  13. public $name = '驳回';
  14. public function handle()
  15. {
  16. $openid = 'oflME5eixHMij2TIVyy52WbfaQvA';
  17. $data = [
  18. $openid,
  19. '很抱歉,你的医生身份认证失败!',
  20. $this->row->docter->name,
  21. $this->row->organization->name,
  22. $this->row->qualification->name,
  23. $this->row->office->name,
  24. ];
  25. DB::beginTransaction();
  26. try {
  27. DocterOrganization::where('id',$this->row->id)->update(['state'=>2]);
  28. $docter_id = $this->row->docter_id;
  29. $ret = send_wechatSubscription_message('then_reminder',$data);
  30. dd($ret);
  31. // Docter::where(['id'=>$docter_id])->update(['is_then'=
  32. // ewWm59p1oVpHw7vt3LlkQTWpYgOZ_h6rfINUiTc4GbM
  33. $data = [
  34. ];
  35. DB::commit();
  36. } catch (Exception $e){
  37. DB::rollBack();
  38. return $this->response()->error('操作失败');
  39. }
  40. return $this->response()->success('操作成功')->refresh();
  41. }
  42. }