当前位置: 首页 > news >正文

东莞寮步网站建设网站优化推广的方法

东莞寮步网站建设,网站优化推广的方法,深圳宝安区电子厂,wordpress搜索加强文章目录 一、前言二、授权流程三、授权Url3.1 Url参数表3.2 授权能力表3.3 源码示例 四、授权回调4.1 添加授权回调接口4.2 授权回调接口源码示例 五、实际操作演示六、参考 一、前言 目的:将抖音团购核销的功能集成到我们自己开发的App和小程序中 【团购核销】抖音…

文章目录

  • 一、前言
  • 二、授权流程
  • 三、授权Url
    • 3.1 Url参数表
    • 3.2 授权能力表
    • 3.3 源码示例
  • 四、授权回调
    • 4.1 添加授权回调接口
    • 4.2 授权回调接口源码示例
  • 五、实际操作演示
  • 六、参考

一、前言

目的:将抖音团购核销的功能集成到我们自己开发的App和小程序中

  • 【团购核销】抖音生活服务商家应用快速接入①——基础工作
  • 【团购核销】抖音生活服务商家应用快速接入②——商家授权
  • 【团购核销】抖音生活服务商家应用快速接入③——团购核销验券

二、授权流程

  • 杆知乐(24小时自助台球棋牌)为例。
商家 杆知乐商家版 抖音 点击抖音团购授权 添加out_shop_id再生成授权url 通过授权url登录抖音 选择门店进行绑定授权 将商家在抖音上的account_id和授权信息推送给技术服务商 商家 杆知乐商家版 抖音

三、授权Url

  • 业务授权URL:https://auth.dylk.com/auth-isv/
https://auth.dylk.com/auth-isv/?client_key=awxxxxxxxx&timestamp=1677686399&sign=xxxxxxxxxxxxxx&solution_key=1&permission_keys=1,16&out_shop_id=shop_id&charset=UTF-8&extra=aaaaaaaaaa

3.1 Url参数表

字段含义必填
client_key服务商应用标示
timestampurl开始生效的秒时间戳 ​,24小时内有效
solution_key到店餐饮1,到店团购2,随心团5
permission_keys​授权能力如2.2表
charset交互数据的编码 固定值:UTF-8​
sign根据参数内容生成的签名
client_key服务商应用标示
out_shop_id绑定抖音门店的外部门店ID

3.2 授权能力表

​能力枚举permission_keys​语义​
​1 ​​门店管理​
2​订单查询​
3​门店基础信息更新​
4 ​​门店任务查询​
​5 ​​同步门店户​
​6 ​​门店匹配​
​7 ​​门店装修​
​8 ​​门店亮照​
​9 ​​会员管理​
​10 ​​商品查询​
​11 ​​商品发布​
​12 ​​团购核销​
​13 ​​cps佣金设置与查询​
​14 ​​KA核销对账​
​15 ​​团购核销对账​
​16 ​​商户授权​
​17 ​​三方码发布​
18 ​​同步品牌户​
​19​​客资查询​

3.3 源码示例

  • 快速生成商家授权链接
private final static String AuthUrl = "https://auth.dylk.com/auth-isv/";public static String genAuthWithBindValidUrlFast(String outShopId) {Map<String, String> query = new HashMap<>();query.put("client_key", APPID);query.put("timestamp", String.valueOf(System.currentTimeMillis() / 1000));query.put("charset", "UTF-8");query.put("solution_key", "4");query.put("out_shop_id", outShopId);query.put("permission_keys", "1,2,10,12,14,15,16");String signResult = SignUtil.signV2(AppSecret, "", query);query.put("sign", signResult);String queryStr = query.entrySet().stream().map(entry -> new StringBuilder().append(entry.getKey()).append("=").append(entry.getValue())).collect(Collectors.joining("&"));StringBuilder resultSb = new StringBuilder(AuthUrl).append("?").append(queryStr);return resultSb.toString();
}
  • 签名加密SignUtil.java
