| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?php
- /**
- * Created by PhpStorm.
- * Author: 芸众商城 www.yunzshop.com
- * Date: 2017/3/3
- * Time: 下午2:30
- */
- namespace app\frontend\modules\order\controllers;
- use app\common\components\ApiController;
- use app\common\models\Order;
- use app\frontend\modules\order\services\OrderService;
- use app\frontend\modules\order\services\MiniMessageService;
- class OperationController extends ApiController
- {
- public $transactionActions = ['*'];
- protected $params;
- protected $order;
- /**
- * @return \Illuminate\Http\JsonResponse|void
- * @throws \app\common\exceptions\ShopException
- */
- public function __construct()
- {
- parent::__construct(); // TODO: Change the autogenerated stub
- }
- public function preAction()
- {
- parent::preAction(); // TODO: Change the autogenerated stub
- $this->params = request()->input();
- if (!isset($this->params['order_id'])) {
- return $this->errorJson('order_id 不能为空!');
- }
- $this->order = app('OrderManager')->make('Order')->find($this->params['order_id']);
- if (!isset($this->order)) {
- return $this->errorJson('未找到该订单!');
- }
- }
- /**
- * @return \Illuminate\Http\JsonResponse
- * @throws \app\common\exceptions\AppException
- */
- public function pay()
- {
- OrderService::orderPay($this->params);
- return $this->successJson();
- }
- /**
- * @return \Illuminate\Http\JsonResponse
- * @throws \app\common\exceptions\AppException
- */
- public function cancelPay()
- {
- OrderService::orderCancelPay($this->params);
- return $this->successJson();
- }
- /**
- * @return \Illuminate\Http\JsonResponse
- * @throws \app\common\exceptions\AppException
- */
- public function send()
- {
- OrderService::orderSend($this->params);
- return $this->successJson();
- }
- /**
- * @return \Illuminate\Http\JsonResponse
- * @throws \app\common\exceptions\AppException
- */
- public function cancelSend()
- {
- OrderService::orderCancelSend($this->params);
- return $this->successJson();
- }
- /**
- * @return \Illuminate\Http\JsonResponse
- * @throws \app\common\exceptions\AppException
- */
- public function Receive()
- {
- OrderService::orderReceive($this->params);
- return $this->successJson();
- }
- /**
- * @return \Illuminate\Http\JsonResponse
- * @throws \app\common\exceptions\AppException
- */
- public function Delete()
- {
- OrderService::orderDelete($this->params);
- return $this->successJson();
- }
- /**
- * @return \Illuminate\Http\JsonResponse
- * @throws \app\common\exceptions\AppException
- */
- public function Close()
- {
- OrderService::orderClose($this->params);
- $ingress = \Yunshop::request()->ingress;
- $type = \Yunshop::request()->type;
- // if ($ingress == 'weChatApplet' && $type == 2){
- // $order = Order::find(\Yunshop::request()->orderId);
- // (new MiniMessageService($order,'',2,'订单取消通知'))->received();
- // }
- return $this->successJson();
- }
- }
|