AppointmentServer.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. namespace app\admin\server\medical;
  3. use app\admin\model\Appointment;
  4. use app\admin\model\MedicalCareOrder;
  5. use app\admin\model\MedicalCareOrderProduct;
  6. use app\admin\model\MedicalCarePostage;
  7. use app\admin\model\PackageOrderDetail;
  8. use app\admin\model\SystemAdmin;
  9. use app\admin\model\SystemMenu;
  10. use app\admin\model\SystemRole;
  11. class AppointmentServer
  12. {
  13. /**
  14. * Notes:获取订单列表
  15. * @param string $keywords
  16. * @param int $page
  17. * @param int $limit
  18. * @return array
  19. * User: QJF
  20. * Date: 2022/9/17
  21. */
  22. public static function getMentList(int $page, int $limit, string $keywords)
  23. {
  24. [$list, $count] = Appointment::geMentList($page, $limit,$keywords);
  25. return compact('list', 'page', 'limit', 'count');
  26. }
  27. /**
  28. * Notes: 添加m模板
  29. * @param array $param
  30. * @return int
  31. * User: QJF
  32. * Date: 2022/9/28
  33. */
  34. public static function insertMent(array $param)
  35. {
  36. SystemRole::affairBegin();
  37. try {
  38. $param['appointment_create_time'] = time();
  39. $param['appointment_auto'] = 1;
  40. $result = Appointment ::insertGetId($param);
  41. if (!empty($result)){
  42. SystemRole::affairCommit();
  43. return $result;
  44. }
  45. throw new \Exception('操作失败!');
  46. }catch (\Exception $exception){
  47. SystemRole::affairRollback();
  48. throw new \Exception($exception->getMessage(), 500);
  49. }
  50. }
  51. /**
  52. * Notes:修改产品
  53. * @param array $param
  54. * @return int
  55. * User: QJF
  56. * Date: 2022/9/23
  57. */
  58. public static function updateMent($param)
  59. {
  60. SystemRole::affairBegin();
  61. try {
  62. $where = [];
  63. $where['appointment_id'] = $param['appointment_id'];
  64. $result = Appointment::where($where)->update($param);
  65. if ($result !== false){
  66. SystemRole::affairCommit();
  67. return true;
  68. }
  69. throw new \Exception('操作失败!');
  70. }catch (\Exception $exception){
  71. SystemRole::affairRollback();
  72. throw new \Exception($exception->getMessage(), 500);
  73. }
  74. }
  75. /**
  76. * Notes:删除产品
  77. * @param int $role_id
  78. * @return int
  79. * User: QJF
  80. * Date: 2022/9/23
  81. */
  82. public static function delMent($appointment_id)
  83. {
  84. SystemRole::affairBegin();
  85. try {
  86. $where = [];
  87. $where['appointment_id'] = $appointment_id;
  88. $data['appointment_del'] = 1;
  89. $result = Appointment::where($where)->update($data);
  90. if (!empty($result)){
  91. SystemRole::affairCommit();
  92. return true;
  93. }else{
  94. return false;
  95. }
  96. }catch (\Exception $exception){
  97. SystemRole::affairRollback();
  98. throw new \Exception($exception->getMessage(), 500);
  99. }
  100. }
  101. /**
  102. * Notes:上/下架
  103. * @param int $role_id
  104. * @return int
  105. * User: QJF
  106. * Date: 2022/9/28
  107. */
  108. public static function showMent($appointment_id,$appointment_status)
  109. {
  110. $where = [];
  111. $where['appointment_id'] = $appointment_id;
  112. $data['appointment_status'] = $appointment_status;
  113. $result = Appointment::where($where)->update($data);
  114. if (!empty($result)){
  115. return true;
  116. }else{
  117. return false;
  118. }
  119. }
  120. /**
  121. * Notes:产品详情
  122. * @param int $package_id
  123. * @return int
  124. * User: QJF
  125. * Date: 2022/9/23
  126. */
  127. public static function infoMent($appointment_id)
  128. {
  129. SystemRole::affairBegin();
  130. try {
  131. $where = [];
  132. $where['appointment_id'] = $appointment_id;
  133. $result = Appointment::with(['Category','Shop'])->where($where)->first();
  134. if (!empty($result)){
  135. SystemRole::affairCommit();
  136. return $result;
  137. }else{
  138. return false;
  139. }
  140. }catch (\Exception $exception){
  141. SystemRole::affairRollback();
  142. throw new \Exception($exception->getMessage(), 500);
  143. }
  144. }
  145. }