OrderController.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\openapi\controller;
  20. use app\adminapi\logic\toutiao\ToutiaoSettingLogic;
  21. use app\openapi\logic\user\UserLogic;
  22. use app\openapi\validate\UserValidate;
  23. use app\openapi\validate\OrderValidate;
  24. use app\openapi\logic\order\OrderLogic;
  25. /**
  26. * 订单接口示例
  27. * Class UserController
  28. * @package app\openapi\controller
  29. */
  30. class OrderController extends BaseOpenController
  31. {
  32. /**
  33. * 获取用户信息
  34. * @return \think\response\Json
  35. */
  36. public function info()
  37. {
  38. $params = (new UserValidate())->post()->goCheckStrict('info');
  39. // 模拟用户数据
  40. $userData = [
  41. 'user_id' => $params['user_id'],
  42. 'nickname' => '测试用户',
  43. 'avatar' => 'https://example.com/avatar.jpg',
  44. 'mobile' => '138****8888',
  45. 'created_time' => date('Y-m-d H:i:s'),
  46. ];
  47. return $this->success('获取成功', $userData);
  48. }
  49. /*
  50. * 查询会员订单信息
  51. * */
  52. public function getUserOrderList(){
  53. $params = (new OrderValidate())->get()->goCheckStrict('getOrderList');
  54. $order_list = (new OrderLogic)->getUserOrderList($params);
  55. return $this->success('获取成功', $order_list);
  56. }
  57. /*
  58. * 订单推送
  59. * */
  60. public function orderPush(){
  61. $params = (new OrderValidate())->post()->goCheckStrict('orderPush');
  62. $result = (new OrderLogic)->orderPush($params);
  63. if ($result) {
  64. return $this->success('订单推送成功', [],1,1);
  65. }
  66. return $this->fail(OrderLogic::getError());
  67. }
  68. /*
  69. * 订单结算
  70. * */
  71. public function orderPay(){
  72. $params = (new OrderValidate())->post()->goCheckStrict('orderPay');
  73. $result = (new OrderLogic)->orderPay($params);
  74. if ($result) {
  75. return $this->success('订单结算推送成功', [],1,1);
  76. }
  77. return $this->fail(OrderLogic::getError());
  78. }
  79. /*
  80. * 退款
  81. * */
  82. public function orderRefundMoney(){
  83. $params = (new OrderValidate())->post()->goCheckStrict('orderRefundMoney');
  84. $result = (new OrderLogic)->orderRefundMoney($params);
  85. if ($result) {
  86. return $this->success('退款成功', [],1,1);
  87. }
  88. return $this->fail(OrderLogic::getError());
  89. }
  90. }