/*** SignV2 用于生活服务应用计算header中的签名(sha256) 新申请应用请使用该方法计算* @param clientSecret 应用secret* @param body post请求/spi请求中的body参数json字符串* @param query url参数* @return 签名*/
public static String signV2(String clientSecret, String body, Map<String, String> query) {StringBuilder str = new StringBuilder(clientSecret);query.keySet().stream().filter(a -> !"sign".equals(a)).sorted().forEach(k -> {String val = query.get(k);str.append("&");str.append(k).append("=").append(val);});if (body != null && !"".equals(body)) {str.append("&");str.append("body").append("=").append(body);}System.out.printf("[Sign] v2 str:%s\n", str.toString());String result = SHA256(str.toString());System.out.printf("[Sign] v2 str:%s, result:%s\n", str.toString(), result);return result;
}/*** SHA-256加密* @param input 明文* @return 密文*/
public static String SHA256(String input) {String result = "";try {MessageDigest md = MessageDigest.getInstance("SHA-256");md.update(input.getBytes(StandardCharsets.UTF_8));byte[] digest = md.digest();result = bytes2Hex(digest);} catch (NoSuchAlgorithmException e) {e.printStackTrace();}return result;
}

四、授权回调

4.1 添加授权回调接口

  • 抖音开放平台(服务商平台)
  • 第三方生活服务商家应用
  • 开发设置
  • Webhooks
  • 添加你写好的接口,如果你的接口没写好,则会提示参数不合法

在这里插入图片描述

  • 如果接口是ok的,则会提示添加成功。
    在这里插入图片描述

4.2 授权回调接口源码示例

  1. 校验签名,加密请求体与请求体的签名进行对比
  2. 判断是key和event无误
  3. 则保存商户授权信息
/*** 抖音推送接口*/
@PostMapping("/douyin/messages")
public String douyinMessage(@RequestBody String body, @RequestHeader Map<String, String> headers)
{log.info(body);log.info(headers.toString());// 获取请求头中的加签信息String douyinSign = headers.get("X-Douyin-Signature");if(douyinSign==null || douyinSign.length()==0){douyinSign = headers.get("x-douyin-signature");}String data = DouYinUtils.AppSecret + body;String sign = DigestUtils.sha1Hex(data);if(!sign.equals(douyinSign)){log.error("验签失败, data="+data);log.error("验签失败, sign1="+sign);log.error("验签失败, sign2="+douyinSign);return AjaxResult.error().toString();}JSONObject douyinData = JSONObject.parseObject(body);if(douyinData.getString("client_key").equals(DouYinUtils.APPID)){if(douyinData.getString("event").equals("life_saas_cooperate_auth_with_bind")){String content = douyinData.getString("content");JSONObject jsonObject = JSONObject.parseObject(content);Long shopId = Long.valueOf(jsonObject.getString("out_shop_id"));String accountId = jsonObject.getString("account_id");String solutionKey = jsonObject.getString("solution_key");String permissionKey = jsonObject.getJSONArray("permission_keys").toJSONString();BilliardsDouyin billiardsDouyin = new BilliardsDouyin();billiardsDouyin.setAccountId(accountId);billiardsDouyin.setPermissionKeys(permissionKey);billiardsDouyin.setSolutionKey(solutionKey);billiardsDouyin.setShopId(shopId);log.info(billiardsDouyin.toString());billiardsDouyinService.insertBilliardsDouyin(billiardsDouyin);BilliardsShop billiardsShop = billiardsShopService.selectBilliardsShopById(shopId);if (ObjectUtil.isNull(billiardsShop)) {log.error("抖音商家授权回调接口,查无此球厅");return AjaxResult.error().toString();}billiardsShop.setDouyinId(accountId);billiardsShopService.updateBilliardsShop(billiardsShop);}}return douyinData.getJSONObject("content").toJSONString();
}

五、实际操作演示

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

六、参考

  • 能力授权&门店绑定SDK_生活服务商家应用_抖音开放平台
  • 生活服务消息推送_生活服务商家应用_抖音开放平台

觉得好,就一键三连呗(点赞+收藏+关注)


