Appointment.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace app\admin\model;
  3. use think\facade\Db;
  4. use think\model;
  5. class Appointment extends model
  6. {
  7. public function add($param){
  8. $param["sponsor_id"] = get_login_admin("id");
  9. $param["sponsor_name"] = get_login_admin("nickname");
  10. $param["sponsor_unit"] = get_login_admin("unit_name");
  11. $param["create_time"] = time();
  12. $param["update_time"] = time();
  13. return $this->save($param);
  14. }
  15. public function agree($param){
  16. $data = $this->find($param["id"]);
  17. $unit = get_login_admin("unit_name");
  18. $another = get_admin($data["sponsor_id"])["unit_name"];
  19. if($data!=null ){
  20. $param["approval_id"] = get_login_admin("id");
  21. $param["approval_name"] = get_login_admin("nickname");
  22. $param["audit_status"] = 1;
  23. $param["update_time"] = time();
  24. return $this->update($param);
  25. }
  26. return false;
  27. }
  28. public function disagree($param){
  29. $data = $this->find($param["id"]);
  30. $unit = get_login_admin("unit_name");
  31. $another = get_admin($data["sponsor_id"])["unit_name"];
  32. if($data!=null && $unit!=$another){
  33. $param["approval_id"] = get_login_admin("id");
  34. $param["approval_name"] = get_login_admin("nickname");
  35. $param["audit_status"] = 2;
  36. $param["update_time"] = time();
  37. return $this->update($param);
  38. }
  39. return false;
  40. }
  41. }