ApiController.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Community\Controllers;
  3. use App\Http\Controllers\Controller;
  4. use App\Models\Docter;
  5. use App\Models\PatientRemark;
  6. use EasyWeChat\Factory;
  7. class ApiController extends Controller
  8. {
  9. public function getDocter()
  10. {
  11. return Docter::get(['name as text','id'])->toArray();
  12. }
  13. public function paitent_remark()
  14. {
  15. $data['patient_id']= request('patient_id');
  16. $data['org_id'] = request('org_id');
  17. $is_have = PatientRemark::where($data)->first();
  18. $data['remark'] = request('remark');
  19. if($is_have){
  20. PatientRemark::where(['id'=>$is_have->id])->update(['remark'=>$data['remark']]);
  21. } else {
  22. PatientRemark::insert($data);
  23. }
  24. return redirect('/cdms/nurse_users');
  25. }
  26. public function sendmsg(){
  27. $config = [
  28. // 'app_id' => 'wx1c2357232cd25f65',
  29. // 'secret' => 'c8cab53e4e52234ed1bc2abbdeaba57d',
  30. 'app_id' => 'wx13bedfcc62e9bab0',
  31. 'secret' => '175e5518b6426dd12d3096f24ca68fb8',
  32. 'response_type' => 'array'
  33. ];
  34. $app = Factory::officialAccount($config );
  35. $app->broadcasting->sendText("大家好!欢迎使用 EasyWeChat。",['o481Y5AtcbnOQef1vc4rL4TwYpDU', 'o481Y5AQG11MyqsEA9656TBEYTFM']);
  36. }
  37. }