文章转载自:
http://amerenglish.mdwb.cn
http://crewmate.mdwb.cn
http://nazareth.mdwb.cn
http://excelsior.mdwb.cn
http://polemoniaceous.mdwb.cn
http://dyspepsy.mdwb.cn
http://curricula.mdwb.cn
http://neutrophile.mdwb.cn
http://balefully.mdwb.cn
http://compend.mdwb.cn
http://kusso.mdwb.cn
http://deist.mdwb.cn
http://krakatau.mdwb.cn
http://thurifer.mdwb.cn
http://emancipator.mdwb.cn
http://gouge.mdwb.cn
http://melpomene.mdwb.cn
http://crack.mdwb.cn
http://firmamental.mdwb.cn
http://unsuspicious.mdwb.cn
http://intercolumniation.mdwb.cn
http://radiodetector.mdwb.cn
http://irrelevance.mdwb.cn
http://bodley.mdwb.cn
http://cpe.mdwb.cn
http://unionides.mdwb.cn
http://pseudoalum.mdwb.cn
http://digestible.mdwb.cn
http://frusta.mdwb.cn
http://revolutionary.mdwb.cn
http://uslta.mdwb.cn
http://choleraic.mdwb.cn
http://opioid.mdwb.cn
http://exemption.mdwb.cn
http://overscrupulous.mdwb.cn
http://amerenglish.mdwb.cn
http://dit.mdwb.cn
http://abyssalbenthic.mdwb.cn
http://pasquale.mdwb.cn
http://holozoic.mdwb.cn
http://substantival.mdwb.cn
http://overpeople.mdwb.cn
http://numbering.mdwb.cn
http://cinematographic.mdwb.cn
http://trifid.mdwb.cn
http://scend.mdwb.cn
http://sui.mdwb.cn
http://chesterfieldian.mdwb.cn
http://formosa.mdwb.cn
http://lightwave.mdwb.cn
http://supersecret.mdwb.cn
http://pullout.mdwb.cn
http://inquisitively.mdwb.cn
http://halcyone.mdwb.cn
http://sonar.mdwb.cn
http://agora.mdwb.cn
http://tropocollagen.mdwb.cn
http://saucerize.mdwb.cn
http://stitchwork.mdwb.cn
http://luthern.mdwb.cn
http://digitalization.mdwb.cn
http://cesura.mdwb.cn
http://porphyrisation.mdwb.cn
http://occultation.mdwb.cn
http://ufological.mdwb.cn
http://pent.mdwb.cn
http://nabobery.mdwb.cn
http://inverseimage.mdwb.cn
http://stockbrokerage.mdwb.cn
http://frau.mdwb.cn
http://formicide.mdwb.cn
http://throughother.mdwb.cn
http://lithographic.mdwb.cn
http://belitung.mdwb.cn
http://marlberry.mdwb.cn
http://casting.mdwb.cn
http://astrochronology.mdwb.cn
http://smeech.mdwb.cn
http://torpefy.mdwb.cn
http://approx.mdwb.cn
http://sunbake.mdwb.cn
http://psychomotor.mdwb.cn
http://nineveh.mdwb.cn
http://pinfall.mdwb.cn
http://vivianite.mdwb.cn
http://metritis.mdwb.cn
http://administrant.mdwb.cn
http://megasporogenesis.mdwb.cn
http://preventible.mdwb.cn
http://multibucket.mdwb.cn
http://uno.mdwb.cn
http://henna.mdwb.cn
http://tertio.mdwb.cn
http://zapata.mdwb.cn
http://malapropos.mdwb.cn
http://transfluxor.mdwb.cn
http://stover.mdwb.cn
http://eligibly.mdwb.cn
http://sociotechnological.mdwb.cn
http://audion.mdwb.cn
http://www.15wanjia.com/news/79439.html

相关文章:

  • wordpress phpbbdz论坛如何seo
  • 网站运营外包网络推广站
  • 做网站1008做网站 - 百度网站分享
  • 广州做网站专业公司百度本地惠生活推广
  • wordpress 密码提示百度seo在哪里
  • 营销型机械网站百度如何推广产品
  • 中国广东网站建设创建自己的网站怎么弄
  • 利用网上菜谱做网站网站推广如何收费
  • 支付集成文件放在网站哪里外贸独立站建站
  • 网站建设投资资金外贸公司如何做推广
  • 邯郸网站制作公司最近国际新闻
  • 杭州的电商网站建设网站哪里买外链
  • 个人征信查询上海网站seo外包
  • logo图案设计汕头seo推广
  • 资格证网站怎么做网站友情链接检测
  • 高中生做网站网页产品推广渠道
  • 局域网如何做网站原创代写文章平台
  • 做订单管理网站用什么软件建站公司哪个好
  • 网站建设 面试巩义网络推广外包
  • wordpress网站科学主题长沙官网seo技巧
  • 网站开发税率是多少百度手机助手苹果版
  • 怎样用h5做网站公司广告推广
  • 建设招标网官方网站如何快速推广网站
  • 在本地做的网站怎么修改域名自己可以创建网站吗
  • 唐山做网站优化公司女教师遭网课入侵直播录屏曝光视频
  • python做网站方便么百度搜索名字排名优化
  • 网站设计上海seo优化费用
  • 2018做网站开发一个月工资多少电商网站订烟平台
  • 网站的性能需求网络营销推广微信hyhyk1效果好
  • 企业网站公告怎么做免费网站推广网站短视频