Shopify:卸载Web挂机响应后如何快速删除数据库条目,以便商人快速卸载并重新安装? [英] Shopify: How to delete database entry fast after uninstall web-hook response, so the merchant uninstall and re-install quickly?

查看:141
本文介绍了Shopify:卸载Web挂机响应后如何快速删除数据库条目,以便商人快速卸载并重新安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在callbackController.php文件中的代码

This is my code in callbackController.php file

$url = 'https://' . $_GET['shop'] . '/admin/webhooks.json';                    
$webhookData = [
    'webhook' => [
        'topic' => 'app/uninstalled',
        'address' => config('app.url').'uninstall.php?shop='.$shop,
        'format' => 'json'
    ]
];
$uninstall = $sh->appUninstallHook($accessToken, $url, $webhookData);

这是我的uninstall.php文件代码,这些文件位于laravel根文件夹中.

This is my uninstall.php file code , these file is in laravel root folder.

$connection = new mysqli("localhost", "username", "******", "database");
$delete_shop = "DELETE FROM tablename WHERE store_name= '".$_GET['shop']."'";
$connection->query($delete_shop);    

我找到了解决方法

I found solution here, but i can't understand how it works.

谢谢!!

推荐答案

如果您获得了Webhook卸载,则无需急于在重新安装商家之前从数据库中突然删除商店.

If you get an uninstall Webhook, there is no rush to suddenly delete the store from your DB before the merchant re-installs.

首先,除非真正异常,否则商家不会卸载重新安装的Apps.大多数只是卸载,再也不会回来.

First off, merchants don't uninstall re-install Apps unless they are really outliers. Most just uninstall and never come back.

第二,如果商人确实卸载了然后重新安装,并且您识别了他们的商店,那么他们将使用新令牌来找您.因此,您可以说这是一个新安装,因此您可以决定保留相同的数据,只更新令牌,或者做任何您想做的事情.

Second, if a merchant did uninstall, and then re-install, and you recognized their shop, they would be coming to you with a new token. You can therefore tell that this is a new install, and you could therefore decide to keep the same data, and just update the token, or do whatever you want.

但是不必急于删除.那就是你是Frogger游戏中的青蛙:)

But there is no need to rush to delete. That is you being the frog in the game Frogger :)

这篇关于Shopify:卸载Web挂机响应后如何快速删除数据库条目,以便商人快速卸载并重新安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