MJoin.Class.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * 加盟管理Model
  4. * Created by PhpStorm.
  5. * User: 小威
  6. * Date: 2020/03/25
  7. * Time: 16:20
  8. */
  9. namespace JinDouYun\Model\Manage;
  10. use Exception;
  11. use Mall\Framework\Core\ErrorCode;
  12. use Mall\Framework\Core\StatusCode;
  13. use Mall\Framework\Core\ResultWrapper;
  14. use JinDouYun\Dao\Manage\DJoin;
  15. use JinDouYun\Dao\Manage\DReservation;
  16. use JinDouYun\Model\Shop\MShop;
  17. use JinDouYun\Model\Department\MStaff;
  18. class MJoin
  19. {
  20. private $objDJoin;
  21. private $objDReservation;
  22. public function __construct()
  23. {
  24. $this->objDJoin = new DJoin('manage');
  25. $this->objDReservation = new DReservation('manage');
  26. }
  27. /**
  28. * 加盟列表
  29. * @return ResultWrapper
  30. * @throws Exception
  31. */
  32. public function getAllJoin()
  33. {
  34. $dbResult = $this->objDJoin->select();
  35. if($dbResult === false){
  36. return ResultWrapper::fail($this->objDJoin->error(), ErrorCode::$dberror);
  37. }
  38. return ResultWrapper::success($dbResult);
  39. }
  40. /**
  41. * 加盟添加
  42. * @param $params
  43. * @return ResultWrapper
  44. */
  45. public function addJoin($params)
  46. {
  47. $dbResult = $this->objDJoin->insert($params);
  48. if($dbResult === false){
  49. return ResultWrapper::fail($this->objDJoin->error(), ErrorCode::$dberror);
  50. }
  51. return ResultWrapper::success($dbResult);
  52. }
  53. /**
  54. * 预约列表
  55. */
  56. public function getAllReservation()
  57. {
  58. $dbResult = $this->objDReservation->select();
  59. if($dbResult === false){
  60. return ResultWrapper::fail($this->objDReservation->error(), ErrorCode::$dberror);
  61. }
  62. return ResultWrapper::success($dbResult);
  63. }
  64. /**
  65. * 预约添加
  66. * @param $params
  67. * @return ResultWrapper
  68. */
  69. public function addReservation($params)
  70. {
  71. $dbResult = $this->objDReservation->insert($params);
  72. if($dbResult === false){
  73. return ResultWrapper::fail($this->objDReservation->error(), ErrorCode::$dberror);
  74. }
  75. return ResultWrapper::success($dbResult);
  76. }
  77. }