|
|
@@ -143,8 +143,27 @@ class DeliveryController extends BaseController
|
|
|
// 有平台有对应的取消授权接口,有的没有。
|
|
|
// 有的就对接下,然后再删除数据。没有的直接删除数据就行。
|
|
|
$platform = Yii::$app->request->get('platform');
|
|
|
+ $delivery = DeliveryAuthTokenClass::getByCondition(['mainId'=>$this->mainId, 'platform'=>$platform]);
|
|
|
+ if($delivery) {
|
|
|
+ if($platform == 'shansong') {
|
|
|
+ $auth = new \common\components\delivery\platform\shansong\Auth();
|
|
|
+ $result = $auth->cancelAuthorization($delivery['accessToken']);
|
|
|
+ if($result['success']) {
|
|
|
+ // 授权已取消
|
|
|
+ }else{
|
|
|
+ if($result['message'] == '商户未授权,请授权后再次尝试'){
|
|
|
+ Yii::info($this->mainId . '--商户未授权,请授权后再次尝试');
|
|
|
+ }else{
|
|
|
+ util::fail('取消授权失败:'.$result['message']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ util::fail('取消授权失败,数据未找到');
|
|
|
+ }
|
|
|
+
|
|
|
$ret = DeliveryAuthTokenClass::deleteByCondition(['mainId'=>$this->mainId, 'platform'=>$platform]);
|
|
|
- if($ret > 0) {
|
|
|
+ if($ret > 0){
|
|
|
util::success(['message'=>'取消授权成功']);
|
|
|
} else {
|
|
|
util::fail('取消授权失败');
|