|
|
@@ -255,48 +255,6 @@ class MtController extends PublicController
|
|
|
return Json::encode(['data' => 'ok']);
|
|
|
}
|
|
|
return Json::encode(['data' => 'ok']);
|
|
|
-
|
|
|
- Yii::warning('newOrder2: ' . json_encode($post));
|
|
|
- // 美团传入的订单数据,中文是 URL_encode 的,执行下解密
|
|
|
- foreach ($post as $k => $val) {
|
|
|
- $post[$k] = urldecode($val);
|
|
|
- }
|
|
|
-
|
|
|
- $data = arrayUtil::humpUnderlineConversion($post, 1);
|
|
|
- Yii::warning('newOrder: ' . urldecode(json_encode($data))); // 想要知道美团请求中带过来哪些参数,查看此日志输出
|
|
|
- $orderId = $data['orderId'];
|
|
|
- $mtOrder = MtOrderClass::getByCondition(['orderId' => $orderId]);
|
|
|
- if (!empty($mtOrder)) {
|
|
|
- Yii::warning('订单号已存在:' . $orderId);
|
|
|
- return Json::encode(['data' => 'ok']);
|
|
|
- }
|
|
|
-
|
|
|
- // TODO 通过 app_poi_code 查询批发商的美团商家帐号,获取 access_token 与 refresh_token
|
|
|
- // TODO 做到上一步,要实现好批发商把他的美团商家账号授权给花掌柜
|
|
|
-
|
|
|
- $mtOrder = MtOrderClass::add($data);
|
|
|
-
|
|
|
- $picArr = [];
|
|
|
- $app = new Application($this->config);
|
|
|
- $detail = $data['detail'];
|
|
|
- $items = json_decode($detail, true);
|
|
|
- foreach ($items as $item) {
|
|
|
- $mtGoodsSpu = $item['app_spu_code'];
|
|
|
-
|
|
|
- // access_token 是商家授权后,获取到的
|
|
|
- $params = ['app_poi_code' => $data['appPoiCode'], 'app_spu_code' => $mtGoodsSpu, 'access_token' => 'token_pOgHs0-h06JUsIrMJ3ZKyQ'];
|
|
|
- $mgGoodsDetail = $app->retail->getDetail($params);
|
|
|
- $mgGoodsDetail = json_decode($mgGoodsDetail, true);
|
|
|
- if (isset($mgGoodsDetail['error'])) {
|
|
|
- Yii::error('get retail fail:' . json_encode($params));
|
|
|
- } else {
|
|
|
- $picArr[$mtGoodsSpu] = $mgGoodsDetail['data']['picture'];
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Yii::info('picture: ' . json_encode($picArr)); // 订单商品图片
|
|
|
-
|
|
|
- return Json::encode(['data' => 'ok']);
|
|
|
}
|
|
|
|
|
|
public function actionCancelOrder()
|