| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <?php
- // +----------------------------------------------------------------------
- // | LikeShop有特色的全开源社交分销电商系统
- // +----------------------------------------------------------------------
- // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
- // | 商业用途务必购买系统授权,以免引起不必要的法律纠纷
- // | 禁止对系统程序代码以任何目的,任何形式的再发布
- // | 微信公众号:好象科技
- // | 访问官网:http://www.likemarket.net
- // | 访问社区:http://bbs.likemarket.net
- // | 访问手册:http://doc.likemarket.net
- // | 好象科技开发团队 版权所有 拥有最终解释权
- // +----------------------------------------------------------------------
- // | Author: LikeShopTeam-段誉
- // +----------------------------------------------------------------------
- namespace app\shopapi\controller;
- use app\common\model\Order;
- use app\common\service\WechatMiniExpressSendSyncService;
- use app\shopapi\lists\OrderLists;
- use app\shopapi\logic\Order\OrderLogic;
- use app\shopapi\validate\PlaceOrderValidate;
- use app\shopapi\validate\OrderValidate;
- /**
- * 订单
- * Class OrderController
- * @package app\shopapi\controller
- */
- class OrderController extends BaseShopController
- {
- /**
- * @notes 提交订单/结算详情
- * @return \think\response\Json
- * @author 段誉
- * @date 2021/7/23 15:52
- */
- public function placeOrder()
- {
- $data = [
- 'terminal' => $this->userInfo['terminal'],
- 'user_id'=> $this->userId
- ];
- $params = (new PlaceOrderValidate())->post()->goCheck('', $data);
- //订单结算信息
- $settlement = OrderLogic::settlement($params);
- if (false === $settlement) {
- return $this->fail(OrderLogic::getError());
- }
- //结算信息
- if ($params['action'] == 'settle') {
- return $this->data($settlement);
- }
- //提交订单
- $result = OrderLogic::submitOrder($settlement);
- if (false === $result) {
- return $this->fail(OrderLogic::getError(), []);
- }
- return $this->data($result);
- }
- /**
- * @notes 订单列表
- * @return \think\response\Json
- * @author 段誉
- * @date 2021/7/23 18:58
- */
- public function lists()
- {
- return $this->dataLists((new OrderLists()));
- }
- /**
- * @notes 订单详情
- * @return \think\response\Json
- * @author 段誉
- * @date 2021/8/2 21:00
- */
- public function detail()
- {
- $params = (new OrderValidate())->goCheck('detail', ['user_id' => $this->userId]);
- return $this->data(OrderLogic::getDetail($params));
- }
- /**
- * @notes 取消订单
- * @return \think\response\Json
- * @author 段誉
- * @date 2021/8/2 16:37
- */
- public function cancel()
- {
- $params = (new OrderValidate())->post()->goCheck('cancel', ['user_id' => $this->userId]);
- $result = OrderLogic::cancelOrder($params);
- if (false === $result) {
- return $this->fail(OrderLogic::getError());
- }
- return $this->success('取消订单成功');
- }
- /**
- * @notes 确认收货
- * @return \think\response\Json
- * @author 段誉
- * @date 2021/8/2 15:21
- */
- public function confirm()
- {
- $params = (new OrderValidate())->post()->goCheck('confirm', ['user_id' => $this->userId]);
- OrderLogic::confirmOrder($params);
- return $this->success('确认收货成功');
- }
- /**
- * @notes 查看物流
- * @return \think\response\Json
- * @author ljj
- * @date 2021/8/13 6:08 下午
- */
- public function orderTraces()
- {
- $params = (new OrderValidate())->goCheck('OrderTraces', ['user_id' => $this->userId]);
- $result = OrderLogic::orderTraces($params);
- return $this->data($result);
- }
- /**
- * @notes 获取配送方式
- * @return \think\response\Json
- * @author ljj
- * @date 2021/8/27 2:33 下午
- */
- public function getDeliveryType()
- {
- $result = (new OrderLogic())->getDeliveryType();
- return $this->success('',$result);
- }
- /**
- * @notes 删除订单
- * @return \think\response\Json
- * @author ljj
- * @date 2021/8/31 2:38 下午
- */
- public function del()
- {
- $params = (new OrderValidate())->post()->goCheck('del', ['user_id' => $this->userId]);
- (new OrderLogic())->del($params);
- return $this->success('删除成功',[],1,1);
- }
-
- /**
- * @notes 微信同步发货 查询
- * @return \think\response\Json
- * @author lbzy
- * @datetime 2023-09-07 15:27:17
- */
- function wechatSyncCheck()
- {
- $id = $this->request->get('id');
-
- $order = Order::where('id', $id)->where('user_id', $this->userId)->findOrEmpty();
-
- $result = WechatMiniExpressSendSyncService::wechatSyncCheck($order);
-
- if (! $result) {
- return $this->fail('获取失败', [], 0, 0);
- }
-
- return $this->success('成功', $result);
- }
-
-
-
- /**
- * @notes 微信确认收货 获取详情
- * @return \think\response\Json
- * @author lbzy
- * @datetime 2023-09-05 09:51:41
- */
- function wxReceiveDetail()
- {
- return $this->success('获取成功', OrderLogic::wxReceiveDetail(input('order_id/d'), $this->userId));
- }
- }
|