|
|
@@ -24,15 +24,26 @@ class MtController extends PublicController
|
|
|
echo '开发中...';
|
|
|
}
|
|
|
|
|
|
+ //已确认订单通知
|
|
|
+ public function actionConfirmOrder()
|
|
|
+ {
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ if (empty($post)) { // 无数据过来时,是美团对接口进行存活试探,请保留此段代码,好让请求在此被中断返回
|
|
|
+ return Json::encode(['data' => 'ok']);
|
|
|
+ }
|
|
|
+ $data = arrayUtil::humpUnderlineConversion($post, 1);
|
|
|
+ Yii::warning('confirmOrder: ' . urldecode(json_encode($data))); // 想要知道美团请求中带过来哪些参数,查看此日志输出
|
|
|
+ }
|
|
|
+
|
|
|
public function actionNewOrder()
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
- if(empty($post)) { // 无数据过来时,是美团对接口进行存活试探,请保留此段代码,好让请求在此被中断返回
|
|
|
+ if (empty($post)) { // 无数据过来时,是美团对接口进行存活试探,请保留此段代码,好让请求在此被中断返回
|
|
|
return Json::encode(['data' => 'ok']);
|
|
|
}
|
|
|
|
|
|
// 美团传入的订单数据,中文是 URL_encode 的,执行下解密
|
|
|
- foreach($post as $k => $val) {
|
|
|
+ foreach ($post as $k => $val) {
|
|
|
$post[$k] = urldecode($val);
|
|
|
}
|
|
|
|
|
|
@@ -54,7 +65,7 @@ class MtController extends PublicController
|
|
|
$app = new Application($this->config);
|
|
|
$detail = $data['detail'];
|
|
|
$items = json_decode($detail, true);
|
|
|
- foreach($items as $item){
|
|
|
+ foreach ($items as $item) {
|
|
|
$appSpuCode = $item['app_spu_code'];
|
|
|
|
|
|
// access_token 是商家授权后,获取到的
|
|
|
@@ -62,7 +73,7 @@ class MtController extends PublicController
|
|
|
$retailDetail = $app->retail->getDetail($params);
|
|
|
$retailDetail = json_decode($retailDetail, true);
|
|
|
if (isset($retailDetail['error'])) {
|
|
|
- Yii::error('get retail fail:' . json_encode($params));
|
|
|
+ Yii::error('get retail fail:' . json_encode($params));
|
|
|
} else {
|
|
|
$picArr[$appSpuCode] = $retailDetail['data']['picture'];
|
|
|
}
|
|
|
@@ -76,14 +87,17 @@ class MtController extends PublicController
|
|
|
public function actionCancelOrder()
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
- if(!empty($post)) {
|
|
|
- Yii::warning('cancelOrder: ' . urldecode(json_encode($post)));
|
|
|
+ if (empty($post)) {
|
|
|
+ return Json::encode(['data' => 'ok']);
|
|
|
}
|
|
|
|
|
|
+ Yii::warning('cancelOrder: ' . urldecode(json_encode($post)));
|
|
|
+
|
|
|
return Json::encode(['data' => 'ok']);
|
|
|
}
|
|
|
|
|
|
- public function demo() {
|
|
|
+ public function demo()
|
|
|
+ {
|
|
|
$app = new Application($this->config);
|
|
|
|
|
|
$params = ['order_id' => '27061900338318741', 'is_mt_logistics' => 1];
|