|
@@ -6,6 +6,7 @@ use biz\goods\services\CategoryService;
|
|
|
use biz\goods\services\GoodsCategoryService;
|
|
use biz\goods\services\GoodsCategoryService;
|
|
|
use biz\merchant\services\MerchantService;
|
|
use biz\merchant\services\MerchantService;
|
|
|
use biz\merchant\services\ShopService;
|
|
use biz\merchant\services\ShopService;
|
|
|
|
|
+use biz\order\services\OrderService;
|
|
|
use common\components\configDict;
|
|
use common\components\configDict;
|
|
|
use Yii;
|
|
use Yii;
|
|
|
use yii\web\Controller;
|
|
use yii\web\Controller;
|
|
@@ -18,6 +19,7 @@ class OrderController extends BaseController
|
|
|
public function actionCreateOrder()
|
|
public function actionCreateOrder()
|
|
|
{
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
$post = Yii::$app->request->post();
|
|
|
|
|
+ $needSend = isset($post['needSend']) ? $post['needSend'] : 0;
|
|
|
$userId = $this->userId;
|
|
$userId = $this->userId;
|
|
|
$post['userId'] = $userId;
|
|
$post['userId'] = $userId;
|
|
|
$post['payWay'] = $this->isWeixin == true ? 0 : 1;
|
|
$post['payWay'] = $this->isWeixin == true ? 0 : 1;
|
|
@@ -28,9 +30,9 @@ class OrderController extends BaseController
|
|
|
util::fail('没有找到门店');
|
|
util::fail('没有找到门店');
|
|
|
}
|
|
}
|
|
|
$shopInfo = ShopService::getById($defaultShopId);
|
|
$shopInfo = ShopService::getById($defaultShopId);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
$calcDistance = ShopService::calcDistance($lat, $lng, $shopInfo);
|
|
$calcDistance = ShopService::calcDistance($lat, $lng, $shopInfo);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
$couponAmount = 0;
|
|
$couponAmount = 0;
|
|
|
$couponId = isset($post['couponId']) ? $post['couponId'] : 0;//代金劵
|
|
$couponId = isset($post['couponId']) ? $post['couponId'] : 0;//代金劵
|
|
|
if (!empty($couponId)) {
|
|
if (!empty($couponId)) {
|
|
@@ -47,12 +49,9 @@ class OrderController extends BaseController
|
|
|
//不要将代金劵保存到订单表,付款成功后再保存进去!!!
|
|
//不要将代金劵保存到订单表,付款成功后再保存进去!!!
|
|
|
unset($post['couponId']);
|
|
unset($post['couponId']);
|
|
|
$post['merchantId'] = $this->merchantId;
|
|
$post['merchantId'] = $this->merchantId;
|
|
|
- //店铺id
|
|
|
|
|
$post['shopId'] = $defaultShopId;
|
|
$post['shopId'] = $defaultShopId;
|
|
|
- $order = xhOrderService::add($post);//创建订单
|
|
|
|
|
- if ($order == false) {
|
|
|
|
|
- util::fail('创建订单失败');
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $order = OrderService::add($post);
|
|
|
|
|
+
|
|
|
$orderId = $order['id'];
|
|
$orderId = $order['id'];
|
|
|
$oData = [];
|
|
$oData = [];
|
|
|
$goodsInfo = $post['goodsInfo'];
|
|
$goodsInfo = $post['goodsInfo'];
|
|
@@ -116,7 +115,7 @@ class OrderController extends BaseController
|
|
|
xhOrderService::updateById($orderId, $oData);
|
|
xhOrderService::updateById($orderId, $oData);
|
|
|
util::success(['orderId' => $orderId, 'couponId' => $couponId]);
|
|
util::success(['orderId' => $orderId, 'couponId' => $couponId]);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//获取商城下单要用的微信支付参数 shish 2019.21.3
|
|
//获取商城下单要用的微信支付参数 shish 2019.21.3
|
|
|
public function actionWxPay()
|
|
public function actionWxPay()
|
|
|
{
|
|
{
|