Browse Source

订单信息完善

shish 6 years ago
parent
commit
a4eaa564d4
2 changed files with 10 additions and 8 deletions
  1. 7 8
      app/client/controllers/OrderController.php
  2. 3 0
      sql.txt

+ 7 - 8
app/client/controllers/OrderController.php

@@ -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()
 	{
 	{

+ 3 - 0
sql.txt

@@ -15,6 +15,9 @@ ALTER TABLE xhGoods DROP COLUMN `isCharge`;
 ALTER TABLE xhGoods DROP COLUMN `sendArea`;
 ALTER TABLE xhGoods DROP COLUMN `sendArea`;
 ALTER TABLE xhGoods CHANGE `sendType` needSend TINYINT NOT NULL DEFAULT 0 COMMENT '是否要配送 0免配送 1需要配送';
 ALTER TABLE xhGoods CHANGE `sendType` needSend TINYINT NOT NULL DEFAULT 0 COMMENT '是否要配送 0免配送 1需要配送';
 ALTER TABLE xhOrder CHANGE `needSend` `sendType` TINYINT NOT NULL DEFAULT 0 COMMENT '配送方式 0免配送 1自己送 2别人送';
 ALTER TABLE xhOrder CHANGE `needSend` `sendType` TINYINT NOT NULL DEFAULT 0 COMMENT '配送方式 0免配送 1自己送 2别人送';
+ALTER TABLE xhOrder MODIFY reachPeriod TINYINT NOT NULL DEFAULT 0 COMMENT '0上午1下午2晚上';
+ALTER TABLE xhOrder DROP COLUMN `blessing`;
+ALTER TABLE xhOrder ADD cardInfo VARCHAR(500) NOT NULL DEFAULT '' COMMENT '贺卡内容' AFTER `needCard`;
 
 
 2019.12.4 shish
 2019.12.4 shish
 !!执行下面的sql,全部的会员折扣要纠正
 !!执行下面的sql,全部的会员折扣要纠正