|
|
@@ -50,25 +50,20 @@ class MtController extends PublicController
|
|
|
}
|
|
|
Yii::info('confirmOrderData: ' . json_encode($post));
|
|
|
|
|
|
- //noticeUtil::push("美团请求通知,美团订单id:{$mtOrderId} 美团编号:{$thirdSn}", '15280215347');
|
|
|
-
|
|
|
$connection = Yii::$app->db;//事务处理
|
|
|
$transaction = $connection->beginTransaction();
|
|
|
try {
|
|
|
- //noticeUtil::push("111", '15280215347');
|
|
|
$shopId = $post['app_poi_code'] ?? '';
|
|
|
$shop = ShopClass::getById($shopId, true);
|
|
|
if (empty($shop)) {
|
|
|
noticeUtil::push("美团确认订单报错,没有找到门店,美团订单id:{$mtOrderId} 美团编号:{$thirdSn}", '15280215347');
|
|
|
return Json::encode(['data' => 'ok']);
|
|
|
}
|
|
|
- //noticeUtil::push("222", '15280215347');
|
|
|
$shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], true);
|
|
|
if (empty($shopExt)) {
|
|
|
noticeUtil::push("美团确认订单报错,没有找到门店拓展信息,美团订单id:{$mtOrderId} 美团编号:{$thirdSn}", '15280215347');
|
|
|
return Json::encode(['data' => 'ok']);
|
|
|
}
|
|
|
- //noticeUtil::push("333", '15280215347');
|
|
|
$mainId = $shop->mainId ?? 0;
|
|
|
$sjId = $shop->sjId ?? 0;
|
|
|
$customId = $shop->defaultCustomId ?? 0;
|
|
|
@@ -76,18 +71,15 @@ class MtController extends PublicController
|
|
|
noticeUtil::push("美团确认订单报错,没有找到客户哦,美团订单id:{$mtOrderId} 美团编号:{$thirdSn}", '15280215347');
|
|
|
return Json::encode(['data' => 'ok']);
|
|
|
}
|
|
|
- //noticeUtil::push("444", '15280215347');
|
|
|
$custom = CustomClass::getById($customId);
|
|
|
if (empty($custom)) {
|
|
|
noticeUtil::push("美团确认订单报错,没有找到客户,美团订单id:{$mtOrderId} 美团编号:{$thirdSn}", '15280215347');
|
|
|
return Json::encode(['data' => 'ok']);
|
|
|
}
|
|
|
- //noticeUtil::push("555", '15280215347');
|
|
|
foreach ($post as $k => $val) {
|
|
|
$post[$k] = urldecode($val);
|
|
|
}
|
|
|
MtOrderClass::add($post);
|
|
|
- //noticeUtil::push("666", '15280215347');
|
|
|
$detail = $post['detail'] ?? '';
|
|
|
if (empty($detail)) {
|
|
|
noticeUtil::push("美团确认订单报错,没有找到商品,美团订单id:{$mtOrderId} 美团编号:{$thirdSn}", '15280215347');
|
|
|
@@ -98,22 +90,18 @@ class MtController extends PublicController
|
|
|
noticeUtil::push("美团确认订单报错,没有找到商品哦,美团订单id:{$mtOrderId} 美团编号:{$thirdSn}", '15280215347');
|
|
|
return Json::encode(['data' => 'ok']);
|
|
|
}
|
|
|
- //noticeUtil::push("777", '15280215347');
|
|
|
Yii::info('商品信息:' . json_encode($mtGoodsData));
|
|
|
- //noticeUtil::push("717171", '15280215347');
|
|
|
$productList = [];
|
|
|
|
|
|
$mtCategory = CategoryClass::getByCondition(['mainId' => $mainId, 'style' => 1], true);
|
|
|
if (empty($mtCategory)) {
|
|
|
$mtCategory = CategoryClass::add(['style' => 1, 'categoryName' => '美团', 'mainId' => $mainId, 'sjId' => $sjId], true);
|
|
|
}
|
|
|
- //noticeUtil::push("727272", '15280215347');
|
|
|
$catId = $mtCategory->id ?? 0;
|
|
|
if (empty($catId)) {
|
|
|
noticeUtil::push("美团确认订单报错,美团默认分类没有找到,美团订单id:{$mtOrderId} 美团编号:{$thirdSn}", '15280215347');
|
|
|
return Json::encode(['data' => 'ok']);
|
|
|
}
|
|
|
- //noticeUtil::push("888", '15280215347');
|
|
|
$caution = isset($post['caution']) && !empty($post['caution']) ? $post['caution'] : '';
|
|
|
$remark = $caution;
|
|
|
|
|
|
@@ -147,7 +135,6 @@ class MtController extends PublicController
|
|
|
$goods = [['productId' => $id, 'num' => $num, 'unitType' => $unitType, 'unitPrice' => $goodsPrice, 'property' => $property]];
|
|
|
$productList = array_merge($goods, $productList);
|
|
|
}
|
|
|
- //noticeUtil::push("999", '15280215347');
|
|
|
$poi_receive_detail_yuan = $post['poi_receive_detail_yuan'] ?? '';
|
|
|
if (empty($poi_receive_detail_yuan)) {
|
|
|
noticeUtil::push("美团确认订单报错,订单金额有问题,美团订单id:{$mtOrderId} 美团编号:{$thirdSn}", '15280215347');
|
|
|
@@ -184,7 +171,6 @@ class MtController extends PublicController
|
|
|
$reachPeriod = date("H:i", $estimate_arrival_time);
|
|
|
$reachDate = date("Y-m-d", $estimate_arrival_time);
|
|
|
$reachTime = $estimate_arrival_time;
|
|
|
- //noticeUtil::push("1212", '15280215347');
|
|
|
$orderData = [
|
|
|
'product' => $productList,
|
|
|
'fromType' => dict::getDict('fromType', 'mt'),
|
|
|
@@ -209,12 +195,10 @@ class MtController extends PublicController
|
|
|
'thirdOrderId' => $mtOrderId,
|
|
|
];
|
|
|
$hasPay = dict::getDict('hasPay', 'payed');
|
|
|
- //noticeUtil::push("1313", '15280215347');
|
|
|
$order = OrderService::createFinishOrder($orderData, $custom, $hasPay);
|
|
|
|
|
|
$transaction->commit();
|
|
|
|
|
|
- //noticeUtil::push("101010", '15280215347');
|
|
|
//新制作单提示
|
|
|
$shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], true);
|
|
|
ShopExtClass::newWorkRemind($shopExt, $order);
|