PayVipOrder.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\store\order;
  12. use app\controller\store\AuthController;
  13. use app\services\order\OtherOrderServices;
  14. use app\services\order\OtherOrderStatusServices;
  15. use think\db\exception\DataNotFoundException;
  16. use think\db\exception\DbException;
  17. use think\db\exception\ModelNotFoundException;
  18. use think\facade\App;
  19. /**
  20. * Class PayVipOrder
  21. * @package app\controller\store\order
  22. */
  23. class PayVipOrder extends AuthController
  24. {
  25. /**
  26. * @var OtherOrderServices
  27. */
  28. protected $services;
  29. /**
  30. * Order constructor.
  31. * @param App $app
  32. * @param OtherOrderServices $services
  33. */
  34. public function __construct(App $app, OtherOrderServices $services)
  35. {
  36. parent::__construct($app);
  37. $this->services = $services;
  38. }
  39. /**
  40. * @return mixed
  41. * @throws DataNotFoundException
  42. * @throws DbException
  43. * @throws ModelNotFoundException
  44. */
  45. public function index()
  46. {
  47. $where = $this->request->getMore([
  48. ['add_time', ""],
  49. ['member_type', ""],
  50. ['pay_type', ""],
  51. ['staff_id', '']
  52. ]);
  53. $where['name'] = $this->request->param('name', '');
  54. $where['store_id'] = $this->storeId;
  55. $where['paid'] = 1;
  56. $data = $this->services->getMemberRecord($where);
  57. return $this->success($data);
  58. }
  59. /**
  60. * 获取备注
  61. * @param $id
  62. * @return mixed
  63. */
  64. public function getRemark($id)
  65. {
  66. return $this->success(['remarks' => $this->services->value(['id' => $id], 'remarks')]);
  67. }
  68. /**
  69. * 修改备注
  70. * @param $id
  71. * @return mixed
  72. */
  73. public function remark($id)
  74. {
  75. $data = $this->request->param('remarks', '');
  76. $this->services->update(['id' => $id], ['remarks' => $data]);
  77. return $this->success('备注提交成功');
  78. }
  79. /**
  80. * 获取vip订单状态
  81. * @param OtherOrderStatusServices $services
  82. * @param $id
  83. * @return mixed
  84. * @throws DataNotFoundException
  85. * @throws DbException
  86. * @throws ModelNotFoundException
  87. */
  88. public function status(OtherOrderStatusServices $services, $id)
  89. {
  90. return $this->success($services->getStatusList((int)$id));
  91. }
  92. }